PageSourceSearch

https://rainfactory.ai/assets/index-DVqYXXq7.js

js rainfactory.ai collected 2026-10-05 14:38:54 UTC 3,891,045 bytes, 2,149 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index.es-DMoiouQ2.js","assets/ui-vendor-Pu0cN9S7.js","assets/AnonymousOnboarding-BsMewnS4.js","assets/AboutUs-DZXFekXQ.js","assets/rocket-C4i1VVtu.js","assets/Services-D7FFSJJv.js","assets/Products-Be6dNP1R.js","assets/connect_to_everything-BlfMWnym.js","assets/Contact-DPk9iSEL.js","assets/Careers-CwKRq27E.js","assets/PrivacyPolicy-Dq0i-2Oi.js","assets/TermsOfService-sNyUvB4K.js","assets/CookieSettings-CwZy0-dk.js","assets/Lander1-DVkMx8XC.js","assets/convergence-BFEvpEHG.js","assets/Blog-DQOs4I6E.js","assets/slug-utils-DU6uXJgO.js","assets/BlogPost-bGJhnP_H.js","assets/usePublicContent-BfrQAWnI.js","assets/LandingPage-BddiSiVP.js","assets/BrandPreview-D1OVqlFF.js","assets/PublicContentView-De3RIqkd.js","assets/AiSocialMediaContentGenerator-C7tLDuup.js","assets/AutomatedSocialMediaPosting-CNYvjJ5t.js","assets/SocialMediaScheduler-DPACB536.js"])))=>i.map(i=>d[i]);
2var Fde=Object.defineProperty;var Lde=(e,t,r)=>t in e?Fde(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Yt=(e,t,r)=>Lde(e,typeof t!="symbol"?t+"":t,r);import{r as rd,a as g,R as Qv,_ as Dde,b as T_,j as n,c as oe,O as by,P as uI,C as yy,d as P_,T as wy,D as jy,e as hI,f as QG,u as zr,g as lo,h as sr,i as yt,k as I_,l as Ki,m as fI,A as Ny,n as co,o as O_,p as tf,q as rf,s as F_,t as $o,v as HG,w as zG,x as VG,F as GG,y as L_,z as D_,B as Xg,E as R_,G as U_,H as xo,I as Nh,J as wn,K as qG,L as KG,M as M_,N as Rde,Q as Ude,S as Mde,U as WG,V as YG,W as $de,X as JG,Y as XG,Z as ZG,$ as eq,a0 as tq,a1 as rq,a2 as nq,a3 as Qde,a4 as Hde,a5 as zde,a6 as Vde,a7 as Gde,a8 as qde,a9 as sq}from"./ui-vendor-Pu0cN9S7.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))s(a);new MutationObserver(a=>{for(const i of a)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&s(o)}).observe(document,{childList:!0,subtree:!0});function r(a){const i={};return a.integrity&&(i.integrity=a.integrity),a.referrerPolicy&&(i.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?i.credentials="include":a.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function s(a){if(a.ep)return;a.ep=!0;const i=r(a);fetch(a.href,i)}})();var G4={},TD=rd;G4.createRoot=TD.createRoot,G4.hydrateRoot=TD.hydrateRoot;const Kde="modulepreload",Wde=function(e){return"/"+e},PD={},hs=function(t,r,s){let a=Promise.resolve();if(r&&r.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),l=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));a=Promise.allSettled(r.map(c=>{if(c=Wde(c),c in PD)return;PD[c]=!0;const d=c.endsWith(".css"),u=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${u}`))return;const h=document.createElement("link");if(h.rel=d?"stylesheet":Kde,d||(h.as="script"),h.crossOrigin="",h.href=c,l&&h.setAttribute("nonce",l),document.head.appendChild(h),d)return new Promise((m,f)=>{h.addEventListener("load",m),h.addEventListener("error",()=>f(new Error(`Unable to preload CSS for ${c}`)))})}))}function i(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return a.then(o=>{for(const l of o||[])l.status==="rejected"&&i(l.reason);return t().catch(i)})};/**
3 * @remix-run/router v1.23.2
4 *
5 * Copyright (c) Remix Software Inc.
6 *
7 * This source code is licensed under the MIT license found in the
8 * LICENSE.md file in the root directory of this source tree.
9 *
10 * @license MIT
11 */function Hv(){return Hv=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];
vendor: 9,300 bytes, lines 11-20
11for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},Hv.apply(this,arguments)}var _h;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(_h||(_h={}));const ID="popstate";function Yde(e){e===void 0&&(e={});function t(s,a){let{pathname:i,search:o,hash:l}=s.location;return q4("",{pathname:i,search:o,hash:l},a.state&&a.state.usr||null,a.state&&a.state.key||"default")}function r(s,a){return typeof a=="string"?a:Jj(a)}return Xde(t,r,null,e)}function na(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function mI(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function Jde(){return Math.random().toString(36).substr(2,8)}function OD(e,t){return{usr:e.state,key:e.key,idx:t}}function q4(e,t,r,s){return r===void 0&&(r=null),Hv({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?Zg(t):t,{state:r,key:t&&t.key||s||Jde()})}function Jj(e){let{pathname:t="/",search:r="",hash:s=""}=e;return r&&r!=="?"&&(t+=r.charAt(0)==="?"?r:"?"+r),s&&s!=="#"&&(t+=s.charAt(0)==="#"?s:"#"+s),t}function Zg(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substr(r),e=e.substr(0,r));let s=e.indexOf("?");s>=0&&(t.search=e.substr(s),e=e.substr(0,s)),e&&(t.pathname=e)}return t}function Xde(e,t,r,s){s===void 0&&(s={});let{window:a=document.defaultView,v5Compat:i=!1}=s,o=a.history,l=_h.Pop,c=null,d=u();d==null&&(d=0,o.replaceState(Hv({},o.state,{idx:d}),""));function u(){return(o.state||{idx:null}).idx}function h(){l=_h.Pop;let v=u(),x=v==null?null:v-d;d=v,c&&c({action:l,location:A.location,delta:x})}function m(v,x){l=_h.Push;let b=q4(A.location,v,x);d=u()+1;let y=OD(b,d),w=A.createHref(b);try{o.pushState(y,"",w)}catch(j){if(j instanceof DOMException&&j.name==="DataCloneError")throw j;a.location.assign(w)}i&&c&&c({action:l,location:A.location,delta:1})}function f(v,x){l=_h.Replace;let b=q4(A.location,v,x);d=u();let y=OD(b,d),w=A.createHref(b);o.replaceState(y,"",w),i&&c&&c({action:l,location:A.location,delta:0})}function p(v){let x=a.location.origin!=="null"?a.location.origin:a.location.href,b=typeof v=="string"?v:Jj(v);return b=b.replace(/ $/,"%20"),na(x,"No window.location.(origin|href) available to create URL for href: "+b),new URL(b,x)}let A={get action(){return l},get location(){return e(a,o)},listen(v){if(c)throw new Error("A history only accepts one active listener");return a.addEventListener(ID,h),c=v,()=>{a.removeEventListener(ID,h),c=null}},createHref(v){return t(a,v)},createURL:p,encodeLocation(v){let x=p(v);return{pathname:x.pathname,search:x.search,hash:x.hash}},push:m,replace:f,go(v){return o.go(v)}};return A}var FD;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(FD||(FD={}));function Zde(e,t,r){return r===void 0&&(r="/"),eue(e,t,r)}function eue(e,t,r,s){let a=typeof t=="string"?Zg(t):t,i=pI(a.pathname||"/",r);if(i==null)return null;let o=aq(e);tue(o);let l=null;for(let c=0;l==null&&c<o.length;++c){let d=fue(i);l=due(o[c],d)}return l}function aq(e,t,r,s){t===void 0&&(t=[]),r===void 0&&(r=[]),s===void 0&&(s="");let a=(i,o,l)=>{let c={relativePath:l===void 0?i.path||"":l,caseSensitive:i.caseSensitive===!0,childrenIndex:o,route:i};c.relativePath.startsWith("/")&&(na(c.relativePath.startsWith(s),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+s+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(s.length));let d=Ih([s,c.relativePath]),u=r.concat(c);i.children&&i.children.length>0&&(na(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+d+'".')),aq(i.children,t,u,d)),!(i.path==null&&!i.index)&&t.push({path:d,score:lue(d,i.index),routesMeta:u})};return e.forEach((i,o)=>{var l;if(i.path===""||!((l=i.path)!=null&&l.includes("?")))a(i,o);else for(let c of iq(i.path))a(i,o,c)}),t}function iq(e){let t=e.split("/");if(t.length===0)return[];let[r,...s]=t,a=r.endsWith("?"),i=r.replace(/\?$/,"");if(s.length===0)return a?[i,""]:[i];let o=iq(s.join("/")),l=[];return l.push(...o.map(c=>c===""?i:[i,c].join("/"))),a&&l.push(...o),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function tue(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:cue(t.routesMeta.map(s=>s.childrenIndex),r.routesMeta.map(s=>s.childrenIndex)))}const rue=/^:[\w-]+$/,nue=3,sue=2,aue=1,iue=10,oue=-2,LD=e=>e==="*";function lue(e,t){let r=e.split("/"),s=r.length;return r.some(LD)&&(s+=oue),t&&(s+=sue),r.filter(a=>!LD(a)).reduce((a,i)=>a+(rue.test(i)?nue:i===""?aue:iue),s)}function cue(e,t){return e.length===t.length&&e.slice(0,-1).every((s,a)=>s===t[a])?e[e.length-1]-t[t.length-1]:0}function due(e,t,r){let{routesMeta:s}=e,a={},i="/",o=[];for(let l=0;l<s.length;++l){let c=s[l],d=l===s.length-1,u=i==="/"?t:t.slice(i.length)||"/",h=uue({path:c.relativePath,caseSensitive:c.caseSensitive,end:d},u),m=c.route;if(!h)return null;Object.assign(a,h.params),o.push({params:a,pathname:Ih([i,h.pathname]),pathnameBase:xue(Ih([i,h.pathnameBase])),route:m}),h.pathnameBase!=="/"&&(i=Ih([i,h.pathnameBase]))}return o}function uue(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,s]=hue(e.path,e.caseSensitive,e.end),a=t.match(r);if(!a)return null;let i=a[0],o=i.replace(/(.)\/+$/,"$1"),l=a.slice(1);return{params:s.reduce((d,u,h)=>{let{paramName:m,isOptional:f}=u;if(m==="*"){let A=l[h]||"";o=i.slice(0,i.length-A.length).replace(/(.)\/+$/,"$1")}const p=l[h];return f&&!p?d[m]=void 0:d[m]=(p||"").replace(/%2F/g,"/"),d},{}),pathname:i,pathnameBase:o,pattern:e}}function hue(e,t,r){t===void 0&&(t=!1),r===void 0&&(r=!0),mI(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let s=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,l,c)=>(s.push({paramName:l,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(s.push({paramName:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),s]}function fue(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return mI(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function pI(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,s=e.charAt(r);return s&&s!=="/"?null:e.slice(r)||"/"}const mue=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,pue=e=>mue.test(e);function Aue(e,t){t===void 0&&(t="/");let{pathname:r,search:s="",hash:a=""}=typeof e=="string"?Zg(e):e,i;if(r)if(pue(r))i=r;else{if(r.includes("//")){let o=r;r=r.replace(/\/\/+/g,"/"),mI(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+r))}r.startsWith("/")?i=DD(r.substring(1),"/"):i=DD(r,t)}else i=t;return{pathname:i,search:vue(s),hash:bue(a)}}function DD(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(a=>{a===".."?r.length>1&&r.pop():a!=="."&&r.push(a)}),r.length>1?r.join("/"):"/"}function l5(e,t,r,s){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(s)+"].  Please separate it out to the ")+("`to."+r+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function gue(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function AI(e,t){let r=gue(e);return t?r.map((s,a)=>a===r.length-1?s.pathname:s.pathnameBase):r.map(s=>s.pathnameBase)}function gI(e,t,r,s){s===void 0&&(s=!1);let a;typeof e=="string"?a=Zg(e):(a=Hv({},e),na(!a.pathname||!a.pathname.includes("?"),l5("?","pathname","search",a)),na(!a.pathname||!a.pathname.includes("#"),l5("#","pathname","hash",a)),na(!a.search||!a.search.includes("#"),l5("#","search","hash",a)));let i=e===""||a.pathname==="",o=i?"/":a.pathname,l;if(o==null)l=r;else{let h=t.length-1;if(!s&&o.startsWith("..")){let m=o.split("/");for(;m[0]==="..";)m.shift(),h-=1;a.pathname=m.join("/")}l=h>=0?t[h]:"/"}let c=Aue(a,l),d=o&&o!=="/"&&o.endsWith("/"),u=(i||o===".")&&r.endsWith("/");return!c.pathname.endsWith("/")&&(d||u)&&(c.pathname+="/"),c}const Ih=e=>e.join("/").replace(/\/\/+/g,"/"),xue=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),vue=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,bue=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function yue(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const oq=["post","put","patch","delete"];new Set(oq);const wue=["get",...oq];new Set(wue);/**
12 * React Router v6.30.3
13 *
14 * Copyright (c) Remix Software Inc.
15 *
16 * This source code is licensed under the MIT license found in the
17 * LICENSE.md file in the root directory of this source tree.
18 *
19 * @license MIT
20 */function zv(){return zv=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];
20for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},zv.apply(this,arguments)}const xI=g.createContext(null),jue=g.createContext(null),nf=g.createContext(null),$_=g.createContext(null),yd=g.createContext({outlet:null,matches:[],isDataRoute:!1}),lq=g.createContext(null);function Nue(e,t){let{relative:r}=t===void 0?{}:t;e0()||na(!1);let{basename:s,navigator:a}=g.useContext(nf),{hash:i,pathname:o,search:l}=dq(e,{relative:r}),c=o;return s!=="/"&&(c=o==="/"?s:Ih([s,o])),a.createHref({pathname:c,search:l,hash:i})}function e0(){return g.useContext($_)!=null}function Gs(){return e0()||na(!1),g.useContext($_).location}function cq(e){g.useContext(nf).static||g.useLayoutEffect(e)}function xr(){let{isDataRoute:e}=g.useContext(yd);return e?Uue():_ue()}function _ue(){e0()||na(!1);let e=g.useContext(xI),{basename:t,future:r,navigator:s}=g.useContext(nf),{matches:a}=g.useContext(yd),{pathname:i}=Gs(),o=JSON.stringify(AI(a,r.v7_relativeSplatPath)),l=g.useRef(!1);return cq(()=>{l.current=!0}),g.useCallback(function(d,u){if(u===void 0&&(u={}),!l.current)return;if(typeof d=="number"){s.go(d);return}let h=gI(d,JSON.parse(o),i,u.relative==="path");e==null&&t!=="/"&&(h.pathname=h.pathname==="/"?t:Ih([t,h.pathname])),(u.replace?s.replace:s.push)(h,u.state,u)},[t,s,o,i,e])}const Cue=g.createContext(null);function Sue(e){let t=g.useContext(yd).outlet;return t&&g.createElement(Cue.Provider,{value:e},t)}function Ei(){let{matches:e}=g.useContext(yd),t=e[e.length-1];return t?t.params:{}}function dq(e,t){let{relative:r}=t===void 0?{}:t,{future:s}=g.useContext(nf),{matches:a}=g.useContext(yd),{pathname:i}=Gs(),o=JSON.stringify(AI(a,s.v7_relativeSplatPath));return g.useMemo(()=>gI(e,JSON.parse(o),i,r==="path"),[e,o,i,r])}function kue(e,t){return Eue(e,t)}function Eue(e,t,r,s){e0()||na(!1);let{navigator:a}=g.useContext(nf),{matches:i}=g.useContext(yd),o=i[i.length-1],l=o?o.params:{};o&&o.pathname;let c=o?o.pathnameBase:"/";o&&o.route;let d=Gs(),u;if(t){var h;let v=typeof t=="string"?Zg(t):t;c==="/"||(h=v.pathname)!=null&&h.startsWith(c)||na(!1),u=v}else u=d;let m=u.pathname||"/",f=m;if(c!=="/"){let v=c.replace(/^\//,"").split("/");f="/"+m.replace(/^\//,"").split("/").slice(v.length).join("/")}let p=Zde(e,{pathname:f}),A=Oue(p&&p.map(v=>Object.assign({},v,{params:Object.assign({},l,v.params),pathname:Ih([c,a.encodeLocation?a.encodeLocation(v.pathname).pathname:v.pathname]),pathnameBase:v.pathnameBase==="/"?c:Ih([c,a.encodeLocation?a.encodeLocation(v.pathnameBase).pathname:v.pathnameBase])})),i,r,s);return t&&A?g.createElement($_.Provider,{value:{location:zv({pathname:"/",search:"",hash:"",state:null,key:"default"},u),navigationType:_h.Pop}},A):A}function Bue(){let e=Rue(),t=yue(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,a={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return g.createElement(g.Fragment,null,g.createElement("h2",null,"Unexpected Application Error!"),g.createElement("h3",{style:{fontStyle:"italic"}},t),r?g.createElement("pre",{style:a},r):null,null)}const Tue=g.createElement(Bue,null);class Pue extends g.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,r){return r.location!==t.location||r.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:r.error,location:r.location,revalidation:t.revalidation||r.revalidation}}componentDidCatch(t,r){console.error("React Router caught the following error during render",t,r)}render(){return this.state.error!==void 0?g.createElement(yd.Provider,{value:this.props.routeContext},g.createElement(lq.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function Iue(e){let{routeContext:t,match:r,children:s}=e,a=g.useContext(xI);return a&&a.static&&a.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=r.route.id),g.createElement(yd.Provider,{value:t},s)}function Oue(e,t,r,s){var a;if(t===void 0&&(t=[]),r===void 0&&(r=null),s===void 0&&(s=null),e==null){var i;if(!r)return null;if(r.errors)e=r.matches;else if((i=s)!=null&&i.v7_partialHydration&&t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let o=e,l=(a=r)==null?void 0:a.errors;if(l!=null){let u=o.findIndex(h=>h.route.id&&(l==null?void 0:l[h.route.id])!==void 0);u>=0||na(!1),o=o.slice(0,Math.min(o.length,u+1))}let c=!1,d=-1;if(r&&s&&s.v7_partialHydration)for(let u=0;u<o.length;u++){let h=o[u];if((h.route.HydrateFallback||h.route.hydrateFallbackElement)&&(d=u),h.route.id){let{loaderData:m,errors:f}=r,p=h.route.loader&&m[h.route.id]===void 0&&(!f||f[h.route.id]===void 0);if(h.route.lazy||p){c=!0,d>=0?o=o.slice(0,d+1):o=[o[0]];break}}}return o.reduceRight((u,h,m)=>{let f,p=!1,A=null,v=null;r&&(f=l&&h.route.id?l[h.route.id]:void 0,A=h.route.errorElement||Tue,c&&(d<0&&m===0?(Mue("route-fallback"),p=!0,v=null):d===m&&(p=!0,v=h.route.hydrateFallbackElement||null)));let x=t.concat(o.slice(0,m+1)),b=()=>{let y;return f?y=A:p?y=v:h.route.Component?y=g.createElement(h.route.Component,null):h.route.element?y=h.route.element:y=u,g.createElement(Iue,{match:h,routeC
20ontext:{outlet:u,matches:x,isDataRoute:r!=null},children:y})};return r&&(h.route.ErrorBoundary||h.route.errorElement||m===0)?g.createElement(Pue,{location:r.location,revalidation:r.revalidation,component:A,error:f,children:b(),routeContext:{outlet:null,matches:x,isDataRoute:!0}}):b()},null)}var uq=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(uq||{}),hq=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(hq||{});function Fue(e){let t=g.useContext(xI);return t||na(!1),t}function Lue(e){let t=g.useContext(jue);return t||na(!1),t}function Due(e){let t=g.useContext(yd);return t||na(!1),t}function fq(e){let t=Due(),r=t.matches[t.matches.length-1];return r.route.id||na(!1),r.route.id}function Rue(){var e;let t=g.useContext(lq),r=Lue(),s=fq();return t!==void 0?t:(e=r.errors)==null?void 0:e[s]}function Uue(){let{router:e}=Fue(uq.UseNavigateStable),t=fq(hq.UseNavigateStable),r=g.useRef(!1);return cq(()=>{r.current=!0}),g.useCallback(function(a,i){i===void 0&&(i={}),r.current&&(typeof a=="number"?e.navigate(a):e.navigate(a,zv({fromRouteId:t},i)))},[e,t])}const RD={};function Mue(e,t,r){RD[e]||(RD[e]=!0)}function $ue(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function pu(e){let{to:t,replace:r,state:s,relative:a}=e;e0()||na(!1);let{future:i,static:o}=g.useContext(nf),{matches:l}=g.useContext(yd),{pathname:c}=Gs(),d=xr(),u=gI(t,AI(l,i.v7_relativeSplatPath),c,a==="path"),h=JSON.stringify(u);return g.useEffect(()=>d(JSON.parse(h),{replace:r,state:s,relative:a}),[d,h,a,r,s]),null}function mq(e){return Sue(e.context)}function Et(e){na(!1)}function Que(e){let{basename:t="/",children:r=null,location:s,navigationType:a=_h.Pop,navigator:i,static:o=!1,future:l}=e;e0()&&na(!1);let c=t.replace(/^\/*/,"/"),d=g.useMemo(()=>({basename:c,navigator:i,static:o,future:zv({v7_relativeSplatPath:!1},l)}),[c,l,i,o]);typeof s=="string"&&(s=Zg(s));let{pathname:u="/",search:h="",hash:m="",state:f=null,key:p="default"}=s,A=g.useMemo(()=>{let v=pI(u,c);return v==null?null:{location:{pathname:v,search:h,hash:m,state:f,key:p},navigationType:a}},[c,u,h,m,f,p,a]);return A==null?null:g.createElement(nf.Provider,{value:d},g.createElement($_.Provider,{children:r,value:A}))}function UD(e){let{children:t,location:r}=e;return kue(K4(t),r)}new Promise(()=>{});function K4(e,t){t===void 0&&(t=[]);let r=[];return g.Children.forEach(e,(s,a)=>{if(!g.isValidElement(s))return;let i=[...t,a];if(s.type===g.Fragment){r.push.apply(r,K4(s.props.children,i));return}s.type!==Et&&na(!1),!s.props.index||!s.props.children||na(!1);let o={id:s.props.id||i.join("-"),caseSensitive:s.props.caseSensitive,element:s.props.element,Component:s.props.Component,index:s.props.index,path:s.props.path,loader:s.props.loader,action:s.props.action,errorElement:s.props.errorElement,ErrorBoundary:s.props.ErrorBoundary,hasErrorBoundary:s.props.ErrorBoundary!=null||s.props.errorElement!=null,shouldRevalidate:s.props.shouldRevalidate,handle:s.props.handle,lazy:s.props.lazy};s.props.children&&(o.children=K4(s.props.children,i)),r.push(o)}),r}/**
21 * React Router DOM v6.30.3
22 *
23 * Copyright (c) Remix Software Inc.
24 *
25 * This source code is licensed under the MIT license found in the
26 * LICENSE.md file in the root directory of this source tree.
27 *
28 * @license MIT
29 */function W4(){return W4=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];
29for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},W4.apply(this,arguments)}function Hue(e,t){if(e==null)return{};var r={},s=Object.keys(e),a,i;for(i=0;i<s.length;i++)a=s[i],!(t.indexOf(a)>=0)&&(r[a]=e[a]);return r}function zue(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Vue(e,t){return e.button===0&&(!t||t==="_self")&&!zue(e)}function Y4(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,r)=>{let s=e[r];return t.concat(Array.isArray(s)?s.map(a=>[r,a]):[[r,s]])},[]))}function Gue(e,t){let r=Y4(e);return t&&t.forEach((s,a)=>{r.has(a)||t.getAll(a).forEach(i=>{r.append(a,i)})}),r}const que=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],Kue="6";try{window.__reactRouterVersion=Kue}catch{}const Wue="startTransition",MD=Qv[Wue];function Yue(e){let{basename:t,children:r,future:s,window:a}=e,i=g.useRef();i.current==null&&(i.current=Yde({window:a,v5Compat:!0}));let o=i.current,[l,c]=g.useState({action:o.action,location:o.location}),{v7_startTransition:d}=s||{},u=g.useCallback(h=>{d&&MD?MD(()=>c(h)):c(h)},[c,d]);return g.useLayoutEffect(()=>o.listen(u),[o,u]),g.useEffect(()=>$ue(s),[s]),g.createElement(Que,{basename:t,children:r,location:l.location,navigationType:l.action,navigator:o,future:s})}const Jue=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Xue=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ir=g.forwardRef(function(t,r){let{onClick:s,relative:a,reloadDocument:i,replace:o,state:l,target:c,to:d,preventScrollReset:u,viewTransition:h}=t,m=Hue(t,que),{basename:f}=g.useContext(nf),p,A=!1;if(typeof d=="string"&&Xue.test(d)&&(p=d,Jue))try{let y=new URL(window.location.href),w=d.startsWith("//")?new URL(y.protocol+d):new URL(d),j=pI(w.pathname,f);w.origin===y.origin&&j!=null?d=j+w.search+w.hash:A=!0}catch{}let v=Nue(d,{relative:a}),x=Zue(d,{replace:o,state:l,target:c,preventScrollReset:u,relative:a,viewTransition:h});function b(y){s&&s(y),y.defaultPrevented||x(y)}return g.createElement("a",W4({},m,{href:p||v,onClick:A||i?s:b,ref:r,target:c}))});var $D;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})($D||($D={}));var QD;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(QD||(QD={}));function Zue(e,t){let{target:r,replace:s,state:a,preventScrollReset:i,relative:o,viewTransition:l}=t===void 0?{}:t,c=xr(),d=Gs(),u=dq(e,{relative:o});return g.useCallback(h=>{if(Vue(h,r)){h.preventDefault();let m=s!==void 0?s:Jj(d)===Jj(u);c(e,{replace:m,state:a,preventScrollReset:i,relative:o,viewTransition:l})}},[d,c,u,s,a,r,e,i,o,l])}function Bi(e){let t=g.useRef(Y4(e)),r=g.useRef(!1),s=Gs(),a=g.useMemo(()=>Gue(s.search,r.current?null:t.current),[s.search]),i=xr(),o=g.useCallback((l,c)=>{const d=Y4(typeof l=="function"?l(a):l);r.current=!0,i("?"+d,c)},[i,a]);return[a,o]}function ehe(e,t){let{capture:r}={};g.useEffect(()=>{let s=r!=null?{capture:r}:void 0;return window.addEventListener("beforeunload",e,s),()=>{window.removeEventListener("beforeunload",e,s)}},[e,r])}const the=e=>e?(...t)=>e(...t):(...t)=>fetch(...t);class Q_ extends Error{constructor(t,r="FunctionsError",s){super(t),this.name=r,this.context=s}}class pq extends Q_{constructor(t){super("Failed to send a request to the Edge Function","FunctionsFetchError",t)}}class J4 extends Q_{constructor(t){super("Relay Error invoking the Edge Function","FunctionsRelayError",t)}}class X4 extends Q_{constructor(t){super("Edge Function returned a non-2xx status code","FunctionsHttpError",t)}}var Xj;(function(e){e.Any="any",e.ApNortheast1="ap-northeast-1",e.ApNortheast2="ap-northeast-2",e.ApSouth1="ap-south-1",e.ApSoutheast1="ap-southeast-1",e.ApSoutheast2="ap-southeast-2",e.CaCentral1="ca-central-1",e.EuCentral1="eu-central-1",e.EuWest1="eu-west-1",e.EuWest2="eu-west-2",e.EuWest3="eu-west-3",e.SaEast1="sa-east-1",e.UsEast1="us-east-1",e.UsWest1="us-west-1",e.UsWest2="us-west-2"})(Xj||(Xj={}));class rhe{constructor(t,{headers:r={},customFetch:s,region:a=Xj.Any}={}){this.url=t,this.headers=r,this.region=a,this.fetch=the(s)}setAuth(t){this.headers.Authorization=`Bearer ${t}`}invoke(t){return Dde(this,arguments,void 0,function*(r,s={}){var a;let i,o;try{const{headers:l,method:c,body:d,signal:u,timeout:h}=s;let m={},{region:f}=s;f||(f=this.region);const p=new URL(`${this.url}/${r}`);f&&f!=="any"&&(m["x-region"]=f,p.searchParams.set("forceFunctionRegion",f));let A;d&&(l&&!Object.prototype.hasOwnProperty.call(l,"Content-Type")||!l)?typeof Blob<"u"&&d instanceof Blob||d instanceof ArrayBuffer?(m["Content-Type"]="application/octet-stream",A=d):typeof d=="str
29ing"?(m["Content-Type"]="text/plain",A=d):typeof FormData<"u"&&d instanceof FormData?A=d:(m["Content-Type"]="application/json",A=JSON.stringify(d)):d&&typeof d!="string"&&!(typeof Blob<"u"&&d instanceof Blob)&&!(d instanceof ArrayBuffer)&&!(typeof FormData<"u"&&d instanceof FormData)?A=JSON.stringify(d):A=d;let v=u;h&&(o=new AbortController,i=setTimeout(()=>o.abort(),h),u?(v=o.signal,u.addEventListener("abort",()=>o.abort())):v=o.signal);const x=yield this.fetch(p.toString(),{method:c||"POST",headers:Object.assign(Object.assign(Object.assign({},m),this.headers),l),body:A,signal:v}).catch(j=>{throw new pq(j)}),b=x.headers.get("x-relay-error");if(b&&b==="true")throw new J4(x);if(!x.ok)throw new X4(x);let y=((a=x.headers.get("Content-Type"))!==null&&a!==void 0?a:"text/plain").split(";")[0].trim(),w;return y==="application/json"?w=yield x.json():y==="application/octet-stream"||y==="application/pdf"?w=yield x.blob():y==="text/event-stream"?w=x:y==="multipart/form-data"?w=yield x.formData():w=yield x.text(),{data:w,error:null,response:x}}catch(l){return{data:null,error:l,response:l instanceof X4||l instanceof J4?l.context:void 0}}finally{i&&clearTimeout(i)}})}}var Aq=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.co
29de=e.code}},nhe=class{constructor(e){var t,r,s;this.shouldThrowOnError=!1,this.method=e.method,this.url=e.url,this.headers=new Headers(e.headers),this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=(t=e.shouldThrowOnError)!==null&&t!==void 0?t:!1,this.signal=e.signal,this.isMaybeSingle=(r=e.isMaybeSingle)!==null&&r!==void 0?r:!1,this.urlLengthLimit=(s=e.urlLengthLimit)!==null&&s!==void 0?s:8e3,e.fetch?this.fetch=e.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=new Headers(this.headers),this.headers.set(e,t),this}then(e,t){var r=this;this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json");const s=this.fetch;let a=s(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async i=>{let o=null,l=null,c=null,d=i.status,u=i.statusText;if(i.ok){var h,m;if(r.method!=="HEAD"){var f;const x=await i.text();x===""||(r.headers.get("Accept")==="text/csv"||r.headers.get("Accept")&&(!((f=r.headers.get("Accept"))===null||f===void 0)&&f.includes("application/vnd.pgrst.plan+text"))?l=x:l=JSON.parse(x))}const A=(h=r.headers.get("Prefer"))===null||h===void 0?void 0:h.match(/count=(exact|planned|estimated)/),v=(m=i.headers.get("content-range"))===null||m===void 0?void 0:m.split("/");A&&v&&v.length>1&&(c=parseInt(v[1])),r.isMaybeSingle&&r.method==="GET"&&Array.isArray(l)&&(l.length>1?(o={code:"PGRST116",details:`Results contain ${l.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},l=null,c=null,d=406,u="Not Acceptable"):l.length===1?l=l[0]:l=null)}else{var p;const A=await i.text();try{o=JSON.parse(A),Array.isArray(o)&&i.status===404&&(l=[],o=null,d=200,u="OK")}catch{i.status===404&&A===""?(d=204,u="No Content"):o={message:A}}if(o&&r.isMaybeSingle&&(!(o==null||(p=o.details)===null||p===void 0)&&p.includes("0 rows"))&&(o=null,d=200,u="OK"),o&&r.shouldThrowOnError)throw new Aq(o)}return{error:o,data:l,count:c,status:d,statusText:u}});return this.shouldThrowOnError||(a=a.catch(i=>{var o;let l="",c="",d="";const u=i==null?void 0:i.cause;if(u){var h,m,f,p;const x=(h=u==null?void 0:u.message)!==null&&h!==void 0?h:"",b=(m=u==null?void 0:u.code)!==null&&m!==void 0?m:"";l=`${(f=i==null?void 0:i.name)!==null&&f!==void 0?f:"FetchError"}: ${i==null?void 0:i.message}`,l+=`
30
31Caused by: ${(p=u==null?void 0:u.name)!==null&&p!==void 0?p:"Error"}: ${x}`,b&&(l+=` (${b})`),u!=null&&u.stack&&(l+=`
32${u.stack}`)}else{var A;l=(A=i==null?void 0:i.stack)!==null&&A!==void 0?A:""}const v=this.url.toString().length;return(i==null?void 0:i.name)==="AbortError"||(i==null?void 0:i.code)==="ABORT_ERR"?(d="",c="Request was aborted (timeout or manual cancellation)",v>this.urlLengthLimit&&(c+=`. Note: Your request URL is ${v} characters, which may exceed server limits. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [many IDs])), consider using an RPC function to pass values server-side.`)):((u==null?void 0:u.name)==="HeadersOverflowError"||(u==null?void 0:u.code)==="UND_ERR_HEADERS_OVERFLOW")&&(d="",c="HTTP headers exceeded server limits (typically 16KB)",v>this.urlLengthLimit&&(c+=`. Your request URL is ${v} characters. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [200+ IDs])), consider using an RPC function instead.`)),{error:{message:`${(o=i==null?void 0:i.name)!==null&&o!==void 0?o:"FetchError"}: ${i==null?void 0:i.message}`,details:l,hint:c,code:d},data:null,count:null,status:0,statusText:""}})),a.then(e,t)}returns(){return this}overrideTypes(){return this}},she=class extends nhe{select(e){let t=!1;const r=(e??"*").split("").map(s=>/\s/.test(s)&&!t?"":(s==='"'&&(t=!t),s)).join("");return this.url.searchParams.set("select",r),this.headers.append("Prefer","return=representation"),this}order(e,{ascending:t=!0,nullsFirst:r,foreignTable:s,referencedTable:a=s}={}){const i=a?`${a}.order`:"order",o=this.url.searchParams.get(i);return this.url.searchParams.set(i,`${o?`${o},`:""}${e}.${t?"asc":"desc"}${r===void 0?"":r?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:t,referencedTable:r=t}={}){const s=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(s,`${e}`),this}range(e,t,{foreignTable:r,referencedTable:s=r}={}){const a=typeof s>"u"?"offset":`${s}.offset`,i=typeof s>"u"?"limit":`${s}.limit`;return this.url.searchParams.set(a,`${e}`),this.url.searchParams.set(i,`${t-e+1}`),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.method==="GET"?this.headers.set("Accept","application/json"):this.headers.set("Accept","application/vnd.pgrst.object+json"),this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}
32explain({analyze:e=!1,verbose:t=!1,settings:r=!1,buffers:s=!1,wal:a=!1,format:i="text"}={}){var o;const l=[e?"analyze":null,t?"verbose":null,r?"settings":null,s?"buffers":null,a?"wal":null].filter(Boolean).join("|"),c=(o=this.headers.get("Accept"))!==null&&o!==void 0?o:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${i}; for="${c}"; options=${l};`),i==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(e){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${e}`),this}};const HD=new RegExp("[,()]");var tA=class extends she{eq(e,t){return this.url.searchParams.append(e,`eq.${t}`),this}neq(e,t){return this.url.searchParams.append(e,`neq.${t}`),this}gt(e,t){return this.url.searchParams.append(e,`gt.${t}`),this}gte(e,t){return this.url.searchParams.append(e,`gte.${t}`),this}lt(e,t){return this.url.searchParams.append(e,`lt.${t}`),this}lte(e,t){return this.url.searchParams.append(e,`lte.${t}`),this}like(e,t){return this.url.searchParams.append(e,`like.${t}`),this}likeAllOf(e,t){return this.url.searchParams.append(e,`like(all).{${t.join(",")}}`),this}likeAnyOf(e,t){return this.url.searchParams.append(e,`like(any).{${t.join(",")}}`),this}ilike(e,t){return this.url.searchParams.append(e,`ilike.${t}`),this}ilikeAllOf(e,t){return this.url.searchParams.append(e,`ilike(all).{${t.join(",")}}`),this}ilikeAnyOf(e,t){return this.url.searchParams.append(e,`ilike(any).{${t.join(",")}}`),this}regexMatch(e,t){return this.url.searchParams.append(e,`match.${t}`),this}regexIMatch(e,t){return this.url.searchParams.append(e,`imatch.${t}`),this}is(e,t){return this.url.searchParams.append(e,`is.${t}`),this}isDistinct(e,t){return this.url.searchParams.append(e,`isdistinct.${t}`),this}in(e,t){const r=Array.from(new Set(t)).map(s=>typeof s=="string"&&HD.test(s)?`"${s}"`:`${s}`).join(",");return this.url.searchParams.append(e,`in.(${r})`),this}notIn(e,t){const r=Array.from(new Set(t)).map(s=>typeof s=="string"&&HD.test(s)?`"${s}"`:`${s}`).join(",");return this.url.searchParams.append(e,`not.in.(${r})`),this}contains(e,t){return typeof t=="string"?this.url.searchParams.append(e,`cs.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cs.{${t.join(",")}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(t)}`),this}containedBy(e,t){return typeof t=="string"?this.url.searchParams.append(e,`cd.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cd.{${t.join(",")}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(t)}`),this}rangeGt(e,t){return this.url.searchParams.append(e,`sr.${t}`),this}rangeGte(e,t){return this.url.searchParams.append(e,`nxl.${t}`),this}rangeLt(e,t){return this.url.searchParams.append(e,`sl.${t}`),this}rangeLte(e,t){return this.url.searchParams.append(e,`nxr.${t}`),this}rangeAdjacent(e,t){return this.url.searchParams.append(e,`adj.${t}`),this}overlaps(e,t){return typeof t=="string"?this.url.searchParams.append(e,`ov.${t}`):this.url.searchParams.append(e,`ov.{${t.join(",")}}`),this}textSearch(e,t,{config:r,type:s}={}){let a="";s==="plain"?a="pl":s==="phrase"?a="ph":s==="websearch"&&(a="w");const i=r===void 0?"":`(${r})`;return this.url.searchParams.append(e,`${a}fts${i}.${t}`),this}match(e){return Object.entries(e).forEach(([t,r])=>{this.url.searchParams.append(t,`eq.${r}`)}),this}not(e,t,r){return this.url.searchParams.append(e,`not.${t}.${r}`),this}or(e,{foreignTable:t,referencedTable:r=t}={}){const s=r?`${r}.or`:"or";return this.url.searchParams.append(s,`(${e})`),this}filter(e,t,r){return this.url.searchParams.append(e,`${t}.${r}`),this}},ahe=class{constructor(e,{headers:t={},schema:r,fetch:s,urlLengthLimit:a=8e3}){this.url=e,this.headers=new Headers(t),this.schema=r,this.fetch=s,this.urlLengthLimit=a}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(e,t){const{head:r=!1,count:s}=t??{},a=r?"HEAD":"GET";let i=!1;const o=(e??"*").split("").map(d=>/\s/.test(d)&&!i?"":(d==='"'&&(i=!i),d)).join(""),{url:l,headers:c}=this.cloneRequestState();return l.searchParams.set("select",o),s&&c.append("Prefer",`count=${s}`),new tA({method:a,url:l,headers:c,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit})}insert(e,{count:t,defaultToNull:r=!0}={}){var s;const a="POST",{url:i,headers:o}=this.cloneRequestState();if(t&&o.append("Prefer",`count=${t}`),r||o.append("Prefer","missing=default"),Array.isArray(e)){const l=e.reduce((c,d)=>c.concat(Object.keys(d)),[]);if(l.length>0){const c=[...new Set(l)].map(d=>`"${d}"`);i.searchParams.set("columns",c.join(","))}}return new tA({method:a,url:i,headers:o,schema:this.schema,body:e,fetch:(s=this.fetch)!==null&&s!==void 0?s:fetch,urlLengthLimit:this.urlLengthLimit})}upsert(e,{onConflict:t,ignoreDuplicates:r=!1,count:s,defaultToNull:a=!0}={}){var i;const o="POST",{url:l,headers:c}=this.cloneRequestState();if(c.append("Prefer",`resolution=${r?"ignore":"merge"}-duplicates`),t!==void 0&&l.searchParams.set("on_conflict",t),s&&c.append("Prefer",`count=${s}`),a||c.append("Prefer","missing=default"),Array.isArray(e)){const d=e.reduce((u,h)=>u.concat(Object.keys(h)),[]);if(d.length>0){const u=[...new Set(d)].map(h=>`"${h}"`);l.searchParams.set("columns",u.join(","))}}return new tA({method:o,url:l,headers:c,schema:this.schema,body:e,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch,urlLengthLimit:this.urlLengthLimit})}update(e,{count:t}={}){var r;const s="PATCH",{url:a,headers:i}=this.cloneRequestState();return t&&i.append("Prefer",`count=${t}`),new tA({method:s,url:a,headers:i,schema:this.schema,body:e,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch,urlLengthLimit:this.urlLengthLimit})}delete({count:e}={}){var t;const r="DELETE",{url:s,headers:a}=this.cloneRequestState();return e&&a.append("Prefer",`count=${e}`),new tA({method:r,url:s,headers:a,schema:this.schema,fetch:(t=this.fetch)!==null&&t!==void 0?t:fetch,urlLengthLimit:this.urlLengthLimit})}};function Vv(e){"@babel/helpers - typeof";return Vv=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Vv(e)}function ihe(e,t){if(Vv(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(Vv(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ohe(e){var t=ihe(e,"string");return Vv(t)=="symbol"?t:t+""}function lhe(e,t,r){return(t=ohe(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function zD(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,s)}return r}function zw(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};
32t%2?zD(Object(r),!0).forEach(function(s){lhe(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):zD(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}var che=class gq{constructor(t,{headers:r={},schema:s,fetch:a,timeout:i,urlLengthLimit:o=8e3}={}){this.url=t,this.headers=new Headers(r),this.schemaName=s,this.urlLengthLimit=o;const l=a??globalThis.fetch;i!==void 0&&i>0?this.fetch=(c,d)=>{const u=new AbortController,h=setTimeout(()=>u.abort(),i),m=d==null?void 0:d.signal;if(m){if(m.aborted)return clearTimeout(h),l(c,d);const f=()=>{clearTimeout(h),u.abort()};return m.addEventListener("abort",f,{once:!0}),l(c,zw(zw({},d),{},{signal:u.signal})).finally(()=>{clearTimeout(h),m.removeEventListener("abort",f)})}return l(c,zw(zw({},d),{},{signal:u.signal})).finally(()=>clearTimeout(h))}:this.fetch=l}from(t){if(!t||typeof t!="string"||t.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new ahe(new URL(`${this.url}/${t}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit})}schema(t){return new gq(this.url,{headers:this.headers,schema:t,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit})}rpc(t,r={},{head:s=!1,get:a=!1,count:i}={}){var o;let l;const c=new URL(`${this.url}/rpc/${t}`);let d;const u=f=>f!==null&&typeof f=="object"&&(!Array.isArray(f)||f.some(u)),h=s&&Object.values(r).some(u);h?(l="POST",d=r):s||a?(l=s?"HEAD":"GET",Object.entries(r).filter(([f,p])=>p!==void 0).map(([f,p])=>[f,Array.isArray(p)?`{${p.join(",")}}`:`${p}`]).forEach(([f,p])=>{c.searchParams.append(f,p)})):(l="POST",d=r);const m=new Headers(this.headers);return h?m.set("Prefer",i?`count=${i},return=minimal`:"return=minimal"):i&&m.set("Prefer",`count=${i}`),new tA({method:l,url:c,headers:m,schema:this.schemaName,body:d,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch,urlLengthLimit:this.urlLengthLimit})}};class xq{constructor(){}static detectEnvironment(){var t;if(typeof WebSocket<"u")return{type:"native",constructor:WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocket<"u")return{type:"native",constructor:globalThis.WebSocket};if(typeof global<"u"&&typeof global.WebSocket<"u")return{type:"native",constructor:global.WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocketPair<"u"&&typeof globalThis.WebSocket>"u")return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if(typeof globalThis<"u"&&globalThis.EdgeRuntime||typeof navigator<"u"&&(!((t=navigator.userAgent)===null||t===void 0)&&t.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};const r=globalThis.process;if(r){const s=r.versions;if(s&&s.node){const a=s.node,i=parseInt(a.replace(/^v/,"").split(".")[0]);return i>=22?typeof globalThis.WebSocket<"u"?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${i} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${i} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option:
33import ws from "ws"
34new RealtimeClient(url, { transport: ws })`}}}return{type:"unsupported",error:"Unknown JavaScript runtime without WebSocket support.",workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){const t=this.detectEnvironment();if(t.constructor)return t.constructor;let r=t.error||"WebSocket not supported in this environment.";throw t.workaround&&(r+=`
35
36Suggested solution: ${t.workaround}`),new Error(r)}static createWebSocket(t,r){const s=this.getWebSocketConstructor();return new s(t,r)}static isWebSocketSupported(){try{const t=this.detectEnvironment();return t.type==="native"||t.type==="ws"}catch{return!1}}}const dhe="2.99.2",uhe=`realtime-js/${dhe}`,hhe="1.0.0",vq="2.0.0",VD=vq,Z4=1e4,fhe=1e3,mhe=100;var mh;(function(e){e[e.connecting=0]="connecting",e[e.open=1]="open",e[e.closing=2]="closing",e[e.closed=3]="closed"})(mh||(mh={}));var ua;(function(e){e.closed="closed",e.errored="errored",e.joined="joined",e.joining="joining",e.leaving="leaving"})(ua||(ua={}));var hc;(function(e){e.close="phx_close",e.error="phx_error",e.join="phx_join",e.reply="phx_reply",e.leave="phx_leave",e.access_token="access_token"})(hc||(hc={}));var eB;(function(e){e.websocket="websocket"})(eB||(eB={}));var Jf;(function(e){e.Connecting="connecting",e.Open="open",e.Closing="closing",e.Closed="closed"})(Jf||(Jf={}));class phe{constructor(t){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT="broadcast",this.allowedMetadataKeys=[],this.allowedMetadataKeys=t??[]}encode(t,r){if(t.event===this.BROADCAST_EVENT&&!(t.payload instanceof ArrayBuffer)&&typeof t.payload.event=="string")return r(this._binaryEncodeUserBroadcastPush(t));let s=[t.join_ref,t.ref,t.topic,t.event,t.payload];return r(JSON.stringify(s))}_binaryEncodeUserBroadcastPush(t){var r;return this._isArrayBuffer((r=t.payload)===null||r===void 0?void 0:r.payload)?this._encodeBinaryUserBroadcastPush(t):this._encodeJsonUserBroadcastPush(t)}_encodeBinaryUserBroadcastPush(t){var r,s;const a=(s=(r=t.payload)===null||r===void 0?void 0:r.payload)!==null&&s!==void 0?s:new ArrayBuffer(0);return this._encodeUserBroadcastPush(t,this.BINARY_ENCODING,a)}_encodeJsonUserBroadcastPush(t){var r,s;const a=(s=(r=t.payload)===null||r===void 0?void 0:r.payload)!==null&&s!==void 0?s:{},o=new TextEncoder().encode(JSON.stringify(a)).buffer;return this._encodeUserBroadcastPush(t,this.JSON_ENCODING,o)}_encodeUserBroadcastPush(t,r,s){var a,i;const o=t.topic,l=(a=t.ref)!==null&&a!==void 0?a:"",c=(i=t.join_ref)!==null&&i!==void 0?i:"",d=t.payload.event,u=this.allowedMetadataKeys?this._pick(t.payload,this.allowedMetadataKeys):{},h=Object.keys(u).length===0?"":JSON.stringify(u);if(c.length>255)throw new Error(`joinRef length ${c.length} exceeds maximum of 255`);if(l.length>255)throw new Error(`ref length ${l.length} exceeds maximum of 255`);if(o.length>255)throw new Error(`topic length ${o.length} exceeds maximum of 255`);if(d.length>255)throw new Error(`userEvent length ${d.length} exceeds maximum of 255`);if(h.length>255)throw new Error(`metadata length ${h.length} exceeds maximum of 255`);const m=this.USER_BROADCAST_PUSH_META_LENGTH+c.length+l.length+o.length+d.length+h.length,f=new ArrayBuffer(this.HEADER_LENGTH+m);let p=new DataView(f),A=0;p.setUint8(A++,this.KINDS.userBroadcastPush),p.setUint8(A++,c.length),p.setUint8(A++,l.length),p.setUint8(A++,o.length),p.setUint8(A++,d.length),p.setUint8(A++,h.length),p.setUint8(A++,r),Array.from(c,x=>p.setUint8(A++,x.charCodeAt(0))),Array.from(l,x=>p.setUint8(A++,x.charCodeAt(0))),Array.from(o,x=>p.setUint8(A++,x.charCodeAt(0))),Array.from(d,x=>p.setUint8(A++,x.charCodeAt(0))),Array.from(h,x=>p.setUint8(A++,x.charCodeAt(0)));var v=new Uint8Array(f.byteLength+s.byteLength);return v.set(new Uint8Array(f),0),v.set(new Uint8Array(s),f.byteLength),v.buffer}decode(t,r){if(this._isArrayBuffer(t)){let s=this._binaryDecode(t);return r(s)}if(typeof t=="string"){const s=JSON.parse(t),[a,i,o,l,c]=s;return r({join_ref:a,ref:i,topic:o,event:l,payload:c})}return r({})}_binaryDecode(t){const r=new DataView(t),s=r.getUint8(0),a=new TextDecoder;switch(s){case this.KINDS.userBroadcast:return this._decodeUserBroadcast(t,r,a)}}_decodeUserBroadcast(t,r,s){const a=r.getUint8(1),i=r.getUint8(2),o=r.getUint8(3),l=r.getUint8(4);let c=this.HEADER_LENGTH+4;const d=s.decode(t.slice(c,c+a));c=c+a;const u=s.decode(t.slice(c,c+i));c=c+i;
36const h=s.decode(t.slice(c,c+o));c=c+o;const m=t.slice(c,t.byteLength),f=l===this.JSON_ENCODING?JSON.parse(s.decode(m)):m,p={type:this.BROADCAST_EVENT,event:u,payload:f};return o>0&&(p.meta=JSON.parse(h)),{join_ref:null,ref:null,topic:d,event:this.BROADCAST_EVENT,payload:p}}_isArrayBuffer(t){var r;return t instanceof ArrayBuffer||((r=t==null?void 0:t.constructor)===null||r===void 0?void 0:r.name)==="ArrayBuffer"}_pick(t,r){return!t||typeof t!="object"?{}:Object.fromEntries(Object.entries(t).filter(([s])=>r.includes(s)))}}let bq=class{constructor(t,r){this.callback=t,this.timerCalc=r,this.timer=void 0,this.tries=0,this.callback=t,this.timerCalc=r}reset(){this.tries=0,clearTimeout(this.timer),this.timer=void 0}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}};var Zn;(function(e){e.abstime="abstime",e.bool="bool",e.date="date",e.daterange="daterange",e.float4="float4",e.float8="float8",e.int2="int2",e.int4="int4",e.int4range="int4range",e.int8="int8",e.int8range="int8range",e.json="json",e.jsonb="jsonb",e.money="money",e.numeric="numeric",e.oid="oid",e.reltime="reltime",e.text="text",e.time="time",e.timestamp="timestamp",e.timestamptz="timestamptz",e.timetz="timetz",e.tsrange="tsrange",e.tstzrange="tstzrange"})(Zn||(Zn={}));const GD=(e,t,r={})=>{var s;const a=(s=r.skipTypes)!==null&&s!==void 0?s:[];return t?Object.keys(t).reduce((i,o)=>(i[o]=Ahe(o,e,t,a),i),{}):{}},Ahe=(e,t,r,s)=>{const a=t.find(l=>
36l.name===e),i=a==null?void 0:a.type,o=r[e];return i&&!s.includes(i)?yq(i,o):tB(o)},yq=(e,t)=>{if(e.charAt(0)==="_"){const r=e.slice(1,e.length);return bhe(t,r)}switch(e){case Zn.bool:return ghe(t);case Zn.float4:case Zn.float8:case Zn.int2:case Zn.int4:case Zn.int8:case Zn.numeric:case Zn.oid:return xhe(t);case Zn.json:case Zn.jsonb:return vhe(t);case Zn.timestamp:return yhe(t);case Zn.abstime:case Zn.date:case Zn.daterange:case Zn.int4range:case Zn.int8range:case Zn.money:case Zn.reltime:case Zn.text:case Zn.time:case Zn.timestamptz:case Zn.timetz:case Zn.tsrange:case Zn.tstzrange:return tB(t);default:return tB(t)}},tB=e=>e,ghe=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},xhe=e=>{if(typeof e=="string"){const t=parseFloat(e);if(!Number.isNaN(t))return t}return e},vhe=e=>{if(typeof e=="string")try{return JSON.parse(e)}catch{return e}return e},bhe=(e,t)=>{if(typeof e!="string")return e;const r=e.length-1,s=e[r];if(e[0]==="{"&&s==="}"){let i;const o=e.slice(1,r);try{i=JSON.parse("["+o+"]")}catch{i=o?o.split(","):[]}return i.map(l=>yq(t,l))}return e},yhe=e=>typeof e=="string"?e.replace(" ","T"):e,wq=e=>{const t=new URL(e);return t.protocol=t.protocol.replace(/^ws/i,"http"),t.pathname=t.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),t.pathname===""||t.pathname==="/"?t.pathname="/api/broadcast":t.pathname=t.pathname+"/api/broadcast",t.href};class c5{constructor(t,r,s={},a=Z4){this.channel=t,this.event=r,this.payload=s,this.timeout=a,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(t){this.timeout=t,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,this.send()}send(){this._hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload,ref:this.ref,join_ref:this.channel._joinRef()}))}updatePayload(t){this.payload=Object.assign(Object.assign({},this.payload),t)}receive(t,r){var s;return this._hasReceived(t)&&r((s=this.receivedResp)===null||s===void 0?void 0:s.response),this.recHooks.push({status:t,callback:r}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);const t=r=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=r,this._matchReceive(r)};this.channel._on(this.refEvent,{},t),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(t,r){this.refEvent&&this.channel._trigger(this.refEvent,{status:t,response:r})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:t,response:r}){this.recHooks.filter(s=>s.status===t).forEach(s=>s.callback(r))}_hasReceived(t){return this.receivedResp&&this.receivedResp.status===t}}var rB;(function(e){e.SYNC="sync",e.JOIN="join",e.LEAVE="leave"})(rB||(rB={}));class SA{constructor(t,r){this.channel=t,this.state={},this.pendingDiffs=[],this.joinRef=null,this.enabled=!1,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};const s=(r==null?void 0:r.events)||{state:"presence_state",diff:"presence_diff"};this.channel._on(s.state,{},a=>{const{onJoin:i,onLeave:o,onSync:l}=this.caller;this.joinRef=this.channel._joinRef(),this.state=SA.syncState(this.state,a,i,o),this.pendingDiffs.forEach(c=>{this.state=SA.syncDiff(this.state,c,i,o)}),this.pendingDiffs=[],l()}),this.channel._on(s.diff,{},a=>{const{onJoin:i,onLeave:o,onSync:l}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(a):(this.state=SA.syncDiff(this.state,a,i,o),l())}),this.onJoin((a,i,o)=>{this.channel._trigger("presence",{event:"join",key:a,currentPresences:i,newPresences:o})}),this.onLeave((a,i,o)=>{this.channel._trigger("presence",{event:"leave",key:a,currentPresences:i,leftPresences:o})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(t,r,s,a){const i=this.cloneDeep(t),o=this.transformState(r),l={},c={};return this.map(i,(d,u)=>{o[d]||(c[d]=u)}),this.map(o,(d,u)=>{const h=i[d];if(h){const m=u.map(v=>v.presence_ref),f=h.map(v=>v.presence_ref),p=u.filter(v=>f.indexOf(v.presence_ref)<0),A=h.filter(v=>m.indexOf(v.presence_ref)<0);p.length>0&&(l[d]=p),A.length>0&&(c[d]=A)}else l[d]=u}),this.syncDiff(i,{joins:l,leaves:c},s,a)}static syncDiff(t,r,s,a){const{joins:i,leaves:o}={joins:this.transformState(r.joins),leaves:this.transformState(r.leaves)};return s||(s=()=>{}),a||(a=()=>{}),this.map(i,(l,c)=>{var d;const u=(d=t[l])!==null&&d!==void 0?d:[];if(t[l]=this.cloneDeep(c),u.length>0){const h=t[l].map(f=>f.presence_ref),m=u.filter(f=>h.indexOf(f.presence_ref)<0);t[l].unshift(...m)}s(l,u,c)}),this.map(o,(l,c)=>{let d=t[l];if(!d)return;const u=c.map(h=>h.presence_ref);d=d.filter(h=>u.indexOf(h.presence_ref)<0),t[l]=d,a(l,d,c),d.length===0&&delete t[l]}),t}static map(t,r){return Object.getOwnPropertyNames(t).map(s=>r(s,t[s]))}static transformState(t){return t=this.cloneDeep(t),Object.getOwnPropertyNames(t).reduce((r,s)=>{const a=t[s];return"metas"in a?r[s]=a.metas.map(i=>(i.presence_ref=i.phx_ref,delete i.phx_ref,delete i.phx_ref_prev,i)):r[s]=a,r},{})}static cloneDeep(t){return JSON.parse(JSON.stringify(t))}onJoin(t){this.caller.onJoin=t}onLeave(t){this.caller.onLeave=t}onSync(t){this.caller.onSync=t}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}}var nB;(function(e){e.ALL="*",e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"})(nB||(nB={}));var kA;(function(e){e.BROADCAST="broadcast",e.PRESENCE="presence",e.POSTGRES_CHANGES="postgres_changes",e.SYSTEM="system"})(kA||(kA={}));var Jc;(function(e){e.SUBSCRIBED="SUBSCRIBED",e.TIMED_OUT="TIMED_OUT",e.CLOSED="CLOSED",e.CHANNEL_ERROR="CHANNEL_ERROR"})(Jc||(Jc={}));const whe=ua;class im{constructor(t,r={config:{}},s){var a,i;if(this.topic=t,this.params=r,this.socket=s,this.bindings={},this.state=ua.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=t.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},r.config),this.timeout=this.socket.timeout,this.joinPush=new c5(this,hc.join,this.params,this.timeout),this.rejoinTimer=new bq(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=ua.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(o=>o.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=ua.closed,this.socket._remove(this)}),this._onError(o=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,o),this.state=ua.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=ua.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",o=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,o),this.state=ua.errored,this.rejoinTimer.scheduleTimeout())}),this._on(hc.reply,{},(o,l)=>{this._trigger(this._replyEventName(l),o)}),this.presence=new SA(this),this.broadcastEndpointURL=wq(this.socket.endPoint),this.private=this.params.config.private||!1,!this.private&&(!((i=(a=this.params.config)===null||a===void 0?void 0:a.broadcast)===null||i===void 0)&&i.replay))throw`tried to use replay on public channel '${this.topic}'. It must be a private channel.`}subscribe(t,r=this.timeout){var s,a,i;if(this.socket.isConnected()||this.socket.connect(),this.state==ua.closed){const{config:{broadcast:o,presence:l,private:c}}=this.params,d=(a=(s=this.bindings.postgres_changes)===null||s===void 0?void 0:s.map(f=>f.filter))!==null&&a!==void 0?a:[],u=!!this.bindings[kA.PRESENCE]&&this.bindings[kA.PRESENCE].length>0||((i=this.params.config.presence)===null||i===void 0?void 0:i.enabled)===!0,h={},m={broadcast:o,presence:Object.assign(Object.assign({},l),{enabled:u}),postgres_changes:d,private:c};this.socket.accessTokenValue&&(h.access_token=this.socket.accessTokenValue),this._onError(f=>t==null?void 0:t(Jc.CHANNEL_ERROR,f)),this._onClose(()=>t==null?void 0:t(Jc.CLOSED)),this.updateJoinPayload(Object.assign({config:m},h)),this.joinedOnce=!0,this._rejoin(r),this.joinPush.receive("ok",async({postgres_changes:f})=>{var p;if(this.socket._isManualToken()||this.socket.setAuth(),f===void 0){t==null||t(Jc.SUBSCRIBED);return}else{const A=this.bindings.postgres_changes,v=(p=A==null?void 0:A.length)!==null&&p!==void 0?p:0,x=[];for(let b=0;b<v;b++){const y=A[b],{filter:{event:w,schema:j,table:N,filter:_}}=y,S=f&&f[b];if(S&&S.event===w&&im.isFilterValueEqual(S.schema,j)&&im.isFilterValueEqual(S.table,N)&&im.isFilterValueEqual(S.filter,_))x.push(Object.assign(Object.assign({},y),{id:S.id}));else{this.unsubscribe(),this.state=ua.errored,t==null||t(Jc.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=x,t&&t(Jc.SUBSCRIBED);return}}).receive("error",f=>{this.state=ua.errored,t==null||t(Jc.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(f).join(", ")||"error")))}).receive("timeout",()=>{t==null||t(Jc.TIMED_OUT)})}return this}presenceState(){return this.presence.state}async track(t,r={}){return await this.send({type:"presence",event:"track",payload:t},r.timeout||this.timeout)}async untrack(t={}){return await this.send({type:"presence",event:"untrack"},t)}on(t,r,s){return this.state===ua.joined&&t===kA.PRESENCE&&(this.socket.log("channel",`resubscribe to ${this.topic} due to change in presence callbacks on joined channel`),this.unsubscribe().then(async()=>await this.subscribe())),this._on(t,r,s)}async httpSend(t,r,s={}){var a;if(r==null)return Promise.reject("Payload is required for httpSend()");const i={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(i.Authorization=`Bearer ${this.socket.accessTokenValue}`);const o={method:"POST",headers:i,body:JSON.stringify({messages:[{topic:this.subTopic,event:t,payload:r,private:this.private}]})},l=await this._fetchWithTimeout(this.broadcastEndpointURL,o,(a=s.timeout)!==null&&a!==void 0?a:this.timeout);if(l.status===202)return{success:!0};let c=l.statusText;
36try{const d=await l.json();c=d.error||d.message||c}catch{}return Promise.reject(new Error(c))}async send(t,r={}){var s,a;if(!this._canPush()&&t.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");const{event:i,payload:o}=t,l={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(l.Authorization=`Bearer ${this.socket.accessTokenValue}`);const c={method:"POST",headers:l,body:JSON.stringify({messages:[{topic:this.subTopic,event:i,payload:o,private:this.private}]})};try{const d=await this._fetchWithTimeout(this.broadcastEndpointURL,c,(s=r.timeout)!==null&&s!==void 0?s:this.timeout);return await((a=d.body)===null||a===void 0?void 0:a.cancel()),d.ok?"ok":"error"}catch(d){return d.name==="AbortError"?"timed out":"error"}}else return new Promise(i=>{var o,l,c;const d=this._push(t.type,t,r.timeout||this.timeout);t.type==="broadcast"&&!(!((c=(l=(o=this.params)===null||o===void 0?void 0:o.config)===null||l===void 0?void 0:l.broadcast)===null||c===void 0)&&c.ack)&&i("ok"),d.receive("ok",()=>i("ok")),d.receive("error",()=>i("error")),d.receive("timeout",()=>i("timed out"))})}updateJoinPayload(t){this.joinPush.updatePayload(t)}unsubscribe(t=this.timeout){this.state=ua.leaving;const r=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(hc.close,"leave",this._joinRef())};this.joinPush.destroy();let s=null;return new Promise(a=>{s=new c5(this,hc.leave,{},t),s.receive("ok",()=>{r(),a("ok")}).receive("timeout",()=>{r(),a("timed out")}).receive("error",()=>{a("error")}),s.send(),this._canPush()||s.trigger("ok",{})}).finally(()=>{s==null||s.destroy()})}teardown(){this.pushBuffer.forEach(t=>t.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=ua.closed,this.bindings={}}async _fetchWithTimeout(t,r,s){const a=new AbortController,i=setTimeout(()=>a.abort(),s),o=await this.socket.fetch(t,Object.assign(Object.assign({},r),{signal:a.signal}));return clearTimeout(i),o}_push(t,r,s=this.timeout){if(!this.joinedOnce)throw`tried to push '${t}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let a=new c5(this,t,r,s);return this._canPush()?a.send():this._addToPushBuffer(a),a}_addToPushBuffer(t){if(t.startTimeout(),this.pushBuffer.push(t),this.pushBuffer.length>mhe){const r=this.pushBuffer.shift();r&&(r.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${r.event}`,r.payload))}}_onMessage(t,r,s){return r}_isMember(t){return this.topic===t}_joinRef(){return this.joinPush.ref}_trigger(t,r,s){var a,i;const o=t.toLocaleLowerCase(),{close:l,error:c,leave:d,join:u}=hc;if(s&&[l,c,d,u].indexOf(o)>=0&&s!==this._joinRef())return;let m=this._onMessage(o,r,s);if(r&&!m)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(o)?(a=this.bindings.postgres_changes)===null||a===void 0||a.filter(f=>{var p,A,v;return((p=f.filter)===null||p===void 0?void 0:p.event)==="*"||((v=(A=f.filter)===null||A===void 0?void 0:A.event)===null||v===void 0?void 0:v.toLocaleLowerCase())===o}).map(f=>f.callback(m,s)):(i=this.bindings[o])===null||i===void 0||i.filter(f=>{var p,A,v,x,b,y;if(["broadcast","presence","postgres_changes"].includes(o))if("id"in f){const w=f.id,j=(p=f.filter)===null||p===void 0?void 0:p.event;return w&&((A=r.ids)===null||A===void 0?void 0:A.includes(w))&&(j==="*"||(j==null?void 0:j.toLocaleLowerCase())===((v=r.data)===null||v===void 0?void 0:v.type.toLocaleLowerCase()))}else{const w=(b=(x=f==null?void 0:f.filter)===null||x===void 0?void 0:x.event)===null||b===void 0?void 0:b.toLocaleLowerCase();return w==="*"||w===((y=r==null?void 0:r.event)===null||y===void 0?void 0:y.toLocaleLowerCase())}else return f.type.toLocaleLowerCase()===o}).map(f=>{if(typeof m=="object"&&"ids"in m){const p=m.data,{schema:A,table:v,commit_timestamp:x,type:b,errors:y}=p;m=Object.assign(Object.assign({},{schema:A,table:v,commit_timestamp:x,eventType:b,new:{},old:{},errors:y}),this._getPayloadRecords(p))}f.callback(m,s)})}_isClosed(){return this.state===ua.closed}_isJoined(){return this.state===ua.joined}_isJoining(){return this.state===ua.joining}_isLeaving(){return this.state===ua.leaving}_replyEventName(t){return`chan_reply_${t}`}_on(t,r,s){const a=t.toLocaleLowerCase(),i={type:a,filter:r,callback:s};return this.bindings[a]?this.bindings[a].push(i):this.bindings[a]=[i],this}_off(t,r){const s=t.toLocaleLowerCase();return this.bindings[s]&&(this.bindings[s]=this.bindings[s].filter(a=>{var i;return!(((i=a.type)===null||i===void 0?void 0:i.toLocaleLowerCase())===s&&im.isEqual(a.filter,r))})),this}static isEqual(t,r){if(Object.keys(t).length!==Object.keys(r).length)return!1;for(const s in t)if(t[s]!==r[s])return!1;return!0}static isFilterValueEqual(t,r){return(t??void 0)===(r??void 0)}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(t){this._on(hc.close,{},t)}_onError(t){this._on(hc.error,{},r=>t(r))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(t=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=ua.joining,this.joinPush.resend(t))}_getPayloadRecords(t){const r={new:{},old:{}};return(t.type==="INSERT"||t.type==="UPDATE")&&(r.new=GD(t.columns,t.record)),(t.type==="UPDATE"||t.type==="DELETE")&&(r.old=GD(t.columns,t.old_record)),r}}const d5=()=>{},Vw={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},jhe=[1e3,2e3,5e3,1e4],Nhe=1e4,_he=`
37  addEventListener("message", (e) => {
38    if (e.data.event === "start") {
39      setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
40    }
41  });`;class jq{constructor(t,r){var s;if(this.accessTokenValue=null,this.apiKey=null,this._manuallySetToken=!1,this.channels=new Array,this.endPoint="",this.httpEndpoint="",this.headers={},this.params={},this.timeout=Z4,this.transport=null,this.heartbeatIntervalMs=Vw.HEARTBEAT_INTERVAL,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=d5,this.ref=0,this.reconnectTimer=null,this.vsn=VD,this.logger=
41d5,this.conn=null,this.sendBuffer=[],this.serializer=new phe,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.accessToken=null,this._connectionState="disconnected",this._wasManualDisconnect=!1,this._authPromise=null,this._heartbeatSentAt=null,this._resolveFetch=a=>a?(...i)=>a(...i):(...i)=>fetch(...i),!(!((s=r==null?void 0:r.params)===null||s===void 0)&&s.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=r.params.apikey,this.endPoint=`${t}/${eB.websocket}`,this.httpEndpoint=wq(t),this._initializeOptions(r),this._setupReconnectionTimer(),this.fetch=this._resolveFetch(r==null?void 0:r.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.conn!==null&&this.isConnected())){if(this._setConnectionState("connecting"),this.accessToken&&!this._authPromise&&this._setAuthSafely("connect"),this.transport)this.conn=new this.transport(this.endpointURL());else try{this.conn=xq.createWebSocket(this.endpointURL())}catch(t){this._setConnectionState("disconnected");const r=t.message;throw r.includes("Node.js")?new Error(`${r}
42
43To use Realtime in Node.js, you need to provide a WebSocket implementation:
44
45Option 1: Use Node.js 22+ which has native WebSocket support
46Option 2: Install and provide the "ws" package:
47
48  npm install ws
49
50  import ws from "ws"
51  const client = new RealtimeClient(url, {
52    ...options,
53    transport: ws
54  })`):new Error(`WebSocket not available: ${r}`)}this._setupConnectionHandlers()}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:this.vsn}))}disconnect(t,r){if(!this.isDisconnecting())if(this._setConnectionState("disconnecting",!0),this.conn){const s=setTimeout(()=>{this._setConnectionState("disconnected")},100);this.conn.onclose=()=>{clearTimeout(s),this._setConnectionState("disconnected")},typeof this.conn.close=="function"&&(t?this.conn.close(t,r??""):this.conn.close()),this._teardownConnection()}else this._setConnectionState("disconnected")}getChannels(){return this.channels}async removeChannel(t){const r=await t.unsubscribe();return this.channels.length===0&&this.disconnect(),r}async removeAllChannels(){const t=await Promise.all(this.channels.map(r=>r.unsubscribe()));return this.channels=[],this.disconnect(),t}log(t,r,s){this.logger(t,r,s)}connectionState(){switch(this.conn&&this.conn.readyState){case mh.connecting:return Jf.Connecting;case mh.open:return Jf.Open;case mh.closing:return Jf.Closing;default:return Jf.Closed}}isConnected(){return this.connectionState()===Jf.Open}isConnecting(){return this._connectionState==="connecting"}isDisconnecting(){return this._connectionState==="disconnecting"}channel(t,r={config:{}}){const s=`realtime:${t}`,a=this.getChannels().find(i=>i.topic===s);if(a)return a;{const i=new im(`realtime:${t}`,r,this);return this.channels.push(i),i}}push(t){const{topic:r,event:s,payload:a,ref:i}=t,o=()=>{this.encode(t,l=>{var c;(c=this.conn)===null||c===void 0||c.send(l)})};this.log("push",`${r} ${s} (${i})`,a),this.isConnected()?o():this.sendBuffer.push(o)}async setAuth(t=null){this._authPromise=this._performAuth(t);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){var t;if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(r){this.log("error","error in heartbeat callback",r)}return}if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this._heartbeatSentAt=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(r){this.log("error","error in heartbeat callback",r)}this._wasManualDisconnect=!1,(t=this.conn)===null||t===void 0||t.close(fhe,"heartbeat timeout"),setTimeout(()=>{var r;this.isConnected()||(r=this.reconnectTimer)===null||r===void 0||r.sc
54heduleTimeout()},Vw.HEARTBEAT_TIMEOUT_FALLBACK);return}this._heartbeatSentAt=Date.now(),this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(r){this.log("error","error in heartbeat callback",r)}this._setAuthSafely("heartbeat")}onHeartbeat(t){this.heartbeatCallback=t}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(t=>t()),this.sendBuffer=[])}_makeRef(){let t=this.ref+1;return t===this.ref?this.ref=0:this.ref=t,this.ref.toString()}_leaveOpenTopic(t){let r=this.channels.find(s=>s.topic===t&&(s._isJoined()||s._isJoining()));r&&(this.log("transport",`leaving duplicate topic "${t}"`),r.unsubscribe())}_remove(t){this.channels=this.channels.filter(r=>r.topic!==t.topic)}_onConnMessage(t){this.decode(t.data,r=>{if(r.topic==="phoenix"&&r.event==="phx_reply"&&r.ref&&r.ref===this.pendingHeartbeatRef){const d=this._heartbeatSentAt?Date.now()-this._heartbeatSentAt:void 0;try{this.heartbeatCallback(r.payload.status==="ok"?"ok":"error",d)}catch(u){this.log("error","error in heartbeat callback",u)}this._heartbeatSentAt=null,this.pendingHeartbeatRef=null}const{topic:s,event:a,payload:i,ref:o}=r,l=o?`(${o})`:"",c=i.status||"";this.log("receive",`${c} ${s} ${a} ${l}`.trim(),i),this.channels.filter(d=>d._isMember(s)).forEach(d=>d._trigger(a,i,o)),this._triggerStateCallbacks("message",r)})}_clearTimer(t){var r;t==="heartbeat"&&this.heartbeatTimer?(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0):t==="reconnect"&&((r=this.reconnectTimer)===null||r===void 0||r.reset())}_clearAllTimers(){this._clearTimer("heartbeat"),this._clearTimer("reconnect")}_setupConnectionHandlers(){this.conn&&("binaryType"in this.conn&&(this.conn.binaryType="arraybuffer"),this.conn.onopen=()=>this._onConnOpen(),this.conn.onerror=t=>this._onConnError(t),this.conn.onmessage=t=>this._onConnMessage(t),this.conn.onclose=t=>this._onConnClose(t),this.conn.readyState===mh.open&&this._onConnOpen())}_teardownConnection(){if(this.conn){if(this.conn.readyState===mh.open||this.conn.readyState===mh.connecting)try{this.conn.close()}catch(t){this.log("error","Error closing connection",t)}this.conn.onopen=null,this.conn.onerror=null,this.conn.onmessage=null,this.conn.onclose=null,this.conn=null}this._clearAllTimers(),this._terminateWorker(),this.channels.forEach(t=>t.teardown())}_onConnOpen(){this._setConnectionState("connected"),this.log("transport",`connected to ${this.endpointURL()}`),(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).then(()=>{this.accessTokenValue&&(this.channels.forEach(r=>{r.updateJoinPayload({access_token:this.accessTokenValue})}),this.sendBuffer=[],this.channels.forEach(r=>{r._isJoining()&&(r.joinPush.sent=!1,r.joinPush.send())})),this.flushSendBuffer()}).catch(r=>{this.log("error","error waiting for auth on connect",r),this.flushSendBuffer()}),this._clearTimer("reconnect"),this.worker?this.workerRef||this._startWorkerHeartbeat():this._startHeartbeat(),this._triggerStateCallbacks("open")}_startHeartbeat(){this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const t=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(t),this.workerRef.onerror=r=>{this.log("worker","worker error",r.message),this._terminateWorker()},this.workerRef.onmessage=r=>{r.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_terminateWorker(){this.workerRef&&(this.log("worker","terminating worker"),this.workerRef.terminate(),this.workerRef=void 0)}_onConnClose(t){var r;this._setConnectionState("disconnected"),this.log("transport","close",t),this._triggerChanError(),this._clearTimer("heartbeat"),this._wasManualDisconnect||(r=this.reconnectTimer)===null||r===void 0||r.sc
54heduleTimeout(),this._triggerStateCallbacks("close",t)}_onConnError(t){this._setConnectionState("disconnected"),this.log("transport",`${t}`),this._triggerChanError(),this._triggerStateCallbacks("error",t);try{this.heartbeatCallback("error")}catch(r){this.log("error","error in heartbeat callback",r)}}_triggerChanError(){this.channels.forEach(t=>t._trigger(hc.error))}_appendParams(t,r){if(Object.keys(r).length===0)return t;const s=t.match(/\?/)?"&":"?",a=new URLSearchParams(r);return`${t}${s}${a}`}_workerObjectUrl(t){let r;if(t)r=t;else{const s=new Blob([_he],{type:"application/javascript"});r=URL.createObjectURL(s)}return r}_setConnectionState(t,r=!1){this._connectionState=t,t==="connecting"?this._wasManualDisconnect=!1:t==="disconnecting"&&(this._wasManualDisconnect=r)}async _performAuth(t=null){let r,s=!1;if(t)r=t,s=!0;else if(this.accessToken)try{r=await this.accessToken()}catch(a){this.log("error","Error fetching access token from callback",a),r=this.accessTokenValue}else r=this.accessTokenValue;s?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=r&&(this.accessTokenValue=r,this.channels.forEach(a=>{const i={access_token:r,version:uhe};r&&a.updateJoinPayload(i),a.joinedOnce&&a._isJoined()&&a._push(hc.access_token,{access_token:r})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(t="general"){this._isManualToken()||this.setAuth().catch(r=>{this.log("error",`Error setting auth in ${t}`,r)})}_triggerStateCallbacks(t,r){try{this.stateChangeCallbacks[t].forEach(s=>{try{s(r)}catch(a){this.log("error",`error in ${t} callback`,a)}})}catch(s){this.log("error",`error triggering ${t} callbacks`,s)}}_setupReconnectionTimer(){this.reconnectTimer=new bq(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},Vw.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(t){var r,s,a,i,o,l,c,d,u,h,m,f;switch(this.transport=(r=t==null?void 0:t.transport)!==null&&r!==void 0?r:null,this.timeout=(s=t==null?void 0:t.timeout)!==null&&s!==void 0?s:Z4,this.heartbeatIntervalMs=(a=t==null?void 0:t.heartbeatIntervalMs)!==null&&a!==void 0?a:Vw.HEARTBEAT_INTERVAL,this.worker=(i=t==null?void 0:t.worker)!==null&&i!==void 0?i:!1,this.accessToken=(o=t==null?void 0:t.accessToken)!==null&&o!==void 0?o:null,this.heartbeatCallback=(l=t==null?void 0:t.heartbeatCallback)!==null&&l!==void 0?l:d5,this.vsn=(c=t==null?void 0:t.vsn)!==null&&c!==void 0?c:VD,t!=null&&t.params&&(this.params=t.params),t!=null&&t.logger&&(this.logger=t.logger),(t!=null&&t.logLevel||t!=null&&t.log_level)&&(this.logLevel=t.logLevel||t.log_level,this.params=Object.assign(Object.assign({},this.params),{log_level:this.logLevel})),this.reconnectAfterMs=(d=t==null?void 0:t.reconnectAfterMs)!==null&&d!==void 0?d:p=>jhe[p-1]||Nhe,this.vsn){case hhe:this.encode=(u=t==null?void 0:t.encode)!==null&&u!==void 0?u:(p,A)=>A(JSON.stringify(p)),this.decode=(h=t==null?void 0:t.decode)!==null&&h!==void 0?h:(p,A)=>A(JSON.parse(p));break;case vq:this.encode=(m=t==null?void 0:t.encode)!==null&&m!==void 0?m:this.serializer.encode.bind(this.serializer),this.decode=(f=t==null?void 0:t.decode)!==null&&f!==void 0?f:this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${this.vsn}`)}if(this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=t==null?void 0:t.workerUrl}}}var Gv=class extends Error{constructor(e,t){var r;super(e),this.name="IcebergError",this.status=t.status,this.icebergType=t.icebergType,this.icebergCode=t.icebergCode,this.details=t.details,this.isCommitStateUnknown=t.icebergType==="CommitStateUnknownException"||[500,502,504].includes(t.status)&&((r=t.icebergType)==null?void 0:r.includes("CommitState"))===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function Che(e,t,r){const s=new URL(t,e);if(r)for(const[a,i]of Object.entries(r))i!==void 0&&s.searchParams.set(a,i);return s.toString()}async function She(e){return!e||e.type==="none"?{}:e.type==="bearer"?{Authorization:`Bearer ${e.token}`}:e.type==="header"?{[e.name]:e.value}:e.type==="custom"?await e.getHeaders():{}}function khe(e){const t=e.fetchImpl??globalThis.fetch;return{async request({method:r,path:s,query:a,body:i,headers:o}){const l=Che(e.baseUrl,s,a),c=await She(e.auth),d=await t(l,{method:r,headers:{...i?{"Content-Type":"application/json"}:{},...c,...o},body:i?JSON.stringify(i):void 0}),u=await d.text(),h=(d.headers.get("content-type")||"").includes("application/json"),m=h&&u?JSON.parse(u):u;if(!d.ok){const f=h?m:void 0,p=f==null?void 0:f.error;throw new Gv((p==null?void 0:p.message)??`Request failed with status ${d.status}`,{status:d.status,icebergType:p==null?void 0:p.type,icebergCode:p==null?void 0:p.code,details:f})}return{status:d.status,headers:d.headers,data:m}}}}function Gw(e){return e.join("�")}var Ehe=class{constructor(e,t=""){this.client=e,this.prefix=t}async listNamespaces(e){const t=e?{parent:Gw(e.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:t})).data.namespaces.map(s=>({namespace:s}))}async createNamespace(e,t){const r={namespace:e.namespace,properties:t==null?void 0:t.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:r})).data}async dropNamespace(e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${Gw(e.namespace)}`})}async loadNamespaceMetadata(e){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Gw(e.namespace)}`})).data.properties}}async namespaceExists(e){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Gw(e.namespace)}`}),!0}catch(t){if(t instanceof Gv&&t.status===404)return!1;throw t}}async createNamespaceIfNotExists(e,t){try{return await this.createNamespace(e,t)}catch(r){if(r instanceof Gv&&r.status===409)return;throw r}}};function Cp(e){return e.join("�")}var Bhe=class{constructor(e,t="",r){this.client=e,this.prefix=t,this.accessDelegation=r}async listTables(e){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Cp(e.namespace)}/tables`})).data.identifiers}async createTable(e,t){const r={};return this.accessDelegation&&(r["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Cp(e.namespace)}/tables`,body:t,headers:r})).data.metadata}async updateTable(e,t){const r=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Cp(e.namespace)}/tables/${e.name}`,body:t});return{"metadata-location":r.data["metadata-location"],metadata:r.data.metadata}}async dropTable(e,t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${Cp(e.namespace)}/tables/${e.name}`,query:{purgeRequested:String((t==null?void 0:t.purge)??!1)}})}async loadTable(e){const t={};return this.accessDelegation&&(t["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Cp(e.namespace)}/tables/${e.name}`,headers:t})).data.metadata}async tableExists(e){const t={};this.accessDelegation&&(t["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Cp(e.namespace)}/tables/${e.name}`,headers:t}),!0}catch(r){if(r instanceof Gv&&r.status===404)return!1;throw r}}async createTableIfNotExists(e,t){try{return await this.createTable(e,t)}catch(r){if(r instanceof Gv&&r.status===409)return await this.loadTable({namespace:e.namespace,name:t.name});throw r}}},The=class{constructor(e){var s;let t="v1";e.catalogName&&(t+=`/${e.catalogName}`);const r=e.baseUrl.endsWith("/")?e.baseUrl:`${e.baseUrl}/`;this.client=khe({baseUrl:r,auth:e.auth,fetchImpl:e.fetch}),this.accessDelegation=(s=e.accessDelegation)==null?void 0:s.join(","),this.namespaceOps=new Ehe(this.client,t),this.tableOps=new Bhe(this.client,t,this.accessDelegation)}async listNamespaces(e){return this.namespaceOps.listNamespaces(e)}async createNamespace(e,t){return this.namespaceOps.createNamespace(e,t)}async dropNamespace(e){await this.namespaceOps.dropNamespace(e)}async loadNamespaceMetadata(e){return this.namespaceOps.loadNamespaceMetadata(e)}async listTables(e){return this.tableOps.listTables(e)}
54async createTable(e,t){return this.tableOps.createTable(e,t)}async updateTable(e,t){return this.tableOps.updateTable(e,t)}async dropTable(e,t){await this.tableOps.dropTable(e,t)}async loadTable(e){return this.tableOps.loadTable(e)}async namespaceExists(e){return this.namespaceOps.namespaceExists(e)}async tableExists(e){return this.tableOps.tableExists(e)}async createNamespaceIfNotExists(e,t){return this.namespaceOps.createNamespaceIfNotExists(e,t)}async createTableIfNotExists(e,t){return this.tableOps.createTableIfNotExists(e,t)}},H_=class extends Error{constructor(e,t="storage",r,s){super(e),this.__isStorageError=!0,this.namespace=t,this.name=t==="vectors"?"StorageVectorsError":"StorageError",this.status=r,this.statusCode=s}};function z_(e){return typeof e=="object"&&e!==null&&"__isStorageError"in e}var Mx=class extends H_{constructor(e,t,r,s="storage"){super(e,s,t,r),this.name=s==="vectors"?"StorageVectorsApiError":"StorageApiError",this.status=t,this.statusCode=r}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},Nq=class extends H_{constructor(e,t,r="storage"){super(e,r),this.name=r==="vectors"?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=t}};const Phe=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),Ihe=e=>{if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},sB=e=>{if(Array.isArray(e))return e.map(r=>sB(r));if(typeof e=="function"||e!==Object(e))return e;const t={};return Object.entries(e).forEach(([r,s])=>{const a=r.replace(/([-_][a-z])/gi,i=>i.toUpperCase().replace(/[-_]/g,""));t[a]=sB(s)}),t},Ohe=e=>!e||typeof e!="string"||e.length===0||e.length>100||e.trim()!==e||e.includes("/")||e.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(e);function qv(e){"@babel/helpers - typeof";return qv=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},qv(e)}function Fhe(e,t){if(qv(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(qv(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Lhe(e){var t=Fhe(e,"string");return qv(t)=="symbol"?t:t+""}function Dhe(e,t,r){return(t=Lhe(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function qD(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,s)}return r}function ir(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?qD(Object(r),!0).forEach(function(s){Dhe(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):qD(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}const KD=e=>{var t;return e.msg||e.message||e.error_description||(typeof e.error=="string"?e.error:(t=e.error)===null||t===void 0?void 0:t.message)||JSON.stringify(e)},Rhe=async(e,t,r,s)=>{if(e&&typeof e=="object"&&"status"in e&&"ok"in e&&typeof e.status=="number"){const a=e,i=a.status||500;if(typeof a.json=="function")a.json().then(o=>{const l=(o==null?void 0:o.statusCode)||(o==null?void 0:o.code)||i+"";t(new Mx(KD(o),i,l,s))}).catch(()=>{if(s==="vectors"){const o=i+"";t(new Mx(a.statusText||`HTTP ${i} error`,i,o,s))}else{const o=i+"";t(new Mx(a.statusText||`HTTP ${i} error`,i,o,s))}});else{const o=i+"";t(new Mx(a.statusText||`HTTP ${i} error`,i,o,s))}}else t(new Nq(KD(e),e,s))},Uhe=(e,t,r,s)=>{const a={method:e,headers:(t==null?void 0:t.headers)||{}};return e==="GET"||e==="HEAD"||!s?ir(ir({},a),r):(Ihe(s)?(a.headers=ir({"Content-Type":"application/json"},t==null?void 0:t.headers),a.body=JSON.stringify(s)):a.body=s,t!=null&&t.duplex&&(a.duplex=t.duplex),ir(ir({},a),r))};async function cx(e,t,r,s,a,i,o){return new Promise((l,c)=>{e(r,Uhe(t,s,a,i)).then(d=>{if(!d.ok)throw d;if(s!=null&&s.noResolveJson)return d;if(o==="vectors"){const u=d.headers.get("content-type");if(d.headers.get("content-length")==="0"||d.status===204)return{};if(!u||!u.includes("application/json"))return{}}return d.json()}).then(d=>l(d)).catch(d=>Rhe(d,c,s,o))})}function _q(e="storage"){return{get:async(t,r,s,a)=>cx(t,"GET",r,s,a,void 0,e),post:async(t,r,s,a,i)=>cx(t,"POST",r,a,i,s,e),put:async(t,r,s,a,i)=>cx(t,"PUT",r,a,i,s,e),head:async(t,r,s,a)=>cx(t,"HEAD",r,ir(ir({},s),{},{noResolveJson:!0}),a,void 0,e),remove:async(t,r,s,a,i)=>cx(t,"DELETE",r,a,i,s,e)}}const Mhe=_q("storage"),{get:Kv,post:uc,put:aB,head:$he,remove:vI}=Mhe,Qo=_q("vectors");var t0=class{constructor(e,t={},r,s="storage"){this.shouldThrowOnError=!1,this.url=e,this.headers=t,this.fetch=Phe(r),this.namespace=s}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=ir(ir({},this.headers),{},{[e]:t}),this}async handleOperation(e){var t=this;try{return{data:await e(),error:null}}catch(r){if(t.shouldThrowOnError)throw r;if(z_(r))return{data:null,error:r};throw r}}},Qhe=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t}then(e,t){return this.execute().then(e,t)}async execute(){var e=this;try{return{data:(await e.downloadFn()).body,error:null}}catch(t){if(e.shouldThrowOnError)throw t;if(z_(t))return{data:null,error:t};throw t}}};let Cq;Cq=Symbol.toStringTag;var Hhe=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[
54Cq]="BlobDownloadBuilder",this.promise=null}asStream(){return new Qhe(this.downloadFn,this.shouldThrowOnError)}then(e,t){return this.getPromise().then(e,t)}catch(e){return this.getPromise().catch(e)}finally(e){return this.getPromise().finally(e)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var e=this;try{return{data:await(await e.downloadFn()).blob(),error:null}}catch(t){if(e.shouldThrowOnError)throw t;if(z_(t))return{data:null,error:t};throw t}}};const zhe={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},WD={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var Vhe=class extends t0{constructor(e,t={},r,s){super(e,t,s,"storage"),this.bucketId=r}async uploadOrUpdate(e,t,r,s){var a=this;return a.handleOperation(async()=>{let i;const o=ir(ir({},WD),s);let l=ir(ir({},a.headers),e==="POST"&&{"x-upsert":String(o.upsert)});const c=o.metadata;typeof Blob<"u"&&r instanceof Blob?(i=new FormData,i.append("cacheControl",o.cacheControl),c&&i.append("metadata",a.encodeMetadata(c)),i.append("",r)):typeof FormData<"u"&&r instanceof FormData?(i=r,i.has("cacheControl")||i.append("cacheControl",o.cacheControl),c&&!i.has("metadata")&&i.append("metadata",a.encodeMetadata(c))):(i=r,l["cache-control"]=`max-age=${o.cacheControl}`,l["content-type"]=o.contentType,c&&(l["x-metadata"]=a.toBase64(a.encodeMetadata(c))),(typeof ReadableStream<"u"&&i instanceof ReadableStream||i&&typeof i=="object"&&"pipe"in i&&typeof i.pipe=="function")&&!o.duplex&&(o.duplex="half")),s!=null&&s.headers&&(l=ir(ir({},l),s.headers));const d=a._removeEmptyFolders(t),u=a._getFinalPath(d),h=await(e=="PUT"?aB:uc)(a.fetch,`${a.url}/object/${u}`,i,ir({headers:l},o!=null&&o.duplex?{duplex:o.duplex}:{}));return{path:d,id:h.Id,fullPath:h.Key}})}async upload(e,t,r){return this.uploadOrUpdate("POST",e,t,r)}async uploadToSignedUrl(e,t,r,s){var a=this;const i=a._removeEmptyFolders(e),o=a._getFinalPath(i),l=new URL(a.url+`/object/upload/sign/${o}`);return l.searchParams.set("token",t),a.handleOperation(async()=>{let c;const d=ir({upsert:WD.upsert},s),u=ir(ir({},a.headers),{"x-upsert":String(d.upsert)});return typeof Blob<"u"&&r instanceof Blob?(c=new FormData,c.append("cacheControl",d.cacheControl),c.append("",r)):typeof FormData<"u"&&r instanceof FormData?(c=r,c.append("cacheControl",d.cacheControl)):(c=r,u["cache-control"]=`max-age=${d.cacheControl}`,u["content-type"]=d.contentType),{path:i,fullPath:(await aB(a.fetch,l.toString(),c,{headers:u})).Key}})}async createSignedUploadUrl(e,t){var r=this;return r.handleOperation(async()=>{let s=r._getFinalPath(e);const a=ir({},r.headers);t!=null&&t.upsert&&(a["x-upsert"]="true");const i=await uc(r.fetch,`${r.url}/object/upload/sign/${s}`,{},{headers:a}),o=new URL(r.url+i.url),l=o.searchParams.get("token");if(!l)throw new H_("No token returned by API");return{signedUrl:o.toString(),path:e,token:l}})}async update(e,t,r){return this.uploadOrUpdate("PUT",e,t,r)}async move(e,t,r){var s=this;return s.handleOperation(async()=>await uc(s.fetch,`${s.url}/object/move`,{bucketId:s.bucketId,sourceKey:e,destinationKey:t,de
54stinationBucket:r==null?void 0:r.destinationBucket},{headers:s.headers}))}async copy(e,t,r){var s=this;return s.handleOperation(async()=>({path:(await uc(s.fetch,`${s.url}/object/copy`,{bucketId:s.bucketId,sourceKey:e,destinationKey:t,destinationBucket:r==null?void 0:r.destinationBucket},{headers:s.headers})).Key}))}async createSignedUrl(e,t,r){var s=this;return s.handleOperation(async()=>{let a=s._getFinalPath(e);const i=typeof(r==null?void 0:r.transform)=="object"&&r.transform!==null&&Object.keys(r.transform).length>0;let o=await uc(s.fetch,`${s.url}/object/sign/${a}`,ir({expiresIn:t},i?{transform:r.transform}:{}),{headers:s.headers});const l=r!=null&&r.download?`&download=${r.download===!0?"":r.download}`:"",c=i&&o.signedURL.includes("/object/sign/")?o.signedURL.replace("/object/sign/","/render/image/sign/"):o.signedURL;return{signedUrl:encodeURI(`${s.url}${c}${l}`)}})}async createSignedUrls(e,t,r){var s=this;return s.handleOperation(async()=>{const a=await uc(s.fetch,`${s.url}/object/sign/${s.bucketId}`,{expiresIn:t,paths:e},{headers:s.headers}),i=r!=null&&r.download?`&download=${r.download===!0?"":r.download}`:"";return a.map(o=>ir(ir({},o),{},{signedUrl:o.signedURL?encodeURI(`${s.url}${o.signedURL}${i}`):null}))})}download(e,t,r){const s=typeof(t==null?void 0:t.transform)<"u"?"render/image/authenticated":"object",a=this.transformOptsToQueryString((t==null?void 0:t.transform)||{}),i=a?`?${a}`:"",o=this._getFinalPath(e),l=()=>Kv(this.fetch,`${this.url}/${s}/${o}${i}`,{headers:this.headers,noResolveJson:!0},r);return new Hhe(l,this.shouldThrowOnError)}async info(e){var t=this;const r=t._getFinalPath(e);return t.handleOperation(async()=>sB(await Kv(t.fetch,`${t.url}/object/info/${r}`,{headers:t.headers})))}async exists(e){var t=this;const r=t._getFinalPath(e);try{return await $he(t.fetch,`${t.url}/object/${r}`,{headers:t.headers}),{data:!0,error:null}}catch(a){if(t.shouldThrowOnError)throw a;if(z_(a)){var s;const i=a instanceof Mx?a.status:a instanceof Nq?(s=a.originalError)===null||s===void 0?void 0:s.status:void 0;if(i!==void 0&&[400,404].includes(i))return{data:!1,error:a}}throw a}}getPublicUrl(e,t){const r=this._getFinalPath(e),s=[],a=t!=null&&t.download?`download=${t.download===!0?"":t.download}`:"";a!==""&&s.push(a);const i=typeof(t==null?void 0:t.transform)<"u"?"render/image":"object",o=this.transformOptsToQueryString((t==null?void 0:t.transform)||{});o!==""&&s.push(o);let l=s.join("&");return l!==""&&(l=`?${l}`),{data:{publicUrl:encodeURI(`${this.url}/${i}/public/${r}${l}`)}}}async remove(e){var t=this;return t.handleOperation(async()=>await vI(t.fetch,`${t.url}/object/${t.bucketId}`,{prefixes:e},{headers:t.headers}))}async list(e,t,r){var s=this;return s.handleOperation(async()=>{const a=ir(ir(ir({},zhe),t),{},{prefix:e||""});return await uc(s.fetch,`${s.url}/object/list/${s.bucketId}`,a,{headers:s.headers},r)})}async listV2(e,t){var r=this;return r.handleOperation(async()=>{const s=ir({},e);return await uc(r.fetch,`${r.url}/object/list-v2/${r.bucketId}`,s,{headers:r.headers},t)})}encodeMetadata(e){return JSON.stringify(e)}toBase64(e){return typeof Buffer<"u"?Buffer.from(e).toString("base64"):btoa(e)}_getFinalPath(e){return`${this.bucketId}/${e.replace(/^\/+/,"")}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(e){const t=[];return e.width&&t.push(`width=${e.width}`),e.height&&t.push(`height=${e.height}`),e.resize&&t.push(`resize=${e.resize}`),e.format&&t.push(`format=${e.format}`),e.quality&&t.push(`quality=${e.quality}`),t.join("&")}};const Ghe="2.99.2",_y={"X-Client-Info":`storage-js/${Ghe}`};var qhe=class extends t0{constructor(e,t={},r,s){const a=new URL(e);s!=null&&s.useNewHostname&&/supabase\.(co|in|red)$/.test(a.hostname)&&!a.hostname.includes("storage.supabase.")&&(a.hostname=a.hostname.replace("supabase.","storage.supabase."));const i=a.href.replace(/\/$/,""),o=ir(ir({},_y),t);super(i,o,r,"storage")}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const r=t.listBucketOptionsToQueryString(e);return await Kv(t.fetch,`${t.url}/bucket${r}`,{headers:t.headers})})}async getBucket(e){var t=this;return t.handleOperation(async()=>await Kv(t.fetch,`${t.url}/bucket/${e}`,{headers:t.headers}))}async createBucket(e,t={public:!1}){var r=this;return r.handleOperation(async()=>await uc(r.fetch,`${r.url}/bucket`,{id:e,name:e,type:t.type,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:r.headers}))}async updateBucket(e,t){var r=this;return r.handleOperation(async()=>await aB(r.fetch,`${r.url}/bucket/${e}`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:r.headers}))}async emptyBucket(e){var t=this;return t.handleOperation(async()=>await uc(t.fetch,`${t.url}/bucket/${e}/empty`,{},{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await vI(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}listBucketOptionsToQueryString(e){const t={};return e&&("limit"in e&&(t.limit=String(e.limit)),"offset"in e&&(t.offset=String(e.offset)),e.search&&(t.search=e.search),e.sortColumn&&(t.sortColumn=e.sortColumn),e.sortOrder&&(t.sortOrder=e.sortOrder)),Object.keys(t).length>0?"?"+new URLSearchParams(t).toString():""}},Khe=class extends t0{constructor(e,t={},r){const s=e.replace(/\/$/,""),a=ir(ir({},_y),t);super(s,a,r,"storage")}async createBucket(e){var t=this;return t.handleOperation(async()=>await uc(t.fetch,`${t.url}/bucket`,{name:e},{headers:t.headers}))}async listBuckets(e){var t=this;return t.handleOperation(async()=>
54{const r=new URLSearchParams;(e==null?void 0:e.limit)!==void 0&&r.set("limit",e.limit.toString()),(e==null?void 0:e.offset)!==void 0&&r.set("offset",e.offset.toString()),e!=null&&e.sortColumn&&r.set("sortColumn",e.sortColumn),e!=null&&e.sortOrder&&r.set("sortOrder",e.sortOrder),e!=null&&e.search&&r.set("search",e.search);const s=r.toString(),a=s?`${t.url}/bucket?${s}`:`${t.url}/bucket`;return await Kv(t.fetch,a,{headers:t.headers})})}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await vI(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}from(e){var t=this;if(!Ohe(e))throw new H_("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");const r=new The({baseUrl:this.url,catalogName:e,auth:{type:"custom",getHeaders:async()=>t.headers},fetch:this.fetch}),s=this.shouldThrowOnError;return new Proxy(r,{get(a,i){const o=a[i];return typeof o!="function"?o:async(...l)=>{try{return{data:await o.apply(a,l),error:null}}catch(c){if(s)throw c;return{data:null,error:c}}}}})}},Whe=class extends t0{constructor(e,t={},r){const s=e.replace(/\/$/,""),a=ir(ir({},_y),{},{"Content-Type":"application/json"},t);super(s,a,r,"vectors")}async createIndex(e){var t=this;return t.handleOperation(async()=>await Qo.post(t.fetch,`${t.url}/CreateIndex`,e,{headers:t.headers})||{})}async getIndex(e,t){var r=this;return r.handleOperation(async()=>await Qo.post(r.fetch,`${r.url}/GetIndex`,{vectorBucketName:e,indexName:t},{headers:r.headers}))}async listIndexes(e){var t=this;return t.handleOperation(async()=>await Qo.post(t.fetch,`${t.url}/ListIndexes`,e,{headers:t.headers}))}async deleteIndex(e,t){var r=this;return r.handleOperation(async()=>await Qo.post(r.fetch,`${r.url}/DeleteIndex`,{vectorBucketName:e,indexName:t},{headers:r.headers})||{})}},Yhe=class extends t0{constructor(e,t={},r){const s=e.replace(/\/$/,""),a=ir(ir({},_y),{},{"Content-Type":"application/json"},t);super(s,a,r,"vectors")}async putVectors(e){var t=this;if(e.vectors.length<1||e.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return t.handleOperation(async()=>await Qo.post(t.fetch,`${t.url}/PutVectors`,e,{headers:t.headers})||{})}async getVectors(e){var t=this;return t.handleOperation(async()=>await Qo.post(t.fetch,`${t.url}/GetVectors`,e,{headers:t.headers}))}async listVectors(e){var t=this;if(e.segmentCount!==void 0){if(e.segmentCount<1||e.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(e.segmentIndex!==void 0&&(e.segmentIndex<0||e.segmentIndex>=e.segmentCount))throw new Error(`segmentIndex must be between 0 and ${e.segmentCount-1}`)}return t.handleOperation(async()=>await Qo.post(t.fetch,`${t.url}/ListVectors`,e,{headers:t.headers}))}async queryVectors(e){var t=this;return t.handleOperation(async()=>await Qo.post(t.fetch,`${t.url}/QueryVectors`,e,{headers:t.headers}))}async deleteVectors(e){var t=this;if(e.keys.length<1||e.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return t.handleOperation(async()=>await Qo.post(t.fetch,`${t.url}/DeleteVectors`,e,{headers:t.headers})||{})}},Jhe=class extends t0{constructor(e,t={},r){const s=e.replace(/\/$/,""),a=ir(ir({},_y),{},{"Content-Type":"application/json"},t);super(s,a,r,"vectors")}async createBucket(e){var t=this;return t.handleOperation(async()=>await Qo.post(t.fetch,`${t.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}async getBucket(e){var t=this;return t.handleOperation(async()=>await Qo.post(t.fetch,`${t.url}/GetVectorBucket`,{vectorBucketName:e},{headers:t.headers}))}async listBuckets(e={}){var t=this;return t.handleOperation(async()=>await Qo.post(t.fetch,`${t.url}/ListVectorBuckets`,e,{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await Qo.post(t.fetch,`${t.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}},Xhe=class extends Jhe{constructor(e,t={}){super(e,t.headers||{},t.fetch)}from(e){return new Zhe(this.url,this.headers,e,this.fetch)}async createBucket(e){var t=()=>super.createBucket,r=this;return t().call(r,e)}async getBucket(e){var t=()=>super.getBucket,r=this;return t().call(r,e)}async listBuckets(e={}){var t=()=>super.listBuckets,r=this;return t().call(r,e)}async deleteBucket(e){var t=()=>super.deleteBucket,r=this;return t().call(r,e)}},Zhe=class extends Whe{constructor(e,t,r,s){super(e,t,s),this.vectorBucketName=r}async createIndex(e){var t=()=>super.createIndex,r=this;return t().call(r,ir(ir({},e),{},{vectorBucketName:r.vectorBucketName}))}
54async listIndexes(e={}){var t=()=>super.listIndexes,r=this;return t().call(r,ir(ir({},e),{},{vectorBucketName:r.vectorBucketName}))}async getIndex(e){var t=()=>super.getIndex,r=this;return t().call(r,r.vectorBucketName,e)}async deleteIndex(e){var t=()=>super.deleteIndex,r=this;return t().call(r,r.vectorBucketName,e)}index(e){return new efe(this.url,this.headers,this.vectorBucketName,e,this.fetch)}},efe=class extends Yhe{constructor(e,t,r,s,a){super(e,t,a),this.vectorBucketName=r,this.indexName=s}async putVectors(e){var t=()=>super.putVectors,r=this;return t().call(r,ir(ir({},e),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async getVectors(e){var t=()=>super.getVectors,r=this;return t().call(r,ir(ir({},e),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async listVectors(e={}){var t=()=>super.listVectors,r=this;return t().call(r,ir(ir({},e),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async queryVectors(e){var t=()=>super.queryVectors,r=this;return t().call(r,ir(ir({},e),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async deleteVectors(e){var t=()=>super.deleteVectors,r=this;return t().call(r,ir(ir({},e),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}},tfe=class extends qhe{constructor(e,t={},r,s){super(e,t,r,s)}from(e){return new Vhe(this.url,this.headers,e,this.fetch)}get vectors(){return new Xhe(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new Khe(this.url+"/iceberg",this.headers,this.fetch)}};const Sq="2.99.2",rA=30*1e3,iB=3,u5=iB*rA,rfe="http://localhost:9999",nfe="supabase.auth.token",sfe={"X-Client-Info":`gotrue-js/${Sq}`},oB="X-Supabase-Api-Version",kq={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},afe=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,ife=10*60*1e3;class WA extends Error{constructor(t,r,s){super(t),this.__isAuthError=!0,this.name="AuthError",this.status=r,this.code=s}}function St(e){return typeof e=="object"&&e!==null&&"__isAuthError"in e}class Eq extends WA{constructor(t,r,s){super(t,r,s),this.name="AuthApiError",this.status=r,this.code=s}}function Bq(e){return St(e)&&e.name==="AuthApiError"}class bh extends WA{constructor(t,r){super(t),this.name="AuthUnknownError",this.originalError=r}}class wd extends WA{constructor(t,r,s,a){super(t,s,a),this.name=r,this.status=s}}class Zi extends wd{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function vj(e){return St(e)&&e.name==="AuthSessionMissingError"}class Qf extends wd{constructor(){super("Auth session or user missing","AuthInvalidToken
54ResponseError",500,void 0)}}class $x extends wd{constructor(t){super(t,"AuthInvalidCredentialsError",400,void 0)}}class Qx extends wd{constructor(t,r=null){super(t,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=r}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}function Tq(e){return St(e)&&e.name==="AuthImplicitGrantRedirectError"}class lB extends wd{constructor(t,r=null){super(t,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=r}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class Pq extends wd{constructor(){super("PKCE code verifier not found in storage. This can happen if the auth flow was initiated in a different browser or device, or if the storage was cleared. For SSR frameworks (Next.js, SvelteKit, etc.), use @supabase/ssr on both the server and client to store the code verifier in cookies.","AuthPKCECodeVerifierMissingError",400,"pkce_code_verifier_not_found")}}function ofe(e){return St(e)&&e.name==="AuthPKCECodeVerifierMissingError"}class Zj extends wd{constructor(t,r){super(t,"AuthRetryableFetchError",r,void 0)}}function bj(e){return St(e)&&e.name==="AuthRetryableFetchError"}class cB extends wd{constructor(t,r,s){super(t,"AuthWeakPasswordError",r,"weak_password"),this.reasons=s}}function lfe(e){return St(e)&&e.name==="AuthWeakPasswordError"}class e2 extends wd{constructor(t){super(t,"AuthInvalidJwtError",400,"invalid_jwt")}}const t2="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),YD=` 	
55\r=`.split(""),cfe=(()=>{const e=new Array(128);for(let t=0;t<e.length;t+=1)e[t]=-1;for(let t=0;t<YD.length;t+=1)e[YD[t].charCodeAt(0)]=-2;for(let t=0;t<t2.length;t+=1)e[t2[t].charCodeAt(0)]=t;return e})();function JD(e,t,r){if(e!==null)for(t.queue=t.queue<<8|e,t.queuedBits+=8;t.queuedBits>=6;){const s=t.queue>>t.queuedBits-6&63;r(t2[s]),t.queuedBits-=6}else if(t.queuedBits>0)for(t.queue=t.queue<<6-t.queuedBits,t.queuedBits=6;t.queuedBits>=6;){const s=t.queue>>t.queuedBits-6&63;r(t2[s]),t.queuedBits-=6}}function Iq(e,t,r){const s=cfe[e];if(s>-1)for(t.queue=t.queue<<6|s,t.queuedBits+=6;t.queuedBits>=8;)r(t.queue>>t.queuedBits-8&255),t.queuedBits-=8;else{if(s===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(e)}"`)}}function XD(e){const t=[],r=o=>{t.push(String.fromCodePoint(o))},s={utf8seq:0,codepoint:0},a={queue:0,queuedBits:0},i=o=>{hfe(o,s,r)};for(let o=0;o<e.length;o+=1)Iq(e.charCodeAt(o),a,i);return t.join("")}function dfe(e,t){if(e<=127){t(e);return}else if(e<=2047){t(192|e>>6),t(128|e&63);return}else if(e<=65535){t(224|e>>12),t(128|e>>6&63),t(128|e&63);return}else if(e<=1114111){t(240|e>>18),t(128|e>>12&63),t(128|e>>6&63),t(128|e&63);return}throw new Error(`Unrecognized Unicode codepoint: ${e.toString(16)}`)}function ufe(e,t){for(let r=0;r<e.length;r+=1){let s=e.charCodeAt(r);if(s>55295&&s<=56319){const a=(s-55296)*1024&65535;s=(e.charCodeAt(r+1)-56320&65535|a)+65536,r+=1}dfe(s,t)}}function hfe(e,t,r){if(t.utf8seq===0){if(e<=127){r(e);return}for(let s=1;s<6;s+=1)if(!(e>>7-s&1)){t.utf8seq=s;break}if(t.utf8seq===2)t.codepoint=e&31;else if(t.utf8seq===3)t.codepoint=e&15;else if(t.utf8seq===4)t.codepoint=e&7;else throw new Error("Invalid UTF-8 sequence");t.utf8seq-=1}else if(t.utf8seq>0){if(e<=127)throw new Error("Invalid UTF-8 sequence");t.codepoint=t.codepoint<<6|e&63,t.utf8seq-=1,t.utf8seq===0&&r(t.codepoint)}}function EA(e){const t=[],r={queue:0,queuedBits:0},s=a=>{t.push(a)};for(let a=0;a<e.length;a+=1)Iq(e.charCodeAt(a),r,s);return new Uint8Array(t)}function ffe(e){const t=[];return ufe(e,r=>t.push(r)),new Uint8Array(t)}function om(e){const t=[],r={queue:0,queuedBits:0},s=a=>{t.push(a)};return e.forEach(a=>JD(a,r,s)),JD(null,r,s),t.join("")}function mfe(e){return Math.round(Date.now()/1e3)+e}function pfe(){return Symbol("auth-callback")}const si=()=>typeof window<"u"&&typeof document<"u",Pf={tested:!1,writable:!1},Oq=()=>{if(!si())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(Pf.tested)return Pf.writable;const e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),Pf.tested=!0,Pf.writable=!0}catch{Pf.tested=!0,Pf.writable=!1}return Pf.writable};function Afe(e){const t={},r=new URL(e);if(r.hash&&r.hash[0]==="#")try{new URLSearchParams(r.hash.substring(1)).forEac
55h((a,i)=>{t[i]=a})}catch{}return r.searchParams.forEach((s,a)=>{t[a]=s}),t}const Fq=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),gfe=e=>typeof e=="object"&&e!==null&&"status"in e&&"ok"in e&&"json"in e&&typeof e.json=="function",nA=async(e,t,r)=>{await e.setItem(t,JSON.stringify(r))},If=async(e,t)=>{const r=await e.getItem(t);if(!r)return null;try{return JSON.parse(r)}catch{return r}},ni=async(e,t)=>{await e.removeItem(t)};class V_{constructor(){this.promise=new V_.promiseConstructor((t,r)=>{this.resolve=t,this.reject=r})}}V_.promiseConstructor=Promise;function qw(e){const t=e.split(".");if(t.length!==3)throw new e2("Invalid JWT structure");for(let s=0;s<t.length;s++)if(!afe.test(t[s]))throw new e2("JWT not in base64url format");return{header:JSON.parse(XD(t[0])),payload:JSON.parse(XD(t[1])),signature:EA(t[2]),raw:{header:t[0],payload:t[1]}}}async function xfe(e){return await new Promise(t=>{setTimeout(()=>t(null),e)})}function vfe(e,t){return new Promise((s,a)=>{(async()=>{for(let i=0;i<1/0;i++)try{const o=await e(i);if(!t(i,null,o)){s(o);return}}catch(o){if(!t(i,o)){a(o);return}}})()})}function bfe(e){return("0"+e.toString(16)).substr(-2)}function yfe(){const t=new Uint32Array(56);if(typeof crypto>"u"){const r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",s=r.length;let a="";for(let i=0;i<56;i++)a+=r.charAt(Math.floor(Math.random()*s));return a}return crypto.getRandomValues(t),Array.from(t,bfe).join("")}async function wfe(e){const r=new TextEncoder().encode(e),s=await crypto.subtle.digest("SHA-256",r),a=new Uint8Array(s);return Array.from(a).map(i=>String.fromCharCode(i)).join("")}async function jfe(e){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),e;const r=await wfe(e);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Sp(e,t,r=!1){const s=yfe();let a=s;r&&(a+="/PASSWORD_RECOVERY"),await nA(e,`${t}-code-verifier`,a);const i=await jfe(s);return[i,s===i?"plain":"s256"]}const Nfe=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function _fe(e){const t=e.headers.get(oB);if(!t||!t.match(Nfe))return null;try{return new Date(`${t}T00:00:00.0Z`)}catch{return null}}function Cfe(e){if(!e)throw new Error("Missing exp claim");const t=Math.floor(Date.now()/1e3);if(e<=t)throw new Error("JWT has expired")}function Sfe(e){switch(e){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw new Error("Invalid alg claim")}}const kfe=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function kp(e){if(!kfe.test(e))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function h5(){const e={};return new Proxy(e,{get:(t,r)=>{if(r==="__isUserNotAvailableProxy")return!0;if(typeof r=="symbol"){const s=r.toString();if(s==="Symbol(Symbol.toPrimitive)"||s==="Symbol(Symbol.toStringTag)"||s==="Symbol(util.inspect.custom)")return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${r}" property of the session object is not supported. Please use getUser() instead.`)},set:(t,r)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${r}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(t,r)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${r}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function Efe(e,t){return new Proxy(e,{get:(r,s,a)=>{if(s==="__isInsecureUserWarningProxy")return!0;if(typeof s=="symbol"){const i=s.toString();if(i==="Symbol(Symbol.toPrimitive)"||i==="Symbol(Symbol.toStringTag)"||i==="Symbol(util.inspect.custom)"||i==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(r,s,a)}return!t.value&&typeof s=="string"&&(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),t.value=!0),Reflect.get(r,s,a)}})}function ZD(e){return JSON.parse(JSON.stringify(e))}const Hf=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),Bfe=[502,503,504];async function eR(e){var t;if(!gfe(e))throw new Zj(Hf(e),0);if(Bfe.includes(e.status))throw new Zj(Hf(e),e.status);let r;try{r=await e.json()}catch(i){throw new bh(Hf(i),i)}let s;const a=_fe(e);
55if(a&&a.getTime()>=kq["2024-01-01"].timestamp&&typeof r=="object"&&r&&typeof r.code=="string"?s=r.code:typeof r=="object"&&r&&typeof r.error_code=="string"&&(s=r.error_code),s){if(s==="weak_password")throw new cB(Hf(r),e.status,((t=r.weak_password)===null||t===void 0?void 0:t.reasons)||[]);if(s==="session_not_found")throw new Zi}else if(typeof r=="object"&&r&&typeof r.weak_password=="object"&&r.weak_password&&Array.isArray(r.weak_password.reasons)&&r.weak_password.reasons.length&&r.weak_password.reasons.reduce((i,o)=>i&&typeof o=="string",!0))throw new cB(Hf(r),e.status,r.weak_password.reasons);throw new Eq(Hf(r),e.status||500,s)}const Tfe=(e,t,r,s)=>{const a={method:e,headers:(t==null?void 0:t.headers)||{}};return e==="GET"?a:(a.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},t==null?void 0:t.headers),a.body=JSON.stringify(s),Object.assign(Object.assign({},a),r))};async function Xt(e,t,r,s){var a;const i=Object.assign({},s==null?void 0:s.headers);i[oB]||(i[oB]=kq["2024-01-01"].name),s!=null&&s.jwt&&(i.Authorization=`Bearer ${s.jwt}`);const o=(a=s==null?void 0:s.query)!==null&&a!==void 0?a:{};s!=null&&s.redirectTo&&(o.redirect_to=s.redirectTo);const l=Object.keys(o).length?"?"+new URLSearchParams(o).toString():"",c=await Pfe(e,t,r+l,{headers:i,noResolveJson:s==null?void 0:s.noResolveJson},{},s==null?void 0:s.body);return s!=null&&s.xform?s==null?void 0:s.xform(c):{data:Object.assign({},c),error:null}}async function Pfe(e,t,r,s,a,i){const o=Tfe(t,s,a,i);let l;try{l=await e(r,Object.assign({},o))}catch(c){throw console.error(c),new Zj(Hf(c),0)}if(l.ok||await eR(l),s!=null&&s.noResolveJson)return l;try{return await l.json()}catch(c){await eR(c)}}function ic(e){var t;let r=null;Ffe(e)&&(r=Object.assign({},e),e.expires_at||(r.expires_at=mfe(e.expires_in)));const s=(t=e.user)!==null&&t!==void 0?t:e;return{data:{session:r,user:s},error:null}}function tR(e){const t=ic(e);return!t.error&&e.weak_password&&typeof e.weak_password=="object"&&Array.isArray(e.weak_password.reasons)&&e.weak_password.reasons.length&&e.weak_password.message&&typeof e.weak_password.message=="string"&&e.weak_password.reasons.reduce((r,s)=>r&&typeof s=="string",!0)&&(t.data.weak_password=e.weak_password),t}function yh(e){var t;return{data:{user:(t=e.user)!==null&&t!==void 0?t:e},error:null}}function Ife(e){return{data:e,error:null}}function Ofe(e){const{action_link:t,email_otp:r,hashed_token:s,redirect_to:a,verification_type:i}=e,o=T_(e,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),l={action_link:t,email_otp:r,hashed_token:s,redirect_to:a,verification_type:i},c=Object.assign({},o);return{data:{properties:l,user:c},error:null}}function rR(e){return e}function Ffe(e){return e.access_token&&e.refresh_token&&e.expires_in}const yj=["global","local","others"];class bI{constructor({url:t="",headers:r={},fetch:s}){this.url=t,this.headers=r,this.fetch=Fq(s),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)},this.customProviders={listProviders:this._listCustomProviders.bind(this),createProvider:this._createCustomProvider.bind(this),getProvider:this._getCustomProvider.bind(this),updateProvider:this._updateCustomProvider.bind(this),deleteProvider:this._deleteCustomProvider.bind(this)}}async signOut(t,r=yj[0]){if(yj.indexOf(r)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${yj.join(", ")}`);try{return await Xt(this.fetch,"POST",`${this.url}/logout?scope=${r}`,{headers:this.headers,jwt:t,noResolveJson:!0}),{data:null,error:null}}catch(s){if(St(s))return{data:null,error:s};throw s}}async inviteUserByEmail(t,r={}){try{return await Xt(this.fetch,"POST",`${this.url}/invite`,{body:{email:t,data:r.data},headers:this.headers,redirectTo:r.redirectTo,xform:yh})}catch(s){if(St(s))return{data:{user:null},error:s};throw s}}async generateLink(t){try{const{options:r}=t,s=T_(t,["options"]),a=Object.assign(Object.assign({},s),r);return"newEmail"in s&&(a.new_email=s==null?void 0:s.newEmail,delete a.newEmail),await Xt(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:a,headers:this.headers,xform:Ofe,redirectTo:r==null?void 0:r.redirectTo})}catch(r){if(St(r))return{data:{properties:null,user:null},error:r};throw r}}async createUser(t){try{return await Xt(this.fetch,"POST",`${this.url}/admin/users`,{body:t,headers:this.headers,xform:yh})}catch(r){if(St(r))return{data:{user:null},error:r};throw r}}async listUsers(t){var r,s,a,i,o,l,c;try{const d={nextPage:null,lastPage:0,total:0},u=await Xt(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(s=(r=t==null?void 0:t.page)===null||r===void 0?void 0:r.toString())!==null&&s!==void 0?s:"",per_page:(i=(a=t==null?void 0:t.perPage)===null||a===void 0?void 0:a.toString())!==null&&i!==void 0?i:""},xform:rR});if(u.error)throw u.error;const h=await u.json(),m=(o=u.headers.get("x-total-count"))!==null&&o!==void 0?o:0,f=(c=(l=u.headers.get("link"))===null||l===void 0?void 0:l.split(","))!==null&&c!==void 0?c:[];return f.length>0&&(f.forEach(p=>{const A=parseInt(p.split(";")[0].split("=")[1].substring(0,1)),v=JSON.parse(p.split(";")[1].split("=")[1]);d[`${v}Page`]=A}),d.total=parseInt(m)),{data:Object.assign(Object.assign({},h),d),error:null}}catch(d){if(St(d))return{data:{users:[]},error:d};throw d}}async getUserById(t){kp(t);try{return await Xt(this.fetch,"GET",`${this.url}/admin/users/${t}`,{headers:this.headers,xform:yh})}catch(r){if(St(r))return{data:{user:null},error:r};throw r}}async updateUserById(t,r){kp(t);try{return await Xt(this.fetch,"PUT",`${this.url}/admin/users/${t}`,{body:r,headers:this.headers,xform:yh})}catch(s){if(St(s))return{data:{user:null},error:s};throw s}}async deleteUser(t,r=!1){kp(t);
55try{return await Xt(this.fetch,"DELETE",`${this.url}/admin/users/${t}`,{headers:this.headers,body:{should_soft_delete:r},xform:yh})}catch(s){if(St(s))return{data:{user:null},error:s};throw s}}async _listFactors(t){kp(t.userId);try{const{data:r,error:s}=await Xt(this.fetch,"GET",`${this.url}/admin/users/${t.userId}/factors`,{headers:this.headers,xform:a=>({data:{factors:a},error:null})});return{data:r,error:s}}catch(r){if(St(r))return{data:null,error:r};throw r}}async _deleteFactor(t){kp(t.userId),kp(t.id);try{return{data:await Xt(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/factors/${t.id}`,{headers:this.headers}),error:null}}catch(r){if(St(r))return{data:null,error:r};throw r}}async _listOAuthClients(t){var r,s,a,i,o,l,c;try{const d={nextPage:null,lastPage:0,total:0},u=await Xt(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(s=(r=t==null?void 0:t.page)===null||r===void 0?void 0:r.toString())!==null&&s!==void 0?s:"",per_page:(i=(a=t==null?void 0:t.perPage)===null||a===void 0?void 0:a.toString())!==null&&i!==void 0?i:""},xform:rR});if(u.error)throw u.error;const h=await u.json(),m=(o=u.headers.get("x-total-count"))!==null&&o!==void 0?o:0,f=(c=(l=u.headers.get("link"))===null||l===void 0?void 0:l.split(","))!==null&&c!==void 0?c:[];return f.length>0&&(f.forEach(p=>{const A=parseInt(p.split(";")[0].split("=")[1].substring(0,1)),v=JSON.parse(p.split(";")[1].split("=")[1]);d[`${v}Page`]=A}),d.total=parseInt(m)),{data:Object.assign(Object.assign({},h),d),error:null}}catch(d){if(St(d))return{data:{clients:[]},error:d};throw d}}async _createOAuthClient(t){try{return await Xt(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:t,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(St(r))return{data:null,error:r};throw r}}async _getOAuthClient(t){try{return await Xt(this.fetch,"GET",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(St(r))return{data:null,error:r};throw r}}async _updateOAuthClient(t,r){try{return await Xt(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${t}`,{body:r,headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(St(s))return{data:null,error:s};throw s}}async _deleteOAuthClient(t){try{return await Xt(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(St(r))return{data:null,error:r};throw r}}async _regenerateOAuthClientSecret(t){try{return await Xt(this.fetch,"POST",`${this.url}/admin/oauth/clients/${t}/regenerate_secret`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(St(r))return{data:null,error:r};throw r}}async _listCustomProviders(t){try{const r={};return t!=null&&t.type&&(r.type=t.type),await Xt(this.fetch,"GET",`${this.url}/admin/custom-providers`,{headers:this.headers,query:r,xform:s=>{var a;return{data:{providers:(a=s==null?void 0:s.providers)!==null&&a!==void 0?a:[]},error:null}}})}catch(r){if(St(r))return{data:{providers:[]},error:r};throw r}}async _createCustomProvider(t){try{return await Xt(this.fetch,"POST",`${this.url}/admin/custom-providers`,{body:t,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(St(r))return{data:null,error:r};throw r}}async _getCustomProvider(t){try{return await Xt(this.fetch,"GET",`${this.url}/admin/custom-providers/${t}`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(St(r))return{data:null,error:r};throw r}}async _updateCustomProvider(t,r){try{return await Xt(this.fetch,"PUT",`${this.url}/admin/custom-providers/${t}`,{body:r,headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(St(s))return{data:null,error:s};throw s}}async _deleteCustomProvider(t){try{return await Xt(this.fetch,"DELETE",`${this.url}/admin/custom-providers/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(St(r))return{data:null,error:r};throw r}}}function nR(e={}){return{getItem:t=>e[t]||null,setItem:(t,r)=>{e[t]=r},removeItem:t=>{delete e[t]}}}const qc={debug:!!(globalThis&&Oq()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};
55class yI extends Error{constructor(t){super(t),this.isAcquireTimeout=!0}}class Lq extends yI{}class Lfe extends yI{}async function Dq(e,t,r){qc.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",e,t);const s=new globalThis.AbortController;t>0&&setTimeout(()=>{s.abort(),qc.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",e)},t),await Promise.resolve();try{return await globalThis.navigator.locks.request(e,t===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:s.signal},async a=>{if(a){qc.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",e,a.name);try{return await r()}finally{qc.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",e,a.name)}}else{if(t===0)throw qc.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",e),new Lq(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if(qc.debug)try{const i=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(i,null,"  "))}catch(i){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",i)}return console.warn("@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request"),await r()}})}catch(a){if((a==null?void 0:a.name)==="AbortError"&&t>0)return qc.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire timeout, recovering by stealing lock",e),console.warn(`@supabase/gotrue-js: Lock "${e}" was not released within ${t}ms. This may indicate an orphaned lock from a component unmount (e.g., React Strict Mode). Forcefully acquiring the lock to recover.`),await Promise.resolve().then(()=>globalThis.navigator.locks.request(e,{mode:"exclusive",steal:!0},async i=>{if(i){qc.debug&&console.log("@supabase/gotrue-js: navigatorLock: recovered (stolen)",e,i.name);try{return await r()}finally{qc.debug&&console.log("@supabase/gotrue-js: navigatorLock: released (stolen)",e,i.name)}}else return console.warn("@supabase/gotrue-js: Navigator LockManager returned null lock even with steal: true"),await r()}));throw a}}const sR={};async function Dfe(e,t,r){var s;const a=(s=sR[e])!==null&&s!==void 0?s:Promise.resolve(),i=(async()=>{try{return await a,null}catch{return null}})(),o=(async()=>{let l=null;try{const c=t>=0?new Promise((d,u)=>{l=setTimeout(()=>{console.warn(`@supabase/gotrue-js: Lock "${e}" acquisition timed out after ${t}ms. This may be caused by another operation holding the lock. Consider increasing lockAcquireTimeout or checking for stuck operations.`),u(new Lfe(`Acquiring process lock with name "${e}" timed out`))},t)}):null;await Promise.race([i,c].filter(d=>d)),l!==null&&clearTimeout(l)}catch(c){if(l!==null&&clearTimeout(l),c&&c.isAcquireTimeout)throw c}return await r()})();return sR[e]=(async()=>{try{return await o}catch(l){if(l&&l.isAcquireTimeout){try{await a}catch{}return null}throw l}})(),await o}function Rfe(){if(typeof globalThis!="object")try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch{typeof self<"u"&&(self.globalThis=self)}}function Rq(e){if(!/^0x[a-fA-F0-9]{40}$/.test(e))throw new Error(`@supabase/auth-js: Address "${e}" is invalid.`);return e.toLowerCase()}function Ufe(e){return parseInt(e,16)}function Mfe(e){const t=new TextEncoder().encode(e);return"0x"+Array.from(t,s=>s.toString(16).padStart(2,"0")).join("")}function $fe(e){var t;const{chainId:r,domain:s,expirationTime:a,issuedAt:i=new Date,nonce:o,notBefore:l,requestId:c,resources:d,scheme:u,uri:h,version:m}=e;{if(!Number.isInteger(r))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${r}`);if(!s)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(o&&o.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${o}`);if(!h)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(m!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${m}`);if(!((t=e.statement)===null||t===void 0)&&t.includes(`
56`))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${e.statement}`)}const f=Rq(e.address),p=u?`${u}://${s}`:s,A=e.statement?`${e.statement}
57`:"",v=`${p} wants you to sign in with your Ethereum account:
58${f}
59
60${A}`;let x=`URI: ${h}
61Version: ${m}
62Chain ID: ${r}${o?`
63Nonce: ${o}`:""}
64Issued At: ${i.toISOString()}`;if(a&&(x+=`
65Expiration Time: ${a.toISOString()}`),l&&(x+=`
66Not Before: ${l.toISOString()}
66`),c&&(x+=`
67Request ID: ${c}`),d){let b=`
68Resources:`;for(const y of d){if(!y||typeof y!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${y}`);b+=`
69- ${y}`}x+=b}return`${v}
70${x}`}class ma extends Error{constructor({message:t,code:r,cause:s,name:a}){var i;super(t,{cause:s}),this.__isWebAuthnError=!0,this.name=(i=a??(s instanceof Error?s.name:void 0))!==null&&i!==void 0?i:"Unknown Error",this.code=r}}class r2 extends ma{constructor(t,r){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:r,message:t}),this.name="WebAuthnUnknownError",this.originalError=r}}function Qfe({error:e,options:t}){var r,s,a;const{publicKey:i}=t;if(!i)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new ma({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else if(e.name==="ConstraintError"){if(((r=i.authenticatorSelection)===null||r===void 0?void 0:r.requireResidentKey)===!0)return new ma({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:e});if(t.mediation==="conditional"&&((s=i.authenticatorSelection)===null||s===void 0?void 0:s.userVerification)==="required")return new ma({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:e});if(((a=i.authenticatorSelection)===null||a===void 0?void 0:a.userVerification)==="required")return new ma({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:e})}else{if(e.name==="InvalidStateError")return new ma({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:e});if(e.name==="NotAllowedError")return new ma({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="NotSupportedError")return i.pubKeyCredParams.filter(l=>l.type==="public-key").length===0?new ma({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:e}):new ma({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:e});if(e.name==="SecurityError"){const o=window.location.hostname;if(Uq(o)){if(i.rp.id!==o)return new ma({message:`The RP ID "${i.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new ma({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="TypeError"){if(i.user.id.byteLength<1||i.user.id.byteLength>64)return new ma({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:e})}else if(e.name==="UnknownError")return new ma({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e})}return new ma({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}function Hfe({error:e,options:t}){const{publicKey:r}=t;if(!r)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new ma({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else{if(e.name==="NotAllowedError")return new ma({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="SecurityError"){const s=window.location.hostname;if(Uq(s)){if(r.rpId!==s)return new ma({message:`The RP ID "${r.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new ma({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="UnknownError")return new ma({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ER
70ROR",cause:e})}return new ma({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}class zfe{createNewAbortSignal(){if(this.controller){const r=new Error("Cancelling existing WebAuthn API call for new one");r.name="AbortError",this.controller.abort(r)}const t=new AbortController;return this.controller=t,t.signal}cancelCeremony(){if(this.controller){const t=new Error("Manually cancelling existing WebAuthn API call");t.name="AbortError",this.controller.abort(t),this.controller=void 0}}}const Vfe=new zfe;function Gfe(e){if(!e)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(e);const{challenge:t,user:r,excludeCredentials:s}=e,a=T_(e,["challenge","user","excludeCredentials"]),i=EA(t).buffer,o=Object.assign(Object.assign({},r),{id:EA(r.id).buffer}),l=Object.assign(Object.assign({},a),{challenge:i,user:o});if(s&&s.length>0){l.excludeCredentials=new Array(s.length);for(let c=0;c<s.length;c++){const d=s[c];l.excludeCredentials[c]=Object.assign(Object.assign({},d),{id:EA(d.id).buffer,type:d.type||"public-key",transports:d.transports})}}return l}function qfe(e){if(!e)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(e);const{challenge:t,allowCredentials:r}=e,s=T_(e,["challenge","allowCredentials"]),a=EA(t).buffer,i=Object.assign(Object.assign({},s),{challenge:a});if(r&&r.length>0){i.allowCredentials=new Array(r.length);for(let o=0;o<r.length;o++){const l=r[o];i.allowCredentials[o]=Object.assign(Object.assign({},l),{id:EA(l.id).buffer,type:l.type||"public-key",transports:l.transports})}}return i}function Kfe(e){var t;if("toJSON"in e&&typeof e.toJSON=="function")return e.toJSON();const r=e;return{id:e.id,rawId:e.id,response:{attestationObject:om(new Uint8Array(e.response.attestationObject)),clientDataJSON:om(new Uint8Array(e.response.clientDataJSON))},type:"public-key",clientExtensionResults:e.getClientExtensionResults(),authenticatorAttachment:(t=r.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function Wfe(e){var t;if("toJSON"in e&&typeof e.toJSON=="function")return e.toJSON();const r=e,s=e.getClientExtensionResults(),a=e.response;return{id:e.id,rawId:e.id,response:{authenticatorData:om(new Uint8Array(a.authenticatorData)),clientDataJSON:om(new Uint8Array(a.clientDataJSON)),signature:om(new Uint8Array(a.signature)),userHandle:a.userHandle?om(new Uint8Array(a.userHandle)):void 0},type:"public-key",clientExtensionResults:s,authenticatorAttachment:(t=r.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function Uq(e){return e==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e)}function aR(){var e,t;return!!(si()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((e=navigator==null?void 0:navigator.credentials)===null||e===void 0?void 0:e.create)=="function"&&typeof((t=navigator==null?void 0:navigator.credentials)===null||t===void 0?void 0:t.get)=="function")}async function Yfe(e){try{const t=await navigator.credentials.create(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new r2("Browser returned unexpected credential type",t)}:{data:null,error:new r2("Empty credential response",t)}}catch(t){return{data:null,error:Qfe({error:t,options:e})}}}async function Jfe(e){try{const t=await navigator.credentials.get(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new r2("Browser returned unexpected credential type",t)}:{data:null,error:new r2("Empty credential response",t)}}catch(t){return{data:null,error:Hfe({error:t,options:e})}}}const Xfe={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},Zfe={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function n2(...e){const t=a=>a!==null&&typeof a=="object"&&!Array.isArray(a),r=a=>a instanceof ArrayBuffer||ArrayBuffer.isView(a),s={};for(const a of e)if(a)for(const i in a){const o=a[i];if(o!==void 0)if(Array.isArray(o))s[i]=o;else if(r(o))s[i]=o;else if(t(o)){const l=s[i];t(l)?s[i]=n2(l,o):s[i]=n2(o)}else s[i]=o}return s}function eme(e,t){return n2(Xfe,e,t||{})}function tme(e,t){return n2(Zfe,e,t||{})}class rme{constructor(t){this.client=t,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(t){return this.client.mfa.enroll(Object.assign(Object.assign({},t),{factorType:"webauthn"}))}async _challenge({factorId:t,webauthn:r,friendlyName:s,signal:a},i){var o;try{const{data:l,error:c}=await this.client.mfa.challenge({factorId:t,webauthn:r});if(!l)return{data:null,error:c};const d=a??Vfe.createNewAbortSignal();if(l.webauthn.type==="create"){const{user:u}=l.webauthn.credential_options.publicKey;if(!u.name){const h=s;if(h)u.name=`${u.id}:${h}`;else{const f=(await this.client.getUser()).data.user,p=((o=f==null?void 0:f.user_metadata)===null||o===void 0?void 0:o.name)||(f==null?void 0:f.email)||(f==null?void 0:f.id)||"User";u.name=`${u.id}:${p}`}}u.displayName||(u.displayName=u.name)}
70switch(l.webauthn.type){case"create":{const u=eme(l.webauthn.credential_options.publicKey,i==null?void 0:i.create),{data:h,error:m}=await Yfe({publicKey:u,signal:d});return h?{data:{factorId:t,challengeId:l.id,webauthn:{type:l.webauthn.type,credential_response:h}},error:null}:{data:null,error:m}}case"request":{const u=tme(l.webauthn.credential_options.publicKey,i==null?void 0:i.request),{data:h,error:m}=await Jfe(Object.assign(Object.assign({},l.webauthn.credential_options),{publicKey:u,signal:d}));return h?{data:{factorId:t,challengeId:l.id,webauthn:{type:l.webauthn.type,credential_response:h}},error:null}:{data:null,error:m}}}}catch(l){return St(l)?{data:null,error:l}:{data:null,error:new bh("Unexpected error in challenge",l)}}}async _verify({challengeId:t,factorId:r,webauthn:s}){return this.client.mfa.verify({factorId:r,challengeId:t,webauthn:s})}async _authenticate({factorId:t,webauthn:{rpId:r=typeof window<"u"?window.location.hostname:void 0,rpOrigins:s=typeof window<"u"?[window.location.origin]:void 0,signal:a}={}},i){if(!r)return{data:null,error:new WA("rpId is required for WebAuthn authentication")};try{if(!aR())return{data:null,error:new bh("Browser does not support WebAuthn",null)};const{data:o,error:l}=await this.challenge({factorId:t,webauthn:{rpId:r,rpOrigins:s},signal:a},{request:i});if(!o)return{data:null,error:l};const{webauthn:c}=o;return this._verify({factorId:t,challengeId:o.challengeId,webauthn:{type:c.type,rpId:r,rpOrigins:s,credential_response:c.credential_response}})}catch(o){return St(o)?{data:null,error:o}:{data:null,error:new bh("Unexpected error in authenticate",o)}}}async _register({friendlyName:t,webauthn:{rpId:r=typeof window<"u"?window.location.hostname:void 0,rpOrigins:s=typeof window<"u"?[window.location.origin]:void 0,signal:a}={}},i){if(!r)return{data:null,error:new WA("rpId is required for WebAuthn registration")};try{if(!aR())return{data:null,error:new bh("Browser does not support WebAuthn",null)};const{data:o,error:l}=await this._enroll({friendlyName:t});if(!o)return await this.client.mfa.listFactors().then(u=>{var h;return(h=u.data)===null||h===void 0?void 0:h.all.find(m=>m.factor_type==="webauthn"&&m.friendly_name===t&&m.status!=="unverified")}).then(u=>u?this.client.mfa.unenroll({factorId:u==null?void 0:u.id}):void 0),{data:null,error:l};const{data:c,error:d}=await this._challenge({factorId:o.id,friendlyName:o.friendly_name,webauthn:{rpId:r,rpOrigins:s},signal:a},{create:i});return c?this._verify({factorId:o.id,challengeId:c.challengeId,webauthn:{rpId:r,rpOrigins:s,type:c.webauthn.type,credential_response:c.webauthn.credential_response}}):{data:null,error:d}}catch(o){return St(o)?{data:null,error:o}:{data:null,error:new bh("Unexpected error in register",o)}}}}Rfe();const nme={url:rfe,storageKey:nfe,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:sfe,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1};async function iR(e,t,r){return await r()}const Ep={};class YA{get jwks(){var t,r;return(r=(t=Ep[this.storageKey])===null||t===void 0?void 0:t.jwks)!==null&&r!==void 0?r:{keys:[]}}set jwks(t){Ep[this.storageKey]=Object.assign(Object.assign({},Ep[this.storageKey]),{jwks:t})}get jwks_cached_at(){var t,r;return(r=(t=Ep[this.storageKey])===null||t===void 0?void 0:t.cachedAt)!==null&&r!==void 0?r:Number.MIN_SAFE_INTEGER}set jwks_cached_at(t){Ep[this.storageKey]=Object.assign(Object.assign({},Ep[this.storageKey]),{cachedAt:t})}constructor(t){var r,s,a;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.autoRefreshTickTimeout=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log;const i=Object.assign(Object.assign({},nme),t);if(this.storageKey=i.storageKey,this.instanceID=(r=YA.nextInstanceID[this.storageKey])!==null&&r!==void 0?r:0,YA.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!i.debug,typeof i.debug=="function"&&(this.logger=i.debug),this.instanceID>0&&si()){const o=`${this._logPrefix()} Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.`;console.warn(o),this.logDebugMessages&&console.trace(o)}if(this.persistSession=i.persistSession,this.autoRefreshToken=i.autoRefreshToken,this.admin=new bI({url:i.url,headers:i.headers,fetch:i.fetch}),this.url=i.url,this.headers=i.headers,this.fetch=Fq(i.fetch),this.lock=i.lock||iR,this.detectSessionInUrl=i.detectSessionInUrl,this.flowType=i.flowType,this.hasCustomAuthorizationHeader=i.hasCustomAuthorizationHeader,this.throwOnError=i.throwOnError,this.lockAcquireTimeout=i.lockAcquireTimeout,i.lock?this.lock=i.lock:this.persistSession&&si()&&(!((s=globalThis==null?void 0:globalThis.navigator)===null||s===void 0)&&s.locks)?this.lock=Dq:this.lock=iR,this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this),webauthn:new rme(this)}
70,this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this),listGrants:this._listOAuthGrants.bind(this),revokeGrant:this._revokeOAuthGrant.bind(this)},this.persistSession?(i.storage?this.storage=i.storage:Oq()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=nR(this.memoryStorage)),i.userStorage&&(this.userStorage=i.userStorage)):(this.memoryStorage={},this.storage=nR(this.memoryStorage)),si()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(o){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",o)}(a=this.broadcastChannel)===null||a===void 0||a.addEventListener("message",async o=>{this._debug("received broadcast notification from other tab or client",o);try{await this._notifyAllSubscribers(o.data.event,o.data.session,!1)}catch(l){this._debug("#broadcastChannel","error",l)}})}i.skipAutoInitialize||this.initialize().catch(o=>{this._debug("#initialize()","error",o)})}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(t){if(this.throwOnError&&t&&t.error)throw t.error;return t}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${Sq}) ${new Date().toISOString()}`}_debug(...t){return this.logDebugMessages&&this.logger(this._logPrefix(),...t),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(this.lockAcquireTimeout,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){var t;try{let r={},s="none";if(si()&&(r=Afe(window.location.href),this._isImplicitGrantCallback(r)?s="implicit":await this._isPKCECallback(r)&&(s="pkce")),si()&&this.detectSessionInUrl&&s!=="none"){const{data:a,error:i}=await this._getSessionFromURL(r,s);if(i){if(this._debug("#_initialize()","error detecting session from URL",i),Tq(i)){const c=(t=i.details)===null||t===void 0?void 0:t.code;if(c==="identity_already_exists"||c==="identity_not_found"||c==="single_identity_not_deletable")return{error:i}}return{error:i}}const{session:o,redirectType:l}=a;return this._debug("#_initialize()","detected session in URL",o,"redirect type",l),await this._saveSession(o),setTimeout(async()=>{l==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",o):await this._notifyAllSubscribers("SIGNED_IN",o)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(r){return St(r)?this._returnResult({error:r}):this._returnResult({error:new bh("Unexpected error during initialization",r)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(t){var r,s,a;try{const i=await Xt(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(s=(r=t==null?void 0:t.options)===null||r===void 0?void 0:r.data)!==null&&s!==void 0?s:{},gotrue_meta_security:{captcha_token:(a=t==null?void 0:t.options)===null||a===void 0?void 0:a.captchaToken}},xform:ic}),{data:o,error:l}=i;if(l||!o)return this._returnResult({data:{user:null,session:null},error:l});const c=o.session,d=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",c)),this._returnResult({data:{user:d,session:c},error:null})}catch(i){if(St(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signUp(t){var r,s,a;try{let i;if("email"in t){const{email:u,password:h,options:m}=t;let f=null,p=null;this.flowType==="pkce"&&([f,p]=await Sp(this.storage,this.storageKey)),i=await Xt(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:m==null?void 0:m.emailRedirectTo,body:{email:u,password:h,data:(r=m==null?void 0:m.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:m==null?void 0:m.captchaToken},code_challenge:f,code_challenge_method:p},xform:ic})}else if("phone"in t){const{phone:u,password:h,options:m}=t;i=await Xt(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:u,password:h,data:(s=m==null?void 0:m.data)!==null&&s!==void 0?s:{},channel:(a=m==null?void 0:m.channel)!==null&&a!==void 0?a:"sms",gotrue_meta_security:{captcha_token:m==null?void 0:m.captchaToken}},xform:ic})}else throw new $x("You must provide either an email or phone number and a password");const{data:o,error:l}=i;if(l||!o)return await ni(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:l});const c=o.session,d=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",c)),this._returnResult({data:{user:d,session:c},error:null})}catch(i){if(await ni(this.storage,`${this.storageKey}-code-verifier`),St(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signInWithPassword(t){try{let r;if("email"in t){const{email:i,password:o,options:l}=t;r=await Xt(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:i,password:o,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken}},xform:tR})}else if("phone"in t){const{phone:i,password:o,options:l}=t;r=await Xt(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:i,password:o,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken}},xform:tR})}else throw new $x("You must provide either an email or phone number and a password");const{data:s,error:a}=r;if(a)return this._returnResult({data:{user:null,session:null},error:a});if(!s||!s.session||!s.user){const i=new Qf;return this._returnResult({data:{user:null,session:null},error:i})}return s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers("SIGNED_IN",s.session)),this._returnResult({data:Object.assign({user:s.user,session:s.session},s.weak_password?{weakPassword:s.weak_password}:null),error:a})}catch(r){if(St(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOAuth(t){var r,s,a,i;return await this._handleProviderSignIn(t.provider,{redirectTo:(r=t.options)===null||r===void 0?void 0:r.redirectTo,scopes:(s=t.options)===null||s===void 0?void 0:s.scopes,queryParams:(a=t.options)===null||a===void 0?void 0:a.queryParams,skipBrowserRedirect:(i=t.options)===null||i===void 0?void 0:i.skipBrowserRedirect})}async exchangeCodeForSession(t){return await this.initializePromise,this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(t))}async signInWithWeb3(t){const{chain:r}=t;switch(r){case"ethereum":return await this.signInWithEthereum(t);case"solana":return await this.signInWithSolana(t);default:throw new Error(`@supabase/auth-js: Unsupported chain "${r}"`)}}async signInWithEthereum(t){var r,s,a,i,o,l,c,d,u,h,m;let f,p;if("message"in t)f=t.message,p=t.signature;else{const{chain:A,wallet:v,statement:x,options:b}=t;let y;if(si())if(typeof v=="object")y=v;else{const C=window;if("ethereum"in C&&typeof C.ethereum=="object"&&"request"in C.ethereum&&typeof C.ethereum.request=="function")y=C.ethereum;else throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.")}else{if(typeof v!="object"||!(b!=null&&b.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");y=v}const w=new URL((r=b==null?void 0:b.url)!==null&&r!==void 0?r:window.location.href),j=await y.request({method:"eth_requestAccounts"}).then(C=>C).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!j||j.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const N=Rq(j[0]);let _=(s=b==null?void 0:b.signInWithEthereum)===null||s===void 0?void 0:s.chainId;if(!_){const C=await y.request({method:"eth_chainId"});_=Ufe(C)}const S={domain:w.host,address:N,statement:x,uri:w.href,version:"1",chainId:_,nonce:(a=b==null?void 0:b.signInWithEthereum)===null||a===void 0?void 0:a.nonce,issuedAt:(o=(i=b==null?void 0:b.signInWithEthereum)===null||i===void 0?void 0:i.issuedAt)!==null&&o!==void 0?o:new Date,expirationTime:(l=b==null?void 0:b.signInWithEthereum)===null||l===void 0?void 0:l.expirationTime,notBefore:(c=b==null?void 0:b.signInWithEthereum)===null||c===void 0?void 0:c.notBefore,requestId:(d=b==null?void 0:b.signInWithEthereum)===null||d===void 0?void 0:d.requestId,resources:(u=b==null?void 0:b.signInWithEthereum)===null||u===void 0?void 0:u.resources};f=$fe(S),p=await y.request({method:"personal_sign",params:[Mfe(f),N]})}try{const{data:A,error:v}=await Xt(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:f,signature:p}
70,!((h=t.options)===null||h===void 0)&&h.captchaToken?{gotrue_meta_security:{captcha_token:(m=t.options)===null||m===void 0?void 0:m.captchaToken}}:null),xform:ic});if(v)throw v;if(!A||!A.session||!A.user){const x=new Qf;return this._returnResult({data:{user:null,session:null},error:x})}return A.session&&(await this._saveSession(A.session),await this._notifyAllSubscribers("SIGNED_IN",A.session)),this._returnResult({data:Object.assign({},A),error:v})}catch(A){if(St(A))return this._returnResult({data:{user:null,session:null},error:A});throw A}}async signInWithSolana(t){var r,s,a,i,o,l,c,d,u,h,m,f;let p,A;if("message"in t)p=t.message,A=t.signature;else{const{chain:v,wallet:x,statement:b,options:y}=t;let w;if(si())if(typeof x=="object")w=x;else{const N=window;if("solana"in N&&typeof N.solana=="object"&&("signIn"in N.solana&&typeof N.solana.signIn=="function"||"signMessage"in N.solana&&typeof N.solana.signMessage=="function"))w=N.solana;else throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if(typeof x!="object"||!(y!=null&&y.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");w=x}const j=new URL((r=y==null?void 0:y.url)!==null&&r!==void 0?r:window.location.href);if("signIn"in w&&w.signIn){const N=await w.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},y==null?void 0:y.signInWithSolana),{version:"1",domain:j.host,uri:j.href}),b?{statement:b}:null));let _;if(Array.isArray(N)&&N[0]&&typeof N[0]=="object")_=N[0];else if(N&&typeof N=="object"&&"signedMessage"in N&&"signature"in N)_=N;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in _&&"signature"in _&&(typeof _.signedMessage=="string"||_.signedMessage instanceof Uint8Array)&&_.signature instanceof Uint8Array)p=typeof _.signedMessage=="string"?_.signedMessage:new TextDecoder().decode(_.signedMessage),A=_.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in w)||typeof w.signMessage!="function"||!("publicKey"in w)||typeof w!="object"||!w.publicKey||!("toBase58"in w.publicKey)||typeof w.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");p=[`${j.host} wants you to sign in with your Solana account:`,w.publicKey.toBase58(),...b?["",b,""]:[""],"Version: 1",`URI: ${j.href}`,`Issued At: ${(a=(s=y==null?void 0:y.signInWithSolana)===null||s===void 0?void 0:s.issuedAt)!==null&&a!==void 0?a:new Date().toISOString()}`,...!((i=y==null?void 0:y.signInWithSolana)===null||i===void 0)&&i.notBefore?[`Not Before: ${y.signInWithSolana.notBefore}`]:[],...!((o=y==null?void 0:y.signInWithSolana)===null||o===void 0)&&o.expirationTime?[`Expiration Time: ${y.signInWithSolana.expirationTime}`]:[],...!((l=y==null?void 0:y.signInWithSolana)===null||l===void 0)&&l.chainId?[`Chain ID: ${y.signInWithSolana.chainId}`]:[],...!((c=y==null?void 0:y.signInWithSolana)===null||c===void 0)&&c.nonce?[`Nonce: ${y.signInWithSolana.nonce}`]:[],...!((d=y==null?void 0:y.signInWithSolana)===null||d===void 0)&&d.requestId?[`Request ID: ${y.signInWithSolana.requestId}`]:[],...!((h=(u=y==null?void 0:y.signInWithSolana)===null||u===void 0?void 0:u.resources)===null||h===void 0)&&h.length?["Resources",...y.signInWithSolana.resources.map(_=>`- ${_}`)]:[]].join(`
71`);const N=await w.signMessage(new TextEncoder().encode(p),"utf8");if(!N||!(N instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");A=N}}try{const{data:v,error:x}=await Xt(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:p,signature:om(A)},!((m=t.options)===null||m===void 0)&&m.captchaToken?{gotrue_meta_security:{captcha_token:(f=t.options)===null||f===void 0?void 0:f.captchaToken}}:null),xform:ic});if(x)throw x;if(!v||!v.session||!v.user){const b=new Qf;return this._returnResult({data:{user:null,session:null},error:b})}return v.session&&(await this._saveSession(v.session),await this._notifyAllSubscribers("SIGNED_IN",v.session)),this._returnResult({data:Object.assign({},v),error:x})}catch(v){if(St(v))return this._returnResult({data:{user:null,session:null},error:v});throw v}}async _exchangeCodeForSession(t){const r=await If(this.storage,`${this.storageKey}-code-verifier`),[s,a]=(r??"").split("/");try{if(!s&&this.flowType==="pkce")throw new Pq;const{data:i,error:o}=await Xt(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:t,code_verifier:s},xform:ic});if(await ni(this.storage,`${this.storageKey}-code-verifier`),o)throw o;if(!i||!i.session||!i.user){const l=new Qf;return this._returnResult({data:{user:null,session:null,redirectType:null},error:l})}return i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",i.session)),this._returnResult({data:Object.assign(Object.assign({},i),{redirectType:a??null}),error:o})}catch(i){if(await ni(this.storage,`${this.storageKey}-code-verifier`),St(i))return this._returnResult({data:{user:null,session:null,redirectType:null},error:i});throw i}}async signInWithIdToken(t){try{const{options:r,provider:s,token:a,access_token:i,nonce:o}=t,l=await Xt(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:s,id_token:a,access_token:i,nonce:o,gotrue_meta_security:{captcha_token:r==null?void 0:r.captchaToken}},xform:ic}),{data:c,error:d}=l;if(d)return this._returnResult({data:{user:null,session:null},error:d});if(!c||!c.session||!c.user){const u=new Qf;return this._returnResult({data:{user:null,session:null},error:u})}return c.session&&(await this._saveSession(c.session),await this._notifyAllSubscribers("SIGNED_IN",c.session)),this._returnResult({data:c,error:d})}catch(r){if(St(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOtp(t){var r,s,a,i,o;try{if("email"in t){const{email:l,options:c}=t;let d=null,u=null;this.flowType==="pkce"&&([d,u]=await Sp(this.storage,this.storageKey));const{error:h}=await Xt(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:l,data:(r=c==null?void 0:c.data)!==null&&r!==void 0?r:{},create_user:(s=c==null?void 0:c.shouldCreateUser)!==null&&s!==void 0?s:!0,gotrue_meta_security:{captcha_token:c==null?void 0:c.captchaToken},code_challenge:d,code_challenge_method:u},redirectTo:c==null?void 0:c.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:h})}if("phone"in t){const{phone:l,options:c}=t,{data:d,error:u}=await Xt(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:l,data:(a=c==null?void 0:c.data)!==null&&a!==void 0?a:{},create_user:(i=c==null?void 0:c.shouldCreateUser)!==null&&i!==void 0?i:!0,gotrue_meta_security:{captcha_token:c==null?void 0:c.captchaToken},channel:(o=c==null?void 0:c.channel)!==null&&o!==void 0?o:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:d==null?void 0:d.message_id},error:u})}throw new $x("You must provide either an email or phone number.")}catch(l){if(await ni(this.storage,`${this.storageKey}-code-verifier`),St(l))return this._returnResult({data:{user:null,session:null},error:l});throw l}}async verifyOtp(t){var r,s;try{let a,i;"options"in t&&(a=(r=t.options)===null||r===void 0?void 0:r.redirectTo,i=(s=t.options)===null||s===void 0?void 0:s.captchaToken);const{data:o,error:l}=await Xt(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},t),{gotrue_meta_security:{captcha_token:i}}),redirectTo:a,xform:ic});if(l)throw l;if(!o)throw new Error("An error occurred on token verification.");const c=o.session,d=o.user;return c!=null&&c.access_token&&(await this._saveSession(c),await this._notifyAllSubscribers(t.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",c)),this._returnResult({data:{user:d,session:c},error:null})}catch(a){if(St(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async signInWithSSO(t){var r,s,a,i,o;try{let l=null,c=null;this.flowType==="pkce"&&([l,c]=await Sp(this.storage,this.storageKey));const d=await Xt(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in t?{provider_id:t.providerId}:null),"domain"in t?{domain:t.domain}:null),{redirect_to:(s=(r=t.options)===null||r===void 0?void 0:r.redirectTo)!==null&&s!==void 0?s:void 0}),!((a=t==null?void 0:t.options)===null||a===void 0)&&a.captchaToken?{gotrue_meta_security:{captcha_token:t.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:l,code_challenge_method:c}),headers:this.headers,xform:Ife});return!((i=d.data)===null||i===void 0)&&i.url&&si()&&!(!((o=t.options)===null||o===void 0)&&o.skipBrowserRedirect)&&window.location.assign(d.data.url),this._returnResult(d)}catch(l){if(await ni(this.storage,`${this.storageKey}-code-verifier`),St(l))return this._returnResult({data:null,error:l});throw l}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async t=>{const{data:{session:r},error:s}=t;if(s)throw s;if(!r)throw new Zi;const{error:a}=await Xt(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:r.access_token});return this._returnResult({data:{user:null,session:null},error:a})})}catch(t){if(St(t))return this._returnResult({data:{user:null,session:null},error:t});throw t}}async resend(t){try{const r=`${this.url}/resend`;if("email"in t){const{email:s,type:a,options:i}=t,{error:o}=await Xt(this.fetch,"POST",r,{headers:this.headers,body:{email:s,type:a,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}},redirectTo:i==null?void 0:i.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:o})}else if("phone"in t){const{phone:s,type:a,options:i}=t,{data:o,error:l}=await Xt(this.fetch,"POST",r,{headers:this.headers,body:{phone:s,type:a,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:o==null?void 0:o.message_id},error:l})}throw new $x("You must provide either an email or phone number and a type")}catch(r){if(St(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async getSession(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async r=>r))}async _acquireLock(t,r){this._debug("#_acquireLock","begin",t);try{if(this.lockAcquired){const s=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),a=(async()=>(await s,await r()))();return this.pendingInLock.push((async()=>{try{await a}catch{}})()),a}return await this.lock(`lock:${this.storageKey}`,t,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const s=r();for(this.pendingInLock.push((async()=>{try{await s}catch{}})()),await s;this.pendingInLock.length;){const a=[...this.pendingInLock];await Promise.all(a),this.pendingInLock.splice(0,a.length)}return await s}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(t){this._debug("#_useSession","begin");try{const r=await this.__loadSession();return await t(r)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let t=null;const r=await If(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",r),r!==null&&(this._isValidSession(r)?t=r:(this._debug("#getSession()","session from storage is not val
71id"),await this._removeSession())),!t)return{data:{session:null},error:null};const s=t.expires_at?t.expires_at*1e3-Date.now()<u5:!1;if(this._debug("#__loadSession()",`session has${s?"":" not"} expired`,"expires_at",t.expires_at),!s){if(this.userStorage){const o=await If(this.userStorage,this.storageKey+"-user");o!=null&&o.user?t.user=o.user:t.user=h5()}if(this.storage.isServer&&t.user&&!t.user.__isUserNotAvailableProxy){const o={value:this.suppressGetSessionWarning};t.user=Efe(t.user,o),o.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:t},error:null}}const{data:a,error:i}=await this._callRefreshToken(t.refresh_token);return i?this._returnResult({data:{session:null},error:i}):this._returnResult({data:{session:a},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(t){if(t)return await this._getUser(t);await this.initializePromise;const r=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser());return r.data.user&&(this.suppressGetSessionWarning=!0),r}async _getUser(t){try{return t?await Xt(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:t,xform:yh}):await this._useSession(async r=>{var s,a,i;const{data:o,error:l}=r;if(l)throw l;return!(!((s=o.session)===null||s===void 0)&&s.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new Zi}:await Xt(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(i=(a=o.session)===null||a===void 0?void 0:a.access_token)!==null&&i!==void 0?i:void 0,xform:yh})})}catch(r){if(St(r))return vj(r)&&(await this._removeSession(),await ni(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:r});throw r}}async updateUser(t,r={}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(t,r))}async _updateUser(t,r={}){try{return await this._useSession(async s=>{const{data:a,error:i}=s;if(i)throw i;if(!a.session)throw new Zi;const o=a.session;let l=null,c=null;this.flowType==="pkce"&&t.email!=null&&([l,c]=await Sp(this.storage,this.storageKey));const{data:d,error:u}=await Xt(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:r==null?void 0:r.emailRedirectTo,body:Object.assign(Object.assign({},t),{code_challenge:l,code_challenge_method:c}),jwt:o.access_token,xform:yh});if(u)throw u;return o.user=d.user,await this._saveSession(o),await this._notifyAllSubscribers("USER_UPDATED",o),this._returnResult({data:{user:o.user},error:null})})}catch(s){if(await ni(this.storage,`${this.storageKey}-code-verifier`),St(s))return this._returnResult({data:{user:null},error:s});throw s}}async setSession(t){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(t))}async _setSession(t){try{if(!t.access_token||!t.refresh_token)throw new Zi;const r=Date.now()/1e3;let s=r,a=!0,i=null;const{payload:o}=qw(t.access_token);if(o.exp&&(s=o.exp,a=s<=r),a){const{data:l,error:c}=await this._callRefreshToken(t.refresh_token);if(c)return this._returnResult({data:{user:null,session:null},error:c});if(!l)return{data:{user:null,session:null},error:null};i=l}else{const{data:l,error:c}=await this._getUser(t.access_token);if(c)return this._returnResult({data:{user:null,session:null},error:c});i={access_token:t.access_token,refresh_token:t.refresh_token,user:l.user,token_type:"bearer",expires_in:s-r,expires_at:s},await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)}return this._returnResult({data:{user:i.user,session:i},error:null})}catch(r){if(St(r))return this._returnResult({data:{session:null,user:null},error:r});throw r}}async refreshSession(t){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(t))}async _refreshSession(t){try{return await this._useSession(async r=>{var s;if(!t){const{data:o,error:l}=r;if(l)throw l;t=(s=o.session)!==null&&s!==void 0?s:void 0}if(!(t!=null&&t.refresh_token))throw new Zi;const{data:a,error:i}=await this._callRefreshToken(t.refresh_token);return i?this._returnResult({data:{user:null,session:null},error:i}):a?this._returnResult({data:{user:a.user,session:a},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(r){if(St(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async _getSessionFromURL(t,r){try{if(!si())throw new Qx("No browser detected.");
71if(t.error||t.error_description||t.error_code)throw new Qx(t.error_description||"Error in URL with unspecified error_description",{error:t.error||"unspecified_error",code:t.error_code||"unspecified_code"});switch(r){case"implicit":if(this.flowType==="pkce")throw new lB("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new Qx("Not a valid implicit grant flow url.");break;default:}if(r==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!t.code)throw new lB("No code detected.");const{data:b,error:y}=await this._exchangeCodeForSession(t.code);if(y)throw y;const w=new URL(window.location.href);return w.searchParams.delete("code"),window.history.replaceState(window.history.state,"",w.toString()),{data:{session:b.session,redirectType:null},error:null}}const{provider_token:s,provider_refresh_token:a,access_token:i,refresh_token:o,expires_in:l,expires_at:c,token_type:d}=t;if(!i||!l||!o||!d)throw new Qx("No session defined in URL");const u=Math.round(Date.now()/1e3),h=parseInt(l);let m=u+h;c&&(m=parseInt(c));const f=m-u;f*1e3<=rA&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${f}s, should have been closer to ${h}s`);const p=m-h;u-p>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",p,m,u):u-p<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",p,m,u);const{data:A,error:v}=await this._getUser(i);if(v)throw v;const x={provider_token:s,provider_refresh_token:a,access_token:i,expires_in:h,expires_at:m,refresh_token:o,token_type:d,user:A.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:x,redirectType:t.type},error:null})}catch(s){if(St(s))return this._returnResult({data:{session:null,redirectType:null},error:s});throw s}}_isImplicitGrantCallback(t){return typeof this.detectSessionInUrl=="function"?this.detectSessionInUrl(new URL(window.location.href),t):!!(t.access_token||t.error_description)}async _isPKCECallback(t){const r=await If(this.storage,`${this.storageKey}-code-verifier`);return!!(t.code&&r)}async signOut(t={scope:"global"}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(t))}async _signOut({scope:t}={scope:"global"}){return await this._useSession(async r=>{var s;const{data:a,error:i}=r;if(i&&!vj(i))return this._returnResult({error:i});const o=(s=a.session)===null||s===void 0?void 0:s.access_token;if(o){const{error:l}=await this.admin.signOut(o,t);if(l&&!(Bq(l)&&(l.status===404||l.status===401||l.status===403)||vj(l)))return this._returnResult({error:l})}return t!=="others"&&(await this._removeSession(),await ni(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(t){const r=pfe(),s={id:r,callback:t,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",r),this.stateChangeEmitters.delete(r)}};return this._debug("#onAuthStateChange()","registered callback with id",r),this.stateChangeEmitters.set(r,s),(async()=>(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(r)})))(),{data:{subscription:s}}}async _emitInitialSession(t){return await this._useSession(async r=>{var s,a;try{const{data:{session:i},error:o}=r;if(o)throw o;await((s=this.stateChangeEmitters.get(t))===null||s===void 0?void 0:s.callback("INITIAL_SESSION",i)),this._debug("INITIAL_SESSION","callback id",t,"session",i)}catch(i){await((a=this.stateChangeEmitters.get(t))===null||a===void 0?void 0:a.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",t,"error",i),console.error(i)}})}async resetPasswordForEmail(t,r={}){let s=null,a=null;this.flowType==="pkce"&&([s,a]=await Sp(this.storage,this.storageKey,!0));try{return await Xt(this.fetch,"POST",`${this.url}/recover`,{body:{email:t,code_challenge:s,code_challenge_method:a,gotrue_meta_security:{captcha_token:r.captchaToken}},headers:this.headers,redirectTo:r.redirectTo})}catch(i){if(await ni(this.storage,`${this.storageKey}-code-verifier`),St(i))return this._returnResult({data:null,error:i});throw i}}async getUserIdentities(){var t;try{const{data:r,error:s}=await this.getUser();if(s)throw s;return this._returnResult({data:{identities:(t=r.user.identities)!==null&&t!==void 0?t:[]},error:null})}catch(r){if(St(r))return this._returnResult({data:null,error:r});throw r}}async linkIdentity(t){return"token"in t?this.linkIdentityIdToken(t):this.linkIdentityOAuth(t)}async linkIdentityOAuth(t){var r;try{const{data:s,error:a}=await this._useSession(async i=>{var o,l,c,d,u;const{data:h,error:m}=i;if(m)throw m;const f=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,t.provider,{redirectTo:(o=t.options)===null||o===void 0?void 0:o.redirectTo,scopes:(l=t.options)===null||l===void 0?void 0:l.scopes,queryParams:(c=t.options)===null||c===void 0?void 0:c.queryParams,skipBrowserRedirect:!0});return await Xt(this.fetch,"GET",f,{headers:this.headers,jwt:(u=(d=h.session)===null||d===void 0?void 0:d.access_token)!==null&&u!==void 0?u:void 0})});if(a)throw a;return si()&&!(!((r=t.options)===null||r===void 0)&&r.skipBrowserRedirect)&&window.location.assign(s==null?void 0:s.url),this._returnResult({data:{provider:t.provider,url:s==null?void 0:s.url},error:null})}catch(s){if(St(s))return this._returnResult({data:{provider:t.provider,url:null},error:s});throw s}}async linkIdentityIdToken(t){return await this._useSession(async r=>{var s;try{const{error:a,data:{session:i}}=r;if(a)throw a;const{options:o,provider:l,token:c,access_token:d,nonce:u}=t,h=await Xt(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(s=i==null?void 0:i.access_token)!==null&&s!==void 0?s:void 0,body:{provider:l,id_token:c,access_token:d,nonce:u,link_identity:!0,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}},xform:ic}),{data:m,error:f}=h;return f?this._returnResult({data:{user:null,session:null},error:f}):!m||!m.session||!m.user?this._returnResult({data:{user:null,session:null},error:new Qf}):(m.session&&(await this._saveSession(m.session),await this._notifyAllSubscribers("USER_UPDATED",m.session)),this._returnResult({data:m,error:f}))}catch(a){if(await ni(this.storage,`${this.storageKey}-code-verifier`),St(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}})}async unlinkIdentity(t){try{return await this._useSession(async r=>{var s,a;const{data:i,error:o}=r;if(o)throw o;
71return await Xt(this.fetch,"DELETE",`${this.url}/user/identities/${t.identity_id}`,{headers:this.headers,jwt:(a=(s=i.session)===null||s===void 0?void 0:s.access_token)!==null&&a!==void 0?a:void 0})})}catch(r){if(St(r))return this._returnResult({data:null,error:r});throw r}}async _refreshAccessToken(t){const r=`#_refreshAccessToken(${t.substring(0,5)}...)`;this._debug(r,"begin");try{const s=Date.now();return await vfe(async a=>(a>0&&await xfe(200*Math.pow(2,a-1)),this._debug(r,"refreshing attempt",a),await Xt(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:t},headers:this.headers,xform:ic})),(a,i)=>{const o=200*Math.pow(2,a);return i&&bj(i)&&Date.now()+o-s<rA})}catch(s){if(this._debug(r,"error",s),St(s))return this._returnResult({data:{session:null,user:null},error:s});throw s}finally{this._debug(r,"end")}}_isValidSession(t){return typeof t=="object"&&t!==null&&"access_token"in t&&"refresh_token"in t&&"expires_at"in t}async _handleProviderSignIn(t,r){const s=await this._getUrlForProvider(`${this.url}/authorize`,t,{redirectTo:r.redirectTo,scopes:r.scopes,queryParams:r.queryParams});return this._debug("#_handleProviderSignIn()","provider",t,"options",r,"url",s),si()&&!r.skipBrowserRedirect&&window.location.assign(s),{data:{provider:t,url:s},error:null}}async _recoverAndRefresh(){var t,r;const s="#_recoverAndRefresh()";this._debug(s,"begin");try{const a=await If(this.storage,this.storageKey);if(a&&this.userStorage){let o=await If(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!o&&(o={user:a.user},await nA(this.userStorage,this.storageKey+"-user",o)),a.user=(t=o==null?void 0:o.user)!==null&&t!==void 0?t:h5()}else if(a&&!a.user&&!a.user){const o=await If(this.storage,this.storageKey+"-user");o&&(o!=null&&o.user)?(a.user=o.user,await ni(this.storage,this.storageKey+"-user"),await nA(this.storage,this.storageKey,a)):a.user=h5()}if(this._debug(s,"session from storage",a),!this._isValidSession(a)){this._debug(s,"session is not valid"),a!==null&&await this._removeSession();return}const i=((r=a.expires_at)!==null&&r!==void 0?r:1/0)*1e3-Date.now()<u5;if(this._debug(s,`session has${i?"":" not"} expired with margin of ${u5}
71s`),i){if(this.autoRefreshToken&&a.refresh_token){const{error:o}=await this._callRefreshToken(a.refresh_token);o&&(console.error(o),bj(o)||(this._debug(s,"refresh failed with a non-retryable error, removing the session",o),await this._removeSession()))}}else if(a.user&&a.user.__isUserNotAvailableProxy===!0)try{const{data:o,error:l}=await this._getUser(a.access_token);!l&&(o!=null&&o.user)?(a.user=o.user,await this._saveSession(a),await this._notifyAllSubscribers("SIGNED_IN",a)):this._debug(s,"could not get user data, skipping SIGNED_IN notification")}catch(o){console.error("Error getting user data:",o),this._debug(s,"error getting user data, skipping SIGNED_IN notification",o)}else await this._notifyAllSubscribers("SIGNED_IN",a)}catch(a){this._debug(s,"error",a),console.error(a);return}finally{this._debug(s,"end")}}async _callRefreshToken(t){var r,s;if(!t)throw new Zi;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const a=`#_callRefreshToken(${t.substring(0,5)}...)`;this._debug(a,"begin");try{this.refreshingDeferred=new V_;const{data:i,error:o}=await this._refreshAccessToken(t);if(o)throw o;if(!i.session)throw new Zi;await this._saveSession(i.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",i.session);const l={data:i.session,error:null};return this.refreshingDeferred.resolve(l),l}catch(i){if(this._debug(a,"error",i),St(i)){const o={data:null,error:i};return bj(i)||await this._removeSession(),(r=this.refreshingDeferred)===null||r===void 0||r.resolve(o),o}throw(s=this.refreshingDeferred)===null||s===void 0||s.reject(i),i}finally{this.refreshingDeferred=null,this._debug(a,"end")}}async _notifyAllSubscribers(t,r,s=!0){const a=`#_notifyAllSubscribers(${t})`;this._debug(a,"begin",r,`broadcast = ${s}`);try{this.broadcastChannel&&s&&this.broadcastChannel.postMessage({event:t,session:r});const i=[],o=Array.from(this.stateChangeEmitters.values()).map(async l=>{try{await l.callback(t,r)}catch(c){i.push(c)}});if(await Promise.all(o),i.length>0){for(let l=0;l<i.length;l+=1)console.error(i[l]);throw i[0]}}finally{this._debug(a,"end")}}async _saveSession(t){this._debug("#_saveSession()",t),this.suppressGetSessionWarning=!0,await ni(this.storage,`${this.storageKey}-code-verifier`);const r=Object.assign({},t),s=r.user&&r.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!s&&r.user&&await nA(this.userStorage,this.storageKey+"-user",{user:r.user});const a=Object.assign({},r);delete a.user;const i=ZD(a);await nA(this.storage,this.storageKey,i)}else{const a=ZD(r);await nA(this.storage,this.storageKey,a)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await ni(this.storage,this.storageKey),await ni(this.storage,this.storageKey+"-code-verifier"),await ni(this.storage,this.storageKey+"-user"),this.userStorage&&await ni(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const t=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{t&&si()&&(window!=null&&window.removeEventListener)&&window.removeEventListener("visibilitychange",t)}catch(r){console.error("removing visibilitychange callback failed",r)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const t=setInterval(()=>this._autoRefreshTokenTick(),rA);this.autoRefreshTicker=t,t&&typeof t=="object"&&typeof t.unref=="function"?t.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(t);const r=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=r,r&&typeof r=="object"&&typeof r.unref=="function"?r.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(r)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const t=this.autoRefreshTicker;this.autoRefreshTicker=null,t&&clearInterval(t);const r=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,r&&clearTimeout(r)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{const t=Date.now();try{return await this._useSession(async r=>{const{data:{session:s}}=r;if(!s||!s.refresh_token||!s.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const a=Math.floor((s.expires_at*1e3-t)/rA);this._debug("#_autoRefreshTokenTick()",`access token expires in ${a} ticks, a tick lasts ${rA}ms, refresh threshold is ${iB} ticks`),a<=iB&&await this._callRefreshToken(s.refresh_token)})}catch(r){console.error("Auto refresh tick failed with error. This is likely a transient error.",r)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(t){if(t.isAcquireTimeout||t instanceof yI)this._debug("auto refresh token tick lock not available");else throw t}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!si()||!(window!=null&&window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>{try{await this._onVisibilityChanged(!1)}catch(t){this._debug("#visibilityChangedCallback","error",t)}},window==null||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(t){console.error("_handleVisibilityChange",t)}}async _onVisibilityChanged(t){const r=`#_onVisibilityChanged(${t})`;this._debug(r,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),t||(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>
71{if(document.visibilityState!=="visible"){this._debug(r,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()}))):document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(t,r,s){const a=[`provider=${encodeURIComponent(r)}`];if(s!=null&&s.redirectTo&&a.push(`redirect_to=${encodeURIComponent(s.redirectTo)}`),s!=null&&s.scopes&&a.push(`scopes=${encodeURIComponent(s.scopes)}`),this.flowType==="pkce"){const[i,o]=await Sp(this.storage,this.storageKey),l=new URLSearchParams({code_challenge:`${encodeURIComponent(i)}`,code_challenge_method:`${encodeURIComponent(o)}`});a.push(l.toString())}if(s!=null&&s.queryParams){const i=new URLSearchParams(s.queryParams);a.push(i.toString())}return s!=null&&s.skipBrowserRedirect&&a.push(`skip_http_redirect=${s.skipBrowserRedirect}`),`${t}?${a.join("&")}`}async _unenroll(t){try{return await this._useSession(async r=>{var s;const{data:a,error:i}=r;return i?this._returnResult({data:null,error:i}):await Xt(this.fetch,"DELETE",`${this.url}/factors/${t.factorId}`,{headers:this.headers,jwt:(s=a==null?void 0:a.session)===null||s===void 0?void 0:s.access_token})})}catch(r){if(St(r))return this._returnResult({data:null,error:r});throw r}}async _enroll(t){try{return await this._useSession(async r=>{var s,a;const{data:i,error:o}=r;if(o)return this._returnResult({data:null,error:o});const l=Object.assign({friendly_name:t.friendlyName,factor_type:t.factorType},t.factorType==="phone"?{phone:t.phone}:t.factorType==="totp"?{issuer:t.issuer}:{}),{data:c,error:d}=await Xt(this.fetch,"POST",`${this.url}/factors`,{body:l,headers:this.headers,jwt:(s=i==null?void 0:i.session)===null||s===void 0?void 0:s.access_token});return d?this._returnResult({data:null,error:d}):(t.factorType==="totp"&&c.type==="totp"&&(!((a=c==null?void 0:c.totp)===null||a===void 0)&&a.qr_code)&&(c.totp.qr_code=`data:image/svg+xml;utf-8,${c.totp.qr_code}`),this._returnResult({data:c,error:null}))})}catch(r){if(St(r))return this._returnResult({data:null,error:r});throw r}}async _verify(t){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async r=>{var s;const{data:a,error:i}=r;if(i)return this._returnResult({data:null,error:i});const o=Object.assign({challenge_id:t.challengeId},"webauthn"in t?{webauthn:Object.assign(Object.assign({},t.webauthn),{credential_response:t.webauthn.type==="create"?Kfe(t.webauthn.credential_response):Wfe(t.webauthn.credential_response)})}:{code:t.code}),{data:l,error:c}=await Xt(this.fetch,"POST",`${this.url}/factors/${t.factorId}/verify`,{body:o,headers:this.headers,jwt:(s=a==null?void 0:a.session)===null||s===void 0?void 0:s.access_token});return c?this._returnResult({data:null,error:c}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+l.expires_in},l)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",l),this._returnResult({data:l,error:c}))})}catch(r){if(St(r))return this._returnResult({data:null,error:r});throw r}})}async _challenge(t){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async r=>{var s;const{data:a,error:i}=r;if(i)return this._returnResult({data:null,error:i});const o=await Xt(this.fetch,"POST",`${this.url}/factors/${t.factorId}/challenge`,{body:t,headers:this.headers,jwt:(s=a==null?void 0:a.session)===null||s===void 0?void 0:s.access_token});if(o.error)return o;const{data:l}=o;if(l.type!=="webauthn")return{data:l,error:null};switch(l.webauthn.type){case"create":return{data:Object.assign(Object.assign({},l),{webauthn:Object.assign(Object.assign({},l.webauthn),{credential_options:Object.assign(Object.assign({},l.webauthn.credential_options),{publicKey:Gfe(l.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},l),{webauthn:Object.assign(Object.assign({},l.webauthn),{credential_options:Object.assign(Object.assign({},l.webauthn.credential_options),{publicKey:qfe(l.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(r){if(St(r))return this._returnResult({data:null,error:r});throw r}})}async _challengeAndVerify(t){const{data:r,error:s}=await this._challenge({factorId:t.factorId});return s?this._returnResult({data:null,error:s}):await this._verify({factorId:t.factorId,challengeId:r.id,code:t.code})}async _listFactors(){var t;const{data:{user:r},error:s}=await this.getUser();if(s)return{data:null,error:s};const a={all:[],phone:[],totp:[],webauthn:[]};for(const i of(t=r==null?void 0:r.factors)!==null&&t!==void 0?t:[])a.all.push(i),i.status==="verified"&&a[i.factor_type].push(i);return{data:a,error:null}}async _getAuthenticatorAssuranceLevel(t){var r,s,a,i;if(t)try{const{payload:f}=qw(t);let p=null;f.aal&&(p=f.aal);let A=p;const{data:{user:v},error:x}=await this.getUser(t);if(x)return this._returnResult({data:null,error:x});((s=(r=v==null?void 0:v.factors)===null||r===void 0?void 0:r.filter(w=>w.status==="verified"))!==null&&s!==void 0?s:[]).length>0&&(A="aal2");const y=f.amr||[];return{data:{currentLevel:p,nextLevel:A,currentAuthenticationMethods:y},error:null}}catch(f){if(St(f))return this._returnResult({data:null,error:f});throw f}const{data:{session:o},error:l}
71=await this.getSession();if(l)return this._returnResult({data:null,error:l});if(!o)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:c}=qw(o.access_token);let d=null;c.aal&&(d=c.aal);let u=d;((i=(a=o.user.factors)===null||a===void 0?void 0:a.filter(f=>f.status==="verified"))!==null&&i!==void 0?i:[]).length>0&&(u="aal2");const m=c.amr||[];return{data:{currentLevel:d,nextLevel:u,currentAuthenticationMethods:m},error:null}}async _getAuthorizationDetails(t){try{return await this._useSession(async r=>{const{data:{session:s},error:a}=r;return a?this._returnResult({data:null,error:a}):s?await Xt(this.fetch,"GET",`${this.url}/oauth/authorizations/${t}`,{headers:this.headers,jwt:s.access_token,xform:i=>({data:i,error:null})}):this._returnResult({data:null,error:new Zi})})}catch(r){if(St(r))return this._returnResult({data:null,error:r});throw r}}async _approveAuthorization(t,r){try{return await this._useSession(async s=>{const{data:{session:a},error:i}=s;if(i)return this._returnResult({data:null,error:i});if(!a)return this._returnResult({data:null,error:new Zi});const o=await Xt(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:a.access_token,body:{action:"approve"},xform:l=>({data:l,error:null})});return o.data&&o.data.redirect_url&&si()&&!(r!=null&&r.skipBrowserRedirect)&&window.location.assign(o.data.redirect_url),o})}catch(s){if(St(s))return this._returnResult({data:null,error:s});throw s}}async _denyAuthorization(t,r){try{return await this._useSession(async s=>{const{data:{session:a},error:i}=s;if(i)return this._returnResult({data:null,error:i});if(!a)return this._returnResult({data:null,error:new Zi});const o=await Xt(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:a.access_token,body:{action:"deny"},xform:l=>({data:l,error:null})});return o.data&&o.data.redirect_url&&si()&&!(r!=null&&r.skipBrowserRedirect)&&window.location.assign(o.data.redirect_url),o})}catch(s){if(St(s))return this._returnResult({data:null,error:s});throw s}}async _listOAuthGrants(){try{return await this._useSession(async t=>{const{data:{session:r},error:s}=t;return s?this._returnResult({data:null,error:s}):r?await Xt(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:r.access_token,xform:a=>({data:a,error:null})}):this._returnResult({data:null,error:new Zi})})}catch(t){if(St(t))return this._returnResult({data:null,error:t});throw t}}async _revokeOAuthGrant(t){try{return await this._useSession(async r=>{const{data:{session:s},error:a}=r;return a?this._returnResult({data:null,error:a}):s?(await Xt(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:s.access_token,query:{client_id:t.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new Zi})})}catch(r){if(St(r))return this._returnResult({data:null,error:r});throw r}}async fetchJwk(t,r={keys:[]}){let s=r.keys.find(l=>l.kid===t);if(s)return s;const a=Date.now();if(s=this.jwks.keys.find(l=>l.kid===t),s&&this.jwks_cached_at+ife>a)return s;const{data:i,error:o}=await Xt(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(o)throw o;return!i.keys||i.keys.length===0||(this.jwks=i,this.jwks_cached_at=a,s=i.keys.find(l=>l.kid===t),!s)?null:s}async getClaims(t,r={}){try{let s=t;if(!s){const{data:f,error:p}
71=await this.getSession();if(p||!f.session)return this._returnResult({data:null,error:p});s=f.session.access_token}const{header:a,payload:i,signature:o,raw:{header:l,payload:c}}=qw(s);r!=null&&r.allowExpired||Cfe(i.exp);const d=!a.alg||a.alg.startsWith("HS")||!a.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(a.kid,r!=null&&r.keys?{keys:r.keys}:r==null?void 0:r.jwks);if(!d){const{error:f}=await this.getUser(s);if(f)throw f;return{data:{claims:i,header:a,signature:o},error:null}}const u=Sfe(a.alg),h=await crypto.subtle.importKey("jwk",d,u,!0,["verify"]);if(!await crypto.subtle.verify(u,h,o,ffe(`${l}.${c}`)))throw new e2("Invalid JWT signature");return{data:{claims:i,header:a,signature:o},error:null}}catch(s){if(St(s))return this._returnResult({data:null,error:s});throw s}}}YA.nextInstanceID={};const sme=bI,Mq=YA,ame="2.99.2";let Hx="";typeof Deno<"u"?Hx="deno":typeof document<"u"?Hx="web":typeof navigator<"u"&&navigator.product==="ReactNative"?Hx="react-native":Hx="node";const ime={"X-Client-Info":`supabase-js-${Hx}/${ame}`},ome={headers:ime},lme={schema:"public"},cme={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},dme={};function Wv(e){"@babel/helpers - typeof";return Wv=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Wv(e)}function ume(e,t){if(Wv(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(Wv(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function hme(e){var t=ume(e,"string");return Wv(t)=="symbol"?t:t+""}function fme(e,t,r){return(t=hme(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function oR(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,s)}return r}function Us(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?oR(Object(r),!0).forEach(function(s){fme(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):oR(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}const mme=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),pme=()=>Headers,Ame=(e,t,r)=>{const s=mme(r),a=pme();return async(i,o)=>{var l;const c=(l=await t())!==null&&l!==void 0?l:e;let d=new a(o==null?void 0:o.headers);return d.has("apikey")||d.set("apikey",e),d.has("Authorization")||d.set("Authorization",`Bearer ${c}`),s(i,Us(Us({},o),{},{headers:d}))}};function gme(e){return e.endsWith("/")?e:e+"/"}function xme(e,t){var r,s;const{db:a,auth:i,realtime:o,global:l}=e,{db:c,auth:d,realtime:u,global:h}=t,m={db:Us(Us({},c),a),auth:Us(Us({},d),i),realtime:Us(Us({},u),o),storage:{},global:Us(Us(Us({},h),l),{},{headers:Us(Us({},(r=h==null?void 0:h.headers)!==null&&r!==void 0?r:{}),(s=l==null?void 0:l.headers)!==null&&s!==void 0?s:{})}),accessToken:async()=>""};return e.accessToken?m.accessToken=e.accessToken:delete m.accessToken,m}function vme(e){const t=e==null?void 0:e.trim();if(!t)throw new Error("supabaseUrl is required.");if(!t.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(gme(t))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var bme=class extends Mq{constructor(e){super(e)}},$q=class{constructor(e,t,r){var s,a;this.supabaseUrl=e,this.supabaseKey=t;const i=vme(e);if(!t)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",i),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",i),this.storageUrl=new URL("storage/v1",i),this.functionsUrl=new URL("functions/v1",i);const o=`sb-${i.hostname.split(".")[0]}-auth-token`,l={db:lme,realtime:dme,auth:Us(Us({},cme),{},{storageKey:o}),global:ome},c=xme(r??{},l);if(this.storageKey=(s=c.auth.storageKey)!==null&&s!==void 0?s:"",this.headers=(a=c.global.headers)!==null&&a!==void 0?a:{},c.accessToken)this.accessToken=c.accessToken,this.auth=new Proxy({},{get:(u,h)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(h)} is not possible`)}});else{var d;this.auth=this._initSupabaseAuthClient((d=c.auth)!==null&&d!==void 0?d:{},this.headers,c.global.fetch)}this.fetch=Ame(t,this._getAccessToken.bind(this),c.global.fetch),this.realtime=this._initRealtimeClient(Us({headers:this.headers,accessToken:this._getAccessToken.bind(this)},c.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(u=>this.realtime.setAuth(u)).catch(u=>console.warn("Failed to set initial Realtime auth token:",u)),this.rest=new che(new URL("rest/v1",i).href,{headers:this.headers,schema:c.db.schema,fetch:this.fetch,timeout:c.db.timeout,urlLengthLimit:c.db.urlLengthLimit}),this.storage=new tfe(this.storageUrl.href,this.headers,this.fetch,r==null?void 0:r.storage),c.accessToken||this._listenForAuthEvents()}get functions(){return new rhe(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,t={},r={head:!1,get:!1,count:void 0}){return this.rest.rpc(e,t,r)}
71channel(e,t={config:{}}){return this.realtime.channel(e,t)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var e=this,t,r;if(e.accessToken)return await e.accessToken();const{data:s}=await e.auth.getSession();return(t=(r=s.session)===null||r===void 0?void 0:r.access_token)!==null&&t!==void 0?t:e.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:r,storage:s,userStorage:a,storageKey:i,flowType:o,lock:l,debug:c,throwOnError:d},u,h){const m={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new bme({url:this.authUrl.href,headers:Us(Us({},m),u),storageKey:i,autoRefreshToken:e,persistSession:t,detectSessionInUrl:r,storage:s,userStorage:a,flowType:o,lock:l,debug:c,throwOnError:d,fetch:h,hasCustomAuthorizationHeader:Object.keys(this.headers).some(f=>f.toLowerCase()==="authorization")})}_initRealtimeClient(e){return new jq(this.realtimeUrl.href,Us(Us({},e),{},{params:Us(Us({},{apikey:this.supabaseKey}),e==null?void 0:e.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((e,t)=>{this._handleTokenChanged(e,"CLIENT",t==null?void 0:t.access_token)})}_handleTokenChanged(e,t,r){(e==="TOKEN_REFRESHED"||e==="SIGNED_IN")&&this.changedAccessToken!==r?(this.changedAccessToken=r,this.realtime.setAuth(r)):e==="SIGNED_OUT"&&(this.realtime.setAuth(),t=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const Qq=(e,t,r)=>new $q(e,t,r);function yme(){if(typeof window<"u")return!1;const e=globalThis.process;if(!e)return!1;const t=e.version;if(t==null)return!1;const r=t.match(/^v(\d+)\./);return r?parseInt(r[1],10)<=18:!1}yme()&&console.warn("⚠️  Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217");const lR=Object.freeze(Object.defineProperty({__proto__:null,AuthAdminApi:sme,AuthApiError:Eq,AuthClient:Mq,AuthError:WA,AuthImplicitGrantRedirectError:Qx,AuthInvalidCredentialsError:$x,AuthInvalidJwtError:e2,AuthInvalidToken
vendor: 7,155 bytes, line 71
71ResponseError:Qf,AuthPKCECodeVerifierMissingError:Pq,AuthPKCEGrantCodeExchangeError:lB,AuthRetryableFetchError:Zj,AuthSessionMissingError:Zi,AuthUnknownError:bh,AuthWeakPasswordError:cB,CustomAuthError:wd,get FunctionRegion(){return Xj},FunctionsError:Q_,FunctionsFetchError:pq,FunctionsHttpError:X4,FunctionsRelayError:J4,GoTrueAdminApi:bI,GoTrueClient:YA,NavigatorLockAcquireTimeoutError:Lq,PostgrestError:Aq,REALTIME_CHANNEL_STATES:whe,get REALTIME_LISTEN_TYPES(){return kA},get REALTIME_POSTGRES_CHANGES_LISTEN_EVENT(){return nB},get REALTIME_PRESENCE_LISTEN_EVENTS(){return rB},get REALTIME_SUBSCRIBE_STATES(){return Jc},RealtimeChannel:im,RealtimeClient:jq,RealtimePresence:SA,SIGN_OUT_SCOPES:yj,SupabaseClient:$q,WebSocketFactory:xq,createClient:Qq,isAuthApiError:Bq,isAuthError:St,isAuthImplicitGrantRedirectError:Tq,isAuthPKCECodeVerifierMissingError:ofe,isAuthRetryableFetchError:bj,isAuthSessionMissingError:vj,isAuthWeakPasswordError:lfe,lockInternals:qc,navigatorLock:Dq,processLock:Dfe},Symbol.toStringTag,{value:"Module"}));var un;(function(e){e.assertEqual=a=>{};function t(a){}e.assertIs=t;function r(a){throw new Error}e.assertNever=r,e.arrayToEnum=a=>{const i={};for(const o of a)i[o]=o;return i},e.getValidEnumValues=a=>{const i=e.objectKeys(a).filter(l=>typeof a[a[l]]!="number"),o={};for(const l of i)o[l]=a[l];return e.objectValues(o)},e.objectValues=a=>e.objectKeys(a).map(function(i){return a[i]}),e.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{const i=[];for(const o in a)Object.prototype.hasOwnProperty.call(a,o)&&i.push(o);return i},e.find=(a,i)=>{for(const o of a)if(i(o))return o},e.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function s(a,i=" | "){return a.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}e.joinValues=s,e.jsonStringifyReplacer=(a,i)=>typeof i=="bigint"?i.toString():i})(un||(un={}));var cR;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(cR||(cR={}));const Mt=un.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ph=e=>{switch(typeof e){case"undefined":return Mt.undefined;case"string":return Mt.string;case"number":return Number.isNaN(e)?Mt.nan:Mt.number;case"boolean":return Mt.boolean;case"function":return Mt.function;case"bigint":return Mt.bigint;case"symbol":return Mt.symbol;case"object":return Array.isArray(e)?Mt.array:e===null?Mt.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?Mt.promise:typeof Map<"u"&&e instanceof Map?Mt.map:typeof Set<"u"&&e instanceof Set?Mt.set:typeof Date<"u"&&e instanceof Date?Mt.date:Mt.object;default:return Mt.unknown}},dt=un.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class md extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){const r=t||function(i){return i.message},s={_errors:[]},a=i=>{for(const o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(a);else if(o.code==="invalid_return_type")a(o.returnTypeError);else if(o.code==="invalid_arguments")a(o.argumentsError);else if(o.path.length===0)s._errors.push(r(o));else{let l=s,c=0;for(;c<o.path.length;){const d=o.path[c];c===o.path.length-1?(l[d]=l[d]||{_errors:[]},l[d]._errors.push(r(o))):l[d]=l[d]||{_errors:[]},l=l[d],c++}}};return a(this),s}static assert(t){if(!(t instanceof md))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,un.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){const r={},s=[];for(const a of this.issues)if(a.path.length>0){const i=a.path[0];r[i]=r[i]||[],r[i].push(t(a))}else s.push(t(a));return{formErrors:s,fieldErrors:r}}get formErrors(){return this.flatten()}}md.create=e=>new md(e);const dB=(e,t)=>{let r;switch(e.code){case dt.invalid_type:e.received===Mt.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case dt.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,un.jsonStringifyReplacer)}`;break;case dt.unrecognized_keys:r=`Unrecognized key(s) in object: ${un.joinValues(e.keys,", ")}`;break;case dt.invalid_union:r="Invalid input";break;case dt.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${un.joinValues(e.options)}`;break;case dt.invalid_enum_value:r=`Invalid enum value. Expected ${un.joinValues(e.options)}, received '${e.received}'`;break;case dt.invalid_arguments:r="Invalid function arguments";break;case dt.invalid_return_type:r="Invalid function return type";break;case dt.invalid_date:r="Invalid date";break;case dt.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:un.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case dt.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case dt.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case dt.custom:r="Invalid input";break;
vendor: 5,030 bytes, line 71
71case dt.invalid_intersection_types:r="Intersection results could not be merged";break;case dt.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case dt.not_finite:r="Number must be finite";break;default:r=t.defaultError,un.assertNever(e)}return{message:r}};let wme=dB;function jme(){return wme}const Nme=e=>{const{data:t,path:r,errorMaps:s,issueData:a}=e,i=[...r,...a.path||[]],o={...a,path:i};if(a.message!==void 0)return{...a,path:i,message:a.message};let l="";const c=s.filter(d=>!!d).slice().reverse();for(const d of c)l=d(o,{data:t,defaultError:l}).message;return{...a,path:i,message:l}};function wt(e,t){const r=jme(),s=Nme({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===dB?void 0:dB].filter(a=>!!a)});e.common.issues.push(s)}class nl{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){const s=[];for(const a of r){if(a.status==="aborted")return Br;a.status==="dirty"&&t.dirty(),s.push(a.value)}return{status:t.value,value:s}}static async mergeObjectAsync(t,r){const s=[];for(const a of r){const i=await a.key,o=await a.value;s.push({key:i,value:o})}return nl.mergeObjectSync(t,s)}static mergeObjectSync(t,r){const s={};for(const a of r){const{key:i,value:o}=a;if(i.status==="aborted"||o.status==="aborted")return Br;i.status==="dirty"&&t.dirty(),o.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||a.alwaysSet)&&(s[i.value]=o.value)}return{status:t.value,value:s}}}const Br=Object.freeze({status:"aborted"}),zx=e=>({status:"dirty",value:e}),Ql=e=>({status:"valid",value:e}),dR=e=>e.status==="aborted",uR=e=>e.status==="dirty",JA=e=>e.status==="valid",s2=e=>typeof Promise<"u"&&e instanceof Promise;var Vt;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(Vt||(Vt={}));class Qh{constructor(t,r,s,a){this._cachedPath=[],this.parent=t,this.data=r,this._path=s,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const hR=(e,t)=>{if(JA(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const r=new md(e.common.issues);return this._error=r,this._error}}};function Gr(e){if(!e)return{};const{errorMap:t,invalid_type_error:r,required_error:s,description:a}=e;if(t&&(r||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:a}:{errorMap:(o,l)=>{const{message:c}=e;return o.code==="invalid_enum_value"?{message:c??l.defaultError}:typeof l.data>"u"?{message:c??s??l.defaultError}:o.code!=="invalid_type"?{message:l.defaultError}:{message:c??r??l.defaultError}},description:a}}class dn{get description(){return this._def.description}_getType(t){return ph(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:ph(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new nl,ctx:{common:t.parent.common,data:t.data,parsedType:ph(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const r=this._parse(t);if(s2(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){const r=this._parse(t);return Promise.resolve(r)}parse(t,r){const s=this.safeParse(t,r);if(s.success)return s.data;throw s.error}safeParse(t,r){const s={common:{issues:[],async:(r==null?void 0:r.async)??!1,contextualErrorMap:r==null?void 0:r.errorMap},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:ph(t)},a=this._parseSync({data:t,path:s.path,parent:s});return hR(s,a)}"~validate"(t){var s,a;const r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:ph(t)};if(!this["~standard"].async)try{const i=this._parseSync({data:t,path:[],parent:r});return JA(i)?{value:i.value}:{issues:r.common.issues}}catch(i){(a=(s=i==null?void 0:i.message)==null?void 0:s.toLowerCase())!=null&&a.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(i=>JA(i)?{value:i.value}:{issues:r.common.issues})}async parseAsync(t,r){const s=await this.safeParseAsync(t,r);if(s.success)return s.data;throw s.error}async safeParseAsync(t,r){const s={common:{issues:[],contextualErrorMap:r==null?void 0:r.errorMap,async:!0},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:ph(t)},a=this._parse({data:t,path:s.path,parent:s}),i=await(s2(a)?a:Promise.resolve(a));return hR(s,i)}refine(t,r){const s=a=>typeof r=="string"||typeof r>"u"?{message:r}
vendor: 6,231 bytes, line 71
71:typeof r=="function"?r(a):r;return this._refinement((a,i)=>{const o=t(a),l=()=>i.addIssue({code:dt.custom,...s(a)});return typeof Promise<"u"&&o instanceof Promise?o.then(c=>c?!0:(l(),!1)):o?!0:(l(),!1)})}refinement(t,r){return this._refinement((s,a)=>t(s)?!0:(a.addIssue(typeof r=="function"?r(s,a):r),!1))}_refinement(t){return new eg({schema:this,typeName:Tr.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return Oh.create(this,this._def)}nullable(){return tg.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return od.create(this)}promise(){return l2.create(this,this._def)}or(t){return i2.create([this,t],this._def)}and(t){return o2.create(this,t,this._def)}transform(t){return new eg({...Gr(this._def),schema:this,typeName:Tr.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const r=typeof t=="function"?t:()=>t;return new fB({...Gr(this._def),innerType:this,defaultValue:r,typeName:Tr.ZodDefault})}brand(){return new qme({typeName:Tr.ZodBranded,type:this,...Gr(this._def)})}catch(t){const r=typeof t=="function"?t:()=>t;return new mB({...Gr(this._def),innerType:this,catchValue:r,typeName:Tr.ZodCatch})}describe(t){const r=this.constructor;return new r({...this._def,description:t})}pipe(t){return wI.create(this,t)}readonly(){return pB.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const _me=/^c[^\s-]{8,}$/i,Cme=/^[0-9a-z]+$/,Sme=/^[0-9A-HJKMNP-TV-Z]{26}$/i,kme=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Eme=/^[a-z0-9_-]{21}$/i,Bme=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Tme=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Pme=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Ime="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let f5;const Ome=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Fme=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Lme=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Dme=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Rme=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Ume=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Hq="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Mme=new RegExp(`^${Hq}$`);function zq(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);const r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function $me(e){return new RegExp(`^${zq(e)}$`)}function Qme(e){let t=`${Hq}T${zq(e)}`;const r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function Hme(e,t){return!!((t==="v4"||!t)&&Ome.test(e)||(t==="v6"||!t)&&Lme.test(e))}function zme(e,t){if(!Bme.test(e))return!1;try{const[r]=e.split(".");if(!r)return!1;const s=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),a=JSON.parse(atob(s));return!(typeof a!="object"||a===null||"typ"in a&&(a==null?void 0:a.typ)!=="JWT"||!a.alg||t&&a.alg!==t)}catch{return!1}}function Vme(e,t){return!!((t==="v4"||!t)&&Fme.test(e)||(t==="v6"||!t)&&Dme.test(e))}class lu extends dn{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==Mt.string){const i=this._getOrReturnCtx(t);
vendor: 19,335 bytes, line 71
71return wt(i,{code:dt.invalid_type,expected:Mt.string,received:i.parsedType}),Br}const s=new nl;let a;for(const i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(a=this._getOrReturnCtx(t,a),wt(a,{code:dt.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),s.dirty());else if(i.kind==="max")t.data.length>i.value&&(a=this._getOrReturnCtx(t,a),wt(a,{code:dt.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),s.dirty());else if(i.kind==="length"){const o=t.data.length>i.value,l=t.data.length<i.value;(o||l)&&(a=this._getOrReturnCtx(t,a),o?wt(a,{code:dt.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):l&&wt(a,{code:dt.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),s.dirty())}else if(i.kind==="email")Pme.test(t.data)||(a=this._getOrReturnCtx(t,a),wt(a,{validation:"email",code:dt.invalid_string,message:i.message}),s.dirty());else if(i.kind==="emoji")f5||(f5=new RegExp(Ime,"u")),f5.test(t.data)||(a=this._getOrReturnCtx(t,a),wt(a,{validation:"emoji",code:dt.invalid_string,message:i.message}),s.dirty());else if(i.kind==="uuid")kme.test(t.data)||(a=this._getOrReturnCtx(t,a),wt(a,{validation:"uuid",code:dt.invalid_string,message:i.message}),s.dirty());else if(i.kind==="nanoid")Eme.test(t.data)||(a=this._getOrReturnCtx(t,a),wt(a,{validation:"nanoid",code:dt.invalid_string,message:i.message}),s.dirty());else if(i.kind==="cuid")_me.test(t.data)||(a=this._getOrReturnCtx(t,a),wt(a,{validation:"cuid",code:dt.invalid_string,message:i.message}),s.dirty());else if(i.kind==="cuid2")Cme.test(t.data)||(a=this._getOrReturnCtx(t,a),wt(a,{validation:"cuid2",code:dt.invalid_string,message:i.message}),s.dirty());else if(i.kind==="ulid")Sme.test(t.data)||(a=this._getOrReturnCtx(t,a),wt(a,{validation:"ulid",code:dt.invalid_string,message:i.message}),s.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{a=this._getOrReturnCtx(t,a),wt(a,{validation:"url",code:dt.invalid_string,message:i.message}),s.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(a=this._getOrReturnCtx(t,a),wt(a,{validation:"regex",code:dt.invalid_string,message:i.message}),s.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(a=this._getOrReturnCtx(t,a),wt(a,{code:dt.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),s.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(a=this._getOrReturnCtx(t,a),wt(a,{code:dt.invalid_string,validation:{startsWith:i.value},message:i.message}),s.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(a=this._getOrReturnCtx(t,a),wt(a,{code:dt.invalid_string,validation:{endsWith:i.value},message:i.message}),s.dirty()):i.kind==="datetime"?Qme(i).test(t.data)||(a=this._getOrReturnCtx(t,a),wt(a,{code:dt.invalid_string,validation:"datetime",message:i.message}),s.dirty()):i.kind==="date"?Mme.test(t.data)||(a=this._getOrReturnCtx(t,a),wt(a,{code:dt.invalid_string,validation:"date",message:i.message}),s.dirty()):i.kind==="time"?$me(i).test(t.data)||(a=this._getOrReturnCtx(t,a),wt(a,{code:dt.invalid_string,validation:"time",message:i.message}),s.dirty()):i.kind==="duration"?Tme.test(t.data)||(a=this._getOrReturnCtx(t,a),wt(a,{validation:"duration",code:dt.invalid_string,message:i.message}),s.dirty()):i.kind==="ip"?Hme(t.data,i.version)||(a=this._getOrReturnCtx(t,a),wt(a,{validation:"ip",code:dt.invalid_string,message:i.message}),s.dirty()):i.kind==="jwt"?zme(t.data,i.alg)||(a=this._getOrReturnCtx(t,a),wt(a,{validation:"jwt",code:dt.invalid_string,message:i.message}),s.dirty()):i.kind==="cidr"?Vme(t.data,i.version)||(a=this._getOrReturnCtx(t,a),wt(a,{validation:"cidr",code:dt.invalid_string,message:i.message}),s.dirty()):i.kind==="base64"?Rme.test(t.data)||(a=this._getOrReturnCtx(t,a),wt(a,{validation:"base64",code:dt.invalid_string,message:i.message}),s.dirty()):i.kind==="base64url"?Ume.test(t.data)||(a=this._getOrReturnCtx(t,a),wt(a,{validation:"base64url",code:dt.invalid_string,message:i.message}),s.dirty()):un.assertNever(i);return{status:s.value,value:t.data}}_regex(t,r,s){return this.refinement(a=>t.test(a),{validation:r,code:dt.invalid_string,...Vt.errToObj(s)})}_addCheck(t){return new lu({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...Vt.errToObj(t)})}url(t){return this._addCheck({kind:"url",...Vt.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...Vt.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...Vt.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...Vt.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...Vt.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...Vt.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...Vt.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...Vt.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...Vt.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...Vt.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...Vt.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...Vt.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(t==null?void 0:t.offset)??!1,local:(t==null?void 0:t.local)??!1,...Vt.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...Vt.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...Vt.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...Vt.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r==null?void 0:r.position,...Vt.errToObj(r==null?void 0:r.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...Vt.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...Vt.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...Vt.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...Vt.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...Vt.errToObj(r)})}nonempty(t){return this.min(1,Vt.errToObj(t))}trim(){return new lu({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new lu({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new lu({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}}lu.create=e=>new lu({checks:[],typeName:Tr.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...Gr(e)});function Gme(e,t){const r=(e.toString().split(".")[1]||"").length,s=(t.toString().split(".")[1]||"").length,a=r>s?r:s,i=Number.parseInt(e.toFixed(a).replace(".","")),o=Number.parseInt(t.toFixed(a).replace(".",""));return i%o/10**a}class Em extends dn{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==Mt.number){const i=this._getOrReturnCtx(t);return wt(i,{code:dt.invalid_type,expected:Mt.number,received:i.parsedType}),Br}let s;const a=new nl;for(const i of this._def.checks)i.kind==="int"?un.isInteger(t.data)||(s=this._getOrReturnCtx(t,s),wt(s,{code:dt.invalid_type,expected:"integer",received:"float",message:i.message}),a.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(s=this._getOrReturnCtx(t,s),wt(s,{code:dt.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),a.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(s=this._getOrReturnCtx(t,s),wt(s,{code:dt.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),a.dirty()):i.kind==="multipleOf"?Gme(t.data,i.value)!==0&&(s=this._getOrReturnCtx(t,s),wt(s,{code:dt.not_multiple_of,multipleOf:i.value,message:i.message}),a.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(s=this._getOrReturnCtx(t,s),wt(s,{code:dt.not_finite,message:i.message}),a.dirty()):un.assertNever(i);return{status:a.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,Vt.toString(r))}gt(t,r){return this.setLimit("min",t,!1,Vt.toString(r))}lte(t,r){return this.setLimit("max",t,!0,Vt.toString(r))}lt(t,r){return this.setLimit("max",t,!1,Vt.toString(r))}setLimit(t,r,s,a){return new Em({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:s,message:Vt.toString(a)}]})}_addCheck(t){return new Em({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:Vt.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Vt.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Vt.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Vt.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Vt.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:Vt.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:Vt.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Vt.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Vt.toString(t)})}get minValue(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&un.isInteger(t.value))}get isFinite(){let t=null,r=null;for(const s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(r===null||s.value>r)&&(r=s.value):s.kind==="max"&&(t===null||s.value<t)&&(t=s.value)}return Number.isFinite(r)&&Number.isFinite(t)}}Em.create=e=>new Em({checks:[],typeName:Tr.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...Gr(e)});class Bm extends dn{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==Mt.bigint)return this._getInvalidInput(t);let s;const a=new nl;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(s=this._getOrReturnCtx(t,s),wt(s,{code:dt.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),a.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(s=this._getOrReturnCtx(t,s),wt(s,{code:dt.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),a.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(s=this._getOrReturnCtx(t,s),wt(s,{code:dt.not_multiple_of,multipleOf:i.value,message:i.message}),a.dirty()):un.assertNever(i);return{status:a.value,value:t.data}}_getInvalidInput(t){const r=this._getOrReturnCtx(t);return wt(r,{code:dt.invalid_type,expected:Mt.bigint,received:r.parsedType}),Br}gte(t,r){return this.setLimit("min",t,!0,Vt.toString(r))}gt(t,r){return this.setLimit("min",t,!1,Vt.toString(r))}lte(t,r){return this.setLimit("max",t,!0,Vt.toString(r))}lt(t,r){return this.setLimit("max",t,!1,Vt.toString(r))}setLimit(t,r,s,a){return new Bm({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:s,message:Vt.toString(a)}]})}_addCheck(t){return new Bm({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Vt.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Vt.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Vt.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Vt.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:Vt.toString(r)})}get minValue(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}}Bm.create=e=>new Bm({checks:[],typeName:Tr.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...Gr(e)});class a2 extends dn{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==Mt.boolean){const s=this._getOrReturnCtx(t);return wt(s,{code:dt.invalid_type,expected:Mt.boolean,received:s.parsedType}),Br}return Ql(t.data)}}a2.create=e=>new a2({typeName:Tr.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...Gr(e)});class XA extends dn{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==Mt.date){const i=this._getOrReturnCtx(t);return wt(i,{code:dt.invalid_type,expected:Mt.date,received:i.parsedType}),Br}if(Number.isNaN(t.data.getTime())){const i=this._getOrReturnCtx(t);return wt(i,{code:dt.invalid_date}),Br}const s=new nl;let a;for(const i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(a=this._getOrReturnCtx(t,a),wt(a,{code:dt.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),s.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(a=this._getOrReturnCtx(t,a),wt(a,{code:dt.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),s.dirty()):un.assertNever(i);return{status:s.value,value:new Date(t.data.getTime())}}_addCheck(t){return new XA({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:Vt.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:Vt.toString(r)})}get minDate(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}}XA.create=e=>new XA({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:Tr.ZodDate,...Gr(e)});class fR extends dn{_parse(t){if(this._getType(t)!==Mt.symbol){const s=this._getOrReturnCtx(t);return wt(s,{code:dt.invalid_type,expected:Mt.symbol,received:s.parsedType}),Br}return Ql(t.data)}}fR.create=e=>new fR({typeName:Tr.ZodSymbol,...Gr(e)});class mR extends dn{_parse(t){if(this._getType(t)!==Mt.undefined){const s=this._getOrReturnCtx(t);return wt(s,{code:dt.invalid_type,expected:Mt.undefined,received:s.parsedType}),Br}return Ql(t.data)}}mR.create=e=>new mR({typeName:Tr.ZodUndefined,...Gr(e)});class pR extends dn{_parse(t){if(this._getType(t)!==Mt.null){const s=this._getOrReturnCtx(t);return wt(s,{code:dt.invalid_type,expected:Mt.null,received:s.parsedType}),Br}return Ql(t.data)}}pR.create=e=>new pR({typeName:Tr.ZodNull,...Gr(e)});class AR extends dn{constructor(){super(...arguments),this._any=!0}_parse(t){return Ql(t.data)}}AR.create=e=>new AR({typeName:Tr.ZodAny,...Gr(e)});class gR extends dn{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Ql(t.data)}}gR.create=e=>new gR({typeName:Tr.ZodUnknown,...Gr(e)});class Hh extends dn{_parse(t){const r=this._getOrReturnCtx(t);return wt(r,{code:dt.invalid_type,expected:Mt.never,received:r.parsedType}),Br}}Hh.create=e=>new Hh({typeName:Tr.ZodNever,...Gr(e)});class xR extends dn{_parse(t){if(this._getType(t)!==Mt.undefined){const s=this._getOrReturnCtx(t);return wt(s,{code:dt.invalid_type,expected:Mt.void,received:s.parsedType}),Br}return Ql(t.data)}}xR.create=e=>new xR({typeName:Tr.ZodVoid,...Gr(e)});class od extends dn{_parse(t){const{ctx:r,status:s}=this._processInputParams(t),a=this._def;if(r.parsedType!==Mt.array)return wt(r,{code:dt.invalid_type,expected:Mt.array,received:r.parsedType}),Br;if(a.exactLength!==null){const o=r.data.length>a.exactLength.value,l=r.data.length<a.exactLength.value;(o||l)&&(wt(r,{code:o?dt.too_big:dt.too_small,minimum:l?a.exactLength.value:void 0,maximum:o?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),s.dirty())}if(a.minLength!==null&&r.data.length<a.minLength.value&&(wt(r,{code:dt.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),s.dirty()),a.maxLength!==null&&r.data.length>a.maxLength.value&&(wt(r,{code:dt.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),s.dirty()),r.common.async)return Promise.all([...r.data].map((o,l)=>a.type._parseAsync(new Qh(r,o,r.path,l)))).then(o=>nl.mergeArray(s,o));const i=[...r.data].map((o,l)=>a.type._parseSync(new Qh(r,o,r.path,l)));return nl.mergeArray(s,i)}get element(){return this._def.type}min(t,r){return new od({...this._def,minLength:{value:t,message:Vt.toString(r)}})}max(t,r){return new od({...this._def,maxLength:{value:t,message:Vt.toString(r)}})}length(t,r){return new od({...this._def,exactLength:{value:t,message:Vt.toString(r)}})}nonempty(t){return this.min(1,t)}}od.create=(e,t)=>new od({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Tr.ZodArray,...Gr(t)});function sA(e){if(e instanceof pa){const t={};for(const r in e.shape){const s=e.shape[r];t[r]=Oh.create(sA(s))}return new pa({...e._def,shape:()=>t})}else return e instanceof od?new od({...e._def,type:sA(e.element)}):e instanceof Oh?Oh.create(sA(e.unwrap())):e instanceof tg?tg.create(sA(e.unwrap())):e instanceof Tm?Tm.create(e.items.map(t=>sA(t))):e}class pa extends dn{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;
vendor: 4,147 bytes, line 71
71const t=this._def.shape(),r=un.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==Mt.object){const d=this._getOrReturnCtx(t);return wt(d,{code:dt.invalid_type,expected:Mt.object,received:d.parsedType}),Br}const{status:s,ctx:a}=this._processInputParams(t),{shape:i,keys:o}=this._getCached(),l=[];if(!(this._def.catchall instanceof Hh&&this._def.unknownKeys==="strip"))for(const d in a.data)o.includes(d)||l.push(d);const c=[];for(const d of o){const u=i[d],h=a.data[d];c.push({key:{status:"valid",value:d},value:u._parse(new Qh(a,h,a.path,d)),alwaysSet:d in a.data})}if(this._def.catchall instanceof Hh){const d=this._def.unknownKeys;if(d==="passthrough")for(const u of l)c.push({key:{status:"valid",value:u},value:{status:"valid",value:a.data[u]}});else if(d==="strict")l.length>0&&(wt(a,{code:dt.unrecognized_keys,keys:l}),s.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const d=this._def.catchall;for(const u of l){const h=a.data[u];c.push({key:{status:"valid",value:u},value:d._parse(new Qh(a,h,a.path,u)),alwaysSet:u in a.data})}}return a.common.async?Promise.resolve().then(async()=>{const d=[];for(const u of c){const h=await u.key,m=await u.value;d.push({key:h,value:m,alwaysSet:u.alwaysSet})}return d}).then(d=>nl.mergeObjectSync(s,d)):nl.mergeObjectSync(s,c)}get shape(){return this._def.shape()}strict(t){return Vt.errToObj,new pa({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,s)=>{var i,o;const a=((o=(i=this._def).errorMap)==null?void 0:o.call(i,r,s).message)??s.defaultError;return r.code==="unrecognized_keys"?{message:Vt.errToObj(t).message??a}:{message:a}}}:{}})}strip(){return new pa({...this._def,unknownKeys:"strip"})}passthrough(){return new pa({...this._def,unknownKeys:"passthrough"})}extend(t){return new pa({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new pa({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Tr.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new pa({...this._def,catchall:t})}pick(t){const r={};for(const s of un.objectKeys(t))t[s]&&this.shape[s]&&(r[s]=this.shape[s]);return new pa({...this._def,shape:()=>r})}omit(t){const r={};for(const s of un.objectKeys(this.shape))t[s]||(r[s]=this.shape[s]);return new pa({...this._def,shape:()=>r})}deepPartial(){return sA(this)}partial(t){const r={};for(const s of un.objectKeys(this.shape)){const a=this.shape[s];t&&!t[s]?r[s]=a:r[s]=a.optional()}return new pa({...this._def,shape:()=>r})}required(t){const r={};for(const s of un.objectKeys(this.shape))if(t&&!t[s])r[s]=this.shape[s];else{let i=this.shape[s];for(;i instanceof Oh;)i=i._def.innerType;r[s]=i}return new pa({...this._def,shape:()=>r})}keyof(){return Vq(un.objectKeys(this.shape))}}pa.create=(e,t)=>new pa({shape:()=>e,unknownKeys:"strip",catchall:Hh.create(),typeName:Tr.ZodObject,...Gr(t)});pa.strictCreate=(e,t)=>new pa({shape:()=>e,unknownKeys:"strict",catchall:Hh.create(),typeName:Tr.ZodObject,...Gr(t)});pa.lazycreate=(e,t)=>new pa({shape:e,unknownKeys:"strip",catchall:Hh.create(),typeName:Tr.ZodObject,...Gr(t)});class i2 extends dn{_parse(t){const{ctx:r}=this._processInputParams(t),s=this._def.options;function a(i){for(const l of i)if(l.result.status==="valid")return l.result;for(const l of i)if(l.result.status==="dirty")return r.common.issues.push(...l.ctx.common.issues),l.result;const o=i.map(l=>new md(l.ctx.common.issues));return wt(r,{code:dt.invalid_union,unionErrors:o}),Br}if(r.common.async)return Promise.all(s.map(async i=>{const o={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:o}),ctx:o}})).then(a);{let i;const o=[];for(const c of s){const d={...r,common:{...r.common,issues:[]},parent:null},u=c._parseSync({data:r.data,path:r.path,parent:d});if(u.status==="valid")return u;u.status==="dirty"&&!i&&(i={result:u,ctx:d}),d.common.issues.length&&o.push(d.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;const l=o.map(c=>new md(c));
vendor: 4,521 bytes, line 71
71return wt(r,{code:dt.invalid_union,unionErrors:l}),Br}}get options(){return this._def.options}}i2.create=(e,t)=>new i2({options:e,typeName:Tr.ZodUnion,...Gr(t)});function uB(e,t){const r=ph(e),s=ph(t);if(e===t)return{valid:!0,data:e};if(r===Mt.object&&s===Mt.object){const a=un.objectKeys(t),i=un.objectKeys(e).filter(l=>a.indexOf(l)!==-1),o={...e,...t};for(const l of i){const c=uB(e[l],t[l]);if(!c.valid)return{valid:!1};o[l]=c.data}return{valid:!0,data:o}}else if(r===Mt.array&&s===Mt.array){if(e.length!==t.length)return{valid:!1};const a=[];for(let i=0;i<e.length;i++){const o=e[i],l=t[i],c=uB(o,l);if(!c.valid)return{valid:!1};a.push(c.data)}return{valid:!0,data:a}}else return r===Mt.date&&s===Mt.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class o2 extends dn{_parse(t){const{status:r,ctx:s}=this._processInputParams(t),a=(i,o)=>{if(dR(i)||dR(o))return Br;const l=uB(i.value,o.value);return l.valid?((uR(i)||uR(o))&&r.dirty(),{status:r.value,value:l.data}):(wt(s,{code:dt.invalid_intersection_types}),Br)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([i,o])=>a(i,o)):a(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}o2.create=(e,t,r)=>new o2({left:e,right:t,typeName:Tr.ZodIntersection,...Gr(r)});class Tm extends dn{_parse(t){const{status:r,ctx:s}=this._processInputParams(t);if(s.parsedType!==Mt.array)return wt(s,{code:dt.invalid_type,expected:Mt.array,received:s.parsedType}),Br;if(s.data.length<this._def.items.length)return wt(s,{code:dt.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Br;!this._def.rest&&s.data.length>this._def.items.length&&(wt(s,{code:dt.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const i=[...s.data].map((o,l)=>{const c=this._def.items[l]||this._def.rest;return c?c._parse(new Qh(s,o,s.path,l)):null}).filter(o=>!!o);return s.common.async?Promise.all(i).then(o=>nl.mergeArray(r,o)):nl.mergeArray(r,i)}get items(){return this._def.items}rest(t){return new Tm({...this._def,rest:t})}}Tm.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Tm({items:e,typeName:Tr.ZodTuple,rest:null,...Gr(t)})};class vR extends dn{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:r,ctx:s}=this._processInputParams(t);if(s.parsedType!==Mt.map)return wt(s,{code:dt.invalid_type,expected:Mt.map,received:s.parsedType}),Br;const a=this._def.keyType,i=this._def.valueType,o=[...s.data.entries()].map(([l,c],d)=>({key:a._parse(new Qh(s,l,s.path,[d,"key"])),value:i._parse(new Qh(s,c,s.path,[d,"value"]))}));if(s.common.async){const l=new Map;return Promise.resolve().then(async()=>{for(const c of o){const d=await c.key,u=await c.value;if(d.status==="aborted"||u.status==="aborted")return Br;(d.status==="dirty"||u.status==="dirty")&&r.dirty(),l.set(d.value,u.value)}return{status:r.value,value:l}})}else{const l=new Map;for(const c of o){const d=c.key,u=c.value;if(d.status==="aborted"||u.status==="aborted")return Br;(d.status==="dirty"||u.status==="dirty")&&r.dirty(),l.set(d.value,u.value)}return{status:r.value,value:l}}}}vR.create=(e,t,r)=>new vR({valueType:t,keyType:e,typeName:Tr.ZodMap,...Gr(r)});class Yv extends dn{_parse(t){const{status:r,ctx:s}=this._processInputParams(t);if(s.parsedType!==Mt.set)return wt(s,{code:dt.invalid_type,expected:Mt.set,received:s.parsedType}),Br;const a=this._def;a.minSize!==null&&s.data.size<a.minSize.value&&(wt(s,{code:dt.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),r.dirty()),a.maxSize!==null&&s.data.size>a.maxSize.value&&(wt(s,{code:dt.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),r.dirty());const i=this._def.valueType;function o(c){const d=new Set;for(const u of c){if(u.status==="aborted")return Br;u.status==="dirty"&&r.dirty(),d.add(u.value)}return{status:r.value,value:d}}const l=[...s.data.values()].map((c,d)=>i._parse(new Qh(s,c,s.path,d)));return s.common.async?Promise.all(l).then(c=>o(c)):o(l)}min(t,r){return new Yv({...this._def,minSize:{value:t,message:Vt.toString(r)}})}max(t,r){return new Yv({...this._def,maxSize:{value:t,message:Vt.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}}Yv.create=(e,t)=>
vendor: 4,264 bytes, line 71
71new Yv({valueType:e,minSize:null,maxSize:null,typeName:Tr.ZodSet,...Gr(t)});class bR extends dn{get schema(){return this._def.getter()}_parse(t){const{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}}bR.create=(e,t)=>new bR({getter:e,typeName:Tr.ZodLazy,...Gr(t)});class hB extends dn{_parse(t){if(t.data!==this._def.value){const r=this._getOrReturnCtx(t);return wt(r,{received:r.data,code:dt.invalid_literal,expected:this._def.value}),Br}return{status:"valid",value:t.data}}get value(){return this._def.value}}hB.create=(e,t)=>new hB({value:e,typeName:Tr.ZodLiteral,...Gr(t)});function Vq(e,t){return new ZA({values:e,typeName:Tr.ZodEnum,...Gr(t)})}class ZA extends dn{_parse(t){if(typeof t.data!="string"){const r=this._getOrReturnCtx(t),s=this._def.values;return wt(r,{expected:un.joinValues(s),received:r.parsedType,code:dt.invalid_type}),Br}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const r=this._getOrReturnCtx(t),s=this._def.values;return wt(r,{received:r.data,code:dt.invalid_enum_value,options:s}),Br}return Ql(t.data)}get options(){return this._def.values}get enum(){const t={};for(const r of this._def.values)t[r]=r;return t}get Values(){const t={};for(const r of this._def.values)t[r]=r;return t}get Enum(){const t={};for(const r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return ZA.create(t,{...this._def,...r})}exclude(t,r=this._def){return ZA.create(this.options.filter(s=>!t.includes(s)),{...this._def,...r})}}ZA.create=Vq;class yR extends dn{_parse(t){const r=un.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(t);if(s.parsedType!==Mt.string&&s.parsedType!==Mt.number){const a=un.objectValues(r);return wt(s,{expected:un.joinValues(a),received:s.parsedType,code:dt.invalid_type}),Br}if(this._cache||(this._cache=new Set(un.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const a=un.objectValues(r);return wt(s,{received:s.data,code:dt.invalid_enum_value,options:a}),Br}return Ql(t.data)}get enum(){return this._def.values}}yR.create=(e,t)=>new yR({values:e,typeName:Tr.ZodNativeEnum,...Gr(t)});class l2 extends dn{unwrap(){return this._def.type}_parse(t){const{ctx:r}=this._processInputParams(t);if(r.parsedType!==Mt.promise&&r.common.async===!1)return wt(r,{code:dt.invalid_type,expected:Mt.promise,received:r.parsedType}),Br;const s=r.parsedType===Mt.promise?r.data:Promise.resolve(r.data);return Ql(s.then(a=>this._def.type.parseAsync(a,{path:r.path,errorMap:r.common.contextualErrorMap})))}}l2.create=(e,t)=>new l2({type:e,typeName:Tr.ZodPromise,...Gr(t)});class eg extends dn{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Tr.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:r,ctx:s}=this._processInputParams(t),a=this._def.effect||null,i={addIssue:o=>{wt(s,o),o.fatal?r.abort():r.dirty()},get path(){return s.path}};if(i.addIssue=i.addIssue.bind(i),a.type==="preprocess"){const o=a.transform(s.data,i);if(s.common.async)return Promise.resolve(o).then(async l=>{if(r.value==="aborted")return Br;const c=await this._def.schema._parseAsync({data:l,path:s.path,parent:s});return c.status==="aborted"?Br:c.status==="dirty"||r.value==="dirty"?zx(c.value):c});{if(r.value==="aborted")return Br;const l=this._def.schema._parseSync({data:o,path:s.path,parent:s});return l.status==="aborted"?Br:l.status==="dirty"||r.value==="dirty"?zx(l.value):l}}if(a.type==="refinement"){const o=l=>{const c=a.refinement(l,i);if(s.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return l};if(s.common.async===!1){const l=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return l.status==="aborted"?Br:(l.status==="dirty"&&r.dirty(),o(l.value),{status:r.value,value:l.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(l=>l.status==="aborted"?Br:(l.status==="dirty"&&r.dirty(),o(l.value).then(()=>({status:r.value,value:l.value}))))}if(a.type==="transform")if(s.common.async===!1){const o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!JA(o))return Br;
71const l=a.transform(o.value,i);if(l instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:l}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>JA(o)?Promise.resolve(a.transform(o.value,i)).then(l=>({status:r.value,value:l})):Br);un.assertNever(a)}}eg.create=(e,t,r)=>new eg({schema:e,typeName:Tr.ZodEffects,effect:t,...Gr(r)});eg.createWithPreprocess=(e,t,r)=>new eg({schema:t,effect:{type:"preprocess",transform:e},typeName:Tr.ZodEffects,...Gr(r)});class Oh extends dn{_parse(t){return this._getType(t)===Mt.undefined?Ql(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Oh.create=(e,t)=>new Oh({innerType:e,typeName:Tr.ZodOptional,...Gr(t)});class tg extends dn{_parse(t){return this._getType(t)===Mt.null?Ql(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}tg.create=(e,t)=>new tg({innerType:e,typeName:Tr.ZodNullable,...Gr(t)});class fB extends dn{_parse(t){const{ctx:r}=this._processInputParams(t);let s=r.data;return r.parsedType===Mt.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}fB.create=(e,t)=>new fB({innerType:e,typeName:Tr.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Gr(t)});class mB extends dn{_parse(t){const{ctx:r}=this._processInputParams(t),s={...r,common:{...r.common,issues:[]}},a=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return s2(a)?a.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new md(s.common.issues)},input:s.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new md(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}mB.create=(e,t)=>new mB({innerType:e,typeName:Tr.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Gr(t)});class wR extends dn{_parse(t){if(this._getType(t)!==Mt.nan){const s=this._getOrReturnCtx(t);return wt(s,{code:dt.invalid_type,expected:Mt.nan,received:s.parsedType}),Br}return{status:"valid",value:t.data}}}wR.create=e=>new wR({typeName:Tr.ZodNaN,...Gr(e)});class qme extends dn{_parse(t){const{ctx:r}=this._processInputParams(t),s=r.data;return this._def.type._parse({data:s,path:r.path,parent:r})}unwrap(){return this._def.type}}class wI extends dn{_parse(t){const{status:r,ctx:s}=this._processInputParams(t);if(s.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return i.status==="aborted"?Br:i.status==="dirty"?(r.dirty(),zx(i.value)):this._def.out._parseAsync({data:i.value,path:s.path,parent:s})})();{const a=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?Br:a.status==="dirty"?(r.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:s.path,parent:s})}}static create(t,r){return new wI({in:t,out:r,typeName:Tr.ZodPipeline})}}class pB extends dn{_parse(t){const r=this._def.innerType._parse(t),s=a=>(JA(a)&&(a.value=Object.freeze(a.value)),a);return s2(r)?r.then(a=>s(a)):s(r)}unwrap(){return this._def.innerType}}pB.create=(e,t)=>new pB({innerType:e,typeName:Tr.ZodReadonly,...Gr(t)});var Tr;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Tr||(Tr={}));const ys=lu.create,Kme=Em.create;Bm.create;const Gq=a2.create;XA.create;Hh.create;od.create;const sf=pa.create;i2.create;o2.create;Tm.create;const Wme=hB.create,qq=ZA.create;l2.create;Oh.create;tg.create;const Yme={string:e=>lu.create({...e,coerce:!0}),number:e=>Em.create({...e,coerce:!0}),boolean:e=>a2.create({...e,coerce:!0}),bigint:e=>Bm.create({...e,coerce:!0}),date:e=>XA.create({...e,coerce:!0})},jR={BASE_URL:"/",MODE:"production",VITE_ENABLE_ANALYTICS:"true",VITE_PRODUCT_NAME:"Rainfactory AI",VITE_SUPABASE_ANON_KEY:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im9sZ25uZW5jY3F3d2JhaGNwc2duIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MjQxNjUyMDksImV4cCI6MjAzOTc0MTIwOX0.qUa9W4vEYLC7LaUPczpqHA9tp8NSiWB7POqOWEvJpYQ",VITE_SUPABASE_URL:"https://olgnnenccqwwbahcpsgn.supabase.co",VITE_WORKERS_URL:"https://worker.rainfactory.ai"},Jme=sf({VITE_SUPABASE_URL:ys().url(),VITE_SUPABASE_ANON_KEY:ys().min(1),VITE_WORKERS_URL:ys().url().optional(),VITE_ENABLE_ANALYTICS:Yme.boolean().optional().default(!1),NODE_ENV:qq(["development","production","test"]).default("development"),BASE_URL:ys().optional().default("/"),VITE_PRODUCT_NAME:ys().optional().default("Rainfactory AI")});function Xme(){const e=typeof jR=="object"?jR:{},t={VITE_SUPABASE_URL:e.VITE_SUPABASE_URL,VITE_SUPABASE_ANON_KEY:e.VITE_SUPABASE_ANON_KEY,VITE_WORKERS_URL:e.VITE_WORKERS_URL,VITE_ENABLE_ANALYTICS:e.VITE_ENABLE_ANALYTICS,NODE_ENV:e.MODE||"production",BASE_URL:e.BASE_URL||"/",VITE_PRODUCT_NAME:e.VITE_PRODUCT_NAME};try{return Jme.parse(t)}catch(r){if(r instanceof md){const s=r.issues.map(a=>a.path.join("."));throw new Error(`Missing or invalid environment variables: ${s.join(", ")}. Available vars: ${JSON.stringify(t)}`)}throw r}}const Wo=Xme();Wo.NODE_ENV;Wo.NODE_ENV;Wo.NODE_ENV;const Zme=Wo.NODE_ENV==="development"||Wo.NODE_ENV==="test",epe=Wo.VITE_PRODUCT_NAME;function Xf(){return"https://worker.rainfactory.ai"}let Pm=!1;document.addEventListener("supabase.auth.signOut",()=>{Pm=!1,de.realtime.disconnect()});document.addEventListener("supabase.auth.signIn",()=>{Pm=!0,de.realtime.connect()});const tpe=(e,t=5e3)=>{let r;return function(...s){clearTimeout(r),r=setTimeout(()=>e.apply(this,s),t)}},rpe=tpe((e,...t)=>{Wo.NODE_ENV==="development"&&console.error(e,...t)}),npe="https://olgnnenccqwwbahcpsgn.supabase.co",spe="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im9sZ25uZW5jY3F3d2JhaGNwc2duIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MjQxNjUyMDksImV4cCI6MjAzOTc0MTIwOX0.qUa9W4vEYLC7LaUPczpqHA9tp8NSiWB7POqOWEvJpYQ",de=Qq(npe,spe,{auth:{autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0},global:{headers:{"Content-Type":"application/json",Accept:"application/json"}}});let lm=0;const Kq=5,ape=6e4,ipe=de.channel("status");ipe.subscribe(e=>{e==="SUBSCRIBED"&&(lm=0,Wo.NODE_ENV==="development"&&console.log("Realtime connected")),e==="CLOSED"&&Wo.NODE_ENV==="development"&&console.log("Realtime disconnected"),e==="CHANNEL_ERROR"&&Pm&&lm<Kq&&(lm++,rpe("Realtime channel error - attempt ${reconnectionAttempts}/${MAX_RECONNECTION_ATTEMPTS}"),setTimeout(()=>{Pm&&de.realtime.connect()},1e3*lm))});setInterval(()=>{Pm&&(lm=0)},ape);const ope=()=>Pm&&lm<Kq?(Wo.NODE_ENV==="development"&&console.log("Forcing Supabase reconnection"),lm++,de.realtime.connect()):Promise.resolve(),lpe=(e,t)=>de.channel("dashboard_updates").on("postgres_changes",{event:"*",schema:"public",table:"dashboard_metrics",filter:`brand_id=eq.${e}`},t).subscribe(),cpe=async e=>{if((e==null?void 0:e.status)===401){Pm=!1,de.realtime.disconnect(),window.location.href="/";return}throw e},dpe=Object.freeze(Object.defineProperty({__proto__:null,handleAuthError:cpe,reconnectSupabase:ope,subscribeToDashboardUpdates:lpe,supabase:de},Symbol.toStringTag,{value:"Module"})),Wq=6048e5,upe=864e5,hpe=6e4,fpe=36e5,Kw=43200,NR=1440,_R=Symbol.for("constructDateFrom");function _c(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&_R in e?e[_R](t):e instanceof Date?new e.constructor(t):new Date(t)}function js(e,t){return _c(t||e,e)}function Yq(e,t,r){const s=js(e,r==null?void 0:r.in);return isNaN(t)?_c(e,NaN):(t&&s.setDate(s.getDate()+t),s)}function mpe(e,t,r){return _c(e,+js(e)+t)}function ppe(e,t,r){return mpe(e,t*fpe)}let Ape={};function Cy(){return Ape}function Jv(e,t){var l,c,d,u;const r=Cy(),s=(t==null?void 0:t.weekStartsOn)??((c=(l=t==null?void 0:t.locale)==null?void 0:l.options)==null?void 0:c.weekStartsOn)??r.weekStartsOn??((u=(d=r.locale)==null?void 0:d.options)==null?void 0:u.weekStartsOn)??0,a=js(e,t==null?void 0:t.in),i=a.getDay(),o=(i<s?7:0)+i-s;return a.setDate(a.getDate()-o),a.setHours(0,0,0,0),a}function c2(e,t){return Jv(e,{...t,weekStartsOn:1}
vendor: 5,230 bytes, line 71
71)}function Jq(e,t){const r=js(e,t==null?void 0:t.in),s=r.getFullYear(),a=_c(r,0);a.setFullYear(s+1,0,4),a.setHours(0,0,0,0);const i=c2(a),o=_c(r,0);o.setFullYear(s,0,4),o.setHours(0,0,0,0);const l=c2(o);return r.getTime()>=i.getTime()?s+1:r.getTime()>=l.getTime()?s:s-1}function d2(e){const t=js(e),r=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return r.setUTCFullYear(t.getFullYear()),+e-+r}function G_(e,...t){const r=_c.bind(null,e||t.find(s=>typeof s=="object"));return t.map(r)}function BA(e,t){const r=js(e,t==null?void 0:t.in);return r.setHours(0,0,0,0),r}function gpe(e,t,r){const[s,a]=G_(r==null?void 0:r.in,e,t),i=BA(s),o=BA(a),l=+i-d2(i),c=+o-d2(o);return Math.round((l-c)/upe)}function xpe(e,t){const r=Jq(e,t),s=_c(e,0);return s.setFullYear(r,0,4),s.setHours(0,0,0,0),c2(s)}function vpe(e,t,r){const s=js(e,r==null?void 0:r.in);return s.setTime(s.getTime()+t*hpe),s}function wj(e,t){const r=+js(e)-+js(t);return r<0?-1:r>0?1:r}function bpe(e){return _c(e,Date.now())}function ype(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function wpe(e){return!(!ype(e)&&typeof e!="number"||isNaN(+js(e)))}function jpe(e,t,r){const[s,a]=G_(r==null?void 0:r.in,e,t),i=s.getFullYear()-a.getFullYear(),o=s.getMonth()-a.getMonth();return i*12+o}function Npe(e){return t=>{const s=(e?Math[e]:Math.trunc)(t);return s===0?0:s}}function _pe(e,t){return+js(e)-+js(t)}function Xq(e,t){const r=js(e,t==null?void 0:t.in);return r.setHours(23,59,59,999),r}function Cpe(e,t){const r=js(e,t==null?void 0:t.in),s=r.getMonth();return r.setFullYear(r.getFullYear(),s+1,0),r.setHours(23,59,59,999),r}function Spe(e,t){const r=js(e,t==null?void 0:t.in);return+Xq(r,t)==+Cpe(r,t)}function kpe(e,t,r){const[s,a,i]=G_(r==null?void 0:r.in,e,e,t),o=wj(a,i),l=Math.abs(jpe(a,i));if(l<1)return 0;a.getMonth()===1&&a.getDate()>27&&a.setDate(30),a.setMonth(a.getMonth()-o*l);let c=wj(a,i)===-o;Spe(s)&&l===1&&wj(s,i)===1&&(c=!1);const d=o*(l-+c);return d===0?0:d}function Epe(e,t,r){const s=_pe(e,t)/1e3;return Npe(r==null?void 0:r.roundingMethod)(s)}function Bpe(e,t){const r=js(e,t==null?void 0:t.in);return r.setFullYear(r.getFullYear(),0,1),r.setHours(0,0,0,0),r}const Tpe={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},Ppe=(e,t,r)=>{let s;const a=Tpe[e];return typeof a=="string"?s=a:t===1?s=a.one:s=a.other.replace("{{count}}",t.toString()),r!=null&&r.addSuffix?r.comparison&&r.comparison>0?"in "+s:s+" ago":s};function m5(e){return(t={})=>{const r=t.width?String(t.width):e.defaultWidth;return e.formats[r]||e.formats[e.defaultWidth]}}const Ipe={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Ope={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Fpe={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Lpe={date:m5({formats:Ipe,defaultWidth:"full"}),time:m5({formats:Ope,defaultWidth:"full"}),dateTime:m5({formats:Fpe,defaultWidth:"full"})},Dpe={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Rpe=(e,t,r,s)=>Dpe[e];function dx(e){return(t,r)=>{const s=r!=null&&r.context?String(r.context):"standalone";let a;if(s==="formatting"&&e.formattingValues){const o=e.defaultFormattingWidth||e.defaultWidth,l=r!=null&&r.width?String(r.width):o;a=e.formattingValues[l]||e.formattingValues[o]}else{const o=e.defaultWidth,l=r!=null&&r.width?String(r.width):e.defaultWidth;a=e.values[l]||e.values[o]}const i=e.argumentCallback?e.argumentCallback(t):t;return a[i]}}const Upe={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Mpe={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},$pe={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Qpe={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Frid
71ay","Saturday"]},Hpe={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},zpe={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},Vpe=(e,t)=>{const r=Number(e),s=r%100;if(s>20||s<10)switch(s%10){case 1:return r+"st";case 2:return r+"nd";case 3:return r+"rd"}return r+"th"},Gpe={ordinalNumber:Vpe,era:dx({values:Upe,defaultWidth:"wide"}),quarter:dx({values:Mpe,defaultWidth:"wide",argumentCallback:e=>e-1}),month:dx({values:$pe,defaultWidth:"wide"}),day:dx({values:Qpe,defaultWidth:"wide"}),dayPeriod:dx({values:Hpe,defaultWidth:"wide",formattingValues:zpe,defaultFormattingWidth:"wide"})};function ux(e){return(t,r={})=>{const s=r.width,a=s&&e.matchPatterns[s]||e.matchPatterns[e.defaultMatchWidth],i=t.match(a);if(!i)return null;const o=i[0],l=s&&e.parsePatterns[s]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(l)?Kpe(l,h=>h.test(o)):qpe(l,h=>h.test(o));let d;d=e.valueCallback?e.valueCallback(c):c,d=r.valueCallback?r.valueCallback(d):d;const u=t.slice(o.length);return{value:d,rest:u}}}function qpe(e,t){for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&t(e[r]))return r}function Kpe(e,t){for(let r=0;r<e.length;r++)if(t(e[r]))return r}function Wpe(e){return(t,r={})=>{const s=t.match(e.matchPattern);if(!s)return null;const a=s[0],i=t.match(e.parsePattern);if(!i)return null;let o=e.valueCallback?e.valueCallback(i[0]):i[0];o=r.valueCallback?r.valueCallback(o):o;const l=t.slice(a.length);return{value:o,rest:l}}}const Ype=/^(\d+)(th|st|nd|rd)?/i,Jpe=/\d+/i,Xpe={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Zpe={any:[/^b/i,/^(a|c)/i]},eAe={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},tAe={any:[/1/i,/2/i,/3/i,/4/i]},rAe={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},nAe={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},sAe={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},aAe={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},iAe={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},oAe={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},lAe={ordinalNumber:Wpe({matchPattern:Ype,parsePattern:Jpe,valueCallback:e=>parseInt(e,10)}),era:ux({matchPatterns:Xpe,defaultMatchWidth:"wide",parsePatterns:Zpe,defaultParseWidth:"any"}),quarter:ux({matchPatterns:eAe,defaultMatchWidth:"wide",parsePatterns:tAe,defaultParseWidth:"any",valueCallback:e=>e+1}),month:ux({matchPatterns:rAe,defaultMatchWidth:"wide",parsePatterns:nAe,defaultParseWidth:"any"}),day:ux({matchPatterns:sAe,defaultMatchWidth:"wide",parsePatterns:aAe,defaultParseWidth:"any"}),dayPeriod:ux({matchPatterns:iAe,defaultMatchWidth:"any",parsePatterns:oAe,defaultParseWidth:"any"})},Zq={code:"en-US",formatDistance:Ppe,formatLong:Lpe,formatRelative:Rpe,localize:Gpe,match:lAe,options:{weekStartsOn:0,firstWeekContainsDate:1}};function cAe(e,t){const r=js(e,t==null?void 0:t.in);return gpe(r,Bpe(r))+1}function dAe(e,t){const r=js(e,t==null?void 0:t.in),s=+c2(r)-+xpe(r);return Math.round(s/Wq)+1}function eK(e,t){var u,h,m,f;const r=js(e,t==null?void 0:t.in),s=r.getFullYear(),a=Cy(),i=(t==null?void 0:t.firstWeekContainsDate)??((h=(u=t==null?void 0:t.locale)==null?void 0:u.options)==null?void 0:h.firstWeekContainsDate)??a.firstWeekContainsDate??((f=(m=a.locale)==null?void 0:m.options)==null?void 0:f.firstWeekContainsDate)??1,o=_c((t==null?void 0:t.in)||e,0);o.setFullYear(s+1,0,i),o.setHours(0,0,0,0);const l=Jv(o,t),c=_c((t==null?void 0:t.in)||e,0);c.setFullYear(s,0,i),c.setHours(0,0,0,0);const d=Jv(c,t);return+r>=+l?s+1:+r>=+d?s:s-1}function uAe(e,t){var l,c,d,u;const r=Cy(),s=(t==null?void 0:t.firstWeekContainsDate)??((c=(l=t==null?void 0:t.locale)==null?void 0:l.options)==null?void 0:c.firstWeekContainsDate)??r.firstWeekContainsDate??((u=(d=r.locale)==null?void 0:d.options)==null?void 0:u.firstWeekContainsDate)??1,a=eK(e,t),i=_c((t==null?void 0:t.in)||e,0);return i.setFullYear(a,0,s),i.setHours(0,0,0,0),Jv(i,t)}function hAe(e,t){const r=js(e,t==null?void 0:t.in),s=+Jv(r,t)-+uAe(r,t);return Math.round(s/Wq)+1}function In(e,t){const r=e<0?"-":"",s=Math.abs(e).toString().padStart(t,"0");return r+s}const nh={y(e,t){const r=e.getFullYear(),s=r>0?r:1-r;return In(t==="yy"?s%100:s,t.length)},M(e,t){const r=e.getMonth();return t==="M"?String(r+1):In(r+1,2)},d(e,t){return In(e.getDate(),t.length)},a(e,t){const r=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.toUpperCase();case"aaa":return r;case"aaaaa":return r[0];case"aaaa":default:return r==="am"?"a.m.":"p.m."}},h(e,t){return In(e.getHours()%12||12,t.length)},H(e,t){return In(e.getHours(),t.length)},m(e,t){return In(e.getMinutes(),t.length)},s(e,t){return In(e.getSeconds(),t.length)},S(e,t){const r=t.length,s=e.getMilliseconds(),a=Math.trunc(s*Math.pow(10,r-3));return In(a,t.length)}},Bp={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},CR={G:function(e,t,r){const s=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return r.era(s,{width:"abbreviated"});case"GGGGG":return r.era(s,{width:"narrow"});case"GGGG":default:return r.era(s,{width:"wide"})}},y:function(e,t,r){if(t==="yo"){const s=e.getFullYear(),a=s>0?s:1-s;return r.ordinalNumber(a,{unit:"year"})}return nh.y(e,t)},Y:function(e,t,r,s){const a=eK(e,s),i=a>0?a:1-a;if(t==="YY"){const o=i%100;return In(o,2)}return t==="Yo"?r.ordinalNumber(i,{unit:"year"}):In(i,t.length)},R:function(e,t){const r=Jq(e);return In(r,t.length)},u:function(e,t){const r=e.getFullYear();return In(r,t.length)},Q:function(e,t,r){const s=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(s);case"QQ":return In(s,2);case"Qo":return r.ordinalNumber(s,{unit:"quarter"});case"QQQ":return r.quarter(s,{width:"abbreviated",context:"formatting"});case"QQQQQ":return r.quarter(s,{width:"narrow",context:"formatting"});case"QQQQ":default:return r.quarter(s,{width:"wide",context:"formatting"})}},q:function(e,t,r){const s=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(s);case"qq":return In(s,2);case"qo":return r.ordinalNumber(s,{unit:"quarter"});case"qqq":return r.quarter(s,{width:"abbreviated",context:"standalone"});case"qqqqq":return r.quarter(s,{width:"narrow",context:"standalone"});case"qqqq":default:return r.quarter(s,{width:"wide",context:"standalone"})}},M:function(e,t,r){const s=e.getMonth();switch(t){case"M":case"MM":return nh.M(e,t);case"Mo":return r.ordinalNumber(s+1,{unit:"month"});case"MMM":return r.month(s,{width:"abbreviated",context:"formatting"});case"MMMMM":return r.month(s,{width:"narrow",context:"formatting"});case"MMMM":default:return r.month(s,{width:"wide",context:"formatting"})}},L:function(e,t,r){const s=e.getMonth();switch(t){case"L":return String(s+1);case"LL":return In(s+1,2);case"Lo":return r.ordinalNumber(s+1,{unit:"month"});case"LLL":return r.month(s,{width:"abbreviated",context:"standalone"});case"LLLLL":return r.month(s,{width:"narrow",context:"standalone"});case"LLLL":default:return r.month(s,{width:"wide",context:"standalone"})}},w:function(e,t,r,s){const a=hAe(e,s);return t==="wo"?r.ordinalNumber(a,{unit:"week"}):In(a,t.length)},I:function(e,t,r){const s=dAe(e);return t==="Io"?r.ordinalNumber(s,{unit:"week"}):In(s,t.length)},d:function(e,t,r){return t==="do"?r.ordinalNumber(e.getDate(),{unit:"date"}):nh.d(e,t)},D:function(e,t,r){const s=cAe(e);return t==="Do"?r.ordinalNumber(s,{unit:"dayOfYear"}):In(s,t.length)},E:function(e,t,r){const s=e.getDay();switch(t){case"E":case"EE":case"EEE":return r.day(s,{width:"abbreviated",context:"formatting"});case"EEEEE":return r.day(s,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(s,{width:"short",context:"formatting"});case"EEEE":default:return r.day(s,{width:"wide",context:"formatting"})}},e:function(e,t,r,s){const a=e.getDay(),i=(a-s.weekStartsOn+8)%7||7;switch(t){case"e":return String(i);case"ee":return In(i,2);case"eo":return r.ordinalNumber(i,{unit:"day"});case"eee":return r.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(a,{width:"short",context:"formatting"});case"eeee":default:return r.day(a,{width:"wide",context:"formatting"})}},c:function(e,t,r,s){const a=e.getDay(),i=(a-s.weekStartsOn+8)%7||7;switch(t){case"c":return String(i);case"cc":return In(i,t.length);case"co":return r.ordinalNumber(i,{unit:"day"});case"ccc":return r.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(a,{width:"narrow",context:"standalone"});case"cccccc":return r.day(a,{width:"short",context:"standalone"});case"cccc":default:return r.day(a,{width:"wide",context:"standalone"})}},i:function(e,t,r){const s=e.getDay(),a=s===0?7:s;switch(t){case"i":return String(a);case"ii":return In(a,t.length);case"io":return r.ordinalNumber(a,{unit:"day"});case"iii":return r.day(s,{width:"abbreviated",context:"formatting"});case"iiiii":return r.day(s,{width:"narrow",context:"formatting"});case"iiiiii":return r.day(s,{width:"short",context:"formatting"});case"iiii":default:return r.day(s,{width:"wide",context:"formatting"})}},a:function(e,t,r){const a=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return r.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return r.dayPeriod(a,{width:"narrow",context:"formatting"});case"aaaa":default:return r.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(e,t,r){const s=e.getHours();let a;switch(s===12?a=Bp.noon:s===0?a=Bp.midnight:a=s/12>
vendor: 4,418 bytes, line 71
71=1?"pm":"am",t){case"b":case"bb":return r.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"bbb":return r.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return r.dayPeriod(a,{width:"narrow",context:"formatting"});case"bbbb":default:return r.dayPeriod(a,{width:"wide",context:"formatting"})}},B:function(e,t,r){const s=e.getHours();let a;switch(s>=17?a=Bp.evening:s>=12?a=Bp.afternoon:s>=4?a=Bp.morning:a=Bp.night,t){case"B":case"BB":case"BBB":return r.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(a,{width:"narrow",context:"formatting"});case"BBBB":default:return r.dayPeriod(a,{width:"wide",context:"formatting"})}},h:function(e,t,r){if(t==="ho"){let s=e.getHours()%12;return s===0&&(s=12),r.ordinalNumber(s,{unit:"hour"})}return nh.h(e,t)},H:function(e,t,r){return t==="Ho"?r.ordinalNumber(e.getHours(),{unit:"hour"}):nh.H(e,t)},K:function(e,t,r){const s=e.getHours()%12;return t==="Ko"?r.ordinalNumber(s,{unit:"hour"}):In(s,t.length)},k:function(e,t,r){let s=e.getHours();return s===0&&(s=24),t==="ko"?r.ordinalNumber(s,{unit:"hour"}):In(s,t.length)},m:function(e,t,r){return t==="mo"?r.ordinalNumber(e.getMinutes(),{unit:"minute"}):nh.m(e,t)},s:function(e,t,r){return t==="so"?r.ordinalNumber(e.getSeconds(),{unit:"second"}):nh.s(e,t)},S:function(e,t){return nh.S(e,t)},X:function(e,t,r){const s=e.getTimezoneOffset();if(s===0)return"Z";switch(t){case"X":return kR(s);case"XXXX":case"XX":return zf(s);case"XXXXX":case"XXX":default:return zf(s,":")}},x:function(e,t,r){const s=e.getTimezoneOffset();switch(t){case"x":return kR(s);case"xxxx":case"xx":return zf(s);case"xxxxx":case"xxx":default:return zf(s,":")}},O:function(e,t,r){const s=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+SR(s,":");case"OOOO":default:return"GMT"+zf(s,":")}},z:function(e,t,r){const s=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+SR(s,":");case"zzzz":default:return"GMT"+zf(s,":")}},t:function(e,t,r){const s=Math.trunc(+e/1e3);return In(s,t.length)},T:function(e,t,r){return In(+e,t.length)}};function SR(e,t=""){const r=e>0?"-":"+",s=Math.abs(e),a=Math.trunc(s/60),i=s%60;return i===0?r+String(a):r+String(a)+t+In(i,2)}function kR(e,t){return e%60===0?(e>0?"-":"+")+In(Math.abs(e)/60,2):zf(e,t)}function zf(e,t=""){const r=e>0?"-":"+",s=Math.abs(e),a=In(Math.trunc(s/60),2),i=In(s%60,2);return r+a+t+i}const ER=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},tK=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},fAe=(e,t)=>{const r=e.match(/(P+)(p+)?/)||[],s=r[1],a=r[2];if(!a)return ER(e,t);let i;switch(s){case"P":i=t.dateTime({width:"short"});break;case"PP":i=t.dateTime({width:"medium"});break;case"PPP":i=t.dateTime({width:"long"});break;case"PPPP":default:i=t.dateTime({width:"full"});break}return i.replace("{{date}}",ER(s,t)).replace("{{time}}",tK(a,t))},mAe={p:tK,P:fAe},pAe=/^D+$/,AAe=/^Y+$/,gAe=["D","DD","YY","YYYY"];function xAe(e){return pAe.test(e)}function vAe(e){return AAe.test(e)}function bAe(e,t,r){const s=yAe(e,t,r);if(console.warn(s),gAe.includes(e))throw new RangeError(s)}function yAe(e,t,r){const s=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${s} to the input \`${r}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const wAe=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,jAe=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,NAe=/^'([^]*?)'?$/,_Ae=/''/g,CAe=/[a-zA-Z]/;function nn(e,t,r){var u,h,m,f;const s=Cy(),a=s.locale??Zq,i=s.firstWeekContainsDate??((h=(u=s.locale)==null?void 0:u.options)==null?void 0:h.firstWeekContainsDate)??1,o=s.weekStartsOn??((f=(m=s.locale)==null?void 0:m.options)==null?void 0:f.weekStartsOn)??0,l=js(e,r==null?void 0:r.in);if(!wpe(l))throw new RangeError("Invalid time value");let c=t.match(jAe).map(p=>{const A=p[0];if(A==="p"||A==="P"){const v=mAe[A];return v(p,a.formatLong)}return p}).join("").match(wAe).map(p=>{if(p==="''")return{isToken:!1,value:"'"};const A=p[0];if(A==="'")return{isToken:!1,value:SAe(p)};if(CR[A])return{isToken:!0,value:p};
71if(A.match(CAe))throw new RangeError("Format string contains an unescaped latin alphabet character `"+A+"`");return{isToken:!1,value:p}});a.localize.preprocessor&&(c=a.localize.preprocessor(l,c));const d={firstWeekContainsDate:i,weekStartsOn:o,locale:a};return c.map(p=>{if(!p.isToken)return p.value;const A=p.value;(vAe(A)||xAe(A))&&bAe(A,t,String(e));const v=CR[A[0]];return v(l,A,a.localize,d)}).join("")}function SAe(e){const t=e.match(NAe);return t?t[1].replace(_Ae,"'"):e}function kAe(e,t,r){const s=Cy(),a=(r==null?void 0:r.locale)??s.locale??Zq,i=2520,o=wj(e,t);if(isNaN(o))throw new RangeError("Invalid time value");const l=Object.assign({},r,{addSuffix:r==null?void 0:r.addSuffix,comparison:o}),[c,d]=G_(r==null?void 0:r.in,...o>0?[t,e]:[e,t]),u=Epe(d,c),h=(d2(d)-d2(c))/1e3,m=Math.round((u-h)/60);let f;if(m<2)return r!=null&&r.includeSeconds?u<5?a.formatDistance("lessThanXSeconds",5,l):u<10?a.formatDistance("lessThanXSeconds",10,l):u<20?a.formatDistance("lessThanXSeconds",20,l):u<40?a.formatDistance("halfAMinute",0,l):u<60?a.formatDistance("lessThanXMinutes",1,l):a.formatDistance("xMinutes",1,l):m===0?a.formatDistance("lessThanXMinutes",1,l):a.formatDistance("xMinutes",m,l);if(m<45)return a.formatDistance("xMinutes",m,l);if(m<90)return a.formatDistance("aboutXHours",1,l);if(m<NR){const p=Math.round(m/60);return a.formatDistance("aboutXHours",p,l)}else{if(m<i)return a.formatDistance("xDays",1,l);if(m<Kw){const p=Math.round(m/NR);return a.formatDistance("xDays",p,l)}else if(m<Kw*2)return f=Math.round(m/Kw),a.formatDistance("aboutXMonths",f,l)}if(f=kpe(d,c),f<12){const p=Math.round(m/Kw);return a.formatDistance("xMonths",p,l)}else{const p=f%12,A=Math.trunc(f/12);return p<3?a.formatDistance("aboutXYears",A,l):p<9?a.formatDistance("overXYears",A,l):a.formatDistance("almostXYears",A+1,l)}}function rK(e,t){return kAe(e,bpe(e),t)}function EAe(e,t,r){const s=+js(e,r==null?void 0:r.in),[a,i]=[+js(t.start,r==null?void 0:r.in),+js(t.end,r==null?void 0:r.in)].sort((o,l)=>o-l);return s>=a&&s<=i}function Fh(e,t,r){return Yq(e,-t,r)}function BAe(e,t,r){return ppe(e,-1)}function TAe(e,t,r){return vpe(e,-5,r)}const fA={AMERICAS:{label:"Americas",timezones:[{value:"America/New_York",label:"Eastern Time (US & Canada)",region:"North America"},{value:"America/Chicago",label:"Central Time (US & Canada)",region:"North America"},{value:"America/Denver",label:"Mountain Time (US & Canada)",region:"North America"},{value:"America/Los_Angeles",label:"Pacific Time (US & Canada)",region:"North America"},{value:"America/Anchorage",label:"Alaska Time",region:"North America"},{value:"Pacific/Honolulu",label:"Hawaii Time",region:"North America"},{value:"America/Toronto",label:"Eastern Time (Canada)",region:"North America"},{value:"America/Vancouver",label:"Pacific Time (Canada)",region:"North America"},{value:"America/Mexico_City",label:"Mexico City",region:"North America"},{value:"America/Sao_Paulo",label:"São Paulo",region:"South America"},{value:"America/Buenos_Aires",label:"Buenos Aires",region:"South America"},{value:"America/Lima",label:"Lima",region:"South America"},{value:"America/Bogota",label:"Bogotá",region:"South America"},{value:"America/Santiago",label:"Santiago",region:"South America"}]},EUROPE:{label:"Europe & Africa",timezones:[{value:"Europe/London",label:"London (GMT/BST)",region:"Western Europe"},{value:"Europe/Dublin",label:"Dublin",region:"Western Europe"},{value:"Europe/Paris",label:"Paris (CET/CEST)",region:"Western Europe"},{value:"Europe/Berlin",label:"Berlin",region:"Western Europe"},{value:"Europe/Rome",label:"Rome",region:"Western Europe"},{value:"Europe/Madrid",label:"Madrid",region:"Western Europe"},{value:"Europe/Amsterdam",label:"Amsterdam",region:"Western Europe"},{value:"Europe/Brussels",label:"Brussels",region:"Western Europe"},{value:"Europe/Zurich",label:"Zurich",region:"Western Europe"},{value:"Europe/Vienna",label:"Vienna",region:"Central Europe"},{value:"Europe/Prague",label:"Prague",region:"Central Europe"},{value:"Europe/Budapest",label:"Budapest",region:"Central Europe"},{value:"Europe/Warsaw",label:"Warsaw",region:"Central Europe"},{value:"Europe/Stockholm",label:"Stockholm",region:"Northern Europe"},{value:"Europe/Helsinki",label:"Helsinki",region:"Northern Europe"},{value:"Europe/Oslo",label:"Oslo",region:"Northern Europe"},{value:"Europe/Copenhagen",label:"Copenhagen",region:"Northern Europe"},{value:"Europe/Moscow",label:"Moscow",region:"Eastern Europe"},{value:"Europe/Kiev",label:"Kyiv",region:"Eastern Europe"},{value:"Europe/Istanbul",label:"Istanbul",region:"Eastern Europe"},{value:"Africa/Cairo",label:"Cairo",region:"Africa"},{value:"Africa/Johannesburg",label:"Johannesburg",region:"Africa"},{value:"Africa/Lagos",label:"Lagos",region:"Africa"},{value:"Africa/Casablanca",label:"Casablanca",region:"Africa"}]},ASIA_PACIFIC:{label:"Asia & Pacific",timezones:[{value:"Asia/Tokyo",label:"Tokyo (JST)",region:"East Asia"},{value:"Asia/Seoul",label:"Seoul",region:"East Asia"},{value:"Asia/Shanghai",label:"Shanghai (CST)",region:"East Asia"},{value:"Asia/Hong_Kong",label:"Hong Kong",region:"East Asia"}
71,{value:"Asia/Taipei",label:"Taipei",region:"East Asia"},{value:"Asia/Singapore",label:"Singapore",region:"Southeast Asia"},{value:"Asia/Bangkok",label:"Bangkok",region:"Southeast Asia"},{value:"Asia/Manila",label:"Manila",region:"Southeast Asia"},{value:"Asia/Jakarta",label:"Jakarta",region:"Southeast Asia"},{value:"Asia/Kuala_Lumpur",label:"Kuala Lumpur",region:"Southeast Asia"},{value:"Asia/Ho_Chi_Minh",label:"Ho Chi Minh City",region:"Southeast Asia"},{value:"Asia/Kolkata",label:"Mumbai/Delhi (IST)",region:"South Asia"},{value:"Asia/Karachi",label:"Karachi",region:"South Asia"},{value:"Asia/Dhaka",label:"Dhaka",region:"South Asia"},{value:"Asia/Dubai",label:"Dubai (GST)",region:"Middle East"},{value:"Asia/Riyadh",label:"Riyadh",region:"Middle East"},{value:"Asia/Tehran",label:"Tehran",region:"Middle East"},{value:"Australia/Sydney",label:"Sydney (AEDT/AEST)",region:"Australia"},{value:"Australia/Melbourne",label:"Melbourne",region:"Australia"},{value:"Australia/Brisbane",label:"Brisbane",region:"Australia"},{value:"Australia/Perth",label:"Perth",region:"Australia"},{value:"Pacific/Auckland",label:"Auckland",region:"New Zealand"},{value:"Pacific/Fiji",label:"Fiji",region:"Pacific"}]},COMMON:{label:"Common Timezones",timezones:[{value:"UTC",label:"UTC (Coordinated Universal Time)",region:"UTC"},{value:"America/New_York",label:"Eastern Time (US)",region:"North America"},{value:"America/Los_Angeles",label:"Pacific Time (US)",region:"North America"},{value:"Europe/London",label:"London (GMT/BST)",region:"Europe"},{value:"Europe/Paris",label:"Paris (CET/CEST)",region:"Europe"},{value:"Asia/Tokyo",label:"Tokyo (JST)",region:"Asia"},{value:"Asia/Shanghai",label:"Shanghai (CST)",region:"Asia"},{value:"Australia/Sydney",label:"Sydney (AEDT/AEST)",region:"Australia"}]}},PAe=[...fA.COMMON.timezones,...fA.AMERICAS.timezones,...fA.EUROPE.timezones,...fA.ASIA_PACIFIC.timezones].reduce((e,t)=>(e.find(r=>r.value===t.value)||e.push(t),e),[]);function Xv(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return console.warn("Failed to detect user timezone:",e),"UTC"}}function El(e){try{return new Intl.DateTimeFormat("en",{timeZone:e}),!0}catch{return!1}}function Au(e,t=new Date){var r;try{const s=new Date(t.toLocaleString("en-US",{timeZone:e})),i=(new Date(t.toLocaleString("en-US",{timeZone:"UTC"})).getTime()-s.getTime())/(1e3*60),o=Math.floor(Math.abs(i)/60),l=Math.abs(i)%60,d=`${i<=0?"+":"-"}${o.toString().padStart(2,"0")}:${l.toString().padStart(2,"0")}`,m=((r=new Intl.DateTimeFormat("en",{timeZone:e,timeZoneName:"short"}).formatToParts(t).find(p=>p.type==="timeZoneName"))==null?void 0:r.value)||"Unknown";return{offset:i,offsetString:d,abbreviation:m,isDST:!1}}catch(s){return console.error("Error getting timezone info:",s),{offset:0,offsetString:"+00:00",abbreviation:"UTC",isDST:!1}}}function Il(e,t,r="MMM dd, yyyy h:mm a"){try{const s=typeof e=="string"?new Date(e):e;if(r==="full")return s.toLocaleString("en-US",{timeZone:t,year:"numeric",month:"long",day:"numeric",hour:"numeric",minute:"2-digit",timeZoneName:"short"});const a=new Date(s.toLocaleString("en-US",{timeZone:t}));return nn(a,r)}catch(s){return console.error("Error formatting date in timezone:",s),nn(typeof e=="string"?new Date(e):e,r)}}function rg(e){try{const t=new Date;return new Date(t.toLocaleString("en-US",{timeZone:e}))}catch(t){return console.error("Error getting current time in timezone:",t),new Date}}function IAe(e,t){try{const r=typeof e=="string"?new Date(e):e;return new Date(r.toLocaleString("en-US",{timeZone:t}))}catch(r){return console.error("Error converting UTC to timezone:",r),typeof e=="string"?new Date(e):e}}function OAe(e,t,r="MMM dd, yyyy h:mm a"){const s=typeof e=="string"?new Date(e):e,a=Au(t,s);return{date:s,formatted:Il(s,t,r),timezone:t,offset:a.offsetString,abbreviation:a.abbreviation}}function Zv(e){const t=PAe.find(r=>r.value===e);return(t==null?void 0:t.label)||e}function FAe(e,t=new Date){var r;try{return((r=new Intl.DateTimeFormat("en",{timeZone:e,timeZoneName:"short"}).formatToParts(t).find(i=>i.type==="timeZoneName"))==null?void 0:r.value)||"Unknown"}catch(s){return console.error("Error getting timezone abbreviation:",s),"Unknown"}}function LAe(e,t=new Date){try{const r=Au(e,new Date(t.getFullYear(),0,1)).offset,s=Au(e,new Date(t.getFullYear(),6,1)).offset,a=Au(e,t).offset;return r!==s&&a===Math.max(r,s)}catch(r){return console.error("Error checking DST status:",r),!1}}function DAe(e=!0){const t=[];return Object.entries(fA).forEach(([,r])=>
71{r.timezones.forEach(s=>{let a=s.label;if(e&&s.value!=="UTC"){const i=Au(s.value);a=`${s.label} (${i.offsetString})`}t.push({value:s.value,label:a,group:r.label})})}),t}function TA(e,t,r=!1){try{return(typeof e=="string"?new Date(e):e).toLocaleTimeString("en-US",{timeZone:t,hour12:!r,hour:"numeric",minute:"2-digit"})}catch(s){return console.error("Error formatting time in timezone:",s),(typeof e=="string"?new Date(e):e).toLocaleTimeString("en-US",{hour12:!r,hour:"numeric",minute:"2-digit"})}}function eb(e,t=Sy,r={}){const{includeSeconds:s=!1,minUnit:a=s?"seconds":"minutes",maxUnit:i="never",absoluteThreshold:o=7,showSuffix:l=!0,shortFormat:c=!1,relativeTo:d=t}=r,u=typeof e=="string"?new Date(e):e,h=rg(d),m=u.getTime()-h.getTime(),f=m<0,p=Math.abs(m),A=Math.floor(p/1e3),v=Math.floor(A/60),x=Math.floor(v/60),b=Math.floor(x/24),y=Math.floor(b/7),w=Math.floor(b/30),j=Math.floor(b/365),N=o>0&&b>=o||i==="minutes"&&x>=1||i==="hours"&&b>=1||i==="days"&&y>=1||i==="weeks"&&w>=1||i==="months"&&j>=1,_=Il(u,t,"MMM dd, yyyy h:mm a");if(N)return{relative:_,isPast:f,shouldShowAbsolute:!0,absolute:_,diffMs:m,unit:"absolute",value:0};const S=Il(u,t,"yyyy-MM-dd"),C=Il(h,t,"yyyy-MM-dd"),E=new Date(h);E.setDate(E.getDate()+1);const T=Il(E,t,"yyyy-MM-dd"),B=new Date(h);B.setDate(B.getDate()-1);const L=Il(B,t,"yyyy-MM-dd");if(S===C&&x<24){const I=TA(u,t,!1);if(!(x<6))return{relative:`Today at ${I}`,isPast:f,shouldShowAbsolute:!1,absolute:_,diffMs:m,unit:"today",value:0}}else{if(S===T)return{relative:`Tomorrow at ${TA(u,t,!1)}`,isPast:f,shouldShowAbsolute:!1,absolute:_,diffMs:m,unit:"tomorrow",value:1};if(S===L)return{relative:`Yesterday at ${TA(u,t,!1)}`,isPast:f,shouldShowAbsolute:!1,absolute:_,diffMs:m,unit:"yesterday",value:-1}}let P,F,M;if(j>=1)F="years",M=j,P=`${j} ${c?"y":j===1?"year":"years"}`;else if(w>=1)F="months",M=w,P=`${w} ${c?"mo":w===1?"month":"months"}`;else if(y>=1)F="weeks",M=y,P=`${y} ${c?"w":y===1?"week":"weeks"}`;else if(b>=1)F="days",M=b,P=`${b} ${c?"d":b===1?"day":"days"}`;else if(x>=1||a==="hours"){F="hours",M=x;const I=c?"h":x===1?"hour":"hours";P=`${Math.max(1,x)} ${I}`}else if(v>=1||a==="minutes"){F="minutes",M=v;const I=c?"m":v===1?"minute":"minutes";P=`${Math.max(1,v)} ${I}`}else if(s||a==="seconds"){F="seconds",M=A;const I=c?"s":A===1?"second":"seconds";P=`${Math.max(1,A)} ${I}`}else F="minutes",M=1,P=`1 ${c?"m":"minute"}`;return l&&(c?P=f?`${P} ago`:`in ${P}`:P=f?`${P} ago`:`in ${P}`),{relative:P,isPast:f,shouldShowAbsolute:!1,absolute:_,diffMs:m,unit:F,value:f?-M:M}}function AB(e,t=Sy,r={}){const{smartThreshold:s=7,...a}=r,i=eb(e,t,{...a,absoluteThreshold:s});return i.shouldShowAbsolute?i.absolute:i.relative}function nK(e,t=Sy,r="normal"){const s=typeof e=="string"?new Date(e):e,a=rg(t),i=Math.abs(s.getTime()-a.getTime()),o=Math.floor(i/(1e3*60*60*24)),l=a.getFullYear(),c=s.getFullYear();if(r==="compact")return i<60*1e3?"now":i<60*60*1e3?`${Math.floor(i/(60*1e3))}m`:i<24*60*60*1e3?`${Math.floor(i/(60*60*1e3))}h`:o<7?`${o}d`:c===l?Il(s,t,"MMM dd"):Il(s,t,"MMM dd, yyyy");const d=eb(e,t,{includeSeconds:r==="detailed",minUnit:r==="detailed"?"seconds":"minutes",absoluteThreshold:r==="detailed"?30:7,shortFormat:!1});return d.shouldShowAbsolute?c===l?Il(s,t,r==="detailed"?"MMM dd, h:mm a":"MMM dd"):Il(s,t,r==="detailed"?"MMM dd, yyyy h:mm a":"MMM dd, yyyy"):d.relative}function RAe(e,t=Sy,r={}){const{includeSeconds:s=!1,precision:a="medium"}=r,i=typeof e=="string"?new Date(e):e,o=rg(t),l=i.getTime()-o.getTime(),c=l<0,d=Math.floor(Math.abs(l)/1e3);if(d<60&&!s)return{timeString:c?"Just finished":"Starting soon",isPast:c,totalSeconds:d};const u=d%60,h=Math.floor(d/60),m=h%60,f=Math.floor(h/60),p=f%24,A=Math.floor(f/24),v=[];return A>0&&v.push(`${A} day${A!==1?"s":""}`),(a==="high"||a==="medium"&&A===0)&&p>0&&v.push(`${p} hour${p!==1?"s":""}`),(a==="high"||a==="medium"&&A===0&&p<12)&&m>0&&v.push(`${m} minute${m!==1?"s":""}`),s&&a==="high"&&A===0&&p===0&&u>0&&v.push(`${u} second${u!==1?"s":""}`),v.length===0?{timeString:s?`${u} second${u!==1?"s":""}`:"Less than a minute",isPast:c,totalSeconds:d}:{timeString:v.slice(0,a==="high"?3:2).join(", "),isPast:c,totalSeconds:d}}const xc=[{value:"UTC",label:"UTC",abbreviation:"UTC",region:"Universal"}
71,{value:"America/New_York",label:"Eastern Time",abbreviation:"EST/EDT",region:"US East Coast"},{value:"America/Chicago",label:"Central Time",abbreviation:"CST/CDT",region:"US Central"},{value:"America/Denver",label:"Mountain Time",abbreviation:"MST/MDT",region:"US Mountain"},{value:"America/Los_Angeles",label:"Pacific Time",abbreviation:"PST/PDT",region:"US West Coast"},{value:"Europe/London",label:"London",abbreviation:"GMT/BST",region:"UK"},{value:"Europe/Paris",label:"Central European Time",abbreviation:"CET/CEST",region:"Central Europe"},{value:"Asia/Tokyo",label:"Japan Standard Time",abbreviation:"JST",region:"Japan"},{value:"Asia/Shanghai",label:"China Standard Time",abbreviation:"CST",region:"China"},{value:"Asia/Kolkata",label:"India Standard Time",abbreviation:"IST",region:"India"},{value:"Australia/Sydney",label:"Australian Eastern Time",abbreviation:"AEST/AEDT",region:"Australia"}],sK={start:"09:00",end:"17:00",days:[1,2,3,4,5]};function UAe(e,t,r=sK){try{const s=typeof e=="string"?new Date(e):e,a=new Date(s.toLocaleString("en-US",{timeZone:t})),i=a.getDay(),o=a.getHours(),l=a.getMinutes(),c=o*60+l;if(!r.days.includes(i))return!1;const[d,u]=r.start.split(":").map(Number),[h,m]=r.end.split(":").map(Number),f=d*60+u,p=h*60+m;return c>=f&&c<=p}catch(s){return console.error("Error checking business hours:",s),!1}}function MAe(e,t){try{const r=typeof e=="string"?new Date(e):e,a=new Date(r.toLocaleString("en-US",{timeZone:t})).getDay();return a===0||a===6}catch(r){return console.error("Error checking weekend:",r),!1}}function r0(e,t=xc.map(s=>s.value),r){const s=typeof e=="string"?new Date(e):e,a=[];return t.forEach(i=>{try{const o=r==null?void 0:r.find(A=>A.timezone===i),l=(o==null?void 0:o.workingHours)||sK,c=new Date(s.toLocaleString("en-US",{timeZone:i})),d=Au(i,s),u=Zv(i),h=UAe(s,i,l),m=MAe(s,i);let f="none",p;if(m)f="warning",p="Weekend";else if(!h){const A=c.getHours();A<6||A>22?(f="warning",p="Late night/Early morning"):(f="caution",p="Outside typical business hours")}a.push({timezone:i,displayName:u,abbreviation:d.abbreviation,time:c,formatted:Il(s,i,"MMM dd, h:mm a"),isBusinessHours:h,isWeekend:m,offset:d.offsetString,warningLevel:f,warningMessage:p})}catch(o){console.error(`Error converting to timezone ${i}:`,o)}}),a.sort((i,o)=>{const l=Au(i.timezone).offset,c=Au(o.timezone).offset;return l-c})}function jI(e,t,r={}){const{workingHoursOnly:s=!0,weekdaysOnly:a=!0,maxSuggestions:i=5,hourRange:o={start:6,end:22}}=r,l=typeof e=="string"?new Date(e):e,c=[],d=new Date(l);d.setMinutes(0,0,0);for(let u=-2;u<=2;u++)for(let h=o.start;h<=o.end;h+=2){const m=new Date(d);m.setDate(m.getDate()+u),m.setHours(h);const f=r0(m,t);let p=0,A=0,v=0;if(f.forEach(y=>{y.isBusinessHours?(p+=10,A++):y.isWeekend||(p+=5),y.isWeekend&&(v+=3);const w=y.time.getHours();(w<6||w>22)&&(p-=5)}),p-=v,s&&A===0||a&&f.some(y=>y.isWeekend))continue;const x=A/f.length;let b=`${A}/${f.length} in business hours`;x===1?b="Perfect for all timezones":x>=.7?b="Good for most timezones":x>=.5?b="Acceptable for some timezones":b="Challenging for most timezones",c.push({time:m,score:p,conversions:f,summary:b})}return c.sort((u,h)=>h.score-u.score).slice(0,i)}function aK(e,t){const r=typeof e=="string"?new Date(e):e,s=r0(r,t),a=[],i=[],o=s.filter(d=>d.isWeekend).length,l=s.filter(d=>d.isBusinessHours).length,c=s.filter(d=>{var u;return d.warningLevel==="warning"&&((u=d.warningMessage)==null?void 0:u.includes("night"))}).length;return o>0&&a.push(`${o} timezone(s) will be on weekend`),l<t.length*.5&&a.push("Fewer than half of team members will be in business hours"),c>0&&a.push(`${c} timezone(s) will be late night/early morning`),a.length>0&&jI(r,t,{maxSuggestions:3}).forEach(u=>{i.push({time:u.time,reason:u.summary,conversions:u.conversions})}),{current:s,recommendations:i,warnings:a}}const Sy="UTC",BR="MMM dd, yyyy h:mm a";async function u2(e,t={}){var a,i;const{updateProfile:r=!0,silentMode:s=!1}=t;try{const o=((a=e.user_metadata)==null?void 0:a.timezone)||((i=e.app_metadata)==null?void 0:i.timezone);if(o&&El(o))return{detected:!1,timezone:o,wasAlreadySet:!0};const{data:l}=await de.schema("marketing_and_customer_success").from("profiles").select("timezone").eq("id",e.id).single();if(l!=null&&l.timezone&&El(l.timezone))return{detected:!1,timezone:l.timezone,wasAlreadySet:!0};const c=Xv();if(!c||!El(c))return{detected:!1,timezone:null,wasAlreadySet:!1,error:"Unable to detect a valid timezone"};if(r)try{const{error:d}=await de.auth.updateUser({data:{timezone:c}});d&&!s&&console.error("Error updating user auth metadata with timezone:",d);const{error:u}=await de.schema("marketing_and_customer_success").from("profiles").upsert({id:e.id,timezone:c,updated_at:new Date().toISOString()});u&&!s&&console.error("Error updating user profile with timezone:",u),s||console.log("Auto-detected and set user timezone:",c)}catch(d){return s||console.error("Error saving auto-detected timezone:",d),{detected:!0,timezone:c,wasAlreadySet:!1,error:"Detected timezone but failed to save it"}}return{detected:!0,timezone:c,wasAlreadySet:!1}}catch(o){const l=o instanceof Error?o.message:"Unknown error";return s||console.error("Error in autoDetectUserTimezone:",o),{detected:!1,timezone:null,wasAlreadySet:!1,error:l}}}async function h2(e){var t,r;
71try{const s=((t=e.user_metadata)==null?void 0:t.timezone)||((r=e.app_metadata)==null?void 0:r.timezone);if(s&&El(s))return!1;const{data:a}=await de.schema("marketing_and_customer_success").from("profiles").select("timezone").eq("id",e.id).single();return!(a!=null&&a.timezone&&El(a.timezone))}catch(s){return console.error("Error checking if timezone auto-detection is needed:",s),!1}}const iK=g.createContext({session:null,user:null,signOut:async()=>{},signInWithGoogle:async()=>{},signInWithFacebook:async()=>{},signInWithEmail:async()=>{},updateProfile:async()=>{},isSuperAdmin:!1,loading:!0});let TR=!1;function $Ae({children:e}){const[t,r]=g.useState(null),[s,a]=g.useState(null),[i,o]=g.useState(!0),[l,c]=g.useState(!1),d=xr(),u=g.useRef(null),h=g.useCallback(async()=>{var x;const v="https://worker.rainfactory.ai";try{const b=await de.auth.getSession();if(!((x=b.data.session)!=null&&x.access_token))return;const y=b.data.session.access_token,w=await fetch(`${v}/billing-functions/customer_sync`,{method:"POST",headers:{Authorization:`Bearer ${y}`}});if(w.status===401){console.error("Unauthorized access, clearing session"),r(null),a(null),m();return}const j=await w.json();console.log("Customer synced",j)}catch(b){console.error("Error syncing customer:",b)}},[]),m=()=>{for(const v in localStorage)(v.includes("supabase.auth")||v.includes("sb-"))&&localStorage.removeItem(v);document.cookie.split(";").forEach(v=>{const[x]=v.trim().split("=");x.includes("sb-")&&(document.cookie=`${x}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`)})},f=g.useCallback(async()=>{if(window.location.pathname!=="/"&&window.location.pathname!=="/home")return;const{data:v,error:x}=await de.from("brands").select("id").neq("status","DELETED").limit(1);if(x){console.error("Error fetching brands:",x);return}v!=null&&v.length||(console.log("No brands found, redirecting to onboarding"),d("/onboarding"))},[d]),p=g.useCallback(async(v,x)=>{var y,w,j,N;if(console.log("[Auth] handleSessionUpdate called",{event:x,newSessionId:(y=v==null?void 0:v.user)==null?void 0:y.id,currentSessionId:(w=t==null?void 0:t.user)==null?void 0:w.id,sessionRefId:(N=(j=u.current)==null?void 0:j.user)==null?void 0:N.id}),!(JSON.stringify(v)!==JSON.stringify(t))){console.log("[Auth] Session unchanged, skipping update");return}if(t&&x==="SIGNED_IN"){console.log("Session already exists, skipping session update");return}if(console.log("[Auth] Updating session state"),r(v),a((v==null?void 0:v.user)??null),u.current=v,v!=null&&v.user&&(!x||["SIGNED_IN","USER_UPDATED","INITIAL_SESSION"].includes(x))){const _=async()=>{try{if(await h2(v.user)){console.log("[Auth] Auto-detecting timezone for user");const C=await u2(v.user,{updateProfile:!0,silentMode:!0});C.detected&&C.timezone&&console.log("[Auth] Successfully auto-detected timezone:",C.timezone)}}catch(S){console.error("[Auth] Error during timezone auto-detection:",S)}};await Promise.all([f(),h(),_()])}},[t,f,h]),A=g.useMemo(()=>{var v;return{session:t,user:s,signOut:async()=>{try{const{data:x}=await de.auth.getSession();if(x.session){const{error:b}=await de.auth.signOut({scope:"global"});if(b)throw b}r(null),a(null),m(),window.location.href="/?forceLogout="+Date.now()}catch(x){console.error("Error signing out:",x),m(),window.location.href="/?forceLogout="+Date.now()}},signInWithGoogle:async()=>{const{error:x}=await de.auth.signInWithOAuth({provider:"google",options:{redirectTo:`${window.location.origin}/auth/callback`}});if(x)throw console.error("Error signing in with Google:",x),x},signInWithFacebook:async()=>{const{error:x}=await de.auth.signInWithOAuth({provider:"facebook",options:{redirectTo:`${window.location.origin}/auth/callback`}});if(x)throw console.error("Error signing in with Facebook:",x),x},signInWithEmail:async x=>{const{error:b}=await de.auth.signInWithOtp({email:x,options:{emailRedirectTo:`${window.location.origin}/auth/callback`}});if(b)throw console.error("Error signing in with Email:",b),b},updateProfile:async x=>{var b;try{const{error:y}=await de.auth.updateUser({data:x});if(y)throw y;const{data:{session:w}}=await de.auth.getSession();if(!((b=w==null?void 0:w.user)!=null&&b.id))throw new Error("No user session found");
71const j={emailNotifications:x.emailNotifications},{error:N}=await de.schema("marketing_and_customer_success").from("profiles").upsert({id:w.user.id,full_name:x.full_name,email_opt_in:x.emailNotifications,preferred_language:x.language,timezone:x.timezone,notificationPreferences:j,updated_at:new Date().toISOString()});if(N)throw N}catch(y){throw console.error("Error updating profile:",y),y}},isSuperAdmin:((v=s==null?void 0:s.app_metadata)==null?void 0:v.is_super_admin)??!1,loading:i||!l}},[t,s,i,l]);return g.useEffect(()=>{if(TR)return;TR=!0;let v=!0;if(new URLSearchParams(window.location.search).get("forceLogout")){m();const w=window.location.pathname;window.history.replaceState({},document.title,w)}async function y(){try{const{data:{session:w},error:j}=await de.auth.getSession();if(j)throw j;if(!v)return;w&&(u.current=w,await p(w,"INITIAL_SESSION")),console.log("[Auth] Setting loading to false and initialized to true"),o(!1),c(!0);const{data:{subscription:N}}=de.auth.onAuthStateChange(async(_,S)=>{var C,E,T,B;if(v){if(_==="SIGNED_IN"&&((E=(C=u.current)==null?void 0:C.user)!=null&&E.id)&&u.current.user.id===((T=S==null?void 0:S.user)==null?void 0:T.id)){console.log("Ignoring SIGNED_IN event - user already authenticated");return}console.log("Auth state changed:",{event:_,userId:(B=S==null?void 0:S.user)==null?void 0:B.id}),p(S,_)}});return()=>{v=!1,N.unsubscribe()}}catch(w){console.error("Auth initialization error:",w),v&&(o(!1),c(!0))}}y()},[p]),n.jsx(iK.Provider,{value:A,children:e})}const wa=()=>{const e=g.useContext(iK);if(e===void 0)throw new Error("useAuth must be used within an AuthProvider");return e},QAe=1,HAe=1e6;let p5=0;function zAe(){return p5=(p5+1)%Number.MAX_SAFE_INTEGER,p5.toString()}const A5=new Map,PR=e=>{if(A5.has(e))return;const t=setTimeout(()=>{A5.delete(e),dv({type:"REMOVE_TOAST",toastId:e})},HAe);A5.set(e,t)},VAe=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,QAe)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(r=>r.id===t.toast.id?{...r,...t.toast}:r)};case"DISMISS_TOAST":{const{toastId:r}=t;return r?PR(r):e.toasts.forEach(s=>{PR(s.id)}),{...e,toasts:e.toasts.map(s=>
71s.id===r||r===void 0?{...s,open:!1}:s)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(r=>r.id!==t.toastId)}}},jj=[];let Nj={toasts:[]};function dv(e){Nj=VAe(Nj,e),jj.forEach(t=>{t(Nj)})}function He({...e}){const t=zAe(),r=a=>dv({type:"UPDATE_TOAST",toast:{...a,id:t}}),s=()=>dv({type:"DISMISS_TOAST",toastId:t});return dv({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:a=>{a||s()}}}),{id:t,dismiss:s,update:r}}function sn(){const[e,t]=g.useState(Nj);return g.useEffect(()=>(jj.push(t),()=>{const r=jj.indexOf(t);r>-1&&jj.splice(r,1)}),[e]),{...e,toast:He,dismiss:r=>dv({type:"DISMISS_TOAST",toastId:r})}}function GAe(e={}){const{autoTrigger:t=!0,showToast:r=!0,redirectToSettings:s=!1}=e,{user:a}=wa(),{toast:i}=sn(),o=xr(),[l,c]=g.useState({isDetecting:!1,hasDetected:!1,detectedTimezone:null,showNotification:!1,error:null});g.useEffect(()=>{!t||!a||l.hasDetected||l.isDetecting||d()},[a,t]);const d=g.useCallback(async()=>{if(a){c(p=>({...p,isDetecting:!0,error:null}));try{if(!await h2(a)){c(v=>({...v,isDetecting:!1,hasDetected:!0}));return}const A=await u2(a,{updateProfile:!0,silentMode:!1});c(v=>({...v,isDetecting:!1,hasDetected:!0,detectedTimezone:A.timezone,showNotification:A.detected&&!!A.timezone,error:A.error||null})),r&&A.detected&&A.timezone&&u(A)}catch(p){const A=p instanceof Error?p.message:"Unknown error";c(v=>({...v,isDetecting:!1,error:A})),r&&i({title:"Timezone Detection Failed",description:"We couldn't automatically detect your timezone. Please set it manually in your profile settings.",variant:"destructive"})}}},[a,r,i]),u=g.useCallback(p=>{var v;if(!p.timezone)return;const A=((v=p.timezone.split("/").pop())==null?void 0:v.replace(/_/g," "))||p.timezone;i({title:"Timezone Auto-Detected",description:`We've automatically set your timezone to ${A}. You can change this in your profile settings.`})},[i,o,s]),h=g.useCallback(()=>{c(p=>({...p,showNotification:!1}))},[]),m=g.useCallback(()=>{h(),o("/settings")},[h,o]),f=g.useCallback(()=>{c(p=>({...p,hasDetected:!1,error:null,showNotification:!1})),d()},[d]);return{...l,detectTimezone:d,dismissNotification:h,openSettings:m,retryDetection:f}}function oK(e){var t,r,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(r=oK(e[t]))&&(s&&(s+=" "),s+=r)}else for(r in e)e[r]&&(s&&(s+=" "),s+=r);return s}function fr(){for(var e,t,r=0,s="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=oK(e))&&(s&&(s+=" "),s+=t);return s}const IR=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,OR=fr,Jm=(e,t)=>r=>{var s;if((t==null?void 0:t.variants)==null)return OR(e,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:a,defaultVariants:i}=t,o=Object.keys(a).map(d=>{const u=r==null?void 0:r[d],h=i==null?void 0:i[d];if(u===null)return null;const m=IR(u)||IR(h);return a[d][m]}),l=r&&Object.entries(r).reduce((d,u)=>{let[h,m]=u;return m===void 0||(d[h]=m),d},{}),c=t==null||(s=t.compoundVariants)===null||s===void 0?void 0:s.reduce((d,u)=>{let{class:h,className:m,...f}=u;return Object.entries(f).every(p=>{let[A,v]=p;return Array.isArray(v)?v.includes({...i,...l}[A]):{...i,...l}[A]===v})?[...d,h,m]:d},[]);return OR(e,o,c,r==null?void 0:r.class,r==null?void 0:r.className)},NI="-",qAe=e=>{const t=WAe(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:o=>{const l=o.split(NI);return l[0]===""&&l.length!==1&&l.shift(),lK(l,t)||KAe(o)},getConflictingClassGroupIds:(o,l)=>{const c=r[o]||[];return l&&s[o]?[...c,...s[o]]:c}}},lK=(e,t)=>{var o;if(e.length===0)return t.classGroupId;const r=e[0],s=t.nextPart.get(r),a=s?lK(e.slice(1),s):void 0;if(a)return a;if(t.validators.length===0)return;const i=e.join(NI);return(o=t.validators.find(({validator:l})=>l(i)))==null?void 0:o.classGroupId},FR=/^\[(.+)\]$/,KAe=e=>{if(FR.test(e)){const t=FR.exec(e)[1],r=t==null?void 0:t.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},WAe=e=>{const{theme:t,prefix:r}=e,s={nextPart:new Map,validators:[]};return JAe(Object.entries(e.classGroups),r).forEach(([i,o])=>{gB(o,s,i,t)}),s},gB=(e,t,r,s)=>{e.forEach(a=>
vendor: 5,073 bytes, line 71
71{if(typeof a=="string"){const i=a===""?t:LR(t,a);i.classGroupId=r;return}if(typeof a=="function"){if(YAe(a)){gB(a(s),t,r,s);return}t.validators.push({validator:a,classGroupId:r});return}Object.entries(a).forEach(([i,o])=>{gB(o,LR(t,i),r,s)})})},LR=(e,t)=>{let r=e;return t.split(NI).forEach(s=>{r.nextPart.has(s)||r.nextPart.set(s,{nextPart:new Map,validators:[]}),r=r.nextPart.get(s)}),r},YAe=e=>e.isThemeGetter,JAe=(e,t)=>t?e.map(([r,s])=>{const a=s.map(i=>typeof i=="string"?t+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([o,l])=>[t+o,l])):i);return[r,a]}):e,XAe=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=new Map,s=new Map;const a=(i,o)=>{r.set(i,o),t++,t>e&&(t=0,s=r,r=new Map)};return{get(i){let o=r.get(i);if(o!==void 0)return o;if((o=s.get(i))!==void 0)return a(i,o),o},set(i,o){r.has(i)?r.set(i,o):a(i,o)}}},cK="!",ZAe=e=>{const{separator:t,experimentalParseClassName:r}=e,s=t.length===1,a=t[0],i=t.length,o=l=>{const c=[];let d=0,u=0,h;for(let v=0;v<l.length;v++){let x=l[v];if(d===0){if(x===a&&(s||l.slice(v,v+i)===t)){c.push(l.slice(u,v)),u=v+i;continue}if(x==="/"){h=v;continue}}x==="["?d++:x==="]"&&d--}const m=c.length===0?l:l.substring(u),f=m.startsWith(cK),p=f?m.substring(1):m,A=h&&h>u?h-u:void 0;return{modifiers:c,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:A}};return r?l=>r({className:l,parseClassName:o}):o},ege=e=>{if(e.length<=1)return e;const t=[];let r=[];return e.forEach(s=>{s[0]==="["?(t.push(...r.sort(),s),r=[]):r.push(s)}),t.push(...r.sort()),t},tge=e=>({cache:XAe(e.cacheSize),parseClassName:ZAe(e),...qAe(e)}),rge=/\s+/,nge=(e,t)=>{const{parseClassName:r,getClassGroupId:s,getConflictingClassGroupIds:a}=t,i=[],o=e.trim().split(rge);let l="";for(let c=o.length-1;c>=0;c-=1){const d=o[c],{modifiers:u,hasImportantModifier:h,baseClassName:m,maybePostfixModifierPosition:f}=r(d);let p=!!f,A=s(p?m.substring(0,f):m);if(!A){if(!p){l=d+(l.length>0?" "+l:l);continue}if(A=s(m),!A){l=d+(l.length>0?" "+l:l);continue}p=!1}const v=ege(u).join(":"),x=h?v+cK:v,b=x+A;if(i.includes(b))continue;i.push(b);const y=a(A,p);for(let w=0;w<y.length;++w){const j=y[w];i.push(x+j)}l=d+(l.length>0?" "+l:l)}return l};function sge(){let e=0,t,r,s="";for(;e<arguments.length;)(t=arguments[e++])&&(r=dK(t))&&(s&&(s+=" "),s+=r);return s}const dK=e=>{if(typeof e=="string")return e;let t,r="";for(let s=0;s<e.length;s++)e[s]&&(t=dK(e[s]))&&(r&&(r+=" "),r+=t);return r};function age(e,...t){let r,s,a,i=o;function o(c){const d=t.reduce((u,h)=>h(u),e());return r=tge(d),s=r.cache.get,a=r.cache.set,i=l,l(c)}function l(c){const d=s(c);if(d)return d;const u=nge(c,r);return a(c,u),u}return function(){return i(sge.apply(null,arguments))}}const os=e=>{const t=r=>r[e]||[];return t.isThemeGetter=!0,t},uK=/^\[(?:([a-z-]+):)?(.+)\]$/i,ige=/^\d+\/\d+$/,oge=new Set(["px","full","screen"]),lge=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,cge=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,dge=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,uge=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,hge=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Vd=e=>PA(e)||oge.has(e)||ige.test(e),sh=e=>n0(e,"length",bge),PA=e=>!!e&&!Number.isNaN(Number(e)),g5=e=>n0(e,"number",PA),hx=e=>!!e&&Number.isInteger(Number(e)),fge=e=>e.endsWith("%")&&PA(e.slice(0,-1)),Ur=e=>uK.test(e),ah=e=>lge.test(e),mge=new Set(["length","size","percentage"]),pge=e=>n0(e,mge,hK),Age=e=>n0(e,"position",hK),gge=new Set(["image","url"]),xge=e=>n0(e,gge,wge),vge=e=>n0(e,"",yge),fx=()=>!0,n0=(e,t,r)=>{const s=uK.exec(e);return s?s[1]?typeof t=="string"?s[1]===t:t.has(s[1]):r(s[2]):!1},bge=e=>cge.test(e)&&!dge.test(e),hK=()=>!1,yge=e=>uge.test(e),wge=e=>hge.test(e),jge=()=>{const e=os("colors"),t=os("spacing"),r=os("blur"),s=os("brightness"),a=os("borderColor"),i=os("borderRadius"),o=os("borderSpacing"),l=os("borderWidth"),c=os("contrast"),d=os("grayscale"),u=os("hueRotate"),h=os("invert"),m=os("gap"),f=os("gradientColorStops"),p=os("gradientColorStopPositions"),A=os("inset"),v=os("margin"),x=os("opacity"),b=os("padding"),y=os("saturate"),w=os("scale"),j=os("sepia"),N=os("skew"),_=os("space"),S=os("translate"),C=()=>["auto","contain","none"],E=()=>["auto","hidden","clip","visible","scroll"],T=()=>["auto",Ur,t],B=()=>[Ur,t],L=()=>["",Vd,sh],P=()=>["auto",PA,Ur],F=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],M=()=>["solid","dashed","dotted","double","none"],I=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],$=()=>["start","end","center","between","around","evenly","stretch"],V=()=>["","0",Ur],R=()=>["auto","avoid","all","avoid-page","page","left","right","column"],Q=()=>[PA,Ur];return{cacheSize:500,separator:":",theme:{colors:[fx],spacing:[Vd,sh],blur:["none","",ah,Ur],brightness:Q(),borderColor:[e],borderRadius:["n
71one","","full",ah,Ur],borderSpacing:B(),borderWidth:L(),contrast:Q(),grayscale:V(),hueRotate:Q(),invert:V(),gap:B(),gradientColorStops:[e],gradientColorStopPositions:[fge,sh],inset:T(),margin:T(),opacity:Q(),padding:B(),saturate:Q(),scale:Q(),sepia:V(),skew:Q(),space:B(),translate:B()},classGroups:{aspect:[{aspect:["auto","square","video",Ur]}],container:["container"],columns:[{columns:[ah]}],"break-after":[{"break-after":R()}],"break-before":[{"break-before":R()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...F(),Ur]}],overflow:[{overflow:E()}],"overflow-x":[{"overflow-x":E()}],"overflow-y":[{"overflow-y":E()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[A]}],"inset-x":[{"inset-x":[A]}],"inset-y":[{"inset-y":[A]}],start:[{start:[A]}],end:[{end:[A]}],top:[{top:[A]}],right:[{right:[A]}],bottom:[{bottom:[A]}],left:[{left:[A]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",hx,Ur]}],basis:[{basis:T()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Ur]}],grow:[{grow:V()}],shrink:[{shrink:V()}],order:[{order:["first","last","none",hx,Ur]}],"grid-cols":[{"grid-cols":[fx]}],"col-start-end":[{col:["auto",{span:["full",hx,Ur]},Ur]}],"col-start":[{"col-start":P()}],"col-end":[{"col-end":P()}],"grid-rows":[{"grid-rows":[fx]}],"row-start-end":[{row:["auto",{span:[hx,Ur]},Ur]}],"row-start":[{"row-start":P()}],"row-end":[{"row-end":P()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Ur]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Ur]}],gap:[{gap:[m]}],"gap-x":[{"gap-x":[m]}],"gap-y":[{"gap-y":[m]}],"justify-content":[{justify:["normal",...$()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...$(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...$(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[b]}],px:[{px:[b]}],py:[{py:[b]}],ps:[{ps:[b]}],pe:[{pe:[b]}],pt:[{pt:[b]}],pr:[{pr:[b]}],pb:[{pb:[b]}],pl:[{pl:[b]}],m:[{m:[v]}],mx:[{mx:[v]}],my:[{my:[v]}],ms:[{ms:[v]}],me:[{me:[v]}],mt:[{mt:[v]}],mr:[{mr:[v]}],mb:[{mb:[v]}],ml:[{ml:[v]}],"space-x":[{"space-x":[_]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[_]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Ur,t]}
vendor: 8,425 bytes, line 71
71],"min-w":[{"min-w":[Ur,t,"min","max","fit"]}],"max-w":[{"max-w":[Ur,t,"none","full","min","max","fit","prose",{screen:[ah]},ah]}],h:[{h:[Ur,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Ur,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Ur,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Ur,t,"auto","min","max","fit"]}],"font-size":[{text:["base",ah,sh]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",g5]}],"font-family":[{font:[fx]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",Ur]}],"line-clamp":[{"line-clamp":["none",PA,g5]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Vd,Ur]}],"list-image":[{"list-image":["none",Ur]}],"list-style-type":[{list:["none","disc","decimal",Ur]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[x]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[x]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...M(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Vd,sh]}],"underline-offset":[{"underline-offset":["auto",Vd,Ur]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:B()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ur]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ur]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[x]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...F(),Age]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",pge]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},xge]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[p]}],"gradient-via-pos":[{via:[p]}],"gradient-to-pos":[{to:[p]}],"gradient-from":[{from:[f]}],"gradient-via":[{via:[f]}],"gradient-to":[{to:[f]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[x]}],"border-style":[{border:[...M(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[x]}],"divide-style":[{divide:M()}],"border-color":[{border:[a]}],"border-color-x":[{"border-x":[a]}],"border-color-y":[{"border-y":[a]}],"border-color-s":[{"border-s":[a]}],"border-color-e":[{"border-e":[a]}],"border-color-t":[{"border-t":[a]}],"border-color-r":[{"border-r":[a]}],"border-color-b":[{"border-b":[a]}],"border-color-l":[{"border-l":[a]}],"divide-color":[{divide:[a]}],"outline-style":[{outline:["",...M()]}],"outline-offset":[{"outline-offset":[Vd,Ur]}],"outline-w":[{outline:[Vd,sh]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:L()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[x]}],"ring-offset-w":[{"ring-offset":[Vd,sh]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",ah,vge]}],"shadow-color":[{shadow:[fx]}],opacity:[{opacity:[x]}],"mix-blend":[{"mix-blend":[...I(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":I()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[s]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",ah,Ur]}],grayscale:[{grayscale:[d]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[h]}],saturate:[{saturate:[y]}],sepia:[{sepia:[j]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[s]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[d]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[h]}],"backdrop-opacity":[{"backdrop-opacity":[x]}],"backdrop-saturate":[{"backdrop-saturate":[y]}],"backdrop-sepia":[{"backdrop-sepia":[j]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Ur]}],duration:[{duration:Q()}],ease:[{ease:["linear","in","out","in-out",Ur]}],delay:[{delay:Q()}],animate:[{animate:["none","spin","ping","pulse","bounce",Ur]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[w]}],"scale-x":[{"scale-x":[w]}],"scale-y":[{"scale-y":[w]}],rotate:[{rotate:[hx,Ur]}],"translate-x":[{"translate-x":[S]}],"translate-y":[{"translate-y":[S]}],"skew-x":[{"skew-x":[N]}],"skew-y":[{"skew-y":[N]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Ur]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Ur]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":B()}],"scroll-mx":[{"scroll-mx":B()}],"scroll-my":[{"scroll-my":B()}],"scroll-ms":[{"scroll-ms":B()}],"scroll-me":[{"scroll-me":B()}],"scroll-mt":[{"scroll-mt":B()}],"scroll-mr":[{"scroll-mr":B()}],"scroll-mb":[{"scroll-mb":B()}],"scroll-ml":[{"scroll-ml":B()}],"scroll-p":[{"scroll-p":B()}],"scroll-px":[{"scroll-px":B()}],"scroll-py":[{"scroll-py":B()}],"scroll-ps":[{"scroll-ps":B()}],"scroll-pe":[{"scroll-pe":B()}],"scroll-pt":[{"scroll-pt":B()}],"scroll-pr":[{"scroll-pr":B()}],"scroll-pb":[{"scroll-pb":B()}],"scroll-pl":[{"scroll-pl":B()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ur]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Vd,sh,g5]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","
71none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},Nge=age(jge);function ye(...e){return Nge(fr(e))}function fK(e,t="usd"){return new Intl.NumberFormat("en-US",{style:"currency",currency:t.toUpperCase(),minimumFractionDigits:2}).format(e)}function wi(){const e=new URLSearchParams(window.location.search),t={};return["utm_source","utm_medium","utm_campaign","utm_term","utm_content"].forEach(r=>{const s=e.get(r);if(s)if(s.includes("%3Futm_")||s.includes("?utm_"))try{const a=s.replace(/%3Futm_/g,"?utm_").split("?utm_")[0];t[r]=a}catch{t[r]=s}else t[r]=s}),t}function _ge(e){const t=wi();if(Object.keys(t).length===0)return e;const r=new URL(e,window.location.origin),s=new URLSearchParams(r.
71search);return Object.entries(t).forEach(([a,i])=>{s.set(a,decodeURIComponent(i))}),r.search=s.toString(),r.toString()}function Li(e){return new Intl.NumberFormat("en-US").format(e)}function x5(e){if(e<1e3)return e.toString();if(e<1e6){const r=e/1e3;return r%1===0?`${r}k`:`${r.toFixed(1)}k`}if(e<1e9){const r=e/1e6;return r%1===0?`${r}M`:`${r.toFixed(1)}M`}const t=e/1e9;return t%1===0?`${t}B`:`${t.toFixed(1)}B`}function DR(e){const t=typeof e=="string"?new Date(e):e;return new Intl.DateTimeFormat("en-US",{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(t)}const tb=Jm("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline",expandIcon:"group relative text-primary-foreground bg-primary hover:bg-primary/90",ringHover:"bg-primary text-primary-foreground transition-all duration-300 hover:bg-primary/90 hover:ring-2 hover:ring-primary/90 hover:ring-offset-2",shine:"text-primary-foreground animate-shine bg-gradient-to-r from-primary via-primary/75 to-primary bg-[length:400%_100%] ",gooeyRight:"text-primary-foreground relative bg-primary z-0 overflow-hidden transition-all duration-500 before:absolute before:inset-0 before:-z-10 before:translate-x-[150%] before:translate-y-[150%] before:scale-[2.5] before:rounded-[100%] before:bg-gradient-to-r from-zinc-400 before:transition-transform before:duration-1000  hover:before:translate-x-[0%] hover:before:translate-y-[0%] ",gooeyLeft:"text-primary-foreground relative bg-primary z-0 overflow-hidden transition-all duration-500 after:absolute after:inset-0 after:-z-10 after:translate-x-[-150%] after:translate-y-[150%] after:scale-[2.5] after:rounded-[100%] after:bg-gradient-to-l from-zinc-400 after:transition-transform after:duration-1000  hover:after:translate-x-[0%] hover:after:translate-y-[0%] ",linkHover1:"relative after:absolute after:bg-primary after:bottom-2 after:h-[1px] after:w-2/3 after:origin-bottom-left after:scale-x-100 hover:after:origin-bottom-right hover:after:scale-x-0 after:transition-transform after:ease-in-out after:duration-300",linkHover2:"relative after:absolute after:bg-primary after:bottom-2 after:h-[1px] after:w-2/3 after:origin-bottom-right after:scale-x-0 hover:after:origin-bottom-left hover:after:scale-x-100 after:transition-transform after:ease-in-out after:duration-300"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),te=g.forwardRef(({className:e,variant:t,size:r,asChild:s=!1,Icon:a,iconPlacement:i,...o},l)=>{if(s&&o.children&&g.isValidElement(o.children)&&o.children.type==="a"&&o.children.props.href){const{href:c,...d}=o.children.props;return n.jsxs("a",{href:c,className:ye(tb({variant:t,size:r,className:e})),...d,children:[a&&i==="left"&&n.jsx("span",{className:"mr-2",children:n.jsx(a,{})}),o.children.props.children,a&&i==="right"&&n.jsx("span",{className:"ml-2",children:n.jsx(a,{})})]})}return n.jsxs("button",{className:ye(tb({variant:t,size:r,className:e})),ref:l,...o,children:[a&&i==="left"&&n.jsx("span",{className:"mr-2",children:n.jsx(a,{})}),o.children,a&&i==="right"&&n.jsx("span",{className:"ml-2",children:n.jsx(a,{})})]})});te.displayName="Button";const Te=g.forwardRef(({className:e,...t},r)=>n.jsx("div",{ref:r,className:ye("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));Te.displayName="Card";const st=g.forwardRef(({className:e,...t},r)=>n.jsx("div",{ref:r,className:ye("flex flex-col space-y-1.5 p-6",e),...t}));
vendor: 6,881 bytes, lines 71-146
71st.displayName="CardHeader";const ot=g.forwardRef(({className:e,...t},r)=>n.jsx("h3",{ref:r,className:ye("text-2xl font-semibold leading-none tracking-tight",e),...t}));ot.displayName="CardTitle";const Wr=g.forwardRef(({className:e,...t},r)=>n.jsx("p",{ref:r,className:ye("text-sm text-muted-foreground",e),...t}));Wr.displayName="CardDescription";const Re=g.forwardRef(({className:e,...t},r)=>n.jsx("div",{ref:r,className:ye("p-6 pt-0",e),...t}));Re.displayName="CardContent";const uo=g.forwardRef(({className:e,...t},r)=>n.jsx("div",{ref:r,className:ye("flex items-center p-6 pt-0",e),...t}));uo.displayName="CardFooter";const Cge=Jm("inline-flex items-center rounded-full 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 hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",success:"border-transparent bg-green-500 text-white hover:bg-green-600",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Be({className:e,variant:t,...r}){return n.jsx("div",{className:ye(Cge({variant:t}),e),...r})}/**
72 * @license lucide-react v0.474.0 - ISC
73 *
74 * This source code is licensed under the ISC license.
75 * See the LICENSE file in the root directory of this source tree.
76 */const Sge=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),mK=(...e)=>e.filter((t,r,s)=>!!t&&t.trim()!==""&&s.indexOf(t)===r).join(" ").trim();/**
77 * @license lucide-react v0.474.0 - ISC
78 *
79 * This source code is licensed under the ISC license.
80 * See the LICENSE file in the root directory of this source tree.
81 */var kge={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
82 * @license lucide-react v0.474.0 - ISC
83 *
84 * This source code is licensed under the ISC license.
85 * See the LICENSE file in the root directory of this source tree.
86 */const Ege=g.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:s,className:a="",children:i,iconNode:o,...l},c)=>g.createElement("svg",{ref:c,...kge,width:t,height:t,stroke:e,strokeWidth:s?Number(r)*24/Number(t):r,className:mK("lucide",a),...l},[...o.map(([d,u])=>g.createElement(d,u)),...Array.isArray(i)?i:[i]]));/**
87 * @license lucide-react v0.474.0 - ISC
88 *
89 * This source code is licensed under the ISC license.
90 * See the LICENSE file in the root directory of this source tree.
91 */const $e=(e,t)=>{const r=g.forwardRef(({className:s,...a},i)=>g.createElement(Ege,{ref:i,iconNode:t,className:mK(`lucide-${Sge(e)}`,s),...a}));return r.displayName=`${e}`,r};/**
92 * @license lucide-react v0.474.0 - ISC
93 *
94 * This source code is licensed under the ISC license.
95 * See the LICENSE file in the root directory of this source tree.
96 */const Bge=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],f2=$e("Activity",Bge);/**
97 * @license lucide-react v0.474.0 - ISC
98 *
99 * This source code is licensed under the ISC license.
100 * See the LICENSE file in the root directory of this source tree.
101 */const Tge=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],rb=$e("Archive",Tge);/**
102 * @license lucide-react v0.474.0 - ISC
103 *
104 * This source code is licensed under the ISC license.
105 * See the LICENSE file in the root directory of this source tree.
106 */const Pge=[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"M11 4h10",key:"1w87gc"}],["path",{d:"M11 8h7",key:"djye34"}],["path",{d:"M11 12h4",key:"q8tih4"}]],Ige=$e("ArrowDownWideNarrow",Pge);/**
107 * @license lucide-react v0.474.0 - ISC
108 *
109 * This source code is licensed under the ISC license.
110 * See the LICENSE file in the root directory of this source tree.
111 */const Oge=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Fge=$e("ArrowDown",Oge);/**
112 * @license lucide-react v0.474.0 - ISC
113 *
114 * This source code is licensed under the ISC license.
115 * See the LICENSE file in the root directory of this source tree.
116 */const Lge=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],Yo=$e("ArrowLeft",Lge);/**
117 * @license lucide-react v0.474.0 - ISC
118 *
119 * This source code is licensed under the ISC license.
120 * See the LICENSE file in the root directory of this source tree.
121 */const Dge=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],io=$e("ArrowRight",Dge);/**
122 * @license lucide-react v0.474.0 - ISC
123 *
124 * This source code is licensed under the ISC license.
125 * See the LICENSE file in the root directory of this source tree.
126 */const Rge=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],ju=$e("ArrowUpDown",Rge);/**
127 * @license lucide-react v0.474.0 - ISC
128 *
129 * This source code is licensed under the ISC license.
130 * See the LICENSE file in the root directory of this source tree.
131 */const Uge=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Ww=$e("ArrowUp",Uge);/**
132 * @license lucide-react v0.474.0 - ISC
133 *
134 * This source code is licensed under the ISC license.
135 * See the LICENSE file in the root directory of this source tree.
136 */const Mge=[["path",{d:"M2 10v3",key:"1fnikh"}],["path",{d:"M6 6v11",key:"11sgs0"}],["path",{d:"M10 3v18",key:"yhl04a"}],["path",{d:"M14 8v7",key:"3a1oy3"}],["path",{d:"M18 5v13",key:"123xd1"}],["path",{d:"M22 10v3",key:"154ddg"}]],xB=$e("AudioLines",Mge);/**
137 * @license lucide-react v0.474.0 - ISC
138 *
139 * This source code is licensed under the ISC license.
140 * See the LICENSE file in the root directory of this source tree.
141 */const $ge=[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Qge=$e("BadgeCheck",$ge);/**
142 * @license lucide-react v0.474.0 - ISC
143 *
144 * This source code is licensed under the ISC license.
145 * See the LICENSE file in the root directory of this source tree.
146 */const Hge=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742",key:"178tsu"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05",key:"1hqiys"}]],zge=$e("BellOff",Hge);
146/**
147 * @license lucide-react v0.474.0 - ISC
148 *
149 * This source code is licensed under the ISC license.
150 * See the LICENSE file in the root directory of this source tree.
151 */const Vge=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],Gge=$e("Bell",Vge);/**
152 * @license lucide-react v0.474.0 - ISC
153 *
154 * This source code is licensed under the ISC license.
155 * See the LICENSE file in the root directory of this source tree.
156 */const qge=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],vB=$e("BookOpen",qge);/**
157 * @license lucide-react v0.474.0 - ISC
158 *
159 * This source code is licensed under the ISC license.
160 * See the LICENSE file in the root directory of this source tree.
161 */const Kge=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],gu=$e("Bot",Kge);/**
162 * @license lucide-react v0.474.0 - ISC
163 *
164 * This source code is licensed under the ISC license.
165 * See the LICENSE file in the root directory of this source tree.
166 */const Wge=[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]],Gi=$e("Brain",Wge);/**
167 * @license lucide-react v0.474.0 - ISC
168 *
169 * This source code is licensed under the ISC license.
170 * See the LICENSE file in the root directory of this source tree.
171 */const Yge=[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]],zh=$e("Building2",Yge);/**
172 * @license lucide-react v0.474.0 - ISC
173 *
174 * This source code is licensed under the ISC license.
175 * See the LICENSE file in the root directory of this source tree.
176 */const Jge=[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",ry:"2",key:"76otgf"}],["path",{d:"M9 22v-4h6v4",key:"r93iot"}],["path",{d:"M8 6h.01",key:"1dz90k"}],["path",{d:"M16 6h.01",key:"1x0f13"}],["path",{d:"M12 6h.01",key:"1vi96p"}],["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 10h.01",key:"1m94wz"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M8 14h.01",key:"6423bh"}]],ih=$e("Building",Jge);/**
177 * @license lucide-react v0.474.0 - ISC
178 *
179 * This source code is licensed under the ISC license.
180 * See the LICENSE file in the root directory of this source tree.
181 */const Xge=[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["line",{x1:"8",x2:"16",y1:"6",y2:"6",key:"x4nwl0"}],["line",{x1:"16",x2:"16",y1:"14",y2:"18",key:"wjye3r"}],["path",{d:"M16 10h.01",key:"1m94wz"}],["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M8 18h.01",key:"lrp35t"}]],pK=$e("Calculator",Xge);/**
182 * @license lucide-react v0.474.0 - ISC
183 *
184 * This source code is licensed under the ISC license.
185 * See the LICENSE file in the root directory of this source tree.
186 */const Zge=[["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M3 10h5",key:"r794hk"}
186],["path",{d:"M17.5 17.5 16 16.3V14",key:"akvzfd"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]],AK=$e("CalendarClock",Zge);/**
187 * @license lucide-react v0.474.0 - ISC
188 *
189 * This source code is licensed under the ISC license.
190 * See the LICENSE file in the root directory of this source tree.
191 */const e0e=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]],gK=$e("CalendarDays",e0e);/**
192 * @license lucide-react v0.474.0 - ISC
193 *
194 * This source code is licensed under the ISC license.
195 * See the LICENSE file in the root directory of this source tree.
196 */const t0e=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],Kn=$e("Calendar",t0e);/**
197 * @license lucide-react v0.474.0 - ISC
198 *
199 * This source code is licensed under the ISC license.
200 * See the LICENSE file in the root directory of this source tree.
201 */const r0e=[["path",{d:"M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z",key:"1tc9qg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]],xK=$e("Camera",r0e);/**
202 * @license lucide-react v0.474.0 - ISC
203 *
204 * This source code is licensed under the ISC license.
205 * See the LICENSE file in the root directory of this source tree.
206 */const n0e=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],sl=$e("ChartColumn",n0e);/**
207 * @license lucide-react v0.474.0 - ISC
208 *
209 * This source code is licensed under the ISC license.
210 * See the LICENSE file in the root directory of this source tree.
211 */const s0e=[["line",{x1:"12",x2:"12",y1:"20",y2:"10",key:"1vz5eb"}],["line",{x1:"18",x2:"18",y1:"20",y2:"4",key:"cun8e5"}
211],["line",{x1:"6",x2:"6",y1:"20",y2:"16",key:"hq0ia6"}]],a0e=$e("ChartNoAxesColumnIncreasing",s0e);/**
212 * @license lucide-react v0.474.0 - ISC
213 *
214 * This source code is licensed under the ISC license.
215 * See the LICENSE file in the root directory of this source tree.
216 */const i0e=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Gn=$e("Check",i0e);/**
217 * @license lucide-react v0.474.0 - ISC
218 *
219 * This source code is licensed under the ISC license.
220 * See the LICENSE file in the root directory of this source tree.
221 */const o0e=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Un=$e("ChevronDown",o0e);/**
222 * @license lucide-react v0.474.0 - ISC
223 *
224 * This source code is licensed under the ISC license.
225 * See the LICENSE file in the root directory of this source tree.
226 */const l0e=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Nu=$e("ChevronLeft",l0e);/**
227 * @license lucide-react v0.474.0 - ISC
228 *
229 * This source code is licensed under the ISC license.
230 * See the LICENSE file in the root directory of this source tree.
231 */const c0e=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],_s=$e("ChevronRight",c0e);/**
232 * @license lucide-react v0.474.0 - ISC
233 *
234 * This source code is licensed under the ISC license.
235 * See the LICENSE file in the root directory of this source tree.
236 */const d0e=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Fu=$e("ChevronUp",d0e);/**
237 * @license lucide-react v0.474.0 - ISC
238 *
239 * This source code is licensed under the ISC license.
240 * See the LICENSE file in the root directory of this source tree.
241 */const u0e=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],nr=$e("CircleAlert",u0e);/**
242 * @license lucide-react v0.474.0 - ISC
243 *
244 * This source code is licensed under the ISC license.
245 * See the LICENSE file in the root directory of this source tree.
246 */const h0e=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],qt=$e("CircleCheckBig",h0e);/**
247 * @license lucide-react v0.474.0 - ISC
248 *
249 * This source code is licensed under the ISC license.
250 * See the LICENSE file in the root directory of this source tree.
251 */const f0e=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],di=$e("CircleCheck",f0e);/**
252 * @license lucide-react v0.474.0 - ISC
253 *
254 * This source code is licensed under the ISC license.
255 * See the LICENSE file in the root directory of this source tree.
256 */const m0e=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Xm=$e("CircleHelp",m0e);/**
257 * @license lucide-react v0.474.0 - ISC
258 *
259 * This source code is licensed under the ISC license.
260 * See the LICENSE file in the root directory of this source tree.
261 */const p0e=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]],La=$e("CirclePlus",p0e);/**
262 * @license lucide-react v0.474.0 - ISC
263 *
264 * This source code is licensed under the ISC license.
265 * See the LICENSE file in the root directory of this source tree.
266 */const A0e=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],Rl=$e("CircleX",A0e);/**
267 * @license lucide-react v0.474.0 - ISC
268 *
269 * This source code is licensed under the ISC license.
270 * See the LICENSE file in the root directory of this source tree.
271 */const g0e=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],vK=$e("Circle",g0e);/**
272 * @license lucide-react v0.474.0 - ISC
273 *
274 * This source code is licensed under the ISC license.
275 * See the LICENSE file in the root directory of this source tree.
276 */const x0e=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2",key:"4jdomd"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4",key:"3hqy98"}],["path",{d:"M21 14H11",key:"1bme5i"}],["path",{d:"m15 10-4 4 4 4",key:"5dvupr"}]],v0e=$e("ClipboardCopy",x0e);/**
277 * @license lucide-react v0.474.0 - ISC
278 *
279 * This source code is licensed under the ISC license.
280 * See the LICENSE file in the root directory of this source tree.
281 */const b0e=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]],y0e=$e("Clipboard",b0e);/**
282 * @license lucide-react v0.474.0 - ISC
283 *
284 * This source code is licensed under the ISC license.
285 * See the LICENSE file in the root directory of this source tree.
286 */const w0e=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]],Vr=$e("Clock",w0e);/**
287 * @license lucide-react v0.474.0 - ISC
288 *
289 * This source code is licensed under the ISC license.
290 * See the LICENSE file in the root directory of this source tree.
291 */const j0e=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],RR=$e("Cloud",j0e);/**
292 * @license lucide-react v0.474.0 - ISC
293 *
294 * This source code is licensed under the ISC license.
295 * See the LICENSE file in the root directory of this source tree.
296 */const N0e=[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]],ng=$e("Code",N0e);/**
297 * @license lucide-react v0.474.0 - ISC
298 *
299 * This source code is licensed under the ISC license.
300 * See the LICENSE file in the root directory of this source tree.
301 */const _0e=[["path",{d:"M12 20a8 8 0 1 0 0-16 8 8 0 0 0 0 16Z",key:"sobvz5"}],["path",{d:"M12 14a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z",key:"11i496"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 22v-2",key:"1osdcq"}],["path",{d:"m17 20.66-1-1.73",key:"eq3orb"}],["path",{d:"M11 10.27 7 3.34",key:"16pf9h"}],["path",{d:"m20.66 17-1.73-1",key:"sg0v6f"}],["path",{d:"m3.34 7 1.73 1",key:"1ulond"}],["path",{d:"M14 12h8",key:"4f43i9"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"m20.66 7-1.73 1",key:"1ow05n"}],["path",{d:"m3.34 17 1.73-1",key:"nuk764"}],["path",{d:"m17 3.34-1 1.73",key:"2wel8s"}],["path",{d:"m11 13.73-4 6.93",key:"794ttg"}]],bK=$e("Cog",_0e);/**
302 * @license lucide-react v0.474.0 - ISC
303 *
304 * This source code is licensed under the ISC license.
305 * See the LICENSE file in the root directory of this source tree.
306 */const C0e=[["circle",{cx:"8",cy:"8",r:"6",key:"3yglwk"}],["path",{d:"M18.09 10.37A6 6 0 1 1 10.34 18",key:"t5s6rm"}],["path",{d:"M7 6h1v4",key:"1obek4"}],["path",{d:"m16.71 13.88.7.71-2.82 2.82",key:"1rbuyh"}]],S0e=$e("Coins",C0e);/**
307 * @license lucide-react v0.474.0 - ISC
308 *
309 * This source code is licensed under the ISC license.
310 * See the LICENSE file in the root directory of this source tree.
311 */const k0e=[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],UR=$e("Compass",k0e);/**
312 * @license lucide-react v0.474.0 - ISC
313 *
314 * This source code is licensed under the ISC license.
315 * See the LICENSE file in the root directory of this source tree.
316 */const E0e=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Cn=$e("Copy",E0e);/**
317 * @license lucide-react v0.474.0 - ISC
318 *
319 * This source code is licensed under the ISC license.
320 * See the LICENSE file in the root directory of this source tree.
321 */const B0e=[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}
321],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]],T0e=$e("Cpu",B0e);/**
322 * @license lucide-react v0.474.0 - ISC
323 *
324 * This source code is licensed under the ISC license.
325 * See the LICENSE file in the root directory of this source tree.
326 */const P0e=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],sg=$e("CreditCard",P0e);/**
327 * @license lucide-react v0.474.0 - ISC
328 *
329 * This source code is licensed under the ISC license.
330 * See the LICENSE file in the root directory of this source tree.
331 */const I0e=[["path",{d:"M6 2v14a2 2 0 0 0 2 2h14",key:"ron5a4"}],["path",{d:"M18 22V8a2 2 0 0 0-2-2H2",key:"7s9ehn"}]],MR=$e("Crop",I0e);/**
332 * @license lucide-react v0.474.0 - ISC
333 *
334 * This source code is licensed under the ISC license.
335 * See the LICENSE file in the root directory of this source tree.
336 */const O0e=[["path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",key:"1vdc57"}],["path",{d:"M5 21h14",key:"11awu3"}]],yK=$e("Crown",O0e);/**
337 * @license lucide-react v0.474.0 - ISC
338 *
339 * This source code is licensed under the ISC license.
340 * See the LICENSE file in the root directory of this source tree.
341 */const F0e=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],pd=$e("Database",F0e);/**
342 * @license lucide-react v0.474.0 - ISC
343 *
344 * This source code is licensed under the ISC license.
345 * See the LICENSE file in the root directory of this source tree.
346 */const L0e=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],q_=$e("DollarSign",L0e);/**
347 * @license lucide-react v0.474.0 - ISC
348 *
349 * This source code is licensed under the ISC license.
350 * See the LICENSE file in the root directory of this source tree.
351 */const D0e=[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]],Ad=$e("Download",D0e);/**
352 * @license lucide-react v0.474.0 - ISC
353 *
354 * This source code is licensed under the ISC license.
355 * See the LICENSE file in the root directory of this source tree.
356 */const R0e=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]],U0e=$e("EllipsisVertical",R0e);/**
357 * @license lucide-react v0.474.0 - ISC
358 *
359 * This source code is licensed under the ISC license.
360 * See the LICENSE file in the root directory of this source tree.
361 */const M0e=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],$0e=$e("Ellipsis",M0e);/**
362 * @license lucide-react v0.474.0 - ISC
363 *
364 * This source code is licensed under the ISC license.
365 * See the LICENSE file in the root directory of this source tree.
366 */const Q0e=[["path",{d:"m15 15 6 6",key:"1s409w"}],["path",{d:"m15 9 6-6",key:"ko1vev"}],["path",{d:"M21 16.2V21h-4.8",key:"1hrera"}],["path",{d:"M21 7.8V3h-4.8",key:"ul1q53"}],["path",{d:"M3 16.2V21h4.8",key:"1x04uo"}],["path",{d:"m3 21 6-6",key:"wwnumi"}],["path",{d:"M3 7.8V3h4.8",key:"1ijppm"}],["path",{d:"M9 9 3 3",key:"v551iv"}]],Yw=$e("Expand",Q0e);/**
367 * @license lucide-react v0.474.0 - ISC
368 *
369 * This source code is licensed under the ISC license.
370 * See the LICENSE file in the root directory of this source tree.
371 */const H0e=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],Vs=$e("ExternalLink",H0e);/**
372 * @license lucide-react v0.474.0 - ISC
373 *
374 * This source code is licensed under the ISC license.
375 * See the LICENSE file in the root directory of this source tree.
376 */const z0e=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],nb=$e("EyeOff",z0e);/**
377 * @license lucide-react v0.474.0 - ISC
378 *
379 * This source code is licensed under the ISC license.
380 * See the LICENSE file in the root directory of this source tree.
381 */const V0e=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],gd=$e("Eye",V0e);/**
382 * @license lucide-react v0.474.0 - ISC
383 *
384 * This source code is licensed under the ISC license.
385 * See the LICENSE file in the root directory of this source tree.
386 */const G0e=[["path",{d:"M18 2h-3a5 5 0 0 0-5 5v3H7v4h3v8h4v-8h3l1-4h-4V7a1 1 0 0 1 1-1h3z",key:"1jg4f8"}]],_u=$e("Facebook",G0e);/**
387 * @license lucide-react v0.474.0 - ISC
388 *
389 * This source code is licensed under the ISC license.
390 * See the LICENSE file in the root directory of this source tree.
391 */const q0e=[["path",{d:"M10 12v-1",key:"v7bkov"}],["path",{d:"M10 18v-2",key:"1cjy8d"}],["path",{d:"M10 7V6",key:"dljcrl"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v16a2 2 0 0 0 .274 1.01",key:"gkbcor"}],["circle",{cx:"10",cy:"20",r:"2",key:"1xzdoj"}]],K0e=$e("FileArchive",q0e);/**
392 * @license lucide-react v0.474.0 - ISC
393 *
394 * This source code is licensed under the ISC license.
395 * See the LICENSE file in the root directory of this source tree.
396 */const W0e=[["path",{d:"M12.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v9.5",key:"1couwa"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M13.378 15.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1y4qbx"}]],Y0e=$e("FilePen",W0e);/**
397 * @license lucide-react v0.474.0 - ISC
398 *
399 * This source code is licensed under the ISC license.
400 * See the LICENSE file in the root directory of this source tree.
401 */const J0e=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Xr=$e("FileText",J0e);/**
402 * @license lucide-react v0.474.0 - ISC
403 *
404 * This source code is licensed under the ISC license.
405 * See the LICENSE file in the root directory of this source tree.
406 */const X0e=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]],bB=$e("File",X0e);/**
407 * @license lucide-react v0.474.0 - ISC
408 *
409 * This source code is licensed under the ISC license.
410 * See the LICENSE file in the root directory of this source tree.
411 */const Z0e=[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]],IA=$e("Filter",Z0e);/**
412 * @license lucide-react v0.474.0 - ISC
413 *
414 * This source code is licensed under the ISC license.
415 * See the LICENSE file in the root directory of this source tree.
416 */const exe=[["path",{d:"M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4",key:"1nerag"}],["path",{d:"M14 13.12c0 2.38 0 6.38-1 8.88",key:"o46ks0"}],["path",{d:"M17.29 21.02c.12-.6.43-2.3.5-3.02",key:"ptglia"}],["path",{d:"M2 12a10 10 0 0 1 18-6",key:"ydlgp0"}],["path",{d:"M2 16h.01",key:"1gqxmh"}],["path",{d:"M21.8 16c.2-2 .131-5.354 0-6",key:"drycrb"}
416],["path",{d:"M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2",key:"1tidbn"}],["path",{d:"M8.65 22c.21-.66.45-1.32.57-2",key:"13wd9y"}],["path",{d:"M9 6.8a6 6 0 0 1 9 5.2v2",key:"1fr1j5"}]],txe=$e("Fingerprint",exe);/**
417 * @license lucide-react v0.474.0 - ISC
418 *
419 * This source code is licensed under the ISC license.
420 * See the LICENSE file in the root directory of this source tree.
421 */const rxe=[["path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z",key:"96xj49"}]],wK=$e("Flame",rxe);/**
422 * @license lucide-react v0.474.0 - ISC
423 *
424 * This source code is licensed under the ISC license.
425 * See the LICENSE file in the root directory of this source tree.
426 */const nxe=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],sxe=$e("Folder",nxe);/**
427 * @license lucide-react v0.474.0 - ISC
428 *
429 * This source code is licensed under the ISC license.
430 * See the LICENSE file in the root directory of this source tree.
431 */const axe=[["rect",{x:"3",y:"8",width:"18",height:"4",rx:"1",key:"bkv52"}],["path",{d:"M12 8v13",key:"1c76mn"}],["path",{d:"M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7",key:"6wjy6b"}],["path",{d:"M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5",key:"1ihvrl"}]],ixe=$e("Gift",axe);/**
432 * @license lucide-react v0.474.0 - ISC
433 *
434 * This source code is licensed under the ISC license.
435 * See the LICENSE file in the root directory of this source tree.
436 */const oxe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],Is=$e("Globe",oxe);/**
437 * @license lucide-react v0.474.0 - ISC
438 *
439 * This source code is licensed under the ISC license.
440 * See the LICENSE file in the root directory of this source tree.
441 */const lxe=[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]],cxe=$e("GraduationCap",lxe);/**
442 * @license lucide-react v0.474.0 - ISC
443 *
444 * This source code is licensed under the ISC license.
445 * See the LICENSE file in the root directory of this source tree.
446 */const dxe=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]],_I=$e("Grid3x3",dxe);/**
447 * @license lucide-react v0.474.0 - ISC
448 *
449 * This source code is licensed under the ISC license.
450 * See the LICENSE file in the root directory of this source tree.
451 */const uxe=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],jK=$e("GripVertical",uxe);/**
452 * @license lucide-react v0.474.0 - ISC
453 *
454 * This source code is licensed under the ISC license.
455 * See the LICENSE file in the root directory of this source tree.
456 */const hxe=[["path",{d:"M3 14h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-7a9 9 0 0 1 18 0v7a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3",key:"1xhozi"}]],fxe=$e("Headphones",hxe);/**
457 * @license lucide-react v0.474.0 - ISC
458 *
459 * This source code is licensed under the ISC license.
460 * See the LICENSE file in the root directory of this source tree.
461 */const mxe=[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}]],pxe=$e("Heart",mxe);/**
462 * @license lucide-react v0.474.0 - ISC
463 *
464 * This source code is licensed under the ISC license.
465 * See the LICENSE file in the root directory of this source tree.
466 */const Axe=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],ag=$e("History",Axe);/**
467 * @license lucide-react v0.474.0 - ISC
468 *
469 * This source code is licensed under the ISC license.
470 * See the LICENSE file in the root directory of this source tree.
471 */const gxe=[["path",{d:"M5 22h14",key:"ehvnwv"}],["path",{d:"M5 2h14",key:"pdyrp9"}],["path",{d:"M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22",key:"1d314k"}],["path",{d:"M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2",key:"1vvvr6"}]],xxe=$e("Hourglass",gxe);/**
472 * @license lucide-react v0.474.0 - ISC
473 *
474 * This source code is licensed under the ISC license.
475 * See the LICENSE file in the root directory of this source tree.
476 */const vxe=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]],$R=$e("House",vxe);/**
477 * @license lucide-react v0.474.0 - ISC
478 *
479 * This source code is licensed under the ISC license.
480 * See the LICENSE file in the root directory of this source tree.
481 */const bxe=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],Ra=$e("Image",bxe);/**
482 * @license lucide-react v0.474.0 - ISC
483 *
484 * This source code is licensed under the ISC license.
485 * See the LICENSE file in the root directory of this source tree.
486 */const yxe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],qi=$e("Info",yxe);/**
487 * @license lucide-react v0.474.0 - ISC
488 *
489 * This source code is licensed under the ISC license.
490 * See the LICENSE file in the root directory of this source tree.
491 */const wxe=[["rect",{width:"20",height:"20",x:"2",y:"2",rx:"5",ry:"5",key:"2e1cvw"}],["path",{d:"M16 11.37A4 4 0 1 1 12.63 8 4 4 0 0 1 16 11.37z",key:"9exkf1"}],["line",{x1:"17.5",x2:"17.51",y1:"6.5",y2:"6.5",key:"r4j83e"}]],Vh=$e("Instagram",wxe);/**
492 * @license lucide-react v0.474.0 - ISC
493 *
494 * This source code is licensed under the ISC license.
495 * See the LICENSE file in the root directory of this source tree.
496 */const jxe=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],Nxe=$e("Layers",jxe);/**
497 * @license lucide-react v0.474.0 - ISC
498 *
499 * This source code is licensed under the ISC license.
500 * See the LICENSE file in the root directory of this source tree.
501 */const _xe=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],K_=$e("LayoutGrid",_xe);/**
502 * @license lucide-react v0.474.0 - ISC
503 *
504 * This source code is licensed under the ISC license.
505 * See the LICENSE file in the root directory of this source tree.
506 */const Cxe=[["path",{d:"m16 6 4 14",key:"ji33uf"}],["path",{d:"M12 6v14",key:"1n7gus"}],["path",{d:"M8 8v12",key:"1gg7y9"}],["path",{d:"M4 4v16",key:"6qkkli"}]],Sxe=$e("Library",Cxe);/**
507 * @license lucide-react v0.474.0 - ISC
508 *
509 * This source code is licensed under the ISC license.
510 * See the LICENSE file in the root directory of this source tree.
511 */const kxe=[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]],ig=$e("Lightbulb",kxe);/**
512 * @license lucide-react v0.474.0 - ISC
513 *
514 * This source code is licensed under the ISC license.
515 * See the LICENSE file in the root directory of this source tree.
516 */const Exe=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],QR=$e("Link2",Exe);/**
517 * @license lucide-react v0.474.0 - ISC
518 *
519 * This source code is licensed under the ISC license.
520 * See the LICENSE file in the root directory of this source tree.
521 */const Bxe=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],Im=$e("Link",Bxe);/**
522 * @license lucide-react v0.474.0 - ISC
523 *
524 * This source code is licensed under the ISC license.
525 * See the LICENSE file in the root directory of this source tree.
526 */const Txe=[["path",{d:"M16 8a6 6 0 0 1 6 6v7h-4v-7a2 2 0 0 0-2-2 2 2 0 0 0-2 2v7h-4v-7a6 6 0 0 1 6-6z",key:"c2jq9f"}],["rect",{width:"4",height:"12",x:"2",y:"9",key:"mk3on5"}],["circle",{cx:"4",cy:"4",r:"2",key:"bt5ra8"}]],ky=$e("Linkedin",Txe);/**
527 * @license lucide-react v0.474.0 - ISC
528 *
529 * This source code is licensed under the ISC license.
530 * See the LICENSE file in the root directory of this source tree.
531 */const Pxe=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],kt=$e("LoaderCircle",Pxe);/**
532 * @license lucide-react v0.474.0 - ISC
533 *
534 * This source code is licensed under the ISC license.
535 * See the LICENSE file in the root directory of this source tree.
536 */const Ixe=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],m2=$e("Lock",Ixe);/**
537 * @license lucide-react v0.474.0 - ISC
538 *
539 * This source code is licensed under the ISC license.
540 * See the LICENSE file in the root directory of this source tree.
541 */const Oxe=[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]],NK=$e("LogOut",Oxe);/**
542 * @license lucide-react v0.474.0 - ISC
543 *
544 * This source code is licensed under the ISC license.
545 * See the LICENSE file in the root directory of this source tree.
546 */const Fxe=[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]],Cu=$e("Mail",Fxe);/**
547 * @license lucide-react v0.474.0 - ISC
548 *
549 * This source code is licensed under the ISC license.
550 * See the LICENSE file in the root directory of this source tree.
551 */const Lxe=[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]],sb=$e("MapPin",Lxe);/**
552 * @license lucide-react v0.474.0 - ISC
553 *
554 * This source code is licensed under the ISC license.
555 * See the LICENSE file in the root directory of this source tree.
556 */const Dxe=[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]],Rxe=$e("Map",Dxe);/**
557 * @license lucide-react v0.474.0 - ISC
558 *
559 * This source code is licensed under the ISC license.
560 * See the LICENSE file in the root directory of this source tree.
561 */const Uxe=[["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["polyline",{points:"9 21 3 21 3 15",key:"1avn1i"}],["line",{x1:"21",x2:"14",y1:"3",y2:"10",key:"ota7mn"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]],Mxe=$e("Maximize2",Uxe);/**
562 * @license lucide-react v0.474.0 - ISC
563 *
564 * This source code is licensed under the ISC license.
565 * See the LICENSE file in the root directory of this source tree.
566 */const $xe=[["path",{d:"m3 11 18-5v12L3 14v-3z",key:"n962bs"}],["path",{d:"M11.6 16.8a3 3 0 1 1-5.8-1.6",key:"1yl0tm"}]],Qxe=$e("Megaphone",$xe);/**
567 * @license lucide-react v0.474.0 - ISC
568 *
569 * This source code is licensed under the ISC license.
570 * See the LICENSE file in the root directory of this source tree.
571 */const Hxe=[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]],_K=$e("Menu",Hxe);/**
572 * @license lucide-react v0.474.0 - ISC
573 *
574 * This source code is licensed under the ISC license.
575 * See the LICENSE file in the root directory of this source tree.
576 */const zxe=[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]],HR=$e("MessageCircle",zxe);/**
577 * @license lucide-react v0.474.0 - ISC
578 *
579 * This source code is licensed under the ISC license.
580 * See the LICENSE file in the root directory of this source tree.
581 */const Vxe=[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]],Cc=$e("MessageSquare",Vxe);/**
582 * @license lucide-react v0.474.0 - ISC
583 *
584 * This source code is licensed under the ISC license.
585 * See the LICENSE file in the root directory of this source tree.
586 */const Gxe=[["path",{d:"M5 12h14",key:"1ays0h"}]],yB=$e("Minus",Gxe);/**
587 * @license lucide-react v0.474.0 - ISC
588 *
589 * This source code is licensed under the ISC license.
590 * See the LICENSE file in the root directory of this source tree.
591 */const qxe=[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]],zR=$e("Moon",qxe);/**
592 * @license lucide-react v0.474.0 - ISC
593 *
594 * This source code is licensed under the ISC license.
595 * See the LICENSE file in the root directory of this source tree.
596 */const Kxe=[["path",{d:"M8 18L12 22L16 18",key:"cskvfv"}],["path",{d:"M12 2V22",key:"r89rzk"}]],Jw=$e("MoveDown",Kxe);/**
597 * @license lucide-react v0.474.0 - ISC
598 *
599 * This source code is licensed under the ISC license.
600 * See the LICENSE file in the root directory of this source tree.
601 */const Wxe=[["path",{d:"M8 6L12 2L16 6",key:"1yvkyx"}],["path",{d:"M12 2V22",key:"r89rzk"}]],Xw=$e("MoveUp",Wxe);/**
602 * @license lucide-react v0.474.0 - ISC
603 *
604 * This source code is licensed under the ISC license.
605 * See the LICENSE file in the root directory of this source tree.
606 */const Yxe=[["path",{d:"M4 22h16a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v16a2 2 0 0 1-2 2Zm0 0a2 2 0 0 1-2-2v-9c0-1.1.9-2 2-2h2",key:"7pis2x"}],["path",{d:"M18 14h-8",key:"sponae"}],["path",{d:"M15 18h-5",key:"95g1m2"}],["path",{d:"M10 6h8v4h-8V6Z",key:"smlsk5"}]],CK=$e("Newspaper",Yxe);/**
607 * @license lucide-react v0.474.0 - ISC
608 *
609 * This source code is licensed under the ISC license.
610 * See the LICENSE file in the root directory of this source tree.
611 */const Jxe=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],CI=$e("Package",Jxe);/**
612 * @license lucide-react v0.474.0 - ISC
613 *
614 * This source code is licensed under the ISC license.
615 * See the LICENSE file in the root directory of this source tree.
616 */const Xxe=[["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]],W_=$e("Palette",Xxe);/**
617 * @license lucide-react v0.474.0 - ISC
618 *
619 * This source code is licensed under the ISC license.
620 * See the LICENSE file in the root directory of this source tree.
621 */const Zxe=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],eve=$e("PanelLeft",Zxe);/**
622 * @license lucide-react v0.474.0 - ISC
623 *
624 * This source code is licensed under the ISC license.
625 * See the LICENSE file in the root directory of this source tree.
626 */const tve=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M9 21V9",key:"1oto5p"}]],p2=$e("PanelsTopLeft",tve);/**
627 * @license lucide-react v0.474.0 - ISC
628 *
629 * This source code is licensed under the ISC license.
630 * See the LICENSE file in the root directory of this source tree.
631 */const rve=[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]],A2=$e("Pause",rve);/**
632 * @license lucide-react v0.474.0 - ISC
633 *
634 * This source code is licensed under the ISC license.
635 * See the LICENSE file in the root directory of this source tree.
636 */const nve=[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]],_j=$e("PenLine",nve);/**
637 * @license lucide-react v0.474.0 - ISC
638 *
639 * This source code is licensed under the ISC license.
640 * See the LICENSE file in the root directory of this source tree.
641 */const sve=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],ave=$e("Pen",sve);/**
642 * @license lucide-react v0.474.0 - ISC
643 *
644 * This source code is licensed under the ISC license.
645 * See the LICENSE file in the root directory of this source tree.
646 */const ive=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],cm=$e("Pencil",ive);/**
647 * @license lucide-react v0.474.0 - ISC
648 *
649 * This source code is licensed under the ISC license.
650 * See the LICENSE file in the root directory of this source tree.
651 */const ove=[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]],ho=$e("Play",ove);/**
652 * @license lucide-react v0.474.0 - ISC
653 *
654 * This source code is licensed under the ISC license.
655 * See the LICENSE file in the root directory of this source tree.
656 */const lve=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],al=$e("Plus",lve);
656/**
657 * @license lucide-react v0.474.0 - ISC
658 *
659 * This source code is licensed under the ISC license.
660 * See the LICENSE file in the root directory of this source tree.
661 */const cve=[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]],VR=$e("Quote",cve);/**
662 * @license lucide-react v0.474.0 - ISC
663 *
664 * This source code is licensed under the ISC license.
665 * See the LICENSE file in the root directory of this source tree.
666 */const dve=[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]],g2=$e("RefreshCcw",dve);/**
667 * @license lucide-react v0.474.0 - ISC
668 *
669 * This source code is licensed under the ISC license.
670 * See the LICENSE file in the root directory of this source tree.
671 */const uve=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Es=$e("RefreshCw",uve);/**
672 * @license lucide-react v0.474.0 - ISC
673 *
674 * This source code is licensed under the ISC license.
675 * See the LICENSE file in the root directory of this source tree.
676 */const hve=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],GR=$e("RotateCcw",hve);/**
677 * @license lucide-react v0.474.0 - ISC
678 *
679 * This source code is licensed under the ISC license.
680 * See the LICENSE file in the root directory of this source tree.
681 */const fve=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 12h18",key:"1i2n21"}]],mve=$e("Rows2",fve);/**
682 * @license lucide-react v0.474.0 - ISC
683 *
684 * This source code is licensed under the ISC license.
685 * See the LICENSE file in the root directory of this source tree.
686 */const pve=[["path",{d:"M4 11a9 9 0 0 1 9 9",key:"pv89mb"}],["path",{d:"M4 4a16 16 0 0 1 16 16",key:"k0647b"}],["circle",{cx:"5",cy:"19",r:"1",key:"bfqh0e"}]],Ey=$e("Rss",pve);/**
687 * @license lucide-react v0.474.0 - ISC
688 *
689 * This source code is licensed under the ISC license.
690 * See the LICENSE file in the root directory of this source tree.
691 */const Ave=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],ld=$e("Save",Ave);/**
692 * @license lucide-react v0.474.0 - ISC
693 *
694 * This source code is licensed under the ISC license.
695 * See the LICENSE file in the root directory of this source tree.
696 */const gve=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],Ns=$e("Search",gve);/**
697 * @license lucide-react v0.474.0 - ISC
698 *
699 * This source code is licensed under the ISC license.
700 * See the LICENSE file in the root directory of this source tree.
701 */const xve=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],Om=$e("Send",xve);/**
702 * @license lucide-react v0.474.0 - ISC
703 *
704 * This source code is licensed under the ISC license.
705 * See the LICENSE file in the root directory of this source tree.
706 */const vve=[["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"}]],fs=$e("Settings",vve);
706/**
707 * @license lucide-react v0.474.0 - ISC
708 *
709 * This source code is licensed under the ISC license.
710 * See the LICENSE file in the root directory of this source tree.
711 */const bve=[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]],og=$e("Share2",bve);/**
712 * @license lucide-react v0.474.0 - ISC
713 *
714 * This source code is licensed under the ISC license.
715 * See the LICENSE file in the root directory of this source tree.
716 */const yve=[["path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8",key:"1b2hhj"}],["polyline",{points:"16 6 12 2 8 6",key:"m901s6"}],["line",{x1:"12",x2:"12",y1:"2",y2:"15",key:"1p0rca"}]],wve=$e("Share",yve);/**
717 * @license lucide-react v0.474.0 - ISC
718 *
719 * This source code is licensed under the ISC license.
720 * See the LICENSE file in the root directory of this source tree.
721 */const jve=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],Nve=$e("ShieldAlert",jve);/**
722 * @license lucide-react v0.474.0 - ISC
723 *
724 * This source code is licensed under the ISC license.
725 * See the LICENSE file in the root directory of this source tree.
726 */const _ve=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],wB=$e("ShieldCheck",_ve);
726/**
727 * @license lucide-react v0.474.0 - ISC
728 *
729 * This source code is licensed under the ISC license.
730 * See the LICENSE file in the root directory of this source tree.
731 */const Cve=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],Gh=$e("Shield",Cve);/**
732 * @license lucide-react v0.474.0 - ISC
733 *
734 * This source code is licensed under the ISC license.
735 * See the LICENSE file in the root directory of this source tree.
736 */const Sve=[["path",{d:"M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4Z",key:"hou9p0"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M16 10a4 4 0 0 1-8 0",key:"1ltviw"}]],kve=$e("ShoppingBag",Sve);/**
737 * @license lucide-react v0.474.0 - ISC
738 *
739 * This source code is licensed under the ISC license.
740 * See the LICENSE file in the root directory of this source tree.
741 */const Eve=[["circle",{cx:"8",cy:"21",r:"1",key:"jimo8o"}],["circle",{cx:"19",cy:"21",r:"1",key:"13723u"}],["path",{d:"M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12",key:"9zh506"}]],Bve=$e("ShoppingCart",Eve);/**
742 * @license lucide-react v0.474.0 - ISC
743 *
744 * This source code is licensed under the ISC license.
745 * See the LICENSE file in the root directory of this source tree.
746 */const Tve=[["line",{x1:"21",x2:"14",y1:"4",y2:"4",key:"obuewd"}],["line",{x1:"10",x2:"3",y1:"4",y2:"4",key:"1q6298"}],["line",{x1:"21",x2:"12",y1:"12",y2:"12",key:"1iu8h1"}],["line",{x1:"8",x2:"3",y1:"12",y2:"12",key:"ntss68"}],["line",{x1:"21",x2:"16",y1:"20",y2:"20",key:"14d8ph"}],["line",{x1:"12",x2:"3",y1:"20",y2:"20",key:"m0wm8r"}],["line",{x1:"14",x2:"14",y1:"2",y2:"6",key:"14e1ph"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14",key:"1i6ji0"}],["line",{x1:"16",x2:"16",y1:"18",y2:"22",key:"1lctlv"}]],Pve=$e("SlidersHorizontal",Tve);/**
747 * @license lucide-react v0.474.0 - ISC
748 *
749 * This source code is licensed under the ISC license.
750 * See the LICENSE file in the root directory of this source tree.
751 */const Ive=[["line",{x1:"4",x2:"4",y1:"21",y2:"14",key:"1p332r"}],["line",{x1:"4",x2:"4",y1:"10",y2:"3",key:"gb41h5"}],["line",{x1:"12",x2:"12",y1:"21",y2:"12",key:"hf2csr"}],["line",{x1:"12",x2:"12",y1:"8",y2:"3",key:"1kfi7u"}],["line",{x1:"20",x2:"20",y1:"21",y2:"16",key:"1lhrwl"}],["line",{x1:"20",x2:"20",y1:"12",y2:"3",key:"16vvfq"}],["line",{x1:"2",x2:"6",y1:"14",y2:"14",key:"1uebub"}],["line",{x1:"10",x2:"14",y1:"8",y2:"8",key:"1yglbp"}],["line",{x1:"18",x2:"22",y1:"16",y2:"16",key:"1jxqpz"}]],x2=$e("SlidersVertical",Ive);/**
752 * @license lucide-react v0.474.0 - ISC
753 *
754 * This source code is licensed under the ISC license.
755 * See the LICENSE file in the root directory of this source tree.
756 */const Ove=[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]],mr=$e("Sparkles",Ove);/**
757 * @license lucide-react v0.474.0 - ISC
758 *
759 * This source code is licensed under the ISC license.
760 * See the LICENSE file in the root directory of this source tree.
761 */const Fve=[["path",{d:"M21 10.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.5",key:"1uzm8b"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],SK=$e("SquareCheckBig",Fve);/**
762 * @license lucide-react v0.474.0 - ISC
763 *
764 * This source code is licensed under the ISC license.
765 * See the LICENSE file in the root directory of this source tree.
766 */const Lve=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],ab=$e("SquarePen",Lve);/**
767 * @license lucide-react v0.474.0 - ISC
768 *
769 * This source code is licensed under the ISC license.
770 * See the LICENSE file in the root directory of this source tree.
771 */const Dve=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],Rve=$e("Square",Dve);/**
772 * @license lucide-react v0.474.0 - ISC
773 *
774 * This source code is licensed under the ISC license.
775 * See the LICENSE file in the root directory of this source tree.
776 */const Uve=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],Fm=$e("Star",Uve);/**
777 * @license lucide-react v0.474.0 - ISC
778 *
779 * This source code is licensed under the ISC license.
780 * See the LICENSE file in the root directory of this source tree.
781 */const Mve=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],qR=$e("Sun",Mve);/**
782 * @license lucide-react v0.474.0 - ISC
783 *
784 * This source code is licensed under the ISC license.
785 * See the LICENSE file in the root directory of this source tree.
786 */const $ve=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],jB=$e("Tag",$ve);/**
787 * @license lucide-react v0.474.0 - ISC
788 *
789 * This source code is licensed under the ISC license.
790 * See the LICENSE file in the root directory of this source tree.
791 */const Qve=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],ui=$e("Target",Qve);/**
792 * @license lucide-react v0.474.0 - ISC
793 *
794 * This source code is licensed under the ISC license.
795 * See the LICENSE file in the root directory of this source tree.
796 */const Hve=[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]],zve=$e("Terminal",Hve);/**
797 * @license lucide-react v0.474.0 - ISC
798 *
799 * This source code is licensed under the ISC license.
800 * See the LICENSE file in the root directory of this source tree.
801 */const Vve=[["path",{d:"M14.5 2v17.5c0 1.4-1.1 2.5-2.5 2.5c-1.4 0-2.5-1.1-2.5-2.5V2",key:"125lnx"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M14.5 16h-5",key:"1ox875"}]],v2=$e("TestTube",Vve);/**
802 * @license lucide-react v0.474.0 - ISC
803 *
804 * This source code is licensed under the ISC license.
805 * See the LICENSE file in the root directory of this source tree.
806 */const Gve=[["path",{d:"M7 10v12",key:"1qc93n"}],["path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z",key:"emmmcr"}]],KR=$e("ThumbsUp",Gve);/**
807 * @license lucide-react v0.474.0 - ISC
808 *
809 * This source code is licensed under the ISC license.
810 * See the LICENSE file in the root directory of this source tree.
811 */const qve=[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]],Kve=$e("Timer",qve);/**
812 * @license lucide-react v0.474.0 - ISC
813 *
814 * This source code is licensed under the ISC license.
815 * See the LICENSE file in the root directory of this source tree.
816 */const Wve=[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]],va=$e("Trash2",Wve);/**
817 * @license lucide-react v0.474.0 - ISC
818 *
819 * This source code is licensed under the ISC license.
820 * See the LICENSE file in the root directory of this source tree.
821 */const Yve=[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]],sa=$e("TrendingUp",Yve);/**
822 * @license lucide-react v0.474.0 - ISC
823 *
824 * This source code is licensed under the ISC license.
825 * See the LICENSE file in the root directory of this source tree.
826 */const Jve=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],hn=$e("TriangleAlert",Jve);/**
827 * @license lucide-react v0.474.0 - ISC
828 *
829 * This source code is licensed under the ISC license.
830 * See the LICENSE file in the root directory of this source tree.
831 */const Xve=[["path",{d:"M22 4s-.7 2.1-2 3.4c1.6 10-9.4 17.3-18 11.6 2.2.1 4.4-.6 6-2C3 15.5.5 9.6 3 5c2.2 2.6 5.6 4.1 9 4-.9-4.2 4-6.6 7-3.8 1.1 0 3-1.2 3-1.2z",key:"pff0z6"}]],Zve=$e("Twitter",Xve);/**
832 * @license lucide-react v0.474.0 - ISC
833 *
834 * This source code is licensed under the ISC license.
835 * See the LICENSE file in the root directory of this source tree.
836 */const ebe=[["polyline",{points:"4 7 4 4 20 4 20 7",key:"1nosan"}],["line",{x1:"9",x2:"15",y1:"20",y2:"20",key:"swin9y"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]],tbe=$e("Type",ebe);/**
837 * @license lucide-react v0.474.0 - ISC
838 *
839 * This source code is licensed under the ISC license.
840 * See the LICENSE file in the root directory of this source tree.
841 */const rbe=[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]],Y_=$e("Upload",rbe);/**
842 * @license lucide-react v0.474.0 - ISC
843 *
844 * This source code is licensed under the ISC license.
845 * See the LICENSE file in the root directory of this source tree.
846 */const nbe=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],sbe=$e("UserPlus",nbe);/**
847 * @license lucide-react v0.474.0 - ISC
848 *
849 * This source code is licensed under the ISC license.
850 * See the LICENSE file in the root directory of this source tree.
851 */const abe=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}
851],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],ibe=$e("UserRound",abe);/**
852 * @license lucide-react v0.474.0 - ISC
853 *
854 * This source code is licensed under the ISC license.
855 * See the LICENSE file in the root directory of this source tree.
856 */const obe=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],li=$e("User",obe);/**
857 * @license lucide-react v0.474.0 - ISC
858 *
859 * This source code is licensed under the ISC license.
860 * See the LICENSE file in the root directory of this source tree.
861 */const lbe=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]],Ka=$e("Users",lbe);/**
862 * @license lucide-react v0.474.0 - ISC
863 *
864 * This source code is licensed under the ISC license.
865 * See the LICENSE file in the root directory of this source tree.
866 */const cbe=[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]],fi=$e("Video",cbe);/**
867 * @license lucide-react v0.474.0 - ISC
868 *
869 * This source code is licensed under the ISC license.
870 * See the LICENSE file in the root directory of this source tree.
871 */const dbe=[["path",{d:"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2",key:"q3hayz"}],["path",{d:"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06",key:"1go1hn"}],["path",{d:"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8",key:"qlwsc0"}]],J_=$e("Webhook",dbe);/**
872 * @license lucide-react v0.474.0 - ISC
873 *
874 * This source code is licensed under the ISC license.
875 * See the LICENSE file in the root directory of this source tree.
876 */const ube=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]],NB=$e("Workflow",ube);/**
877 * @license lucide-react v0.474.0 - ISC
878 *
879 * This source code is licensed under the ISC license.
880 * See the LICENSE file in the root directory of this source tree.
881 */const hbe=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]],SI=$e("Wrench",hbe);/**
882 * @license lucide-react v0.474.0 - ISC
883 *
884 * This source code is licensed under the ISC license.
885 * See the LICENSE file in the root directory of this source tree.
886 */const fbe=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],kr=$e("X",fbe);/**
887 * @license lucide-react v0.474.0 - ISC
888 *
889 * This source code is licensed under the ISC license.
890 * See the LICENSE file in the root directory of this source tree.
891 */const mbe=[["path",{d:"M2.5 17a24.12 24.12 0 0 1 0-10 2 2 0 0 1 1.4-1.4 49.56 49.56 0 0 1 16.2 0A2 2 0 0 1 21.5 7a24.12 24.12 0 0 1 0 10 2 2 0 0 1-1.4 1.4 49.55 49.55 0 0 1-16.2 0A2 2 0 0 1 2.5 17",key:"1q2vi4"}],["path",{d:"m10 15 5-3-5-3z",key:"1jp15x"}]],kI=$e("Youtube",mbe);/**
892 * @license lucide-react v0.474.0 - ISC
893 *
894 * This source code is licensed under the ISC license.
895 * See the LICENSE file in the root directory of this source tree.
896 */const pbe=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],en=$e("Zap",pbe);function Abe({detectedTimezone:e,onChangeTimezone:t,onDismiss:r,className:s=""}){const[a,i]=g.useState(!0),o=()=>{i(!1),setTimeout(r,300)},l=Zv(e),c=TA(new Date,e);return a?n.jsx(Te,{className:`max-w-md mx-auto shadow-lg border-primary/20 animate-in slide-in-from-top-2 duration-300 ${s}`,children:n.jsx(Re,{className:"p-4",children:n.jsxs("div",{className:"flex items-start justify-between gap-3",children:[n.jsxs("div",{className:"flex items-start gap-3 flex-1",children:[n.jsx("div",{className:"flex-shrink-0 mt-0.5",children:n.jsx("div",{className:"w-8 h-8 rounded-full bg-primary/10 flex items-center justify-center",children:n.jsx(sb,{className:"w-4 h-4 text-primary"})})}),n.jsxs("div",{className:"flex-1 space-y-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("h4",{className:"text-sm font-medium text-foreground",children:"Timezone Auto-Detected"}),n.jsxs(Be,{variant:"secondary",className:"text-xs",children:[n.jsx(Vr,{className:"w-3 h-3 mr-1"}),c]})]}),n.jsxs("p",{className:"text-sm text-muted-foreground",children:["We've set your timezone to"," ",n.jsx("span",{className:"font-medium text-foreground",children:l}),". You can change this in your settings if needed."]}),n.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[n.jsxs(te,{size:"sm",variant:"outline",onClick:t,className:"h-8 text-xs",children:[n.jsx(fs,{className:"w-3 h-3 mr-1"}),"Change Timezone"]}),n.jsx(te,{size:"sm",variant:"ghost",onClick:o,className:"h-8 text-xs text-muted-foreground hover:text-foreground",children:"Got it"})]})]})]}),n.jsx(te,{variant:"ghost",size:"sm",onClick:o,className:"h-8 w-8 p-0 text-muted-foreground hover:text-foreground",children:n.jsx(kr,{className:"w-4 h-4"})})]})})}):null}function kK({showToast:e=!0,showCustomNotification:t=!0,autoTrigger:r=!0,notificationClassName:s="fixed top-4 right-4 z-50"}){const{showNotification:a,detectedTimezone:i,openSettings:o,dism
896issNotification:l}=GAe({autoTrigger:r,showToast:e,redirectToSettings:!0});if(!t||!a||!i)return null;const c=n.jsx(Abe,{detectedTimezone:i,onChangeTimezone:o,onDismiss:l,className:s});return rd.createPortal(c,document.body)}function gbe({to:e,...t}){const r=wi();if(Object.keys(r).length===0)return n.jsx(pu,{to:e,...t});if(typeof e=="string"){const s=new URL(e,window.location.origin),a=new URLSearchParams(s.search);return Object.entries(r).forEach(([i,o])=>{a.set(i,decodeURIComponent(o))}),s.search=a.toString(),n.jsx(pu,{to:s.toString(),...t})}else{const s=new URLSearchParams(e.search||"");return Object.entries(r).forEach(([a,i])=>{s.set(a,decodeURIComponent(i))}),n.jsx(pu,{to:{...e,search:s.toString()},...t})}}const EK=g.createContext({brands:[],selectedBrand:null,setSelectedBrand:()=>{},loading:!0,refreshBrands:async()=>{}});function xbe({children:e}){const[t]=Bi(),r=Gs(),[s,a]=g.useState([]),[i,o]=g.useState(null),[l,c]=g.useState(!0),d=g.useCallback(()=>{const f=t.get("brandId");return console.log("[DEBUG] BrandsProvider - getBrandIdFromUrl:",{brandId:f,searchParams:Array.from(t.entries()),location:r.pathname+r.search}),f},[t,r]),u=g.useCallback(async()=>{try{c(!0);const{data:{user:f}}=await de.auth.getUser();if(!f){console.log("[DEBUG] BrandsProvider - no user, setting empty brands"),a([]),c(!1);return}const{data:p,error:A}=await de.from("brands").select("*").neq("status","DELETED").eq("status","ACTIVE").order("brand_name");if(A)throw A;const{data:v,error:x}=await de.from("brand_access").select(`
897                    access_level,
898                    expires_at,
899                    brand:brands!inner(
900                        id,
901                        brand_name,
902                        account_id,
903                        status
904                    )
905                `).eq("user_id",f.id).or("expires_at.is.null,expires_at.gt."+new Date().toISOString());if(x)throw x;const b=new Map;p==null||p.forEach(C=>{b.set(C.id,C)}),v==null||v.forEach(C=>{const E=C.brand;E.status==="ACTIVE"&&!b.has(E.id)&&b.set(E.id,E)});const w=Array.from(b.values()).filter(C=>C.brand_name&&C.brand_name.trim()!==""&&C.status==="ACTIVE").sort((C,E)=>C.brand_name.localeCompare(E.brand_name));a(w);const j=d(),N=localStorage.getItem("selectedBrandId");console.log("[DEBUG] BrandsProvider - brand selection sources:",{urlBrandId:j,storedBrandId:N,availableBrands:w.length});let _=null,S="";if(j&&w.length>0){const C=w.find(E=>E.id===j);C?(_=C,S="URL parameter",console.log("[DEBUG] BrandsProvider - found brand from URL:",{brandId:C.id,brandName:C.brand_name})):console.log("[DEBUG] BrandsProvider - brandId from URL not found in available brands:",{requestedId:j,availableIds:w.map(E=>E.id)})}if(!_&&N&&w.length>0){const C=w.find(E=>E.id===N);C&&(_=C,S="localStorage",console.log("[DEBUG] BrandsProvider - found brand from localStorage:",{brandId:C.id,brandName:C.brand_name}))}!_&&w.length>0&&(_=w[0],S="first available",console.log("[DEBUG] BrandsProvider - selecting first available brand:",{brandId:_==null?void 0:_.id,brandName:_==null?void 0:_.brand_name})),_?(console.log("[DEBUG] BrandsProvider - setting selected brand:",{source:S,brandId:_==null?void 0:_.id,brandName:_==null?void 0:_.brand_name}),o(_),localStorage.setItem("selectedBrandId",_.id)):(console.log("[DEBUG] BrandsProvider - no brand selected, no brands available"),o(null),localStorage.removeItem("selectedBrandId"))}catch(f){console.error("Error loading brands:",f)}finally{c(!1)}},[d]);g.useEffect(()=>{u()},[u]),g.useEffect(()=>{if(s.length>0&&!l){const f=d();if(console.log("[DEBUG] BrandsProvider - URL change effect triggered:",{urlBrandId:f,currentSelectedBrand:i==null?void 0:i.id,brandsLoaded:s.length}),f){const p=s.find(A=>A.id===f);p&&p.id!==(i==null?void 0:i.id)?(console.log("[DEBUG] BrandsProvider - switching to URL brand:",{from:i==null?void 0:i.id,to:p.id,brandName:p.brand_name}),o(p),localStorage.setItem("selectedBrandId",p.id)):p||console.log("[DEBUG] BrandsProvider - URL brandId not found in loaded brands:",{requestedId:f,availableIds:s.map(A=>A.id)})}}},[d,s,l,i]);const h=f=>{console.log("[DEBUG] BrandsProvider - handleSetSelectedBrand called:",{previousBrand:i==null?void 0:i.id,newBrand:f==null?void 0:f.id,brandName:f==null?void 0:f.brand_name}),o(f),f?localStorage.setItem("selectedBrandId",f.id):localStorage.removeItem("selectedBrandId")},m=g.useCallback(async()=>{await u()},[u]);return n.jsx(EK.Provider,{value:{brands:s,selectedBrand:i,setSelectedBrand:h,loading:l,refreshBrands:m},children:e})}function mn(){const e=g.useContext(EK);if(!e)throw new Error("useBrands must be used within a BrandsProvider");return e}function Of({children:e,requireBrands:t=!0,requireAuth:r=!0}){const[s,a]=g.useState(!0),i=xr(),o=Gs();return g.useEffect(()=>{let l=!0;return(async()=>{var d;try{const{data:{session:u},error:h}=await de.auth.getSession();if(h){console.error("[ProtectedRoute Debug] Session error:",h),r?(console.log("[ProtectedRoute Debug] Redirecting to / due to session error"),window.location.href="/"):a(!1);return}if(!u){console.log("[ProtectedRoute Debug] No session found"),r?(console.log("[ProtectedRoute Debug] Redirecting to / due to no session"),window.location.href="/"):a(!1);return}console.log("[ProtectedRoute Debug] Valid session found:",(d=u.user)==null?void 0:d.id);const{error:m}=await de.schema("basejump").from("current_user_role").select("role").single();if(m&&m.code!=="PGRST116"){console.error("ProtectedRoute: Role check error:",m),r?window.location.href="/":a(!1);return}if(o.pathname.includes("/process-invitation")||o.pathname.includes("/invitations/accept")){console.log("[ProtectedRoute Debug] Detected invitation flow, skipping brand check"),l&&a(!1);return}if(o.pathname.includes("/settings")){console.log("[ProtectedRoute Debug] User accessing settings, allowing access without brand/onboarding check"),l&&a(!1);return}if(t)try{const{data:A,error:v}=await de.from("brands").select("id").neq("status","DELETED").limit(1);if(v){console.error("[ProtectedRoute Debug] Brands check error:",v),i("/");return}if(!A||A.length===0){console.log("[ProtectedRoute Debug] No brands found via account, checking for direct access brands");const{data:x}=await de.from("brand_access").select("brand_id").eq("user_id",u.user.id).limit(1);if(x&&x.length>0){console.log("[ProtectedRoute Debug] Found brands via direct access, user is invited but may 
905need onboarding"),l&&a(!1);return}console.log("[ProtectedRoute Debug] No brands found anywhere, checking onboarding status");const{data:b}=await de.schema("marketing_and_customer_success").from("profiles").select("onboarding_completed").eq("id",u.user.id).limit(1).single();if(b!=null&&b.onboarding_completed){console.log("[ProtectedRoute Debug] Onboarding completed but no brands found, redirecting to brand creation"),i("/onboarding?step=brand");return}else{console.log("[ProtectedRoute Debug] Onboarding not completed, redirecting to onboarding"),i("/onboarding");return}}console.log("[ProtectedRoute Debug] Brands found:",A.length)}catch(A){console.error("[ProtectedRoute Debug] Brands check failed:",A),i("/");return}l&&a(!1)}catch(u){console.error("ProtectedRoute: Auth check failed:",u),r?i("/"):a(!1)}})(),()=>{l=!1}},[i,t,r,o]),s?n.jsx("div",{className:"min-h-screen flex items-center justify-center",children:n.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})}):n.jsx(n.Fragment,{children:e})}const qe=g.forwardRef(({className:e,type:t,...r},s)=>n.jsx("input",{type:t,className:ye("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm r
905ing-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:s,...r}));qe.displayName="Input";function Qa({to:e,children:t,...r}){const s=wi();if(Object.keys(s).length===0)return n.jsx(Ir,{to:e,...r,children:t});let a;if(typeof e=="string")a=_ge(e);else{const i=new URLSearchParams(e.search||"");Object.entries(s).forEach(([o,l])=>{i.set(o,decodeURIComponent(l))}),a={...e,search:i.toString()}}return n.jsx(Ir,{to:a,...r,children:t})}const Zw="/assets/logo_reveal-_irMxYDN.mp4";function vbe({className:e}){const[t]=Bi(),r=t.get("flow"),s=t.get("token"),a=()=>{if(s)return n.jsxs("div",{className:"relative",children:[n.jsx("div",{className:"absolute top-0 right-0 w-32 h-32 bg-gradient-to-br from-indigo-200/30 to-transparent rounded-full -translate-y-16 translate-x-16"}),n.jsx("div",{className:"absolute bottom-0 left-0 w-24 h-24 bg-gradient-to-tr from-purple-100/40 to-transparent rounded-full translate-y-12 -translate-x-12"}),n.jsx("div",{className:"relative backdrop-blur-sm p-6",children:n.jsxs("div",{className:"flex flex-col items-center gap-4 text-center",children:[n.jsx("div",{className:"p-3 bg-white/80 backdrop-blur-sm rounded-xl shadow-lg",children:n.jsx("div",{className:"w-12 h-12 bg-gradient-to-br from-indigo-500 to-purple-600 rounded-lg flex items-center justify-center",children:n.jsx("span",{className:"text-2xl",children:"👋"})})}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("h2",{className:"text-xl font-bold bg-gradient-to-r from-indigo-800 to-purple-700 bg-clip-text text-transparent",children:"Team Invitation"}),n.jsx("p",{className:"text-sm text-slate-600",children:"Sign in or create an account to accept your team invitation."})]})]})})]});switch(r){case"signup":return n.jsxs("div",{className:"relative",children:[n.jsx("div",{className:"absolute top-0 right-0 w-40 h-40 bg-gradient-to-br from-emerald-200/30 to-transparent rounded-full -translate-y-20 translate-x-20"}),n.jsx("div",{className:"absolute bottom-0 left-0 w-32 h-32 bg-gradient-to-tr from-blue-100/40 to-transparent rounded-full translate-y-16 -translate-x-16"}),n.jsx("div",{className:"relative backdrop-blur-sm p-4 sm:p-6 md:p-8",children:n.jsxs("div",{className:"flex flex-col items-center gap-4 sm:gap-5 md:gap-6 text-center",children:[n.jsx("div",{className:"relative group",children:n.jsx("div",{className:"p-2 sm:p-3 md:p-4 bg-white/80 backdrop-blur-sm rounded-2xl shadow-lg group-hover:shadow-xl transition-all duration-300",children:n.jsx("video",{autoPlay:!0,muted:!0,playsInline:!0,className:"w-24 h-24 sm:w-32 sm:h-32 md:w-48 md:h-48 rounded-xl transform group-hover:scale-105 transition-transform duration-500",children:n.jsx("source",{src:Zw,type:"video/mp4"})})})}),n.jsxs("div",{className:"space-y-2 sm:space-y-3 md:space-y-4",children:[n.jsx("h1",{className:"text-2xl font-bold tracking-tight sm:text-4xl md:text-6xl bg-gradient-to-r from-emerald-700 via-blue-700 to-indigo-700 bg-clip-text text-transparent",children:"Welcome to Rainfactory"}),n.jsx("p",{className:"text-sm sm:text-lg md:text-xl text-slate-600 leading-relaxed max-w-2xl",children:"Join thousands of businesses using Rainfactory's AI-powered marketing platform to transform their brand presence."})]})]})})]});case"pricing":return n.jsxs("div",{className:"relative",children:[n.jsx("div",{className:"absolute top-0 right-0 w-40 h-40 bg-gradient-to-br from-amber-200/30 to-transparent rounded-full -translate-y-20 translate-x-20"}),n.jsx("div",{className:"absolute bottom-0 left-0 w-32 h-32 bg-gradient-to-tr from-orange-100/40 to-transparent rounded-full translate-y-16 -translate-x-16"}),n.jsx("div",{className:"relative backdrop-blur-sm p-4 sm:p-6 md:p-8",children:n.jsxs("div",{className:"flex flex-col items-center gap-4 sm:gap-5 md:gap-6 text-center",children:[n.jsx("div",{className:"relative group",children:n.jsx("div",{className:"p-2 sm:p-3 md:p-4 bg-white/80 backdrop-blur-sm rounded-2xl shadow-lg group-hover:shadow-xl transition-all duration-300",children:n.jsx("video",{autoPlay:!0,muted:!0,playsInl
905ine:!0,className:"w-24 h-24 sm:w-32 sm:h-32 md:w-48 md:h-48 rounded-xl transform group-hover:scale-105 transition-transform duration-500",children:n.jsx("source",{src:Zw,type:"video/mp4"})})})}),n.jsxs("div",{className:"space-y-2 sm:space-y-3 md:space-y-4",children:[n.jsx("h1",{className:"text-2xl font-bold tracking-tight sm:text-4xl md:text-6xl bg-gradient-to-r from-amber-700 via-orange-700 to-red-600 bg-clip-text text-transparent",children:"Choose Your Plan"}),n.jsx("p",{className:"text-sm sm:text-lg md:text-xl text-slate-600 leading-relaxed max-w-2xl",children:"Select the perfect plan for your business needs and unlock the full potential of AI-powered marketing."})]})]})})]});case"brand-claim":return n.jsxs("div",{className:"relative",children:[n.jsx("div",{className:"absolute top-0 right-0 w-40 h-40 bg-gradient-to-br from-purple-200/30 to-transparent rounded-full -translate-y-20 translate-x-20"}),n.jsx("div",{className:"absolute bottom-0 left-0 w-32 h-32 bg-gradient-to-tr from-indigo-100/40 to-transparent rounded-full translate-y-16 -translate-x-16"}),n.jsx("div",{className:"relative backdrop-blur-sm p-4 sm:p-6 md:p-8",children:n.jsxs("div",{className:"flex flex-col items-center gap-4 sm:gap-5 md:gap-6 text-center",children:[n.jsx("div",{className:"relative group",children:n.jsx("div",{className:"p-2 sm:p-3 md:p-4 bg-white/80 backdrop-blur-sm rounded-2xl shadow-lg group-hover:shadow-xl transition-all duration-300",children:n.jsx("video",{autoPlay:!0,muted:!0,playsInline:!0,className:"w-24 h-24 sm:w-32 sm:h-32 md:w-48 md:h-48 rounded-xl transform group-hover:scale-105 transition-transform duration-500",children:n.jsx("source",{src:Zw,type:"video/mp4"})})})}),n.jsxs("div",{className:"space-y-2 sm:space-y-3 md:space-y-4",children:[n.jsx("h1",{className:"text-2xl font-bold tracking-tight sm:text-4xl md:text-6xl bg-gradient-to-r from-purple-700 via-indigo-700 to-blue-700 bg-clip-text text-transparent",children:"Start your 14-day free trial"}),n.jsx("p",{className:"text-sm sm:text-lg md:text-xl text-slate-600 leading-relaxed max-w-2xl",children:"Before continuing, we need to create an account to save your work. You can sign up with Google or email."})]})]})})]});default:return n.jsxs("div",{className:"relative",children:[n.jsx("div",{className:"absolute top-0 right-0 w-40 h-40 bg-gradient-to-br from-blue-200/30 to-transparent rounded-full -translate-y-20 translate-x-20"}),n.jsx("div",{className:"absolute bottom-0 left-0 w-32 h-32 bg-gradient-to-tr from-indigo-100/40 to-transparent rounded-full translate-y-16 -translate-x-16"}),n.jsx("div",{className:"relative backdrop-blur-sm p-4 sm:p-6 md:p-8",children:n.jsxs("div",{className:"flex flex-col items-center gap-4 sm:gap-5 md:gap-6 text-center",children:[n.jsx("div",{className:"relative group",children:n.jsx("div",{className:"p-2 sm:p-3 md:p-4 bg-white/80 backdrop-blur-sm rounded-2xl shadow-lg group-hover:shadow-xl transition-all duration-300",children:n.jsx("video",{autoPlay:!0,muted:!0,playsInline:!0,className:"w-24 h-24 sm:w-32 sm:h-32 md:w-48 md:h-48 rounded-xl transform group-hover:scale-105 transition-transform duration-500",children:n.jsx("source",{src:Zw,type:"video/mp4"})})})}),n.jsxs("div",{className:"space-y-2 sm:space-y-3 md:space-y-4",children:[n.jsx("h1",{className:"text-2xl font-bold tracking-tight sm:text-4xl md:text-6xl bg-gradient-to-r from-blue-700 via-indigo-700 to-purple-700 bg-clip-text text-transparent",children:"Welcome Back"}),n.jsx("p",{className:"text-sm sm:text-lg md:text-xl text-slate-600 leading-relaxed max-w-2xl",children:"Sign in to continue to your account and unlock the power of AI-driven marketing."}),n.jsx("div",{className:"pt-2",children:n.jsx(Qa,{to:"/",className:"inline-flex items-center gap-2 text-sm text-slate-500 hover:text-blue-600 transition-all duration-300 hover:bg-white/60 backdrop-blur-sm px-4 py-2 rounded-lg border border-white/50 shadow-sm hover:shadow-md transform hover:scale-105",children:"← Back to rainfactory.ai"})})]})]})})]})}};return n.jsxs("div",{className:`min-h-[20vh] bg-gradient-to-br from-slate-50 via-white to-blue-50/30 relative overflow-hidden ${e||""}`,children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-blue-50/30 via-trans
905parent to-purple-50/30"}),n.jsx("div",{className:`container relative z-10 ${s?"py-4 sm:py-6 md:py-8":"py-6 sm:py-8 md:py-12 lg:py-16"}`,children:a()})]})}var BK={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},WR=oe.createContext&&oe.createContext(BK),bbe=["attr","size","title"];function ybe(e,t){if(e==null)return{};var r,s,a=wbe(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)r=i[s],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function wbe(e,t){if(e==null)return{};var r={};for(var s in e)if({}.hasOwnProperty.call(e,s)){if(t.indexOf(s)!==-1)continue;r[s]=e[s]}return r}function b2(){return b2=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var s in r)({}).hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},b2.apply(null,arguments)}function YR(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,s)}return r}function y2(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?YR(Object(r),!0).forEach(function(s){jbe(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):YR(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}function jbe(e,t,r){return(t=Nbe(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Nbe(e){var t=_be(e,"string");return typeof t=="symbol"?t:t+""}function _be(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function TK(e){return e&&e.map((t,r)=>oe.createElement(t.tag,y2({key:r},t.attr),TK(t.child)))}function Cbe(e){return t=>oe.createElement(Sbe,b2({attr:y2({},e.attr)},t),TK(e.child))}function Sbe(e){var t=r=>{var{attr:s,size:a,title:i}=e,o=ybe(e,bbe),l=a||r.size||"1em",c;return r.className&&(c=r.className),e.className&&(c=(c?c+" ":"")+e.className),oe.createElement("svg",b2({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},r.attr,s,o,{className:c,style:y2(y2({color:e.color||r.color},r.style),e.style),height:l,width:l,xmlns:"http://www.w3.org/2000/svg"}),i&&oe.createElement("title",null,i),e.children)};return WR!==void 0?oe.createElement(WR.Consumer,null,r=>t(r)):t(BK)}function kbe(e){return Cbe({attr:{version:"1.1",x:"0px",y:"0px",viewBox:"0 0 48 48",enableBackground:"new 0 0 48 48"},child:[{tag:"path",attr:{fill:"#FFC107",d:`M43.611,20.083H42V20H24v8h11.303c-1.649,4.657-6.08,8-11.303,8c-6.627,0-12-5.373-12-12\r
906	c0-6.627,5.373-12,12-12c3.059,0,5.842,1.154,7.961,3.039l5.657-5.657C34.046,6.053,29.268,4,24,4C12.955,4,4,12.955,4,24\r
907	c0,11.045,8.955,20,20,20c11.045,0,20-8.955,20-20C44,22.659,43.862,21.35,43.611,20.083z`},child:[]},{tag:"path",attr:{fill:"#FF3D00",d:`M6.306,14.691l6.571,4.819C14.655,15.108,18.961,12,24,12c3.059,0,5.842,1.154,7.961,3.039l5.657-5.657\r
908	C34.046,6.053,29.268,4,24,4C16.318,4,9.656,8.337,6.306,14.691z`},child:[]},{tag:"path",attr:{fill:"#4CAF50",d:`M24,44c5.166,0,9.86-1.977,13.409-5.192l-6.19-5.238C29.211,35.091,26.715,36,24,36\r
909	c-5.202,0-9.619-3.317-11.283-7.946l-6.522,5.025C9.505,39.556,16.227,44,24,44z`},child:[]},{tag:"path",attr:{fill:"#1976D2",d:`M43.611,20.083H42V20H24v8h11.303c-0.792,2.237-2.231,4.166-4.087,5.571\r
910	c0.001-0.001,0.002-0.001,0.003-0.002l6.19,5.238C36.971,39.205,44,34,44,24C44,22.659,43.862,21.35,43.611,20.083z`},child:[]}]})(e)}const Ebe={USER_SIGNED_UP:"user_signed_up",USER_LOGGED_IN:"user_logged_in",USER_LOGGED_OUT:"user_logged_out",USER_ONBOARDING_STARTED:"user_onboarding_started",USER_ONBOARDING_COMPLETED:"user_onboarding_completed",BRAND_CREATED:"brand_created",BRAND_EDITED:"brand_edited",BRAND_SELECTED:"brand_selected",CAMPAIGN_CREATED:"campaign_created",CAMPAIGN_EDITED:"campaign_edited",CAMPAIGN_DELET
910ED:"campaign_deleted",CAMPAIGN_VIEWED:"campaign_viewed",CONTENT_TYPE_SELECTED:"content_type_selected",CONTENT_GENERATION_STARTED:"content_generation_started",CONTENT_GENERATION_COMPLETED:"content_generation_completed",CONTENT_GENERATION_ERROR:"content_generation_error",CONTENT_EDITED:"content_edited",CONTENT_PUBLISHED:"content_published",CONTENT_SHARED:"content_shared",CONVERGENCE_VIEWED:"convergence_viewed",CONVERGENCE_FILTERED:"convergence_filtered",CONVERGENCE_RERANKED:"convergence_reranked",CONVERGENCE_HIGHLIGHTED:"convergence_highlighted",FEATURE_USED:"feature_used",AI_ASSIST_REQUESTED:"ai_assist_requested",TOOL_EXECUTED:"tool_executed",SITE_SCRAPED:"site_scraped",PAGE_VIEWED:"page_viewed",BUTTON_CLICKED:"button_clicked",FORM_SUBMITTED:"form_submitted",MODAL_OPENED:"modal_opened",SUBSCRIPTION_VIEWED:"subscription_viewed",SUBSCRIPTION_CHANGED:"subscription_changed",SUBSCRIPTION_CANCELLED:"subscription_cancelled",CHECKOUT_STARTED:"checkout_started",CHECKOUT_COMPLETED:"checkout_completed",ERROR_OCCURRED:"error_occurred"},PK=g.createContext(void 0);class Bbe extends oe.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t){console.debug("Analytics error caught by boundary:",t.message)}render(){return this.state.hasError?this.props.children:this.props.children}}const Tbe=({adapter:e,options:t,children:r,disabled:s=!1})=>{const[a,i]=g.useState(!s),o=mn(),l=o==null?void 0:o.selectedBrand;g.useEffect(()=>{try{return e.initialize(t),s&&(e.disable(),i(!1)),()=>{e.reset()}}catch(f){console.debug("Analytics initialization error:",f),i(!1)}},[e,t,s]),g.useEffect(()=>{try{a?e.enable():e.disable()}catch(f){console.debug("Analytics toggle error:",f)}},[e,a]);const c=g.useCallback(f=>{try{a&&e.identify(f)}catch(p){console.debug("Analytics identify error:",p)}},[e,a]),d=g.useCallback(f=>{try{if(a){const p={...f.properties,environment:"production",timestamp:new Date().toISOString(),brand_id:l==null?void 0:l.id,url:window.location.href,path:window.location.pathname};e.track({name:f.name,properties:p})}}catch(p){console.debug("Analytics track error:",p)}},[e,a,l]),u=g.useCallback((f,p)=>{try{d({name:f,properties:p})}catch(A){console.debug("Analytics trackEvent error:",A)}},[d]),h=g.useCallback((f,p)=>{try{a&&e.page(f,p)}catch(A){console.debug("Analytics page error:",A)}},[e,a]),m=g.useCallback(()=>{try{e.reset()}catch(f){console.debug("Analytics reset error:",f)}},[e]);return n.jsx(Bbe,{children:n.jsx(PK.Provider,{value:{track:d,trackEvent:u,identify:c,page:h,reset:m,enabled:a,setEnabled:i,events:Ebe},children:r})})},Pbe={track:()=>{},trackEvent:()=>{},identify:()=>{},page:()=>{},reset:()=>{},enabled:!1,setEnabled:()=>{},events:{}},Lu=()=>{const e=g.useContext(PK),t=Gs();return e?(g.useEffect(()=>{try{if(e.enabled){const r=t.pathname,s=r==="/"?"home":r.substring(1).replace(/\//g,"_");e.page(s,{path:r,url:window.location.href,referrer:document.referrer})}}catch(r){console.debug("Error tracking page view:",r)}},[t,e]),e):(console.debug("Analytics context not found, using noop implementation"),Pbe)};class Ibe{constructor(){Yt(this,"isBlockedByClient",!1);Yt(this,"posthogInstance",null)}initialize(t){try{hs(()=>import("./module-Mv-tqxmC.js"),[]).then(r=>{const s=r.default;this.posthogInstance=s,s.init(t.apiKey,{api_host:t.apiHost||"https://app.posthog.com",capture_pageview:!1,autocapture:!1,capture_pageleave:!0,loaded:a=>{}})}).catch(r=>{console.debug("Analytics blocked or failed to load:",r),this.isBlockedByClient=!0})}catch(r){console.debug("Analytics initialization failed:",r),this.isBlockedByClient=!0}}identify(t){if(!(this.isBlockedByClient||!this.posthogInstance))try{this.posthogInstance.identify(t.id,t.traits)}catch(r){console.debug("Analytics identify failed:",r)}}track(t){if(!(this.isBlockedByClient||!this.posthogInstance))try{this.posthogInstance.capture(t.name,t.properties)}catch(r){console.debug("Analytics track failed:",r)}}page(t,r){if(!(this.isBlockedByClient||!this.posthogInstance))try{this.posthogInstance.capture("$pageview",{...r,page_name:t})}catch(s){console.debug("Analytics page view failed:",s)}}reset(){if(!(this.isBlockedByClient||!this.posthogInstance))try{this.posthogInstance.reset()}catch(t){console.debug("Analytics reset failed:",t)}}enable(){if(!(this.isBlockedByClient||!this.posthogInstance))try{this.posthogInstance.opt_in_capturing()}catch(t){console.debug("Analytics enable failed:",t)}}disable(){if(!(this.isBlockedByClient||!this.posthogInstance))try{this.posthogInstance.opt_out_capturing()}catch(t){console.debug("Analytics disable failed:",t)}}}const lg={SIGN_UP:"sign_up",GENERATE_LEAD:"generate_lead",BEGIN_CHECKOUT:"begin_checkout",PURCHASE:"purchase",VIDEO_START:"video_start",VIDEO_COMPLETE:"video_complete",BRAND_SCAN_STARTED:"brand_scan_started"};function cg(e,t,r){if(typeof window>"u"||!window.gtag){console.debug("[GA4] gtag not available, skipping conversion:",e);return}const s={...t!==void 0&&{value:t,currency:(r==null?void 0:r.currency)||"USD"},...r};try{window.gtag("event",e,s),console.debug("[GA4] Conversion tracked:",e,s)}catch(a){console.error("[GA4] Error tracking conversion:",a)}}function Obe(e,t,r){if(typeof window>"u"||!window.gtag){console.debug("[GA4] gtag not available, skipping page view:",e);return}const s={page_path:e,page_title:t||(typeof document<"u"?document.title:void 0),page_location:typeof window<"u"?window.location.href:void 0,...r};try{window.gtag("event","page_view",s),console.debug("[GA4] Page view tracked:",e,s)}catch(a){console.error("[GA4] Error tracking page view:",a)}}const v5=Qa;function w2({headerSlot:e,redirectTo:t,view:r="sign_in"}){const[s,a]=g.useState(""),[i,o]=g.useState(""),[l,c]=g.useState(!1),[d,u]=g.useState(null),[h,m]=g.useState(!1),[f,p]=g.useState(r==="sign_up"?"sign_up":"sign_in"),[A,v]=g.useState(!1),[x]=Bi(),b=x.get("flow"),y=x.get("action"),w=x.get("sessionToken"),j=b==="signup"||f==="sign_up",N=b==="invite"||r==="invite",_=y==="claim"&&w,S=j||N||_,C=x.get("plan"),E=x.get("token");
910let T=x.get("invitation_token")||E;if(!T&&t&&t.includes("invitation_token=")){const M=t.match(/invitation_token=([^&]+)/);M&&(T=M[1])}const{trackEvent:B,events:L}=Lu();g.useEffect(()=>{_&&w&&(localStorage.setItem("brand_claim_session_token",w),console.log("[Auth] Stored brand claim session token:",w))},[_,w]),console.log("[Auth] Initialized with invitation token:",T,"redirect:",t),g.useEffect(()=>{B(S?L.USER_SIGNED_UP:L.USER_LOGGED_IN,{method:"page_load",selected_plan:C,flow_type:b||"login",referrer:document.referrer})},[S,L,B,C,b]),g.useEffect(()=>{const{data:{subscription:M}}=de.auth.onAuthStateChange(async(I,$)=>{if(I==="SIGNED_IN"&&($!=null&&$.user))try{const{data:V}=await de.schema("marketing_and_customer_success").from("profiles").select("*").eq("id",$.user.id).single(),R=$.user.user_metadata||{},Q=$.user.email,U=T||window.location.pathname.includes("process-invitation");if(V){const{error:D}=await de.schema("marketing_and_customer_success").from("profiles").update({last_login_date:new Date().toISOString(),login_count:(V.login_count||0)+1,full_name:R.full_name||R.name,email:Q,avatar_url:R.avatar_url||R.picture,metadata:{provider:"email",...R}}).eq("id",$.user.id);if(D)throw D;const{data:q}=await de.schema("marketing_and_customer_success").from("profiles").select("onboarding_completed").eq("id",$.user.id).single();if(T||window.location.pathname.includes("process-invitation"))return;window.location.href=q!=null&&q.onboarding_completed?"/dashboard":"/onboarding"}else{const{error:D}=await de.schema("marketing_and_customer_success").from("profiles").upsert({id:$.user.id,full_name:R.full_name||R.name||(Q==null?void 0:Q.split("@")[0]),email:Q,avatar_url:R.avatar_url||R.picture,customer_status:"lead",lifecycle_stage:"awareness",account_tier:"standard",first_contact_date:new Date().toISOString(),last_login_date:new Date().toISOString(),marketing_opt_in:!0,preferred_language:R.language||R.locale||"en",timezone:R.timezone||Intl.DateTimeFormat().resolvedOptions().timeZone,login_count:1,onboarding_completed:!!U,email_opt_in:!!R.email_verified,metadata:{provider:"email",selected_plan:C,...R}});if(D)throw D;if(U)return;window.location.href="/onboarding"}}catch(V){console.error("Error handling auth state change:",V),window.location.href="/"}else I==="SIGNED_OUT"&&window.location.replace("/")});return()=>{M.unsubscribe()}},[C]);const P=async M=>{M.preventDefault();try{c(!0),u(null),B(S?L.USER_SIGNED_UP:L.USER_LOGGED_IN,{method:A?"email_password":"email_magic_link",email_domain:s.split("@")[1],selected_plan:C,flow_type:b||"login",has_invitation:!!T});let I=`${window.location.origin}/auth/callback`;const $=wi(),V=Object.keys($).length>0?"&"+new URLSearchParams($).toString():"";if(T?(I=`${window.location.origin}/process-invitation?invitation_token=${T}${V}`,console.log("[Auth] Using invitation-specific redirect with UTM:",I)):_&&w?(I=`${window.location.origin}/auth/callback?claim=true&sessionToken=${w}${V}`,console.log("[Auth] Using brand claim redirect with UTM:",I)):t?(I=`${window.location.origin}${t.startsWith("/")?"":"/"}${t}`,Object.keys($).length>0&&(I+=I.includes("?")?"&"+new URLSearchParams($).toString():"?"+new URLSearchParams($).toString()),console.log("[Auth] Using custom redirect with UTM:",I)):Object.keys($).length>0&&(I+="?"+new URLSearchParams($).toString()),A)if(f==="sign_up"||S){const{error:R}=await de.auth.signUp({email:s,password:i,options:{emailRedirectTo:I}});if(R)throw R;m(!0)}else{const{error:R}=await de.auth.signInWithPassword({email:s,password:i});if(R)throw R}else{const{error:R}=await de.auth.signInWithOtp({email:s,options:{emailRedirectTo:I,shouldCreateUser:!!S}});if(R)throw R;m(!0)}(!A||A&&(f==="sign_up"||S))&&(B(L.FEATURE_USED,{feature:A?"password_signup":"magic_link_sent",success:!0,is_signup:S,flow_type:b||"login",email_domain:s.split("@")[1]}),S&&cg(lg.SIGN_UP,void 0,{method:A?"email_password":"email_magic_link",flow_type:b||"login"}))}catch(I){console.error("Error during auth:",I);let $=I instanceof Error?I.message:"Authentication failed";($.toLowerCase().includes("signups not allowed")||$.toLowerCase().includes("signup not allowed"))&&($=`No account found for ${s}. Would you like to create an account instead?`),u($),B(L.ERROR_OCCURRED,{error_type:"auth_failed",method:A?"email_password":"email_magic_link",is_signup:S,flow_type:b||"login",error_message:I instanceof Error?I.message:String(I)})}finally{c(!1)}},F=async()=>{try{c(!0),u(null),B(S?L.USER_SIGNED_UP:L.USER_LOGGED_IN,{method:"google_oauth",is_signup:S,flow_type:b||"login",selected_plan:C,has_invitation:!!T});let M=`${window.location.origin}/auth/callback`;const I=wi(),$=Object.keys(I).length>0?"&"+new URLSearchParams(I).toString():"";T?(M=`${window.location.origin}/process-invitation?invitation_token=${T}${$}
910`,console.log("[Auth] Google login with invitation-specific redirect and UTM:",M)):_&&w?(M=`${window.location.origin}/auth/callback?claim=true&sessionToken=${w}${$}`,console.log("[Auth] Google login with brand claim redirect and UTM:",M)):t?(M=`${window.location.origin}${t.startsWith("/")?"":"/"}${t}`,Object.keys(I).length>0&&(M+=M.includes("?")?"&"+new URLSearchParams(I).toString():"?"+new URLSearchParams(I).toString()),console.log("[Auth] Google login with custom redirect and UTM:",M)):Object.keys(I).length>0&&(M+="?"+new URLSearchParams(I).toString());const{error:V}=await de.auth.signInWithOAuth({provider:"google",options:{redirectTo:M,queryParams:{access_type:"offline",prompt:"select_account",redirect_uri:`${Wo.VITE_SUPABASE_URL}/auth/v1/callback`}}});if(V)throw V;S&&cg(lg.SIGN_UP,void 0,{method:"google_oauth",flow_type:b||"login"})}catch(M){console.error("Error signing in with Google:",M),u("Error signing in with Google"),B(L.ERROR_OCCURRED,{error_type:"auth_failed",method:"google_oauth",is_signup:S,flow_type:b||"login",error_message:M instanceof Error?M.message:String(M)})}finally{c(!1)}};return n.jsxs("div",{className:"flex flex-col",children:[!N&&(e||n.jsx(vbe,{})),n.jsx("div",{className:"flex-1 flex items-center justify-center p-4",children:n.jsxs(Te,{className:"w-full max-w-md p-6",children:[r==="invite"&&n.jsxs("div",{className:"text-center mb-6",children:[n.jsx("h2",{className:"text-2xl font-semibold mb-2",children:"Complete Your Account Setup"}),n.jsx("p",{className:"text-muted-foreground",children:"Choose how you'd like to access your account"})]}),Zme&&n.jsxs("div",{className:"mb-4 p-2 bg-gray-100 rounded text-xs break-all",children:[n.jsx("p",{children:"You are looking at a preview environment."}),n.jsxs("p",{children:["Supabase URL: ",Wo.VITE_SUPABASE_URL||"Not set"]}),n.jsxs("p",{children:["Redirect URL: ",`${Wo.VITE_SUPABASE_URL}/auth/v1/callback`]})]}),n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{children:[d&&n.jsxs("div",{className:"text-center mt-2",children:[n.jsx("p",{className:"text-red-500 text-sm",children:d}),d.includes("Would you like to create an account instead?")&&!j&&n.jsx("div",{className:"mt-2",children:n.jsx(v5,{to:"/login?flow=signup",className:"text-primary hover:underline text-sm font-medium",children:"Create an account"})})]}),h&&n.jsx("div",{className:"bg-green-50 border border-green-200 rounded-lg p-4 text-center",children:n.jsx("p",{className:"text-green-700 font-medium",children:A&&(f==="sign_up"||S)?"Account created! Check your email to confirm your account.":"Magic link sent! Check your email to sign in."})})]}),n.jsxs(te,{type:"button",variant:"outline",className:"w-full",onClick:F,disabled:l,children:[n.jsx(kbe,{className:"mr-2 h-5 w-5"}),"Continue with Google"]}),n.jsxs("div",{className:"relative",children:[n.jsx("div",{className:"absolute inset-0 flex items-center",children:n.jsx("span",{className:"w-full border-t"})}),n.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:n.jsx("span",{className:"bg-background px-2 text-muted-foreground",children:"Or continue with email"})})]}),n.jsxs("form",{onSubmit:P,className:"space-y-4",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx(qe,{type:"email",placeholder:"Email",value:s,onChange:M=>a(M.target.value),required:!0}),A&&n.jsx(qe,{type:"password",placeholder:"Password",value:i,onChange:M=>o(M.target.value),required:!0,minLength:6})]}),n.jsx("div",{className:"text-center",children:n.jsx("button",{type:"button",onClick:()=>v(!A),className:"text-sm text-muted-foreground hover:text-primary",children:A?"Use magic link instead":"Use password instead"})}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(te,{type:"submit",className:"w-full",disabled:l,children:l?n.jsxs(n.Fragment,{children:[n.jsx(kt,{className:"mr-2 h-4 w-4 animate-spin"}),"Loading"]}):A?f==="sign_up"||S?"Create Account":"Sign In":f==="sign_up"||S?"Create Account":"Send Magic Link"}),r==="invite"?n.jsx("div",{className:"text-center text-sm",children:n.jsx("button",{type:"button",onClick:()=>p(f==="sign_in"?"sign_up":"sign_in"),className:"text-primary hover:underline",children:f==="sign_in"?"Don't have an account? Create one":"Already have an account? Sign in"})}):!N&&n.jsxs(n.Fragment,{children:[!j&&n.jsxs("div",{className:"text-center text-sm",children:[n.jsxs("span",{className:"text-muted-foreground",children:["Don't have an account?"," "]}),n.jsx(v5,{to:"/login?flow=signup",className:"text-primary hover:underline",children:"Create one"})]}),j&&n.jsxs("div",{className:"text-center text-sm",children:[n.jsxs("span",{className:"text-muted-foreground",children:["Already have an account?"," "]}),n.jsx(v5,{to:"/login",className:"text-primary hover:underline",children:"Sign in"})]})]})]})]})]})]})})]})}function Fbe(e){try{const t=new URL(e);return t.hostname=t.hostname.replace(/^www\./,""),t.protocol="https:",t.toString()}catch{return e}}function Lbe(e,t=60){if(e.length<=t)return e;const r=e.substring(0,t),s=r.lastIndexOf(" ");return(s>0?r.substring(0,s):r)+"..."}function Dbe(e,t=160){if(e.length<=t)return e;const r=e.substring(0,t),s=r.lastIndexOf(" ");return(s>0?r.substring(0,s):r)+"..."}function IK(e){g.useEffect(()=>{var f;const t=document.title,r={},s={};let a=null,i=null;const o=(p,A,v=!1)=>{const x=v?`meta[property="${p}"]`:`meta[name="${p}"]`;let b=document.querySelector(x);b?s[p]=b.content:(b=document.createElement("meta"),v?b.setAttribute("property",p):b.setAttribute("name",p),document.head.appendChild(b),s[p]=null),b.content=A,r[p]=A};e.title&&(document.title=`${Lbe(e.title)} | Rainfactory`);const l=e.description?Dbe(e.description):void 0;l&&o("description",l),e.keywords&&o("keywords",e.keywords),e.author&&o("author",e.author),o("og:site_name","Rainfactory",!0),e.title&&o("og:title",e.title,!0),l&&o("og:description",l,!0);const c=e.image||"https://rainfactory.ai/og-image.png";if(o("og:image",c,!0),e.url&&o("og:url",e.url,!0),o("og:type",e.type||"website",!0),e.publishedTime&&o("article:published_time",e.publishedTime,!0),e.modifiedTime&&o("article:modified_time",e.modifiedTime,!0),e.tags&&e.tags.forEac
910h(p=>{o("article:tag",p,!0)}),o("twitter:card","summary_large_image"),e.title&&o("twitter:title",e.title),l&&o("twitter:description",l),o("twitter:image",c),e.url&&o("twitter:url",e.url),e.url){const p=Fbe(e.url);a=document.querySelector('link[rel="canonical"]'),a?i=a.href:(a=document.createElement("link"),a.rel="canonical",document.head.appendChild(a),i=null),a.href=p}let d=null,u=null;e.type==="article"&&e.title&&(d={"@context":"https://schema.org","@type":"Article",headline:e.title,description:e.description,image:e.image,url:e.url,datePublished:e.publishedTime,dateModified:e.modifiedTime,author:e.author?{"@type":"Person",name:e.author}:void 0,publisher:{"@type":"Organization",name:"Rainfactory",logo:{"@type":"ImageObject",url:`${window.location.origin}/favicon.ico`}},keywords:(f=e.tags)==null?void 0:f.join(", ")},Object.keys(d).forEach(p=>{d[p]===void 0&&delete d[p]}),u=document.createElement("script"),u.type="application/ld+json",u.textContent=JSON.stringify(d),u.id="rainfactory-structured-data",document.head.appendChild(u));let h=null;if(e.breadcrumbs&&e.breadcrumbs.length>0){const p={"@context":"https://schema.org","@type":"BreadcrumbList",itemListElement:e.breadcrumbs.map((A,v)=>({"@type":"ListItem",position:v+1,name:A.name,item:A.url}))};h=document.createElement("script"),h.type="application/ld+json",h.textContent=JSON.stringify(p),h.id="rainfactory-breadcrumb-data",document.head.appendChild(h)}let m=null;if(e.faqItems&&e.faqItems.length>0){const p={"@context":"https://schema.org","@type":"FAQPage",mainEntity:e.faqItems.map(A=>({"@type":"Question",name:A.question,acceptedAnswer:{"@type":"Answer",text:A.answer}}))};m=document.createElement("script"),m.type="application/ld+json",m.textContent=JSON.stringify(p),m.id="rainfactory-faq-data",document.head.appendChild(m)}return()=>{document.title=t,Object.keys(r).forEach(p=>{const v=p.startsWith("og:")||p.startsWith("article:")?`meta[property="${p}"]`:`meta[name="${p}"]`,x=document.querySelector(v);x&&(s[p]===null?x.remove():s[p]&&(x.content=s[p]))}),u&&u.remove(),h&&h.remove(),m&&m.remove(),a&&(i===null?a.remove():i&&(a.href=i))}},[e.title,e.description,e.keywords,e.author,e.image,e.url,e.type,e.publishedTime,e.modifiedTime,e.readingTime,JSON.stringify(e.tags),JSON.stringify(e.breadcrumbs),JSON.stringify(e.faqItems)])}const EI=g.createContext({});function X_(e){const t=g.useRef(null);return t.current===null&&(t.current=e()),t.current}const Z_=g.createContext(null),BI=g.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});class Rbe extends g.Component{getSnapshotBeforeUpdate(t){const r=this.props.childRef.current;if(r&&t.isPresent&&!this.props.isPresent){const s=this.props.sizeRef.current;s.height=r.offsetHeight||0,s.width=r.offsetWidth||0,s.top=r.offsetTop,s.left=r.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function Ube({children:e,isPresent:t}){const r=g.useId(),s=g.useRef(null),a=g.useRef({width:0,height:0,top:0,left:0}),{nonce:i}=g.useContext(BI);return g.useInsertionEffect(()=>{const{width:o,height:l,top:c,left:d}=a.current;if(t||!s.current||!o||!l)return;s.current.dataset.motionPopId=r;const u=document.createElement("style");return i&&(u.nonce=i),document.head.appendChild(u),u.sheet&&u.sheet.insertRule(`
911          [data-motion-pop-id="${r}"] {
912            position: absolute !important;
913            width: ${o}px !important;
914            height: ${l}px !important;
915            top: ${c}px !important;
916            left: ${d}px !important;
917          }
918        `),()=>{document.head.removeChild(u)}},[t]),n.jsx(Rbe,{isPresent:t,childRef:s,sizeRef:a,children:g.cloneElement(e,{ref:s})})}const Mbe=({children:e,initial:t,isPresent:r,onExitComplete:s,custom:a,presenceAffectsLayout:i,mode:o})=>{const l=X_($be),c=g.useId(),d=g.useCallback(h=>{l.set(h,!0);for(const m of l.values())if(!m)return;s&&s()},[l,s]),u=g.useMemo(()=>({id:c,initial:t,isPresent:r,custom:a,onExitComplete:d,register:h=>(l.set(h,!1),()=>l.delete(h))}),i?[Math.random(),d]:[r,d]);return g.useMemo(()=>{l.forEach((h,m)=>l.set(m,!1))},[r]),g.useEffect(()=>{!r&&!l.size&&s&&s()},[r]),o==="popLayout"&&(e=n.jsx(Ube,{isPresent:r,children:e})),n.jsx(Z_.Provider,{value:u,children:e})};function $be(){return new Map}function OK(e=!0){const t=g.useContext(Z_);if(t===null)return[!0,null];const{isPresent:r,onExitComplete:s,register:a}=t,i=g.useId();g.useEffect(()=>{e&&a(i)},[e]);const o=g.useCallback(()=>e&&s&&s(i),[i,s,e]);return!r&&s?[!1,o]:[!0]}const e1=e=>e.key||"";function JR(e){const t=[];
vendor: 30,596 bytes, line 918
918return g.Children.forEach(e,r=>{g.isValidElement(r)&&t.push(r)}),t}const TI=typeof window<"u",PI=TI?g.useLayoutEffect:g.useEffect,qh=({children:e,custom:t,initial:r=!0,onExitComplete:s,presenceAffectsLayout:a=!0,mode:i="sync",propagate:o=!1})=>{const[l,c]=OK(o),d=g.useMemo(()=>JR(e),[e]),u=o&&!l?[]:d.map(e1),h=g.useRef(!0),m=g.useRef(d),f=X_(()=>new Map),[p,A]=g.useState(d),[v,x]=g.useState(d);PI(()=>{h.current=!1,m.current=d;for(let w=0;w<v.length;w++){const j=e1(v[w]);u.includes(j)?f.delete(j):f.get(j)!==!0&&f.set(j,!1)}},[v,u.length,u.join("-")]);const b=[];if(d!==p){let w=[...d];for(let j=0;j<v.length;j++){const N=v[j],_=e1(N);u.includes(_)||(w.splice(j,0,N),b.push(N))}i==="wait"&&b.length&&(w=b),x(JR(w)),A(d);return}const{forceRender:y}=g.useContext(EI);return n.jsx(n.Fragment,{children:v.map(w=>{const j=e1(w),N=o&&!l?!1:d===v||u.includes(j),_=()=>{if(f.has(j))f.set(j,!0);else return;let S=!0;f.forEach(C=>{C||(S=!1)}),S&&(y==null||y(),x(m.current),o&&(c==null||c()),s&&s())};return n.jsx(Mbe,{isPresent:N,initial:!h.current||r?void 0:!1,custom:N?void 0:t,presenceAffectsLayout:a,mode:i,onExitComplete:N?void 0:_,children:w},j)})})},Jo=e=>e;let FK=Jo;function II(e){let t;return()=>(t===void 0&&(t=e()),t)}const dg=(e,t,r)=>{const s=t-e;return s===0?1:(r-e)/s},xu=e=>e*1e3,vu=e=>e/1e3,Qbe={useManualTiming:!1};function Hbe(e){let t=new Set,r=new Set,s=!1,a=!1;const i=new WeakSet;let o={delta:0,timestamp:0,isProcessing:!1};function l(d){i.has(d)&&(c.schedule(d),e()),d(o)}const c={schedule:(d,u=!1,h=!1)=>{const f=h&&s?t:r;return u&&i.add(d),f.has(d)||f.add(d),d},cancel:d=>{r.delete(d),i.delete(d)},process:d=>{if(o=d,s){a=!0;return}s=!0,[t,r]=[r,t],t.forEach(l),t.clear(),s=!1,a&&(a=!1,c.process(d))}};return c}const t1=["read","resolveKeyframes","update","preRender","render","postRender"],zbe=40;function LK(e,t){let r=!1,s=!0;const a={delta:0,timestamp:0,isProcessing:!1},i=()=>r=!0,o=t1.reduce((x,b)=>(x[b]=Hbe(i),x),{}),{read:l,resolveKeyframes:c,update:d,preRender:u,render:h,postRender:m}=o,f=()=>{const x=performance.now();r=!1,a.delta=s?1e3/60:Math.max(Math.min(x-a.timestamp,zbe),1),a.timestamp=x,a.isProcessing=!0,l.process(a),c.process(a),d.process(a),u.process(a),h.process(a),m.process(a),a.isProcessing=!1,r&&t&&(s=!1,e(f))},p=()=>{r=!0,s=!0,a.isProcessing||e(f)};return{schedule:t1.reduce((x,b)=>{const y=o[b];return x[b]=(w,j=!1,N=!1)=>(r||p(),y.schedule(w,j,N)),x},{}),cancel:x=>{for(let b=0;b<t1.length;b++)o[t1[b]].cancel(x)},state:a,steps:o}}const{schedule:ms,cancel:Kh,state:ii,steps:b5}=LK(typeof requestAnimationFrame<"u"?requestAnimationFrame:Jo,!0),DK=g.createContext({strict:!1}),XR={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},ug={};for(const e in XR)ug[e]={isEnabled:t=>XR[e].some(r=>!!t[r])};function Vbe(e){for(const t in e)ug[t]={...ug[t],...e[t]}}const Gbe=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function j2(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||Gbe.has(e)}let RK=e=>!j2(e);function qbe(e){e&&(RK=t=>t.startsWith("on")?!j2(t):e(t))}try{qbe(require("@emotion/is-prop-valid").default)}catch{}function Kbe(e,t,r){const s={};for(const a in e)a==="values"&&typeof e.values=="object"||(RK(a)||r===!0&&j2(a)||!t&&!j2(a)||e.draggable&&a.startsWith("onDrag"))&&(s[a]=e[a]);return s}function Wbe(e){if(typeof Proxy>"u")return e;const t=new Map,r=(...s)=>e(...s);return new Proxy(r,{get:(s,a)=>a==="create"?e:(t.has(a)||t.set(a,e(a)),t.get(a))})}const eC=g.createContext({});function ib(e){return typeof e=="string"||Array.isArray(e)}function tC(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}const OI=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],FI=["initial",...OI];function rC(e){return tC(e.animate)||FI.some(t=>ib(e[t]))}function UK(e){return!!(rC(e)||e.variants)}function Ybe(e,t){if(rC(e)){const{initial:r,animate:s}=e;return{initial:r===!1||ib(r)?r:void 0,animate:ib(s)?s:void 0}}return e.inherit!==!1?t:{}}function Jbe(e){const{initial:t,animate:r}=Ybe(e,g.useContext(eC));return g.useMemo(()=>({initial:t,animate:r}),[ZR(t),ZR(r)])}function ZR(e){return Array.isArray(e)?e.join(" "):e}const Xbe=Symbol.for("motionComponentSymbol");function mA(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function Zbe(e,t,r){return g.useCallback(s=>{s&&e.onMount&&e.onMount(s),t&&(s?t.mount(s):t.unmount()),r&&(typeof r=="function"?r(s):mA(r)&&(r.current=s))},[t])}const LI=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),eye="framerAppearId",MK="data-"+LI(eye),{schedule:DI}=LK(queueMicrotask,!1),$K=g.createContext({});function tye(e,t,r,s,a){var i,o;const{visualElement:l}=g.useContext(eC),c=g.useContext(DK),d=g.useContext(Z_),u=g.useContext(BI).reducedMotion,h=g.useRef(null);s=s||c.renderer,!h.current&&s&&(h.current=s(e,{visualState:t,parent:l,props:r,presenceContext:d,blockInitialAnimation:d?d.initial===!1:!1,reducedMotionConfig:u}));const m=h.current,f=g.useContext($K);m&&!m.projection&&a&&(m.type==="html"||m.type==="svg")&&rye(h.current,r,a,f);const p=g.useRef(!1);g.useInsertionEffect(()=>{m&&p.current&&m.update(r,d)});const A=r[MK],v=g.useRef(!!A&&!(!((i=window.MotionHandoffIsComplete)===null||i===void 0)&&i.call(window,A))&&((o=window.MotionHasOptimisedAnimation)===null||o===void 0?void 0:o.call(window,A)));return PI(()=>{m&&(p.current=!0,window.MotionIsMounted=!0,m.updateFeatures(),DI.render(m.render),v.current&&m.animationState&&m.animationState.animateChanges())}),g.useEffect(()=>{m&&(!v.current&&m.animationState&&m.animationState.animateChanges(),v.current&&(queueMicrotask(()=>{var x;(x=window.MotionHandoffMarkAsComplete)===null||x===void 0||x.call(window,A)}),v.current=!1))}),m}function rye(e,t,r,s){const{layoutId:a,layout:i,drag:o,dragConstraints:l,layoutScroll:c,layoutRoot:d}=t;e.projection=new r(e.latestValues,t["data-framer-portal-id"]?void 0:QK(e.parent)),e.projection.setOptions({layoutId:a,layout:i,alwaysMeasureLayout:!!o||l&&mA(l),visualElement:e,animationType:typeof i=="string"?i:"both",initialPromotionConfig:s,layoutScroll:c,layoutRoot:d})}function QK(e){if(e)return e.options.allowProjection!==!1?e.projection:QK(e.parent)}function nye({preloadedFeatures:e,createVisualElement:t,useRender:r,useVisualState:s,Component:a}){var i,o;e&&Vbe(e);function l(d,u){let h;const m={...g.useContext(BI),...d,layoutId:sye(d)},{isStatic:f}=m,p=Jbe(d),A=s(d,f);if(!f&&TI){aye();const v=iye(m);h=v.MeasureLayout,p.visualElement=tye(a,A,m,t,v.ProjectionNode)}return n.jsxs(eC.Provider,{value:p,children:[h&&p.visualElement?n.jsx(h,{visualElement:p.visualElement,...m}):null,r(a,d,Zbe(A,p.visualElement,u),A,f,p.visualElement)]})}l.displayName=`motion.${typeof a=="string"?a:`create(${(o=(i=a.displayName)!==null&&i!==void 0?i:a.name)!==null&&o!==void 0?o:""})`}`;const c=g.forwardRef(l);return c[Xbe]=a,c}function sye({layoutId:e}){const t=g.useContext(EI).id;return t&&e!==void 0?t+"-"+e:e}function aye(e,t){g.useContext(DK).strict}function iye(e){const{drag:t,layout:r}=ug;if(!t&&!r)return{};const s={...t,...r};return{MeasureLayout:t!=null&&t.isEnabled(e)||r!=null&&r.isEnabled(e)?s.MeasureLayout:void 0,ProjectionNode:s.ProjectionNode}}const oye=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function RI(e){return typeof e!="string"||e.includes("-")?!1:!!(oye.indexOf(e)>-1||/[A-Z]/u.test(e))}function eU(e){const t=[{},{}];return e==null||e.values.forEach((r,s)=>{t[0][s]=r.get(),t[1][s]=r.getVelocity()}),t}function UI(e,t,r,s){if(typeof t=="function"){const[a,i]=eU(s);t=t(r!==void 0?r:e.custom,a,i)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[a,i]=eU(s);t=t(r!==void 0?r:e.custom,a,i)}return t}const _B=e=>Array.isArray(e),lye=e=>!!(e&&typeof e=="object"&&e.mix&&e.toValue),cye=e=>_B(e)?e[e.length-1]||0:e,ki=e=>!!(e&&e.getVelocity);function Cj(e){const t=ki(e)?e.get():e;return lye(t)?t.toValue():t}function dye({scrapeMotionValuesFromProps:e,createRenderState:t,onUpdate:r},s,a,i){const o={latestValues:uye(s,a,i,e),renderState:t()};return r&&(o.onMount=l=>r({props:s,current:l,...o}),o.onUpdate=l=>r(l)),o}const HK=e=>(t,r)=>{const s=g.useContext(eC),a=g.useContext(Z_),i=()=>dye(e,t,s,a);return r?i():X_(i)};function uye(e,t,r,s){const a={},i=s(e,{});for(const m in i)a[m]=Cj(i[m]);let{initial:o,animate:l}=e;const c=rC(e),d=UK(e);t&&d&&!c&&e.inherit!==!1&&(o===void 0&&(o=t.initial),l===void 0&&(l=t.animate));let u=r?r.initial===!1:!1;u=u||o===!1;const h=u?l:o;if(h&&typeof h!="boolean"&&!tC(h)){const m=Array.isArray(h)?h:[h];for(let f=0;f<m.length;f++){const p=UI(e,m[f]);if(p){const{transitionEnd:A,transition:v,...x}=p;for(const b in x){let y=x[b];if(Array.isArray(y)){const w=u?y.length-1:0;y=y[w]}y!==null&&(a[b]=y)}for(const b in A)a[b]=A[b]}}}return a}const s0=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Zm=new Set(s0),zK=e=>t=>typeof t=="string"&&t.startsWith(e),VK=zK("--"),hye=zK("var(--"),MI=e=>hye(e)?fye.test(e.split("/*")[0].trim()):!1,fye=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,GK=(e,t)=>t&&typeof e=="number"?t.transform(e):e,Su=(e,t,r)=>r>t?t:r<e?e:r,a0={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},ob={...a0,transform:e=>Su(0,1,e)},r1={...a0,default:1},By=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),dh=By("deg"),cd=By("%"),dr=By("px"),mye=By("vh"),pye=By("vw"),tU={...cd,parse:e=>cd.parse(e)/100,transform:e=>cd.transform(e*100)},Aye={borderWidth:dr,borderTopWidth:dr,borderRightWidth:dr,borderBottomWidth:dr,borderLeftWidth:dr,borderRadius:dr,radius:dr,borderTopLeftRadius:dr,borderTopRightRadius:dr,borderBottomRightRadius:dr,borderBottomLeftRadius:dr,width:dr,maxWidth:dr,height:dr,maxHeight:dr,top:dr,right:dr,bottom:dr,left:dr,padding:dr,paddingTop:dr,paddingRight:dr,paddingBottom:dr,paddingLeft:dr,margin:dr,marginTop:dr,marginRight:dr,marginBottom:dr,marginLeft:dr,backgroundPositionX:dr,backgroundPositionY:dr},gye={rotate:dh,rotateX:dh,rotateY:dh,rotateZ:dh,scale:r1,scaleX:r1,scaleY:r1,scaleZ:r1,skew:dh,skewX:dh,skewY:dh,distance:dr,translateX:dr,translateY:dr,translateZ:dr,x:dr,y:dr,z:dr,perspective:dr,transformPerspective:dr,opacity:ob,originX:tU,originY:tU,originZ:dr},rU={...a0,transform:Math.round},$I={...Aye,...gye,zIndex:rU,size:dr,fillOpacity:ob,strokeOpacity:ob,numOctaves:rU},xye={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},vye=s0.length;function bye(e,t,r){let s="",a=!0;for(let i=0;i<vye;i++){const o=s0[i],l=e[o];if(l===void 0)continue;let c=!0;if(typeof l=="number"?c=l===(o.startsWith("scale")?1:0):c=parseFloat(l)===0,!c||r){const d=GK(l,$I[o]);if(!c){a=!1;const u=xye[o]||o;s+=`${u}(${d}) `}r&&(t[o]=d)}}return s=s.trim(),r?s=r(t,a?"":s):a&&(s="none"),s}function QI(e,t,r){const{style:s,vars:a,transformOrigin:i}=e;let o=!1,l=!1;for(const c in t){const d=t[c];if(Zm.has(c)){o=!0;continue}else if(VK(c)){a[c]=d;continue}else{const u=GK(d,$I[c]);c.startsWith("origin")?(l=!0,i[c]=u):s[c]=u}}if(t.transform||(o||r?s.transform=bye(t,e.transform,r):s.transform&&(s.transform="none")),l){const{originX:c="50%",originY:d="50%",originZ:u=0}=i;s.transformOrigin=`${c} ${d} ${u}`}}const yye={offset:"stroke-dashoffset",array:"stroke-dasharray"},wye={offset:"strokeDashoffset",array:"strokeDasharray"};function jye(e,t,r=1,s=0,a=!0){e.pathLength=1;const i=a?yye:wye;e[i.offset]=dr.transform(-s);const o=dr.transform(t),l=dr.transform(r);e[i.array]=`${o} ${l}`}function nU(e,t,r){return typeof e=="string"?e:dr.transform(t+r*e)}function Nye(e,t,r){const s=nU(t,e.x,e.width),a=nU(r,e.y,e.height);return`${s} ${a}`}function HI(e,{attrX:t,attrY:r,attrScale:s,originX:a,originY:i,pathLength:o,pathSpacing:l=1,pathOffset:c=0,...d},u,h){if(QI(e,d,h),u){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:m,style:f,dimensions:p}=e;m.transform&&(p&&(f.transform=m.transform),delete m.transform),p&&(a!==void 0||i!==void 0||f.transform)&&(f.transformOrigin=Nye(p,a!==void 0?a:.5,i!==void 0?i:.5)),t!==void 0&&(m.x=t),r!==void 0&&(m.y=r),s!==void 0&&(m.scale=s),o!==void 0&&jye(m,o,l,c,!1)}const zI=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),qK=()=>({...zI(),attrs:{}}),VI=e=>typeof e=="string"&&e.toLowerCase()==="svg";function KK(e,{style:t,vars:r},s,a){Object.assign(e.style,t,a&&a.getProjectionStyles(s));for(const i in r)e.style.setProperty(i,r[i])}const WK=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function YK(e,t,r,s){KK(e,t,void 0,s);for(const a in t.attrs)e.setAttribute(WK.has(a)?a:LI(a),t.attrs[a])}const N2={};function _ye(e){Object.assign(N2,e)}function JK(e,{layout:t,layoutId:r}){return Zm.has(e)||e.startsWith("origin")||(t||r!==void 0)&&(!!N2[e]||e==="opacity")}function GI(e,t,r){var s;const{style:a}=e,i={};for(const o in a)(ki(a[o])||t.style&&ki(t.style[o])||JK(o,e)||((s=r==null?void 0:r.getValue(o))===null||s===void 0?void 0:s.liveStyle)!==void 0)&&(i[o]=a[o]);return i}function XK(e,t,r){const s=GI(e,t,r);for(const a in e)if(ki(e[a])||ki(t[a])){const i=s0.indexOf(a)!==-1?"attr"+a.charAt(0).toUpperCase()+a.substring(1):a;s[i]=e[a]}return s}function Cye(e,t){try{t.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{t.dimensions={x:0,y:0,width:0,height:0}}}const sU=["x","y","width","height","cx","cy","r"],Sye={useVisualState:HK({scrapeMotionValuesFromProps:XK,createRenderState:qK,onUpdate:({props:e,prevProps:t,current:r,renderState:s,latestValues:a})=>{if(!r)return;let i=!!e.drag;if(!i){for(const l in a)if(Zm.has(l)){i=!0;break}}if(!i)return;let o=!t;if(t)for(let l=0;l<sU.length;l++){const c=sU[l];e[c]!==t[c]&&(o=!0)}o&&ms.read(()=>{Cye(r,s),ms.render(()=>{HI(s,a,VI(r.tagName),e.transformTemplate),YK(r,s)})})}})},kye={useVisualState:HK({scrapeMotionValuesFromProps:GI,createRenderState:zI})};function ZK(e,t,r){for(const s in t)!ki(t[s])&&!JK(s,r)&&(e[s]=t[s])}function Eye({transformTemplate:e},t){return g.useMemo(()=>{const r=zI();return QI(r,t,e),Object.assign({},r.vars,r.style)},[t])}function Bye(e,t){const r=e.style||{},s={};return ZK(s,r,e),Object.assign(s,Eye(e,t)),s}function Tye(e,t){const r={},s=Bye(e,t);return e.drag&&e.dragListener!==!1&&(r.draggable=!1,s.userSelect=s.WebkitUserSelect=s.WebkitTouchCallout="none",s.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(r.tabIndex=0),r.style=s,r}function Pye(e,t,r,s){const a=g.useMemo(()=>{const i=qK();return HI(i,t,VI(s),e.transformTemplate),{...i.attrs,style:{...i.style}}},[t]);if(e.style){const i={};ZK(i,e.style,e),a.style={...i,...a.style}}return a}function Iye(e=!1){return(r,s,a,{latestValues:i},o)=>{const c=(RI(r)?Pye:Tye)(s,i,o,r),d=Kbe(s,typeof r=="string",e),u=r!==g.Fragment?{...d,...c,ref:a}:{},{children:h}=s,m=g.useMemo(()=>ki(h)?h.get():h,[h]);return g.createElement(r,{...u,children:m})}}function Oye(e,t){return function(s,{forwardMotionProps:a}={forwardMotionProps:!1}){const o={...RI(s)?Sye:kye,preloadedFeatures:e,useRender:Iye(a),createVisualElement:t,Component:s};return nye(o)}}function eW(e,t){if(!Array.isArray(t))return!1;const r=t.length;if(r!==e.length)return!1;for(let s=0;s<r;s++)if(t[s]!==e[s])return!1;return!0}function nC(e,t,r){const s=e.getProps();return UI(s,t,r!==void 0?r:s.custom,e)}const Fye=II(()=>window.ScrollTimeline!==void 0);class Lye{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map(t=>"finished"in t?t.finished:t))}getAll(t){return this.animations[0][t]}setAll(t,r){for(let s=0;s<this.animations.length;s++)this.animations[s][t]=r}attachTimeline(t,r){const s=this.animations.map(a=>{if(Fye()&&a.attachTimeline)return a.attachTimeline(t);if(typeof r=="function")return r(a)});return()=>{s.forEach((a,i)=>{a&&a(),this.animations[i].stop()})}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get startTime(){return this.getAll("startTime")}get duration(){let t=0;for(let r=0;r<this.animations.length;r++)t=Math.max(t,this.animations[r].duration);return t}runAll(t){this.animations.forEach(r=>r[t]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class Dye extends Lye{then(t,r){return Promise.all(this.animations).then(t).catch(r)}}function qI(e,t){return e?e[t]||e.default||e:void 0}const CB=2e4;function tW(e){let t=0;const r=50;let s=e.next(t);for(;!s.done&&t<CB;)t+=r,s=e.next(t);return t>=CB?1/0:t}function KI(e){return typeof e=="function"}function aU(e,t){e.timeline=t,e.onfinish=null}const WI=e=>Array.isArray(e)&&typeof e[0]=="number",Rye={linearEasing:void 0};function Uye(e,t){const r=II(e);return()=>{var s;return(s=Rye[t])!==null&&s!==void 0?s:r()}}const _2=Uye(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),rW=(e,t,r=10)=>{let s="";const a=Math.max(Math.round(t/r),2);for(let i=0;i<a;i++)s+=e(dg(0,a-1,i))+", ";return`linear(${s.substring(0,s.length-2)})`};function nW(e){return!!(typeof e=="function"&&_2()||!e||typeof e=="string"&&(e in SB||_2())||WI(e)||Array.isArray(e)&&e.every(nW))}const Vx=([e,t,r,s])=>`cubic-bezier(${e}, ${t}, ${r}, ${s})`,SB={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Vx([0,.65,.55,1]),circOut:Vx([.55,0,1,.45]),backIn:Vx([.31,.01,.66,-.59]),backOut:Vx([.33,1.53,.69,.99])};function sW(e,t){if(e)return typeof e=="function"&&_2()?rW(e,t):WI(e)?Vx(e):Array.isArray(e)?e.map(r=>sW(r,t)||SB.easeOut):SB[e]}const cc={x:!1,y:!1};function aW(){return cc.x||cc.y}function Mye(e,t,r){var s;if(e instanceof Element)return[e];if(typeof e=="string"){let a=document;const i=(s=void 0)!==null&&s!==void 0?s:a.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e)}function iW(e,t){const r=Mye(e),s=new AbortController,a={passive:!0,...t,signal:s.signal};return[r,a,()=>s.abort()]}function iU(e){return t=>{t.pointerType==="touch"||aW()||e(t)}}function $ye(e,t,r={}){const[s,a,i]=iW(e,r),o=iU(l=>{const{target:c}=l,d=t(l);if(typeof d!="function"||!c)return;const u=iU(h=>{d(h),c.removeEventListener("pointerleave",u)});c.addEventListener("pointerleave",u,a)});return s.forEach(l=>{l.addEventListener("pointerenter",o,a)}),i}const oW=(e,t)=>t?e===t?!0:oW(e,t.parentElement):!1,YI=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,Qye=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function Hye(e){return Qye.has(e.tagName)||e.tabIndex!==-1}const Gx=new WeakSet;function oU(e){return t=>{t.key==="Enter"&&e(t)}}function y5(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const zye=(e,t)=>{const r=e.currentTarget;if(!r)return;const s=oU(()=>{if(Gx.has(r))return;y5(r,"down");const a=oU(()=>{y5(r,"up")}),i=()=>y5(r,"cancel");r.addEventListener("keyup",a,t),r.addEventListener("blur",i,t)});r.addEventListener("keydown",s,t),r.addEventListener("blur",()=>r.removeEventListener("keydown",s),t)};function lU(e){return YI(e)&&!aW()}function Vye(e,t,r={}){const[s,a,i]=iW(e,r),o=l=>{const c=l.currentTarget;if(!lU(l)||Gx.has(c))return;Gx.add(c);const d=t(l),u=(f,p)=>{window.removeEventListener("pointerup",h),window.removeEventListener("pointercancel",m),!(!lU(f)||!Gx.has(c))&&(Gx.delete(c),typeof d=="function"&&d(f,{success:p}))},h=f=>{u(f,r.useGlobalTarget||oW(c,f.target))},m=f=>{u(f,!1)};window.addEventListener("pointerup",h,a),window.addEventListener("pointercancel",m,a)};return s.forEach(l=>{!Hye(l)&&l.getAttribute("tabindex")===null&&(l.tabIndex=0),(r.useGlobalTarget?window:l).addEventListener("pointerdown",o,a),l.addEventListener("focus",d=>zye(d,a),a)}),i}function Gye(e){return e==="x"||e==="y"?cc[e]?null:(cc[e]=!0,()=>{cc[e]=!1}):cc.x||cc.y?null:(cc.x=cc.y=!0,()=>{cc.x=cc.y=!1})}const lW=new Set(["width","height","top","left","right","bottom",...s0]);let Sj;function qye(){Sj=void 0}const dd={now:()=>(Sj===void 0&&dd.set(ii.isProcessing||Qbe.useManualTiming?ii.timestamp:performance.now()),Sj),set:e=>{Sj=e,queueMicrotask(qye)}};function JI(e,t){e.indexOf(t)===-1&&e.push(t)}function XI(e,t){const r=e.indexOf(t);r>-1&&e.splice(r,1)}class ZI{constructor(){this.subscriptions=[]}add(t){return JI(this.subscriptions,t),()=>XI(this.subscriptions,t)}notify(t,r,s){const a=this.subscriptions.length;if(a)if(a===1)this.subscriptions[0](t,r,s);else for(let i=0;i<a;i++){const o=this.subscriptions[i];o&&o(t,r,s)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}function cW(e,t){return t?e*(1e3/t):0}const cU=30,Kye=e=>!isNaN(parseFloat(e));class Wye{constructor(t,r={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(s,a=!0)=>{const i=dd.now();this.updatedAt!==i&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(s),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),a&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(t),this.owner=r.owner}setCurrent(t){this.current=t,this.updatedAt=dd.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=Kye(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,r){this.events[t]||(this.events[t]=new ZI);const s=this.events[t].add(r);return t==="change"?()=>{s(),ms.read(()=>{this.events.change.getSize()||this.stop()})}:s}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,r){this.passiveEffect=t,this.stopPassiveEffect=r}set(t,r=!0){!r||!this.passiveEffect?this.updateAndNotify(t,r):this.passiveEffect(t,this.updateAndNotify)}setWithVelocity(t,r,s){this.set(r),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-s}jump(t,r=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,r&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=dd.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>cU)return 0;const r=Math.min(this.updatedAt-this.prevUpdatedAt,cU);return cW(parseFloat(this.current)-parseFloat(this.prevFrameValue),r)}start(t){return this.stop(),new Promise(r=>{this.hasAnimated=!0,this.animation=t(r),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function lb(e,t){return new Wye(e,t)}function Yye(e,t,r){e.hasValue(t)?e.getValue(t).set(r):e.addValue(t,lb(r))}function eO(e,t){const r=nC(e,t);let{transitionEnd:s={},transition:a={},...i}=r||{};i={...i,...s};for(const o in i){const l=cye(i[o]);Yye(e,o,l)}}function Jye(e){return!!(ki(e)&&e.add)}function kB(e,t){const r=e.getValue("willChange");if(Jye(r))return r.add(t)}function dW(e){return e.props[MK]}const uW=(e,t,r)=>(((1-3*r+3*t)*e+(3*r-6*t))*e+3*t)*e,Xye=1e-7,Zye=12;function ewe(e,t,r,s,a){let i,o,l=0;do o=t+(r-t)/2,i=uW(o,s,a)-e,i>0?r=o:t=o;while(Math.abs(i)>Xye&&++l<Zye);return o}function Ty(e,t,r,s){if(e===t&&r===s)return Jo;const a=i=>ewe(i,0,1,e,r);return i=>i===0||i===1?i:uW(a(i),t,s)}const hW=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,fW=e=>t=>1-e(1-t),mW=Ty(.33,1.53,.69,.99),tO=fW(mW),pW=hW(tO),AW=e=>(e*=2)<1?.5*tO(e):.5*(2-Math.pow(2,-10*(e-1))),rO=e=>1-Math.sin(Math.acos(e)),gW=fW(rO),xW=hW(rO),vW=e=>/^0[^.\s]+$/u.test(e);function twe(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||vW(e):!0}const uv=e=>Math.round(e*1e5)/1e5,nO=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function rwe(e){return e==null}const nwe=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,sO=(e,t)=>r=>!!(typeof r=="string"&&nwe.test(r)&&r.startsWith(e)||t&&!rwe(r)&&Object.prototype.hasOwnProperty.call(r,t)),bW=(e,t,r)=>s=>{if(typeof s!="string")return s;const[a,i,o,l]=s.match(nO);return{[e]:parseFloat(a),[t]:parseFloat(i),[r]:parseFloat(o),alpha:l!==void 0?parseFloat(l):1}},swe=e=>Su(0,255,e),w5={...a0,transform:e=>Math.round(swe(e))},dm={test:sO("rgb","red"),parse:bW("red","green","blue"),transform:({red:e,green:t,blue:r,alpha:s=1})=>"rgba("+w5.transform(e)+", "+w5.transform(t)+", "+w5.transform(r)+", "+uv(ob.transform(s))+")"};function awe(e){let t="",r="",s="",a="";return e.length>5?(t=e.substring(1,3),r=e.substring(3,5),s=e.substring(5,7),a=e.substring(7,9)):(t=e.substring(1,2),r=e.substring(2,3),s=e.substring(3,4),a=e.substring(4,5),t+=t,r+=r,s+=s,a+=a),{red:parseInt(t,16),green:parseInt(r,16),blue:parseInt(s,16),alpha:a?parseInt(a,16)/255:1}}const EB={test:sO("#"),parse:awe,transform:dm.transform},pA={test:sO("hsl","hue"),parse:bW("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:r,alpha:s=1})=>"hsla("+Math.round(e)+", "+cd.transform(uv(t))+", "+cd.transform(uv(r))+", "+uv(ob.transform(s))+")"},ji={test:e=>dm.test(e)||EB.test(e)||pA.test(e),parse:e=>dm.test(e)?dm.parse(e):pA.test(e)?pA.parse(e):EB.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?dm.transform(e):pA.transform(e)},iwe=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function owe(e){var t,r;return isNaN(e)&&typeof e=="string"&&(((t=e.match(nO))===null||t===void 0?void 0:t.length)||0)+(((r=e.match(iwe))===null||r===void 0?void 0:r.length)||0)>0}const yW="number",wW="color",lwe="var",cwe="var(",dU="${}",dwe=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function cb(e){const t=e.toString(),r=[],s={color:[],number:[],var:[]},a=[];let i=0;const l=t.replace(dwe,c=>(ji.test(c)?(s.color.push(i),a.push(wW),r.push(ji.parse(c))):c.startsWith(cwe)?(s.var.push(i),a.push(lwe),r.push(c)):(s.number.push(i),a.push(yW),r.push(parseFloat(c))),++i,dU)).split(dU);return{values:r,split:l,indexes:s,types:a}}function jW(e){return cb(e).values}function NW(e){const{split:t,types:r}=cb(e),s=t.length;return a=>{let i="";for(let o=0;o<s;o++)if(i+=t[o],a[o]!==void 0){const l=r[o];l===yW?i+=uv(a[o]):l===wW?i+=ji.transform(a[o]):i+=a[o]}return i}}const uwe=e=>typeof e=="number"?0:e;function hwe(e){const t=jW(e);return NW(e)(t.map(uwe))}const Wh={test:owe,parse:jW,createTransformer:NW,getAnimatableNone:hwe},fwe=new Set(["brightness","contrast","saturate","opacity"]);function mwe(e){const[t,r]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[s]=r.match(nO)||[];if(!s)return e;const a=r.replace(s,"");let i=fwe.has(t)?1:0;return s!==r&&(i*=100),t+"("+i+a+")"}const pwe=/\b([a-z-]*)\(.*?\)/gu,BB={...Wh,getAnimatableNone:e=>{const t=e.match(pwe);return t?t.map(mwe).join(" "):e}},Awe={...$I,color:ji,backgroundColor:ji,outlineColor:ji,fill:ji,stroke:ji,borderColor:ji,borderTopColor:ji,borderRightColor:ji,borderBottomColor:ji,borderLeftColor:ji,filter:BB,WebkitFilter:BB},aO=e=>Awe[e];function _W(e,t){let r=aO(e);return r!==BB&&(r=Wh),r.getAnimatableNone?r.getAnimatableNone(t):void 0}const gwe=new Set(["auto","none","0"]);function xwe(e,t,r){let s=0,a;for(;s<e.length&&!a;){const i=e[s];typeof i=="string"&&!gwe.has(i)&&cb(i).values.length&&(a=e[s]),s++}if(a&&r)for(const i of t)e[i]=_W(r,a)}const uU=e=>e===a0||e===dr,hU=(e,t)=>parseFloat(e.split(", ")[t]),fU=(e,t)=>(r,{transform:s})=>{if(s==="none"||!s)return 0;const a=s.match(/^matrix3d\((.+)\)$/u);if(a)return hU(a[1],t);{const i=s.match(/^matrix\((.+)\)$/u);return i?hU(i[1],e):0}},vwe=new Set(["x","y","z"]),bwe=s0.filter(e=>!vwe.has(e));function ywe(e){const t=[];return bwe.forEach(r=>{const s=e.getValue(r);s!==void 0&&(t.push([r,s.get()]),s.set(r.startsWith("scale")?1:0))}),t}const hg={width:({x:e},{paddingLeft:t="0",paddingRight:r="0"})=>e.max-e.min-parseFloat(t)-parseFloat(r),height:({y:e},{paddingTop:t="0",paddingBottom:r="0"})=>e.max-e.min-parseFloat(t)-parseFloat(r),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:fU(4,13),y:fU(5,14)};hg.translateX=hg.x;hg.translateY=hg.y;const bm=new Set;let TB=!1,PB=!1;function CW(){if(PB){const e=Array.from(bm).filter(s=>s.needsMeasurement),t=new Set(e.map(s=>s.element)),r=new Map;t.forEach(s=>{const a=ywe(s);a.length&&(r.set(s,a),s.render())}),e.forEach(s=>s.measureInitialState()),t.forEach(s=>{s.render();const a=r.get(s);a&&a.forEach(([i,o])=>{var l;(l=s.getValue(i))===null||l===void 0||l.set(o)})}),e.forEach(s=>s.measureEndState()),e.forEach(s=>{s.suspendedScrollY!==void 0&&window.scrollTo(0,s.suspendedScrollY)})}
vendor: 13,873 bytes, line 918
918PB=!1,TB=!1,bm.forEach(e=>e.complete()),bm.clear()}function SW(){bm.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(PB=!0)})}function wwe(){SW(),CW()}class iO{constructor(t,r,s,a,i,o=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...t],this.onComplete=r,this.name=s,this.motionValue=a,this.element=i,this.isAsync=o}scheduleResolve(){this.isScheduled=!0,this.isAsync?(bm.add(this),TB||(TB=!0,ms.read(SW),ms.resolveKeyframes(CW))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:r,element:s,motionValue:a}=this;for(let i=0;i<t.length;i++)if(t[i]===null)if(i===0){const o=a==null?void 0:a.get(),l=t[t.length-1];if(o!==void 0)t[0]=o;else if(s&&r){const c=s.readValue(r,l);c!=null&&(t[0]=c)}t[0]===void 0&&(t[0]=l),a&&o===void 0&&a.set(t[0])}else t[i]=t[i-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),bm.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,bm.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const kW=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),jwe=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Nwe(e){const t=jwe.exec(e);if(!t)return[,];const[,r,s,a]=t;return[`--${r??s}`,a]}function EW(e,t,r=1){const[s,a]=Nwe(e);if(!s)return;const i=window.getComputedStyle(t).getPropertyValue(s);if(i){const o=i.trim();return kW(o)?parseFloat(o):o}return MI(a)?EW(a,t,r+1):a}const BW=e=>t=>t.test(e),_we={test:e=>e==="auto",parse:e=>e},TW=[a0,dr,cd,dh,pye,mye,_we],mU=e=>TW.find(BW(e));class PW extends iO{constructor(t,r,s,a,i){super(t,r,s,a,i,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:r,name:s}=this;if(!r||!r.current)return;super.readKeyframes();for(let c=0;c<t.length;c++){let d=t[c];if(typeof d=="string"&&(d=d.trim(),MI(d))){const u=EW(d,r.current);u!==void 0&&(t[c]=u),c===t.length-1&&(this.finalKeyframe=d)}}if(this.resolveNoneKeyframes(),!lW.has(s)||t.length!==2)return;const[a,i]=t,o=mU(a),l=mU(i);if(o!==l)if(uU(o)&&uU(l))for(let c=0;c<t.length;c++){const d=t[c];typeof d=="string"&&(t[c]=parseFloat(d))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:r}=this,s=[];for(let a=0;a<t.length;a++)twe(t[a])&&s.push(a);s.length&&xwe(t,s,r)}measureInitialState(){const{element:t,unresolvedKeyframes:r,name:s}=this;if(!t||!t.current)return;s==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=hg[s](t.measureViewportBox(),window.getComputedStyle(t.current)),r[0]=this.measuredOrigin;const a=r[r.length-1];a!==void 0&&t.getValue(s,a).jump(a,!1)}measureEndState(){var t;const{element:r,name:s,unresolvedKeyframes:a}=this;if(!r||!r.current)return;const i=r.getValue(s);i&&i.jump(this.measuredOrigin,!1);const o=a.length-1,l=a[o];a[o]=hg[s](r.measureViewportBox(),window.getComputedStyle(r.current)),l!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=l),!((t=this.removedTransforms)===null||t===void 0)&&t.length&&this.removedTransforms.forEach(([c,d])=>{r.getValue(c).set(d)}),this.resolveNoneKeyframes()}}const pU=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(Wh.test(e)||e==="0")&&!e.startsWith("url("));function Cwe(e){const t=e[0];if(e.length===1)return!0;for(let r=0;r<e.length;r++)if(e[r]!==t)return!0}function Swe(e,t,r,s){const a=e[0];if(a===null)return!1;if(t==="display"||t==="visibility")return!0;const i=e[e.length-1],o=pU(a,t),l=pU(i,t);return!o||!l?!1:Cwe(e)||(r==="spring"||KI(r))&&s}const kwe=e=>e!==null;function sC(e,{repeat:t,repeatType:r="loop"},s){const a=e.filter(kwe),i=t&&r!=="loop"&&t%2===1?0:a.length-1;return!i||s===void 0?a[i]:s}const Ewe=40;class IW{constructor({autoplay:t=!0,delay:r=0,type:s="keyframes",repeat:a=0,repeatDelay:i=0,repeatType:o="loop",...l}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=dd.now(),this.options={autoplay:t,delay:r,type:s,repeat:a,repeatDelay:i,repeatType:o,...l},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>Ewe?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&wwe(),this._resolved}onKeyframesResolved(t,r){this.resolvedAt=dd.now(),this.hasAttemptedResolve=!0;const{name:s,type:a,velocity:i,delay:o,onComplete:l,onUpdate:c,isGenerator:d}=this.options;if(!d&&!Swe(t,s,a,i))if(o)this.options.duration=0;else{c&&c(sC(t,this.options,r)),l&&l(),this.resolveFinishedPromise();return}const u=this.initPlayback(t,r);u!==!1&&(this._resolved={keyframes:t,finalKeyframe:r,...u},this.onPostResolved())}onPostResolved(){}then(t,r){return this.currentFinishedPromise.then(t,r)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(t=>{this.resolveFinishedPromise=t})}}const Bs=(e,t,r)=>e+(t-e)*r;function j5(e,t,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+(t-e)*6*r:r<1/2?t:r<2/3?e+(t-e)*(2/3-r)*6:e}function Bwe({hue:e,saturation:t,lightness:r,alpha:s}){e/=360,t/=100,r/=100;let a=0,i=0,o=0;if(!t)a=i=o=r;else{const l=r<.5?r*(1+t):r+t-r*t,c=2*r-l;a=j5(c,l,e+1/3),i=j5(c,l,e),o=j5(c,l,e-1/3)}return{red:Math.round(a*255),green:Math.round(i*255),blue:Math.round(o*255),alpha:s}}function C2(e,t){return r=>r>0?t:e}const N5=(e,t,r)=>{const s=e*e,a=r*(t*t-s)+s;return a<0?0:Math.sqrt(a)},Twe=[EB,dm,pA],Pwe=e=>Twe.find(t=>t.test(e));function AU(e){const t=Pwe(e);if(!t)return!1;let r=t.parse(e);return t===pA&&(r=Bwe(r)),r}const gU=(e,t)=>{const r=AU(e),s=AU(t);if(!r||!s)return C2(e,t);const a={...r};return i=>(a.red=N5(r.red,s.red,i),a.green=N5(r.green,s.green,i),a.blue=N5(r.blue,s.blue,i),a.alpha=Bs(r.alpha,s.alpha,i),dm.transform(a))},Iwe=(e,t)=>r=>t(e(r)),Py=(...e)=>e.reduce(Iwe),IB=new Set(["none","hidden"]);function Owe(e,t){return IB.has(e)?r=>r<=0?e:t:r=>r>=1?t:e}function Fwe(e,t){return r=>Bs(e,t,r)}function oO(e){return typeof e=="number"?Fwe:typeof e=="string"?MI(e)?C2:ji.test(e)?gU:Rwe:Array.isArray(e)?OW:typeof e=="object"?ji.test(e)?gU:Lwe:C2}function OW(e,t){const r=[...e],s=r.length,a=e.map((i,o)=>oO(i)(i,t[o]));return i=>{for(let o=0;o<s;o++)r[o]=a[o](i);return r}}function Lwe(e,t){const r={...e,...t},s={};for(const a in r)e[a]!==void 0&&t[a]!==void 0&&(s[a]=oO(e[a])(e[a],t[a]));return a=>{for(const i in s)r[i]=s[i](a);return r}}function Dwe(e,t){var r;const s=[],a={color:0,var:0,number:0};for(let i=0;i<t.values.length;i++){const o=t.types[i],l=e.indexes[o][a[o]],c=(r=e.values[l])!==null&&r!==void 0?r:0;s[i]=c,a[o]++}return s}const Rwe=(e,t)=>{const r=Wh.createTransformer(t),s=cb(e),a=cb(t);return s.indexes.var.length===a.indexes.var.length&&s.indexes.color.length===a.indexes.color.length&&s.indexes.number.length>=a.indexes.number.length?IB.has(e)&&!a.values.length||IB.has(t)&&!s.values.length?Owe(e,t):Py(OW(Dwe(s,a),a.values),r):C2(e,t)};function FW(e,t,r){return typeof e=="number"&&typeof t=="number"&&typeof r=="number"?Bs(e,t,r):oO(e)(e,t)}const Uwe=5;function LW(e,t,r){const s=Math.max(t-Uwe,0);return cW(r-e(s),t-s)}const Ms={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},_5=.001;function Mwe({duration:e=Ms.duration,bounce:t=Ms.bounce,velocity:r=Ms.velocity,mass:s=Ms.mass}){let a,i,o=1-t;o=Su(Ms.minDamping,Ms.maxDamping,o),e=Su(Ms.minDuration,Ms.maxDuration,vu(e)),o<1?(a=d=>{const u=d*o,h=u*e,m=u-r,f=OB(d,o),p=Math.exp(-h);return _5-m/f*p},i=d=>{const h=d*o*e,m=h*r+r,f=Math.pow(o,2)*Math.pow(d,2)*e,p=Math.exp(-h),A=OB(Math.pow(d,2),o);return(-a(d)+_5>0?-1:1)*((m-f)*p)/A}):(a=d=>{const u=Math.exp(-d*e),h=(d-r)*e+1;return-_5+u*h},i=d=>{const u=Math.exp(-d*e),h=(r-d)*(e*e);return u*h});const l=5/e,c=Qwe(a,i,l);if(e=xu(e),isNaN(c))return{stiffness:Ms.stiffness,damping:Ms.damping,duration:e};{const d=Math.pow(c,2)*s;return{stiffness:d,damping:o*2*Math.sqrt(s*d),duration:e}}}const $we=12;function Qwe(e,t,r){let s=r;for(let a=1;a<$we;a++)s=s-e(s)/t(s);return s}function OB(e,t){return e*Math.sqrt(1-t*t)}const Hwe=["duration","bounce"],zwe=["stiffness","damping","mass"];function xU(e,t){return t.some(r=>e[r]!==void 0)}function Vwe(e){let t={velocity:Ms.velocity,stiffness:Ms.stiffness,damping:Ms.damping,mass:Ms.mass,isResolvedFromDuration:!1,...e};if(!xU(e,zwe)&&xU(e,Hwe))if(e.visualDuration){const r=e.visualDuration,s=2*Math.PI/(r*1.2),a=s*s,i=2*Su(.05,1,1-(e.bounce||0))*Math.sqrt(a);t={...t,mass:Ms.mass,stiffness:a,damping:i}}else{const r=Mwe(e);t={...t,...r,mass:Ms.mass},t.isResolvedFromDuration=!0}return t}function DW(e=Ms.visualDuration,t=Ms.bounce){const r=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:s,restDelta:a}=r;const i=r.keyframes[0],o=r.keyframes[r.keyframes.length-1],l={done:!1,value:i},{stiffness:c,damping:d,mass:u,duration:h,velocity:m,isResolvedFromDuration:f}=Vwe({...r,velocity:-vu(r.velocity||0)}),p=m||0,A=d/(2*Math.sqrt(c*u)),v=o-i,x=vu(Math.sqrt(c/u)),b=Math.abs(v)<5;s||(s=b?Ms.restSpeed.granular:Ms.restSpeed.default),a||(a=b?Ms.restDelta.granular:Ms.restDelta.default);let y;if(A<1){const j=OB(x,A);y=N=>{const _=Math.exp(-A*x*N);return o-_*((p+A*x*v)/j*Math.sin(j*N)+v*Math.cos(j*N))}}else if(A===1)y=j=>o-Math.exp(-x*j)*(v+(p+x*v)*j);else{const j=x*Math.sqrt(A*A-1);y=N=>{const _=Math.exp(-A*x*N),S=Math.min(j*N,300);return o-_*((p+A*x*v)*Math.sinh(S)+j*v*Math.cosh(S))/j}}const w={calculatedDuration:f&&h||null,next:j=>{const N=y(j);if(f)l.done=j>=h;else{let _=0;A<1&&(_=j===0?xu(p):LW(y,j,N));const S=Math.abs(_)<=s,C=Math.abs(o-N)<=a;l.done=S&&C}return l.value=l.done?o:N,l},toString:()=>{const j=Math.min(tW(w),CB),N=rW(_=>w.next(j*_).value,j,30);return j+"ms "+N}};return w}function vU({keyframes:e,velocity:t=0,power:r=.8,timeConstant:s=325,bounceDamping:a=10,bounceStiffness:i=500,modifyTarget:o,min:l,max:c,restDelta:d=.5,restSpeed:u}){const h=e[0],m={done:!1,value:h},f=S=>l!==void 0&&S<l||c!==void 0&&S>c,p=S=>l===void 0?c:c===void 0||Math.abs(l-S)<Math.abs(c-S)?l:c;let A=r*t;const v=h+A,x=o===void 0?v:o(v);x!==v&&(A=x-h);const b=S=>-A*Math.exp(-S/s),y=S=>x+b(S),w=S=>{const C=b(S),E=y(S);m.done=Math.abs(C)<=d,m.value=m.done?x:E};let j,N;const _=S=>{f(m.value)&&(j=S,N=DW({keyframes:[m.value,p(m.value)],velocity:LW(y,S,m.value),damping:a,stiffness:i,restDelta:d,restSpeed:u}))};return _(0),{calculatedDuration:null,next:S=>{let C=!1;return!N&&j===void 0&&(C=!0,w(S),_(S)),j!==void 0&&S>=j?N.next(S-j):(!C&&w(S),m)}}}const Gwe=Ty(.42,0,1,1),qwe=Ty(0,0,.58,1),RW=Ty(.42,0,.58,1),Kwe=e=>Array.isArray(e)&&typeof e[0]!="number",Wwe={linear:Jo,easeIn:Gwe,easeInOut:RW,easeOut:qwe,circIn:rO,circInOut:xW,circOut:gW,backIn:tO,backInOut:pW,backOut:mW,anticipate:AW},bU=e=>{if(WI(e)){FK(e.length===4);const[t,r,s,a]=e;return Ty(t,r,s,a)}else if(typeof e=="string")return Wwe[e];return e};function Ywe(e,t,r){const s=[],a=r||FW,i=e.length-1;for(let o=0;o<i;o++){let l=a(e[o],e[o+1]);if(t){const c=Array.isArray(t)?t[o]||Jo:t;l=Py(c,l)}s.push(l)}return s}function Jwe(e,t,{clamp:r=!0,ease:s,mixer:a}={}){const i=e.length;if(FK(i===t.length),i===1)return()=>t[0];if(i===2&&t[0]===t[1])return()=>t[1];const o=e[0]===e[1];e[0]>e[i-1]&&(e=[...e].reverse(),t=[...t].reverse());const l=Ywe(t,s,a),c=l.length,d=u=>{if(o&&u<e[0])return t[0];let h=0;if(c>1)for(;h<e.length-2&&!(u<e[h+1]);h++);const m=dg(e[h],e[h+1],u);return l[h](m)};return r?u=>d(Su(e[0],e[i-1],u)):d}function Xwe(e,t){const r=e[e.length-1];for(let s=1;s<=t;s++){const a=dg(0,t,s);e.push(Bs(r,1,a))}}function Zwe(e){const t=[0];return Xwe(t,e.length-1),t}function e1e(e,t){return e.map(r=>r*t)}function t1e(e,t){return e.map(()=>t||RW).splice(0,e.length-1)}function S2({duration:e=300,keyframes:t,times:r,ease:s="easeInOut"}){const a=Kwe(s)?s.map(bU):bU(s),i={done:!1,value:t[0]},o=e1e(r&&r.length===t.length?r:Zwe(t),e),l=Jwe(o,t,{ease:Array.isArray(a)?a:t1e(t,a)});return{calculatedDuration:e,next:c=>(i.value=l(c),i.done=c>=e,i)}}const r1e=e=>{const t=({timestamp:r})=>e(r);return{start:()=>ms.update(t,!0),stop:()=>Kh(t),now:()=>ii.isProcessing?ii.timestamp:dd.now()}},n1e={decay:vU,inertia:vU,tween:S2,keyframes:S2,spring:DW},s1e=e=>e/100;class lO extends IW{constructor(t){super(t),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:c}=this.options;c&&c()};const{name:r,motionValue:s,element:a,keyframes:i}=this.options,o=(a==null?void 0:a.KeyframeResolver)||iO,l=(c,d)=>this.onKeyframesResolved(c,d);this.resolver=new o(i,l,r,s,a),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(t){const{type:r="keyframes",repeat:s=0,repeatDelay:a=0,repeatType:i,velocity:o=0}=this.options,l=KI(r)?r:n1e[r]||S2;let c,d;l!==S2&&typeof t[0]!="number"&&(c=Py(s1e,FW(t[0],t[1])),t=[0,100]);const u=l({...this.options,keyframes:t});i==="mirror"&&(d=l({...this.options,keyframes:[...t].reverse(),velocity:-o})),u.calculatedDuration===null&&(u.calculatedDuration=tW(u));const{calculatedDuration:h}=u,m=h+a,f=m*(s+1)-a;return{generator:u,mirroredGenerator:d,mapPercentToKeyframes:c,calculatedDuration:h,resolvedDuration:m,totalDuration:f}}onPostResolved(){const{autoplay:t=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!t?this.pause():this.state=this.pendingPlayState}tick(t,r=!1){const{resolved:s}=this;if(!s){const{keyframes:S}=this.options;return{done:!0,value:S[S.length-1]}}const{finalKeyframe:a,generator:i,mirroredGenerator:o,mapPercentToKeyframes:l,keyframes:c,calculatedDuration:d,totalDuration:u,resolvedDuration:h}=s;
vendor: 55,732 bytes, line 918
918if(this.startTime===null)return i.next(0);const{delay:m,repeat:f,repeatType:p,repeatDelay:A,onUpdate:v}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-u/this.speed,this.startTime)),r?this.currentTime=t:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(t-this.startTime)*this.speed;const x=this.currentTime-m*(this.speed>=0?1:-1),b=this.speed>=0?x<0:x>u;this.currentTime=Math.max(x,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=u);let y=this.currentTime,w=i;if(f){const S=Math.min(this.currentTime,u)/h;let C=Math.floor(S),E=S%1;!E&&S>=1&&(E=1),E===1&&C--,C=Math.min(C,f+1),!!(C%2)&&(p==="reverse"?(E=1-E,A&&(E-=A/h)):p==="mirror"&&(w=o)),y=Su(0,1,E)*h}const j=b?{done:!1,value:c[0]}:w.next(y);l&&(j.value=l(j.value));let{done:N}=j;!b&&d!==null&&(N=this.speed>=0?this.currentTime>=u:this.currentTime<=0);const _=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&N);return _&&a!==void 0&&(j.value=sC(c,this.options,a)),v&&v(j.value),_&&this.finish(),j}get duration(){const{resolved:t}=this;return t?vu(t.calculatedDuration):0}get time(){return vu(this.currentTime)}set time(t){t=xu(t),this.currentTime=t,this.holdTime!==null||this.speed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.speed)}get speed(){return this.playbackSpeed}set speed(t){const r=this.playbackSpeed!==t;this.playbackSpeed=t,r&&(this.time=vu(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:t=r1e,onPlay:r,startTime:s}=this.options;this.driver||(this.driver=t(i=>this.tick(i))),r&&r();const a=this.driver.now();this.holdTime!==null?this.startTime=a-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=a):this.startTime=s??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var t;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(t=this.currentTime)!==null&&t!==void 0?t:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:t}=this.options;t&&t()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}}const a1e=new Set(["opacity","clipPath","filter","transform"]);function i1e(e,t,r,{delay:s=0,duration:a=300,repeat:i=0,repeatType:o="loop",ease:l="easeInOut",times:c}={}){const d={[t]:r};c&&(d.offset=c);const u=sW(l,a);return Array.isArray(u)&&(d.easing=u),e.animate(d,{delay:s,duration:a,easing:Array.isArray(u)?"linear":u,fill:"both",iterations:i+1,direction:o==="reverse"?"alternate":"normal"})}const o1e=II(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),k2=10,l1e=2e4;function c1e(e){return KI(e.type)||e.type==="spring"||!nW(e.ease)}function d1e(e,t){const r=new lO({...t,keyframes:e,repeat:0,delay:0,isGenerator:!0});let s={done:!1,value:e[0]};const a=[];let i=0;for(;!s.done&&i<l1e;)s=r.sample(i),a.push(s.value),i+=k2;return{times:void 0,keyframes:a,duration:i-k2,ease:"linear"}}const UW={anticipate:AW,backInOut:pW,circInOut:xW};function u1e(e){return e in UW}class yU extends IW{constructor(t){super(t);const{name:r,motionValue:s,element:a,keyframes:i}=this.options;this.resolver=new PW(i,(o,l)=>this.onKeyframesResolved(o,l),r,s,a),this.resolver.scheduleResolve()}initPlayback(t,r){let{duration:s=300,times:a,ease:i,type:o,motionValue:l,name:c,startTime:d}=this.options;if(!l.owner||!l.owner.current)return!1;if(typeof i=="string"&&_2()&&u1e(i)&&(i=UW[i]),c1e(this.options)){const{onComplete:h,onUpdate:m,motionValue:f,element:p,...A}=this.options,v=d1e(t,A);t=v.keyframes,t.length===1&&(t[1]=t[0]),s=v.duration,a=v.times,i=v.ease,o="keyframes"}const u=i1e(l.owner.current,c,t,{...this.options,duration:s,times:a,ease:i});return u.startTime=d??this.calcStartTime(),this.pendingTimeline?(aU(u,this.pendingTimeline),this.pendingTimeline=void 0):u.onfinish=()=>{const{onComplete:h}=this.options;l.set(sC(t,this.options,r)),h&&h(),this.cancel(),this.resolveFinishedPromise()},{animation:u,duration:s,times:a,type:o,ease:i,keyframes:t}}get duration(){const{resolved:t}=this;if(!t)return 0;const{duration:r}=t;return vu(r)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:r}=t;return vu(r.currentTime||0)}set time(t){const{resolved:r}=this;if(!r)return;const{animation:s}=r;s.currentTime=xu(t)}get speed(){const{resolved:t}=this;if(!t)return 1;const{animation:r}=t;return r.playbackRate}set speed(t){const{resolved:r}=this;if(!r)return;const{animation:s}=r;s.playbackRate=t}get state(){const{resolved:t}=this;if(!t)return"idle";const{animation:r}=t;return r.playState}get startTime(){const{resolved:t}=this;if(!t)return null;const{animation:r}=t;return r.startTime}attachTimeline(t){if(!this._resolved)this.pendingTimeline=t;else{const{resolved:r}=this;if(!r)return Jo;const{animation:s}=r;aU(s,t)}return Jo}play(){if(this.isStopped)return;const{resolved:t}=this;if(!t)return;const{animation:r}=t;r.playState==="finished"&&this.updateFinishedPromise(),r.play()}pause(){const{resolved:t}=this;if(!t)return;const{animation:r}=t;r.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:t}=this;if(!t)return;const{animation:r,keyframes:s,duration:a,type:i,ease:o,times:l}=t;if(r.playState==="idle"||r.playState==="finished")return;if(this.time){const{motionValue:d,onUpdate:u,onComplete:h,element:m,...f}=this.options,p=new lO({...f,keyframes:s,duration:a,type:i,ease:o,times:l,isGenerator:!0}),A=xu(this.time);d.setWithVelocity(p.sample(A-k2).value,p.sample(A).value,k2)}const{onStop:c}=this.options;c&&c(),this.cancel()}complete(){const{resolved:t}=this;t&&t.animation.finish()}cancel(){const{resolved:t}=this;t&&t.animation.cancel()}static supports(t){const{motionValue:r,name:s,repeatDelay:a,repeatType:i,damping:o,type:l}=t;if(!r||!r.owner||!(r.owner.current instanceof HTMLElement))return!1;const{onUpdate:c,transformTemplate:d}=r.owner.getProps();return o1e()&&s&&a1e.has(s)&&!c&&!d&&!a&&i!=="mirror"&&o!==0&&l!=="inertia"}}const h1e={type:"spring",stiffness:500,damping:25,restSpeed:10},f1e=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),m1e={type:"keyframes",duration:.8},p1e={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},A1e=(e,{keyframes:t})=>t.length>2?m1e:Zm.has(e)?e.startsWith("scale")?f1e(t[1]):h1e:p1e;function g1e({when:e,delay:t,delayChildren:r,staggerChildren:s,staggerDirection:a,repeat:i,repeatType:o,repeatDelay:l,from:c,elapsed:d,...u}){return!!Object.keys(u).length}const cO=(e,t,r,s={},a,i)=>o=>{const l=qI(s,e)||{},c=l.delay||s.delay||0;let{elapsed:d=0}=s;d=d-xu(c);let u={keyframes:Array.isArray(r)?r:[null,r],ease:"easeOut",velocity:t.getVelocity(),...l,delay:-d,onUpdate:m=>{t.set(m),l.onUpdate&&l.onUpdate(m)},onComplete:()=>{o(),l.onComplete&&l.onComplete()},name:e,motionValue:t,element:i?void 0:a};g1e(l)||(u={...u,...A1e(e,u)}),u.duration&&(u.duration=xu(u.duration)),u.repeatDelay&&(u.repeatDelay=xu(u.repeatDelay)),u.from!==void 0&&(u.keyframes[0]=u.from);let h=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(u.duration=0,u.delay===0&&(h=!0)),h&&!i&&t.get()!==void 0){const m=sC(u.keyframes,l);if(m!==void 0)return ms.update(()=>{u.onUpdate(m),u.onComplete()}),new Dye([])}return!i&&yU.supports(u)?new yU(u):new lO(u)};function x1e({protectedKeys:e,needsAnimating:t},r){const s=e.hasOwnProperty(r)&&t[r]!==!0;return t[r]=!1,s}function MW(e,t,{delay:r=0,transitionOverride:s,type:a}={}){var i;let{transition:o=e.getDefaultTransition(),transitionEnd:l,...c}=t;s&&(o=s);const d=[],u=a&&e.animationState&&e.animationState.getState()[a];for(const h in c){const m=e.getValue(h,(i=e.latestValues[h])!==null&&i!==void 0?i:null),f=c[h];if(f===void 0||u&&x1e(u,h))continue;const p={delay:r,...qI(o||{},h)};let A=!1;if(window.MotionHandoffAnimation){const x=dW(e);if(x){const b=window.MotionHandoffAnimation(x,h,ms);b!==null&&(p.startTime=b,A=!0)}}kB(e,h),m.start(cO(h,m,f,e.shouldReduceMotion&&lW.has(h)?{type:!1}:p,e,A));const v=m.animation;v&&d.push(v)}return l&&Promise.all(d).then(()=>{ms.update(()=>{l&&eO(e,l)})}),d}function FB(e,t,r={}){var s;const a=nC(e,t,r.type==="exit"?(s=e.presenceContext)===null||s===void 0?void 0:s.custom:void 0);let{transition:i=e.getDefaultTransition()||{}}=a||{};r.transitionOverride&&(i=r.transitionOverride);const o=a?()=>Promise.all(MW(e,a,r)):()=>Promise.resolve(),l=e.variantChildren&&e.variantChildren.size?(d=0)=>{const{delayChildren:u=0,staggerChildren:h,staggerDirection:m}=i;return v1e(e,t,u+d,h,m,r)}:()=>Promise.resolve(),{when:c}=i;if(c){const[d,u]=c==="beforeChildren"?[o,l]:[l,o];return d().then(()=>u())}else return Promise.all([o(),l(r.delay)])}function v1e(e,t,r=0,s=0,a=1,i){const o=[],l=(e.variantChildren.size-1)*s,c=a===1?(d=0)=>d*s:(d=0)=>l-d*s;return Array.from(e.variantChildren).sort(b1e).forEach((d,u)=>{d.notify("AnimationStart",t),o.push(FB(d,t,{...i,delay:r+c(u)}).then(()=>d.notify("AnimationComplete",t)))}),Promise.all(o)}function b1e(e,t){return e.sortNodePosition(t)}function $W(e,t,r={}){e.notify("AnimationStart",t);let s;if(Array.isArray(t)){const a=t.map(i=>FB(e,i,r));s=Promise.all(a)}else if(typeof t=="string")s=FB(e,t,r);else{const a=typeof t=="function"?nC(e,t,r.custom):t;s=Promise.all(MW(e,a,r))}return s.then(()=>{e.notify("AnimationComplete",t)})}const y1e=FI.length;function QW(e){if(!e)return;if(!e.isControllingVariants){const r=e.parent?QW(e.parent)||{}:{};return e.props.initial!==void 0&&(r.initial=e.props.initial),r}const t={};for(let r=0;r<y1e;r++){const s=FI[r],a=e.props[s];(ib(a)||a===!1)&&(t[s]=a)}return t}const w1e=[...OI].reverse(),j1e=OI.length;function N1e(e){return t=>Promise.all(t.map(({animation:r,options:s})=>$W(e,r,s)))}function _1e(e){let t=N1e(e),r=wU(),s=!0;const a=c=>(d,u)=>{var h;const m=nC(e,u,c==="exit"?(h=e.presenceContext)===null||h===void 0?void 0:h.custom:void 0);if(m){const{transition:f,transitionEnd:p,...A}=m;d={...d,...A,...p}}return d};function i(c){t=c(e)}function o(c){const{props:d}=e,u=QW(e.parent)||{},h=[],m=new Set;let f={},p=1/0;for(let v=0;v<j1e;v++){const x=w1e[v],b=r[x],y=d[x]!==void 0?d[x]:u[x],w=ib(y),j=x===c?b.isActive:null;j===!1&&(p=v);let N=y===u[x]&&y!==d[x]&&w;if(N&&s&&e.manuallyAnimateOnMount&&(N=!1),b.protectedKeys={...f},!b.isActive&&j===null||!y&&!b.prevProp||tC(y)||typeof y=="boolean")continue;const _=C1e(b.prevProp,y);let S=_||x===c&&b.isActive&&!N&&w||v>p&&w,C=!1;const E=Array.isArray(y)?y:[y];let T=E.reduce(a(x),{});j===!1&&(T={});const{prevResolvedValues:B={}}=b,L={...B,...T},P=I=>{S=!0,m.has(I)&&(C=!0,m.delete(I)),b.needsAnimating[I]=!0;const $=e.getValue(I);$&&($.liveStyle=!1)};for(const I in L){const $=T[I],V=B[I];if(f.hasOwnProperty(I))continue;let R=!1;_B($)&&_B(V)?R=!eW($,V):R=$!==V,R?$!=null?P(I):m.add(I):$!==void 0&&m.has(I)?P(I):b.protectedKeys[I]=!0}b.prevProp=y,b.prevResolvedValues=T,b.isActive&&(f={...f,...T}),s&&e.blockInitialAnimation&&(S=!1),S&&(!(N&&_)||C)&&h.push(...E.map(I=>({animation:I,options:{type:x}})))}if(m.size){const v={};m.forEach(x=>{const b=e.getBaseTarget(x),y=e.getValue(x);y&&(y.liveStyle=!0),v[x]=b??null}),h.push({animation:v})}let A=!!h.length;return s&&(d.initial===!1||d.initial===d.animate)&&!e.manuallyAnimateOnMount&&(A=!1),s=!1,A?t(h):Promise.resolve()}function l(c,d){var u;if(r[c].isActive===d)return Promise.resolve();(u=e.variantChildren)===null||u===void 0||u.forEach(m=>{var f;return(f=m.animationState)===null||f===void 0?void 0:f.setActive(c,d)}),r[c].isActive=d;const h=o(c);for(const m in r)r[m].protectedKeys={};return h}return{animateChanges:o,setActive:l,setAnimateFunction:i,getState:()=>r,reset:()=>{r=wU(),s=!0}}}function C1e(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!eW(t,e):!1}function Ff(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function wU(){return{animate:Ff(!0),whileInView:Ff(),whileHover:Ff(),whileTap:Ff(),whileDrag:Ff(),whileFocus:Ff(),exit:Ff()}}class af{constructor(t){this.isMounted=!1,this.node=t}update(){}}class S1e extends af{constructor(t){super(t),t.animationState||(t.animationState=_1e(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();tC(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:r}=this.node.prevProps||{};t!==r&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),(t=this.unmountControls)===null||t===void 0||t.call(this)}}let k1e=0;class E1e extends af{constructor(){super(...arguments),this.id=k1e++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:r}=this.node.presenceContext,{isPresent:s}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===s)return;const a=this.node.animationState.setActive("exit",!t);r&&!t&&a.then(()=>r(this.id))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}const B1e={animation:{Feature:S1e},exit:{Feature:E1e}};function db(e,t,r,s={passive:!0}){return e.addEventListener(t,r,s),()=>e.removeEventListener(t,r)}function Iy(e){return{point:{x:e.pageX,y:e.pageY}}}const T1e=e=>t=>YI(t)&&e(t,Iy(t));function hv(e,t,r,s){return db(e,t,T1e(r),s)}const jU=(e,t)=>Math.abs(e-t);function P1e(e,t){const r=jU(e.x,t.x),s=jU(e.y,t.y);return Math.sqrt(r**2+s**2)}class HW{constructor(t,r,{transformPagePoint:s,contextWindow:a,dragSnapToOrigin:i=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const h=S5(this.lastMoveEventInfo,this.history),m=this.startEvent!==null,f=P1e(h.offset,{x:0,y:0})>=3;if(!m&&!f)return;const{point:p}=h,{timestamp:A}=ii;this.history.push({...p,timestamp:A});const{onStart:v,onMove:x}=this.handlers;m||(v&&v(this.lastMoveEvent,h),this.startEvent=this.lastMoveEvent),x&&x(this.lastMoveEvent,h)},this.handlePointerMove=(h,m)=>{this.lastMoveEvent=h,this.lastMoveEventInfo=C5(m,this.transformPagePoint),ms.update(this.updatePoint,!0)},this.handlePointerUp=(h,m)=>{this.end();const{onEnd:f,onSessionEnd:p,resumeAnimation:A}=this.handlers;if(this.dragSnapToOrigin&&A&&A(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const v=S5(h.type==="pointercancel"?this.lastMoveEventInfo:C5(m,this.transformPagePoint),this.history);this.startEvent&&f&&f(h,v),p&&p(h,v)},!YI(t))return;this.dragSnapToOrigin=i,this.handlers=r,this.transformPagePoint=s,this.contextWindow=a||window;const o=Iy(t),l=C5(o,this.transformPagePoint),{point:c}=l,{timestamp:d}=ii;this.history=[{...c,timestamp:d}];const{onSessionStart:u}=r;u&&u(t,S5(l,this.history)),this.removeListeners=Py(hv(this.contextWindow,"pointermove",this.handlePointerMove),hv(this.contextWindow,"pointerup",this.handlePointerUp),hv(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),Kh(this.updatePoint)}}function C5(e,t){return t?{point:t(e.point)}:e}function NU(e,t){return{x:e.x-t.x,y:e.y-t.y}}function S5({point:e},t){return{point:e,delta:NU(e,zW(t)),offset:NU(e,I1e(t)),velocity:O1e(t,.1)}}function I1e(e){return e[0]}function zW(e){return e[e.length-1]}function O1e(e,t){if(e.length<2)return{x:0,y:0};let r=e.length-1,s=null;const a=zW(e);for(;r>=0&&(s=e[r],!(a.timestamp-s.timestamp>xu(t)));)r--;if(!s)return{x:0,y:0};const i=vu(a.timestamp-s.timestamp);if(i===0)return{x:0,y:0};const o={x:(a.x-s.x)/i,y:(a.y-s.y)/i};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}const VW=1e-4,F1e=1-VW,L1e=1+VW,GW=.01,D1e=0-GW,R1e=0+GW;function il(e){return e.max-e.min}function U1e(e,t,r){return Math.abs(e-t)<=r}function _U(e,t,r,s=.5){e.origin=s,e.originPoint=Bs(t.min,t.max,e.origin),e.scale=il(r)/il(t),e.translate=Bs(r.min,r.max,e.origin)-e.originPoint,(e.scale>=F1e&&e.scale<=L1e||isNaN(e.scale))&&(e.scale=1),(e.translate>=D1e&&e.translate<=R1e||isNaN(e.translate))&&(e.translate=0)}function fv(e,t,r,s){_U(e.x,t.x,r.x,s?s.originX:void 0),_U(e.y,t.y,r.y,s?s.originY:void 0)}function CU(e,t,r){e.min=r.min+t.min,e.max=e.min+il(t)}function M1e(e,t,r){CU(e.x,t.x,r.x),CU(e.y,t.y,r.y)}function SU(e,t,r){e.min=t.min-r.min,e.max=e.min+il(t)}function mv(e,t,r){SU(e.x,t.x,r.x),SU(e.y,t.y,r.y)}function $1e(e,{min:t,max:r},s){return t!==void 0&&e<t?e=s?Bs(t,e,s.min):Math.max(e,t):r!==void 0&&e>r&&(e=s?Bs(r,e,s.max):Math.min(e,r)),e}function kU(e,t,r){return{min:t!==void 0?e.min+t:void 0,max:r!==void 0?e.max+r-(e.max-e.min):void 0}}function Q1e(e,{top:t,left:r,bottom:s,right:a}){return{x:kU(e.x,r,a),y:kU(e.y,t,s)}}function EU(e,t){let r=t.min-e.min,s=t.max-e.max;return t.max-t.min<e.max-e.min&&([r,s]=[s,r]),{min:r,max:s}}function H1e(e,t){return{x:EU(e.x,t.x),y:EU(e.y,t.y)}}function z1e(e,t){let r=.5;const s=il(e),a=il(t);return a>s?r=dg(t.min,t.max-s,e.min):s>a&&(r=dg(e.min,e.max-a,t.min)),Su(0,1,r)}function V1e(e,t){const r={};return t.min!==void 0&&(r.min=t.min-e.min),t.max!==void 0&&(r.max=t.max-e.min),r}const LB=.35;function G1e(e=LB){return e===!1?e=0:e===!0&&(e=LB),{x:BU(e,"left","right"),y:BU(e,"top","bottom")}}function BU(e,t,r){return{min:TU(e,t),max:TU(e,r)}}function TU(e,t){return typeof e=="number"?e:e[t]||0}const PU=()=>({translate:0,scale:1,origin:0,originPoint:0}),AA=()=>({x:PU(),y:PU()}),IU=()=>({min:0,max:0}),Xs=()=>({x:IU(),y:IU()});function Nl(e){return[e("x"),e("y")]}function qW({top:e,left:t,right:r,bottom:s}){return{x:{min:t,max:r},y:{min:e,max:s}}}function q1e({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function K1e(e,t){if(!t)return e;const r=t({x:e.left,y:e.top}),s=t({x:e.right,y:e.bottom});return{top:r.y,left:r.x,bottom:s.y,right:s.x}}function k5(e){return e===void 0||e===1}function DB({scale:e,scaleX:t,scaleY:r}){return!k5(e)||!k5(t)||!k5(r)}function Vf(e){return DB(e)||KW(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function KW(e){return OU(e.x)||OU(e.y)}function OU(e){return e&&e!=="0%"}function E2(e,t,r){const s=e-r,a=t*s;return r+a}function FU(e,t,r,s,a){return a!==void 0&&(e=E2(e,a,s)),E2(e,r,s)+t}function RB(e,t=0,r=1,s,a){e.min=FU(e.min,t,r,s,a),e.max=FU(e.max,t,r,s,a)}function WW(e,{x:t,y:r}){RB(e.x,t.translate,t.scale,t.originPoint),RB(e.y,r.translate,r.scale,r.originPoint)}const LU=.999999999999,DU=1.0000000000001;function W1e(e,t,r,s=!1){const a=r.length;if(!a)return;t.x=t.y=1;let i,o;for(let l=0;l<a;l++){i=r[l],o=i.projectionDelta;const{visualElement:c}=i.options;c&&c.props.style&&c.props.style.display==="contents"||(s&&i.options.layoutScroll&&i.scroll&&i!==i.root&&xA(e,{x:-i.scroll.offset.x,y:-i.scroll.offset.y}),o&&(t.x*=o.x.scale,t.y*=o.y.scale,WW(e,o)),s&&Vf(i.latestValues)&&xA(e,i.latestValues))}t.x<DU&&t.x>LU&&(t.x=1),t.y<DU&&t.y>LU&&(t.y=1)}function gA(e,t){e.min=e.min+t,e.max=e.max+t}function RU(e,t,r,s,a=.5){const i=Bs(e.min,e.max,a);RB(e,t,r,i,s)}function xA(e,t){RU(e.x,t.x,t.scaleX,t.scale,t.originX),RU(e.y,t.y,t.scaleY,t.scale,t.originY)}function YW(e,t){return qW(K1e(e.getBoundingClientRect(),t))}function Y1e(e,t,r){const s=YW(e,r),{scroll:a}=t;return a&&(gA(s.x,a.offset.x),gA(s.y,a.offset.y)),s}const JW=({current:e})=>e?e.ownerDocument.defaultView:null,J1e=new WeakMap;class X1e{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Xs(),this.visualElement=t}start(t,{snapToCursor:r=!1}={}){const{presenceContext:s}=this.visualElement;if(s&&s.isPresent===!1)return;const a=u=>{const{dragSnapToOrigin:h}=this.getProps();h?this.pauseAnimation():this.stopAnimation(),r&&this.snapToCursor(Iy(u).point)},i=(u,h)=>{const{drag:m,dragPropagation:f,onDragStart:p}=this.getProps();if(m&&!f&&(this.openDragLock&&this.openDragLock(),this.openDragLock=Gye(m),!this.openDragLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Nl(v=>{let x=this.getAxisMotionValue(v).get()||0;if(cd.test(x)){const{projection:b}=this.visualElement;if(b&&b.layout){const y=b.layout.layoutBox[v];y&&(x=il(y)*(parseFloat(x)/100))}}this.originPoint[v]=x}),p&&ms.postRender(()=>p(u,h)),kB(this.visualElement,"transform");const{animationState:A}=this.visualElement;A&&A.setActive("whileDrag",!0)},o=(u,h)=>{const{dragPropagation:m,dragDirectionLock:f,onDirectionLock:p,onDrag:A}=this.getProps();if(!m&&!this.openDragLock)return;const{offset:v}=h;if(f&&this.currentDirection===null){this.currentDirection=Z1e(v),this.currentDirection!==null&&p&&p(this.currentDirection);return}this.updateAxis("x",h.point,v),this.updateAxis("y",h.point,v),this.visualElement.render(),A&&A(u,h)},l=(u,h)=>this.stop(u,h),c=()=>Nl(u=>{var h;return this.getAnimationState(u)==="paused"&&((h=this.getAxisMotionValue(u).animation)===null||h===void 0?void 0:h.play())}),{dragSnapToOrigin:d}=this.getProps();this.panSession=new HW(t,{onSessionStart:a,onStart:i,onMove:o,onSessionEnd:l,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:d,contextWindow:JW(this.visualElement)})}stop(t,r){const s=this.isDragging;if(this.cancel(),!s)return;const{velocity:a}=r;this.startAnimation(a);const{onDragEnd:i}=this.getProps();i&&ms.postRender(()=>i(t,r))}cancel(){this.isDragging=!1;const{projection:t,animationState:r}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:s}=this.getProps();!s&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),r&&r.setActive("whileDrag",!1)}updateAxis(t,r,s){const{drag:a}=this.getProps();if(!s||!n1(t,a,this.currentDirection))return;const i=this.getAxisMotionValue(t);let o=this.originPoint[t]+s[t];this.constraints&&this.constraints[t]&&(o=$1e(o,this.constraints[t],this.elastic[t])),i.set(o)}resolveConstraints(){var t;const{dragConstraints:r,dragElastic:s}=this.getProps(),a=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(t=this.visualElement.projection)===null||t===void 0?void 0:t.layout,i=this.constraints;r&&mA(r)?this.constraints||(this.constraints=this.resolveRefConstraints()):r&&a?this.constraints=Q1e(a.layoutBox,r):this.constraints=!1,this.elastic=G1e(s),i!==this.constraints&&a&&this.constraints&&!this.hasMutatedConstraints&&Nl(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=V1e(a.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:r}=this.getProps();if(!t||!mA(t))return!1;const s=t.current,{projection:a}=this.visualElement;if(!a||!a.layout)return!1;const i=Y1e(s,a.root,this.visualElement.getTransformPagePoint());let o=H1e(a.layout.layoutBox,i);if(r){const l=r(q1e(o));this.hasMutatedConstraints=!!l,l&&(o=qW(l))}return o}startAnimation(t){const{drag:r,dragMomentum:s,dragElastic:a,dragTransition:i,dragSnapToOrigin:o,onDragTransitionEnd:l}=this.getProps(),c=this.constraints||{},d=Nl(u=>{if(!n1(u,r,this.currentDirection))return;let h=c&&c[u]||{};o&&(h={min:0,max:0});const m=a?200:1e6,f=a?40:1e7,p={type:"inertia",velocity:s?t[u]:0,bounceStiffness:m,bounceDamping:f,timeConstant:750,restDelta:1,restSpeed:10,...i,...h};return this.startAxisValueAnimation(u,p)});return Promise.all(d).then(l)}startAxisValueAnimation(t,r){const s=this.getAxisMotionValue(t);return kB(this.visualElement,t),s.start(cO(t,s,0,r,this.visualElement,!1))}stopAnimation(){Nl(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){Nl(t=>{var r;return(r=this.getAxisMotionValue(t).animation)===null||r===void 0?void 0:r.pause()})}getAnimationState(t){var r;return(r=this.getAxisMotionValue(t).animation)===null||r===void 0?void 0:r.state}getAxisMotionValue(t){const r=`_drag${t.toUpperCase()}`,s=this.visualElement.getProps(),a=s[r];return a||this.visualElement.getValue(t,(s.initial?s.initial[t]:void 0)||0)}snapToCursor(t){Nl(r=>{const{drag:s}=this.getProps();if(!n1(r,s,this.currentDirection))return;const{projection:a}=this.visualElement,i=this.getAxisMotionValue(r);if(a&&a.layout){const{min:o,max:l}=a.layout.layoutBox[r];i.set(t[r]-Bs(o,l,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:r}=this.getProps(),{projection:s}=this.visualElement;if(!mA(r)||!s||!this.constraints)return;this.stopAnimation();const a={x:0,y:0};Nl(o=>{const l=this.getAxisMotionValue(o);if(l&&this.constraints!==!1){const c=l.get();a[o]=z1e({min:c,max:c},this.constraints[o])}});const{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",s.root&&s.root.updateScroll(),s.updateLayout(),this.resolveConstraints(),Nl(o=>{if(!n1(o,t,null))return;const l=this.getAxisMotionValue(o),{min:c,max:d}=this.constraints[o];l.set(Bs(c,d,a[o]))})}addListeners(){if(!this.visualElement.current)return;J1e.set(this.visualElement,this);const t=this.visualElement.current,r=hv(t,"pointerdown",c=>{const{drag:d,dragListener:u=!0}=this.getProps();d&&u&&this.start(c)}),s=()=>{const{dragConstraints:c}=this.getProps();mA(c)&&c.current&&(this.constraints=this.resolveRefConstraints())},{projection:a}=this.visualElement,i=a.addEventListener("measure",s);a&&!a.layout&&(a.root&&a.root.updateScroll(),a.updateLayout()),ms.read(s);const o=db(window,"resize",()=>this.scalePositionWithinConstraints()),l=a.addEventListener("didUpdate",({delta:c,hasLayoutChanged:d})=>{this.isDragging&&d&&(Nl(u=>{const h=this.getAxisMotionValue(u);h&&(this.originPoint[u]+=c[u].translate,h.set(h.get()+c[u].translate))}),this.visualElement.render())});return()=>{o(),r(),i(),l&&l()}}getProps(){const t=this.visualElement.getProps(),{drag:r=!1,dragDirectionLock:s=!1,dragPropagation:a=!1,dragConstraints:i=!1,dragElastic:o=LB,dragMomentum:l=!0}=t;return{...t,drag:r,dragDirectionLock:s,dragPropagation:a,dragConstraints:i,dragElastic:o,dragMomentum:l}}}function n1(e,t,r){return(t===!0||t===e)&&(r===null||r===e)}function Z1e(e,t=10){let r=null;return Math.abs(e.y)>t?r="y":Math.abs(e.x)>t&&(r="x"),r}class eje extends af{constructor(t){super(t),this.removeGroupControls=Jo,this.removeListeners=Jo,this.controls=new X1e(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Jo}unmount(){this.removeGroupControls(),this.removeListeners()}}const UU=e=>(t,r)=>{e&&ms.postRender(()=>e(t,r))};class tje extends af{constructor(){super(...arguments),this.removePointerDownListener=Jo}onPointerDown(t){this.session=new HW(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:JW(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:r,onPan:s,onPanEnd:a}=this.node.getProps();return{onSessionStart:UU(t),onStart:UU(r),onMove:s,onEnd:(i,o)=>{delete this.session,a&&ms.postRender(()=>a(i,o))}}}mount(){this.removePointerDownListener=hv(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const kj={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function MU(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const mx={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(dr.test(e))e=parseFloat(e);else return e;const r=MU(e,t.target.x),s=MU(e,t.target.y);return`${r}% ${s}%`}},rje={correct:(e,{treeScale:t,projectionDelta:r})=>{const s=e,a=Wh.parse(e);if(a.length>5)return s;const i=Wh.createTransformer(e),o=typeof a[0]!="number"?1:0,l=r.x.scale*t.x,c=r.y.scale*t.y;a[0+o]/=l,a[1+o]/=c;const d=Bs(l,c,.5);return typeof a[2+o]=="number"&&(a[2+o]/=d),typeof a[3+o]=="number"&&(a[3+o]/=d),i(a)}};class nje extends g.Component{componentDidMount(){const{visualElement:t,layoutGroup:r,switchLayoutGroup:s,layoutId:a}=this.props,{projection:i}=t;_ye(sje),i&&(r.group&&r.group.add(i),s&&s.register&&a&&s.register(i),i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,onExitComplete:()=>this.safeToRemove()})),kj.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:r,visualElement:s,drag:a,isPresent:i}=this.props,o=s.projection;return o&&(o.isPresent=i,a||t.layoutDependency!==r||r===void 0?o.willUpdate():this.safeToRemove(),t.isPresent!==i&&(i?o.promote():o.relegate()||ms.postRender(()=>{const l=o.getStack();(!l||!l.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),DI.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:r,switchLayoutGroup:s}=this.props,{projection:a}=t;a&&(a.scheduleCheckAfterUnmount(),r&&r.group&&r.group.remove(a),s&&s.deregister&&s.deregister(a))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function XW(e){const[t,r]=OK(),s=g.useContext(EI);return n.jsx(nje,{...e,layoutGroup:s,switchLayoutGroup:g.useContext($K),isPresent:t,safeToRemove:r})}const sje={borderRadius:{...mx,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:mx,borderTopRightRadius:mx,borderBottomLeftRadius:mx,borderBottomRightRadius:mx,boxShadow:rje};function aje(e,t,r){const s=ki(e)?e:lb(e);return s.start(cO("",s,t,r)),s.animation}function ije(e){return e instanceof SVGElement&&e.tagName!=="svg"}const oje=(e,t)=>e.depth-t.depth;class lje{constructor(){this.children=[],this.isDirty=!1}add(t){JI(this.children,t),this.isDirty=!0}remove(t){XI(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(oje),this.isDirty=!1,this.children.forEach(t)}}function cje(e,t){const r=dd.now(),s=({timestamp:a})=>{const i=a-r;i>=t&&(Kh(s),e(i-t))};return ms.read(s,!0),()=>Kh(s)}const ZW=["TopLeft","TopRight","BottomLeft","BottomRight"],dje=ZW.length,$U=e=>typeof e=="string"?parseFloat(e):e,QU=e=>typeof e=="number"||dr.test(e);function uje(e,t,r,s,a,i){a?(e.opacity=Bs(0,r.opacity!==void 0?r.opacity:1,hje(s)),e.opacityExit=Bs(t.opacity!==void 0?t.opacity:1,0,fje(s))):i&&(e.opacity=Bs(t.opacity!==void 0?t.opacity:1,r.opacity!==void 0?r.opacity:1,s));for(let o=0;o<dje;o++){const l=`border${ZW[o]}Radius`;let c=HU(t,l),d=HU(r,l);if(c===void 0&&d===void 0)continue;c||(c=0),d||(d=0),c===0||d===0||QU(c)===QU(d)?(e[l]=Math.max(Bs($U(c),$U(d),s),0),(cd.test(d)||cd.test(c))&&(e[l]+="%")):e[l]=d}(t.rotate||r.rotate)&&(e.rotate=Bs(t.rotate||0,r.rotate||0,s))}function HU(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const hje=eY(0,.5,gW),fje=eY(.5,.95,Jo);function eY(e,t,r){return s=>s<e?0:s>t?1:r(dg(e,t,s))}function zU(e,t){e.min=t.min,e.max=t.max}function vl(e,t){zU(e.x,t.x),zU(e.y,t.y)}function VU(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function GU(e,t,r,s,a){return e-=t,e=E2(e,1/r,s),a!==void 0&&(e=E2(e,1/a,s)),e}function mje(e,t=0,r=1,s=.5,a,i=e,o=e){if(cd.test(t)&&(t=parseFloat(t),t=Bs(o.min,o.max,t/100)-o.min),typeof t!="number")return;let l=Bs(i.min,i.max,s);e===i&&(l-=t),e.min=GU(e.min,t,r,l,a),e.max=GU(e.max,t,r,l,a)}function qU(e,t,[r,s,a],i,o){mje(e,t[r],t[s],t[a],t.scale,i,o)}const pje=["x","scaleX","originX"],Aje=["y","scaleY","originY"];function KU(e,t,r,s){qU(e.x,t,pje,r?r.x:void 0,s?s.x:void 0),qU(e.y,t,Aje,r?r.y:void 0,s?s.y:void 0)}function WU(e){return e.translate===0&&e.scale===1}function tY(e){return WU(e.x)&&WU(e.y)}function YU(e,t){return e.min===t.min&&e.max===t.max}function gje(e,t){return YU(e.x,t.x)&&YU(e.y,t.y)}function JU(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function rY(e,t){return JU(e.x,t.x)&&JU(e.y,t.y)}function XU(e){return il(e.x)/il(e.y)}function ZU(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class xje{constructor(){this.members=[]}add(t){JI(this.members,t),t.scheduleRender()}remove(t){if(XI(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const r=this.members[this.members.length-1];r&&this.promote(r)}}relegate(t){const r=this.members.findIndex(a=>t===a);if(r===0)return!1;let s;for(let a=r;a>=0;a--){const i=this.members[a];if(i.isPresent!==!1){s=i;break}}return s?(this.promote(s),!0):!1}promote(t,r){const s=this.lead;if(t!==s&&(this.prevLead=s,this.lead=t,t.show(),s)){s.instance&&s.scheduleRender(),t.scheduleRender(),t.resumeFrom=s,r&&(t.resumeFrom.preserveOpacity=!0),s.snapshot&&(t.snapshot=s.snapshot,t.snapshot.latestValues=s.animationValues||s.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:a}=t.options;a===!1&&s.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:r,resumingFrom:s}=t;r.onExitComplete&&r.onExitComplete(),s&&s.options.onExitComplete&&s.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function vje(e,t,r){let s="";const a=e.x.translate/t.x,i=e.y.translate/t.y,o=(r==null?void 0:r.z)||0;if((a||i||o)&&(s=`translate3d(${a}px, ${i}px, ${o}px) `),(t.x!==1||t.y!==1)&&(s+=`scale(${1/t.x}, ${1/t.y}) `),r){const{transformPerspective:d,rotate:u,rotateX:h,rotateY:m,skewX:f,skewY:p}=r;d&&(s=`perspective(${d}px) ${s}`),u&&(s+=`rotate(${u}deg) `),h&&(s+=`rotateX(${h}deg) `),m&&(s+=`rotateY(${m}deg) `),f&&(s+=`skewX(${f}deg) `),p&&(s+=`skewY(${p}deg) `)}const l=e.x.scale*t.x,c=e.y.scale*t.y;return(l!==1||c!==1)&&(s+=`scale(${l}, ${c})`),s||"none"}const Gf={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},qx=typeof window<"u"&&window.MotionDebug!==void 0,E5=["","X","Y","Z"],bje={visibility:"hidden"},eM=1e3;let yje=0;function B5(e,t,r,s){const{latestValues:a}=t;a[e]&&(r[e]=a[e],t.setStaticValue(e,0),s&&(s[e]=0))}function nY(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const r=dW(t);if(window.MotionHasOptimisedAnimation(r,"transform")){const{layout:a,layoutId:i}=e.options;window.MotionCancelOptimisedAnimation(r,"transform",ms,!(a||i))}const{parent:s}=e;s&&!s.hasCheckedOptimisedAppear&&nY(s)}function sY({attachResizeListener:e,defaultParent:t,measureScroll:r,checkIsScrollRoot:s,resetTransform:a}){return class{constructor(o={},l=t==null?void 0:t()){this.id=yje++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,qx&&(Gf.totalNodes=Gf.resolvedTargetDeltas=Gf.recalculatedProjection=0),this.nodes.forEach(Nje),this.nodes.forEach(Eje),this.nodes.forEach(Bje),this.nodes.forEach(_je),qx&&window.MotionDebug.record(Gf)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=l?l.root||l:this,this.path=l?[...l.path,l]:[],this.parent=l,this.depth=l?l.depth+1:0;for(let c=0;c<this.path.length;c++)this.path[c].shouldResetTransform=!0;this.root===this&&(this.nodes=new lje)}addEventListener(o,l){return this.eventHandlers.has(o)||this.eventHandlers.set(o,new ZI),this.eventHandlers.get(o).add(l)}notifyListeners(o,...l){const c=this.eventHandlers.get(o);c&&c.notify(...l)}hasListeners(o){return this.eventHandlers.has(o)}mount(o,l=this.root.hasTreeAnimated){if(this.instance)return;this.isSVG=ije(o),this.instance=o;const{layoutId:c,layout:d,visualElement:u}=this.options;if(u&&!u.current&&u.mount(o),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),l&&(d||c)&&(this.isLayoutDirty=!0),e){let h;const m=()=>this.root.updateBlockedByResize=!1;e(o,()=>{this.root.updateBlockedByResize=!0,h&&h(),h=cje(m,250),kj.hasAnimatedSinceResize&&(kj.hasAnimatedSinceResize=!1,this.nodes.forEach(rM))})}c&&this.root.registerSharedNode(c,this),this.options.animate!==!1&&u&&(c||d)&&this.addEventListener("didUpdate",({delta:h,hasLayoutChanged:m,hasRelativeTargetChanged:f,layout:p})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const A=this.options.transition||u.getDefaultTransition()||Fje,{onLayoutAnimationStart:v,onLayoutAnimationComplete:x}=u.getProps(),b=!this.targetLayout||!rY(this.targetLayout,p)||f,y=!m&&f;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||y||m&&(b||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(h,y);const w={...qI(A,"layout"),onPlay:v,onComplete:x};(u.shouldReduceMotion||this.options.layoutRoot)&&(w.delay=0,w.type=!1),this.startAnimation(w)}else m||rM(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=p})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,Kh(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(Tje),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&nY(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let u=0;u<this.path.length;u++){const h=this.path[u];h.shouldResetTransform=!0,h.updateScroll("snapshot"),h.options.layoutRoot&&h.willUpdate(!1)}const{layoutId:l,layout:c}=this.options;if(l===void 0&&!c)return;const d=this.getTransformTemplate();this.prevTransformTemplateValue=d?d(this.latestValues,""):void 0,this.updateSnapshot(),o&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(tM);return}this.isUpdating||this.nodes.forEach(Sje),this.isUpdating=!1,this.nodes.forEach(kje),this.nodes.forEach(wje),this.nodes.forEach(jje),this.clearAllSnapshots();const l=dd.now();ii.delta=Su(0,1e3/60,l-ii.timestamp),ii.timestamp=l,ii.isProcessing=!0,b5.update.process(ii),b5.preRender.process(ii),b5.render.process(ii),ii.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,DI.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(Cje),this.sharedNodes.forEach(Pje)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,ms.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){ms.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let c=0;c<this.path.length;c++)this.path[c].updateScroll();const o=this.layout;this.layout=this.measure(!1),this.layoutCorrected=Xs(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:l}=this.options;l&&l.notify("LayoutMeasure",this.layout.layoutBox,o?o.layoutBox:void 0)}updateScroll(o="measure"){let l=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===o&&(l=!1),l){const c=s(this.instance);this.scroll={animationId:this.root.animationId,phase:o,isRoot:c,offset:r(this.instance),wasRoot:this.scroll?this.scroll.isRoot:c}}}resetTransform(){if(!a)return;const o=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,l=this.projectionDelta&&!tY(this.projectionDelta),c=this.getTransformTemplate(),d=c?c(this.latestValues,""):void 0,u=d!==this.prevTransformTemplateValue;o&&(l||Vf(this.latestValues)||u)&&(a(this.instance,d),this.shouldResetTransform=!1,this.scheduleRender())}measure(o=!0){const l=this.measurePageBox();let c=this.removeElementScroll(l);return o&&(c=this.removeTransform(c)),Lje(c),{animationId:this.root.animationId,measuredBox:l,layoutBox:c,latestValues:{},source:this.id}}measurePageBox(){var o;const{visualElement:l}=this.options;if(!l)return Xs();const c=l.measureViewportBox();if(!(((o=this.scroll)===null||o===void 0?void 0:o.wasRoot)||this.path.some(Dje))){const{scroll:u}=this.root;u&&(gA(c.x,u.offset.x),gA(c.y,u.offset.y))}return c}removeElementScroll(o){var l;const c=Xs();if(vl(c,o),!((l=this.scroll)===null||l===void 0)&&l.wasRoot)return c;for(let d=0;d<this.path.length;d++){const u=this.path[d],{scroll:h,options:m}=u;u!==this.root&&h&&m.layoutScroll&&(h.wasRoot&&vl(c,o),gA(c.x,h.offset.x),gA(c.y,h.offset.y))}return c}applyTransform(o,l=!1){const c=Xs();vl(c,o);for(let d=0;d<this.path.length;d++){const u=this.path[d];!l&&u.options.layoutScroll&&u.scroll&&u!==u.root&&xA(c,{x:-u.scroll.offset.x,y:-u.scroll.offset.y}),Vf(u.latestValues)&&xA(c,u.latestValues)}return Vf(this.latestValues)&&xA(c,this.latestValues),c}removeTransform(o){const l=Xs();vl(l,o);for(let c=0;c<this.path.length;c++){const d=this.path[c];if(!d.instance||!Vf(d.latestValues))continue;DB(d.latestValues)&&d.updateSnapshot();const u=Xs(),h=d.measurePageBox();vl(u,h),KU(l,d.latestValues,d.snapshot?d.snapshot.layoutBox:void 0,u)}return Vf(this.latestValues)&&KU(l,this.latestValues),l}setTargetDelta(o){this.targetDelta=o,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(o){this.options={...this.options,...o,crossfade:o.crossfade!==void 0?o.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==ii.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(o=!1){var l;const c=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=c.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=c.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=c.isSharedProjectionDirty);const d=!!this.resumingFrom||this!==c;if(!(o||d&&this.isSharedProjectionDirty||this.isProjectionDirty||!((l=this.parent)===null||l===void 0)&&l.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:h,layoutId:m}=this.options;if(!(!this.layout||!(h||m))){if(this.resolvedRelativeTargetAt=ii.timestamp,!this.targetDelta&&!this.relativeTarget){const f=this.getClosestProjectingParent();f&&f.layout&&this.animationProgress!==1?(this.relativeParent=f,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Xs(),this.relativeTargetOrigin=Xs(),mv(this.relativeTargetOrigin,this.layout.layoutBox,f.layout.layoutBox),vl(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)){if(this.target||(this.target=Xs(),this.targetWithTransforms=Xs()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),M1e(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):vl(this.target,this.layout.layoutBox),WW(this.target,this.targetDelta)):vl(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;const f=this.getClosestProjectingParent();f&&!!f.resumingFrom==!!this.resumingFrom&&!f.options.layoutScroll&&f.target&&this.animationProgress!==1?(this.relativeParent=f,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Xs(),this.relativeTargetOrigin=Xs(),mv(this.relativeTargetOrigin,this.target,f.target),vl(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}qx&&Gf.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||DB(this.parent.latestValues)||KW(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var o;const l=this.getLead(),c=!!this.resumingFrom||this!==l;let d=!0;if((this.isProjectionDirty||!((o=this.parent)===null||o===void 0)&&o.isProjectionDirty)&&(d=!1),c&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(d=!1),this.resolvedRelativeTargetAt===ii.timestamp&&(d=!1),d)return;const{layout:u,layoutId:h}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(u||h))return;vl(this.layoutCorrected,this.layout.layoutBox);const m=this.treeScale.x,f=this.treeScale.y;W1e(this.layoutCorrected,this.treeScale,this.path,c),l.layout&&!l.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(l.target=l.layout.layoutBox,l.targetWithTransforms=Xs());const{target:p}=l;if(!p){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(VU(this.prevProjectionDelta.x,this.projectionDelta.x),VU(this.prevProjectionDelta.y,this.projectionDelta.y)),fv(this.projectionDelta,this.layoutCorrected,p,this.latestValues),(this.treeScale.x!==m||this.treeScale.y!==f||!ZU(this.projectionDelta.x,this.prevProjectionDelta.x)||!ZU(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",p)),qx&&Gf.recalculatedProjection++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(o=!0){var l;if((l=this.options.visualElement)===null||l===void 0||l.scheduleRender(),o){const c=this.getStack();c&&c.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=AA(),this.projectionDelta=AA(),this.projectionDeltaWithTransform=AA()}setAnimationOrigin(o,l=!1){const c=this.snapshot,d=c?c.latestValues:{},u={...this.latestValues},h=AA();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!l;const m=Xs(),f=c?c.source:void 0,p=this.layout?this.layout.source:void 0,A=f!==p,v=this.getStack(),x=!v||v.members.length<=1,b=!!(A&&!x&&this.options.crossfade===!0&&!this.path.some(Oje));this.animationProgress=0;let y;this.mixTargetDelta=w=>{const j=w/1e3;nM(h.x,o.x,j),nM(h.y,o.y,j),this.setTargetDelta(h),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(mv(m,this.layout.layoutBox,this.relativeParent.layout.layoutBox),Ije(this.relativeTarget,this.relativeTargetOrigin,m,j),y&&gje(this.relativeTarget,y)&&(this.isProjectionDirty=!1),y||(y=Xs()),vl(y,this.relativeTarget)),A&&(this.animationValues=u,uje(u,d,this.latestValues,j,b,x)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=j},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(Kh(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=ms.update(()=>{kj.hasAnimatedSinceResize=!0,this.currentAnimation=aje(0,eM,{...o,onUpdate:l=>{this.mixTargetDelta(l),o.onUpdate&&o.onUpdate(l)},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(eM),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:l,target:c,layout:d,latestValues:u}=o;if(!(!l||!c||!d)){if(this!==o&&this.layout&&d&&aY(this.options.animationType,this.layout.layoutBox,d.layoutBox)){c=this.target||Xs();const h=il(this.layout.layoutBox.x);c.x.min=o.target.x.min,c.x.max=c.x.min+h;const m=il(this.layout.layoutBox.y);c.y.min=o.target.y.min,c.y.max=c.y.min+m}vl(l,c),xA(l,u),fv(this.projectionDeltaWithTransform,this.layoutCorrected,l,u)}}registerSharedNode(o,l){this.sharedNodes.has(o)||this.sharedNodes.set(o,new xje),this.sharedNodes.get(o).add(l);const d=l.options.initialPromotionConfig;l.promote({transition:d?d.transition:void 0,preserveFollowOpacity:d&&d.shouldPreserveFollowOpacity?d.shouldPreserveFollowOpacity(l):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var o;const{layoutId:l}=this.options;return l?((o=this.getStack())===null||o===void 0?void 0:o.lead)||this:this}getPrevLead(){var o;const{layoutId:l}=this.options;return l?(o=this.getStack())===null||o===void 0?void 0:o.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:l,preserveFollowOpacity:c}={}){const d=this.getStack();d&&d.promote(this,c),o&&(this.projectionDelta=void 0,this.needsReset=!0),l&&this.setOptions({transition:l})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let l=!1;const{latestValues:c}=o;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(l=!0),!l)return;const d={};c.z&&B5("z",o,d,this.animationValues);for(let u=0;u<E5.length;u++)B5(`rotate${E5[u]}`,o,d,this.animationValues),B5(`skew${E5[u]}`,o,d,this.animationValues);o.render();for(const u in d)o.setStaticValue(u,d[u]),this.animationValues&&(this.animationValues[u]=d[u]);o.scheduleRender()}getProjectionStyles(o){var l,c;if(!this.instance||this.isSVG)return;if(!this.isVisible)return bje;const d={visibility:""},u=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,d.opacity="",d.pointerEvents=Cj(o==null?void 0:o.pointerEvents)||"",d.transform=u?u(this.latestValues,""):"none",d;const h=this.getLead();if(!this.projectionDelta||!this.layout||!h.target){const A={};return this.options.layoutId&&(A.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,A.pointerEvents=Cj(o==null?void 0:o.pointerEvents)||""),this.hasProjected&&!Vf(this.latestValues)&&(A.transform=u?u({},""):"none",this.hasProjected=!1),A}const m=h.animationValues||h.latestValues;this.applyTransformsToTarget(),d.transform=vje(this.projectionDeltaWithTransform,this.treeScale,m),u&&(d.transform=u(m,d.transform));const{x:f,y:p}=this.projectionDelta;d.transformOrigin=`${f.origin*100}% ${p.origin*100}% 0`,h.animationValues?d.opacity=h===this?(c=(l=m.opacity)!==null&&l!==void 0?l:this.latestValues.opacity)!==null&&c!==void 0?c:1:this.preserveOpacity?this.latestValues.opacity:m.opacityExit:d.opacity=h===this?m.opacity!==void 0?m.opacity:"":m.opacityExit!==void 0?m.opacityExit:0;for(const A in N2){if(m[A]===void 0)continue;const{correct:v,applyTo:x}=N2[A],b=d.transform==="none"?m[A]:v(m[A],h);if(x){const y=x.length;for(let w=0;w<y;w++)d[x[w]]=b}else d[A]=b}return this.options.layoutId&&(d.pointerEvents=h===this?Cj(o==null?void 0:o.pointerEvents)||"":"none"),d}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(o=>{var l;return(l=o.currentAnimation)===null||l===void 0?void 0:l.stop()}),this.root.nodes.forEach(tM),this.root.sharedNodes.clear()}}}function wje(e){e.updateLayout()}function jje(e){var t;const r=((t=e.resumeFrom)===null||t===void 0?void 0:t.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&r&&e.hasListeners("didUpdate")){const{layoutBox:s,measuredBox:a}=e.layout,{animationType:i}=e.options,o=r.source!==e.layout.source;i==="size"?Nl(h=>{const m=o?r.measuredBox[h]:r.layoutBox[h],f=il(m);m.min=s[h].min,m.max=m.min+f}):aY(i,r.layoutBox,s)&&Nl(h=>{const m=o?r.measuredBox[h]:r.layoutBox[h],f=il(s[h]);m.max=m.min+f,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[h].max=e.relativeTarget[h].min+f)});const l=AA();fv(l,s,r.layoutBox);const c=AA();o?fv(c,e.applyTransform(a,!0),r.measuredBox):fv(c,s,r.layoutBox);const d=!tY(l);let u=!1;if(!e.resumeFrom){const h=e.getClosestProjectingParent();if(h&&!h.resumeFrom){const{snapshot:m,layout:f}=h;if(m&&f){const p=Xs();mv(p,r.layoutBox,m.layoutBox);const A=Xs();mv(A,s,f.layoutBox),rY(p,A)||(u=!0),h.options.layoutRoot&&(e.relativeTarget=A,e.relativeTargetOrigin=p,e.relativeParent=h)}}}e.notifyListeners("didUpdate",{layout:s,snapshot:r,delta:c,layoutDelta:l,hasLayoutChanged:d,hasRelativeTargetChanged:u})}else if(e.isLead()){const{onExitComplete:s}=e.options;s&&s()}e.options.transition=void 0}function Nje(e){qx&&Gf.totalNodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function _je(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function Cje(e){e.clearSnapshot()}function tM(e){e.clearMeasurements()}function Sje(e){e.isLayoutDirty=!1}function kje(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function rM(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function Eje(e){e.resolveTargetDelta()}function Bje(e){e.calcProjection()}
vendor: 5,781 bytes, line 918
918function Tje(e){e.resetSkewAndRotation()}function Pje(e){e.removeLeadSnapshot()}function nM(e,t,r){e.translate=Bs(t.translate,0,r),e.scale=Bs(t.scale,1,r),e.origin=t.origin,e.originPoint=t.originPoint}function sM(e,t,r,s){e.min=Bs(t.min,r.min,s),e.max=Bs(t.max,r.max,s)}function Ije(e,t,r,s){sM(e.x,t.x,r.x,s),sM(e.y,t.y,r.y,s)}function Oje(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const Fje={duration:.45,ease:[.4,0,.1,1]},aM=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),iM=aM("applewebkit/")&&!aM("chrome/")?Math.round:Jo;function oM(e){e.min=iM(e.min),e.max=iM(e.max)}function Lje(e){oM(e.x),oM(e.y)}function aY(e,t,r){return e==="position"||e==="preserve-aspect"&&!U1e(XU(t),XU(r),.2)}function Dje(e){var t;return e!==e.root&&((t=e.scroll)===null||t===void 0?void 0:t.wasRoot)}const Rje=sY({attachResizeListener:(e,t)=>db(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),T5={current:void 0},iY=sY({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!T5.current){const e=new Rje({});e.mount(window),e.setOptions({layoutScroll:!0}),T5.current=e}return T5.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),Uje={pan:{Feature:tje},drag:{Feature:eje,ProjectionNode:iY,MeasureLayout:XW}};function lM(e,t,r){const{props:s}=e;e.animationState&&s.whileHover&&e.animationState.setActive("whileHover",r==="Start");const a="onHover"+r,i=s[a];i&&ms.postRender(()=>i(t,Iy(t)))}class Mje extends af{mount(){const{current:t}=this.node;t&&(this.unmount=$ye(t,r=>(lM(this.node,r,"Start"),s=>lM(this.node,s,"End"))))}unmount(){}}class $je extends af{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Py(db(this.node.current,"focus",()=>this.onFocus()),db(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function cM(e,t,r){const{props:s}=e;e.animationState&&s.whileTap&&e.animationState.setActive("whileTap",r==="Start");const a="onTap"+(r==="End"?"":r),i=s[a];i&&ms.postRender(()=>i(t,Iy(t)))}class Qje extends af{mount(){const{current:t}=this.node;t&&(this.unmount=Vye(t,r=>(cM(this.node,r,"Start"),(s,{success:a})=>cM(this.node,s,a?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const UB=new WeakMap,P5=new WeakMap,Hje=e=>{const t=UB.get(e.target);t&&t(e)},zje=e=>{e.forEach(Hje)};function Vje({root:e,...t}){const r=e||document;P5.has(r)||P5.set(r,{});const s=P5.get(r),a=JSON.stringify(t);return s[a]||(s[a]=new IntersectionObserver(zje,{root:e,...t})),s[a]}function Gje(e,t,r){const s=Vje(t);return UB.set(e,r),s.observe(e),()=>{UB.delete(e),s.unobserve(e)}}const qje={some:0,all:1};class Kje extends af{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:r,margin:s,amount:a="some",once:i}=t,o={root:r?r.current:void 0,rootMargin:s,threshold:typeof a=="number"?a:qje[a]},l=c=>{const{isIntersecting:d}=c;if(this.isInView===d||(this.isInView=d,i&&!d&&this.hasEnteredView))return;d&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",d);const{onViewportEnter:u,onViewportLeave:h}=this.node.getProps(),m=d?u:h;m&&m(c)};return Gje(this.node.current,o,l)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:r}=this.node;["amount","margin","root"].some(Wje(t,r))&&this.startObserver()}unmount(){}}function Wje({viewport:e={}},{viewport:t={}}={}){return r=>e[r]!==t[r]}const Yje={inView:{Feature:Kje},tap:{Feature:Qje},focus:{Feature:$je},hover:{Feature:Mje}},Jje={layout:{ProjectionNode:iY,MeasureLayout:XW}},MB={current:null},oY={current:!1};function Xje(){if(oY.current=!0,!!TI)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>MB.current=e.matches;e.addListener(t),t()}else MB.current=!1}const Zje=[...TW,ji,Wh],e2e=e=>Zje.find(BW(e)),dM=new WeakMap;function t2e(e,t,r){for(const s in t){const a=t[s],i=r[s];if(ki(a))e.addValue(s,a);else if(ki(i))e.addValue(s,lb(a,{owner:e}));else if(i!==a)if(e.hasValue(s)){const o=e.getValue(s);o.liveStyle===!0?o.jump(a):o.hasAnimated||o.set(a)}else{const o=e.getStaticValue(s);e.addValue(s,lb(o!==void 0?o:a,{owner:e}))}}for(const s in r)t[s]===void 0&&e.removeValue(s);return t}const uM=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class r2e{scrapeMotionValuesFromProps(t,r,s){return{}}constructor({parent:t,props:r,presenceContext:s,reducedMotionConfig:a,blockInitialAnimation:i,visualState:o},l={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=iO,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const f=dd.now();this.renderScheduledAt<f&&(this.renderScheduledAt=f,ms.render(this.render,!1,!0))};
vendor: 4,592 bytes, line 918
918const{latestValues:c,renderState:d,onUpdate:u}=o;this.onUpdate=u,this.latestValues=c,this.baseTarget={...c},this.initialValues=r.initial?{...c}:{},this.renderState=d,this.parent=t,this.props=r,this.presenceContext=s,this.depth=t?t.depth+1:0,this.reducedMotionConfig=a,this.options=l,this.blockInitialAnimation=!!i,this.isControllingVariants=rC(r),this.isVariantNode=UK(r),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:h,...m}=this.scrapeMotionValuesFromProps(r,{},this);for(const f in m){const p=m[f];c[f]!==void 0&&ki(p)&&p.set(c[f],!1)}}mount(t){this.current=t,dM.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((r,s)=>this.bindToMotionValue(s,r)),oY.current||Xje(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:MB.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){dM.delete(this.current),this.projection&&this.projection.unmount(),Kh(this.notifyUpdate),Kh(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const r=this.features[t];r&&(r.unmount(),r.isMounted=!1)}this.current=null}bindToMotionValue(t,r){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const s=Zm.has(t),a=r.on("change",l=>{this.latestValues[t]=l,this.props.onUpdate&&ms.preRender(this.notifyUpdate),s&&this.projection&&(this.projection.isTransformDirty=!0)}),i=r.on("renderRequest",this.scheduleRender);let o;window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,t,r)),this.valueSubscriptions.set(t,()=>{a(),i(),o&&o(),r.owner&&r.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in ug){const r=ug[t];if(!r)continue;const{isEnabled:s,Feature:a}=r;if(!this.features[t]&&a&&s(this.props)&&(this.features[t]=new a(this)),this.features[t]){const i=this.features[t];i.isMounted?i.update():(i.mount(),i.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Xs()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,r){this.latestValues[t]=r}update(t,r){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=r;for(let s=0;s<uM.length;s++){const a=uM[s];this.propEventSubscriptions[a]&&(this.propEventSubscriptions[a](),delete this.propEventSubscriptions[a]);const i="on"+a,o=t[i];o&&(this.propEventSubscriptions[a]=this.on(a,o))}this.prevMotionValues=t2e(this,this.scrapeMotionValuesFromProps(t,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue(),this.onUpdate&&this.onUpdate(this)}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const r=this.getClosestVariantNode();if(r)return r.variantChildren&&r.variantChildren.add(t),()=>r.variantChildren.delete(t)}addValue(t,r){const s=this.values.get(t);r!==s&&(s&&this.removeValue(t),this.bindToMotionValue(t,r),this.values.set(t,r),this.latestValues[t]=r.get())}removeValue(t){this.values.delete(t);const r=this.valueSubscriptions.get(t);r&&(r(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,r){if(this.props.values&&this.props.values[t])return this.props.values[t];let s=this.values.get(t);return s===void 0&&r!==void 0&&(s=lb(r===null?void 0:r,{owner:this}),this.addValue(t,s)),s}readValue(t,r){var s;let a=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:(s=this.getBaseTargetFromProps(this.props,t))!==null&&s!==void 0?s:this.readValueFromInstance(this.current,t,this.options);
918return a!=null&&(typeof a=="string"&&(kW(a)||vW(a))?a=parseFloat(a):!e2e(a)&&Wh.test(r)&&(a=_W(t,r)),this.setBaseTarget(t,ki(a)?a.get():a)),ki(a)?a.get():a}setBaseTarget(t,r){this.baseTarget[t]=r}getBaseTarget(t){var r;const{initial:s}=this.props;let a;if(typeof s=="string"||typeof s=="object"){const o=UI(this.props,s,(r=this.presenceContext)===null||r===void 0?void 0:r.custom);o&&(a=o[t])}if(s&&a!==void 0)return a;const i=this.getBaseTargetFromProps(this.props,t);return i!==void 0&&!ki(i)?i:this.initialValues[t]!==void 0&&a===void 0?void 0:this.baseTarget[t]}on(t,r){return this.events[t]||(this.events[t]=new ZI),this.events[t].add(r)}notify(t,...r){this.events[t]&&this.events[t].notify(...r)}}class lY extends r2e{constructor(){super(...arguments),this.KeyframeResolver=PW}sortInstanceNodePosition(t,r){return t.compareDocumentPosition(r)&2?1:-1}getBaseTargetFromProps(t,r){return t.style?t.style[r]:void 0}removeValueFromRenderState(t,{vars:r,style:s}){delete r[t],delete s[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;ki(t)&&(this.childSubscription=t.on("change",r=>{this.current&&(this.current.textContent=`${r}`)}))}}function n2e(e){return window.getComputedStyle(e)}class s2e extends lY{constructor(){super(...arguments),this.type="html",this.renderInstance=KK}readValueFromInstance(t,r){if(Zm.has(r)){const s=aO(r);return s&&s.default||0}else{const s=n2e(t),a=(VK(r)?s.getPropertyValue(r):s[r])||0;return typeof a=="string"?a.trim():a}}measureInstanceViewportBox(t,{transformPagePoint:r}){return YW(t,r)}build(t,r,s){QI(t,r,s.transformTemplate)}scrapeMotionValuesFromProps(t,r,s){return GI(t,r,s)}}class a2e extends lY{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Xs}getBaseTargetFromProps(t,r){return t[r]}readValueFromInstance(t,r){if(Zm.has(r)){const s=aO(r);return s&&s.default||0}return r=WK.has(r)?r:LI(r),t.getAttribute(r)}scrapeMotionValuesFromProps(t,r,s){return XK(t,r,s)}build(t,r,s){HI(t,r,this.isSVGTag,s.transformTemplate)}renderInstance(t,r,s,a){YK(t,r,s,a)}mount(t){this.isSVGTag=VI(t.tagName),super.mount(t)}}const i2e=(e,t)=>RI(e)?new a2e(t):new s2e(t,{allowProjection:e!==g.Fragment}),o2e=Oye({...B1e,...Yje,...Uje,...Jje},i2e),ut=Wbe(o2e);function l2e(e){e.values.forEach(t=>t.stop())}function $B(e,t){[...t].reverse().forEach(s=>{const a=e.getVariant(s);a&&eO(e,a),e.variantChildren&&e.variantChildren.forEach(i=>{$B(i,t)})})}function c2e(e,t){if(Array.isArray(t))return $B(e,t);if(typeof t=="string")return $B(e,[t]);eO(e,t)}function d2e(){const e=new Set,t={subscribe(r){return e.add(r),()=>void e.delete(r)},start(r,s){const a=[];return e.forEach(i=>{a.push($W(i,r,{transitionOverride:s}))}),Promise.all(a)},set(r){return e.forEach(s=>{c2e(s,r)})},stop(){e.forEach(r=>{l2e(r)})},mount(){return()=>{t.stop()}}};return t}function u2e(){const e=X_(d2e);return PI(e.mount,[]),e}const h2e=u2e,f2e="/assets/scan_dna-B0VWJ1wX.png",m2e="/assets/convergences-BU9oyaqY.png",p2e="/assets/small_review_email-C3qe-H9b.png",A2e="/assets/lots_of_news_items-BICmYCYe.jpg";function g2e({className:e,children:t,from:r="from-blue-500",to:s="to-blue-200",via:a,...i}){const o=a?`bg-gradient-to-r ${r} ${a} ${s}`:`bg-gradient-to-r ${r} ${s}`;return n.jsx("span",{className:ye(o,"bg-clip-text text-transparent font-bold",e),...i,children:t})}const Zt=hI,aC=QG,QB=uI,B2=g.forwardRef(({className:e,...t},r)=>n.jsx(by,{ref:r,className:ye("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",e),...t}));B2.displayName=by.displayName;const Jt=g.forwardRef(({className:e,children:t,...r},s)=>n.jsxs(QB,{children:[n.jsx(B2,{}),n.jsxs(yy,{ref:s,className:ye("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rou
918nded-lg",e),...r,children:[t,n.jsxs(P_,{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-accent data-[state=open]:text-muted-foreground",children:[n.jsx(kr,{className:"h-4 w-4"}),n.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Jt.displayName=yy.displayName;const _r=({className:e,...t})=>n.jsx("div",{className:ye("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});_r.displayName="DialogHeader";const Sn=({className:e,...t})=>n.jsx("div",{className:ye("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Sn.displayName="DialogFooter";const tr=g.forwardRef(({className:e,...t},r)=>n.jsx(wy,{ref:r,className:ye("text-lg font-semibold leading-none tracking-tight",e),...t}));tr.displayName=wy.displayName;const Hr=g.forwardRef(({className:e,...t},r)=>n.jsx(jy,{ref:r,className:ye("text-sm text-muted-foreground",e),...t}));Hr.displayName=jy.displayName;const x2e="https://pub-7e4759089ab0451cb1078bcf98a99f64.r2.dev/rainfactory_demo.mp4";function v2e({isOpen:e,onClose:t,videoUrl:r=x2e,videoTitle:s="Rainfactory Demo"}){const a=g.useRef(null);return g.useEffect(()=>{e&&a.current?(cg(lg.VIDEO_START,void 0,{video_title:s,video_url:r}),a.current.play().catch(i=>{console.warn("Video autoplay failed:",i)})):!e&&a.current&&(a.current.pause(),a.current.currentTime=0)},[e,s,r]),n.jsx(Zt,{open:e,onOpenChange:t,children:n.jsx(Jt,{className:"sm:max-w-[800px] p-0 overflow-hidden",children:n.jsxs("div",{className:"relative",children:[n.jsx(te,{variant:"ghost",size:"icon",className:"absolute right-2 top-2 z-10 bg-background/80 backdrop-blur-sm",onClick:t,children:n.jsx(kr,{className:"h-4 w-4"})}),n.jsx("div",{className:"aspect-video w-full",children:n.jsx("video",{ref:a,src:r,title:"Rainfactory Demo Video",className:"w-full h-full",controls:!0,playsInline:!0,muted:!0,autoPlay:!0})})]})})})}const b2e={direction:"forward",speed:2,startDelay:1e3,active:!0,breakpoints:{},playOnInit:!0,stopOnFocusIn:!0,stopOnInteraction:!0,stopOnMouseEnter:!1,rootNode:null};function y2e(e,t){const r=e.rootNode();return t&&t(r)||r}function dO(e={}){let t,r,s,a,i=0,o=!1,l=!1,c;function d(C,E){r=C;const{mergeOptions:T,optionsAtMedia:B}=E,L=T(b2e,dO.globalOptions),P=T(L,e);if(t=B(P),r.scrollSnapList().length<=1)return;a=t.startDelay,s=!1,c=r.internalEngine().scrollBody;const{eventStore:F}=r.internalEngine(),M=!!r.internalEngine().options.watchDrag,I=y2e(r,t.rootNode);M&&r.on("pointerDown",p),M&&!t.stopOnInteraction&&r.on("pointerUp",A),t.stopOnMouseEnter&&F.add(I,"mouseenter",v),t.stopOnMouseEnter&&!t.stopOnInteraction&&F.add(I,"mouseleave",x),t.stopOnFocusIn&&r.on("slideFocusStart",m),t.stopOnFocusIn&&!t.stopOnInteraction&&F.add(r.containerNode(),"focusout",h),t.playOnInit&&h()}function u(){r.off("pointerDown",p).off("pointerUp",A).off("slideFocusStart",m).off("settle",b),m(),s=!0,o=!1}function h(){if(s||o)return;r.emit("autoScroll:play");const C=r.internalEngine(),{ownerWindow:E}=C;i=E.setTimeout(()=>{C.scrollBody=f(C),C.animation.start()},a),o=!0}function m(){if(s||!o)return;r.emit("autoScroll:stop");const C=r.internalEngine(),{ownerWindow:E}=C;C.scrollBody=c,E.clearTimeout(i),i=0,o=!1}function f(C){const{location:E,previousLocation:T,offsetLocation:B,target:L,scrollTarget:P,index:F,indexPrevious:M,limit:{reachedMin:I,reachedMax:$,constrain:V},options:{loop:R}}=C,Q=t.direction==="forward"?-1:1,U=()=>ne;let D=0,q=0,G=E.get(),Y=0,K=!1;function X(){let ae=0;T.set(E),D=Q*t.speed,G+=D,E.add(D),L.set(E),ae=G-Y,q=Math.sign(ae),Y=G;const J=P.byDistance(0,!1).index;F.get()!==J&&(M.set(F.get()),F.set(J),r.emit("select"));const W=t.direction==="forward"?I(B.get()):$(B.get());if(!R&&W){K=!0;const ie=V(E.get());E.set(ie),L.set(E),m()}return ne}const ne={direction:()=>q,duration:()=>-1,velocity:()=>D,settled:()=>K,seek:X,useBaseFriction:U,useBaseDuration:U,useFriction:U,useDuration:U};return ne}function p(){l||m()}function A(){l||y()}function v(){l=!0,m()}function x(){l=!1,h()}function b(){r.off("settle",b),h()}function y(){r.on("settle",b)}function w(C){typeof C<"u"&&(a=C),h()}function j(){o&&m()}function N(){o&&(m(),y())}function _(){return o}return{name:"autoScroll",options:e,init:d,destroy:u,play:w,stop:j,reset:N,isPlaying:_}}dO.globalOptions=void 0;const w2e="/assets/small-globetrotter-CTdEVy3g.png",j2e="/assets/small-selfhealix-DK1DlXqP.png",N2e="/assets/small-operationalai-C2f_rx3-.png",_2e="/assets/small-apex-mode-HENQPvDC.png",C2e="/assets/small-ever-retire-DSRG_i4i.png",S2e="/assets/small-cultivated-cup-B9O2nRhA.png",k2e="/assets/small-todoai-CCVHs3au.png";function E2e(e){return Object.prototype.toString.call(e)==="[object Object]"}function hM(e){return E2e(e)||Array.isArray(e)}function B2e(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}function uO(e,t){const r=Object.keys(e),s=Object.keys(t);if(r.length!==s.length)return!1;const a=JSON.stringify(Object.keys(e.breakpoints||{})),i=JSON.stringify(Object.keys(t.breakpoints||{}));return a!==i?!1:r.every(o=>{const l=e[o],c=t[o];return typeof l=="function"?`${l}`==`${c}`:!hM(l)||!hM(c)?l===c:uO(l,c)})}function fM(e){return e.concat().sort((t,r)=>t.name>
vendor: 5,282 bytes, line 918
918r.name?1:-1).map(t=>t.options)}function T2e(e,t){if(e.length!==t.length)return!1;const r=fM(e),s=fM(t);return r.every((a,i)=>{const o=s[i];return uO(a,o)})}function hO(e){return typeof e=="number"}function HB(e){return typeof e=="string"}function iC(e){return typeof e=="boolean"}function mM(e){return Object.prototype.toString.call(e)==="[object Object]"}function Ts(e){return Math.abs(e)}function fO(e){return Math.sign(e)}function pv(e,t){return Ts(e-t)}function P2e(e,t){if(e===0||t===0||Ts(e)<=Ts(t))return 0;const r=pv(Ts(e),Ts(t));return Ts(r/e)}function I2e(e){return Math.round(e*100)/100}function ub(e){return hb(e).map(Number)}function bc(e){return e[Oy(e)]}function Oy(e){return Math.max(0,e.length-1)}function mO(e,t){return t===Oy(e)}function pM(e,t=0){return Array.from(Array(e),(r,s)=>t+s)}function hb(e){return Object.keys(e)}function cY(e,t){return[e,t].reduce((r,s)=>(hb(s).forEach(a=>{const i=r[a],o=s[a],l=mM(i)&&mM(o);r[a]=l?cY(i,o):o}),r),{})}function zB(e,t){return typeof t.MouseEvent<"u"&&e instanceof t.MouseEvent}function O2e(e,t){const r={start:s,center:a,end:i};function s(){return 0}function a(c){return i(c)/2}function i(c){return t-c}function o(c,d){return HB(e)?r[e](c):e(t,c,d)}return{measure:o}}function fb(){let e=[];function t(a,i,o,l={passive:!0}){let c;if("addEventListener"in a)a.addEventListener(i,o,l),c=()=>a.removeEventListener(i,o,l);else{const d=a;d.addListener(o),c=()=>d.removeListener(o)}return e.push(c),s}function r(){e=e.filter(a=>a())}const s={add:t,clear:r};return s}function F2e(e,t,r,s){const a=fb(),i=1e3/60;let o=null,l=0,c=0;function d(){a.add(e,"visibilitychange",()=>{e.hidden&&p()})}function u(){f(),a.clear()}function h(v){if(!c)return;o||(o=v,r(),r());const x=v-o;for(o=v,l+=x;l>=i;)r(),l-=i;const b=l/i;s(b),c&&(c=t.requestAnimationFrame(h))}function m(){c||(c=t.requestAnimationFrame(h))}function f(){t.cancelAnimationFrame(c),o=null,l=0,c=0}function p(){o=null,l=0}return{init:d,destroy:u,start:m,stop:f,update:r,render:s}}function L2e(e,t){const r=t==="rtl",s=e==="y",a=s?"y":"x",i=s?"x":"y",o=!s&&r?-1:1,l=u(),c=h();function d(p){const{height:A,width:v}=p;return s?A:v}function u(){return s?"top":r?"right":"left"}function h(){return s?"bottom":r?"left":"right"}function m(p){return p*o}return{scroll:a,cross:i,startEdge:l,endEdge:c,measureSize:d,direction:m}}function Lm(e=0,t=0){const r=Ts(e-t);function s(d){return d<e}function a(d){return d>t}function i(d){return s(d)||a(d)}function o(d){return i(d)?s(d)?e:t:d}function l(d){return r?d-r*Math.ceil((d-t)/r):d}return{length:r,max:t,min:e,constrain:o,reachedAny:i,reachedMax:a,reachedMin:s,removeOffset:l}}function dY(e,t,r){const{constrain:s}=Lm(0,e),a=e+1;let i=o(t);function o(m){return r?Ts((a+m)%a):s(m)}function l(){return i}function c(m){return i=o(m),h}function d(m){return u().set(l()+m)}function u(){return dY(e,l(),r)}const h={get:l,set:c,add:d,clone:u};return h}function D2e(e,t,r,s,a,i,o,l,c,d,u,h,m,f,p,A,v,x,b){const{cross:y,direction:w}=e,j=["INPUT","SELECT","TEXTAREA"],N={passive:!1},_=fb(),S=fb(),C=Lm(50,225).constrain(f.measure(20)),E={mouse:300,touch:400},T={mouse:500,touch:600},B=p?43:25;let L=!1,P=0,F=0,M=!1,I=!1,$=!1,V=!1;function R(W){if(!b)return;function ie(ee){(iC(b)||b(W,ee))&&Y(ee)}const he=t;_.add(he,"dragstart",ee=>ee.preventDefault(),N).add(he,"touchmove",()=>{},N).add(he,"touchend",()=>{}).add(he,"touchstart",ie).add(he,"mousedown",ie).add(he,"touchcancel",X).add(he,"contextmenu",X).add(he,"click",ne,!0)}function Q(){_.clear(),S.clear()}function U(){const W=V?r:t;S.add(W,"touchmove",K,N).add(W,"touchend",X).add(W,"mousemove",K,N).add(W,"mouseup",X)}function D(W){const ie=W.nodeName||"";return j.includes(ie)}function q(){return(p?T:E)[V?"mouse":"touch"]}function G(W,ie){const he=h.add(fO(W)*-1),ee=u.byDistance(W,!p).distance;return p||Ts(W)<C?ee:v&&ie?ee*.5:u.byIndex(he.get(),0).distance}function Y(W){const ie=zB(W,s);V=ie,$=p&&ie&&!W.buttons&&L,L=pv(a.get(),o.get())>=2,!(ie&&W.button!==0)&&(D(W.target)||(M=!0,i.pointerDown(W),d.useFriction(0).useDuration(0),a.set(o),U(),P=i.readPoint(W),F=i.readPoint(W,y),m.emit("pointerDown")))}function K(W){if(!zB(W,s)&&W.touches.length>=2)return X(W);const he=i.readPoint(W),ee=i.readPoint(W,y),xe=pv(he,P),we=pv(ee,F);if(!I&&!V&&(!W.cancelable||(I=xe>we,!I)))return X(W);const Se=i.pointerMove(W);xe>A&&($=!0),d.useFriction(.3).useDuration(.75),l.start(),a.add(w(Se)),W.preventDefault()}function X(W){const he=u.byDistance(0,!1).index!==h.get(),ee=i.pointerUp(W)*q(),xe=G(w(ee),he),we=P2e(ee,xe),Se=B-10*we,pe=x+we/50;I=!1,M=!1,S.clear(),d.useDuration(Se).useFriction(pe),c.distance(xe,!p),V=!1,m.emit("pointerUp")}function ne(W){$&&(W.stopPropagation(),W.preventDefault(),$=!1)}function ae(){return M}return{init:R,destroy:Q,pointerDown:ae}}function R2e(e,t){let s,a;function i(h){return h.timeStamp}function o(h,m){const p=`client${(m||e.scroll)==="x"?"X":"Y"}`;return(zB(h,t)?h:h.touches[0])[p]}function l(h){return s=h,a=h,o(h)}function c(h){const m=o(h)-o(a),f=i(h)-i(s)>170;return a=h,f&&(s=h),m}function d(h){if(!s||!a)return 0;const m=o(a)-o(s),f=i(h)-i(s),p=i(h)-i(a)>170,A=m/f;return f&&!p&&Ts(A)>.1?A:0}return{pointerDown:l,pointerMove:c,pointerUp:d,readPoint:o}}function U2e(){function e(r){const{offsetTop:s,offsetLeft:a,offsetWidth:i,offsetHeight:o}=r;
vendor: 13,471 bytes, line 918
918return{top:s,right:a+i,bottom:s+o,left:a,width:i,height:o}}return{measure:e}}function M2e(e){function t(s){return e*(s/100)}return{measure:t}}function $2e(e,t,r,s,a,i,o){const l=[e].concat(s);let c,d,u=[],h=!1;function m(v){return a.measureSize(o.measure(v))}function f(v){if(!i)return;d=m(e),u=s.map(m);function x(b){for(const y of b){if(h)return;const w=y.target===e,j=s.indexOf(y.target),N=w?d:u[j],_=m(w?e:s[j]);if(Ts(_-N)>=.5){v.reInit(),t.emit("resize");break}}}c=new ResizeObserver(b=>{(iC(i)||i(v,b))&&x(b)}),r.requestAnimationFrame(()=>{l.forEach(b=>c.observe(b))})}function p(){h=!0,c&&c.disconnect()}return{init:f,destroy:p}}function Q2e(e,t,r,s,a,i){let o=0,l=0,c=a,d=i,u=e.get(),h=0;function m(){const N=s.get()-e.get(),_=!c;let S=0;return _?(o=0,r.set(s),e.set(s),S=N):(r.set(e),o+=N/c,o*=d,u+=o,e.add(o),S=u-h),l=fO(S),h=u,j}function f(){const N=s.get()-t.get();return Ts(N)<.001}function p(){return c}function A(){return l}function v(){return o}function x(){return y(a)}function b(){return w(i)}function y(N){return c=N,j}function w(N){return d=N,j}const j={direction:A,duration:p,velocity:v,seek:m,settled:f,useBaseFriction:b,useBaseDuration:x,useFriction:w,useDuration:y};return j}function H2e(e,t,r,s,a){const i=a.measure(10),o=a.measure(50),l=Lm(.1,.99);let c=!1;function d(){return!(c||!e.reachedAny(r.get())||!e.reachedAny(t.get()))}function u(f){if(!d())return;const p=e.reachedMin(t.get())?"min":"max",A=Ts(e[p]-t.get()),v=r.get()-t.get(),x=l.constrain(A/o);r.subtract(v*x),!f&&Ts(v)<i&&(r.set(e.constrain(r.get())),s.useDuration(25).useBaseFriction())}function h(f){c=!f}return{shouldConstrain:d,constrain:u,toggleActive:h}}function z2e(e,t,r,s,a){const i=Lm(-t+e,0),o=h(),l=u(),c=m();function d(p,A){return pv(p,A)<=1}function u(){const p=o[0],A=bc(o),v=o.lastIndexOf(p),x=o.indexOf(A)+1;return Lm(v,x)}function h(){return r.map((p,A)=>{const{min:v,max:x}=i,b=i.constrain(p),y=!A,w=mO(r,A);return y?x:w||d(v,b)?v:d(x,b)?x:b}).map(p=>parseFloat(p.toFixed(3)))}function m(){if(t<=e+a)return[i.max];if(s==="keepSnaps")return o;const{min:p,max:A}=l;return o.slice(p,A)}return{snapsContained:c,scrollContainLimit:l}}function V2e(e,t,r){const s=t[0],a=r?s-e:bc(t);return{limit:Lm(a,s)}}function G2e(e,t,r,s){const i=t.min+.1,o=t.max+.1,{reachedMin:l,reachedMax:c}=Lm(i,o);function d(m){return m===1?c(r.get()):m===-1?l(r.get()):!1}function u(m){if(!d(m))return;const f=e*(m*-1);s.forEach(p=>p.add(f))}return{loop:u}}function q2e(e){const{max:t,length:r}=e;function s(i){const o=i-t;return r?o/-r:0}return{get:s}}function K2e(e,t,r,s,a){const{startEdge:i,endEdge:o}=e,{groupSlides:l}=a,c=h().map(t.measure),d=m(),u=f();function h(){return l(s).map(A=>bc(A)[o]-A[0][i]).map(Ts)}function m(){return s.map(A=>r[i]-A[i]).map(A=>-Ts(A))}function f(){return l(d).map(A=>A[0]).map((A,v)=>A+c[v])}return{snaps:d,snapsAligned:u}}function W2e(e,t,r,s,a,i){const{groupSlides:o}=a,{min:l,max:c}=s,d=u();function u(){const m=o(i),f=!e||t==="keepSnaps";return r.length===1?[i]:f?m:m.slice(l,c).map((p,A,v)=>{const x=!A,b=mO(v,A);if(x){const y=bc(v[0])+1;return pM(y)}if(b){const y=Oy(i)-bc(v)[0]+1;return pM(y,bc(v)[0])}return p})}return{slideRegistry:d}}function Y2e(e,t,r,s,a){const{reachedAny:i,removeOffset:o,constrain:l}=s;function c(p){return p.concat().sort((A,v)=>Ts(A)-Ts(v))[0]}function d(p){const A=e?o(p):l(p),v=t.map((b,y)=>({diff:u(b-A,0),index:y})).sort((b,y)=>Ts(b.diff)-Ts(y.diff)),{index:x}=v[0];return{index:x,distance:A}}function u(p,A){const v=[p,p+r,p-r];if(!e)return p;if(!A)return c(v);const x=v.filter(b=>fO(b)===A);return x.length?c(x):bc(v)-r}function h(p,A){const v=t[p]-a.get(),x=u(v,A);return{index:p,distance:x}}function m(p,A){const v=a.get()+p,{index:x,distance:b}=d(v),y=!e&&i(v);if(!A||y)return{index:x,distance:p};const w=t[x]-b,j=p+u(w,0);return{index:x,distance:j}}return{byDistance:m,byIndex:h,shortcut:u}}function J2e(e,t,r,s,a,i,o){function l(h){const m=h.distance,f=h.index!==t.get();i.add(m),m&&(s.duration()?e.start():(e.update(),e.render(1),e.update())),f&&(r.set(t.get()),t.set(h.index),o.emit("select"))}function c(h,m){const f=a.byDistance(h,m);l(f)}function d(h,m){const f=t.clone().set(h),p=a.byIndex(f.get(),m);l(p)}return{distance:c,index:d}}function X2e(e,t,r,s,a,i,o,l){const c={passive:!0,capture:!0};let d=0;function u(f){if(!l)return;function p(A){if(new Date().getTime()-d>10)return;o.emit("slideFocusStart"),e.scrollLeft=0;const b=r.findIndex(y=>y.includes(A));hO(b)&&(a.useDuration(0),s.index(b,0),o.emit("slideFocus"))}i.add(document,"keydown",h,!1),t.forEach((A,v)=>{i.add(A,"focus",x=>{(iC(l)||l(f,x))&&p(v)},c)})}function h(f){f.code==="Tab"&&(d=new Date().getTime())}return{init:u}}function Kx(e){let t=e;function r(){return t}function s(c){t=o(c)}function a(c){t+=o(c)}function i(c){t-=o(c)}function o(c){return hO(c)?c:c.get()}return{get:r,set:s,add:a,subtract:i}}function uY(e,t){const r=e.scroll==="x"?o:l,s=t.style;let a=null,i=!1;function o(m){return`translate3d(${m}px,0px,0px)`}function l(m){return`translate3d(0px,${m}px,0px)`}function c(m){if(i)return;const f=I2e(e.direction(m));f!==a&&(s.transform=r(f),a=f)}function d(m){i=!m}function u(){i||(s.transform="",t.getAttribute("style")||t.removeAttribute("style"))}return{clear:u,to:c,toggleActive:d}}function Z2e(e,t,r,s,a,i,o,l,c){const u=ub(a),h=ub(a).reverse(),m=x().concat(b());function f(_,S){return _.reduce((C,E)=>C-a[E],S)}function p(_,S){return _.reduce((C,E)=>f(C,S)>0?C.concat([E]):C,[])}function A(_){return i.map((S,C)=>({start:S-s[C]+.5+_,end:S+t-.5+_}))}function v(_,S,C){const E=A(S);return _.map(T=>{const B=C?0:-r,L=C?r:0,P=C?"end":"start",F=E[T][P];return{index:T,loopPoint:F,slideLocation:Kx(-1),translate:uY(e,c[T]),target:()=>l.get()>F?B:L}})}function x(){const _=o[0],S=p(h,_);return v(S,r,!1)}function b(){const _=t-o[0]-1,S=p(u,_);return v(S,-r,!0)}function y(){return m.every(({index:_})=>{const S=u.filter(C=>C!==_);return f(S,t)<=.1})}function w(){m.forEach(_=>{const{target:S,translate:C,slideLocation:E}=_,T=S();T!==E.get()&&(C.to(T),E.set(T))})}function j(){m.forEach(_=>_.translate.clear())}return{canLoop:y,clear:j,loop:w,loopPoints:m}}function eNe(e,t,r){let s,a=!1;function i(c){if(!r)return;function d(u){for(const h of u)if(h.type==="childList"){c.reInit(),t.emit("slidesChanged");break}}s=new MutationObserver(u=>{a||(iC(r)||r(c,u))&&d(u)}),s.observe(e,{childList:!0})}function o(){s&&s.disconnect(),a=!0}return{init:i,destroy:o}}function tNe(e,t,r,s){const a={};let i=null,o=null,l,c=!1;function d(){l=new IntersectionObserver(p=>{c||(p.forEach(A=>{const v=t.indexOf(A.target);a[v]=A}),i=null,o=null,r.emit("slidesInView"))},{root:e.parentElement,threshold:s}),t.forEach(p=>l.observe(p))}function u(){l&&l.disconnect(),c=!0}function h(p){return hb(a).reduce((A,v)=>{const x=parseInt(v),{isIntersecting:b}=a[x];return(p&&b||!p&&!b)&&A.push(x),A},[])}function m(p=!0){if(p&&i)return i;if(!p&&o)return o;const A=h(p);return p&&(i=A),p||(o=A),A}return{init:d,destroy:u,get:m}}function rNe(e,t,r,s,a,i){const{measureSize:o,startEdge:l,endEdge:c}=e,d=r[0]&&a,u=p(),h=A(),m=r.map(o),f=v();function p(){if(!d)return 0;const b=r[0];return Ts(t[l]-b[l])}function A(){if(!d)return 0;const b=i.getComputedStyle(bc(s));return parseFloat(b.getPropertyValue(`margin-${c}`))}function v(){return r.map((b,y,w)=>{const j=!y,N=mO(w,y);return j?m[y]+u:N?m[y]+h:w[y+1][l]-b[l]}).map(Ts)}return{slideSizes:m,slideSizesWithGaps:f,startGap:u,endGap:h}}function nNe(e,t,r,s,a,i,o,l,c){const{startEdge:d,endEdge:u,direction:h}=e,m=hO(r);function f(x,b){return ub(x).filter(y=>y%b===0).map(y=>x.slice(y,y+b))}function p(x){return x.length?ub(x).reduce((b,y,w)=>{const j=bc(b)||0,N=j===0,_=y===Oy(x),S=a[d]-i[j][d],C=a[d]-i[y][u],E=!s&&N?h(o):0,T=!s&&_?h(l):0,B=Ts(C-T-(S+E));return w&&B>t+c&&b.push(y),_&&b.push(x.length),b},[]).map((b,y,w)=>{const j=Math.max(w[y-1]||0);return x.slice(j,b)}):[]}function A(x){return m?f(x,r):p(x)}return{groupSlides:A}}function sNe(e,t,r,s,a,i,o){const{align:l,axis:c,direction:d,startIndex:u,loop:h,duration:m,dragFree:f,dragThreshold:p,inViewThreshold:A,slidesToScroll:v,skipSnaps:x,containScroll:b,watchResize:y,watchSlides:w,watchDrag:j,watchFocus:N}=i,_=2,S=U2e(),C=S.measure(t),E=r.map(S.measure),T=L2e(c,d),B=T.measureSize(C),L=M2e(B),P=O2e(l,B),F=!h&&!!b,M=h||!!b,{slideSizes:I,slideSizesWithGaps:$,startGap:V,endGap:R}=rNe(T,C,E,r,M,a),Q=nNe(T,B,v,h,C,E,V,R,_),{snaps:U,snapsAligned:D}=K2e(T,P,C,E,Q),q=-bc(U)+bc($),{snapsContained:G,scrollContainLimit:Y}=z2e(B,q,D,b,_),K=F?G:D,{limit:X}=V2e(q,K,h),ne=dY(Oy(K),u,h),ae=ne.clone(),J=ub(r),W=({dragHandler:Ge,scrollBody:Ye,scrollBounds:Tt,options:{loop:Nt}})=>{Nt||Tt.constrain(Ge.pointerDown()),Ye.seek()},ie=({scrollBody:Ge,translate:Ye,location:Tt,offsetLocation:Nt,previousLocation:Pt,scrollLooper:_t,slideLooper:zt,dragHandler:vt,animation:vr,eventHandler:Rt,scrollBounds:rr,options:{loop:an}},It)=>{const ht=Ge.settled(),ar=!rr.shouldConstrain(),tt=an?ht:ht&&ar,it=tt&&!vt.pointerDown();it&&vr.stop();const gt=Tt.get()*It+Pt.get()*(1-It);Nt.set(gt),an&&(_t.loop(Ge.direction()),zt.loop()),Ye.to(Nt.get()),it&&Rt.emit("settle"),tt||Rt.emit("scroll")},he=F2e(s,a,()=>W(De),Ge=>ie(De,Ge)),ee=.68,xe=K[ne.get()],we=Kx(xe),Se=Kx(xe),pe=Kx(xe),Ce=Kx(xe),re=Q2e(we,pe,Se,Ce,m,ee),se=Y2e(h,K,q,X,Ce),Ae=J2e(he,ne,ae,re,se,Ce,o),Pe=q2e(X),Oe=fb(),be=tNe(t,r,o,A),{slideRegistry:ue}=W2e(F,b,K,Y,Q,J),Ee=X2e(e,r,ue,Ae,re,Oe,o,N),De={ownerDocument:s,ownerWindow:a,eventHandler:o,containerRect:C,slideRects:E,animation:he,axis:T,dragHandler:D2e(T,e,s,a,Ce,R2e(T,a),we,he,Ae,re,se,ne,o,L,f,p,x,ee,j),eventStore:Oe,percentOfView:L,index:ne,indexPrevious:ae,limit:X,location:we,offsetLocation:pe,previousLocation:Se,options:i,resizeHandler:$2e(t,o,a,r,T,y,S),scrollBody:re,scrollBounds:H2e(X,pe,Ce,re,L),scrollLooper:G2e(q,X,pe,[we,pe,Se,Ce]),scrollProgress:Pe,scrollSnapList:K.map(Pe.get),scrollSnaps:K,scrollTarget:se,scrollTo:Ae,slideLooper:Z2e(T,B,q,I,$,U,K,pe,r),slideFocus:Ee,slidesHandler:eNe(t,o,w),slidesInView:be,slideIndexes:J,slideRegistry:ue,slidesToScroll:Q,target:Ce,translate:uY(T,t)};return De}function aNe(){let e={},t;function r(d){t=d}function s(d){return e[d]||[]}function a(d){return s(d).forEach(u=>u(t,d)),c}function i(d,u){return e[d]=s(d).concat([u]),c}function o(d,u){return e[d]=s(d).filter(h=>h!==u),c}function l(){e={}}const c={init:r,emit:a,off:o,on:i,clear:l};return c}const iNe={align:"center",axis:"x",container:null,slides:null,containScroll:"trimSnaps",direction:"ltr",slidesToScroll:1,inViewThreshold:0,breakpoints:{},dragFree:!1,dragThreshold:10,loop:!1,skipSnaps:!1,duration:25,startIndex:0,active:!0,watchDrag:!0,watchResize:!0,watchSlides:!0,watchFocus:!0};function oNe(e){function t(i,o){return cY(i,o||{})}function r(i){const o=i.breakpoints||{},l=hb(o).filter(c=>e.matchMedia(c).matches).map(c=>o[c]).reduce((c,d)=>t(c,d),{});return t(i,l)}function s(i){return i.map(o=>hb(o.breakpoints||{})).reduce((o,l)=>o.concat(l),[]).map(e.matchMedia)}return{mergeOptions:t,optionsAtMedia:r,optionsMediaQueries:s}}function lNe(e){let t=[];function r(i,o){return t=o.filter(({options:l})=>e.optionsAtMedia(l).active!==!1),t.forEach(l=>l.init(i,e)),o.reduce((l,c)=>Object.assign(l,{[c.name]:c}),{})}function s(){t=t.filter(i=>i.destroy())}return{init:r,destroy:s}}function T2(e,t,r){const s=e.ownerDocument,a=s.defaultView,i=oNe(a),o=lNe(i),l=fb(),c=aNe(),{mergeOptions:d,optionsAtMedia:u,optionsMediaQueries:h}=i,{on:m,off:f,emit:p}=c,A=T;let v=!1,x,b=d(iNe,T2.globalOptions),y=d(b),w=[],j,N,_;function S(){const{container:J,slides:W}=y;N=(HB(J)?e.querySelector(J):J)||e.children[0];const he=HB(W)?N.querySelectorAll(W):W;_=[].slice.call(he||N.children)}function C(J){const W=sNe(e,N,_,s,a,J,c);if(J.loop&&!W.slideLooper.canLoop()){const ie=Object.assign({},J,{loop:!1});return C(ie)}return W}function E(J,W){v||(b=d(b,J),y=u(b),w=W||w,S(),x=C(y),h([b,...w.map(({options:ie})=>ie)]).forEach(ie=>l.add(ie,"change",T)),y.active&&(x.translate.to(x.location.get()),x.animation.init(),x.slidesInView.init(),x.slideFocus.init(ae),x.eventHandler.init(ae),x.resizeHandler.init(ae),x.slidesHandler.init(ae),x.options.loop&&x.slideLooper.loop(),N.offsetParent&&_.length&&x.dragHandler.init(ae),j=o.init(ae,w)))}function T(J,W){const ie=Q();B(),E(d({startIndex:ie},J),W),c.emit("reInit")}function B(){x.dragHandler.destroy(),x.eventStore.clear(),x.translate.clear(),x.slideLooper.clear(),x.resizeHandler.destroy(),x.slidesHandler.destroy(),x.slidesInView.destroy(),x.animation.destroy(),o.destroy(),l.clear()}function L(){v||(v=!0,l.clear(),B(),c.emit("destroy"),c.clear())}function P(J,W,ie){!y.active||v||(x.scrollBody.useBaseFriction().useDuration(W===!0?0:y.duration),x.scrollTo.index(J,ie||0))}function F(J){const W=x.index.add(1).get();P(W,J,-1)}function M(J){const W=x.index.add(-1).get();P(W,J,1)}function I(){return x.index.add(1).get()!==Q()}function $(){return x.index.add(-1).get()!==Q()}function V(){return x.scrollSnapList}function R(){return x.scrollProgress.get(x.offsetLocation.get())}function Q(){return x.index.get()}function U(){return x.indexPrevious.get()}function D(){return x.slidesInView.get()}function q(){return x.slidesInView.get(!1)}function G(){return j}function Y(){return x}function K(){return e}function X(){return N}function ne(){return _}const ae={canScrollNext:I,canScrollPrev:$,containerNode:X,internalEngine:Y,destroy:L,off:f,on:m,emit:p,plugins:G,previousScrollSnap:U,reInit:A,rootNode:K,scrollNext:F,scrollPrev:M,scrollProgress:R,scrollSnapList:V,scrollTo:P,selectedScrollSnap:Q,slideNo
918des:ne,slidesInView:D,slidesNotInView:q};return E(t,r),setTimeout(()=>c.emit("init"),0),ae}T2.globalOptions=void 0;function pO(e={},t=[]){const r=g.useRef(e),s=g.useRef(t),[a,i]=g.useState(),[o,l]=g.useState(),c=g.useCallback(()=>{a&&a.reInit(r.current,s.current)},[a]);return g.useEffect(()=>{uO(r.current,e)||(r.current=e,c())},[e,c]),g.useEffect(()=>{T2e(s.current,t)||(s.current=t,c())},[t,c]),g.useEffect(()=>{if(B2e()&&o){T2.globalOptions=pO.globalOptions;const d=T2(o,r.current,s.current);return i(d),()=>d.destroy()}else i(void 0)},[o,i]),[l,a]}pO.globalOptions=void 0;const hY=g.createContext(null);function oC(){const e=g.useContext(hY);if(!e)throw new Error("useCarousel must be used within a <Carousel />");return e}const fY=g.forwardRef(({orientation:e="horizontal",opts:t,setApi:r,plugins:s,className:a,children:i,...o},l)=>{const[c,d]=pO({...t,axis:e==="horizontal"?"x":"y"},s),[u,h]=g.useState(!1),[m,f]=g.useState(!1),p=g.useCallback(b=>{b&&(h(b.canScrollPrev()),f(b.canScrollNext()))},[]),A=g.useCallback(()=>{d==null||d.scrollPrev()},[d]),v=g.useCallback(()=>{d==null||d.scrollNext()},[d]),x=g.useCallback(b=>{b.key==="ArrowLeft"?(b.preventDefault(),A()):b.key==="ArrowRight"&&(b.preventDefault(),v())},[A,v]);return g.useEffect(()=>{!d||!r||r(d)},[d,r]),g.useEffect(()=>{if(d)return p(d),d.on("reInit",p),d.on("select",p),()=>{d==null||d.off("select",p)}},[d,p]),n.jsx(hY.Provider,{value:{carouselRef:c,api:d,opts:t,orientation:e||((t==null?void 0:t.axis)==="y"?"vertical":"horizontal"),scrollPrev:A,scrollNext:v,canScrollPrev:u,canScrollNext:m},children:n.jsx("div",{ref:l,onKeyDownCapture:x,className:ye("relative",a),role:"region","aria-roledescription":"carousel",...o,children:i})})});fY.displayName="Carousel";const mY=g.forwardRef(({className:e,...t},r)=>{const{carouselRef:s,orientation:a}=oC();return n.jsx("div",{ref:s,className:"overflow-hidden",children:n.jsx("div",{ref:r,className:ye("flex",a==="horizontal"?"-ml-4":"-mt-4 flex-col",e),...t})})});mY.displayName="CarouselContent";const pY=g.forwardRef(({className:e,...t},r)=>{const{orientation:s}=oC();return n.jsx("div",{ref:r,role:"group","aria-roledescription":"slide",className:ye("min-w-0 shrink-0 grow-0 basis-full",s==="horizontal"?"pl-4":"pt-4",e),...t})});pY.displayName="CarouselItem";const cNe=g.forwardRef(({className:e,variant:t="outline",size:r="icon",...s},a)=>{const{orientation:i,scrollPrev:o,canScrollPrev:l}=oC();return n.jsxs(te,{ref:a,variant:t,size:r,className:ye("absolute  h-8 w-8 rounded-full",i==="horizontal"?"-left-12 top-1/2 -translate-y-1/2":"-top-12 left-1/2 -translate-x-1/2 rotate-90",e),disabled:!l,onClick:o,...s,children:[n.jsx(Yo,{className:"h-4 w-4"}),n.jsx("span",{className:"sr-only",children:"Previous slide"})]})});cNe.displayName="CarouselPrevious";const dNe=g.forwardRef(({className:e,variant:t="outline",size:r="icon",...s},a)=>{const{orientation:i,scrollNext:o,canScrollNext:l}=oC();return n.jsxs(te,{ref:a,variant:t,size:r,className:ye("absolute h-8 w-8 rounded-full",i==="horizontal"?"-right-12 top-1/2 -translate-y-1/2":"-bottom-12 left-1/2 -translate-x-1/2 rotate-90",e),disabled:!l,onClick:o,...s,children:[n.jsx(io,{className:"h-4 w-4"}),n.jsx("span",{className:"sr-only",children:"Next slide"})]})});dNe.displayName="CarouselNext";const AO=({heading:e="Trusted and loved by companies around the world",logos:t=[{id:"logo-4",description:"Operational AI",image:N2e,className:"h-5 w-auto",link:"https://operational.ai"},{id:"logo-2",description:"Globetrotter",image:w2e,className:"h-7 w-auto",link:"https://gogoglobetrotter.com"},{id:"logo-9",description:"Todo.AI",image:k2e,className:"h-7 w-auto",link:"https://todo.ai"},{id:"logo-3",description:"Selfhealix",image:j2e,className:"h-7 w-auto",link:"https://selfhealix.com"},{id:"logo-1",description:"Apex Mode",image:_2e,className:"h-7 w-auto"},{id:"logo-7",description:"Ever Retire",image:C2e,className:"h-7 w-auto"},{id:"logo-8",description:"Cultivated Cup",image:S2e,className:"h-7 w-auto"}]})=>n.jsxs("section",{className:"py-16 overflow-hidden",children:[n.jsx("div",{className:"container flex flex-col items-center text-center px-4",children:n.jsx("h1",{className:"my-6 text-pretty text-2xl font-bold lg:text-4xl",children:e})}),n.jsx("div",{className:"pt-6 md:pt-6 lg:pt-10",children:n.jsxs("div",{className:"relative mx-auto flex items-center justify-center lg:max-w-5xl overflow-hidden",children:[n.jsx(fY,{opts:{loop:!0,align:"start",containScroll:"trimSnaps"},plugins:[dO({playOnInit:!0,stopOnInteraction:!1,stopOnMouseEnter:!0,speed:1})],className:"w-full",children:n.jsx(mY,{className:"-ml-4",children:t.map(r=>n.jsx(pY,{className:"flex basis-1/3 justify-center pl-4 sm:basis-1/4 md:basis-1/5 lg:basis-1/6",children:n.jsx("div",{className:"px-2 sm:px-4 md:px-6 lg:px-8 flex shrink-0 items-center justify-center",children:n.jsx("div",{children:n.jsx("img",{src:r.image,alt:r.description,className:r.className})})})},r.id))})}),n.jsx("div",{className:"absolute inset-y-0 left-0 w-12 bg-gradient-to-r from-background to-transparent"}),n.jsx("div",{className:"absolute inset-y-0 right-0 w-12 bg-gradient-to-l from-background to-transparent"})]})})]}),uNe="/assets/dna_icon-BGLw4HNh.png",AY=({isOpen:e,websiteUrl:t="your website",duration:r=6e4,className:s=""})=>{const[a,i]=g.useState(0),[o,l]=g.useState(0),[c,d]=g.useState(!1),u=[{text:"Scanning website architecture",subtext:"Mapping your site structure and navigation patterns",loader:"scan"}
918,{text:"Analyzing content patterns",subtext:"Understanding your messaging and content strategy",loader:"content"},{text:"Evaluating brand voice",subtext:"Identifying your unique tone and personality",loader:"voice"},{text:"Assessing user experience",subtext:"Reviewing engagement flows and conversion paths",loader:"ux"},{text:"Identifying market positioning",subtext:"Analyzing competitive landscape and opportunities",loader:"market"},{text:"Processing engagement data",subtext:"Examining user behavior and interaction patterns",loader:"data"},{text:"Generating content insights",subtext:"Discovering high-impact messaging opportunities",loader:"insights"},{text:"Optimizing conversion strategy",subtext:"Identifying paths to increase customer action",loader:"optimize"},{text:"Building recommendation engine",subtext:"Creating personalized improvement strategies",loader:"recommendations"},{text:"Analysis complete",subtext:"Your comprehensive brand strategy kit is ready",loader:"complete"}];g.useEffect(()=>{if(!e){i(0),l(0);return}let f=0;const p=6e3,A=setInterval(()=>{f+=100;const v=f/r,x=v<.8?v*100:80+(v-.8)*100;l(Math.min(x,95));const b=u.length-1,w=Math.floor(f/p)%b;i(j=>(w!==j&&(d(!0),setTimeout(()=>{d(!1)},300)),w))},100);return()=>clearInterval(A)},[e,u.length,r]);const h=f=>{switch(f){case"scan":return n.jsx(Ns,{className:"h-8 w-8 text-white"});case"content":return n.jsx(sl,{className:"h-8 w-8 text-white"});case"voice":return n.jsx(ui,{className:"h-8 w-8 text-white"});case"ux":return n.jsx(sa,{className:"h-8 w-8 text-white"});case"market":return n.jsx(sl,{className:"h-8 w-8 text-white"});case"data":return n.jsx(Gi,{className:"h-8 w-8 text-white"});case"insights":return n.jsx(mr,{className:"h-8 w-8 text-white"});case"optimize":return n.jsx(en,{className:"h-8 w-8 text-white"});
918case"recommendations":return n.jsx(ui,{className:"h-8 w-8 text-white"});case"complete":return n.jsx(qt,{className:"h-8 w-8 text-white"});default:return n.jsx(Vr,{className:"h-8 w-8 text-white"})}},m=f=>{switch(f){case"scan":return n.jsx("div",{className:"relative w-52 h-36 mx-auto",children:n.jsxs("div",{className:"absolute inset-0 bg-gradient-to-br from-white/40 to-blue-50/60 backdrop-blur-sm rounded-2xl border border-white/30 shadow-sm",children:[[...Array(12)].map((p,A)=>n.jsx("div",{className:"absolute h-px bg-gradient-to-r from-transparent via-blue-500/80 to-transparent shadow-sm",style:{top:`${(A+1)*8}%`,left:"15%",right:"15%",animationName:"scan",animationDuration:"3s",animationTimingFunction:"ease-in-out",animationIterationCount:"infinite",animationDelay:`${A*.1}s`,filter:"drop-shadow(0 0 2px rgba(59, 130, 246, 0.4))"}},A)),n.jsx("div",{className:"absolute w-full h-1 bg-gradient-to-r from-transparent via-blue-500 to-transparent shadow-sm",style:{animationName:"scanLine",animationDuration:"2s",animationTimingFunction:"ease-in-out",animationIterationCount:"infinite",filter:"drop-shadow(0 0 4px rgba(59, 130, 246, 0.6))"}})]})});case"content":return n.jsx("div",{className:"relative w-64 h-36 mx-auto",children:n.jsx("div",{className:"bg-white/30 backdrop-blur-sm rounded-2xl border border-white/20 p-4 h-full",children:n.jsx("div",{className:"space-y-3",children:[...Array(3)].map((p,A)=>n.jsxs("div",{className:"bg-white/40 rounded-xl p-3",children:[n.jsx("div",{className:"h-3 w-32 rounded-md bg-gradient-to-r from-gray-300/60 via-white/70 to-gray-300/60",style:{backgroundSize:"200% 100%",animation:"shimmer 2.2s ease-in-out infinite"}}),n.jsx("div",{className:"mt-2 space-y-2",children:[...Array(2)].map((v,x)=>n.jsx("div",{className:"h-2 rounded-md bg-gradient-to-r from-gray-300/50 via-white/60 to-gray-300/50",style:{backgroundSize:"200% 100%",animation:"shimmer 2.2s ease-in-out infinite",animationDelay:`${.15*x}s`}},x))}),n.jsx("div",{className:"mt-3 flex gap-2",children:[...Array(3)].map((v,x)=>n.jsx("span",{className:"h-4 w-10 rounded-full bg-emerald-200/60",style:{animation:"tagPulse 2.6s ease-in-out infinite",animationDelay:`${.25*x}s`}},x))})]},A))})})});case"voice":return n.jsx("div",{className:"relative w-52 h-36 mx-auto flex items-center justify-center",children:n.jsx("div",{className:"bg-gradient-to-br from-white/40 to-purple-50/60 backdrop-blur-sm rounded-2xl border border-white/30 shadow-sm p-6 flex items-center justify-center",children:n.jsx("div",{className:"flex space-x-2",children:[...Array(8)].map((p,A)=>n.jsx("div",{className:"w-3 bg-gradient-to-t from-purple-600 via-indigo-500 to-blue-400 rounded-full shadow-sm",style:{height:`${20+Math.sin(Date.now()*.005+A)*25}px`,animationName:"voice",animationDuration:`${1.5+A*.1}s`,animationTimingFunction:"ease-in-out",animationIterationCount:"infinite",animationDelay:`${A*.1}s`,filter:"drop-shadow(0 0 2px rgba(139, 92, 246, 0.4))"}},A))})})});case"ux":return n.jsxs("div",{className:"relative w-80 h-48 mx-auto",children:[n.jsx("div",{className:"absolute inset-0 rounded-[22px] bg-gradient-to-br from-white/50 to-cyan-50/60 border border-white/40 shadow-xl backdrop-blur-sm"}),n.jsxs("div",{className:"absolute inset-2 rounded-[18px] overflow-hidden bg-gradient-to-b from-white/70 to-sky-50/60",children:[n.jsx("div",{className:"absolute left-0 right-0 top-0 h-5 bg-black/5"}),n.jsx("div",{className:"absolute left-0 right-0 top-5 bottom-0 overflow-hidden",children:n.jsxs("div",{className:"absolute left-0 right-0",style:{animation:"pageScrollUX 6s ease-in-out infinite"},children:[n.jsxs("div",{className:"px-4 pt-3 pb-5",children:[n.jsx("div",{className:"h-6 w-28 rounded-md bg-gradient-to-r from-sky-200 to-indigo-200 mb-3"}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("div",{className:"h-3 rounded-md bg-sky-200/70"}),n.jsx("div",{className:"h-3 rounded-md bg-sky-200/50"}),n.jsx("div",{className:"h-3 rounded-md bg-sky-200/60 w-4/5"})]}),n.jsx("div",{className:"mt-4 h-9 w-28 rounded-full relative overflow-hidden bg-gradient-to-r from-indigo-500 to-sky-500 shadow-md",children:n.jsx("span",{className:"absolute inset-0 opacity-40",style:{animation:"shineUX 2.2s linear infinite"}})})]}),n.jsxs("div",{className:"px-4 pt-3 pb-5",children:[n.jsx("div",{className:"grid grid-cols-3 gap-2",children:[...Array(6)].map((p,A)=>n.jsx("div",{className:"h-12 rounded-xl bg-white/70 border border-white/40 shadow-sm"},A))}),n.jsx("div",{className:"mt-4 h-9 w-32 rounded-full relative overflow-hidden bg-gradient-to-r from-purple-500 to-indigo-500 shadow-md",children:n.jsx("span",{className:"absolute inset-0 opacity-40",style:{animation:"shineUX 2.2s linear infinite"}})})]})]})}),n.jsx("div",{className:"absolute w-4 h-4 rounded-full bg-white shadow ring-2 ring-indigo-400/80",style:{animation:"cursorMoveUX 6s ease-in-out infinite"},children:n.jsx("span",{className:"absolute -inset-3 rounded-full border-2 border-indigo-400/70",style:{animation:"tapRippleUX 6s ease-in-out infinite"}})})]})]});case"market":return n.jsx("div",{className:"relative w-52 h-36 mx-auto flex items-center justify-center",children:n.jsx("div",{className:"bg-gradient-to-br from-white/40 to-orange-50/60 backdrop-blur-sm rounded-2xl border border-white/30 shadow-sm p-6 flex items-center justify-center",children:n.jsxs("div",{className:"relative",children:[[...Array(5)].map((p,A)=>n.jsx("div",{className:"absolute w-4 bg-gradient-to-t from-orange-500 via-red-500 to-pink-500 rounded-t-lg shadow-sm",style:{height:`${35+A*12}px`,left:`${A*20}px`,bottom:"0",animationName:"marketBar",animationDuration:"2s",animationTimingFunction:"ease-in-out",animationIterationCount:"infinite",animationDelay:`${A*.2}s`,filter:"drop-shadow(0 0 2px rgba(249, 115, 22, 0.4))"}},A)),n.jsx("div",{className:"w-24 h-0.5 bg-gradient-to-r from-gray-300 to-gray-400 absolute bottom-0 shadow-sm"})]})})});case"data":return n.jsx("div",{className:"relative w-64 h-36 mx-auto",children:n.jsxs("div",{className:"bg-white/30 backdrop-blur-sm rounded-2xl border border-white/20 p-5 h-full",children:[[0,1,2].map(p=>n.jsxs("div",{className:"relative",children:[n.jsx("div",{className:"absolute left-3 right-3 h-1 rounded-full",style:{to
918p:`${10+p*28}px`,background:"linear-gradient(90deg, rgba(99,102,241,0.35), rgba(59,130,246,0.55), rgba(99,102,241,0.35))"}}),[0,1,2].map(A=>n.jsx("span",{className:"absolute w-3 h-3 rounded-full",style:{top:`${9+p*28}px`,left:"-12px",background:"linear-gradient(135deg, #818cf8, #60a5fa)",boxShadow:"0 0 8px rgba(96, 165, 250, 0.6)",animation:"packetMove 2.4s linear infinite",animationDelay:`${p*.3+A*.5}s`}},A))]},p)),n.jsx("div",{className:"absolute left-1/2 -translate-x-1/2 top-[52%] -translate-y-1/2 w-4 h-4 rounded-full bg-indigo-400/70",children:n.jsx("div",{className:"absolute inset-0 rounded-full border border-indigo-300/60 animate-ping"})})]})});case"insights":return n.jsx("div",{className:"relative w-52 h-36 mx-auto flex items-center justify-center",children:n.jsx("div",{className:"bg-gradient-to-br from-white/40 to-yellow-50/60 backdrop-blur-sm rounded-2xl border border-white/30 shadow-sm p-6 flex items-center justify-center",children:n.jsxs("div",{className:"relative",children:[n.jsx("div",{className:"w-20 h-20 border-3 border-gradient-to-r from-yellow-400 to-amber-500 rounded-full flex items-center justify-center bg-gradient-to-br from-yellow-100 to-amber-200 shadow-sm",children:n.jsx(mr,{className:"w-10 h-10 text-yellow-600 drop-shadow-sm"})}),[...Array(6)].map((p,A)=>n.jsx("div",{className:"absolute w-3 h-3 bg-gradient-to-br from-yellow-400 to-amber-500 rounded-full shadow-sm",style:{left:"50%",top:"50%",transform:`rotate(${A*60}deg) translateY(-45px)`,transformOrigin:"50% 50%",animationName:"insights",animationDuration:"2s",animationTimingFunction:"ease-in-out",animationIterationCount:"infinite",animationDelay:`${A*.2}s`,filter:"drop-shadow(0 0 2px rgba(245, 158, 11, 0.4))"}},A))]})})});case"optimize":return n.jsx("div",{className:"relative w-52 h-36 mx-auto flex items-center justify-center",children:n.jsx("div",{className:"bg-gradient-to-br from-white/40 to-green-50/60 backdrop-blur-sm rounded-2xl border border-white/30 shadow-sm p-6 flex items-center justify-center",children:n.jsxs("svg",{className:"w-36 h-24 drop-shadow-sm",viewBox:"0 0 128 80",children:[n.jsx("defs",{children:n.jsxs("linearGradient",{id:"optimizeGradient",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[n.jsx("stop",{offset:"0%",stopColor:"#10b981"}),n.jsx("stop",{offset:"50%",stopColor:"#059669"}),n.jsx("stop",{offset:"100%",stopColor:"#047857"})]})}),n.jsx("path",{d:"M 10 70 Q 30 10 50 40 T 90 20 T 118 30",stroke:"url(#optimizeGradient)",strokeWidth:"4",fill:"none",className:"animate-pulse",filter:"drop-shadow(0 0 2px rgba(16, 185, 129, 0.4))"}),n.jsx("circle",{cx:"10",cy:"70",r:"4",fill:"url(#optimizeGradient)",className:"drop-shadow-sm",style:{animationName:"optimizeDot",animationDuration:"3s",animationTimingFunction:"ease-in-out",animationIterationCount:"infinite"}})]})})});case"recommendations":return n.jsx("div",{className:"relative w-52 h-36 mx-auto flex items-center justify-center",children:n.jsx("div",{className:"bg-gradient-to-br from-white/40 to-indigo-50/60 backdrop-blur-sm rounded-2xl border border-white/30 shadow-sm p-6 flex items-center justify-center",children:n.jsxs("div",{className:"relative",children:[[...Array(3)].map((p,A)=>n.jsx("div",{className:"absolute border-3 rounded-full shadow-sm",style:{width:`${45+A*22}px`,height:`${45+A*22}px`,left:`${-A*11}px`,top:`${-A*11}px`,border:"3px solid transparent",backgroundImage:"linear-gradient(45deg, #6366f1, #8b5cf6, #a855f7)",backgroundClip:"padding-box",animationName:"recommendationRing",animationDuration:`${2+A}s`,animationTimingFunction:"linear",animationIterationCount:"infinite",animationDelay:`${A*.5}s`,filter:"drop-shadow(0 0 2px rgba(139, 92, 246, 0.3))"}},A)),n.jsx("div",{className:"w-10 h-10 bg-gradient-to-br from-indigo-500 to-purple-600 rounded-full flex items-center justify-center text-white text-sm font-bold shadow-sm",children:n.jsx(Gi,{className:"w-5 h-5"})})]})})});case"complete":return n.jsx("div",{className:"relative w-52 h-36 mx-auto flex items-center justify-center",children:n.jsx("div",{className:"bg-gradient-to-br from-white/40 to-green-50/60 backdrop-blur-sm rounded-2xl border border-white/30 shadow-sm p-6 flex items-center justify-center",children:n.jsxs("div",{className:"relative",children:[n.jsx("div",{className:"w-24 h-24 border-4 border-gradient-to-r from-green-400 to-emerald-500 rounded-full flex items-center justify-center bg-gradient-to-br from-green-50 to-emerald-100 shadow-sm",children:n.jsx(qt,{className:"w-12 h-12 text-green-600 drop-shadow-sm"})}),n.jsx("div",{className:"absolute inset-0 border-4 border-green-300/60 rounded-full animate-ping"}),n.jsx("div",{className:"absolute -inset-2 border-2 border-green-200/40 rounded-full animate-pulse"})]})})});default:return n.jsx("div",{className:"relative w-52 h-36 mx-auto flex items-center justify-center",children:n.jsx("div",{className:"bg-gradient-to-br from-white/40 to-blue-50/60 backdrop-blur-sm rounded-2xl border border-white/30 shadow-sm p-6 flex items-center justify-center",children:n.jsx("div",{className:"w-20 h-20 border-4 border-gradient-to-r from-blue-500 to-indigo-500 border-t-transparent roun
918ded-full animate-spin shadow-sm",style:{borderImage:"linear-gradient(45deg, #3b82f6, #6366f1) 1",borderStyle:"solid",borderWidth:"4px",borderTopColor:"transparent"}})})})}};return e?n.jsxs("div",{className:`fixed inset-0 z-50 ${s}`,children:[n.jsxs("div",{className:"absolute inset-0 bg-gradient-to-br from-blue-50 via-indigo-50 to-purple-50",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-tr from-white/40 via-blue-100/30 to-indigo-100/40"}),n.jsx("div",{className:"absolute top-0 left-0 w-96 h-96 bg-gradient-to-br from-blue-200/30 to-transparent rounded-full blur-3xl -translate-x-48 -translate-y-48"}),n.jsx("div",{className:"absolute bottom-0 right-0 w-96 h-96 bg-gradient-to-tl from-purple-200/30 to-transparent rounded-full blur-3xl translate-x-48 translate-y-48"}),n.jsx("div",{className:"absolute top-1/2 left-1/2 w-64 h-64 bg-gradient-to-br from-indigo-200/20 to-transparent rounded-full blur-2xl -translate-x-32 -translate-y-32"}),[...Array(30)].map((f,p)=>n.jsx("div",{className:"absolute rounded-full animate-pulse",style:{left:`${Math.random()*100}%`,top:`${Math.random()*100}%`,width:`${2+Math.random()*4}px`,height:`${2+Math.random()*4}px`,background:`linear-gradient(45deg, rgba(59, 130, 246, ${.3+Math.random()*.4}), rgba(139, 92, 246, ${.3+Math.random()*.4}))`,animationDelay:`${Math.random()*3}s`,animationDuration:`${3+Math.random()*4}s`}},p)),n.jsx("div",{className:"absolute inset-0 backdrop-blur-[1px] bg-white/10"})]}),n.jsxs("div",{className:"relative z-10 flex flex-col items-center justify-center min-h-screen text-center px-4 py-8",children:[n.jsx("div",{className:"fixed top-0 left-0 w-full h-2 bg-gradient-to-r from-gray-100 to-gray-200 z-20 shadow-sm",children:n.jsxs("div",{className:"h-full bg-gradient-to-r from-blue-500 via-indigo-500 to-purple-500 transition-all duration-300 ease-out relative",style:{width:`${o}%`},children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-blue-400 via-indigo-400 to-purple-400 blur-sm opacity-60"}),n.jsx("div",{className:"absolute right-0 top-1/2 -translate-y-1/2 w-1 h-4 bg-white rounded-full shadow-sm"})]})}),n.jsx("div",{className:"fixed top-6 right-6 z-20",children:n.jsx("div",{className:"bg-white/80 backdrop-blur-md rounded-full px-3 py-1 shadow-sm border border-white/20",children:n.jsxs("span",{className:"text-sm font-semibold bg-gradient-to-r from-blue-600 to-indigo-600 bg-clip-text text-transparent",children:[Math.round(o),"%"]})})}),n.jsxs("div",{className:"flex flex-col items-center justify-center w-full max-w-5xl mx-auto space-y-12",children:[n.jsx("div",{className:`transition-all duration-700 ease-out ${c?"opacity-0 transform translate-y-8 scale-95":"opacity-100 transform translate-y-0 scale-100"}`,children:n.jsx("div",{className:"bg-white/20 backdrop-blur-md rounded-3xl p-8 md:p-12",children:n.jsxs("div",{className:"text-center space-y-6",children:[n.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 bg-gradient-to-br from-blue-500 to-indigo-600 rounded-2xl mb-4",children:h(u[a].loader)}),n.jsx("h1",{className:"text-3xl md:text-4xl lg:text-5xl font-bold mb-6 leading-tight",children:n.jsx("span",{className:"bg-gradient-to-r from-blue-700 via-indigo-700 to-purple-700 bg-clip-text text-transparent",children:u[a].text})}),n.jsx("p",{className:"text-lg md:text-xl lg:text-2xl text-gray-700 font-medium max-w-4xl mx-auto leading-relaxed",children:u[a].subtext})]})})}),n.jsx("div",{className:`transition-all duration-700 ${c?"opacity-0 transform scale-90":"opacity-100 transform scale-100"}`,children:n.jsx("div",{className:"bg-white/10 backdrop-blur-md rounded-2xl border border-white/20 shadow-sm p-8",children:m(u[a].loader)})}),n.jsx("div",{className:"bg-white/20 backdrop-blur-md rounded-full px-6 py-3 border border-white/30 shadow-sm",children:n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-2 h-2 bg-gradient-to-r from-blue-500 to-indigo-500 rounded-full animate-pulse"}),n.jsxs("span",{className:"text-sm font-medium text-gray-700",children:["Analyzing ",n.jsx("span",{className:"font-semibold bg-gradient-to-r from-blue-600 to-indigo-600 bg-clip-text text-transparent",children:t})]}),n.jsxs("div",{className:"flex gap-1",children:[n.jsx("div",{className:"w-1 h-1 bg-blue-500 rounded-full animate-bounce",style:{animationDelay:"0ms"}}),n.jsx("div",{className:"w-1 h-1 bg-indigo-500 rounded-full animate-bounce",style:{animationDelay:"150ms"}}),n.jsx("div",{className:"w-1 h-1 bg-purple-500 rounded-full animate-bounce",style:{animationDelay:"300ms"}})]})]})})]})]}),n.jsx("style",{children:`
919        @keyframes scan {
920          0%, 100% { opacity: 0.4; transform: scaleX(1); }
921          50% { opacity: 1; transform: scaleX(1.05); }
922        }
923
924        @keyframes scanLine {
925          0% { top: 0%; opacity: 1; transform: scaleY(0.8); }
926          50% { opacity: 0.9; transform: scaleY(1.2); }
927          100% { top: 100%; opacity: 0; transform: scaleY(0.8); }
928        }
929
930        @keyframes contentPulse {
931          0%, 100% {
932            background: linear-gradient(45deg, #e5e7eb, #f3f4f6);
933            transform: scale(1) rotate(0deg);
934            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
935          }
936          50% {
937            background: linear-gradient(45deg, #10b981, #059669);
938            transform: scale(1.08) rotate(2deg);
939            box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
940          }
941        }
942
943        /* New skeleton shimmer used by the content loader */
944        @keyframes shimmer {
945          0% { background-position: 200% 0; }
946          100% { background-position: -200% 0; }
947        }
948
949        @keyframes tagPulse {
950          0%, 100% { transform: scale(1); opacity: 0.85; }
951          50% { transform: scale(1.06); opacity: 1; }
952        }
953
954        @keyframes voice {
955          0%, 100% {
956            height: 25px;
957            opacity: 0.6;
958            transform: scaleY(1);
959            filter: brightness(1);
960          }
961          50% {
962            height: 70px;
963            opacity: 1;
964            transform: scaleY(1.1);
965            filter: brightness(1.2) drop-shadow(0 0 8px rgba(139, 92, 246, 0.6));
966          }
967        }
968
969        @keyframes uxNode {
970          0%, 100% {
971            transform: scale(1) rotate(0deg);
972            border-color: #06b6d4;
973            box-shadow: 0 0 8px rgba(6, 182, 212, 0.3);
974          }
975          50% {
976            transform: scale(1.3) rotate(10deg);
977            border-color: #0891b2;
978            box-shadow: 0 0 16px rgba(6, 182, 212, 0.6);
979          }
980        }
981
982        /* New UX sequence: phone page scroll, cursor move, tap ripple, CTA shine */
983        @keyframes pageScrollUX {
984          0% { transform: translateY(0); }
985          35% { transform: translateY(0); }
986          60% { transform: translateY(-100%); }
987          100% { transform: translateY(-100%); }
988        }
989
990        @keyframes cursorMoveUX {
991          0% { transform: translate(28px, 110px); }
992          25% { transform: translate(180px, 140px); }
993          50% { transform: translate(140px, 38px); }
994          75% { transform: translate(62px, 150px); }
995          100% { transform: translate(28px, 110px); }
996        }
997
998        @keyframes tapRippleUX {
999          0%, 49% { opacity: 0; transform: scale(0.8); }
1000          50% { opacity: 1; transform: scale(1); }
1001          60% { opacity: 0; transform: scale(1.6); }
1002          100% { opacity: 0; transform: scale(0.8); }
1003        }
1004
1005        @keyframes shineUX {
1006          0% { background: linear-gradient(120deg, transparent 0%, rgba(255,255,255,0.9) 50%, transparent 100%); background-position:-150% 0; background-size: 250% 100%; }
1007          100% { background-position: 150% 0; }
1008        }
1009
1010        @keyframes marketBar {
1011          0% {
1012            height: 30px;
1013            transform: scaleY(1);
1014            filter: brightness(1);
1015          }
1016          50% {
1017            height: 90px;
1018            transform: scaleY(1.05);
1019            filter: brightness(1.2) drop-shadow(0 0 8px rgba(249, 115, 22, 0.6));
1020          }
1021          100% {
1022            height: 30px;
1023            transform: scaleY(1);
1024            filter: brightness(1);
1025          }
1026        }
1027
1028        @keyframes dataPoint {
1029          0%, 100% {
1030            opacity: 0.4;
1031            transform: scale(1) rotate(0deg);
1032            filter: brightness(1);
1033          }
1034          50% {
1035            opacity: 1;
1036            transform: scale(1.15) rotate(5deg);
1037            filter: brightness(1.3) drop-shadow(0 0 4px rgba(139, 92, 246, 0.5));
1038          }
1039        }
1040
1041        /* Packet animation for data loader */
1042        @keyframes packetMove {
1043          0% { transform: translateX(0) scale(1); opacity: 0; }
1044          10% { opacity: 1; }
1045          50% { transform: translateX(220px) scale(1.05); }
1046          100% { transform: translateX(440px) scale(1); opacity: 0; }
1047        }
1048
1049        @keyframes insights {
1050          0% {
1051            opacity: 0;
1052            transform: rotate(0deg) translateY(-45px) scale(0);
1053            filter: brightness(1);
1054          }
1055          50% {
1056            opacity: 1;
1057            transform: rotate(180deg) translateY(-45px) scale(1.2);
1058            filter: brightness(1.3) drop-shadow(0 0 8px rgba(245, 158, 11, 0.8));
1059          }
1060          100% {
1061            opacity: 0;
1062            transform: rotate(360deg) translateY(-45px) scale(0);
1063            filter: brightness(1);
1064          }
1065        }
1066
1067        @keyframes optimizeDot {
1068          0% { cx: 10; transform: scale(1); }
1069          25% { cx: 50; transform: scale(1.2); }
1070          50% { cx: 90; transform: scale(1); }
1071          75% { cx: 118; transform: scale(1.2); }
1072          100% { cx: 10; transform: scale(1); }
1073        }
1074
1075        @keyframes recommendationRing {
1076          0% {
1077            transform: scale(0.9) rotate(0deg);
1078            opacity: 1;
1079            filter: brightness(1);
1080          }
1081          50% {
1082            transform: scale(1.3) rotate(180deg);
1083            opacity: 0.6;
1084            filter: brightness(1.2) drop-shadow(0 0 12px rgba(139, 92, 246, 0.6));
1085          }
1086          100% {
1087            transform: scale(0.9) rotate(360deg);
1088            opacity: 1;
1089            filter: brightness(1);
1090          }
1091        }
1092
1093        /* Additional glow effects */
1094        @keyframes glow {
1095          0%, 100% { filter: drop-shadow(0 0 5px rgba(59, 130, 246, 0.3)); }
1096          50% { filter: drop-shadow(0 0 20px rgba(59, 130, 246, 0.8)); }
1097        }
1098      `})]}):null};function hNe({className:e="",showTitle:t=!0,showDescription:r=!0}){const[s,a]=g.useState(""),[i,o]=g.useState(!1),[l]=g.useState(()=>`anon_${Date.now()}_${Math.random().toString(36).substring(2,11)}`),c=async()=>
1098{if(s.trim()){o(!0);try{const u=await fetch("https://worker.rainfactory.ai/rainfactory/anonymous-brands/create_anonymous_brand",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:s,sessionToken:l})}),h=await u.json();if(u.ok){cg(lg.BRAND_SCAN_STARTED,void 0,{website_url:s,session_token:h.session_token||l});const m=h.session_token||l;localStorage.setItem("anonymous_session_token",m),window.location.href=`/onboarding/help-wizard?anonymous=true&sessionToken=${m}`}else console.error("Failed to analyze website:",h.error),alert("Failed to analyze website. Please try again."),o(!1)}catch(d){console.error("Error analyzing website:",d),alert("An error occurred. Please try again."),o(!1)}}};return n.jsxs(n.Fragment,{children:[n.jsx(ut.div,{initial:{opacity:0,y:30},whileInView:{opacity:1,y:0},viewport:{once:!0},transition:{duration:.6},className:`mb-16 ${e}`,children:n.jsxs("div",{className:"w-full max-w-xl mx-auto",children:[(t||r)&&n.jsxs("div",{className:"mb-8",children:[t&&n.jsxs("div",{className:"text-center mb-6",children:[n.jsx("div",{className:"flex justify-center mb-4",children:n.jsx("img",{src:uNe,alt:"DNA Icon",className:"h-12 w-12 sm:h-14 sm:w-14"})}),n.jsx("h2",{className:"text-2xl sm:text-3xl font-bold bg-gradient-to-r from-blue-700 via-purple-700 to-indigo-700 bg-clip-text text-transparent",children:"Experience a Convergence: Your DNA + The Zeitgeist"})]}),r&&n.jsxs("div",{className:"max-w-2xl mx-auto space-y-4 text-left",children:[n.jsx("p",{className:"text-base sm:text-lg text-gray-700 leading-relaxed",children:"Our AI can connect to your brand in seconds—try it now! Give it your URL and it will scan your website and social media to create a deep profile and analysis including:"}),n.jsxs("ul",{className:"space-y-2.5 text-sm sm:text-base text-gray-700 pl-1",children:[n.jsxs("li",{className:"flex items-start gap-2.5",children:[n.jsx("span",{className:"text-blue-600 font-semibold mt-0.5",children:"•"}),n.jsx("span",{className:"leading-relaxed",children:"Brand voice & tone"})]}),n.jsxs("li",{className:"flex items-start gap-2.5",children:[n.jsx("span",{className:"text-purple-600 font-semibold mt-0.5",children:"•"}),n.jsx("span",{className:"leading-relaxed",children:"Products & services"})]}),n.jsxs("li",{className:"flex items-start gap-2.5",children:[n.jsx("span",{className:"text-indigo-600 font-semibold mt-0.5",children:"•"}),n.jsx("span",{className:"leading-relaxed",children:"Market positioning"})]}),n.jsxs("li",{className:"flex items-start gap-2.5",children:[n.jsx("span",{className:"text-blue-600 font-semibold mt-0.5",children:"•"}),n.jsx("span",{className:"leading-relaxed",children:"Target audience insights"})]}),n.jsxs("li",{className:"flex items-start gap-2.5",children:[n.jsx("span",{className:"text-blue-600 font-semibold mt-0.5",children:"•"}),n.jsx("span",{className:"leading-relaxed",children:"Strengths and weaknesses"})]})]}),n.jsx("p",{className:"text-base sm:text-lg text-gray-800 font-semibold pt-2",children:"Try it now! See your free analysis in about 30 seconds."})]})]}),n.jsxs(ut.div,{whileHover:{y:-4,scale:1.02},className:"relative group",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-blue-500/30 via-purple-500/30 to-indigo-500/30 rounded-2xl blur-2xl opacity-60 group-hover:opacity-80 transition-opacity duration-500"}),n.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-blue-400/10 via-purple-400/10 to-indigo-400/10 rounded-2xl blur-xl"}),n.jsxs(Te,{className:"relative overflow-hidden bg-gradient-to-br from-white via-blue-50/40 to-indigo-50/50 backdrop-blur-sm border-2 border-blue-300/60 shadow-2xl hover:shadow-3xl transition-all duration-500 transform hover:scale-105 hover:-translate-y-2",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsx("div",{className:"absolute top-0 right-0 w-32 h-32 bg-gradient-to-br from-blue-200/20 to-transparent rounded-full -translate-y-16 translate-x-16"}),n.jsx("div",{className:"absolute bottom-0 left-0 w-24 h-24 bg-gradient-to-tr from-purple-100/30 to-transparent roun
1098ded-full translate-y-12 -translate-x-12"}),n.jsxs(Re,{className:"relative space-y-4 px-4 sm:px-6 py-6",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 sm:gap-2",children:[n.jsx(qe,{type:"url",placeholder:"https://yourwebsite.com",value:s,onChange:d=>a(d.target.value),className:"flex-1 h-12 text-base bg-white/70 backdrop-blur-sm border-blue-300/50 focus:border-blue-500/80 focus:bg-white/90 transition-all duration-300 shadow-sm hover:shadow-md",onKeyDown:d=>d.key==="Enter"&&c()}),n.jsxs("div",{className:"relative w-full sm:w-auto",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-blue-500 to-indigo-600 rounded-lg blur-xl opacity-60 animate-pulse"}),n.jsx(te,{onClick:c,disabled:!s.trim()||i,size:"lg",className:"relative w-full sm:w-auto sm:min-w-[140px] h-12 bg-gradient-to-r from-blue-500 to-indigo-600 hover:from-blue-600 hover:to-indigo-700 text-white font-bold shadow-2xl hover:shadow-[0_0_30px_rgba(99,102,241,0.6)] transition-all duration-300 transform hover:scale-110 hover:-translate-y-1 border-0 ring-2 ring-white/30 hover:ring-white/50 disabled:opacity-100 disabled:cursor-not-allowed",children:i?n.jsxs(n.Fragment,{children:[n.jsx(kt,{className:"h-4 w-4 mr-2 animate-spin"}),"Scanning..."]}):n.jsxs(n.Fragment,{children:["Scan Brand DNA",n.jsx(io,{className:"h-4 w-4 mr-2"})]})})]})]}),n.jsx("p",{className:"text-sm text-gray-700 text-center px-2 leading-relaxed font-medium",children:n.jsx("span",{className:"inline-block px-3 py-1.5 rounded-lg bg-white/60 backdrop-blur-sm border border-white/40 shadow-sm",children:"No signup required • Get instant results • See your brand strategy kit"})})]})]})]})]})}),n.jsx(AY,{isOpen:i,onClose:()=>o(!1),websiteUrl:s})]})}const I5=Qa,AM=[{question:"Will AI-generated content sound like my brand?",answer:"Yes. Our Brand Voice AI analyzes your existing content, website, and brand guidelines to learn your unique brand voice and tone. Every piece of AI-generated social media content sounds authentically like you. You can adjust the style anytime."},{question:"How is Rainfactory different from other AI content generators for social media?",answer:"Unlike generic AI content generators, Rainfactory constantly scans trending topics and news to find Convergences—moments where what's trending aligns with your brand voice. This social media marketing automation approach means every post is both timely and on-brand."},{question:"Can I edit the content?",answer:"Absolutely. Edit anything directly in the platform. Change copy, swap images, adjust colors - even ask AI to refine it for you."},{question:"What social media platforms does automated posting support?",answer:"Our automated social media posting supports Facebook, Instagram, LinkedIn, and blogs with one-click publishing. Coming soon: TikTok, YouTube, Twitter/X, and Pinterest. Each with platform-specific formatting and optimization."},{question:"Is my data secure?",answer:"Yes. SOC2 Type II compliant, GDPR compliant, and your content is never shared or used to train AI for others."}];function fNe(){const[e,t]=g.useState(!1),[r,s]=g.useState(null);return IK({title:"AI Social Media Marketing Automation | Generate Content Automatically",description:"Rainfactory's AI generates on-brand social media content automatically. Brand Voice AI learns your unique voice, detects Convergences with trending topics, and creates social posts, blogs, videos & more.",keywords:"social media marketing automation, ai social media content generator, ai content generator for social media, social media content generator, automated social media posting, brand voice AI, ai content creation, ai content creator for social media",url:`${window.location.origin}/`,type:"website",image:"https://rainfactory.ai/og-image.png",faqItems:AM}),n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 via-white to-blue-50/30 relative overflow-hidden",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsxs("div",{className:"relative w-full box-border px-3 sm:px-6 lg:px-8 max-w-6xl mx-auto",children:[n.jsxs("div",{className:"relative overflow-hidden bg-gradient-to-br from-white via-blue-50/30 to-indigo-50/40 rounded-2xl border border-blue-200/50 shadow-sm mt-8 mb-8",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsx(ut.div,{animate:{scale:[1,1.1,1],rotate:[0,5,0]},transition:{duration:8,repeat:1/0,ease:"easeInOut"},className:"absolute -top-32 -left-16 w-[600px] h-[600px] rounded-full opacity-30 -z-10",style:{background:"radial-gradient(circle, rgba(59,130,246,0.1) 0%, rgba(139,92,246,0.05) 50%, rgba(255,255,255,0) 70%)"}}),n.jsx("div",{className:"absolute top-0 right-0 w-40 h-40 bg-gradient-to-br from-blue-200/20 to-transparent roun
1098ded-full -translate-y-20 translate-x-20"}),n.jsx("div",{className:"pt-8 sm:pt-16 pb-12",children:n.jsxs(ut.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.6},className:"relative w-full max-w-4xl mx-auto text-center px-4",children:[n.jsxs("div",{className:"inline-flex items-center gap-2 px-3 py-1 rounded-full bg-blue-50 border border-blue-100 text-blue-600 text-xs font-semibold uppercase tracking-wide mb-6",children:[n.jsxs("span",{className:"relative flex h-2 w-2",children:[n.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-blue-400 opacity-75"}),n.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-blue-500"})]}),"AI Social Media Content Generator"]}),n.jsxs("h1",{className:"text-4xl sm:text-5xl lg:text-6xl xl:text-7xl font-extrabold mb-6 tracking-tight leading-tight text-slate-900",children:["AI-Generated Social Media Content ",n.jsx("br",{className:"hidden sm:block"}),"That Actually ",n.jsx(g2e,{from:"from-blue-600",to:"to-purple-600",className:"font-extrabold",children:"Sounds Like You"}),"."]}),n.jsx("p",{className:"text-xl text-gray-600 mb-10 max-w-2xl mx-auto",children:"Stop guessing what to post. Rainfactory's AI analyzes trending topics, combines them with your Brand Voice, and automatically generates social posts, blog articles, videos, email sequences, and more — all on-brand, all on autopilot."}),n.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-center gap-4 mb-4",children:[n.jsx(I5,{to:"/login?flow=signup",className:"w-full sm:w-auto",children:n.jsx(te,{size:"lg",className:"w-full sm:w-auto h-14 px-8 text-lg font-bold bg-gradient-to-r from-blue-500 to-purple-600 hover:from-blue-600 hover:to-purple-700 text-white shadow-lg hover:shadow-xl transition-all duration-300 transform hover:scale-105 border-0",children:"Start Free 14-Day Trial"})}),n.jsxs(te,{size:"lg",variant:"outline",className:"w-full sm:w-auto h-14 px-8 text-lg font-semibold transition-transform duration-200 hover:scale-105 flex items-center justify-center gap-2",onClick:()=>t(!0),children:[n.jsx(ho,{className:"h-5 w-5"}),"Watch How It Works"]})]}),n.jsx("p",{className:"text-sm text-gray-400 mb-8",children:"No credit card required. Cancel anytime."}),n.jsxs("div",{className:"mt-16 pt-8 border-t border-gray-200/60",children:[n.jsx("p",{className:"text-center text-sm font-semibold text-gray-400 mb-6 uppercase tracking-wider",children:"Trusted by 500+ High-Growth Brands"}),n.jsx(AO,{})]})]})})]}),n.jsxs(ut.div,{initial:{opacity:0,y:30},whileInView:{opacity:1,y:0},viewport:{once:!0},transition:{duration:.6},className:"mb-16",children:[n.jsxs("div",{className:"text-center mb-8",children:[n.jsx("h2",{className:"text-3xl sm:text-4xl lg:text-5xl font-bold mb-4 text-gray-900",children:"Convergences in Action"}),n.jsxs("p",{className:"text-xl text-gray-600",children:[n.jsx("span",{className:"text-blue-600 font-semibold",children:"Live trends"})," + ",n.jsx("span",{className:"text-purple-600 font-semibold",children:"Your Brand Voice AI"})," = ",n.jsx("b",{children:"Convergences:"})," AI-generated social media content that converts — in just 10 minutes per week"]})]}),n.jsxs("div",{className:"grid lg:grid-cols-2 gap-8 max-w-6xl mx-auto",children:[n.jsxs("div",{className:"bg-red-50 border-2 border-red-200 rounded-2xl p-6 sm:p-8",children:[n.jsxs("div",{className:"text-center mb-6",children:[n.jsx("h3",{className:"text-2xl font-bold text-red-700 mb-2",children:"Your Current Week"}),n.jsx("div",{className:"text-4xl font-bold text-red-600",children:"40 hours 35 minutes"})]}),n.jsx("div",{className:"space-y-3",children:[{task:"Trend research",time:"45 min"},{task:"Content ideation",time:"20 min"},{task:"Script writing",time:"60 min"},{task:"Video creation",time:"60 min"},{task:"Editing & formatting",time:"90 min"},{task:"Platform optimization",time:"30 min"},{task:"Thumbnail design",time:"30 min"},{task:"Captions & hashtags",time:"20 min"},{task:"Copywriting variants",time:"35 min"},{task:"Scheduling & posting",time:"20 min"},{task:"Community management",time:"30 min"},{task:"Analytics review",time:"45 min"}
1098,{task:"Planning next week",time:"30 min"}].map((a,i)=>n.jsxs(ut.div,{initial:{opacity:0,x:-20},whileInView:{opacity:1,x:0},viewport:{once:!0},transition:{delay:i*.05},className:"flex justify-between items-center py-2 border-b border-red-200/50 last:border-b-0",children:[n.jsx("span",{className:"text-gray-700",children:a.task}),n.jsx("span",{className:"font-semibold text-red-600",children:a.time})]},i))})]}),n.jsxs("div",{className:"bg-green-50 border-2 border-green-200 rounded-2xl p-6 sm:p-8",children:[n.jsxs("div",{className:"text-center mb-6",children:[n.jsx("h3",{className:"text-2xl font-bold text-green-700 mb-2",children:"With Rainfactory"}),n.jsx("div",{className:"text-4xl font-bold text-green-600",children:"10 minutes"})]}),n.jsx("div",{className:"space-y-3",children:[{task:"Review & approve created contents",time:"5 min"},{task:"One-click publish",time:"2 min"}].map((a,i)=>n.jsxs(ut.div,{initial:{opacity:0,x:20},whileInView:{opacity:1,x:0},viewport:{once:!0},transition:{delay:i*.2},className:"flex justify-between items-center py-4 border-b border-green-200/50 last:border-b-0",children:[n.jsx("span",{className:"text-gray-700 font-medium",children:a.task}),n.jsx("span",{className:"font-bold text-green-600",children:a.time})]},i))}),n.jsx("div",{className:"mt-8 text-center",children:n.jsxs("div",{className:"bg-white/70 rounded-lg p-4",children:[n.jsx("p",{className:"text-lg font-semibold text-green-700",children:"💰 Save 40+ hours every week"}),n.jsx("p",{className:"text-sm text-gray-600 mt-1",children:"That's over 2,000 hours per year back in your life"})]})})]})]})]}),n.jsx(ut.div,{initial:{opacity:0,y:30},whileInView:{opacity:1,y:0},viewport:{once:!0},transition:{duration:.6},className:"mb-16 bg-white rounded-2xl py-24",children:n.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:n.jsxs("div",{className:"grid md:grid-cols-2 gap-16 items-center",children:[n.jsxs("div",{className:"relative",children:[n.jsxs("div",{className:"relative h-[400px] w-full flex justify-center items-center",children:[n.jsx(ut.div,{initial:{y:0,scale:1},animate:{y:[0,-15,0],scale:[1,1.05,1]},transition:{duration:6,repeat:1/0,ease:"easeInOut"},className:"absolute w-48 h-48 rounded-full opacity-80",style:{backgroundColor:"#60A5FA",mixBlendMode:"multiply",filter:"blur(30px)",left:"50%",transform:"translateX(-80%)"}}),n.jsx(ut.div,{initial:{y:0,scale:1},animate:{y:[0,15,0],scale:[1,1.05,1]},transition:{duration:6,repeat:1/0,ease:"easeInOut",delay:1},className:"absolute w-48 h-48 rounded-full opacity-80",style:{backgroundColor:"#A78BFA",mixBlendMode:"multiply",filter:"blur(30px)",right:"50%",transform:"translateX(80%)"}}),n.jsx(ut.div,{className:"relative z-10 w-24 h-24 bg-white rounded-full flex items-center justify-center",style:{boxShadow:"0 0 40px rgba(139, 92, 246, 0.6)"},children:n.jsx(ut.div,{initial:{scale:.9,opacity:.6},animate:{scale:[.9,1.1,.9],opacity:[.6,1,.6]},transition:{duration:2,repeat:1/0,ease:"easeInOut"},children:n.jsx(mr,{className:"w-10 h-10 text-purple-600"})})})]}),n.jsx("div",{className:"text-center mt-4",children:n.jsx("div",{className:"inline-block px-4 py-2 bg-slate-900 text-white text-sm font-bold rounded-lg shadow-xl relative -top-8 z-20",children:"THE SECRET SAUCE: CONVERGENCE"})})]}),n.jsxs("div",{children:[n.jsxs("h2",{className:"text-3xl md:text-4xl font-bold text-slate-900 mb-6",children:["Why other AI tools feel ",n.jsx("span",{className:"line-through text-gray-400",children:"robotic"}),"."]}),n.jsxs("p",{className:"text-lg text-gray-600 mb-6",children:["Most AI tools just predict the next word. They don't know what's happening ",n.jsx("em",{children:"right now"}),", and they certainly don't know ",n.jsx("em",{children:"who you are"}),"."]}),n.jsx("p",{className:"text-lg text-gray-600 mb-8",children:"Rainfactory is different. Our engine constantly scans:"}),n.jsxs("ul",{className:"space-y-4 mb-8",children:[n.jsxs("li",{className:"flex items-start gap-3",children:[n.jsx("div",{className:"mt-1 w-6 h-6 rounded-full bg-blue-100 flex items-center justify-center text-blue-600 flex-shrink-0",children:n.jsx(sa,{className:"w-4 h-4"})}),n.jsxs("div",{children:[n.jsx("h4",{className:"font-bold text-slate-900",children:"Real-Time Trends"}),n.jsx("p",{className:"text-sm text-gray-500",children:"What is the world talking about right now?"})]})]}),n.jsxs("li",{className:"flex items-start gap-3",children:[n.jsx("div",{className:"mt-1 w-6 h-6 rounded-full bg-purple-100 flex items-center justify-center text-purple-600 flex-shrink-0",children:n.jsx(txe,{className:"w-4 h-4"})}),n.jsxs("div",{children:[n.jsx("h4",{className:"font-bold text-slate-900",children:"Your Brand Voice & DNA"}),n.jsx("p",{className:"text-sm text-gray-500",children:"Your unique brand voice, values, and target audience."})]})]})]})]})]})})}),n.jsx(ut.div,{initial:{opacity:0,y:30},whileInView:{opacity:1,y:0},viewport:{once:!0},transition:{duration:.6},className:"mb-16 py-24 bg-slate-50 rounded-2xl border-y border-gray-200",children:n.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:[n.jsxs("div",{className:"text-center max-w-3xl mx-auto mb-16",children:[n.jsx("h2",{className:"text-3xl md:text-4xl font-bold text-slate-900 mb-4",children:"The Content Quality Gap"}),n.jsx("p",{className:"text-lg text-gray-600",children:"See the difference between generic prompting and Convergence-driven creation."})]}),n.jsxs("div",{className:"grid md:grid-cols-2 gap-8",children:[n.jsxs(ut.div,{initial:{opacity:0,x:-20},whileInView:{opacity:1,x:0},viewport:{once:!0},transition:{delay:.1},className:"bg-white rounded-2xl p-8 border border-gray-200 shadow-sm opacity-70 hover:opacity-100 transition",children:[n.jsxs("div",{className:"flex justify-between items-center mb-6",children:[n.jsx("span",{className:"bg-gray-100 text-gray-600 px-3 py-1 rounded-full text-xs font-bold uppercase",children:"Generic AI Model"}),n.jsx(Rl,{className:"text-red-400"})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsx("div",{className:"h-4 bg-gray-100 rounded w-3/4"}),n.jsx("div",{className:"h-4 bg-gray-100 rounded w-full"}),n.jsx("div",{className:"h-4 bg-gray-100 rounded w-5/6"})]}),n.jsx("div",{className:"mt-6 p-4 bg-gray-50 rounded-lg border border-gray-100 text-sm text-gray-600 italic",children:'"We are pleased to announce our new coffee blend. It is very tasty and good for mornings. We hope you enjoy it."'}),n.jsxs("div",{className:"mt-6 pt-6 border-t border-gray-100 flex items-center gap-4 text-gray-400 text-sm",children:[n.jsxs("span",{className:"flex items-center gap-1",children:[n.jsx(KR,{className:"w-4 h-4"}),"12 Likes"]}),n.jsxs("span",{className:"flex items-center gap-1",children:[n.jsx(og,{className:"w-4 h-4"}),"0 Shares"]})]})]}),n.jsxs(ut.div,{initial:{opacity:0,x:20},whileInView:{opacity:1,x:0},viewport:{once:!0},transition:{delay:.2},className:"bg-white rounded-2xl p-8 border border-purple-200 shadow-xl ring-4 ring-purple-50 transform md:-translate-y-4 relative overflow-hidden",children:[n.jsx("div",{className:"absolute top-0 left-0 w-full h-1 bg-gradient-to-r from-blue-500 to-purple-600"}),n.jsxs("div",{className:"flex justify-between items-center mb-6",children:[n.jsxs("span",{className:"bg-purple-100 text-purple-700 px-3 py-1 rounded-full text-xs font-bold uppercase flex items-center gap-1",children:[n.jsx(mr,{className:"w-3 h-3"}),"Rainfactory"]}),n.jsx(di,{className:"text-green-500 fill-green-50"})]}),n.jsxs("div",{className:"mb-4 inline-flex items-center gap-2 px-3 py-1.5 rounded-md bg-yellow-50 text-yellow-700 text-xs font-medium border border-yellow-100",children:[n.jsx(wK,{className:"w-3 h-3"}),'Convergence Detected: "Monday Motivation" + "Eco-Friendly"']}),n.jsx("div",{className:"p-4 bg-gradient-to-br from-blue-50 to-purple-50 rounded-lg border border-purple-100 text-slate-800 font-medium leading-relaxed",children:`"Monday blues? Not today. ☕️ We're turning c
1098affeine into clean energy. Sip responsibly and conquer the week. #SustainableGrind #MondayMotivation"`}),n.jsxs("div",{className:"mt-6 pt-6 border-t border-gray-100 flex items-center gap-6 text-slate-700 text-sm font-semibold",children:[n.jsxs("span",{className:"flex items-center text-blue-600 gap-1",children:[n.jsx(KR,{className:"w-4 h-4 fill-blue-100"}),"438 Likes"]}),n.jsxs("span",{className:"flex items-center text-purple-600 gap-1",children:[n.jsx(og,{className:"w-4 h-4 fill-purple-100"}),"82 Shares"]}),n.jsx("span",{className:"text-green-600 text-xs bg-green-50 px-2 py-1 rounded",children:"+2400% Engagement"})]})]})]})]})}),n.jsxs(ut.div,{initial:{opacity:0,y:30},whileInView:{opacity:1,y:0},viewport:{once:!0},transition:{duration:.6},className:"mb-16",children:[n.jsxs("div",{className:"text-center mb-12",children:[n.jsx("h2",{className:"text-3xl sm:text-4xl lg:text-5xl font-bold mb-4 text-gray-900",children:"How It Works"}),n.jsx("p",{className:"text-xl text-gray-600",children:"How our AI social media content generator creates on-brand content from trending topics"})]}),n.jsx("div",{className:"max-w-5xl mx-auto",children:n.jsxs("div",{className:"grid md:grid-cols-2 gap-8 relative",children:[n.jsx("div",{className:"hidden md:block absolute top-32 left-1/4 right-3/4 h-0.5 bg-gradient-to-r from-blue-300 to-amber-300"}),n.jsx(ut.div,{initial:{opacity:0,y:20},whileInView:{opacity:1,y:0},viewport:{once:!0},transition:{delay:.1},className:"relative",children:n.jsxs("div",{className:"bg-gradient-to-br from-blue-50 to-blue-100/50 rounded-2xl border-2 border-blue-200 shadow-lg p-8 hover:shadow-xl transition-all duration-300 h-full",children:[n.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[n.jsx("div",{className:"w-10 h-10 rounded-full bg-blue-600 text-white font-bold flex items-center justify-center text-lg",children:"1"}),n.jsx("h3",{className:"text-xl font-bold text-gray-900",children:"We Learn Your Brand Voice & DNA"})]}),n.jsx("div",{className:"w-full max-w-xs mx-auto mb-4 rounded-lg overflow-hidden shadow-md",children:n.jsx("img",{src:f2e,alt:"Brand DNA Scan",className:"w-full h-auto object-cover rounded-lg"})}),n.jsx("p",{className:"font-semibold text-gray-900 mb-2",children:"Start by scanning your website in 30 seconds"}),n.jsx("p",{className:"text-gray-600 text-sm leading-relaxed",children:"Our Brand Voice AI instantly learns your unique voice, tone, value proposition, and target audience"}),n.jsx("div",{className:"mt-4 font-semibold text-blue-600",children:"Time: 30 seconds"})]})}),n.jsx(ut.div,{initial:{opacity:0,y:20},whileInView:{opacity:1,y:0},viewport:{once:!0},transition:{delay:.2},className:"relative",children:n.jsxs("div",{className:"bg-gradient-to-br from-amber-50 to-orange-100/50 rounded-2xl border-2 border-amber-200 shadow-lg p-8 hover:shadow-xl transition-all duration-300 h-full",children:[n.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[n.jsx("div",{className:"w-10 h-10 rounded-full bg-amber-600 text-white font-bold flex items-center justify-center text-lg",children:"2"}),n.jsx("h3",{className:"text-xl font-bold text-gray-900",children:"We Find What's Trending"})]}),n.jsx("div",{className:"w-full max-w-xs mx-auto mb-4 rounded-lg overflow-hidden shadow-md",children:n.jsx("img",{src:A2e,alt:"Trending Topics Research",className:"w-full h-auto object-cover rounded-lg"})}),n.jsx("p",{className:"font-semibold text-gray-900 mb-2",children:"Our AI constantly researches live trends, news, and viral topics in your specific market"}),n.jsx("p",{className:"text-gray-600 text-sm leading-relaxed",children:"We find the relevant conversations your audience is already having right now"}),n.jsx("div",{className:"mt-4 font-semibold text-amber-600",children:"Time: Continuous"})]})}),n.jsx(ut.div,{initial:{opacity:0,y:20},whileInView:{opacity:1,y:0},viewport:{once:!0},transition:{delay:.3},className:"relative",children:n.jsxs("div",{className:"bg-gradient-to-br from-purple-50 via-violet-50 to-fuchsia-50 rounded-2xl border-4 border-purple-300 shadow-xl p-8 hover:shadow-2xl transition-all duration-300 h-full relative overflow-hidden",children:[n.jsx("div",{className:"absolute top-4 right-4 bg-purple-600 text-white text-xs font-bold px-3 py-1 rounded-full",children:"The Magic ✨"}),n.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[n.jsx("div",{className:"w-10 h-10 rounded-full bg-gradient-to-br from-purple-600 to-fuchsia-600 text-white font-bold flex items-center justify-center text-lg",children:"3"}),n.jsx("h3",{className:"text-xl font-bold text-gray-900",children:"We Create the Convergences"})]}),n.jsx("div",{className:"w-full max-w-xs mx-auto mb-4 rounded-lg overflow-hidden shadow-md",children:n.jsx("img",{src:m2e,alt:"Convergence - Brand DNA + Trends",className:"w-full h-auto object-cover rounded-lg"})}),n.jsx("p",{className:"font-semibold text-gray-900 mb-2",children:"Rainfactory's AI combines what's trending with your unique voice"}),n.jsx("p",{className:"text-gray-600 text-sm leading-relaxed",children:"The magic happens here—we transform generic trends into relevant, high-engagement posts that sound authentically like your brand"}),n.jsx("div",{className:"mt-4 font-semibold text-purple-600",children:"Time: Automated"})]})}),n.jsx(ut.div,{initial:{opacity:0,y:20},whileInView:{opacity:1,y:0},viewport:{once:!0},transition:{delay:.4},className:"relative",children:n.jsxs("div",{className:"bg-gradient-to-br from-green-50 to-emerald-100/50 rounded-2xl border-2 border-green-200 shadow-lg p-8 hover:shadow-xl transition-all duration-300 h-full",children:[n.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[n.jsx("div",{className:"w-10 h-10 rounded-full bg-green-600 text-white font-bold flex items-center justify-center text-lg",children:"4"}),n.jsx("h3",{className:"text-xl font-bold text-gray-900",children:"You Review in 10 Minutes"})]}),n.jsx("div",{className:"w-full max-w-xs mx-auto mb-4 rounded-lg overflow-hidden shadow-md",children:n.jsx("img",{src:p2e,alt:"Review Campaign Email",className:"w-full h-auto object-cover rounded-lg"})}),n.jsx("p",{className:"font-semibold text-gray-900 mb-2",children:"Get content every day"}),n.jsx("p",{className:"text-gray-600 text-sm leading-relaxed",children:"You just review and approve. That's it. No creation, no research, no formatting."}),n.jsx("div",{className:"mt-4 font-semibold text-green-600",children:"Time: 10 minutes"})]})})]})})]}),n.jsx(ut.div,{initial:{opacity:0,y:30},whileInView:{opacity:1,y:0},viewport:{once:!0},transition:{duration:.6},className:"mb-16",children:n.jsxs("div",{className:"bg-gradient-to-br from-blue-50 to-indigo-50 rounded-2xl border border-blue-200 p-8 sm:p-12 text-center",children:[n.jsx("h2",{className:"text-3xl sm:text-4xl font-bold mb-4 text-gray-900",children:"Ready to get 40 hours back every week?"}),n.jsx("p",{className:"text-xl text-gray-600 mb-8",children:"Join 500+ businesses already saving time and growing with Rainfactory"}),n.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-6 mb-8 max-w-3xl mx-auto",children:[n.jsxs("div",{className:"text-center",children:[n.jsx("div",{className:"text-2xl font-bold text-blue-600",children:"500+"}),n.jsx("div",{className:"text-sm text-gray-600",children:"businesses automated"})]}),n.jsxs("div",{className:"text-center",children:[n.jsx("div",{className:"text-2xl font-bold text-green-600",children:"2.3M+"}),n.jsx("div",{className:"text-sm text-gray-600",children:"pieces of content created"})]}),n.jsxs("div",{className:"text-center",children:[n.jsx("div",{className:"text-2xl font-bold text-purple-600",children:"42M+"}),n.jsx("div",{className:"text-sm text-gray-600",children:"hours saved"})]}),n.jsxs("div",{className:"text-center",children:[n.jsx(Gh,{className:"h-8 w-8 text-gray-600 mx-auto mb-1"}),n.jsx("div",{className:"text-sm text-gray-600",children:"SOC2 Compliant"})]})]}),n.jsxs("div",{className:"bg-white/70 rounded-xl p-6 mb-8 max-w-2xl mx-auto",children:[n.jsx("h3",{className:"font-semibold text-gray-900 mb-4",children:"Zero risk to get started"}),n.jsxs("div",{className:"grid sm:grid-cols-2 gap-3 text-sm text-gray-700",children:[n.jsxs("div",{className:"flex items-center",children:[n.jsx(qt,{className:"h-4 w-4 text-green-500 mr-2"}),"14-day free trial"]}),n.jsxs("div",{className:"flex items-center",children:[n.jsx(qt,{className:"h-4 w-4 text-green-500 mr-2"}),"Cancel anytime with one click"]}),n.jsxs("div",{className:"flex items-center",children:[n.jsx(qt,{className:"h-4 w-4 text-green-500 mr-2"}),"30-day money-back guarantee"]}),n.jsxs("div",{className:"flex items-center",children:[n.jsx(qt,{className:"h-4 w-4 text-green-500 mr-2"}),"Keep all content you've created"]})]})]}),n.jsxs("div",{className:"flex flex-col sm:flex-row justify-center gap-4",children:[n.jsx(I5,{to:"/login?flow=signup",className:"w-full sm:w-auto",children:n.jsx(te,{size:"lg",className:"w-full sm:w-auto h-14 px-8 text-lg font-semibold bg-gradient-to-r from-blue-500 to-indigo-600 hover:from-blue-600 hover:to-indigo-700 text-white shadow-lg hover:shadow-xl transition-all duration-300 transform hover:scale-105 border-0",children:"Start my free trial"})}),n.jsx(te,{size:"lg",variant:"outline",className:"w-full sm:w-auto h-14 px-8 text-lg transition-transform duration-200 hover:scale-105",onClick:()=>t(!0),children:"Schedule a demo"})]})]})}),n.jsxs(ut.div,{initial:{opacity:0,y:30},whileInView:{opacity:1,y:0},viewport:{once:!0},transition:{duration:.6},className:"mb-16",children:[n.jsxs("div",{className:"text-center mb-12",children:[n.jsx("h2",{className:"text-3xl sm:text-4xl font-bold mb-4 text-gray-900",children:"Frequently Asked Questions"}),n.jsx("p",{className:"text-xl text-gray-600",children:"Everything you need to know to get started"})]}
1098),n.jsx("div",{className:"max-w-3xl mx-auto space-y-4",children:AM.map((a,i)=>n.jsxs(ut.div,{initial:{opacity:0,y:10},whileInView:{opacity:1,y:0},viewport:{once:!0},transition:{delay:i*.1},className:"bg-white border border-gray-200 rounded-xl shadow-sm",children:[n.jsxs("button",{className:"w-full px-6 py-4 text-left flex justify-between items-center hover:bg-gray-50 transition-colors duration-200 rounded-xl",onClick:()=>s(r===i?null:i),children:[n.jsx("h3",{className:"font-semibold text-gray-900 pr-4",children:a.question}),n.jsx(Un,{className:`h-5 w-5 text-gray-500 transition-transform duration-200 ${r===i?"transform rotate-180":""}`})]}),n.jsx(qh,{children:r===i&&n.jsx(ut.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2,ease:"easeOut"},className:"overflow-hidden",children:n.jsx("div",{className:"px-6 pb-4",children:n.jsx("p",{className:"text-gray-600 leading-relaxed",children:a.answer})})})})]},i))}),n.jsx("div",{className:"text-center mt-8",children:n.jsxs("p",{className:"text-gray-600",children:["Still have questions? ",n.jsx(I5,{to:"/contact",className:"text-blue-600 hover:text-blue-700 underline",children:"Contact our support team"})]})})]}),n.jsxs(ut.div,{initial:{opacity:0,y:30},whileInView:{opacity:1,y:0},viewport:{once:!0},transition:{duration:.6},className:"mb-16",children:[n.jsxs("div",{className:"text-center mb-12",children:[n.jsx("h2",{className:"text-3xl sm:text-4xl font-bold mb-4 text-gray-900",children:"What Our Customers Say"}),n.jsx("p",{className:"text-xl text-gray-600",children:"Real results from real businesses"})]}),n.jsxs("div",{className:"grid md:grid-cols-3 gap-6 max-w-6xl mx-auto",children:[n.jsxs(ut.div,{initial:{opacity:0,y:20},whileInView:{opacity:1,y:0},viewport:{once:!0},transition:{delay:.1},className:"bg-white rounded-xl border border-gray-200 shadow-sm p-6 hover:shadow-md transition-shadow duration-300",children:[n.jsx("div",{className:"flex items-center gap-1 mb-4",children:[...Array(5)].map((a,i)=>n.jsx("svg",{className:"w-5 h-5 text-yellow-400",fill:"currentColor",viewBox:"0 0 20 20",children:n.jsx("path",{d:"M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z"})},i))}),n.jsx("p",{className:"text-gray-700 mb-4 italic",children:`"I went from spending 8 hours every Monday creating content to just 10 minutes reviewing what Rainfactory created. It's like having a marketing team that never sleeps."`}),n.jsxs("div",{className:"border-t border-gray-100 pt-4",children:[n.jsx("p",{className:"font-semibold text-gray-900",children:"Sarah Chen"}),n.jsx("p",{className:"text-sm text-gray-600",children:"Founder, TechFlow Solutions"})]})]}),n.jsxs(ut.div,{initial:{opacity:0,y:20},whileInView:{opacity:1,y:0},viewport:{once:!0},transition:{delay:.2},className:"bg-white rounded-xl border border-gray-200 shadow-sm p-6 hover:shadow-md transition-shadow duration-300",children:[n.jsx("div",{className:"flex items-center gap-1 mb-4",children:[...Array(5)].map((a,i)=>n.jsx("svg",{className:"w-5 h-5 text-yellow-400",fill:"currentColor",viewBox:"0 0 20 20",children:n.jsx("path",{d:"M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z"})},i))}),n.jsx("p",{className:"text-gray-700 mb-4 italic",children:`"Our engagement rates doubled in the first month. The content actually sounds like us, and we're posting consistently across all platforms without the stress."`}),n.jsxs("div",{className:"border-t border-gray-100 pt-4",children:[n.jsx("p",{className:"font-semibold text-gray-900",children:"Marcus Rodriguez"}),n.jsx("p",{className:"text-sm text-gray-600",children:"Marketing Director, GreenLeaf Organics"})]})]}),n.jsxs(ut.div,{initial:{opacity:0,y:20},whileInView:{opacity:1,y:0},viewport:{once:!0},transition:{delay:.3},className:"bg-white rounded-xl border border-gray-200 shadow-sm p-6 hover:shadow-md transition-shadow duration-300",children:[n.jsx("div",{className:"flex items-center gap-1 mb-4",children:[...Array(5)].map((a,i)=>n.jsx("svg",{className:"w-5 h-5 text-yellow-400",fill:"currentColor",viewBox:"0 0 20 20",children:n.jsx("path",{d:"M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z"})},i))}),n.jsx("p",{className:"text-gray-700 mb-4 italic",children:`"Best $29 I spend every month. I've reclaimed 40 hours per week and our content quality is actually better than when I was doing it manually."`}),n.jsxs("div",{className:"border-t border-gray-100 pt-4",children:[n.jsx("p",{className:"font-semibold text-gray-900",children:"Jessica Park"}),n.jsx("p",{className:"text-sm text-gray-600",children:"CEO, Artisan Coffee Co."})]})]})]})]}),n.jsxs(ut.div,{initial:{opacity:0,y:30},whileInView:{opacity:1,y:0},viewport:{once:!0},transition:{duration:.6},className:"mb-16 relative overflow-hidden bg-slate-900 rounded-2xl py-24",children:[n.jsx(ut.div,{animate:{scale:[1,1.2,1],rotate:[0,10,0]},transition:{duration:7,repeat:1/0,ease:"easeInOut"},className:"absolute top-0 right-0 -mr-20 -mt-20 w-96 h-96 bg-blue-600 rounded-full mix-blend-multiply filter blur-3xl op
1098acity-20"}),n.jsx(ut.div,{animate:{scale:[1,1.15,1],rotate:[0,-8,0]},transition:{duration:7,repeat:1/0,ease:"easeInOut",delay:2},className:"absolute bottom-0 left-0 -ml-20 -mb-20 w-96 h-96 bg-purple-600 rounded-full mix-blend-multiply filter blur-3xl opacity-20"}),n.jsxs("div",{className:"max-w-4xl mx-auto px-4 relative z-10 text-center",children:[n.jsx("h2",{className:"text-3xl md:text-5xl font-bold text-white mb-6",children:"See your brand's unique DNA."}),n.jsx("p",{className:"text-blue-100 mb-10 text-lg",children:"Enter your website below. Our AI will analyze your tone, values, and audience in 30 seconds to find your first Convergence."}),n.jsx(hNe,{className:"mb-0",showTitle:!1,showDescription:!1}),n.jsx("p",{className:"mt-6 text-sm text-gray-400",children:"No signup required. Get instant results."})]})]})]})]}),n.jsx(v2e,{isOpen:e,onClose:()=>t(!1)})]})}const gM=5*60*1e3,xM=new Map,vM=new Map;function lC(){const[e,t]=g.useState(null),[r,s]=g.useState(null),[a,i]=g.useState(!0),[o,l]=g.useState(null),c=g.useCallback(p=>Date.now()-p<gM,[]),d=g.useCallback(async(p=!1)=>{try{i(!0);const{data:A}=await de.rpc("get_personal_account");if(!(A!=null&&A.account_id))throw new Error("No account found");const v=xM.get(A.account_id),x=vM.get(A.account_id);if(!p&&v&&x&&c(v.timestamp)&&c(x.timestamp)){t(v.data),s(x.data),i(!1);return}const[b,y]=await Promise.all([de.rpc("get_plan_limitations"),de.rpc("get_current_usage")]);if(b.error)throw b.error;if(y.error)throw y.error;const w=b.data,j=y.data;xM.set(A.account_id,{data:w,timestamp:Date.now()}),vM.set(A.account_id,{data:j,timestamp:Date.now()}),t(w),s(j)}catch(A){l(A instanceof Error?A:new Error("Unknown error occurred"))}finally{i(!1)}},[c]),u=g.useCallback(async(p,A={})=>{try{const{data:v,error:x}=await de.rpc("is_action_allowed",{p_action:p,p_context:A});if(x)throw x;return d(!0),!!v}catch(v){return console.error("Error checking action:",v),!1}},[d]),h=g.useCallback(()=>!e||!r?null:{remaining_brands:e.max_brands-r.total_brands},[e,r]),m=g.useCallback(p=>e?!!e.features[p]:!1,[e]),f=g.useCallback(p=>r!=null&&r.feature_usage?r.feature_usage[`use_feature_${p}`]||{count:0,last_used:null}:null,[r]);return g.useEffect(()=>{d();const p=setInterval(()=>{d()},gM-3e4);return()=>clearInterval(p)},[d]),{limitations:e,usage:r,loading:a,error:o,isActionAllowed:u,getRemainingLimits:h,isFeatureAvailable:m,getFeatureUsage:f,refresh:()=>d(!0)}}const mNe=Jm("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive",success:"border-green-200 text-green-800 dark:border-green-800 dark:text-green-200 [&>svg]:text-green-800 dark:[&>svg]:text-green-200"}},defaultVariants:{variant:"default"}}),Ar=g.forwardRef(({className:e,variant:t,...r},s)=>n.jsx("div",{ref:s,role:"alert",className:ye(mNe({variant:t}),e),...r}));Ar.displayName="Alert";const Wa=g.forwardRef(({className:e,...t},r)=>n.jsx("h5",{ref:r,className:ye("mb-1 font-medium leading-none tracking-tight",e),...t}));Wa.displayName="AlertTitle";const gr=g.forwardRef(({className:e,...t},r)=>n.jsx("div",{ref:r,className:ye("text-sm [&_p]:leading-relaxed",e),...t}));gr.displayName="AlertDescription";function pNe({type:e,showUpgradeButton:t=!0,className:r=""}){const s=xr(),{limitations:a,getRemainingLimits:i}=lC();if(!a||!i())return null;const o={brands:{title:"Brand Limit Reached",description:`You can create up to ${a.max_brands} brand${a.max_brands===1?"":"s"} on your current plan.`}},{title:l,description:c}=o[e];return n.jsxs(Ar,{variant:"destructive",className:ye("flex items-center justify-between",r),children:[n.jsxs("div",{children:[n.jsx(Wa,{children:l}),n.jsx(gr,{children:c})]}),t&&n.jsx(te,{variant:"outline",onClick:()=>s("/settings"),className:"ml-4 bg-white hover:bg-white/90",children:"Upgrade Plan"})]})}function i0({title:e,description:t,icon:r,badge:s,actions:a,action:i}){return n.jsx("div",{className:"pb-4 mb-0 w-full",children:n.jsxs("div",{className:"flex justify-between items-start gap-4",children:[n.jsxs("div",{className:"flex items-start gap-3",children:[r&&n.jsx("div",{className:"flex-shrink-0 text-primary mt-1",children:r}),n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:e}),s&&n.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-md text-xs font-medium ${s.variant==="success"?"bg-green-100 text-green-800":s.variant==="warning"?"bg-yellow-100 text-yellow-800":"bg-blue-100 text-blue-800"}`,children:s.label})]}),n.jsx("div",{className:"text-muted-foreground text-sm mt-1",children:t})]})]}),(i||a)&&n.jsxs("div",{className:"flex items-center gap-2",children:[i&&n.jsxs(te,{onClick:i.onClick,size:"sm",className:"h-9",children:[n.jsx(i.icon,{className:"h-4 w-4 mr-2"}),i.label]}),a]})]})})}function Fy(e){const t=g.useRef({value:e,previous:e});return g.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var cC="Switch",[ANe]=Ki(cC),[gNe,xNe]=ANe(cC),gY=g.forwardRef((e,t)=>
1098{const{__scopeSwitch:r,name:s,checked:a,defaultChecked:i,required:o,disabled:l,value:c="on",onCheckedChange:d,form:u,...h}=e,[m,f]=g.useState(null),p=zr(t,y=>f(y)),A=g.useRef(!1),v=m?u||!!m.closest("form"):!0,[x,b]=lo({prop:a,defaultProp:i??!1,onChange:d,caller:cC});return n.jsxs(gNe,{scope:r,checked:x,disabled:l,children:[n.jsx(sr.button,{type:"button",role:"switch","aria-checked":x,"aria-required":o,"data-state":yY(x),"data-disabled":l?"":void 0,disabled:l,value:c,...h,ref:p,onClick:yt(e.onClick,y=>{b(w=>!w),v&&(A.current=y.isPropagationStopped(),A.current||y.stopPropagation())})}),v&&n.jsx(bY,{control:m,bubbles:!A.current,name:s,value:c,checked:x,required:o,disabled:l,form:u,style:{transform:"translateX(-100%)"}})]})});gY.displayName=cC;var xY="SwitchThumb",vY=g.forwardRef((e,t)=>{const{__scopeSwitch:r,...s}=e,a=xNe(xY,r);return n.jsx(sr.span,{"data-state":yY(a.checked),"data-disabled":a.disabled?"":void 0,...s,ref:t})});vY.displayName=xY;var vNe="SwitchBubbleInput",bY=g.forwardRef(({__scopeSwitch:e,control:t,checked:r,bubbles:s=!0,...a},i)=>{const o=g.useRef(null),l=zr(o,i),c=Fy(r),d=I_(t);return g.useEffect(()=>{const u=o.current;if(!u)return;const h=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(h,"checked").set;if(c!==r&&f){const p=new Event("click",{bubbles:s});f.call(u,r),u.dispatchEvent(p)}},[c,r,s]),n.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...a,tabIndex:-1,ref:l,style:{...a.style,...d,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});bY.displayName=vNe;function yY(e){return e?"checked":"unchecked"}var wY=gY,bNe=vY;const ns=g.forwardRef(({className:e,...t},r)=>n.jsx(wY,{className:ye("peer inline-flex h-7 w-14 shrink-0 cursor-pointer items-center rounded-full border border-gray-200 dark:border-gray-700 shadow-sm transition-all duration-300 ease-in-out","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2 focus-visible:ring-offset-background","disabled:cursor-not-allowed disabled:opacity-50","data-[state=checked]:bg-gradient-to-r data-[state=checked]:from-blue-500 data-[state=checked]:to-indigo-600 data-[state=checked]:border-transparent","data-[state=unchecked]:bg-gray-100 dark:data-[state=unchecked]:bg-gray-800","hover:shadow-md hover:border-gray-300 dark:hover:border-gray-600","data-[state=checked]:hover:from-blue-600 data-[state=checked]:hover:to-indigo-700",e),...t,ref:r,children:n.jsx(bNe,{className:ye("pointer-events-none block h-5 w-5 rounded-full bg-white shadow-lg ring-0","transition-all duration-300 ease-in-out","data-[state=checked]:translate-x-7 data-[state=unchecked]:translate-x-1","data-[state=checked]:shadow-xl data-[state=checked]:bg-white","data-[state=unchecked]:shadow-md")})}));ns.displayName=wY.displayName;const jY=g.createContext(void 0);function yNe({children:e}){const[t,r]=g.useState(null),[s,a]=g.useState(!0),[i,o]=g.useState(null),l=g.useCallback(async()=>{try{a(!0),o(null);const{data:{session:c}}=await de.auth.getSession();if(!c)throw console.log("[AccountProvider] No session found"),new Error("No session found");const d=await fetch("https://worker.rainfactory.ai/rainfactory/account/status",{headers:{Authorization:`Bearer ${c.access_token}`}});if(!d.ok)throw new Error("Failed to fetch account status");const u=await d.json();r(u)}catch(c){o(c instanceof Error?c:new Error("Unknown error")),console.error("Error fetching account status:",c)}finally{a(!1)}},[]);return g.useEffect(()=>{l();const{data:{subscription:c}}=de.auth.onAuthStateChange(d=>{d==="TOKEN_REFRESHED"&&l()});return()=>c.unsubscribe()},[l]),n.jsx(jY.Provider,{value:{status:t,loading:s,error:i,refresh:l},children:e})}function o0(){const e=g.useContext(jY);if(e===void 0)throw new Error("useAccountStatus must be used within an AccountProvider");return e}const wNe=()=>{const e=xr(),t=Gs(),[r,s]=g.useState([]),[a,i]=g.useState(""),{limitations:o,getRemainingLimits:l,isActionAllowed:c}=lC(),{setSelectedBrand:d,selectedBrand:u,refreshBrands:h}=mn(),{status:m,loading:f}=o0(),p=g.useRef(!0);g.useEffect(()=>{console.log("Account Status Debug:",{accountStatus:m,accountLoading:f,personalAccount:m==null?void 0:m.personalAccount,effectiveStatus:m==null?void 0:m.effectiveStatus})},[m,f]),g.useEffect(()=>{x(),A()},[]),g.useEffect(()=>{p.current?p.current=!1:t.pathname==="/brands"&&(x(),h&&h())},[t.pathname,h]);const A=async()=>{try{const{data:S,error:C}=await de.schema("basejump").from("billing_subscriptions").select("*").in("status",["active","trialing"]);console.log("Active Subscriptions:",S,"Error:",C);const{data:E,error:T}=await de.schema("basejump").from("plan_limitations").select("*");console.log("Plan Limitations:",E,"Error:",T);const{data:B}=await de.rpc("get_personal_account");console.log("Current Account:",B);const{data:L}=await de.rpc("get_plan_limitations");console.log("Current Plan Limitations:",L)}catch(S){console.error("Error checking subscription data:",S)}};g.useEffect(()=>{o&&console.log("Current Plan Limitations:",{maxBrands:o.max_brands,planId:o.plan_id,allLimitations:o})},[o,l]);const v=async()=>
1098{if(!(m!=null&&m.personalAccount)){He({title:"Account Required",description:"You need an active account to create brands. Please activate your account in settings.",variant:"destructive"}),e("/settings");return}console.log("Checking if brand creation is allowed...");const S=await c("create_brand");if(console.log("Brand creation allowed:",S),S)try{const{data:C,error:E}=await de.rpc("get_personal_account");if(E||!(C!=null&&C.account_id))throw new Error("Failed to get account information");const{data:T,error:B}=await de.from("brands").insert({brand_name:"New Brand",status:"ACTIVE",account_id:C.account_id,elevator_pitch:"",niche:"",url:"",default_landing_page:""}).select().single();if(B)throw B;if(!T)throw new Error("Failed to create new brand");d(T),localStorage.setItem("selectedBrandId",T.id),e(`/onboarding?skipBilling=true&brandId=${T.id}`)}catch(C){console.error("Error creating new brand:",C),He({title:"Error Creating Brand",description:"Failed to create a new brand. Please try again.",variant:"destructive"})}else{const C=l(),E=(o==null?void 0:o.max_brands)||0;console.log("Brand creation denied:",{currentLimits:o,remainingLimits:C,maxBrands:E}),He({title:"Brand Limit Reached",description:`You've reached your limit of ${E} brand${E===1?"":"s"} on your current plan. Please upgrade your plan to create more brands.`,variant:"destructive"})}},x=async()=>{try{const{data:{user:S}}=await de.auth.getUser();if(!S)return;const{data:C,error:E}=await de.from("brands").select(`
1099                    *,
1100                    convergences:convergences(count),
1101                    campaigns:campaigns(count),
1102                    contents:contents(count)
1103                `).neq("status","DELETED").order("created_at",{ascending:!1});if(E)throw E;const{data:T,error:B}=await de.from("brand_access").select(`
1104                    access_level,
1105                    expires_at,
1106                    brand:brands!inner(
1107                        id,
1108                        brand_name,
1109                        account_id,
1110                        status,
1111                        notify_on_convergences,
1112                        elevator_pitch,
1113                        niche,
1114                        convergences:convergences(count),
1115                        campaigns:campaigns(count),
1116                        contents:contents(count)
1117                    )
1118                `).eq("user_id",S.id).neq("brand.status","DELETED").or("expires_at.is.null,expires_at.gt."+new Date().toISOString());if(B)throw B;const L=new Map;C==null||C.forEach(I=>{L.set(I.id,I)}),T==null||T.forEach(I=>{const $=I.brand;!L.has($.id)&&$.status!=="DELETED"&&L.set($.id,{...$,_directAccessOnly:!0,_accessLevel:I.access_level})});const P=Array.from(L.values()),{data:F}=await de.from("brand_access").select("brand_id, access_level").eq("user_id",S.id).or("expires_at.is.null,expires_at.gt."+new Date().toISOString()),M=(P==null?void 0:P.map(I=>{const $=F==null?void 0:F.find(R=>R.brand_id===I.id),V=$?I.account_id?"both":"direct":"account";return{...I,status:I.status===null||I.status===void 0?"INACTIVE":I.status,notify_on_convergences:I.notify_on_convergences??!1,convergences:I.convergences||[{count:0}],campaigns:I.campaigns||[{count:0}],contents:I.contents||[{count:0}],access_source:V,direct_access_level:$==null?void 0:$.access_level,account_name:void 0}}))||[];console.log("Fetched brands with access:",M),s(M)}catch(S){console.error("Error fetching brands:",S),He({title:"Error",description:"Failed to fetch brands. Please try again.",variant:"destructive"})}},b=async(S,C)=>{if(C!=="DELETED")try{const E=C==="ACTIVE"?"INACTIVE":"ACTIVE";console.log("🔍 DEBUG: Toggling brand status:",{id:S,currentStatus:C,newStatus:E});const{error:T}=await de.from("brands").update({status:E,updated_at:new Date().toISOString()}).eq("id",S).select();if(T)throw console.error("🔍 DEBUG: Database error:",T),T;if(s(B=>B.map(L=>L.id===S?{...L,status:E}:L)),E==="ACTIVE"){console.log("🔍 DEBUG: Brand activated, triggering convergence processing for brand ID:",S);const L="https://worker.rainfactory.ai/rainfactory/brand-genius/process_updated_brand";console.log("🔍 DEBUG: Calling endpoint:",L);try{const P=await de.auth.getSession();console.log("🔍 DEBUG: Auth session available:",!!P.data.session);const F=await fetch(L,{method:"POST",headers:{"Content-Type":"application/json",Authorization:P.data.session?`Bearer ${P.data.session.access_token}`:""},body:JSON.stringify({brandId:S})}),M=await F.json();console.log("🔍 DEBUG: Process updated brand response:",M),F.ok||console.error("🔍 DEBUG: Error response from process_updated_brand:",F.status,M)}catch(P){console.error("🔍 DEBUG: Error calling process_updated_brand:",P)}}}catch(E){console.error("🔍 DEBUG: Error updating brand status:",E),He({title:"Error",description:"Failed to update brand status. Please try again.",variant:"destructive"})}},y=async(S,C)=>{try{const{error:E}=await de.from("brands").update({notify_on_convergences:!C,updated_at:new Date().toISOString()}).eq("id",S);if(E)throw E;s(T=>T.map(B=>B.id===S?{...B,notify_on_convergences:!C}:B)),He({title:C?"Notifications disabled":"Notifications enabled",description:C?"You won't be notified about new convergences":"You'll be notified when new convergences are available"})}catch(E){console.error("Error updating notification preference:",E),He({title:"Error",description:"Failed to update notification preference. Please try again.",variant:"destructive"})}},w=r.filter(S=>S.brand_name.toLowerCase().includes(a.toLowerCase())).sort((S,C)=>S.brand_name.localeCompare(C.brand_name)),j=l(),N=j?j.remaining_brands<=0:!1,_=!N&&!!(m&&m.personalAccount);return n.jsxs("section",{className:"p-6 space-y-6",children:[n.jsx(i0,{title:"Your Brands",description:n.jsx("div",{className:"space-y-1",children:m&&!m.personalAccount?n.jsxs(n.Fragment,{children:[n.jsx("p",{children:"You currently have access to shared brands only."}),n.jsxs("p",{className:"text-sm text-muted-foreground",children:["You can't create brands without an active account."," ",n.jsx(te,{variant:"link",className:"p-0 h-auto text-sm",onClick:()=>e("/settings"),children:"Click here to activate your account"})]})]}):n.jsxs(n.Fragment,{children:[n.jsx("p",{children:"Create and manage your brands to organize your marketing campaigns and content."}),o?n.jsxs("p",{className:"text-sm text-muted-foreground",children:["You can create up to ",o.max_brands," brand",o.max_brands===1?"":"s"," on your current plan.",j&&` You have ${j.remaining_brands} remaining.`]}):null]})}),icon:n.jsx(wB,{className:"h-6 w-6"}),actions:_?null:n.jsxs(te,{onClick:v,disabled:N||m&&!m.personalAccount||!1,children:[n.jsx(La,{className:"mr-2 h-4 w-4"}),"New Brand"]})}),!f&&m&&n.jsxs("div",{className:"relative overflow-hidden bg-gradient-to-r from-blue-50 via-purple-50 to-indigo-50 border border-blue-200/50 rounded-xl p-6 mb-6",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsxs("div",{className:"relative flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-4",children:[n.jsx("div",{className:"p-2 bg-white/80 backdrop-blur-sm rounded-lg",children:n.jsx(zh,{className:"h-5 w-5 text-blue-600"})}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-semibold text-gray-900 mb-1",children:"Account Status"}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs(Be,{variant:m.effectiveStatus==="active"?"default":m.effectiveStatus==="needs_billing"?"destructive":"secondary",className:"shadow-sm font-medium",children:[m.effectiveStatus==="active"&&n.jsx(Fm,{className:"h-3 w-3 mr-1"}),m.effectiveStatus==="active"?"Active":m.effectiveStatus==="needs_billing"?"Billing Required":"Inactive Brands Only"]}),m.personalAccount&&n.jsxs("span",{className:"text-xs text-gray-600 bg-white/60 backdrop-blur-sm px-2 py-1 rounded-md",children:["Personal Account: ",m.personalAccount.status,m.personalAccount.subscription&&m.personalAccount.subscription.current_period_end&&n.jsxs(n.Fragment,{children:[" • ",m.personalAccount.subscription.cancel_at_period_end?`Cancels ${new Date(m.personalAccount.subscription.current_period_end).toLocaleDateString()}`:`Renews ${new Date(m.personalAccount.subscription.current_period_end).toLocaleDateString()}`]})]}),!m.personalAccount&&m.hasActiveBrands&&n.jsx("span",{className:"text-xs text-gray-600 bg-white/60 backdrop-blur-sm px-2 py-1 rounded-md",children:"Access through shared brands only"})]})]})]}),m.requiresBilling&&n.jsxs(te,{variant:"outline",size:"sm",className:"bg-white/80 backdrop-blur-sm hover:bg-white shadow-sm",onClick:()=>e("/settings/billing"),children:[n.jsx(en,{className:"h-4 w-4 mr-2"}
1118),"Update Billing"]})]})]}),N&&n.jsx(pNe,{type:"brands",className:"mb-4"}),n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"relative",children:[n.jsx("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:n.jsx(Ns,{className:"h-5 w-5 text-gray-400"})}),n.jsx("input",{type:"text",value:a,onChange:S=>i(S.target.value),placeholder:"Search your brands...",className:"w-full pl-10 pr-4 py-3 bg-white border border-gray-200 rounded-xl shadow-sm focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-all duration-200 placeholder:text-gray-500"}),a&&n.jsx("div",{className:"absolute inset-y-0 right-0 pr-3 flex items-center",children:n.jsx("button",{onClick:()=>i(""),className:"text-gray-400 hover:text-gray-600 p-1 rounded-full hover:bg-gray-100 transition-colors",children:n.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})})]}),w.length>0?n.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 2xl:grid-cols-3 gap-6",children:[_&&n.jsx("div",{className:ye("group relative overflow-hidden bg-white rounded-2xl border-2 border-dashed border-blue-300 hover:border-blue-500 shadow-sm hover:shadow-xl transition-all duration-500 transform hover:-translate-y-1 p-6 flex items-center justify-center cursor-pointer"),onClick:v,title:"Add a new brand",children:n.jsxs("div",{className:"flex flex-col items-center text-blue-700",children:[n.jsx("div",{className:"w-12 h-12 rounded-xl bg-blue-50 flex items-center justify-center mb-3 group-hover:bg-blue-100 transition-colors",children:n.jsx(La,{className:"h-6 w-6"})}),n.jsx("span",{className:"font-semibold",children:"Add Brand"}),o&&n.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:j&&j.remaining_brands>=0?`You can add ${j.remaining_brands} more`:"Create a new brand"})]})},"add-brand"),w.map((S,C)=>{var E,T,B;return n.jsxs("div",{className:ye("group relative overflow-hidden bg-gradient-to-br from-white via-gray-50/50 to-white rounded-2xl shadow-sm hover:shadow-xl transition-all duration-500 transform hover:-translate-y-1 p-6 space-y-5 animate-brand-slide cursor-pointer",(u==null?void 0:u.id)===S.id?"border-2 border-emerald-400 shadow-lg shadow-emerald-100/50 hover:shadow-emerald-200/50":"border border-gray-200/60 hover:shadow-blue-100/50 hover:border-blue-200"),style:{animationDelay:`${C*100}ms`},onClick:()=>{d(S),localStorage.setItem("selectedBrandId",S.id),He({title:"Brand Selected",description:`${S.brand_name} is now your active brand.`})},children:[n.jsx("div",{className:ye("absolute inset-0 bg-gradient-to-br transition-opacity duration-500",(u==null?void 0:u.id)===S.id?"from-emerald-50/30 via-transparent to-emerald-50/30 opacity-100":"from-blue-50/20 via-transparent to-purple-50/20 opacity-0 group-hover:opacity-100")}),n.jsx("div",{className:ye("absolute inset-0 rounded-2xl transition-opacity duration-500 blur-sm",(u==null?void 0:u.id)===S.id?"bg-gradient-to-r from-emerald-400/20 via-emerald-400/20 to-emerald-400/20 opacity-100":"bg-gradient-to-r from-blue-400/10 via-purple-400/10 to-indigo-400/10 opacity-0 group-hover:opacity-100")}),n.jsxs("div",{className:"relative flex flex-col space-y-4",children:[n.jsxs("div",{className:"flex items-start gap-4",children:[n.jsx("div",{className:"flex-shrink-0",children:n.jsx("div",{className:"w-12 h-12 rounded-xl bg-gradient-to-br from-blue-500 to-purple-600 flex items-center justify-center shadow-lg",children:n.jsx("span",{className:"text-white font-bold text-lg",children:S.brand_name.charAt(0).toUpperCase()})})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("h3",{className:ye("text-xl font-bold truncate transition-colors duration-300",(u==null?void 0:u.id)===S.id?"text-emerald-700":"text-gray-900 group-hover:text-blue-700"),children:S.brand_name}),(u==null?void 0:u.id)===S.id&&n.jsx("div",{className:"flex-shrink-0",children:n.jsx(di,{className:"h-5 w-5 text-emerald-600 animate-pulse"})})]}),n.jsxs("div",{className:"flex items-center gap-2 mt-2 flex-wrap",children:[n.jsxs(Be,{variant:S.status==="ACTIVE"?"default":"secondary",className:`shadow-sm font-medium transition-all duration-300 ${S.status==="ACTIVE"?"bg-emerald-100 text-emerald-700 hover:bg-emerald-200 border-emerald-200":"bg-gray-100 text-gray-600 hover:bg-gray-200"}`,children:[S.status==="ACTIVE"&&n.jsx("div",{className:"w-2 h-2 bg-emerald-500 rounded-full mr-1.5 animate-pulse"}),S.status==="ACTIVE"?"Active":"Inactive"]}),S.access_source==="direct"&&n.jsxs(Be,{variant:"outline",className:"text-xs flex items-center gap-1 bg-blue-50 text-blue-700 border-blue-200",children:[n.jsx(Ka,{className:"h-3 w-3"}),"Direct - ",S.direct_access_level]}),S.access_source==="both"&&n.jsxs(Be,{variant:"outline",className:"text-xs flex items-center gap-1 bg-purple-50 text-purple-700 border-purple-200",children:[n.jsx(Ka,{className:"h-3 w-3"}),"Team + Direct - ",S.direct_access_level]})]})]})]}),n.jsxs("div",{className:"bg-gray-50/50 backdrop-blur-sm rounded-xl p-4 space-y-3",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(mr,{className:"h-4 w-4 text-blue-500"}),n.jsx("span",{className:"text-sm font-medium text-gray-700",children:"Notifications"})]}),n.jsx(ns,{checked:S.notify_on_convergences,onCheckedChange:()=>y(S.id,S.notify_on_convergences),className:"data-[state=checked]:bg-blue-500"})]}),n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(en,{className:"h-4 w-4 text-emerald-500"}),n.jsx("span",{className:"text-sm font-medium text-gray-700",children:"Active Status"})]}),n.jsx(ns,{checked:S.status==="ACTIVE",onCheckedChange:()=>b(S.id,S.status),className:"data-[state=checked]:bg-emerald-500"})]})]})]}),n.jsx("div",{className:"relative space-y-3",children:n.jsxs("div",{className:"space-y-2",children:[n.jsx("p",{className:"text-sm text-gray-700 leading-relaxed line-clamp-2 min-h-[2.5rem]",children:S.elevator_pitch||"No description provided yet."}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("div",{className:"w-1.5 h-1.5 bg-blue-400 rounded-full"}),n.jsx("p",{className:"text-sm text-gray-500 font-medium line-clamp-1",children:S.niche||"General"})]})]})}),n.jsxs("div",{className:"relative",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-blue-50 via-purple-50 to-indigo-50 rounded-xl opacity-50"}),n.jsxs("div",{className:"relative grid grid-cols-3 gap-4 p-4 rounded-xl border border-gray-100/50",children:[n.jsxs("div",{className:"text-center group/metric hover:scale-105 transition-transform duration-200",children:[n.jsx("div",{className:"inline-flex items-center justify-center w-8 h-8 bg-blue-100 rounded-lg mb-2 group-hover/metric:bg-blue-200 transition-colors",children:n.jsx(sa,{className:"h-4 w-4 text-blue-600"})}),n.jsx("span",{className:"block text-lg font-bold text-gray-900 group-hover/metric:text-blue-700 transition-colors",children:((E=S.convergences[0])==null?void 0:E.
1118count)||0}),n.jsx("span",{className:"text-xs text-gray-600 font-medium",children:"Convergences"})]}),n.jsxs("div",{className:"text-center group/metric hover:scale-105 transition-transform duration-200",children:[n.jsx("div",{className:"inline-flex items-center justify-center w-8 h-8 bg-purple-100 rounded-lg mb-2 group-hover/metric:bg-purple-200 transition-colors",children:n.jsx(en,{className:"h-4 w-4 text-purple-600"})}),n.jsx("span",{className:"block text-lg font-bold text-gray-900 group-hover/metric:text-purple-700 transition-colors",children:((T=S.campaigns[0])==null?void 0:T.count)||0}),n.jsx("span",{className:"text-xs text-gray-600 font-medium",children:"Campaigns"})]}),n.jsxs("div",{className:"text-center group/metric hover:scale-105 transition-transform duration-200",children:[n.jsx("div",{className:"inline-flex items-center justify-center w-8 h-8 bg-indigo-100 rounded-lg mb-2 group-hover/metric:bg-indigo-200 transition-colors",children:n.jsx(mr,{className:"h-4 w-4 text-indigo-600"})}),n.jsx("span",{className:"block text-lg font-bold text-gray-900 group-hover/metric:text-indigo-700 transition-colors",children:((B=S.contents[0])==null?void 0:B.count)||0}),n.jsx("span",{className:"text-xs text-gray-600 font-medium",children:"Content"})]})]})]}),n.jsxs("div",{className:"relative pt-4 border-t border-gradient-to-r from-gray-100 via-gray-200 to-gray-100",children:[n.jsxs("div",{className:"flex gap-2 justify-center",children:[n.jsxs(te,{variant:"default",size:"sm",onClick:L=>{L.stopPropagation(),d(S),localStorage.setItem("selectedBrandId",S.id),e("/brand-genius")},className:"flex items-center gap-2 bg-gradient-to-r from-blue-600 to-blue-700 hover:from-blue-700 hover:to-blue-800 shadow-sm hover:shadow-md transition-all duration-200 transform hover:scale-105 flex-1 sm:flex-none",title:"Open Brand Genius",children:[n.jsx(Gi,{className:"h-4 w-4"}),n.jsx("span",{className:"hidden xs:inline sm:hidden md:inline",children:"Brand Genius"}),n.jsx("span",{className:"xs:hidden sm:inline md:hidden",children:"Genius"})]}),n.jsxs(te,{variant:"outline",size:"sm",onClick:L=>{L.stopPropagation(),d(S),localStorage.setItem("selectedBrandId",S.id),e(`/brands/${S.id}
1118/settings`)},className:"flex items-center gap-2 border-gray-200 hover:border-gray-300 hover:bg-gray-50 transition-all duration-200 transform hover:scale-105 flex-1 sm:flex-none",title:"Brand Settings",children:[n.jsx(fs,{className:"h-4 w-4"}),n.jsx("span",{className:"hidden xs:inline sm:hidden md:inline",children:"Settings"})]})]}),(u==null?void 0:u.id)===S.id&&n.jsx("div",{className:"mt-3 text-center",children:n.jsxs("div",{className:"inline-flex items-center gap-2 px-3 py-1.5 bg-emerald-100 text-emerald-700 rounded-full text-sm font-medium",children:[n.jsx(di,{className:"h-4 w-4"}),n.jsx("span",{children:"Active Brand"})]})})]})]},S.id)})]}):n.jsxs("div",{className:"relative overflow-hidden bg-gradient-to-br from-gray-50 via-white to-blue-50/30 rounded-2xl border border-gray-200/60 shadow-sm",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsxs("div",{className:"relative text-center py-16 px-8",children:[n.jsx("div",{className:"absolute top-8 left-8 w-20 h-20 bg-gradient-to-br from-blue-100 to-purple-100 rounded-full opacity-50 animate-pulse"}),n.jsx("div",{className:"absolute bottom-8 right-8 w-16 h-16 bg-gradient-to-br from-indigo-100 to-pink-100 rounded-full opacity-30 animate-pulse",style:{animationDelay:"1s"}}),n.jsx("div",{className:"mx-auto w-20 h-20 bg-gradient-to-br from-blue-500 to-purple-600 rounded-2xl flex items-center justify-center mb-6 shadow-lg",children:a?n.jsx(Ns,{className:"h-10 w-10 text-white"}):n.jsx(mr,{className:"h-10 w-10 text-white"})}),n.jsx("h3",{className:"text-2xl font-bold text-gray-900 mb-3",children:a?"No Matching Brands":"No Brands Yet"}),n.jsx("p",{className:"text-gray-600 mb-8 max-w-md mx-auto leading-relaxed",children:a?"We couldn't find any brands matching your search. Try adjusting your search terms.":m&&!m.personalAccount?"You need an active account to create and manage your own brands.":"Create your first brand to start building amazing marketing campaigns and content."}),n.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center",children:[a&&n.jsx(te,{onClick:()=>i(""),variant:"outline",className:"bg-white hover:bg-gray-50 border-gray-200",children:"Clear Search"}),!a&&!N&&(m==null?void 0:m.personalAccount)&&n.jsxs(te,{onClick:v,className:"bg-gradient-to-r from-blue-600 to-purple-600 hover:from-blue-700 hover:to-purple-700 text-white shadow-lg hover:shadow-xl transition-all duration-200 transform hover:scale-105",children:[n.jsx(La,{className:"mr-2 h-5 w-5"}),"Create Your First Brand"]}),!a&&m&&!m.personalAccount&&n.jsxs(te,{onClick:()=>e("/settings"),className:"bg-gradient-to-r from-emerald-600 to-teal-600 hover:from-emerald-700 hover:to-teal-700 text-white shadow-lg hover:shadow-xl transition-all duration-200 transform hover:scale-105",children:[n.jsx(Fm,{className:"mr-2 h-5 w-5"}),"Activate Your Account"]})]})]})]})]})]})};function jNe({session:e}){const[t,r]=g.useState(!0),[s,a]=g.useState(null),[i,o]=g.useState(null),[l,c]=g.useState(null);g.useEffect(()=>{let u=!1;async function h(){r(!0);const{user:m}=e,{data:f,error:p}=await de.from("profiles").select("username, website, avatar_url").eq("id",m.id).single();u||(p?console.warn(p):f&&(a(f.username),o(f.website),c(f.avatar_url))),r(!1)}return h(),()=>{u=!0}},[e]);async function d(u){u.preventDefault(),r(!0);const{user:h}=e,m={id:h.id,username:s,website:i,avatar_url:l,updated_at:new Date},{error:f}=await de.from("profiles").upsert(m);f?alert(f.message):c(l),r(!1)}return n.jsxs("form",{onSubmit:d,className:"form-widget",children:[n.jsxs("div",{children:[n.jsx("label",{htmlFor:"email",children:"Email"}),n.jsx("input",{id:"email",type:"text",value:e.user.email,disabled:!0})]}),n.jsxs("div",{children:[n.jsx("label",{htmlFor:"username",children:"Name"}),n.jsx("input",{id:"username",type:"text",required:!0,value:s||"",onChange:u=>a(u.target.value)})]}),n.jsxs("div",{children:[n.jsx("label",{htmlFor:"website",children:"Website"}),n.jsx("input",{id:"website",type:"url",value:i||"",onChange:u=>o(u.target.value)})]}),n.jsx("div",{children:n.jsx("button",{className:"button block primary",type:"submit",disabled:t,children:t?"Loading ...":"Update"})}),n.jsx("div",{children:n.jsx("button",{className:"button block",type:"button",onClick:()=>de.auth.signOut(),children:"Sign Out"})})]})}const O5=new Set;async function bM(e){if(console.log("[claimBrand] Starting brand claim process for session token:",e),O5.has(e))throw console.log("[claimBrand] Claiming already in progress for this session token, skipping duplicate request"),new Error("Brand claiming already in progress");O5.add(e);try{const{data:{session:t}}=await de.auth.getSession();if(!t)throw console.error("[claimBrand] No authenticated session found"),new Error("Not authenticated");console.log("[claimBrand] Authenticated user found:",t.user.id);const r="https://worker.rainfactory.ai/rainfactory/anonymous-brands/claim_brand";console.log("[claimBrand] Making request to:",r);const s=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t.access_token}`},body:JSON.stringify({sessionToken:e})});console.log("[claimBrand] Response status:",s.status),console.log("[claimBrand] Response headers:",Object.fromEntries(s.headers.entries()));const a=await s.json();if(console.log("[claimBrand] Response body:",a),!s.ok)throw console.error("[claimBrand] API error:",a.error||"Failed to claim brand"),new Error(a.error||"Failed to claim brand");return console.log("[claimBrand] Brand claim successful! Cleaning up session tokens..."),localStorage.removeItem("brand_claim_session_token"),localStorage.removeItem("anonymous_session_token"),console.log("[claimBrand] Returning result:",a),a}catch(t){throw console.error("[claimBrand] Error during brand claiming:",t),t}finally{O5.delete(e)}}async function NNe(e){const t=await fetch("https://worker.rainfactory.ai/rainfactory/anonymous-brands/get_processing_status",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionToken:e})}),r=await t.json();if(!t.ok)throw new Error(r.error||"Failed to fetch anonymous brand data");return r}function VB(){return localStorage.getItem("brand_claim_session_token")||localStorage.getItem("anonymous_session_token")}function GB(){const e=xr(),t=Gs(),[r,s]=g.useState(!0),{trackEvent:a,events:i}=Lu();console.log("AuthCallback component running");const o=async l=>{const c=wi();if(Object.keys(c).length>0)try{const d={};c.utm_source&&(d.utm_source=c.utm_source),c.utm_medium&&(d.utm_medium=c.utm_medium),c.utm_campaign&&(d.utm_campaign=c.utm_campaign),c.utm_term&&(d.utm_term=c.utm_term),c.utm_c
1118ontent&&(d.utm_content=c.utm_content);const{data:u}=await de.schema("marketing_and_customer_success").from("profiles").select("metadata").eq("id",l).single();d.metadata=JSON.stringify({...(u==null?void 0:u.metadata)||{},utm_params:c,utm_capture_date:new Date().toISOString()});const{error:h}=await de.schema("marketing_and_customer_success").from("profiles").update(d).eq("id",l);h?console.error("Error saving UTM parameters:",h):console.log("Successfully saved UTM parameters for user",l,d)}catch(d){console.error("Exception saving UTM parameters:",d)}};return g.useEffect(()=>{const l=async()=>{var v,x,b;console.log("[AuthCallback] Starting auth status check...");const d=window.location.href,u=new URLSearchParams(window.location.search),h=new URLSearchParams(window.location.hash.replace("#",""));console.log("[AuthCallback] Current URL:",d),console.log("[AuthCallback] URL params:",Object.fromEntries(u.entries())),console.log("[AuthCallback] Hash params:",Object.fromEntries(h.entries()));const m=u.get("error"),f=u.get("error_description");m&&console.error("[AuthCallback] Auth error from Supabase:",m,f);const{data:{session:p},error:A}=await de.auth.getSession();if(console.log("[AuthCallback] Session check result:",{hasSession:!!p,sessionError:A,userId:(v=p==null?void 0:p.user)==null?void 0:v.id,email:(x=p==null?void 0:p.user)==null?void 0:x.email}),p){await o(p.user.id);try{if(await h2(p.user)){console.log("[AuthCallback] Auto-detecting timezone for new user");const S=await u2(p.user,{updateProfile:!0,silentMode:!1});S.detected&&S.timezone?(console.log("[AuthCallback] Successfully auto-detected timezone:",S.timezone),a(i.FEATURE_USED,{feature:"timezone_auto_detection",user_id:p.user.id,detected_timezone:S.timezone,was_successful:!0})):S.error&&(console.log("[AuthCallback] Timezone auto-detection failed:",S.error),a(i.ERROR_OCCURRED,{error_type:"timezone_auto_detection_failed",user_id:p.user.id,error_message:S.error}))}}catch(_){console.error("[AuthCallback] Error during timezone auto-detection:",_),a(i.ERROR_OCCURRED,{error_type:"timezone_auto_detection_error",user_id:p.user.id,error_message:_ instanceof Error?_.message:"Unknown error"})}a(i.USER_LOGGED_IN,{user_id:p.user.id,email_domain:((b=p.user.email)==null?void 0:b.split("@")[1])||"unknown",auth_provider:p.user.app_metadata.provider||"unknown",is_new_user:p.user.created_at===p.user.updated_at,...wi()});const y=new URLSearchParams(window.location.search),w=y.get("claim")==="true",j=y.get("sessionToken")||VB();if(w&&j){console.log("[AuthCallback] Brand claim flow detected in session check with existing session");try{console.log("[AuthCallback] Processing brand claim for session token:",j);const _=await bM(j);console.log("[AuthCallback] Brand claimed successfully! Result:",_),a(i.BRAND_CREATED,{user_id:p.user.id,brand_id:_.brand_id,source:"anonymous_claim",...wi()});const S=`/onboarding?brandId=${_.brand_id}`;console.log("[AuthCallback] 🎯 Redirecting to onboarding with claimed brand:",S),e(S,{replace:!0});return}catch(_){console.error("[AuthCallback] Failed to claim brand:",_)}}const{data:N}=await de.schema("marketing_and_customer_success").from("profiles").select("onboarding_completed").eq("id",p.user.id).single();N!=null&&N.onboarding_completed?(a(i.USER_LOGGED_IN,{user_id:p.user.id,is_returning:!0,...wi()}),e("/dashboard")):(a(i.USER_ONBOARDING_STARTED,{user_id:p.user.id,is_new_user:p.user.created_at===p.user.updated_at,...wi()}),e("/onboarding"))}else{console.log("[AuthCallback] No session found in checkAuthStatus");const y=u.get("code"),w=u.get("error");y?(console.log("[AuthCallback] OAuth code found, waiting for auth state change..."),setTimeout(async()=>{var _;console.log("[AuthCallback] Retrying session check after delay...");const{data:{session:j},error:N}=await de.auth.getSession();console.log("[AuthCallback] Retry session result:",{hasSession:!!j,retryError:N,userId:(_=j==null?void 0:j.user)==null?void 0:_.id}),j||(console.log("[AuthCallback] Still no session after retry, auth likely failed"),s(!1))},2e3)):w?(console.log("[AuthCallback] OAuth error:",w,u.get("error_description")),a(i.ERROR_OCCURRED,{error_type:"auth_failed",reason:w,error_description:u.get("error_description"),...wi()}),s(!1)):(console.log("[AuthCallback] No session, no code, no error - auth failed"),a(i.ERROR_OCCURRED,{error_type:"auth_failed",reason:"no_session",...wi()}),s(!1))}},{data:c}=de.auth.onAuthStateChange(async(d,u)=>{var h,m;if(console.log("[AuthCallback] Auth state change:",{event:d,hasSession:!!u,userId:(h=u==null?void 0:u.user)==null?void 0:h.id,email:(m=u==null?void 0:u.user)==null?void 0:m.email}),d==="SIGNED_IN"&&u){const f=new URLSearchParams(window.location.search),p=f.get("claim")==="true",A=f.get("sessionToken")||VB();await o(u.user.id);try{if(await h2(u.user)){console.log("[AuthCallback] Auto-detecting timezone for new user (auth listener)");const b=await u2(u.user,{updateProfile:!0,silentMode:!1});b.detected&&b.timezone&&(console.log("[AuthCallback] Successfully auto-detected timezone (auth listener):",b.timezone),a(i.FEATURE_USED,{feature:"timezone_auto_detection",user_id:u.user.id,detected_t
1118imezone:b.timezone,was_successful:!0,context:"auth_listener"}))}}catch(x){console.error("[AuthCallback] Error during timezone auto-detection (auth listener):",x)}if(a(i.USER_LOGGED_IN,{event_type:d,user_id:u.user.id,auth_provider:u.user.app_metadata.provider||"unknown",is_brand_claim:p,...wi()}),p&&A)try{console.log("[AuthCallback] Processing brand claim for session token in auth listener:",A);const x=await bM(A);console.log("[AuthCallback] Brand claimed successfully in auth listener! Full result:",x),console.log("[AuthCallback] Claimed brand ID in auth listener:",x.brand_id),a(i.BRAND_CREATED,{user_id:u.user.id,brand_id:x.brand_id,source:"anonymous_claim",...wi()});const b=`/onboarding?brandId=${x.brand_id}`;console.log("[AuthCallback] 🎯 Redirecting to onboarding with claimed brand (auth listener):",b),s(!1),e(b,{replace:!0});return}catch(x){console.error("[AuthCallback] Failed to claim brand in auth listener:",x),console.error("[AuthCallback] Error details in auth listener:",{message:x instanceof Error?x.message:String(x),sessionToken:A,isClaim:p}),a(i.ERROR_OCCURRED,{error_type:"brand_claim_failed",user_id:u.user.id,error_message:x instanceof Error?x.message:String(x),...wi()})}const{data:v}=await de.schema("marketing_and_customer_success").from("profiles").select("onboarding_completed").eq("id",u.user.id).single();v!=null&&v.onboarding_completed?(s(!1),e("/dashboard")):(a(i.USER_ONBOARDING_STARTED,{user_id:u.user.id,is_new_user:u.user.created_at===u.user.updated_at,...wi()}),s(!1),e("/onboarding"))}});return l(),()=>{c.subscription.unsubscribe()}},[e,t]),r?n.jsx("div",{children:"Loading..."}):n.jsx("div",{children:"Authentication failed. Please try again."})}function NY(){const[e]=Bi();return g.useEffect(()=>{const t=e.get("code"),r=e.get("state"),s=e.get("error"),a=e.get("error_description");console.log("LinkedIn OAuth callback received",{code:t,state:r,error:s,errorDescription:a}),window.opener?(window.opener.postMessage({type:"linkedin_auth_callback",code:t,state:r,error:s,errorDescription:a},window.location.origin),window.close()):(console.error("LinkedIn callback opened directly, not in popup window"),document.body.innerHTML=`
1119        <div style="text-align:center; padding: 2rem;">
1120          <h1>LinkedIn Authentication</h1>
1121          <p>${s?"Authentication failed: "+a:"Authentication successful"}</p>
1122          <p>You can close this window now and return to the application.</p>
1123        </div>
1124      `)},[e]),n.jsxs("div",{className:"flex flex-col items-center justify-center min-h-screen p-4",children:[n.jsx("h1",{className:"text-2xl font-bold mb-4",children:"LinkedIn Authentication"}),n.jsx("p",{className:"text-center mb-4",children:"Processing your authentication..."}),n.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-t-2 border-b-2 border-gray-900"})]})}function _Y(){const[e]=Bi();return g.useEffect(()=>{const t=e.get("code"),r=e.get("state"),s=e.get("error"),a=e.get("error_description");console.log("X (Twitter) OAuth callback received",{code:t,state:r,error:s,errorDescription:a}),window.opener?(window.opener.postMessage({type:"twitter_auth_callback",code:t,state:r,error:s,errorDescription:a},window.location.origin),window.close()):(console.error("X (Twitter) callback opened directly, not in popup window"),document.body.innerHTML=`
1125        <div style="text-align:center; padding: 2rem;">
1126          <h1>X (Twitter) Authentication</h1>
1127          <p>${s?"Authentication failed: "+a:"Authentication successful"}</p>
1128          <p>You can close this window now and return to the application.</p>
1129        </div>
1130      `)},[e]),n.jsxs("div",{className:"flex flex-col items-center justify-center min-h-screen p-4",children:[n.jsx("h1",{className:"text-2xl font-bold mb-4",children:"X (Twitter) Authentication"}),n.jsx("p",{className:"text-center mb-4",children:"Processing your authentication..."}),n.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-t-2 border-b-2 border-gray-900"})]})}function _Ne(){const[e]=Bi();return g.useEffect(()=>{const t=e.get("code"),r=e.get("state"),s=e.get("error"),a=e.get("error_description");console.log("Instagram OAuth callback received",{code:t,state:r,error:s,errorDescription:a}),window.opener?(window.opener.postMessage({type:"instagram_auth_callback",code:t,state:r,error:s,errorDescription:a},window.location.origin),window.close()):(console.error("Instagram callback opened directly, not in popup window"),document.body.innerHTML=`
1131        <div style="text-align:center; padding: 2rem;">
1132          <h1>Instagram Authentication</h1>
1133          <p>${s?"Authentication failed: "+a:"Authentication successful"}</p>
1134          <p>You can close this window now and return to the application.</p>
1135        </div>
1136      `)},[e]),n.jsxs("div",{className:"flex flex-col items-center justify-center min-h-screen p-4",children:[n.jsx("h1",{className:"text-2xl font-bold mb-4",children:"Instagram Authentication"}),n.jsx("p",{className:"text-center mb-4",children:"Processing your authentication..."}),n.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-t-2 border-b-2 border-gray-900"})]})}function qB(){const[e]=Bi(),[t,r]=g.useState(!0),[s,a]=g.useState(null),[i,o]=g.useState(!1),[l,c]=g.useState(""),d=xr(),{trackEvent:u,events:h}=Lu(),m=e.get("invitation_token")||e.get("token");return g.useEffect(()=>{(async()=>
1136{if(console.log("[ProcessInvitation] Starting with token:",m),!m){a("No invitation token found. Please check your invitation link."),r(!1);return}try{const{data:p}=await de.auth.getSession();if(!p.session){console.log("[ProcessInvitation] No active session, redirecting to login"),d(`/login?flow=invite&invitation_token=${m}`);return}console.log("[ProcessInvitation] Accepting invitation with token:",m);const{data:A,error:v}=await de.rpc("accept_brand_invitation",{invitation_token:m});if(v){console.error("[ProcessInvitation] Error accepting invitation:",v),a(`Failed to accept invitation: ${v.message}`),r(!1);return}console.log("[ProcessInvitation] Invitation accepted successfully:",A);const x=A;if(!x||!x.success){a((x==null?void 0:x.error)||"Failed to accept invitation"),r(!1);return}c(x.brand_name||"the brand");const{error:b}=await de.schema("marketing_and_customer_success").from("profiles").update({onboarding_completed:!0}).eq("id",p.session.user.id);b?console.error("[ProcessInvitation] Error updating profile:",b):console.log("[ProcessInvitation] Set onboarding_completed to true"),u(h.USER_LOGGED_IN,{user_id:p.session.user.id,via_invitation:!0,invitation_accepted:!0}),o(!0),r(!1),setTimeout(()=>{d("/brands")},2e3)}catch(p){console.error("[ProcessInvitation] Unexpected error:",p),a("An unexpected error occurred. Please try again."),r(!1)}})()},[m,d,u,h]),t?n.jsx("div",{className:"flex items-center justify-center min-h-screen",children:n.jsxs(Te,{className:"w-[400px] shadow-md",children:[n.jsxs(st,{children:[n.jsx(ot,{className:"text-center",children:"Processing Invitation"}),n.jsx(Wr,{className:"text-center",children:"Please wait while we add you to the team..."})]}),n.jsx(Re,{className:"flex justify-center p-6",children:n.jsx(kt,{className:"h-12 w-12 animate-spin text-primary"})})]})}):s?n.jsx("div",{className:"flex items-center justify-center min-h-screen",children:n.jsxs(Te,{className:"w-[400px] shadow-md",children:[n.jsxs(st,{children:[n.jsx(ot,{className:"text-center text-red-500",children:"Invitation Error"}),n.jsx(Wr,{className:"text-center",children:s})]}),n.jsxs(Re,{className:"flex flex-col items-center gap-4 p-6",children:[n.jsx(Rl,{className:"h-12 w-12 text-red-500"}),n.jsx(te,{onClick:()=>d("/brands"),children:"Go to Brands"})]})]})}):i?n.jsx("div",{className:"flex items-center justify-center min-h-screen",children:n.jsxs(Te,{className:"w-[400px] shadow-md",children:[n.jsxs(st,{children:[n.jsx(ot,{className:"text-center text-green-500",children:"Invitation Accepted"}),n.jsxs(Wr,{className:"text-center",children:["You have successfully joined ",l,"."]})]}),n.jsxs(Re,{className:"flex flex-col items-center gap-4 p-6",children:[n.jsx(qt,{className:"h-12 w-12 text-green-500"}),n.jsx("p",{className:"text-sm text-center",children:"Redirecting to brands..."})]})]})}):null}function Lt({className:e,...t}){return n.jsx("div",{className:ye("animate-pulse rounded-md bg-muted",e),...t})}function mb(e,[t,r]){return Math.min(r,Math.max(t,e))}function CNe(e){const t=SNe(e),r=g.forwardRef((s,a)=>{const{children:i,...o}=s,l=g.Children.toArray(i),c=l.find(ENe);if(c){const d=c.props.children,u=l.map(h=>h===c?g.Children.count(d)>1?g.Children.only(null):g.isValidElement(d)?d.props.children:null:h);return n.jsx(t,{...o,ref:a,children:g.isValidElement(d)?g.cloneElement(d,void 0,u):null})}return n.jsx(t,{...o,ref:a,children:i})});return r.displayName=`${e}.Slot`,r}function SNe(e){const t=g.forwardRef((r,s)=>{const{children:a,...i}=r;if(g.isValidElement(a)){const o=TNe(a),l=BNe(i,a.props);return a.type!==g.Fragment&&(l.ref=s?fI(s,o):o),g.cloneElement(a,l)}return g.Children.count(a)>1?g.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var kNe=Symbol("radix.slottable");function ENe(e){return g.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===kNe}function BNe(e,t){const r={...t};for(const s in t){const a=e[s],i=t[s];/^on[A-Z]/.test(s)?a&&i?r[s]=(...l)=>{const c=i(...l);return a(...l),c}:a&&(r[s]=a):s==="style"?r[s]={...a,...i}:s==="className"&&(r[s]=[a,i].filter(Boolean).join(" "))}return{...e,...r}}function TNe(e){var s,a;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var CY=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),PNe="VisuallyHidden",dC=g.forwardRef((e,t)=>
vendor: 4,597 bytes, line 1136
1136n.jsx(sr.span,{...e,ref:t,style:{...CY,...e.style}}));dC.displayName=PNe;var INe=dC,ONe=[" ","Enter","ArrowUp","ArrowDown"],FNe=[" ","Enter"],Dm="Select",[uC,hC,LNe]=F_(Dm),[l0]=Ki(Dm,[LNe,rf]),fC=rf(),[DNe,of]=l0(Dm),[RNe,UNe]=l0(Dm),SY=e=>{const{__scopeSelect:t,children:r,open:s,defaultOpen:a,onOpenChange:i,value:o,defaultValue:l,onValueChange:c,dir:d,name:u,autoComplete:h,disabled:m,required:f,form:p}=e,A=fC(t),[v,x]=g.useState(null),[b,y]=g.useState(null),[w,j]=g.useState(!1),N=Xg(d),[_,S]=lo({prop:s,defaultProp:a??!1,onChange:i,caller:Dm}),[C,E]=lo({prop:o,defaultProp:l,onChange:c,caller:Dm}),T=g.useRef(null),B=v?p||!!v.closest("form"):!0,[L,P]=g.useState(new Set),F=Array.from(L).map(M=>M.props.value).join(";");return n.jsx(R_,{...A,children:n.jsxs(DNe,{required:f,scope:t,trigger:v,onTriggerChange:x,valueNode:b,onValueNodeChange:y,valueNodeHasChildren:w,onValueNodeHasChildrenChange:j,contentId:tf(),value:C,onValueChange:E,open:_,onOpenChange:S,dir:N,triggerPointerDownPosRef:T,disabled:m,children:[n.jsx(uC.Provider,{scope:t,children:n.jsx(RNe,{scope:e.__scopeSelect,onNativeOptionAdd:g.useCallback(M=>{P(I=>new Set(I).add(M))},[]),onNativeOptionRemove:g.useCallback(M=>{P(I=>{const $=new Set(I);return $.delete(M),$})},[]),children:r})}),B?n.jsxs(JY,{"aria-hidden":!0,required:f,tabIndex:-1,name:u,autoComplete:h,value:C,onChange:M=>E(M.target.value),disabled:m,form:p,children:[C===void 0?n.jsx("option",{value:""}):null,Array.from(L)]},F):null]})})};SY.displayName=Dm;var kY="SelectTrigger",EY=g.forwardRef((e,t)=>{const{__scopeSelect:r,disabled:s=!1,...a}=e,i=fC(r),o=of(kY,r),l=o.disabled||s,c=zr(t,o.onTriggerChange),d=hC(r),u=g.useRef("touch"),[h,m,f]=ZY(A=>{const v=d().filter(y=>!y.disabled),x=v.find(y=>y.value===o.value),b=eJ(v,A,x);b!==void 0&&o.onValueChange(b.value)}),p=A=>{l||(o.onOpenChange(!0),f()),A&&(o.triggerPointerDownPosRef.current={x:Math.round(A.pageX),y:Math.round(A.pageY)})};return n.jsx(Ny,{asChild:!0,...i,children:n.jsx(sr.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":XY(o.value)?"":void 0,...a,ref:c,onClick:yt(a.onClick,A=>{A.currentTarget.focus(),u.current!=="mouse"&&p(A)}),onPointerDown:yt(a.onPointerDown,A=>{u.current=A.pointerType;const v=A.target;v.hasPointerCapture(A.pointerId)&&v.releasePointerCapture(A.pointerId),A.button===0&&A.ctrlKey===!1&&A.pointerType==="mouse"&&(p(A),A.preventDefault())}),onKeyDown:yt(a.onKeyDown,A=>{const v=h.current!=="";!(A.ctrlKey||A.altKey||A.metaKey)&&A.key.length===1&&m(A.key),!(v&&A.key===" ")&&ONe.includes(A.key)&&(p(),A.preventDefault())})})})});EY.displayName=kY;var BY="SelectValue",TY=g.forwardRef((e,t)=>{const{__scopeSelect:r,className:s,style:a,children:i,placeholder:o="",...l}=e,c=of(BY,r),{onValueNodeHasChildrenChange:d}=c,u=i!==void 0,h=zr(t,c.onValueNodeChange);return co(()=>{d(u)},[d,u]),n.jsx(sr.span,{...l,ref:h,style:{pointerEvents:"none"},children:XY(c.value)?n.jsx(n.Fragment,{children:o}):i})});TY.displayName=BY;var MNe="SelectIcon",PY=g.forwardRef((e,t)=>{const{__scopeSelect:r,children:s,...a}=e;return n.jsx(sr.span,{"aria-hidden":!0,...a,ref:t,children:s||"▼"})});PY.displayName=MNe;var $Ne="SelectPortal",IY=e=>n.jsx(O_,{asChild:!0,...e});IY.displayName=$Ne;var Rm="SelectContent",OY=g.forwardRef((e,t)=>{const r=of(Rm,e.__scopeSelect),[s,a]=g.useState();if(co(()=>{a(new DocumentFragment)},[]),!r.open){const i=s;return i?rd.createPortal(n.jsx(FY,{scope:e.__scopeSelect,children:n.jsx(uC.Slot,{scope:e.__scopeSelect,children:n.jsx("div",{children:e.children})})}),i):null}return n.jsx(LY,{...e,ref:t})});OY.displayName=Rm;var dc=10,[FY,lf]=l0(Rm),QNe="SelectContentImpl",HNe=CNe("SelectContent.RemoveScroll"),LY=g.forwardRef((e,t)=>{const{__scopeSelect:r,position:s="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:i,onPointerDownOutside:o,side:l,sideOffset:c,align:d,alignOffset:u,arrowPadding:h,collisionBoundary:m,collisionPadding:f,sticky:p,hideWhenDetached:A,avoidCollisions:v,...x}=e,b=of(Rm,r),[y,w]=g.useState(null),[j,N]=g.useState(null),_=zr(t,K=>w(K)),[S,C]=g.useState(null),[E,T]=g.useState(null),B=hC(r),[L,P]=g.useState(!1),F=g.useRef(!1);g.useEffect(()=>{if(y)return HG(y)},[y]),zG();const M=g.useCallback(K=>{const[X,...ne]=B().map(W=>W.ref.current),[ae]=ne.slice(-1),J=document.activeElement;for(const W of K)if(W===J||(W==null||W.scrollIntoView({block:"nearest"}),W===X&&j&&(j.scrollTop=0),W===ae&&j&&(j.scrollTop=j.scrollHeight),W==null||W.focu
vendor: 13,713 bytes, line 1136
1136s(),document.activeElement!==J))return},[B,j]),I=g.useCallback(()=>M([S,y]),[M,S,y]);g.useEffect(()=>{L&&I()},[L,I]);const{onOpenChange:$,triggerPointerDownPosRef:V}=b;g.useEffect(()=>{if(y){let K={x:0,y:0};const X=ae=>{var J,W;K={x:Math.abs(Math.round(ae.pageX)-(((J=V.current)==null?void 0:J.x)??0)),y:Math.abs(Math.round(ae.pageY)-(((W=V.current)==null?void 0:W.y)??0))}},ne=ae=>{K.x<=10&&K.y<=10?ae.preventDefault():y.contains(ae.target)||$(!1),document.removeEventListener("pointermove",X),V.current=null};return V.current!==null&&(document.addEventListener("pointermove",X),document.addEventListener("pointerup",ne,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",X),document.removeEventListener("pointerup",ne,{capture:!0})}}},[y,$,V]),g.useEffect(()=>{const K=()=>$(!1);return window.addEventListener("blur",K),window.addEventListener("resize",K),()=>{window.removeEventListener("blur",K),window.removeEventListener("resize",K)}},[$]);const[R,Q]=ZY(K=>{const X=B().filter(J=>!J.disabled),ne=X.find(J=>J.ref.current===document.activeElement),ae=eJ(X,K,ne);ae&&setTimeout(()=>ae.ref.current.focus())}),U=g.useCallback((K,X,ne)=>{const ae=!F.current&&!ne;(b.value!==void 0&&b.value===X||ae)&&(C(K),ae&&(F.current=!0))},[b.value]),D=g.useCallback(()=>y==null?void 0:y.focus(),[y]),q=g.useCallback((K,X,ne)=>{const ae=!F.current&&!ne;(b.value!==void 0&&b.value===X||ae)&&T(K)},[b.value]),G=s==="popper"?KB:DY,Y=G===KB?{side:l,sideOffset:c,align:d,alignOffset:u,arrowPadding:h,collisionBoundary:m,collisionPadding:f,sticky:p,hideWhenDetached:A,avoidCollisions:v}:{};return n.jsx(FY,{scope:r,content:y,viewport:j,onViewportChange:N,itemRefCallback:U,selectedItem:S,onItemLeave:D,itemTextRefCallback:q,focusSelectedItem:I,selectedItemText:E,position:s,isPositioned:L,searchRef:R,children:n.jsx(VG,{as:HNe,allowPinchZoom:!0,children:n.jsx(GG,{asChild:!0,trapped:b.open,onMountAutoFocus:K=>{K.preventDefault()},onUnmountAutoFocus:yt(a,K=>{var X;(X=b.trigger)==null||X.focus({preventScroll:!0}),K.preventDefault()}),children:n.jsx(L_,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:K=>K.preventDefault(),onDismiss:()=>b.onOpenChange(!1),children:n.jsx(G,{role:"listbox",id:b.contentId,"data-state":b.open?"open":"closed",dir:b.dir,onContextMenu:K=>K.preventDefault(),...x,...Y,onPlaced:()=>P(!0),ref:_,style:{display:"flex",flexDirection:"column",outline:"none",...x.style},onKeyDown:yt(x.onKeyDown,K=>{const X=K.ctrlKey||K.altKey||K.metaKey;if(K.key==="Tab"&&K.preventDefault(),!X&&K.key.length===1&&Q(K.key),["ArrowUp","ArrowDown","Home","End"].includes(K.key)){let ae=B().filter(J=>!J.disabled).map(J=>J.ref.current);if(["ArrowUp","End"].includes(K.key)&&(ae=ae.slice().reverse()),["ArrowUp","ArrowDown"].includes(K.key)){const J=K.target,W=ae.indexOf(J);ae=ae.slice(W+1)}setTimeout(()=>M(ae)),K.preventDefault()}})})})})})})});LY.displayName=QNe;var zNe="SelectItemAlignedPosition",DY=g.forwardRef((e,t)=>{const{__scopeSelect:r,onPlaced:s,...a}=e,i=of(Rm,r),o=lf(Rm,r),[l,c]=g.useState(null),[d,u]=g.useState(null),h=zr(t,_=>u(_)),m=hC(r),f=g.useRef(!1),p=g.useRef(!0),{viewport:A,selectedItem:v,selectedItemText:x,focusSelectedItem:b}=o,y=g.useCallback(()=>{if(i.trigger&&i.valueNode&&l&&d&&A&&v&&x){const _=i.trigger.getBoundingClientRect(),S=d.getBoundingClientRect(),C=i.valueNode.getBoundingClientRect(),E=x.getBoundingClientRect();if(i.dir!=="rtl"){const J=E.left-S.left,W=C.left-J,ie=_.left-W,he=_.width+ie,ee=Math.max(he,S.width),xe=window.innerWidth-dc,we=mb(W,[dc,Math.max(dc,xe-ee)]);l.style.minWidth=he+"px",l.style.left=we+"px"}else{const J=S.right-E.right,W=window.innerWidth-C.right-J,ie=window.innerWidth-_.right-W,he=_.width+ie,ee=Math.max(he,S.width),xe=window.innerWidth-dc,we=mb(W,[dc,Math.max(dc,xe-ee)]);l.style.minWidth=he+"px",l.style.right=we+"px"}const T=m(),B=window.innerHeight-dc*2,L=A.scrollHeight,P=window.getComputedStyle(d),F=parseInt(P.borderTopWidth,10),M=parseInt(P.paddingTop,10),I=parseInt(P.borderBottomWidth,10),$=parseInt(P.paddingBottom,10),V=F+M+L+$+I,R=Math.min(v.offsetHeight*5,V),Q=window.getComputedStyle(A),U=parseInt(Q.paddingTop,10),D=parseInt(Q.paddingBottom,10),q=_.top+_.height/2-dc,G=B-q,Y=v.offsetHeight/2,K=v.offsetTop+Y,X=F+M+K,ne=V-X;if(X<=q){const J=T.length>0&&v===T[T.length-1].ref.current;l.style.bottom="0px";const W=d.clientHeight-A.offsetTop-A.offsetHeight,ie=Math.max(G,Y+(J?D:0)+W+I),he=X+ie;l.style.height=he+"px"}else{const J=T.length>0&&v===T[0].ref.current;l.style.top="0px";const ie=Math.max(q,F+A.offsetTop+(J?U:0)+Y)+ne;l.style.height=ie+"px",A.scrollTop=X-q+A.offsetTop}l.style.margin=`${dc}px 0`,l.style.minHeight=R+"px",l.style.maxHeight=B+"px",s==null||s(),requestAnimationFrame(()=>f.current=!0)}},[m,i.trigger,i.valueNode,l,d,A,v,x,i.dir,s]);co(()=>y(),[y]);const[w,j]=g.useState();co(()=>{d&&j(window.getComputedStyle(d).zIndex)},[d]);const N=g.useCallback(_=>{_&&p.current===!0&&(y(),b==null||b(),p.current=!1)},[y,b]);return n.jsx(GNe,{scope:r,contentWrapper:l,shouldExpandOnScrollRef:f,onScrollButtonChange:N,children:n.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:w},children:n.jsx(sr.div,{...a,ref:h,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});DY.displayName=zNe;var VNe="SelectPopperPosition",KB=g.forwardRef((e,t)=>{const{__scopeSelect:r,align:s="start",collisionPadding:a=dc,...i}=e,o=fC(r);return n.jsx(D_,{...o,...i,ref:t,align:s,collisionPadding:a,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});KB.displayName=VNe;var[GNe,gO]=l0(Rm,{}),WB="SelectViewport",RY=g.forwardRef((e,t)=>{const{__scopeSelect:r,nonce:s,...a}=e,i=lf(WB,r),o=gO(WB,r),l=zr(t,i.onViewportChange),c=g.useRef(0);return n.jsxs(n.Fragment,{children:[n.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),n.jsx(uC.Slot,{scope:r,children:n.jsx(sr.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:yt(a.onScroll,d=>{const u=d.currentTarget,{contentWrapper:h,shouldExpandOnScrollRef:m}=o;if(m!=null&&m.current&&h){const f=Math.abs(c.current-u.scrollTop);if(f>0){const p=window.innerHeight-dc*2,A=parseFloat(h.style.minHeight),v=parseFloat(h.style.height),x=Math.max(A,v);if(x<p){const b=x+f,y=Math.min(p,b),w=b-y;h.style.height=y+"px",h.style.bottom==="0px"&&(u.scrollTop=w>0?w:0,h.style.justifyContent="flex-end")}}}c.current=u.scrollTop})})})]})});RY.displayName=WB;var UY="SelectGroup",[qNe,KNe]=l0(UY),WNe=g.forwardRef((e,t)=>{const{__scopeSelect:r,...s}=e,a=tf();return n.jsx(qNe,{scope:r,id:a,children:n.jsx(sr.div,{role:"group","aria-labelledby":a,...s,ref:t})})});WNe.displayName=UY;var MY="SelectLabel",$Y=g.forwardRef((e,t)=>{const{__scopeSelect:r,...s}=e,a=KNe(MY,r);return n.jsx(sr.div,{id:a.id,...s,ref:t})});$Y.displayName=MY;var P2="SelectItem",[YNe,QY]=l0(P2),HY=g.forwardRef((e,t)=>{const{__scopeSelect:r,value:s,disabled:a=!1,textValue:i,...o}=e,l=of(P2,r),c=lf(P2,r),d=l.value===s,[u,h]=g.useState(i??""),[m,f]=g.useState(!1),p=zr(t,b=>{var y;return(y=c.itemRefCallback)==null?void 0:y.call(c,b,s,a)}),A=tf(),v=g.useRef("touch"),x=()=>{a||(l.onValueChange(s),l.onOpenChange(!1))};if(s==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return n.jsx(YNe,{scope:r,value:s,disabled:a,textId:A,isSelected:d,onItemTextChange:g.useCallback(b=>{h(y=>y||((b==null?void 0:b.textContent)??"").trim())},[]),children:n.jsx(uC.ItemSlot,{scope:r,value:s,disabled:a,textValue:u,children:n.jsx(sr.div,{role:"option","aria-labelledby":A,"data-highlighted":m?"":void 0,"aria-selected":d&&m,"data-state":d?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...o,ref:p,onFocus:yt(o.onFocus,()=>f(!0)),onBlur:yt(o.onBlur,()=>f(!1)),onClick:yt(o.onClick,()=>{v.current!=="mouse"&&x()}),onPointerUp:yt(o.onPointerUp,()=>{v.current==="mouse"&&x()}),onPointerDown:yt(o.onPointerDown,b=>{v.current=b.pointerType}),onPointerMove:yt(o.onPointerMove,b=>{var y;v.current=b.pointerType,a?(y=c.onItemLeave)==null||y.call(c):v.current==="mouse"&&b.currentTarget.focus({preventScroll:!0})}),onPointerLeave:yt(o.onPointerLeave,b=>{var y;b.currentTarget===document.activeElement&&((y=c.onItemLeave)==null||y.call(c))}),onKeyDown:yt(o.onKeyDown,b=>{var w;((w=c.searchRef)==null?void 0:w.current)!==""&&b.key===" "||(FNe.includes(b.key)&&x(),b.key===" "&&b.preventDefault())})})})})});HY.displayName=P2;var Wx="SelectItemText",zY=g.forwardRef((e,t)=>{const{__scopeSelect:r,className:s,style:a,...i}=e,o=of(Wx,r),l=lf(Wx,r),c=QY(Wx,r),d=UNe(Wx,r),[u,h]=g.useState(null),m=zr(t,x=>h(x),c.onItemTextChange,x=>{var b;return(b=l.itemTextRefCallback)==null?void 0:b.call(l,x,c.value,c.disabled)}),f=u==null?void 0:u.textContent,p=g.useMemo(()=>n.jsx("option",{value:c.value,disabled:c.disabled,children:f},c.value),[c.disabled,c.value,f]),{onNativeOptionAdd:A,onNativeOptionRemove:v}=d;return co(()=>(A(p),()=>v(p)),[A,v,p]),n.jsxs(n.Fragment,{children:[n.jsx(sr.span,{id:c.textId,...i,ref:m}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?rd.createPortal(i.children,o.valueNode):null]})});zY.displayName=Wx;var VY="SelectItemIndicator",GY=g.forwardRef((e,t)=>{const{__scopeSelect:r,...s}=e;return QY(VY,r).isSelected?n.jsx(sr.span,{"aria-hidden":!0,...s,ref:t}):null});GY.displayName=VY;var YB="SelectScrollUpButton",qY=g.forwardRef((e,t)=>{const r=lf(YB,e.__scopeSelect),s=gO(YB,e.__scopeSelect),[a,i]=g.useState(!1),o=zr(t,s.onScrollButtonChange);return co(()=>{if(r.viewport&&r.isPositioned){let l=function(){const d=c.scrollTop>0;i(d)};const c=r.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[r.viewport,r.isPositioned]),a?n.jsx(WY,{...e,ref:o,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=r;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});qY.displayName=YB;var JB="SelectScrollDownButton",KY=g.forwardRef((e,t)=>{const r=lf(JB,e.__scopeSelect),s=gO(JB,e.__scopeSelect),[a,i]=g.useState(!1),o=zr(t,s.onScrollButtonChange);return co(()=>{if(r.viewport&&r.isPositioned){let l=function(){const d=c.scrollHeight-c.clientHeight,u=Math.ceil(c.scrollTop)<d;i(u)};const c=r.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[r.viewport,r.isPositioned]),a?n.jsx(WY,{...e,ref:o,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=r;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});KY.displayName=JB;var WY=g.forwardRef((e,t)=>{const{__scopeSelect:r,onAutoScroll:s,...a}=e,i=lf("SelectScrollButton",r),o=g.useRef(null),l=hC(r),c=g.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return g.useEffect(()=>()=>c(),[c]),co(()=>{var u;const d=l().find(h=>h.ref.current===document.activeElement);(u=d==null?void 0:d.ref.current)==null||u.scrollIntoView({block:"nearest"})},[l]),n.jsx(sr.div,{"aria-hidden":!0,...a,ref:t,style:{flexShrink:0,...a.style},onPointerDown:yt(a.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(s,50))}),onPointerMove:yt(a.onPointerMove,()=>{var d;(d=i.onItemLeave)==null||d.call(i),o.current===null&&(o.current=window.setInterval(s,50))}),onPointerLeave:yt(a.onPointerLeave,()=>{c()})})}),JNe="SelectSeparator",YY=g.forwardRef((e,t)=>{const{__scopeSelect:r,...s}=e;return n.jsx(sr.div,{"aria-hidden":!0,...s,ref:t})});YY.displayName=JNe;var XB="SelectArrow",XNe=g.forwardRef((e,t)=>{const{__scopeSelect:r,...s}=e,a=fC(r),i=of(XB,r),o=lf(XB,r);return i.open&&o.position==="popper"?n.jsx(U_,{...a,...s,ref:t}):null});XNe.displayName=XB;var ZNe="SelectBubbleInput",JY=g.forwardRef(({__scopeSelect:e,value:t,...r},s)=>{const a=g.useRef(null),i=zr(s,a),o=Fy(t);return g.useEffect(()=>{const l=a.current;if(!l)return;const c=window.HTMLSelectElement.prototype,u=Object.getOwnPropertyDescriptor(c,"value").set;if(o!==t&&u){const h=new Event("change",{bubbles:!0});u.call(l,t),l.dispatchEvent(h)}},[o,t]),n.jsx(sr.select,{...r,style:{...CY,...r.style},ref:i,defaultValue:t})});JY.displayName=ZNe;function XY(e){return e===""||e===void 0}function ZY(e){const t=$o(e),r=g.useRef(""),s=g.useRef(0),a=g.useCallback(o=>{const l=r.current+o;t(l),function c(d){r.current=d,window.clearTimeout(s.current),d!==""&&(s.current=window.setTimeout(()=>c(""),1e3))}(l)},[t]),i=g.useCallback(()=>{r.current="",window.clearTimeout(s.current)},[]);return g.useEffect(()=>()=>window.clearTimeout(s.current),[]),[r,a,i]}function eJ(e,t,r){const a=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,i=r?e.indexOf(r):-1;let o=e_e(e,Math.max(i,0));a.length===1&&(o=o.filter(d=>d!==r));const c=o.find(d=>d.textValue.toLowerCase().startsWith(a.toLowerCase()));return c!==r?c:void 0}function e_e(e,t){return e.map((r,s)=>e[(t+s)%e.length])}var t_e=SY,tJ=EY,r_e=TY,n_e=PY,s_e=IY,rJ=OY,a_e=RY,nJ=$Y,sJ=HY,i_e=zY,o_e=GY,aJ=qY,iJ=KY,oJ=YY;const ur=t_e,hr=r_e,or=g.forwardRef(({className:e,children:t,...r},s)=>n.jsxs(tJ,{ref:s,className:ye("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm r
1136ing-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...r,children:[t,n.jsx(n_e,{asChild:!0,children:n.jsx(Un,{className:"h-4 w-4 opacity-50"})})]}));or.displayName=tJ.displayName;const lJ=g.forwardRef(({className:e,...t},r)=>n.jsx(aJ,{ref:r,className:ye("flex cursor-default items-center justify-center py-1",e),...t,children:n.jsx(Fu,{className:"h-4 w-4"})}));lJ.displayName=aJ.displayName;const cJ=g.forwardRef(({className:e,...t},r)=>n.jsx(iJ,{ref:r,className:ye("flex cursor-default items-center justify-center py-1",e),...t,children:n.jsx(Un,{className:"h-4 w-4"})}));cJ.displayName=iJ.displayName;const lr=g.forwardRef(({className:e,children:t,position:r="popper",...s},a)=>n.jsx(s_e,{children:n.jsxs(rJ,{ref:a,className:ye("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover 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",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,...s,children:[n.jsx(lJ,{}),n.jsx(a_e,{className:ye("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),n.jsx(cJ,{})]})}));lr.displayName=rJ.displayName;const l_e=g.forwardRef(({className:e,...t},r)=>n.jsx(nJ,{ref:r,className:ye("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));l_e.displayName=nJ.displayName;const Fe=g.forwardRef(({className:e,children:t,...r},s)=>n.jsxs(sJ,{ref:s,className:ye("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[n.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:n.jsx(o_e,{children:n.jsx(Gn,{className:"h-4 w-4"})})}),n.jsx(i_e,{children:t})]}));Fe.displayName=sJ.displayName;const c_e=g.forwardRef(({className:e,...t},r)=>n.jsx(oJ,{ref:r,className:ye("-mx-1 my-1 h-px bg-muted",e),...t}));c_e.displayName=oJ.displayName;const I2="/assets/convergence_background-BexvXJwQ.png";function d_e({convergence:e}){const t=xr(),{toast:r}=sn(),[s,a]=g.useState(!1),[i,o]=g.useState(e.status),l=["Used","Unused","Unranked","Archived"],c=async p=>{if(!(!e||s))try{a(!0);const{error:A}=await de.from("convergences").update({status:p}).eq("id",e.id);if(A)throw A;o(p),r({title:"Status Updated",description:`Convergence status changed to ${p}`})}catch(A){console.error("Error updating convergence status:",A),r({title:"Error",description:"Failed to update convergence status",variant:"destructive"})}finally{a(!1)}},d=new Date,u=e.expiration_date?new Date(e.expiration_date):null,h=u&&u<=d,m=u?Math.ceil((u.getTime()-d.getTime())/(1e3*60*60*24)):0,f=()=>{if(!u)return null;if(h){const p=Math.abs(m);return`Expired ${p===1?"1 day":`${p} days`} ago`}else return m===0?"Expires today":m===1?"Expires tomorrow":`Expires in ${m} days`};return n.jsxs("div",{className:"group relative bg-white rounded-xl border border-gray-200 shadow-sm hover:shadow-lg transition-all duration-300 overflow-hidden flex flex-col h-full",children:[n.jsxs("div",{className:"relative h-52 overflow-hidden bg-gray-100 cursor-pointer",onClick:()=>t(`/convergences/${e.id}`),children:[n.jsx("img",{src:e.image_url||I2,alt:e.name,className:"w-full h-full object-cover transition-transform duration-300 group-hover:scale-105",onError:p=>{p.currentTarget.src=I2}}),n.jsx("div",{className:"absolute top-4 left-4",onClick:p=>p.stopPropagation(),children:n.jsxs(ur,{value:i,onValueChange:c,disabled:s,children:[n.jsx(or,{className:`h-auto w-auto border-0 font-medium text-xs px-2.5 py-1 ${i==="Used"?"bg-green-500 text-white hover:bg-green-600":i==="Archived"?"bg-gray-500 text-white hover:bg-gray-600":"bg-blue-500 text-white hover:bg-blue-600"}`,children:n.jsx(hr,{})}),n.jsx(lr,{children:l.map(p=>n.jsx(Fe,{value:p,className:"text-xs",children:p},p))})]})}),u&&n.jsx("div",{className:"absolute top-4 right-4",children:n.jsxs("div",{className:`flex items-center gap-1 px-2 py-1 rounded-md bg-black/50 backdrop-blur-sm text-xs ${h?"text-red-400":m<=3?"text-orange-400":"text-white"}`,children:[n.jsx(Vr,{className:"h-3 w-3"}),n.jsx("span",{className:"font-medium",children:f()})]})})]}),n.jsxs("div",{className:"flex-1 p-5 space-y-4 flex flex-col",children:[n.jsxs("div",{className:"flex-1",children:[n.jsx("h3",{className:"font-bold text-lg text-gray-900 mb-2 line-clamp-2 group-hover:text-blue-600 transition-colors cursor-pointer",onClick:()=>t(`/convergences/${e.id}`),children:e.name}),n.jsx("p",{className:"text-sm text-gray-600 line-clamp-2",children:e.trend_description||e.convergence||e.trend})]}),n.jsxs("div",{className:"py-3 border-t border-gray-100",children:[n.jsxs("div",{className:"flex items-center justify-between mb-3",children:[n.jsx("span",{className:"text-sm font-medium text-gray-700",children:"Power Score"}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx(sa,{className:"h-4 w-4 text-blue-600"}),n.jsx("span",{className:"text-2xl font-bold text-blue-600",children:(e.power_score||0).toFixed(1)})]})]}),n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsxs("div",{className:"text-center",children:[n.jsx("div",{className:"text-lg font-bold text-purple-600",children:(e.virality_score||0).toFixed(1)}),n.jsx("div",{className:"text-xs text-gray-500",children:"Virality"})]}),n.jsxs("div",{className:"text-center",children:[n.jsx("div",{className:"text-lg font-bold text-blue-600",children:(e.relevance_score||0).toFixed(1)}),n.jsx("div",{className:"text-xs text-gray-500",children:"Relevance"})]}),n.jsxs("div",{className:"text-center",children:[n.jsx("div",{className:"text-lg font-bold text-green-600",children:(e.interest_to_audie
vendor: 6,949 bytes, line 1136
1136nce_score||0).toFixed(1)}),n.jsx("div",{className:"text-xs text-gray-500",children:"Interest"})]}),n.jsxs("div",{className:"text-center",children:[n.jsx("div",{className:"text-lg font-bold text-orange-600",children:(e.crossover_potential_score||0).toFixed(1)}),n.jsx("div",{className:"text-xs text-gray-500",children:"Crossover"})]})]})]}),n.jsxs("div",{className:"text-xs text-gray-400 pt-3 border-t border-gray-100",children:["Created ",new Date(e.created_at).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})]}),n.jsx("div",{className:"pt-2",children:n.jsx(te,{size:"sm",className:"w-full bg-blue-600 hover:bg-blue-700 text-white transition-colors",onClick:()=>t(`/convergences/${e.id}`),children:"View"})})]})]})}var u_e=Symbol("radix.slottable");function h_e(e){const t=({children:r})=>n.jsx(n.Fragment,{children:r});return t.displayName=`${e}.Slottable`,t.__radixId=u_e,t}var[mC]=Ki("Tooltip",[rf]),pC=rf(),dJ="TooltipProvider",f_e=700,ZB="tooltip.open",[m_e,xO]=mC(dJ),uJ=e=>{const{__scopeTooltip:t,delayDuration:r=f_e,skipDelayDuration:s=300,disableHoverableContent:a=!1,children:i}=e,o=g.useRef(!0),l=g.useRef(!1),c=g.useRef(0);return g.useEffect(()=>{const d=c.current;return()=>window.clearTimeout(d)},[]),n.jsx(m_e,{scope:t,isOpenDelayedRef:o,delayDuration:r,onOpen:g.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:g.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,s)},[s]),isPointerInTransitRef:l,onPointerInTransitChange:g.useCallback(d=>{l.current=d},[]),disableHoverableContent:a,children:i})};uJ.displayName=dJ;var pb="Tooltip",[p_e,AC]=mC(pb),hJ=e=>{const{__scopeTooltip:t,children:r,open:s,defaultOpen:a,onOpenChange:i,disableHoverableContent:o,delayDuration:l}=e,c=xO(pb,e.__scopeTooltip),d=pC(t),[u,h]=g.useState(null),m=tf(),f=g.useRef(0),p=o??c.disableHoverableContent,A=l??c.delayDuration,v=g.useRef(!1),[x,b]=lo({prop:s,defaultProp:a??!1,onChange:_=>{_?(c.onOpen(),document.dispatchEvent(new CustomEvent(ZB))):c.onClose(),i==null||i(_)},caller:pb}),y=g.useMemo(()=>x?v.current?"delayed-open":"instant-open":"closed",[x]),w=g.useCallback(()=>{window.clearTimeout(f.current),f.current=0,v.current=!1,b(!0)},[b]),j=g.useCallback(()=>{window.clearTimeout(f.current),f.current=0,b(!1)},[b]),N=g.useCallback(()=>{window.clearTimeout(f.current),f.current=window.setTimeout(()=>{v.current=!0,b(!0),f.current=0},A)},[A,b]);return g.useEffect(()=>()=>{f.current&&(window.clearTimeout(f.current),f.current=0)},[]),n.jsx(R_,{...d,children:n.jsx(p_e,{scope:t,contentId:m,open:x,stateAttribute:y,trigger:u,onTriggerChange:h,onTriggerEnter:g.useCallback(()=>{c.isOpenDelayedRef.current?N():w()},[c.isOpenDelayedRef,N,w]),onTriggerLeave:g.useCallback(()=>{p?j():(window.clearTimeout(f.current),f.current=0)},[j,p]),onOpen:w,onClose:j,disableHoverableContent:p,children:r})})};hJ.displayName=pb;var eT="TooltipTrigger",fJ=g.forwardRef((e,t)=>{const{__scopeTooltip:r,...s}=e,a=AC(eT,r),i=xO(eT,r),o=pC(r),l=g.useRef(null),c=zr(t,l,a.onTriggerChange),d=g.useRef(!1),u=g.useRef(!1),h=g.useCallback(()=>d.current=!1,[]);return g.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),n.jsx(Ny,{asChild:!0,...o,children:n.jsx(sr.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...s,ref:c,onPointerMove:yt(e.onPointerMove,m=>{m.pointerType!=="touch"&&!u.current&&!i.isPointerInTransitRef.current&&(a.onTriggerEnter(),u.current=!0)}),onPointerLeave:yt(e.onPointerLeave,()=>{a.onTriggerLeave(),u.current=!1}),onPointerDown:yt(e.onPointerDown,()=>{a.open&&a.onClose(),d.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:yt(e.onFocus,()=>{d.current||a.onOpen()}),onBlur:yt(e.onBlur,a.onClose),onClick:yt(e.onClick,a.onClose)})})});fJ.displayName=eT;var A_e="TooltipPortal",[L1t,g_e]=mC(A_e,{forceMount:void 0}),fg="TooltipContent",mJ=g.forwardRef((e,t)=>{const r=g_e(fg,e.__scopeTooltip),{forceMount:s=r.forceMount,side:a="top",...i}=e,o=AC(fg,e.__scopeTooltip);return n.jsx(xo,{present:s||o.open,children:o.disableHoverableContent?n.jsx(pJ,{side:a,...i,ref:t}):n.jsx(x_e,{side:a,...i,ref:t})})}),x_e=g.forwardRef((e,t)=>{const r=AC(fg,e.__scopeTooltip),s=xO(fg,e.__scopeTooltip),a=g.useRef(null),i=zr(t,a),[o,l]=g.useState(null),{trigger:c,onClose:d}=r,u=a.current,{onPointerInTransitChange:h}=s,m=g.useCallback(()=>{l(null),h(!1)},[h]),f=g.useCallback((p,A)=>{const v=p.currentTarget,x={x:p.clientX,y:p.clientY},b=j_e(x,v.getBoundingClientRect()),y=N_e(x,b),w=__e(A.getBoundingClientRect()),j=S_e([...y,...w]);l(j),h(!0)},[h]);return g.useEffect(()=>()=>m(),[m]),g.useEffect(()=>{if(c&&u){const p=v=>f(v,u),A=v=>f(v,c);return c.addEventListener("pointerleave",p),u.addEventListener("pointerleave",A),()=>{c.removeEventListener("pointerleave",p),u.removeEventListener("pointerleave",A)}}},[c,u,f,m]),g.useEffect(()=>{if(o){const p=A=>{const v=A.target,x={x:A.clientX,y:A.clientY},b=(c==null?void 0:c.contains(v))||(u==null?void 0:u.contains(v)),y=!C_e(x,o);b?m():y&&(m(),d())};return document.addEventListener("pointermove",p),()=>document.removeEventListener("pointermove",p)}},[c,u,o,d,m]),n.jsx(pJ,{...e,ref:i})}),[v_e,b_e]=mC(pb,{isInside:!1}),y_e=h_e("TooltipContent"),pJ=g.forwardRef((e,t)=>{const{__scopeTooltip:r,children:s,"aria-label":a,onEscapeKeyDown:i,onPointerDownOutside:o,...l}=e,c=AC(fg,r),d=pC(r),{onClose:u}=c;return g.useEffect(()=>(document.addEventListener(ZB,u),()=>document.removeEventListener(ZB,u)),[u]),g.useEffect(()=>{if(c.trigger){const h=m=>{const f=m.target;f!=null&&f.contains(c.trigger)&&u()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[c.trigger,u]),n.jsx(L_,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:h=>h.preventDefault(),onDismiss:u,children:n.jsxs(D_,{"data-state":c.stateAttribute,...d,...l,ref:t,style:{...l.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[n.jsx(y_e,{children:s}),n.jsx(v_e,{scope:r,isInside:!0,children:n.jsx(INe,{id:c.contentId,role:"tooltip",children:a||s})})]})})});mJ.displayName=fg;var AJ="TooltipArrow",w_e=g.forwardRef((e,t)=>{const{__scopeTooltip:r,...s}=e,a=pC(r);return b_e(AJ,r).isInside?null:n.jsx(U_,{...a,...s,ref:t})});w_e.displayName=AJ;function j_e(e,t){const r=Math.abs(t.top-e.y),s=Math.abs(t.bottom-e.y),a=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(r,s,a,i)){case i:return"left";case a:return"right";case r:return"top";case s:return"bottom";default:throw new Error("unreachable")}}function N_e(e,t,r=5){const s=[];
1136switch(t){case"top":s.push({x:e.x-r,y:e.y+r},{x:e.x+r,y:e.y+r});break;case"bottom":s.push({x:e.x-r,y:e.y-r},{x:e.x+r,y:e.y-r});break;case"left":s.push({x:e.x+r,y:e.y-r},{x:e.x+r,y:e.y+r});break;case"right":s.push({x:e.x-r,y:e.y-r},{x:e.x-r,y:e.y+r});break}return s}function __e(e){const{top:t,right:r,bottom:s,left:a}=e;return[{x:a,y:t},{x:r,y:t},{x:r,y:s},{x:a,y:s}]}function C_e(e,t){const{x:r,y:s}=e;let a=!1;for(let i=0,o=t.length-1;i<t.length;o=i++){const l=t[i],c=t[o],d=l.x,u=l.y,h=c.x,m=c.y;u>s!=m>s&&r<(h-d)*(s-u)/(m-u)+d&&(a=!a)}return a}function S_e(e){const t=e.slice();return t.sort((r,s)=>r.x<s.x?-1:r.x>s.x?1:r.y<s.y?-1:r.y>s.y?1:0),k_e(t)}function k_e(e){if(e.length<=1)return e.slice();const t=[];for(let s=0;s<e.length;s++){const a=e[s];for(;t.length>=2;){const i=t[t.length-1],o=t[t.length-2];if((i.x-o.x)*(a.y-o.y)>=(i.y-o.y)*(a.x-o.x))t.pop();else break}t.push(a)}t.pop();const r=[];for(let s=e.length-1;s>=0;s--){const a=e[s];for(;r.length>=2;){const i=r[r.length-1],o=r[r.length-2];if((i.x-o.x)*(a.y-o.y)>=(i.y-o.y)*(a.x-o.x))r.pop();else break}r.push(a)}return r.pop(),t.length===1&&r.length===1&&t[0].x===r[0].x&&t[0].y===r[0].y?t:t.concat(r)}var E_e=uJ,B_e=hJ,T_e=fJ,gJ=mJ;const Ya=E_e,Hs=B_e,zs=T_e,Vn=g.forwardRef(({className:e,sideOffset:t=4,...r},s)=>n.jsx(gJ,{ref:s,sideOffset:t,className:ye("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md 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",e),...r}));Vn.displayName=gJ.displayName;function P_e({onFilterChange:e,onExpirationChange:t,onSortChange:r,onClearFilters:s,loading:a=!1,currentFilter:i,currentExpiration:o="fresh",currentSort:l}){return n.jsx(Ya,{children:n.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[n.jsxs(ur,{value:i,onValueChange:e,disabled:a,children:[n.jsxs(or,{className:"w-full sm:w-[160px] h-12 bg-white/50 border-white/50 focus:bg-white/70 transition-colors",children:[n.jsx(IA,{className:"h-4 w-4 mr-2"}),n.jsx(hr,{placeholder:"Filter by status"})]}),n.jsxs(lr,{children:[n.jsx(Fe,{value:"all",children:"All Statuses"}),n.jsx(Fe,{value:"Unused",children:"Unused"}),n.jsx(Fe,{value:"Used",children:"Used"}),n.jsx(Fe,{value:"Unranked",children:"Unranked"}),n.jsx(Fe,{value:"Archived",children:"Archived"})]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs(ur,{value:o,onValueChange:t,disabled:a,children:[n.jsxs(or,{className:"w-full sm:w-[140px] h-12 bg-white/50 border-white/50 focus:bg-white/70 transition-colors",children:[n.jsx(Vr,{className:"h-4 w-4 mr-2"}),n.jsx(hr,{placeholder:"Expiration"})]}),n.jsxs(lr,{children:[n.jsx(Fe,{value:"fresh",children:"Fresh"}),n.jsx(Fe,{value:"expired",children:"Expired"}),n.jsx(Fe,{value:"all",children:"All"})]})]}),n.jsxs(Hs,{children:[n.jsx(zs,{asChild:!0,children:n.jsx(te,{variant:"ghost",size:"icon",className:"h-8 w-8 bg-white/30 hover:bg-white/50 transition-colors",disabled:!0,children:n.jsx(qi,{className:"h-4 w-4 text-blue-600"})})}),n.jsx(Vn,{className:"max-w-xs",children:n.jsx("p",{className:"text-sm",children:"The system analyzes the lifespan of each trend or news item and automatically expires convergences once they are likely to be out of the news or hype cycle."})})]})]}),n.jsxs(ur,{value:l,onValueChange:r,disabled:a,children:[n.jsxs(or,{className:"w-full sm:w-[180px] h-12 bg-white/50 border-white/50 focus:bg-white/70 transition-colors",children:[n.jsx(ju,{className:"h-4 w-4 mr-2"}),n.jsx(hr,{placeholder:"Sort by"})]}),n.jsxs(lr,{children:[n.jsx(Fe,{value:"most-recent",children:"Most Recent"}),n.jsx(Fe,{value:"virality",children:"Highest Virality"}),n.jsx(Fe,{value:"relevance",children:"Highest Relevance"}),n.jsx(Fe,{value:"power",children:"Highest Power"})]})]}),n.jsxs(te,{variant:"outline",size:"sm",onClick:s,disabled:a||i==="all"&&o==="fresh"&&l==="most-recent",className:"h-12 px-4 bg-white/50 border-white/50 hover:bg-white/70 transition-colors",children:[n.jsx(kr,{className:"h-4 w-4 mr-2"}),"Clear Filters"]})]})})}function ep(){const{brands:e}=mn();return e.length===0?n.jsx("div",{className:"flex items-center justify-center h-full",children:n.jsxs("div",{className:"text-center max-w-md mx-auto p-6",children:[n.jsx("h2",{className:"text-2xl font-semibold text-gray-700",children:"No Brands Configured"}),n.jsx("p",{className:"text-gray-500 mt-3 mb-6",children:"To get started, you'll need to set up your first brand. This will allow you to manage campaigns, content, and use our AI tools."}),n.jsx(Ir,{to:"/onboarding",children:n.jsxs(te,{className:"gap-2",children:[n.jsx(La,{className:"h-5 w-5"}),"Set up your brand"]})})]})}):n.jsx("div",{className:"flex items-center justify-center h-full",children:n.jsxs("div",{className:"text-center",children:[n.jsx("h2",{className:"text-xl font-semibold text-gray-700",children:"No Brand Selected"}),n.jsx("p",{className:"text-gray-500 mt-2",children:"Please select a brand from the sidebar to view the dashboard"})]})})}var gC="Checkbox",[I_e]=Ki(gC),[O_e,vO]=I_e(gC);function F_e(e){const{__scopeCheckbox:t,checked:r,children:s,defaultChecked:a,disabled:i,form:o,name:l,onCheckedChange:c,required:d,value:u="on",internal_do_not_use_render:h}=e,[m,f]=lo({prop:r,defaultProp:a??!1,onChange:c,caller:gC}),[p,A]=g.useState(null),[v,x]=g.useState(null),b=g.useRef(!1),y=p?!!o||
vendor: 5,907 bytes, lines 1136-1144
1136!!p.closest("form"):!0,w={checked:m,disabled:i,setChecked:f,control:p,setControl:A,name:l,form:o,value:u,hasConsumerStoppedPropagationRef:b,required:d,defaultChecked:Lh(a)?!1:a,isFormControl:y,bubbleInput:v,setBubbleInput:x};return n.jsx(O_e,{scope:t,...w,children:L_e(h)?h(w):s})}var xJ="CheckboxTrigger",vJ=g.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:r,...s},a)=>{const{control:i,value:o,disabled:l,checked:c,required:d,setControl:u,setChecked:h,hasConsumerStoppedPropagationRef:m,isFormControl:f,bubbleInput:p}=vO(xJ,e),A=zr(a,u),v=g.useRef(c);return g.useEffect(()=>{const x=i==null?void 0:i.form;if(x){const b=()=>h(v.current);return x.addEventListener("reset",b),()=>x.removeEventListener("reset",b)}},[i,h]),n.jsx(sr.button,{type:"button",role:"checkbox","aria-checked":Lh(c)?"mixed":c,"aria-required":d,"data-state":NJ(c),"data-disabled":l?"":void 0,disabled:l,value:o,...s,ref:A,onKeyDown:yt(t,x=>{x.key==="Enter"&&x.preventDefault()}),onClick:yt(r,x=>{h(b=>Lh(b)?!0:!b),p&&f&&(m.current=x.isPropagationStopped(),m.current||x.stopPropagation())})})});vJ.displayName=xJ;var bO=g.forwardRef((e,t)=>{const{__scopeCheckbox:r,name:s,checked:a,defaultChecked:i,required:o,disabled:l,value:c,onCheckedChange:d,form:u,...h}=e;return n.jsx(F_e,{__scopeCheckbox:r,checked:a,defaultChecked:i,disabled:l,required:o,onCheckedChange:d,name:s,form:u,value:c,internal_do_not_use_render:({isFormControl:m})=>n.jsxs(n.Fragment,{children:[n.jsx(vJ,{...h,ref:t,__scopeCheckbox:r}),m&&n.jsx(jJ,{__scopeCheckbox:r})]})})});bO.displayName=gC;var bJ="CheckboxIndicator",yJ=g.forwardRef((e,t)=>{const{__scopeCheckbox:r,forceMount:s,...a}=e,i=vO(bJ,r);return n.jsx(xo,{present:s||Lh(i.checked)||i.checked===!0,children:n.jsx(sr.span,{"data-state":NJ(i.checked),"data-disabled":i.disabled?"":void 0,...a,ref:t,style:{pointerEvents:"none",...e.style}})})});yJ.displayName=bJ;var wJ="CheckboxBubbleInput",jJ=g.forwardRef(({__scopeCheckbox:e,...t},r)=>{const{control:s,hasConsumerStoppedPropagationRef:a,checked:i,defaultChecked:o,required:l,disabled:c,name:d,value:u,form:h,bubbleInput:m,setBubbleInput:f}=vO(wJ,e),p=zr(r,f),A=Fy(i),v=I_(s);g.useEffect(()=>{const b=m;if(!b)return;const y=window.HTMLInputElement.prototype,j=Object.getOwnPropertyDescriptor(y,"checked").set,N=!a.current;if(A!==i&&j){const _=new Event("click",{bubbles:N});b.indeterminate=Lh(i),j.call(b,Lh(i)?!1:i),b.dispatchEvent(_)}},[m,A,i,a]);const x=g.useRef(Lh(i)?!1:i);return n.jsx(sr.input,{type:"checkbox","aria-hidden":!0,defaultChecked:o??x.current,required:l,disabled:c,name:d,value:u,form:h,...t,tabIndex:-1,ref:p,style:{...t.style,...v,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});jJ.displayName=wJ;function L_e(e){return typeof e=="function"}function Lh(e){return e==="indeterminate"}function NJ(e){return Lh(e)?"indeterminate":e?"checked":"unchecked"}var _J={exports:{}},CJ={};/**
1137 * @license React
1138 * use-sync-external-store-shim.production.js
1139 *
1140 * Copyright (c) Meta Platforms, Inc. and affiliates.
1141 *
1142 * This source code is licensed under the MIT license found in the
1143 * LICENSE file in the root directory of this source tree.
1144 */var mg=g;function D_e(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var R_e=typeof Object.is=="function"?Object.is:D_e,U_e=mg.useState,M_e=mg.useEffect,$_e=mg.useLayoutEffect,Q_e=mg.useDebugValue;function H_e(e,t){var r=t(),s=U_e({inst:{value:r,getSnapshot:t}}),a=s[0].inst,i=s[1];return $_e(function(){a.value=r,a.getSnapshot=t,F5(a)&&i({inst:a})},[e,r,t]),M_e(function(){return F5(a)&&i({inst:a}),e(function(){F5(a)&&i({inst:a})})},[e]),Q_e(r),r}function F5(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!R_e(e,r)}catch{return!0}}function z_e(e,t){return t()}var V_e=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?z_e:H_e;CJ.useSyncExternalStore=mg.useSyncExternalStore!==void 0?mg.useSyncExternalStore:V_e;_J.exports=CJ;var G_e=_J.exports;const Xo=g.forwardRef(({className:e,...t},r)=>n.jsx(bO,{ref:r,className:ye("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:n.jsx(yJ,{className:ye("flex items-center justify-center text-current"),children:n.jsx(Gn,{className:"h-4 w-4"})})}));Xo.displayName=bO.displayName;var q_e=Symbol.for("react.lazy"),O2=Qv[" use ".trim().toString()];function K_e(e){return typeof e=="object"&&e!==null&&"then"in e}function SJ(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===q_e&&"_payload"in e&&K_e(e._payload)}function Ly(e){const t=W_e(e),r=g.forwardRef((s,a)=>{let{children:i,...o}=s;SJ(i)&&typeof O2=="function"&&(i=O2(i._payload));const l=g.Children.toArray(i),c=l.find(J_e);if(c){const d=c.props.children,u=l.map(h=>h===c?g.Children.count(d)>1?g.Children.only(null):g.isValidElement(d)?d.props.children:null:h);return n.jsx(t,{...o,ref:a,children:g.isValidElement(d)?g.cloneElement(d,void 0,u):null})}return n.jsx(t,{...o,ref:a,children:i})});return r.displayName=`${e}.Slot`,r}var tp=Ly("Slot");function W_e(e){const t=g.forwardRef((r,s)=>{let{children:a,...i}=r;if(SJ(a)&&typeof O2=="function"&&(a=O2(a._payload)),g.isValidElement(a)){const o=Z_e(a),l=X_e(i,a.props);return a.type!==g.Fragment&&(l.ref=s?fI(s,o):o),g.cloneElement(a,l)}return g.Children.count(a)>1?g.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Y_e=Symbol("radix.slottable");function J_e(e){return g.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Y_e}function X_e(e,t){const r={...t};for(const s in t){const a=e[s],i=t[s];/^on[A-Z]/.test(s)?a&&i?r[s]=(...l)=>{const c=i(...l);return a(...l),c}:a&&(r[s]=a):s==="style"?r[s]={...a,...i}
1144:s==="className"&&(r[s]=[a,i].filter(Boolean).join(" "))}return{...e,...r}}function Z_e(e){var s,a;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var eCe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],tCe=eCe.reduce((e,t)=>{const r=Ly(`Primitive.${t}`),s=g.forwardRef((a,i)=>{const{asChild:o,...l}=a,c=o?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),n.jsx(c,{...l,ref:i})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{}),rCe="Label",kJ=g.forwardRef((e,t)=>n.jsx(tCe.label,{...e,ref:t,onMouseDown:r=>{var a;r.target.closest("button, input, select, textarea")||((a=e.onMouseDown)==null||a.call(e,r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));kJ.displayName=rCe;var EJ=kJ;const nCe=Jm("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),ze=g.forwardRef(({className:e,...t},r)=>n.jsx(EJ,{ref:r,className:ye(nCe(),e),...t}));ze.displayName=EJ.displayName;const xC=({className:e,...t})=>n.jsx("nav",{role:"navigation","aria-label":"pagination",className:ye("mx-auto flex w-full justify-center",e),...t});xC.displayName="Pagination";const vC=g.forwardRef(({className:e,...t},r)=>n.jsx("ul",{ref:r,className:ye("flex flex-row items-center gap-1",e),...t}));vC.displayName="PaginationContent";const _i=g.forwardRef(({className:e,...t},r)=>n.jsx("li",{ref:r,className:ye("",e),...t}));_i.displayName="PaginationItem";const Dh=({className:e,isActive:t,size:r="icon",...s})=>n.jsx("a",{"aria-current":t?"page":void 0,className:ye(tb({variant:t?"outline":"ghost",size:r}),e),...s});Dh.displayName="PaginationLink";const bC=({className:e,isActive:t,...r})=>n.jsxs(Dh,{"aria-label":"Go to previous page",size:"default",className:ye("gap-1 pl-2.5",e),...r,children:[n.jsx(Nu,{className:"h-4 w-4"}),n.jsx("span",{children:"Previous"})]});bC.displayName="PaginationPrevious";const yC=({className:e,isActive:t,...r})=>n.jsxs(Dh,{"aria-label":"Go to next page",size:"default",className:ye("gap-1 pr-2.5",e),...r,children:[n.jsx("span",{children:"Next"}),n.jsx(_s,{className:"h-4 w-4"})]});yC.displayName="PaginationNext";const Ab=({className:e,...t})=>n.jsxs("span",{"aria-hidden":!0,className:ye("flex h-9 w-9 items-center justify-center",e),...t,children:[n.jsx($0e,{className:"h-4 w-4"}),n.jsx("span",{className:"sr-only",children:"More pages"})]});Ab.displayName="PaginationEllipsis";const L5=12;function sCe(){const{selectedBrand:e}=mn(),{toast:t}=sn(),[r,s]=g.useState([]),[a,i]=g.useState(!0),[o,l]=g.useState(""),[c,d]=g.useState("all"),[u,h]=g.useState("fresh"),[m,f]=g.useState("most-recent"),[p,A]=g.useState(!1),[v,x]=g.useState(1),[b,y]=g.useState(!0),[w,j]=g.useState(!1),N=async(I,$)=>{if(!e)return[];let V=de.from("convergences").select(`
1145        *,
1146        brands!inner (
1147          id,
1148          brand_name
1149        ),
1150        news_contents (
1151          id,
1152          name,
1153          description,
1154          trend_analysis,
1155          business_opportunities_analysis,
1156          audience_and_brand_analysis,
1157          raw_headline,
1158          raw_content,
1159          authoritative_urls,
1160          interesting_links
1161        )
1162      `).eq("brand_id",e.id);switch(I!=="all"&&(V=V.eq("status",I)),$){case"most-recent":V=V.order("created_at",{ascending:!1});break;case"virality":V=V.order("virality_score",{ascending:!1,nullsFirst:!1});break;case"relevance":V=V.order("relevance_score",{ascending:!1,nullsFirst:!1});break;case"power":V=V.order("power_score",{ascending:!1,nullsFirst:!1});break}const{data:R,error:Q}=await V;if(Q)throw console.error("Error fetching convergences:",Q),Q;return R};g.useEffect(()=>{e&&A(e.notify_on_convergences??!1)},[e]),g.useEffect(()=>{const I=()=>{const $=window.innerWidth<768;j($),$&&b?y(!1):!$&&!b&&y(!0)};return I(),window.addEventListener("resize",I),()=>window.removeEventListener("resize",I)},[]);const _=async I=>{if(e)try{const{error:$}=await de.from("brands").update({notify_on_convergences:I,updated_at:new Date().toISOString()}).eq("id",e.id);if($)throw $;A(I),t({title:I?"Notifications enabled":"Notifications disabled",description:I?"You'll be notified when new convergences are available":"You won't be notified about new convergences"})}catch($){console.error("Error updating notification preference:",$),t({title:"Error",description:"Failed to update notification preference",variant:"destructive"})}};g.useEffect(()=>{const I=async()=>{if(e)try{i(!0);const V=await N(c,m);s(V||[])}catch(V){console.error("Failed to load convergences:",V)}finally{i(!1)}},$=setTimeout(I,100);if(e){const V=de.channel("convergences").on("postgres_changes",{event:"*",schema:"public",table:"convergences",filter:`brand_id=eq.${e.id}`},()=>{I()}).subscribe();return()=>{clearTimeout($),V.unsubscribe()}}return()=>clearTimeout($)},[c,m,e]);const S=I=>{d(I)},C=I=>{f(I)},E=()=>{d("all"),h("fresh"),f("most-recent")},T=I=>{h(I)},B=r.filter(I=>{var U,D,q;const $=((U=I.name)==null?void 0:U.toLowerCase().includes(o.toLowerCase()))||((D=I.trend)==null?void 0:D.toLowerCase().includes(o.toLowerCase()))||((q=I.convergence)==null?void 0:q.toLowerCase().includes(o.toLowerCase())),V=new Date,R=I.expiration_date?new Date(I.expiration_date):null;let Q=!0;return u==="fresh"?Q=!R||R>V:u==="expired"&&(Q=R?R<=V:!1),$&&Q}),L=Math.ceil(B.length/L5),P=(v-1)*L5,F=P+L5,M=B.slice(P,F);return g.useEffect(()=>{x(1)},[o,c,u,m]),e?n.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 via-white to-blue-50/30 relative overflow-hidden",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsxs("div",{className:"relative container mx-auto p-6 max-w-7xl space-y-8",children:[n.jsxs("div",{className:"relative overflow-hidden bg-gradient-to-br from-white via-blue-50/30 to-indigo-50/40 rounded-2xl border border-blue-200/50 shadow-sm p-4 md:p-8",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsx("div",{className:"absolute top-0 right-0 w-40 h-40 bg-gradient-to-br from-blue-200/20 to-transparent rounded-full -translate-y-20 translate-x-20"}),n.jsx("div",{className:"relative",children:n.jsx("div",{className:"flex flex-col sm:flex-row sm:items-start justify-between gap-4 md:gap-6",children:n.jsxs("div",{className:"flex items-center gap-2 md:gap-4",children:[n.jsx("div",{className:"p-2 md:p-3 bg-white/80 backdrop-blur-sm rounded-xl md:rounded-2xl shadow-lg",children:n.jsx(mr,{className:"h-5 w-5 md:h-8 md:w-8 text-blue-600"})}),n.jsxs("div",{className:"flex-1",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-1 md:mb-2",children:[n.jsx("h1",{className:"text-2xl md:text-4xl font-bold bg-gradient-to-r from-blue-700 via-indigo-700 to-purple-700 bg-clip-text text-transparent",children:"Convergences"}),n.jsx(Ya,{delayDuration:200,children:n.jsxs(Hs,{children:[n.jsx(zs,{asChild:!0,children:n.jsx("button",{type:"button",className:"p-1.5 rounded-full hover:bg-blue-100/50 transition-colors flex-shrink-0","aria-label":"Convergences information",children:n.jsx(qi,{className:"h-4 w-4 md:h-5 md:w-5 text-blue-600"})})}),n.jsx(Vn,{side:"bottom",className:"max-w-xs p-3",children:n.jsx("p",{className:"text-sm leading-relaxed",children:"Topical content opportunities to keep your brand trending. Convergences are AI-identified topics that combine multiple news sources and trends relevant to your brand."})})]})})]}),n.jsx("p",{className:"text-gray-600 text-base md:text-lg leading-relaxed hidden md:block",children:"Topical content opportunities to keep your brand trending"})]})]})})})]}),n.jsxs("div",{className:"relative overflow-hidden bg-white/60 backdrop-blur-sm rounded-xl border border-white/50 shadow-sm",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-blue-50/20 via-trans
1162parent to-purple-50/20"}),n.jsxs("div",{className:"relative flex items-start sm:items-center gap-3 text-sm p-4",children:[n.jsx(nr,{className:"h-4 w-4 text-blue-600 flex-shrink-0 mt-0.5 sm:mt-0"}),n.jsxs("span",{className:"text-gray-700",children:["For better accuracy, ensure your brand's target audience and value propositions are configured in"," ",n.jsx(Ir,{to:"/brand-genius",className:"font-medium text-blue-600 hover:text-blue-700 underline underline-offset-4 transition-colors",children:"Brand Genius"})]})]})]}),n.jsxs("div",{className:"relative overflow-hidden bg-white/60 backdrop-blur-sm rounded-xl border border-white/50 shadow-sm",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-blue-50/30 via-transparent to-purple-50/30"}),n.jsxs("div",{className:"relative",children:[w&&n.jsxs("button",{onClick:()=>y(!b),className:"w-full flex items-center justify-between p-4 hover:bg-white/30 transition-colors","aria-expanded":b,"aria-label":"Toggle filters",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Pve,{className:"h-5 w-5 text-blue-600"}),n.jsx("span",{className:"font-medium text-gray-700",children:b?"Hide Filters":"Show Filters"}),!b&&n.jsxs("span",{className:"text-xs text-gray-500 bg-blue-100 px-2 py-1 rounded-full",children:[[c!=="all",u!=="all",m!=="most-recent",o].filter(Boolean).length," active"]})]}),b?n.jsx(Fu,{className:"h-5 w-5 text-gray-600"}):n.jsx(Un,{className:"h-5 w-5 text-gray-600"})]}),n.jsx("div",{className:`transition-all duration-300 ease-in-out overflow-hidden ${b?"max-h-96 opacity-100":"max-h-0 opacity-0"}`,children:n.jsx("div",{className:"p-6",children:n.jsxs("div",{className:"flex flex-col lg:flex-row gap-4",children:[n.jsxs("div",{className:"relative flex-grow",children:[n.jsx(Ns,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),n.jsx(qe,{placeholder:"Search convergences...",value:o,onChange:I=>l(I.target.value),className:"pl-10 h-12 bg-white/50 border-white/50 focus:bg-white/70 transition-colors"})]}),n.jsx(P_e,{onFilterChange:S,onExpirationChange:T,onSortChange:C,onClearFilters:E,loading:a,currentFilter:c,currentExpiration:u,currentSort:m})]})})})]})]}),n.jsxs("div",{className:"space-y-8",children:[n.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-6 auto-rows-fr",children:a?Array.from({length:6}).map((I,$)=>n.jsx("div",{className:"bg-white rounded-xl border border-gray-200 shadow-sm",children:n.jsx(Lt,{className:"h-[520px] rounded-xl"})},$)):B.length===0?n.jsx("div",{className:"col-span-full",children:n.jsxs("div",{className:"relative overflow-hidden bg-gradient-to-br from-white via-gray-50/30 to-blue-50/20 rounded-2xl border border-gray-200/50 shadow-sm",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsx("div",{className:"relative flex flex-col items-center justify-center py-20 px-8",children:o?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"w-24 h-24 bg-gradient-to-br from-gray-100 to-gray-200 rounded-full flex items-center justify-center mb-6",children:n.jsx(Ns,{className:"h-12 w-12 text-gray-400"})}),n.jsx("h3",{className:"text-xl font-bold bg-gradient-to-r from-gray-800 to-gray-600 bg-clip-text text-transparent mb-2",children:"No convergences found"}),n.jsx("p",{className:"text-gray-600 text-center mb-6 max-w-md leading-relaxed",children:"Try adjusting your search terms or filters"})]}):r.length===0?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"w-24 h-24 bg-gradient-to-br from-blue-100 to-indigo-200 rounded-full flex items-center justify-center mb-6 animate-pulse",children:n.jsx(Kve,{className:"h-12 w-12 text-blue-600"})}),n.jsx("h3",{className:"text-xl font-bold bg-gradient-to-r from-blue-700 to-indigo-700 bg-clip-text text-transparent mb-2",children:"Looking for convergences..."}),n.jsx("p",{className:"text-gray-600 text-center mb-6 max-w-md leading-relaxed",children:"This shouldn't take long, but sometimes it can take up to 24 hours for convergences to show up depending on your brand."}),n.jsxs("div",{className:"flex items-center justify-center space-x-3 p-4 bg-white/50 rounded-xl",children:[n.jsx(Xo,{id:"notify",checked:p,onCheckedChange:_,className:"border-blue-300"}),n.jsx(ze,{htmlFor:"notify",className:"text-sm cursor-pointer text-gray-700 font-medium",children:"Notify me when convergences are available"})]})]}):n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"w-24 h-24 bg-gradient-to-br from-gray-100 to-gray-200 rounded-full flex items-center justify-center mb-6",children:n.jsx(Ns,{className:"h-12 w-12 text-gray-400"})}),n.jsx("h3",{className:"text-xl font-bold bg-gradient-to-r from-gray-800 to-gray-600 bg-clip-text text-transparent mb-2",children:"No matching convergences"}),n.jsx("p",{className:"text-gray-600 text-center mb-6 max-w-md leading-relaxed",children:"Try adjusting your filters or search terms"})]})})]})}):M.map(I=>n.jsx(d_e,{convergence:I},I.id))}),L>1&&n.jsx("div",{className:"flex justify-center mt-8",children:n.jsx(xC,{children:n.jsxs(vC,{className:"gap-2",children:[n.jsx(_i,{children:n.jsx(bC,{onClick:()=>v>1&&x(v-1),className:`${v===1?"pointer-events-none opacity-50":"cursor-pointer hover:bg-white/70"} bg-white/50 border-white/50 transition-colors`})}),Array.from({length:Math.min(5,L)},(I,$)=>{let V;return L<=5?V=$+1:V=Math.max(1,Math.min(v-2,L-4))+$,n.jsx(_i,{children:n.jsx(Dh,{isActive:v===V,onClick:()=>
1162x(V),className:`cursor-pointer transition-colors ${v===V?"bg-gradient-to-r from-blue-500 to-indigo-600 text-white border-transparent hover:from-blue-600 hover:to-indigo-700":"bg-white/50 border-white/50 hover:bg-white/70"}`,children:V})},V)}),L>5&&v<L-2&&n.jsx(_i,{children:n.jsx(Ab,{className:"bg-white/30"})}),n.jsx(_i,{children:n.jsx(yC,{onClick:()=>v<L&&x(v+1),className:`${v===L?"pointer-events-none opacity-50":"cursor-pointer hover:bg-white/70"} bg-white/50 border-white/50 transition-colors`})})]})})})]})]})]}):n.jsx(ep,{})}const aCe=e=>!e||typeof e!="object"?null:e,iCe=e=>{try{return e?Array.isArray(e)?e.filter(t=>t&&typeof t=="object"&&"url"in t):[]:[]}catch(t){return console.error("Error parsing interesting links:",t),[]}},oCe=({convergence:e,isExpanded:t,onToggleExpand:r})=>{var y,w,j,N,_,S,C,E,T,B;const s=xr(),[a,i]=g.useState("news"),[o,l]=g.useState([]),[c,d]=g.useState(!1),u=aCe(e.metadata),h=e.news_contents?iCe(e.news_contents.interesting_links):[];g.useEffect(()=>{(async()=>{if(!(a!=="content"||!t))try{d(!0);const{data:P,error:F}=await de.from("contents").select(`
1163            id,
1164            name,
1165            content_type,
1166            status,
1167            created_at,
1168            campaign_id,
1169            campaigns!inner (
1170              id,
1171              name,
1172              originating_convergence_id
1173            )
1174          `).eq("campaigns.originating_convergence_id",e.id).order("created_at",{ascending:!1});if(F)throw F;l(P||[])}catch(P){console.error("Error fetching related content:",P),l([])}finally{d(!1)}})()},[a,t,e.id]);const m=()=>{t||i("news"),r()},f=L=>{const P=new Date,F=new Date(L),M=Math.floor((P.getTime()-F.getTime())/(1e3*60*60));if(M<1){const I=Math.floor((P.getTime()-F.getTime())/6e4);return I<1?"Just now":`${I}m`}else return M<24?`${M}h`:F.toLocaleDateString("en-US",{month:"short",day:"numeric"})},p=e.news_contents,A=((y=e.news_contents)==null?void 0:y.trend_analysis)||((w=e.news_contents)==null?void 0:w.business_opportunities_anal
1174ysis)||((j=e.news_contents)==null?void 0:j.audience_and_brand_analysis),v=(u==null?void 0:u.ideas)&&(u.ideas.unique_insights||u.ideas.brand_opinion||u.ideas.hot_takes||u.ideas.controversial_takes||e.promo_idea),b=p||A||v||!0;return n.jsxs("div",{className:ye("bg-white transition-all duration-200 ease-in-out mb-6","hover:shadow-lg cursor-pointer rounded-xl overflow-hidden",t&&"shadow-2xl border-2 border-blue-500 bg-white z-10"),children:[n.jsx("div",{className:"relative",onClick:m,children:n.jsxs("div",{className:"p-4",children:[n.jsxs("div",{className:"flex items-start justify-between mb-3",children:[n.jsxs("div",{className:"flex items-start gap-3 flex-1 min-w-0",children:[n.jsx("div",{className:"w-12 h-12 rounded-lg bg-gradient-to-br from-blue-500 to-indigo-600 flex items-center justify-center flex-shrink-0 shadow-sm",children:n.jsx("span",{className:"text-white font-bold text-sm",children:e.brands.brand_name.substring(0,2).toUpperCase()})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsx("div",{className:"flex items-center gap-2 mb-0.5",children:n.jsx("span",{className:"font-bold text-gray-900 text-base hover:underline cursor-pointer",children:e.brands.brand_name})}),n.jsx("div",{className:"text-gray-500 text-sm mb-1"}),n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"text-gray-500 text-sm",children:f(e.created_at)}),n.jsx("span",{className:"text-gray-400 text-xs",children:"·"}),n.jsx(Is,{className:"w-3.5 h-3.5 text-gray-400"})]})]})]}),n.jsx("div",{className:"flex items-center gap-2 flex-shrink-0 ml-2",children:e.status&&n.jsx(Be,{variant:e.status==="Used"?"secondary":"outline",className:"text-xs",children:e.status})})]}),n.jsxs("div",{className:"mb-3",children:[n.jsx(Ir,{to:`/convergences/${e.id}`,onClick:L=>L.stopPropagation(),className:"inline-block mb-2",children:n.jsx("h3",{className:"text-[17px] font-bold text-gray-900 leading-normal hover:underline hover:text-blue-600 cursor-pointer transition-colors",children:e.name})}),n.jsx("p",{className:"text-[15px] text-gray-700 leading-normal whitespace-pre-wrap",children:e.trend_description})]}),h.length>0&&h[0].image&&n.jsx("div",{className:"mb-3 rounded-lg overflow-hidden",children:n.jsx("img",{src:h[0].image,alt:h[0].title||"Article image",className:"w-full object-cover",style:{maxHeight:"500px"},onError:L=>{L.target.style.display="none"}})}),e.convergence&&n.jsx("div",{className:"mt-4 pt-4 border-t border-gray-200",children:n.jsx("p",{className:"text-sm text-gray-700 leading-relaxed",children:e.convergence})}),n.jsx("div",{className:"mt-5",children:n.jsx(te,{variant:"outline",size:"sm",className:ye("h-9 px-4 text-sm font-medium transition-all border-2 rounded-lg",t?"bg-blue-50 text-blue-700 border-blue-300 hover:bg-blue-100 hover:border-blue-400 shadow-sm":"bg-white text-gray-700 border-gray-300 hover:bg-gray-50 hover:border-gray-400 shadow-sm"),onClick:L=>{L.stopPropagation(),m()},children:t?n.jsxs(n.Fragment,{children:[n.jsx(Fu,{className:"h-4 w-4 mr-1.5"}),"Show less"]}):n.jsxs(n.Fragment,{children:[n.jsx(Un,{className:"h-4 w-4 mr-1.5"}),"Show more"]})})})]})}),t&&b&&n.jsxs("div",{className:"bg-gray-100 border-t border-gray-300",children:[n.jsxs("div",{className:"flex items-center border-b border-gray-300 bg-gray-100",children:[p&&n.jsxs("button",{onClick:L=>{L.stopPropagation(),i("news")},className:`flex items-center gap-2 px-4 py-3 text-sm font-medium transition-all duration-200 border-b-2 ${a==="news"?"border-blue-500 text-blue-600":"border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300"}`,children:[n.jsx(CK,{className:"h-4 w-4"}),n.jsx("span",{children:"News"})]}),v&&n.jsxs("button",{onClick:L=>{L.stopPropagation(),i("discussion")},className:`flex items-center gap-2 px-4 py-3 text-sm font-medium transition-all duration-200 border-b-2 ${a==="discussion"?"border-blue-500 text-blue-600":"border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300"}`,children:[n.jsx(Cc,{className:"h-4 w-4"}),n.jsx("span",{children:"Discussion"})]}),A&&n.jsxs("button",{onClick:L=>{L.stopPropagation(),i("analysis")},className:`flex items-center gap-2 px-4 py-3 text-sm font-medium transition-all duration-200 border-b-2 ${a==="analysis"?"border-blue-500 text-blue-600":"border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300"}`,children:[n.jsx(sa,{className:"h-4 w-4"}),n.jsx("span",{children:"Analysis"})]}),n.jsxs("button",{onClick:L=>{L.stopPropagation(),i("content")},className:`flex items-center gap-2 px-4 py-3 text-sm font-medium transition-all duration-200 border-b-2 ${a==="content"?"border-blue-500 text-blue-600":"border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300"}`,children:[n.jsx(Xr,{className:"h-4 w-4"}),n.jsx("span",{children:"Your Content"})]})]}),a==="news"&&p&&e.news_contents&&n.jsx("div",{className:"p-4 bg-gray-50",children:n.jsxs("div",{className:"space-y-4",children:[e.news_contents.authoritative_urls&&Array.isArray(e.news_contents.authoritative_urls)&&n.jsx("div",{children:n.jsx("div",{className:"space-y-2",children:e.news_contents.authoritative_urls.map((L,P)=>n.jsxs("div",{className:"flex items-center gap-2 p-2 bg-white rounded-lg border border-gray-200",children:[n.jsx(Vs,{className:"h-4 w-4 text-blue-500 flex-shrink-0"}),n.jsx("a",{href:L.url,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-blue-600 hover:underline truncate",children:L.title||L.url})]},P))})}),h.length>0&&n.jsx("div",{children:n.jsx("div",{className:"space-y-3",children:h.map((L,P)=>n.jsx("div",{className:"bg-white p-4 rounded-lg border border-gray-200",children:n.jsxs("div",{className:"flex gap-3",children:[L.image&&n.jsx("img",{src:L.image,alt:L.title||"Article image",className:"w-16 h-16 object-cover rounded flex-shrink-0",onError:F=>{F.target.style.display="none"}}),n.jsxs("div",{className:"flex-1 min-w-0",children:[L.title&&n.jsx("h6",{className:"font-medium text-sm text-gray-900 mb-1 line-clamp-2",children:L.title}),n.jsx("a",{href:L.url,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-blue-600 hover:underline truncate block mb-1",children:L.url}),L.contents&&n.jsx("p",{className:"text-xs text-gray-600 line-clamp-2",children:L.contents})]})]})},P))})})]})}),a==="analysis"&&A&&n.jsxs("div",{className:"p-4 bg-gray-50",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[n.jsx(sa,{className:"h-4 w-4 text-gray-600"}),n.jsx("h4",{className:"text-sm font-semibold text-gray-900",children:"Analysis"})]}),n.jsxs("div",{className:"space-y-4",children:[((N=e.news_contents)==null?void 0:N.trend_anal
1174ysis)&&n.jsxs("div",{children:[n.jsx("h5",{className:"font-medium text-sm text-gray-700 mb-2",children:"Trend Analysis"}),n.jsx("p",{className:"text-sm text-gray-700 whitespace-pre-wrap",children:e.news_contents.trend_analysis})]}),((_=e.news_contents)==null?void 0:_.business_opportunities_analysis)&&n.jsxs("div",{children:[n.jsx("h5",{className:"font-medium text-sm text-gray-700 mb-2",children:"Business Opportunities"}),n.jsx("p",{className:"text-sm text-gray-700 whitespace-pre-wrap",children:e.news_contents.business_opportunities_analysis})]}),((S=e.news_contents)==null?void 0:S.audience_and_brand_analysis)&&n.jsxs("div",{children:[n.jsx("h5",{className:"font-medium text-sm text-gray-700 mb-2",children:"Audience & Brand Analysis"}),n.jsx("p",{className:"text-sm text-gray-700 whitespace-pre-wrap",children:e.news_contents.audience_and_brand_analysis})]})]})]}),a==="discussion"&&v&&n.jsx("div",{className:"bg-gray-50 px-4 py-3",children:n.jsxs("div",{className:"relative pl-8 space-y-3 before:content-[''] before:absolute before:left-3 before:top-0 before:bottom-0 before:w-0.5 before:bg-gray-300",children:[((C=u==null?void 0:u.ideas)==null?void 0:C.unique_insights)&&n.jsxs("div",{className:"flex gap-3 bg-white p-3 rounded-xl border border-gray-200 shadow-sm hover:shadow-md transition-all",children:[n.jsx("div",{className:"flex-shrink-0",children:n.jsx("div",{className:"w-10 h-10 rounded-full bg-gradient-to-br from-amber-100 to-amber-200 flex items-center justify-center",children:n.jsx("span",{className:"text-amber-700 text-sm font-semibold",children:"AI"})})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[n.jsx("span",{className:"font-semibold text-sm text-gray-900",children:"AI Insights"}),n.jsx("span",{className:"text-gray-400 text-xs",children:"·"}),n.jsx("span",{className:"text-gray-500 text-xs",children:"Just now"})]}),n.jsx("p",{className:"text-[15px] text-gray-700 whitespace-pre-wrap leading-normal",children:u.ideas.unique_insights})]})]}),((E=u==null?void 0:u.ideas)==null?void 0:E.brand_opinion)&&n.jsxs("div",{className:"flex gap-3 bg-white p-3 rounded-xl border border-gray-200 shadow-sm hover:shadow-md transition-all",children:[n.jsx("div",{className:"flex-shrink-0",children:n.jsx("div",{className:"w-10 h-10 rounded-full bg-gradient-to-br from-blue-100 to-blue-200 flex items-center justify-center",children:n.jsx("span",{className:"text-blue-700 text-sm font-semibold",children:"BP"})})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[n.jsx("span",{className:"font-semibold text-sm text-gray-900",children:"Brand Perspective"}),n.jsx("span",{className:"text-gray-400 text-xs",children:"·"}),n.jsx("span",{className:"text-gray-500 text-xs",children:"Just now"})]}),n.jsx("p",{className:"text-[15px] text-gray-700 whitespace-pre-wrap leading-normal",children:u.ideas.brand_opinion})]})]}),((T=u==null?void 0:u.ideas)==null?void 0:T.hot_takes)&&n.jsxs("div",{className:"flex gap-3 bg-white p-3 rounded-xl border border-gray-200 shadow-sm hover:shadow-md transition-all",children:[n.jsx("div",{className:"flex-shrink-0",children:n.jsx("div",{className:"w-10 h-10 rounded-full bg-gradient-to-br from-orange-100 to-orange-200 flex items-center justify-center",children:n.jsx("span",{className:"text-orange-700 text-sm font-semibold",children:"HT"})})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[n.jsx("span",{className:"font-semibold text-sm text-gray-900",children:"Hot Take"}),n.jsx("span",{className:"text-gray-400 text-xs",children:"·"}),n.jsx("span",{className:"text-gray-500 text-xs",children:"Just now"})]}),n.jsx("p",{className:"text-[15px] text-gray-700 whitespace-pre-wrap leading-normal",children:u.ideas.hot_takes})]})]}),((B=u==null?void 0:u.ideas)==null?void 0:B.controversial_takes)&&n.jsxs("div",{className:"flex gap-3 bg-white p-3 rounded-xl border border-gray-200 shadow-sm hover:shadow-md transition-all",children:[n.jsx("div",{className:"flex-shrink-0",children:n.jsx("div",{className:"w-10 h-10 rounded-full bg-gradient-to-br from-red-100 to-red-200 flex items-center justify-center",children:n.jsx("span",{className:"text-red-700 text-sm font-semibold",children:"CT"})})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[n.jsx("span",{className:"font-semibold text-sm text-gray-900",children:"Controversial Take"}),n.jsx("span",{className:"text-gray-400 text-xs",children:"·"}),n.jsx("span",{className:"text-gray-500 text-xs",children:"Just now"})]}),n.jsx("p",{className:"text-[15px] text-gray-700 whitespace-pre-wrap leading-normal",children:u.ideas.controversial_takes})]})]}),e.promo_idea&&n.jsxs("div",{className:"flex gap-3 bg-white p-3 rounded-xl border border-gray-200 shadow-sm hover:shadow-md transition-all",children:[n.jsx("div",{className:"flex-shrink-0",children:n.jsx("div",{className:"w-10 h-10 rounded-full bg-gradient-to-br from-purple-100 to-purple-200 flex items-center justify-center",children:n.jsx("span",{className:"text-purple-700 text-sm font-semibold",children:"PR"})})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[n.jsx("span",{className:"font-semibold text-sm text-gray-900",children:"Promo Idea"}),n.jsx("span",{className:"text-gray-400 text-xs",children:"·"}),n.jsx("span",{className:"text-gray-500 text-xs",children:"Just now"})]}),n.jsx("p",{className:"text-[15px] text-gray-700 whitespace-pre-wrap leading-normal",children:e.promo_idea})]})]})]})}),a==="content"&&n.jsx("div",{className:"p-4 bg-gray-50",children:c?n.jsxs("div",{className:"space-y-3",children:[n.jsx(Lt,{className:"h-20"}),n.jsx(Lt,{className:"h-20"})]}):o.length===0?n.jsx("div",{className:"bg-white p-8 rounded-lg border border-gray-200 text-center",children:n.jsxs("div",{className:"flex flex-col items-center justify-center",children:[n.jsx("div",{className:"w-12 h-12 bg-gray-100 rounded-full flex items-center justify-center mb-3",children:n.jsx(Xr,{className:"h-6 w-6 text-gray-400"})}),n.jsx("p",{className:"text-sm text-gray-600 mb-1",children:"No content created yet"}),n.jsx("p",{className:"text-xs text-gray-500",children:"Create content from this convergence to get started"})]})}):n.jsx("div",{className:"space-y-3",children:o.map(L=>n.jsx("div",{className:"bg-white p-4 rounded-lg border border-gray-200 hover:border-blue-300 hover:shadow-sm transition-all cursor-pointer",onClick:P=>{P.stopPropagation(),s(`/content/${L.id}`)},children:n.jsxs("div",{className:"flex items-start justify-between gap-3",children:[n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsx("h5",{className:"font-medium text-sm text-gray-900 mb-1 truncate",children:L.name}),n.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500",children:[n.jsx(Be,{variant:"outline",className:"text-xs",children:L.content_type}),L.campaigns&&n.jsxs(n.Fragment,{children:[n.jsx("span",{children:"·"}),n.jsx("span",{className:"truncate",children:L.campaigns.name})]})]})]}),n.jsxs("div",{className:"flex-shrink-0 flex items-center gap-2",children:[n.jsx(Be,{variant:L.status==="published"?"secondary":"outline",className:"text-xs",children:L.status}),L.created_at&&n.jsx("span",{className:"text-xs text-gray-500",children:new Date(L.created_at).toLocaleDateString("en-US",{month:"short",day:"numeric"})})]})]})},L.id))})})]})]})};function tT(){const{selectedBrand:e}=mn(),[t,r]=g.useState([]),[s,a]=g.useState(!0),[i,o]=g.useState(null);return g.useEffect(()=>{const l=async()=>
1174{if(e)try{a(!0);const{data:c,error:d}=await de.from("convergences").select(`
1175            *,
1176            brands!inner (
1177              id,
1178              brand_name
1179            ),
1180            news_contents (
1181              id,
1182              name,
1183              description,
1184              trend_analysis,
1185              business_opportunities_analysis,
1186              audience_and_brand_analysis,
1187              raw_headline,
1188              raw_content,
1189              authoritative_urls,
1190              interesting_links
1191            )
1192          `).eq("brand_id",e.id).order("created_at",{ascending:!1});if(d)throw d;r(c||[])}catch(c){console.error("Error fetching convergences:",c)}finally{a(!1)}};if(l(),e){const c=de.channel("convergences-feed").on("postgres_changes",{event:"INSERT",schema:"public",table:"convergences",filter:`brand_id=eq.${e.id}`},()=>{l()}).subscribe();return()=>{c.unsubscribe()}}},[e]),e?n.jsx("div",{className:"min-h-screen bg-gray-50",children:n.jsx("div",{className:"container mx-auto max-w-2xl",children:n.jsx("div",{className:"border-x border-gray-200 bg-white",children:s?Array.from({length:3}).map((l,c)=>n.jsx("div",{className:"border-b border-gray-200 p-4",children:n.jsx(Lt,{className:"h-32"})},c)):t.length===0?n.jsx("div",{className:"border-b border-gray-200 p-12 text-center",children:n.jsxs("div",{className:"flex flex-col items-center justify-center",children:[n.jsx("div",{className:"w-16 h-16 bg-gray-100 rounded-full flex items-center justify-center mb-4",children:n.jsx(Ey,{className:"h-8 w-8 text-gray-400"})}),n.jsx("h3",{className:"text-lg font-bold text-gray-900 mb-1",children:"No convergences yet"}),n.jsx("p",{className:"text-gray-600 text-sm max-w-md",children:"Convergences will appear here as they are discovered for your brand. Check back soon!"})]})}):t.map((l,c)=>n.jsx("div",{className:c!==t.length-1?"border-b border-gray-200":"",children:n.jsx(oCe,{convergence:l,isExpanded:i===l.id,onToggleExpand:()=>o(i===l.id?null:l.id)})},l.id))})})}):n.jsx(ep,{})}var lCe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],cCe=lCe.reduce((e,t)=>{const r=Ly(`Primitive.${t}`),s=g.forwardRef((a,i)=>{const{asChild:o,...l}=a,c=o?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),n.jsx(c,{...l,ref:i})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{}),dCe="Separator",yM="horizontal",uCe=["horizontal","vertical"],BJ=g.forwardRef((e,t)=>{const{decorative:r,orientation:s=yM,...a}=e,i=hCe(s)?s:yM,l=r?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return n.jsx(cCe.div,{"data-orientation":i,...l,...a,ref:t})});BJ.displayName=dCe;function hCe(e){return uCe.includes(e)}var TJ=BJ;const xn=g.forwardRef(({className:e,orientation:t="horizontal",decorative:r=!0,...s},a)=>n.jsx(TJ,{ref:a,decorative:r,orientation:t,className:ye("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...s}));xn.displayName=TJ.displayName;function rp(){const[e,t]=g.useState("user"),[r,s]=g.useState(!0);return g.useEffect(()=>{async function o(){try{const{data:l,error:c}=await de.schema("basejump").from("current_user_role").select("role").single();if(c){console.error("Error fetching role:",c),c.code==="PGRST116"&&t("user"),s(!1);return}t((l==null?void 0:l.role)||"user")}catch(l){console.error("Error in fetchRole:",l)}finally{s(!1)}}o()},[]),{role:e,loading:r,isSuperAdmin:e==="superadmin",isAdmin:e==="admin"||e==="superadmin"}}function fCe(e,t){return g.useReducer((r,s)=>t[r][s]??r,e)}var yO="ScrollArea",[PJ]=Ki(yO),[mCe,Hl]=PJ(yO),IJ=g.forwardRef((e,t)=>{const{__scopeScrollArea:r,type:s="hover",dir:a,scrollHideDelay:i=600,...o}=e,[l,c]=g.useState(null),[d,u]=g.useState(null),[h,m]=g.useState(null),[f,p]=g.useState(null),[A,v]=g.useState(null),[x,b]=g.useState(0),[y,w]=g.useState(0),[j,N]=g.useState(!1),[_,S]=g.useState(!1),C=zr(t,T=>c(T)),E=Xg(a);return n.jsx(mCe,{scope:r,type:s,dir:E,scrollHideDelay:i,scrollArea:l,viewport:d,onViewportChange:u,content:h,onContentChange:m,scrollbarX:f,onScrollbarXChange:p,scrollbarXEnabled:j,onScrollbarXEnabledChange:N,scrollbarY:A,onScrollbarYChange:v,scrollbarYEnabled:_,onScrollbarYEnabledChange:S,onCornerWidthChange:b,onCornerHeight
vendor: 8,847 bytes, line 1192
1192Change:w,children:n.jsx(sr.div,{dir:E,...o,ref:C,style:{position:"relative","--radix-scroll-area-corner-width":x+"px","--radix-scroll-area-corner-height":y+"px",...e.style}})})});IJ.displayName=yO;var OJ="ScrollAreaViewport",FJ=g.forwardRef((e,t)=>{const{__scopeScrollArea:r,children:s,nonce:a,...i}=e,o=Hl(OJ,r),l=g.useRef(null),c=zr(t,l,o.onViewportChange);return n.jsxs(n.Fragment,{children:[n.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:a}),n.jsx(sr.div,{"data-radix-scroll-area-viewport":"",...i,ref:c,style:{overflowX:o.scrollbarXEnabled?"scroll":"hidden",overflowY:o.scrollbarYEnabled?"scroll":"hidden",...e.style},children:n.jsx("div",{ref:o.onContentChange,style:{minWidth:"100%",display:"table"},children:s})})]})});FJ.displayName=OJ;var jd="ScrollAreaScrollbar",wO=g.forwardRef((e,t)=>{const{forceMount:r,...s}=e,a=Hl(jd,e.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:o}=a,l=e.orientation==="horizontal";return g.useEffect(()=>(l?i(!0):o(!0),()=>{l?i(!1):o(!1)}),[l,i,o]),a.type==="hover"?n.jsx(pCe,{...s,ref:t,forceMount:r}):a.type==="scroll"?n.jsx(ACe,{...s,ref:t,forceMount:r}):a.type==="auto"?n.jsx(LJ,{...s,ref:t,forceMount:r}):a.type==="always"?n.jsx(jO,{...s,ref:t}):null});wO.displayName=jd;var pCe=g.forwardRef((e,t)=>{const{forceMount:r,...s}=e,a=Hl(jd,e.__scopeScrollArea),[i,o]=g.useState(!1);return g.useEffect(()=>{const l=a.scrollArea;let c=0;if(l){const d=()=>{window.clearTimeout(c),o(!0)},u=()=>{c=window.setTimeout(()=>o(!1),a.scrollHideDelay)};return l.addEventListener("pointerenter",d),l.addEventListener("pointerleave",u),()=>{window.clearTimeout(c),l.removeEventListener("pointerenter",d),l.removeEventListener("pointerleave",u)}}},[a.scrollArea,a.scrollHideDelay]),n.jsx(xo,{present:r||i,children:n.jsx(LJ,{"data-state":i?"visible":"hidden",...s,ref:t})})}),ACe=g.forwardRef((e,t)=>{const{forceMount:r,...s}=e,a=Hl(jd,e.__scopeScrollArea),i=e.orientation==="horizontal",o=jC(()=>c("SCROLL_END"),100),[l,c]=fCe("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return g.useEffect(()=>{if(l==="idle"){const d=window.setTimeout(()=>c("HIDE"),a.scrollHideDelay);return()=>window.clearTimeout(d)}},[l,a.scrollHideDelay,c]),g.useEffect(()=>{const d=a.viewport,u=i?"scrollLeft":"scrollTop";if(d){let h=d[u];const m=()=>{const f=d[u];h!==f&&(c("SCROLL"),o()),h=f};return d.addEventListener("scroll",m),()=>d.removeEventListener("scroll",m)}},[a.viewport,i,c,o]),n.jsx(xo,{present:r||l!=="hidden",children:n.jsx(jO,{"data-state":l==="hidden"?"hidden":"visible",...s,ref:t,onPointerEnter:yt(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:yt(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),LJ=g.forwardRef((e,t)=>{const r=Hl(jd,e.__scopeScrollArea),{forceMount:s,...a}=e,[i,o]=g.useState(!1),l=e.orientation==="horizontal",c=jC(()=>{if(r.viewport){const d=r.viewport.offsetWidth<r.viewport.scrollWidth,u=r.viewport.offsetHeight<r.viewport.scrollHeight;o(l?d:u)}},10);return pg(r.viewport,c),pg(r.content,c),n.jsx(xo,{present:s||i,children:n.jsx(jO,{"data-state":i?"visible":"hidden",...a,ref:t})})}),jO=g.forwardRef((e,t)=>{const{orientation:r="vertical",...s}=e,a=Hl(jd,e.__scopeScrollArea),i=g.useRef(null),o=g.useRef(0),[l,c]=g.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),d=$J(l.viewport,l.content),u={...s,sizes:l,onSizesChange:c,hasThumb:d>0&&d<1,onThumbChange:m=>i.current=m,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:m=>o.current=m};function h(m,f){return wCe(m,o.current,l,f)}return r==="horizontal"?n.jsx(gCe,{...u,ref:t,onThumbPositionChange:()=>{if(a.viewport&&i.current){const m=a.viewport.scrollLeft,f=wM(m,l,a.dir);i.current.style.transform=`translate3d(${f}px, 0, 0)`}},onWheelScroll:m=>{a.viewport&&(a.viewport.scrollLeft=m)},onDragScroll:m=>{a.viewport&&(a.viewport.scrollLeft=h(m,a.dir))}}):r==="vertical"?n.jsx(xCe,{...u,ref:t,onThumbPositionChange:()=>{if(a.viewport&&i.current){const m=a.viewport.scrollTop,f=wM(m,l);i.current.style.transform=`translate3d(0, ${f}px, 0)`}},onWheelScroll:m=>{a.viewport&&(a.viewport.scrollTop=m)},onDragScroll:m=>{a.viewport&&(a.viewport.scrollTop=h(m))}}):null}),gCe=g.forwardRef((e,t)=>{const{sizes:r,onSizesChange:s,...a}=e,i=Hl(jd,e.__scopeScrollArea),[o,l]=g.useState(),c=g.useRef(null),d=zr(t,c,i.onScrollbarXChange);return g.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),n.jsx(RJ,{"data-orientation":"horizontal",...a,ref:d,sizes:r,style:{bottom:0,left:i.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:i.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":wC(r)+"px",...e.style},onThumbPointerDown:u=>e.onThumbPointerDown(u.x),onDragScroll:u=>e.onDragScroll(u.x),onWheelScroll:(u,h)=>{if(i.viewport){const m=i.viewport.scrollLeft+u.deltaX;e.onWheelScroll(m),HJ(m,h)&&u.preventDefault()}},onResize:()=>{c.current&&i.viewport&&o&&s({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:L2(o.paddingLeft),paddingEnd:L2(o.paddingRight)}})}})}),xCe=g.forwardRef((e,t)=>{const{sizes:r,onSizesChange:s,...a}=e,i=Hl(jd,e.__scopeScrollArea),[o,l]=g.useState(),c=g.useRef(null),d=zr(t,c,i.onScrollbarYChange);return g.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),n.jsx(RJ,{"data-orientation":"vertical",...a,ref:d,sizes:r,style:{top:0,right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":wC(r)+"px",...e.style},onThumbPointerDown:u=>e.onThumbPointerDown(u.y),onDragScroll:u=>e.onDragScroll(u.y),onWheelScroll:(u,h)=>{if(i.viewport){const m=i.viewport.scrollTop+u.deltaY;e.onWheelScroll(m),HJ(m,h)&&u.preventDefault()}},onResize:()=>{c.current&&i.viewport&&o&&s({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:L2(o.paddingTop),paddingEnd:L2(o.paddingBottom)}})}})}),[vCe,DJ]=PJ(jd),RJ=g.forwardRef((e,t)=>{const{__scopeScrollArea:r,sizes:s,hasThumb:a,onThumbChange:i,onThumbPointerUp:o,onThumbPointerDown:l,onThumbPositionChange:c,onDragScroll:d,onWheelScroll:u,onResize:h,...m}=e,f=Hl(jd,r),[p,A]=g.useState(null),v=zr(t,C=>A(C)),x=g.useRef(null),b=g.useRef(""),y=f.viewport,w=s.content-s.viewport,j=$o(u),N=$o(c),_=jC(h,10);function S(C){if(x.current){const E=C.clientX-x.current.left,T=C.clientY-x.current.top;d({x:E,y:T})}}return g.useEffect(()=>{const C=E=>{const T=E.target;(p==null?void 0:p.contains(T))&&j(E,w)};return document.addEventListener("wheel",C,{passive:!1}),()=>document.removeEventListener("wheel",C,{passive:!1})},[y,p,w,j]),g.useEffect(N,[s,N]),pg(p,_),pg(f.content,_),n.jsx(vCe,{scope:r,scrollbar:p,hasThumb:a,onThumbChange:$o(i),onThumbPointerUp:$o(o),onThumbPositionChange:N,onThumbPointerDown:$o(l),children:n.jsx(sr.div,{...m,ref:v,style:{position:"absolute",...m.style},onPointerDown:yt(e.onPointerDown,C=>{C.button===0&&(C.target.setPointerCapture(C.pointerId),x.current=p.getBoundingClientRect(),b.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",f.viewport&&(f.viewport.style.scrollBehavior="auto"),S(C))}),onPointerMove:yt(e.onPointerMove,S),onPointerUp:yt(e.onPointerUp,C=>{const E=C.target;E.hasPointerCapture(C.pointerId)&&E.releasePointerCapture(C.pointerId),document.body.style.webkitUserSelect=b.current,f.viewport&&(f.viewport.style.scrollBehavior=""),x.current=null})})})}),F2="ScrollAreaThumb",UJ=g.forwardRef((e,t)=>{const{forceMount:r,...s}=e,a=DJ(F2,e.__scopeScrollArea);return n.jsx(xo,{present:r||a.hasThumb,children:n.jsx(bCe,{ref:t,...s})})}),bCe=g.forwardRef((e,t)=>{const{__scopeScrollArea:r,style:s,...a}=e,i=Hl(F2,r),o=DJ(F2,r),{onThumbPositionChange:l}=o,c=zr(t,h=>o.onThumbChange(h)),d=g.useRef(void 0),u=jC(()=>{d.current&&(d.current(),d.current=void 0)},100);return g.useEffect(()=>{const h=i.viewport;if(h){const m=()=>{if(u(),!d.current){const f=jCe(h,l);d.current=f,l()}};return l(),h.addEventListener("scroll",m),()=>h.removeEventListener("scroll",m)}},[i.viewport,u,l]),n.jsx(sr.div,{"data-state":o.hasThumb?"visible":"hidden",...a,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...s},onPointerDownCapture:yt(e.onPointerDownCapture,h=>{const f=h.target.getBoundingClientRect(),p=h.clientX-f.left,A=h.clientY-f.top;o.onThumbPointerDown({x:p,y:A})}),onPointerUp:yt(e.onPointerUp,o.onThumbPointerUp)})});UJ.displayName=F2;var NO="ScrollAreaCorner",MJ=g.forwardRef((e,t)=>
1192{const r=Hl(NO,e.__scopeScrollArea),s=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&s?n.jsx(yCe,{...e,ref:t}):null});MJ.displayName=NO;var yCe=g.forwardRef((e,t)=>{const{__scopeScrollArea:r,...s}=e,a=Hl(NO,r),[i,o]=g.useState(0),[l,c]=g.useState(0),d=!!(i&&l);return pg(a.scrollbarX,()=>{var h;const u=((h=a.scrollbarX)==null?void 0:h.offsetHeight)||0;a.onCornerHeightChange(u),c(u)}),pg(a.scrollbarY,()=>{var h;const u=((h=a.scrollbarY)==null?void 0:h.offsetWidth)||0;a.onCornerWidthChange(u),o(u)}),d?n.jsx(sr.div,{...s,ref:t,style:{width:i,height:l,position:"absolute",right:a.dir==="ltr"?0:void 0,left:a.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function L2(e){return e?parseInt(e,10):0}function $J(e,t){const r=e/t;return isNaN(r)?0:r}function wC(e){const t=$J(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,s=(e.scrollbar.size-r)*t;return Math.max(s,18)}function wCe(e,t,r,s="ltr"){const a=wC(r),i=a/2,o=t||i,l=a-o,c=r.scrollbar.paddingStart+o,d=r.scrollbar.size-r.scrollbar.paddingEnd-l,u=r.content-r.viewport,h=s==="ltr"?[0,u]:[u*-1,0];return QJ([c,d],h)(e)}function wM(e,t,r="ltr"){const s=wC(t),a=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,i=t.scrollbar.size-a,o=t.content-t.viewport,l=i-s,c=r==="ltr"?[0,o]:[o*-1,0],d=mb(e,c);return QJ([0,o],[0,l])(d)}function QJ(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const s=(t[1]-t[0])/(e[1]-e[0]);return t[0]+s*(r-e[0])}}function HJ(e,t){return e>0&&e<t}var jCe=(e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},s=0;return function a(){const i={left:e.scrollLeft,top:e.scrollTop},o=r.left!==i.left,l=r.top!==i.top;(o||l)&&t(),r=i,s=window.requestAnimationFrame(a)}(),()=>window.cancelAnimationFrame(s)};function jC(e,t){const r=$o(e),s=g.useRef(0);return g.useEffect(()=>()=>window.clearTimeout(s.current),[]),g.useCallback(()=>{window.clearTimeout(s.current),s.current=window.setTimeout(r,t)},[r,t])}function pg(e,t){const r=$o(t);co(()=>{let s=0;if(e){const a=new ResizeObserver(()=>{cancelAnimationFrame(s),s=window.requestAnimationFrame(r)});return a.observe(e),()=>{window.cancelAnimationFrame(s),a.unobserve(e)}}},[e,r])}var zJ=IJ,NCe=FJ,_Ce=MJ;const ol=g.forwardRef(({className:e,children:t,...r},s)=>n.jsxs(zJ,{ref:s,className:ye("relative overflow-hidden",e),...r,children:[n.jsx(NCe,{className:"h-full w-full rounded-[inherit]",children:t}),n.jsx(_O,{}),n.jsx(_Ce,{})]}));ol.displayName=zJ.displayName;const _O=g.forwardRef(({className:e,orientation:t="vertical",...r},s)=>n.jsx(wO,{ref:s,orientation:t,className:ye("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...r,children:n.jsx(UJ,{className:"relative flex-1 rounded-full bg-border"})}));_O.displayName=wO.displayName;var CCe=Array.isArray,vo=CCe,SCe=typeof Nh=="object"&&Nh&&Nh.Object===Object&&Nh,VJ=SCe,kCe=VJ,ECe=typeof self=="object"&&self&&self.Object===Object&&self,BCe=kCe||ECe||Function("return this")(),Nd=BCe,TCe=Nd,PCe=TCe.Symbol,Dy=PCe,jM=Dy,GJ=Object.prototype,ICe=GJ.hasOwnProperty,OCe=GJ.toString,px=jM?jM.toStringTag:void 0;function FCe(e){var t=ICe.call(e,px),r=e[px];try{e[px]=void 0;var s=!0}catch{}var a=OCe.call(e);return s&&(t?e[px]=r:delete e[px]),a}var LCe=FCe,DCe=Object.prototype,RCe=DCe.toString;function UCe(e){return RCe.call(e)}var MCe=UCe,NM=Dy,$Ce=LCe,QCe=MCe,HCe="[object Null]",zCe="[object Undefined]",_M=NM?NM.toStringTag:void 0;function VCe(e){return e==null?e===void 0?zCe:HCe:_M&&_M in Object(e)?$Ce(e):QCe(e)}var Du=VCe;function GCe(e){return e!=null&&typeof e=="object"}var Ru=GCe,qCe=Du,KCe=Ru,WCe="[object Symbol]";function YCe(e){return typeof e=="symbol"||KCe(e)&&qCe(e)==WCe}var c0=YCe,JCe=vo,XCe=c0,ZCe=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,eSe=/^\w*$/;function tSe(e,t){if(JCe(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||XCe(e)?!0:eSe.test(e)||!ZCe.test(e)||t!=null&&e in Object(t)}var CO=tSe;function rSe(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var cf=rSe;const d0=wn(cf);var nSe=Du,sSe=cf,aSe="[object AsyncFunction]",iSe="[object Function]",oSe="[object GeneratorFunction]",lSe="[object Proxy]";function cSe(e){if(!sSe(e))return!1;var t=nSe(e);return t==iSe||t==oSe||t==aSe||t==lSe}var SO=cSe;const er=wn(SO);var dSe=Nd,uSe=dSe["__core-js_shared__"],hSe=uSe,D5=hSe,CM=function(){var e=/[^.]+$/.exec(D5&&D
vendor: 4,131 bytes, line 1192
11925.keys&&D5.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function fSe(e){return!!CM&&CM in e}var mSe=fSe,pSe=Function.prototype,ASe=pSe.toString;function gSe(e){if(e!=null){try{return ASe.call(e)}catch{}try{return e+""}catch{}}return""}var qJ=gSe,xSe=SO,vSe=mSe,bSe=cf,ySe=qJ,wSe=/[\\^$.*+?()[\]{}|]/g,jSe=/^\[object .+?Constructor\]$/,NSe=Function.prototype,_Se=Object.prototype,CSe=NSe.toString,SSe=_Se.hasOwnProperty,kSe=RegExp("^"+CSe.call(SSe).replace(wSe,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function ESe(e){if(!bSe(e)||vSe(e))return!1;var t=xSe(e)?kSe:jSe;return t.test(ySe(e))}var BSe=ESe;function TSe(e,t){return e==null?void 0:e[t]}var PSe=TSe,ISe=BSe,OSe=PSe;function FSe(e,t){var r=OSe(e,t);return ISe(r)?r:void 0}var np=FSe,LSe=np,DSe=LSe(Object,"create"),NC=DSe,SM=NC;function RSe(){this.__data__=SM?SM(null):{},this.size=0}var USe=RSe;function MSe(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var $Se=MSe,QSe=NC,HSe="__lodash_hash_undefined__",zSe=Object.prototype,VSe=zSe.hasOwnProperty;function GSe(e){var t=this.__data__;if(QSe){var r=t[e];return r===HSe?void 0:r}return VSe.call(t,e)?t[e]:void 0}var qSe=GSe,KSe=NC,WSe=Object.prototype,YSe=WSe.hasOwnProperty;function JSe(e){var t=this.__data__;return KSe?t[e]!==void 0:YSe.call(t,e)}var XSe=JSe,ZSe=NC,eke="__lodash_hash_undefined__";function tke(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=ZSe&&t===void 0?eke:t,this}var rke=tke,nke=USe,ske=$Se,ake=qSe,ike=XSe,oke=rke;function u0(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var s=e[t];this.set(s[0],s[1])}}u0.prototype.clear=nke;u0.prototype.delete=ske;u0.prototype.get=ake;u0.prototype.has=ike;u0.prototype.set=oke;var lke=u0;function cke(){this.__data__=[],this.size=0}var dke=cke;function uke(e,t){return e===t||e!==e&&t!==t}var kO=uke,hke=kO;function fke(e,t){for(var r=e.length;r--;)if(hke(e[r][0],t))return r;return-1}var _C=fke,mke=_C,pke=Array.prototype,Ake=pke.splice;function gke(e){var t=this.__data__,r=mke(t,e);if(r<0)return!1;var s=t.length-1;return r==s?t.pop():Ake.call(t,r,1),--this.size,!0}var xke=gke,vke=_C;function bke(e){var t=this.__data__,r=vke(t,e);return r<0?void 0:t[r][1]}var yke=bke,wke=_C;function jke(e){return wke(this.__data__,e)>-1}var Nke=jke,_ke=_C;function Cke(e,t){var r=this.__data__,s=_ke(r,e);return s<0?(++this.size,r.push([e,t])):r[s][1]=t,this}var Ske=Cke,kke=dke,Eke=xke,Bke=yke,Tke=Nke,Pke=Ske;function h0(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var s=e[t];this.set(s[0],s[1])}}h0.prototype.clear=kke;h0.prototype.delete=Eke;h0.prototype.get=Bke;h0.prototype.has=Tke;h0.prototype.set=Pke;var CC=h0,Ike=np,Oke=Nd,Fke=Ike(Oke,"Map"),EO=Fke,kM=lke,Lke=CC,Dke=EO;function Rke(){this.size=0,this.__data__={hash:new kM,map:new(Dke||Lke),string:new kM}}var Uke=Rke;function Mke(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var $ke=Mke,Qke=$ke;function Hke(e,t){var r=e.__data__;return Qke(t)?r[typeof t=="string"?"string":"hash"]:r.map}var SC=Hke,zke=SC;function Vke(e){var t=zke(this,e).delete(e);return this.size-=t?1:0,t}var Gke=Vke,qke=SC;function Kke(e){return qke(this,e).get(e)}var Wke=Kke,Yke=SC;function Jke(e){return Yke(this,e).has(e)}var Xke=Jke,Zke=SC;function e5e(e,t){var r=Zke(this,e),s=r.size;return r.set(e,t),this.size+=r.size==s?0:1,this}var t5e=e5e,r5e=Uke,n5e=Gke,s5e=Wke,a5e=Xke,i5e=t5e;function f0(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var s=e[t];this.set(s[0],s[1])}}f0.prototype.clear=r5e;f0.prototype.delete=n5e;f0.prototype.get=s5e;f0.prototype.has=a5e;f0.prototype.set=i5e;var BO=f0,KJ=BO,o5e="Expected a function";function TO(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(o5e);var r=function(){var s=arguments,a=t?t.apply(this,s):s[0],i=r.cache;if(i.has(a))return i.get(a);var o=e.apply(this,s);return r.cache=i.set(a,o)||i,o};return r.cache=new(TO.Cache||KJ),r}TO.Cache=KJ;var WJ=TO;const l5e=wn(WJ);var c5e=WJ,d5e=500;function u5e(e){var t=c5e(e,function(s){return r.size===d5e&&r.clear(),s}
vendor: 6,734 bytes, lines 1192-1200
1192),r=t.cache;return t}var h5e=u5e,f5e=h5e,m5e=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,p5e=/\\(\\)?/g,A5e=f5e(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(m5e,function(r,s,a,i){t.push(a?i.replace(p5e,"$1"):s||r)}),t}),g5e=A5e;function x5e(e,t){for(var r=-1,s=e==null?0:e.length,a=Array(s);++r<s;)a[r]=t(e[r],r,e);return a}var PO=x5e,EM=Dy,v5e=PO,b5e=vo,y5e=c0,BM=EM?EM.prototype:void 0,TM=BM?BM.toString:void 0;function YJ(e){if(typeof e=="string")return e;if(b5e(e))return v5e(e,YJ)+"";if(y5e(e))return TM?TM.call(e):"";var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}var w5e=YJ,j5e=w5e;function N5e(e){return e==null?"":j5e(e)}var JJ=N5e,_5e=vo,C5e=CO,S5e=g5e,k5e=JJ;function E5e(e,t){return _5e(e)?e:C5e(e,t)?[e]:S5e(k5e(e))}var XJ=E5e,B5e=c0;function T5e(e){if(typeof e=="string"||B5e(e))return e;var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}var kC=T5e,P5e=XJ,I5e=kC;function O5e(e,t){t=P5e(t,e);for(var r=0,s=t.length;e!=null&&r<s;)e=e[I5e(t[r++])];return r&&r==s?e:void 0}var IO=O5e,F5e=IO;function L5e(e,t,r){var s=e==null?void 0:F5e(e,t);return s===void 0?r:s}var ZJ=L5e;const Zo=wn(ZJ);function D5e(e){return e==null}var R5e=D5e;const wr=wn(R5e);var U5e=Du,M5e=vo,$5e=Ru,Q5e="[object String]";function H5e(e){return typeof e=="string"||!M5e(e)&&$5e(e)&&U5e(e)==Q5e}var z5e=H5e;const Um=wn(z5e);var eX={exports:{}},Fn={};/**
1193 * @license React
1194 * react-is.production.min.js
1195 *
1196 * Copyright (c) Facebook, Inc. and its affiliates.
1197 *
1198 * This source code is licensed under the MIT license found in the
1199 * LICENSE file in the root directory of this source tree.
1200 */var OO=Symbol.for("react.element"),FO=Symbol.for("react.portal"),EC=Symbol.for("react.fragment"),BC=Symbol.for("react.strict_mode"),TC=Symbol.for("react.profiler"),PC=Symbol.for("react.provider"),IC=Symbol.for("react.context"),V5e=Symbol.for("react.server_context"),OC=Symbol.for("react.forward_ref"),FC=Symbol.for("react.suspense"),LC=Symbol.for("react.suspense_list"),DC=Symbol.for("react.memo"),RC=Symbol.for("react.lazy"),G5e=Symbol.for("react.offscreen"),tX;tX=Symbol.for("react.module.reference");function zl(e){if(typeof e=="object"&&e!==null){var t=e.$$typeof;switch(t){case OO:switch(e=e.type,e){case EC:case TC:case BC:case FC:case LC:return e;default:switch(e=e&&e.$$typeof,e){case V5e:case IC:case OC:case RC:case DC:case PC:return e;default:return t}}case FO:return t}}}Fn.ContextConsumer=IC;Fn.ContextProvider=PC;Fn.Element=OO;Fn.ForwardRef=OC;Fn.Fragment=EC;Fn.Lazy=RC;Fn.Memo=DC;Fn.Portal=FO;Fn.Profiler=TC;Fn.StrictMode=BC;Fn.Suspense=FC;Fn.SuspenseList=LC;Fn.isAsyncMode=function(){return!1};Fn.isConcurrentMode=function(){return!1};Fn.isContextConsumer=function(e){return zl(e)===IC};Fn.isContextProvider=function(e){return zl(e)===PC};Fn.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===OO};Fn.isForwardRef=function(e){return zl(e)===OC};Fn.isFragment=function(e){return zl(e)===EC};Fn.isLazy=function(e){return zl(e)===RC};Fn.isMemo=function(e){return zl(e)===DC};Fn.isPortal=function(e){return zl(e)===FO};Fn.isProfiler=function(e){return zl(e)===TC};Fn.isStrictMode=function(e){return zl(e)===BC};Fn.isSuspense=function(e){return zl(e)===FC};Fn.isSuspenseList=function(e){return zl(e)===LC};Fn.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===EC||e===TC||e===BC||e===FC||e===LC||e===G5e||typeof e=="object"&&e!==null&&(e.$$typeof===RC||e.$$typeof===DC||e.$$typeof===PC||e.$$typeof===IC||e.$$typeof===OC||e.$$typeof===tX||e.getModuleId!==void 0)};Fn.typeOf=zl;eX.exports=Fn;var q5e=eX.exports,K5e=Du,W5e=Ru,Y5e="[object Number]";function J5e(e){return typeof e=="number"||W5e(e)&&K5e(e)==Y5e}var rX=J5e;const X5e=wn(rX);var Z5e=rX;function eEe(e){return Z5e(e)&&e!=+e}var tEe=eEe;const m0=wn(tEe);var Qi=function(t){return t===0?0:t>0?1:-1},um=function(t){return Um(t)&&t.indexOf("%")===t.length-1},lt=function(t){return X5e(t)&&!m0(t)},rEe=function(t){return wr(t)},Da=function(t){return lt(t)||Um(t)},nEe=0,sp=function(t){var r=++nEe;return"".concat(t||"").concat(r)},Hi=function(t,r){var s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!lt(t)&&!Um(t))return s;var i;if(um(t)){var o=t.indexOf("%");i=r*parseFloat(t.slice(0,o))/100}else i=+t;return m0(i)&&(i=s),a&&i>r&&(i=r),i},wh=function(t){if(!t)return null;var r=Object.keys(t);return r&&r.length?t[r[0]]:null},sEe=function(t){if(!Array.isArray(t))return!1;for(var r=t.length,s={},a=0;a<r;a++)if(!s[t[a]])s[t[a]]=!0;else return!0;return!1},ks=function(t,r){return lt(t)&&lt(r)?function(s){return t+s*(r-t)}:function(){return r}};function D2(e,t,r){return!e||!e.length?null:e.find(function(s){return s&&(typeof t=="function"?t(s):Zo(s,t))===r})}var aEe=function(t,r){return lt(t)&&lt(r)?t-r:Um(t)&&Um(r)?t.localeCompare(r):t instanceof Date&&r instanceof Date?t.getTime()-r.getTime():String(t).localeCompare(String(r))};function OA(e,t){for(var r in e)if({}.hasOwnProperty.call(e,r)&&(!{}.hasOwnProperty.call(t,r)||e[r]!==t[r]))return!1;for(var s in t)if({}.hasOwnProperty.call(t,s)&&!{}.hasOwnProperty.call(e,s))return!1;return!0}function rT(e){"@babel/helpers - typeof";return rT=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},rT(e)}var iEe=["viewBox","children"],oEe=["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRen
1200dering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"],PM=["points","pathLength"],R5={svg:iEe,polygon:PM,polyline:PM},LO=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDrag
1200Capture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"],R2=function(t,r){if(!t||typeof t=="function"||typeof t=="boolean")return null;var s=t;if(g.isValidElement(t)&&(s=t.props),!d0(s))return null;var a={};return Object.keys(s).forEach(function(i){LO.includes(i)&&(a[i]=r||function(o){return s[i](s,o)})}),a},lEe=function(t,r,s){return function(a){return t(r,s,a),null}},Mm=function(t,r,s){if(!d0(t)||rT(t)!=="object")return null;var a=null;return Object.keys(t).forEach(function(i){var o=t[i];LO.includes(i)&&typeof o=="function"&&(a||(a={}),a[i]=lEe(o,r,s))}),a},cEe=["children"],dEe=["children"];function IM(e,t){if(e==null)return{};var r=uEe(e,t),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)s=i[a],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(r[s]=e[s])}return r}function uEe(e,t){if(e==null)return{};var r={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;r[s]=e[s]}return r}function nT(e){"@babel/helpers - typeof";return nT=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},nT(e)}var OM={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart",contextmenu:"onContextMenu",dblclick:"onDoubleClick"},bu=function(t){return typeof t=="string"?t:t?t.displayName||t.name||"Component":""},FM=null,U5=null,DO=function e(t){if(t===FM&&Array.isArray(U5))return U5;var r=[];return g.Children.forEach(t,function(s){wr(s)||(q5e.isFragment(s)?r=r.concat(e(s.props.children)):r.push(s))}),U5=r,FM=t,r};function el(e,t){var r=[],s=[];return Array.isArray(t)?s=t.map(function(a){return bu(a)}):s=[bu(t)],DO(e).forEach(function(a){var i=Zo(a,"type.displayName")||Zo(a,"type.n
1200ame");s.indexOf(i)!==-1&&r.push(a)}),r}function Do(e,t){var r=el(e,t);return r&&r[0]}var LM=function(t){if(!t||!t.props)return!1;var r=t.props,s=r.width,a=r.height;return!(!lt(s)||s<=0||!lt(a)||a<=0)},hEe=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColormatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-url","foreignObject","g","glyph","glyphRef","hkern","image","line","lineGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],fEe=function(t){return t&&t.type&&Um(t.type)&&hEe.indexOf(t.type)>=0},nX=function(t){return t&&nT(t)==="object"&&"clipDot"in t},mEe=function(t,r,s,a){var i,o=(i=R5==null?void 0:R5[a])!==null&&i!==void 0?i:[];return r.startsWith("data-")||!er(t)&&(a&&o.includes(r)||oEe.includes(r))||s&&LO.includes(r)},Dt=function(t,r,s){if(!t||typeof t=="function"||typeof t=="boolean")return null;var a=t;if(g.isValidElement(t)&&(a=t.props),!d0(a))return null;var i={};return Object.keys(a).forEach(function(o){var l;mEe((l=a)===null||l===void 0?void 0:l[o],o,r,s)&&(i[o]=a[o])}),i},sT=function e(t,r){if(t===r)return!0;var s=g.Children.count(t);if(s!==g.Children.count(r))return!1;if(s===0)return!0;if(s===1)return DM(Array.isArray(t)?t[0]:t,Array.isArray(r)?r[0]:r);for(var a=0;a<s;a++){var i=t[a],o=r[a];if(Array.isArray(i)||Array.isArray(o)){if(!e(i,o))return!1}else if(!DM(i,o))return!1}return!0},DM=function(t,r){if(wr(t)&&wr(r))return!0;if(!wr(t)&&!wr(r)){var s=t.props||{},a=s.children,i=IM(s,cEe),o=r.props||{},l=o.children,c=IM(o,dEe);return a&&l?OA(i,c)&&sT(a,l):!a&&!l?OA(i,c):!1}return!1},RM=function(t,r){var s=[],a={};return DO(t).forEach(function(i,o){if(fEe(i))s.push(i);else if(i){var l=bu(i.type),c=r[l]||{},d=c.handler,u=c.once;if(d&&(!u||!a[l])){var h=d(i,l,o);s.push(h),a[l]=!0}}}),s},pEe=function(t){var r=t&&t.type;return r&&OM[r]?OM[r]:null},AEe=function(t,r){return DO(r).indexOf(t)},gEe=["children","width","height","viewBox","className","style","title","desc"];function aT(){return aT=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];
vendor: 1,086 bytes, line 1200
1200for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},aT.apply(this,arguments)}function xEe(e,t){if(e==null)return{};var r=vEe(e,t),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)s=i[a],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(r[s]=e[s])}return r}function vEe(e,t){if(e==null)return{};var r={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;r[s]=e[s]}return r}function iT(e){var t=e.children,r=e.width,s=e.height,a=e.viewBox,i=e.className,o=e.style,l=e.title,c=e.desc,d=xEe(e,gEe),u=a||{width:r,height:s,x:0,y:0},h=fr("recharts-surface",i);return oe.createElement("svg",aT({},Dt(d,!0,"svg"),{className:h,width:r,height:s,style:o,viewBox:"".concat(u.x," ").concat(u.y," ").concat(u.width," ").concat(u.height)}),oe.createElement("title",null,l),oe.createElement("desc",null,c),t)}var bEe=["children","className"];function oT(){return oT=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];
1200for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},oT.apply(this,arguments)}function yEe(e,t){if(e==null)return{};var r=wEe(e,t),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)s=i[a],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(r[s]=e[s])}return r}function wEe(e,t){if(e==null)return{};var r={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;r[s]=e[s]}return r}var Qr=oe.forwardRef(function(e,t){var r=e.children,s=e.className,a=yEe(e,bEe),i=fr("recharts-layer",s);return oe.createElement("g",oT({className:i},Dt(a,!0),{ref:t}),r)}),yc=function(t,r){for(var s=arguments.length,a=new Array(s>2?s-2:0),i=2;i<s;i++)a[i-2]=arguments[i]};function jEe(e,t,r){var s=-1,a=e.length;t<0&&(t=-t>a?0:a+t),r=r>a?a:r,r<0&&(r+=a),a=t>r?0:r-t>>>0,t>>>=0;for(var i=Array(a);++s<a;)i[s]=e[s+t];return i}var NEe=jEe,_Ee=NEe;function CEe(e,t,r){var s=e.length;return r=r===void 0?s:r,!t&&r>=s?e:_Ee(e,t,r)}var SEe=CEe,kEe="\\ud800-\\udfff",EEe="\\u0300-\\u036f",BEe="\\ufe20-\\ufe2f",TEe="\\u20d0-\\u20ff",PEe=EEe+BEe+TEe,IEe="\\ufe0e\\ufe0f",OEe="\\u200d",FEe=RegExp("["+OEe+kEe+PEe+IEe+"]");function LEe(e){return FEe.test(e)}var sX=LEe;function DEe(e){return e.split("")}var REe=DEe,aX="\\ud800-\\udfff",UEe="\\u0300-\\u036f",MEe="\\ufe20-\\ufe2f",$Ee="\\u20d0-\\u20ff",QEe=UEe+MEe+$Ee,HEe="\\ufe0e\\ufe0f",zEe="["+aX+"]",lT="["+QEe+"]",cT="\\ud83c[\\udffb-\\udfff]",VEe="(?:"+lT+"|"+cT+")",iX="[^"+aX+"]",oX="(?:\\ud83c[\\udde6-\\uddff]){2}",lX="[\\ud800-\\udbff][\\udc00-\\udfff]",GEe="\\u200d",cX=VEe+"?",dX="["+HEe+"]?",qEe="(?:"+GEe+"(?:"+[iX,oX,lX].join("|")+")"+dX+cX+")*",KEe=dX+cX+qEe,WEe="(?:"+[iX+lT+"?",lT,oX,lX,zEe].join("|")+")",YEe=RegExp(cT+"(?="+cT+")|"+WEe+KEe,"g");function JEe(e){return e.match(YEe)||[]}var XEe=JEe,ZEe=REe,e4e=sX,t4e=XEe;function r4e(e){return e4e(e)?t4e(e):ZEe(e)}var n4e=r4e,s4e=SEe,a4e=sX,i4e=n4e,o4e=JJ;function l4e(e){return function(t){t=o4e(t);var r=a4e(t)?i4e(t):void 0,s=r?r[0]:t.charAt(0),a=r?s4e(r,1).join(""):t.slice(1);return s[e]()+a}}var c4e=l4e,d4e=c4e,u4e=d4e("toUpperCase"),h4e=u4e;const UC=wn(h4e);function rs(e){return function(){return e}}const uX=Math.cos,U2=Math.sin,Bc=Math.sqrt,M2=Math.PI,MC=2*M2,dT=Math.PI,uT=2*dT,qf=1e-6,f4e=uT-qf;function hX(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=arguments[t]+e[t]}function m4e(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return hX;const r=10**t;return function(s){this._+=s[0];for(let a=1,i=s.length;a<i;++a)this._+=Math.round(arguments[a]*r)/r+s[a]}}class p4e{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?hX:m4e(t)}moveTo(t,r){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,r){this._append`L${this._x1=+t},${this._y1=+r}`}quadraticCurveTo(t,r,s,a){this._append`Q${+t},${+r},${this._x1=+s},${this._y1=+a}`}bezierCurveTo(t,r,s,a,i,o){this._append`C${+t},${+r},${+s},${+a},${this._x1=+i},${this._y1=+o}`}arcTo(t,r,s,a,i){if(t=+t,r=+r,s=+s,a=+a,i=+i,i<0)throw new Error(`negative radius: ${i}`);let o=this._x1,l=this._y1,c=s-t,d=a-r,u=o-t,h=l-r,m=u*u+h*h;if(this._x1===null)this._append`M${this._x1=t},${this._y1=r}`;else if(m>qf)if(!(Math.abs(h*c-d*u)>qf)||!i)this._append`L${this._x1=t},${this._y1=r}`;else{let f=s-o,p=a-l,A=c*c+d*d,v=f*f+p*p,x=Math.sqrt(A),b=Math.sqrt(m),y=i*Math.tan((dT-Math.acos((A+m-v)/(2*x*b)))/2),w=y/b,j=y/x;Math.abs(w-1)>qf&&this._append`L${t+w*u},${r+w*h}`,this._append`A${i},${i},0,0,${+(h*f>u*p)},${this._x1=t+j*c},${this._y1=r+j*d}`}}arc(t,r,s,a,i,o){if(t=+t,r=+r,s=+s,o=!!o,s<0)throw new Error(`negative radius: ${s}`);let l=s*Math.cos(a),c=s*Math.sin(a),d=t+l,u=r+c,h=1^o,m=o?a-i:i-a;this._x1===null?this._append`M${d},${u}`:(Math.abs(this._x1-d)>qf||Math.abs(this._y1-u)>qf)&&this._append`L${d},${u}`,s&&(m<0&&(m=m%uT+uT),m>f4e?this._append`A${s},${s},0,1,${h},${t-l},${r-c}A${s},${s},0,1,${h},${this._x1=d},${this._y1=u}`:m>qf&&this._append`A${s},${s},0,${+(m>=dT)},${h},${this._x1=t+s*Math.cos(i)},${this._y1=r+s*Math.sin(i)}`)}rect(t,r,s,a){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}h${s=+s}v${+a}h${-s}Z`}toString(){return this._}}function RO(e){let t=3;return e.digits=function(r){if(!arguments.length)return t;if(r==null)t=null;else{const s=Math.floor(r);if(!(s>=0))throw new RangeError(`invalid digits: ${r}`);t=s}return e},()=>new p4e(t)}function UO(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function fX(e){this._context=e}fX.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function $C(e){return new fX(e)}function mX(e){return e[0]}function pX(e){return e[1]}function AX(e,t){var r=rs(!0),s=null,a=$C,i=null,o=RO(l);e=typeof e=="function"?e:e===void 0?mX:rs(e),t=typeof t=="function"?t:t===void 0?pX:rs(t);function l(c){var d,u=(c=UO(c)).length,h,m=!1,f;for(s==null&&(i=a(f=o())),d=0;d<=u;++d)!(d<u&&r(h=c[d],d,c))===m&&((m=!m)?i.lineStart():i.lineEnd()),m&&i.point(+e(h,d,c),+t(h,d,c));if(f)return i=null,f+""||null}return l.x=function(c){return arguments.length?(e=typeof c=="function"?c:rs(+c),l):e},l.y=function(c){return arguments.length?(t=typeof c=="function"?c:rs(+c),l):t},l.defined=function(c){return arguments.length?(r=typeof c=="function"?c:rs(!!c),l):r},l.curve=function(c){return arguments.length?(a=c,s!=null&&(i=a(s)),l):a},l.context=function(c){return arguments.length?(c==null?s=i=null:i=a(s=c),l):s},l}function s1(e,t,r){var s=null,a=rs(!0),i=null,o=$C,l=null,c=RO(d);e=typeof e=="function"?e:e===void 0?mX:rs(+e),t=typeof t=="function"?t:rs(t===void 0?0:+t),r=typeof r=="function"?r:r===void 0?pX:rs(+r);function d(h){var m,f,p,A=(h=UO(h)).length,v,x=!1,b,y=new Array(A),w=new Array(A);for(i==null&&(l=o(b=c())),m=0;m<=A;++m){if(!(m<A&&a(v=h[m],m,h))===x)if(x=!x)f=m,l.areaStart(),l.lineStart();else{for(l.lineEnd(),l.lineStart(),p=m-1;p>=f;--p)l.point(y[p],w[p]);l.lineEnd(),l.areaEnd()}x&&(y[m]=+e(v,m,h),w[m]=+t(v,m,h),l.point(s?+s(v,m,h):y[m],r?+r(v,m,h):w[m]))}if(b)return l=null,b+""||null}function u(){return AX().defined(a).curve(o).context(i)}return d.x=function(h){return arguments.length?(e=typeof h=="function"?h:rs(+h
1200),s=null,d):e},d.x0=function(h){return arguments.length?(e=typeof h=="function"?h:rs(+h),d):e},d.x1=function(h){return arguments.length?(s=h==null?null:typeof h=="function"?h:rs(+h),d):s},d.y=function(h){return arguments.length?(t=typeof h=="function"?h:rs(+h),r=null,d):t},d.y0=function(h){return arguments.length?(t=typeof h=="function"?h:rs(+h),d):t},d.y1=function(h){return arguments.length?(r=h==null?null:typeof h=="function"?h:rs(+h),d):r},d.lineX0=d.lineY0=function(){return u().x(e).y(t)},d.lineY1=function(){return u().x(e).y(r)},d.lineX1=function(){return u().x(s).y(t)},d.defined=function(h){return arguments.length?(a=typeof h=="function"?h:rs(!!h),d):a},d.curve=function(h){return arguments.length?(o=h,i!=null&&(l=o(i)),d):o},d.context=function(h){return arguments.length?(h==null?i=l=null:l=o(i=h),d):i},d}class gX{constructor(t,r){this._context=t,this._x=r}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,r){switch(t=+t,r=+r,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,r,t,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,t,this._y0,t,r);break}}this._x0=t,this._y0=r}}function A4e(e){return new gX(e,!0)}function g4e(e){return new gX(e,!1)}const MO={draw(e,t){const r=Bc(t/M2);e.moveTo(r,0),e.arc(0,0,r,0,MC)}},x4e={draw(e,t){const r=Bc(t/5)/2;e.moveTo(-3*r,-r),e.lineTo(-r,-r),e.lineTo(-r,-3*r),e.lineTo(r,-3*r),e.lineTo(r,-r),e.lineTo(3*r,-r),e.lineTo(3*r,r),e.lineTo(r,r),e.lineTo(r,3*r),e.lineTo(-r,3*r),e.lineTo(-r,r),e.lineTo(-3*r,r),e.closePath()}},xX=Bc(1/3),v4e=xX*2,b4e={draw(e,t){const r=Bc(t/v4e),s=r*xX;e.moveTo(0,-r),e.lineTo(s,0),e.lineTo(0,r),e.lineTo(-s,0),e.closePath()}},y4e={draw(e,t){const r=Bc(t),s=-r/2;e.rect(s,s,r,r)}},w4e=.8908130915292852,vX=U2(M2/10)/U2(7*M2/10),j4e=U2(MC/10)*vX,N4e=-uX(MC/10)*vX,_4e={draw(e,t){const r=Bc(t*w4e),s=j4e*r,a=N4e*r;e.moveTo(0,-r),e.lineTo(s,a);for(let i=1;i<5;++i){const o=MC*i/5,l=uX(o),c=U2(o);e.lineTo(c*r,-l*r),e.lineTo(l*s-c*a,c*s+l*a)}e.closePath()}},M5=Bc(3),C4e={draw(e,t){const r=-Bc(t/(M5*3));e.moveTo(0,r*2),e.lineTo(-M5*r,-r),e.lineTo(M5*r,-r),e.closePath()}},bl=-.5,yl=Bc(3)/2,hT=1/Bc(12),S4e=(hT/2+1)*3,k4e={draw(e,t){const r=Bc(t/S4e),s=r/2,a=r*hT,i=s,o=r*hT+r,l=-i,c=o;e.moveTo(s,a),e.lineTo(i,o),e.lineTo(l,c),e.lineTo(bl*s-yl*a,yl*s+bl*a),e.lineTo(bl*i-yl*o,yl*i+bl*o),e.lineTo(bl*l-yl*c,yl*l+bl*c),e.lineTo(bl*s+yl*a,bl*a-yl*s),e.lineTo(bl*i+yl*o,bl*o-yl*i),e.lineTo(bl*l+yl*c,bl*c-yl*l),e.closePath()}};function E4e(e,t){let r=null,s=RO(a);e=typeof e=="function"?e:rs(e||MO),t=typeof t=="function"?t:rs(t===void 0?64:+t);function a(){let i;if(r||(r=i=s()),e.apply(this,arguments).draw(r,+t.apply(this,arguments)),i)return r=null,i+""||null}return a.type=function(i){return arguments.length?(e=typeof i=="function"?i:rs(i),a):e},a.size=function(i){return arguments.length?(t=typeof i=="function"?i:rs(+i),a):t},a.context=function(i){return arguments.length?(r=i??null,a):r},a}function $2(){}function Q2(e,t,r){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+r)/6)}function bX(e){this._context=e}bX.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Q2(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Q2(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function B4e(e){return new bX(e)}function yX(e){this._context=e}yX.prototype={areaStart:$2,areaEnd:$2,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:Q2(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function T4e(e){return new yX(e)}function wX(e){this._context=e}wX.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+e)/6,s=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(r,s):this._context.moveTo(r,s);break;case 3:this._point=4;default:Q2(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function P4e(e){return new wX(e)}function jX(e){this._context=e}jX.prototype={areaStart:$2,areaEnd:$2,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function I4e(e){return new jX(e)}function UM(e){return e<0?-1:1}function MM(e,t,r){var s=e._x1-e._x0,a=t-e._x1,i=(e._y1-e._y0)/(s||a<0&&-0),o=(r-e._y1)/(a||s<0&&-0),l=(i*a+o*s)/(s+a);
1200return(UM(i)+UM(o))*Math.min(Math.abs(i),Math.abs(o),.5*Math.abs(l))||0}function $M(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function $5(e,t,r){var s=e._x0,a=e._y0,i=e._x1,o=e._y1,l=(i-s)/3;e._context.bezierCurveTo(s+l,a+l*t,i-l,o-l*r,i,o)}function H2(e){this._context=e}H2.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:$5(this,this._t0,$M(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var r=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,$5(this,$M(this,r=MM(this,e,t)),r);break;default:$5(this,this._t0,r=MM(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}};function NX(e){this._context=new _X(e)}(NX.prototype=Object.create(H2.prototype)).point=function(e,t){H2.prototype.point.call(this,t,e)};function _X(e){this._context=e}_X.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,r,s,a,i){this._context.bezierCurveTo(t,e,s,r,i,a)}};function O4e(e){return new H2(e)}function F4e(e){return new NX(e)}function CX(e){this._context=e}CX.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,r=e.length;if(r)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),r===2)this._context.lineTo(e[1],t[1]);else for(var s=QM(e),a=QM(t),i=0,o=1;o<r;++i,++o)this._context.bezierCurveTo(s[0][i],a[0][i],s[1][i],a[1][i],e[o],t[o]);(this._line||this._line!==0&&r===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function QM(e){var t,r=e.length-1,s,a=new Array(r),i=new Array(r),o=new Array(r);for(a[0]=0,i[0]=2,o[0]=e[0]+2*e[1],t=1;t<r-1;++t)a[t]=1,i[t]=4,o[t]=4*e[t]+2*e[t+1];for(a[r-1]=2,i[r-1]=7,o[r-1]=8*e[r-1]+e[r],t=1;t<r;++t)s=a[t]/i[t-1],i[t]-=s,o[t]-=s*o[t-1];for(a[r-1]=o[r-1]/i[r-1],t=r-2;t>=0;--t)a[t]=(o[t]-a[t+1])/i[t];for(i[r-1]=(e[r]+a[r-1])/2,t=0;t<r-1;++t)i[t]=2*e[t+1]-a[t+1];return[a,i]}function L4e(e){return new CX(e)}function QC(e,t){this._context=e,this._t=t}QC.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var r=this._x*(1-this._t)+e*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,t)}break}}this._x=e,this._y=t}};function D4e(e){return new QC(e,.5)}function R4e(e){return new QC(e,0)}function U4e(e){return new QC(e,1)}function Ag(e,t){if((o=e.length)>1)for(var r=1,s,a,i=e[t[0]],o,l=i.length;r<o;++r)for(a=i,i=e[t[r]],s=0;s<l;++s)i[s][1]+=i[s][0]=isNaN(a[s][1])?a[s][0]:a[s][1]}function fT(e){for(var t=e.length,r=new Array(t);--t>=0;)r[t]=t;return r}function M4e(e,t){return e[t]}function $4e(e){const t=[];return t.key=e,t}function Q4e(){var e=rs([]),t=fT,r=Ag,s=M4e;function a(i){var o=Array.from(e.apply(this,arguments),$4e),l,c=o.length,d=-1,u;for(const h of i)for(l=0,++d;l<c;++l)(o[l][d]=[0,+s(h,o[l].key,d,i)]).data=h;for(l=0,u=UO(t(o));l<c;++l)o[u[l]].index=l;return r(o,u),o}return a.keys=function(i){return arguments.length?(e=typeof i=="function"?i:rs(Array.from(i)),a):e},a.value=function(i){return arguments.length?(s=typeof i=="function"?i:rs(+i),a):s},a.order=function(i){return arguments.length?(t=i==null?fT:typeof i=="function"?i:rs(Array.from(i)),a):t},a.offset=function(i){return arguments.length?(r=i??Ag,a):r},a}function H4e(e,t){if((s=e.length)>0){for(var r,s,a=0,i=e[0].length,o;a<i;++a){for(o=r=0;r<s;++r)o+=e[r][a][1]||0;if(o)for(r=0;r<s;++r)e[r][a][1]/=o}Ag(e,t)}}function z4e(e,t){if((a=e.length)>0){for(var r=0,s=e[t[0]],a,i=s.length;r<i;++r){for(var o=0,l=0;o<a;++o)l+=e[o][r][1]||0;s[r][1]+=s[r][0]=-l/2}Ag(e,t)}}function V4e(e,t){if(!(!((o=e.length)>0)||!((i=(a=e[t[0]]).length)>0))){for(var r=0,s=1,a,i,o;s<i;++s){for(var l=0,c=0,d=0;l<o;++l){for(var u=e[t[l]],h=u[s][1]||0,m=u[s-1][1]||0,f=(h-m)/2,p=0;p<l;
vendor: 7,413 bytes, lines 1200-1203
1200++p){var A=e[t[p]],v=A[s][1]||0,x=A[s-1][1]||0;f+=v-x}c+=h,d+=f*h}a[s-1][1]+=a[s-1][0]=r,c&&(r-=d/c)}a[s-1][1]+=a[s-1][0]=r,Ag(e,t)}}function gb(e){"@babel/helpers - typeof";return gb=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},gb(e)}var G4e=["type","size","sizeType"];function mT(){return mT=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},mT.apply(this,arguments)}function HM(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,s)}return r}function zM(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?HM(Object(r),!0).forEach(function(s){q4e(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):HM(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}function q4e(e,t,r){return t=K4e(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function K4e(e){var t=W4e(e,"string");return gb(t)=="symbol"?t:t+""}function W4e(e,t){if(gb(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(gb(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Y4e(e,t){if(e==null)return{};var r=J4e(e,t),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)s=i[a],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(r[s]=e[s])}return r}function J4e(e,t){if(e==null)return{};var r={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;r[s]=e[s]}return r}var SX={symbolCircle:MO,symbolCross:x4e,symbolDiamond:b4e,symbolSquare:y4e,symbolStar:_4e,symbolTriangle:C4e,symbolWye:k4e},X4e=Math.PI/180,Z4e=function(t){var r="symbol".concat(UC(t));return SX[r]||MO},eBe=function(t,r,s){if(r==="area")return t;switch(s){case"cross":return 5*t*t/9;case"diamond":return .5*t*t/Math.sqrt(3);case"square":return t*t;case"star":{var a=18*X4e;return 1.25*t*t*(Math.tan(a)-Math.tan(a*2)*Math.pow(Math.tan(a),2))}case"triangle":return Math.sqrt(3)*t*t/4;case"wye":return(21-10*Math.sqrt(3))*t*t/8;default:return Math.PI*t*t/4}},tBe=function(t,r){SX["symbol".concat(UC(t))]=r},$O=function(t){var r=t.type,s=r===void 0?"circle":r,a=t.size,i=a===void 0?64:a,o=t.sizeType,l=o===void 0?"area":o,c=Y4e(t,G4e),d=zM(zM({},c),{},{type:s,size:i,sizeType:l}),u=function(){var v=Z4e(s),x=E4e().type(v).size(eBe(i,l,s));return x()},h=d.className,m=d.cx,f=d.cy,p=Dt(d,!0);return m===+m&&f===+f&&i===+i?oe.createElement("path",mT({},p,{className:fr("recharts-symbols",h),transform:"translate(".concat(m,", ").concat(f,")"),d:u()})):null};$O.registerSymbol=tBe;function gg(e){"@babel/helpers - typeof";return gg=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},gg(e)}function pT(){return pT=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},pT.apply(this,arguments)}function VM(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,s)}return r}function rBe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?VM(Object(r),!0).forEach(function(s){xb(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):VM(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}function nBe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function sBe(e,t){for(var r=0;r<t.length;r++){var s=t[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,EX(s.key),s)}}function aBe(e,t,r){return t&&sBe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function iBe(e,t,r){return t=z2(t),oBe(e,kX()?Reflect.construct(t,r||[],z2(e).constructor):t.apply(e,r))}function oBe(e,t){if(t&&(gg(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return lBe(e)}function lBe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function kX(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(kX=function(){return!!e})()}function z2(e){return z2=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},z2(e)}function cBe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&AT(e,t)}function AT(e,t){return AT=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,a){return s.__proto__=a,s},AT(e,t)}function xb(e,t,r){return t=EX(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function EX(e){var t=dBe(e,"string");return gg(t)=="symbol"?t:t+""}function dBe(e,t){if(gg(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(gg(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var wl=32,QO=function(e){function t(){return nBe(this,t),iBe(this,t,arguments)}return cBe(t,e),aBe(t,[{key:"renderIcon",value:function(s){var a=this.props.inactiveColor,i=wl/2,o=wl/6,l=wl/3,c=s.inactive?a:s.color;if(s.type==="plainline")return oe.createElement("line",{strokeWidth:4,fill:"none",stroke:c,strokeDasharray:s.payload.strokeDasharray,x1:0,y1:i,x2:wl,y2:i,className:"recharts-legend-icon"});if(s.type==="line")return oe.createElement("path",{strokeWidth:4,fill:"none",stroke:c,d:"M0,".concat(i,"h").concat(l,`
1201            A`).concat(o,",").concat(o,",0,1,1,").concat(2*l,",").concat(i,`
1202            H`).concat(wl,"M").concat(2*l,",").concat(i,`
1203            A`).concat(o,",").concat(o,",0,1,1,").concat(l,",").concat(i),className:"recharts-legend-icon"});if(s.type==="rect")return oe.createElement("path",{stroke:"none",fill:c,d:"M0,".concat(wl/8,"h").concat(wl,"v").concat(wl*3/4,"h").concat(-wl,"z"),className:"recharts-legend-icon"});if(oe.isValidElement(s.legendIcon)){var d=rBe({},s);return delete d.legendIcon,oe.cloneElement(s.legendIcon,d)}return oe.createElement($O,{fill:c,cx:i,cy:i,size:wl,sizeType:"diameter",type:s.type})}},{key:"renderItems",value:function(){var s=this,a=this.props,i=a.payload,o=a.iconSize,l=a.layout,c=a.formatter,d=a.inactiveColor,u={x:0,y:0,width:wl,height:wl}
1203,h={display:l==="horizontal"?"inline-block":"block",marginRight:10},m={display:"inline-block",verticalAlign:"middle",marginRight:4};return i.map(function(f,p){var A=f.formatter||c,v=fr(xb(xb({"recharts-legend-item":!0},"legend-item-".concat(p),!0),"inactive",f.inactive));if(f.type==="none")return null;var x=er(f.value)?null:f.value;yc(!er(f.value),`The name property is also required when using a function for the dataKey of a chart's cartesian components. Ex: <Bar name="Name of my Data"/>`);var b=f.inactive?d:f.color;return oe.createElement("li",pT({className:v,style:h,key:"legend-item-".concat(p)},Mm(s.props,f,p)),oe.createElement(iT,{width:o,height:o,viewBox:u,style:m},s.renderIcon(f)),oe.createElement("span",{className:"recharts-legend-item-text",style:{color:b}},A?A(x,f,p):x))})}},{key:"render",value:function(){var s=this.props,a=s.payload,i=s.layout,o=s.align;if(!a||!a.length)return null;var l={padding:0,margin:0,textAlign:i==="horizontal"?o:"left"};return oe.createElement("ul",{className:"recharts-default-legend",style:l},this.renderItems())}}])}(g.PureComponent);xb(QO,"displayName","Legend");xb(QO,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var uBe=CC;function hBe(){this.__data__=new uBe,this.size=0}var fBe=hBe;function mBe(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}var pBe=mBe;function ABe(e){return this.__data__.get(e)}var gBe=ABe;function xBe(e){return this.__data__.has(e)}var vBe=xBe,bBe=CC,yBe=EO,wBe=BO,jBe=200;function NBe(e,t){var r=this.__data__;if(r instanceof bBe){var s=r.__data__;if(!yBe||s.length<jBe-1)return s.push([e,t]),this.size=++r.size,this;r=this.__data__=new wBe(s)}return r.set(e,t),this.size=r.size,this}var _Be=NBe,CBe=CC,SBe=fBe,kBe=pBe,EBe=gBe,BBe=vBe,TBe=_Be;function p0(e){var t=this.__data__=new CBe(e);this.size=t.size}p0.prototype.clear=SBe;p0.prototype.delete=kBe;p0.prototype.get=EBe;p0.prototype.has=BBe;p0.prototype.set=TBe;var BX=p0,PBe="__lodash_hash_undefined__";function IBe(e){return this.__data__.set(e,PBe),this}var OBe=IBe;function FBe(e){return this.__data__.has(e)}var LBe=FBe,DBe=BO,RBe=OBe,UBe=LBe;function V2(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new DBe;++t<r;)this.add(e[t])}V2.prototype.add=V2.prototype.push=RBe;V2.prototype.has=UBe;var TX=V2;function MBe(e,t){for(var r=-1,s=e==null?0:e.length;++r<s;)if(t(e[r],r,e))return!0;return!1}var PX=MBe;function $Be(e,t){return e.has(t)}var IX=$Be,QBe=TX,HBe=PX,zBe=IX,VBe=1,GBe=2;function qBe(e,t,r,s,a,i){var o=r&VBe,l=e.length,c=t.length;if(l!=c&&!(o&&c>l))return!1;var d=i.get(e),u=i.get(t);if(d&&u)return d==t&&u==e;var h=-1,m=!0,f=r&GBe?new QBe:void 0;for(i.set(e,t),i.set(t,e);++h<l;){var p=e[h],A=t[h];if(s)var v=o?s(A,p,h,t,e,i):s(p,A,h,e,t,i);if(v!==void 0){if(v)continue;m=!1;break}if(f){if(!HBe(t,function(x,b){if(!zBe(f,b)&&(p===x||a(p,x,r,s,i)))return f.push(b)})){m=!1;break}}else if(!(p===A||a(p,A,r,s,i))){m=!1;break}}return i.delete(e),i.delete(t),m}var OX=qBe,KBe=Nd,WBe=KBe.Uint8Array,YBe=WBe;function JBe(e){var t=-1,r=Array(e.size);return e.forEach(function(s,a){r[++t]=[a,s]}),r}var XBe=JBe;function ZBe(e){var t=-1,r=Array(e.size);return e.forEach(function(s){r[++t]=s}),r}var HO=ZBe,GM=Dy,qM=YBe,eTe=kO,tTe=OX,rTe=XBe,nTe=HO,sTe=1,aTe=2,iTe="[object Boolean]",oTe="[object Date]",lTe="[object Error]",cTe="[object Map]",dTe="[object Number]",uTe="[object RegExp]",hTe="[object Set]",fTe="[object String]",mTe="[object Symbol]",pTe="[object ArrayBuffer]",ATe="[object DataView]",KM=GM?GM.prototype:void 0,Q5=KM?KM.valueOf:void 0;function gTe(e,t,r,s,a,i,o){switch(r){case ATe:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case pTe:return!(e.byteLength!=t.byteLength||!i(new qM(e),new qM(t)));case iTe:case oTe:case dTe:return eTe(+e,+t);case lTe:return e.name==t.name&&e.message==t.message;case uTe:case fTe:return e==t+"";case cTe:var l=rTe;case hTe:var c=s&sTe;if(l||(l=nTe),e.size!=t.size&&!c)return!1;var d=o.get(e);if(d)return d==t;s|=aTe,o.set(e,t);var u=tTe(l(e),l(t),s,a,i,o);return o.delete(e),u;case mTe:if(Q5)return Q5.call(e)==Q5.call(t)}return!1}var xTe=gTe;function vTe(e,t){for(var r=-1,s=t.length,a=e.length;++r<s;)e[a+r]=t[r];return e}var FX=vTe,bTe=FX,yTe=vo;function wTe(e,t,r){var s=t(e);return yTe(e)?s:bTe(s,r(e))}var jTe=wTe;function NTe(e,t){for(var r=-1,s=e==null?0:e.length,a=0,i=[];++r<s;){var o=e[r];t(o,r,e)&&(i[a++]=o)}return i}var _Te=NTe;function CTe(){return[]}var STe=CTe,kTe=_Te,ETe=STe,BTe=Object.prototype,TTe=BTe.propertyIsEnumerable,WM=Object.getOwnPropertySymbols,PTe=WM?function(e){return e==null?[]:(e=Object(e),kTe(WM(e),function(t){return TTe.call(e,t)}))}:ETe,ITe=PTe;function OTe(e,t){for(var r=-1,s=Array(e);++r<e;)s[r]=t(r);return s}var FTe=OTe,LTe=Du,DTe=Ru,RTe="[object Arguments]";function UTe(e){return DTe(e)&&LTe(e)==RTe}var MTe=UTe,YM=MTe,$Te=Ru,LX=Object.prototype,QTe=LX.hasOwnProperty,HTe=LX.propertyIsEnumerable,zTe=YM(function(){return arguments}())?YM:function(e){return $Te(e)&&QTe.call(e,"callee")&&!HTe.call(e,"callee")},zO=zTe,G2={exports:{}};function VTe(){return!1}var GTe=VTe;G2.exports;(function(e,t){var r=Nd,s=GTe,a=t&&!t.nodeType&&t,i=a&&!0&&e&&!e.nodeType&&e,o=i&&i.exports===a,l=o?r.Buffer:void 0,c=l?l.isBuffer:void 0,d=c||s;e.exports=d})(G2,G2.exports);var DX=G2.exports,qTe=9007199254740991,KTe=/^(?:0|[1-9]\d*)$/;function WTe(e,t){var r=typeof e;return t=t??qTe,!!t&&(r=="number"||r!="symbol"&&KTe.test(e))&&e>-1&&e%1==0&&e<t}var VO=WTe,YTe=9007199254740991;function JTe(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=YTe}var GO=JTe,XTe=Du,ZTe=GO,e3e=Ru,t3e="[object Arguments]",r3e="[object Array]",n3e="[object Boolean]",s3e="[object Date]",a3e="[object Error]",i3e="[object Function]",o3e="[object Map]",l3e="[object Number]",c3e="[object Object]",d3e="[object RegExp]",u3e="[object Set]",h3e="[object String]",f3e="[object WeakMap]",m3e="[object ArrayBuffer]",p3e="[object DataView]",A3e="[object Float32Array]",g3e="[object Float64Array
1203]",x3e="[object Int8Array]",v3e="[object Int16Array]",b3e="[object Int32Array]",y3e="[object Uint8Array]",w3e="[object Uint8ClampedArray]",j3e="[object Uint16Array]",N3e="[object Uint32Array]",ls={};ls[A3e]=ls[g3e]=ls[x3e]=ls[v3e]=ls[b3e]=ls[y3e]=ls[w3e]=ls[j3e]=ls[N3e]=!0;ls[t3e]=ls[r3e]=ls[m3e]=ls[n3e]=ls[p3e]=ls[s3e]=ls[a3e]=ls[i3e]=ls[o3e]=ls[l3e]=ls[c3e]=ls[d3e]=ls[u3e]=ls[h3e]=ls[f3e]=!1;function _3e(e){return e3e(e)&&ZTe(e.length)&&!!ls[XTe(e)]}var C3e=_3e;function S3e(e){return function(t){return e(t)}}var RX=S3e,q2={exports:{}};q2.exports;(function(e,t){var r=VJ,s=t&&!t.nodeType&&t,a=s&&!0&&e&&!e.nodeType&&e,i=a&&a.exports===s,o=i&&r.process,l=function(){try{var c=a&&a.require&&a.require("util").types;return c||o&&o.binding&&o.binding("util")}catch{}}();e.exports=l})(q2,q2.exports);var k3e=q2.exports,E3e=C3e,B3e=RX,JM=k3e,XM=JM&&JM.isTypedArray,T3e=XM?B3e(XM):E3e,UX=T3e,P3e=FTe,I3e=zO,O3e=vo,F3e=DX,L3e=VO,D3e=UX,R3e=Object.prototype,U3e=R3e.hasOwnProperty;function M3e(e,t){var r=O3e(e),s=!r&&I3e(e),a=!r&&!s&&F3e(e),i=!r&&!s&&!a&&D3e(e),o=r||s||a||i,l=o?P3e(e.length,String):[],c=l.length;for(var d in e)(t||U3e.call(e,d))&&!(o&&(d=="length"||a&&(d=="offset"||d=="parent")||i&&(d=="buffer"||d=="byteLength"||d=="byteOffset")||L3e(d,c)))&&l.push(d);return l}var $3e=M3e,Q3e=Object.prototype;function H3e(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||Q3e;return e===r}var z3e=H3e;function V3e(e,t){return function(r){return e(t(r))}}var MX=V3e,G3e=MX,q3e=G3e(Object.keys,Object),K3e=q3e,W3e=z3e,Y3e=K3e,J3e=Object.prototype,X3e=J3e.hasOwnProperty;function Z3e(e){if(!W3e(e))return Y3e(e);var t=[];for(var r in Object(e))X3e.call(e,r)&&r!="constructor"&&t.push(r);return t}var ePe=Z3e,tPe=SO,rPe=GO;function nPe(e){return e!=null&&rPe(e.length)&&!tPe(e)}var Ry=nPe,sPe=$3e,aPe=ePe,iPe=Ry;function oPe(e){return iPe(e)?sPe(e):aPe(e)}var HC=oPe,lPe=jTe,cPe=ITe,dPe=HC;function uPe(e){return lPe(e,dPe,cPe)}var hPe=uPe,ZM=hPe,fPe=1,mPe=Object.prototype,pPe=mPe.hasOwnProperty;function APe(e,t,r,s,a,i){var o=r&fPe,l=ZM(e),c=l.length,d=ZM(t),u=d.length;if(c!=u&&!o)return!1;for(var h=c;h--;){var m=l[h];if(!(o?m in t:pPe.call(t,m)))return!1}var f=i.get(e),p=i.get(t);if(f&&p)return f==t&&p==e;var A=!0;i.set(e,t),i.set(t,e);for(var v=o;++h<c;){m=l[h];var x=e[m],b=t[m];if(s)var y=o?s(b,x,m,t,e,i):s(x,b,m,e,t,i);if(!(y===void 0?x===b||a(x,b,r,s,i):y)){A=!1;break}v||(v=m=="constructor")}if(A&&!v){var w=e.constructor,j=t.constructor;w!=j&&"constructor"in e&&"constructor"in t&&!(typeof w=="function"&&w instanceof w&&typeof j=="function"&&j instanceof j)&&(A=!1)}return i.delete(e),i.delete(t),A}var gPe=APe,xPe=np,vPe=Nd,bPe=xPe(vPe,"DataView"),yPe=bPe,wPe=np,jPe=Nd,NPe=wPe(jPe,"Promise"),_Pe=NPe,CPe=np,SPe=Nd,kPe=CPe(SPe,"Set"),$X=kPe,EPe=np,BPe=Nd,TPe=EPe(BPe,"WeakMap"),PPe=TPe,gT=yPe,xT=EO,vT=_Pe,bT=$X,yT=PPe,QX=Du,A0=qJ,e8="[object Map]",IPe="[object Object]",t8="[object Promise]",r8="[object Set]",n8="[object WeakMap]",s8="[object DataView]",OPe=A0(gT),FPe=A0(xT),LPe=A0(vT),DPe=A0(bT),RPe=A0(yT),Kf=QX;(gT&&Kf(new gT(new ArrayBuffer(1)))!=s8||xT&&Kf(new xT)!=e8||vT&&Kf(vT.resolve())!=t8||bT&&Kf(new bT)!=r8||yT&&Kf(new yT)!=n8)&&(Kf=function(e){var t=QX(e),r=t==IPe?e.constructor:void 0,s=r?A0(r):"";if(s)switch(s){case OPe:return s8;case FPe:return e8;case LPe:return t8;case DPe:return r8;case RPe:return n8}return t});var UPe=Kf,H5=BX,MPe=OX,$Pe=xTe,QPe=gPe,a8=UPe,i8=vo,o8=DX,HPe=UX,zPe=1,l8="[object Arguments]",c8="[object Array]",a1="[object Object]",VPe=Object.prototype,d8=VPe.hasOwnProperty;function GPe(e,t,r,s,a,i){var o=i8(e),l=i8(t),c=o?c8:a8(e),d=l?c8:a8(t);c=c==l8?a1:c,d=d==l8?a1:d;var u=c==a1,h=d==a1,m=c==d;if(m&&o8(e)){if(!o8(t))return!1;o=!0,u=!1}if(m&&!u)return i||(i=new H5),o||HPe(e)?MPe(e,t,r,s,a,i):$Pe(e,t,c,r,s,a,i);if(!(r&zPe)){var f=u&&d8.call(e,"__wrapped__"),p=h&&d8.call(t,"__wrapped__");
vendor: 4,112 bytes, line 1203
1203if(f||p){var A=f?e.value():e,v=p?t.value():t;return i||(i=new H5),a(A,v,r,s,i)}}return m?(i||(i=new H5),QPe(e,t,r,s,a,i)):!1}var qPe=GPe,KPe=qPe,u8=Ru;function HX(e,t,r,s,a){return e===t?!0:e==null||t==null||!u8(e)&&!u8(t)?e!==e&&t!==t:KPe(e,t,r,s,HX,a)}var qO=HX,WPe=BX,YPe=qO,JPe=1,XPe=2;function ZPe(e,t,r,s){var a=r.length,i=a,o=!s;if(e==null)return!i;for(e=Object(e);a--;){var l=r[a];if(o&&l[2]?l[1]!==e[l[0]]:!(l[0]in e))return!1}for(;++a<i;){l=r[a];var c=l[0],d=e[c],u=l[1];if(o&&l[2]){if(d===void 0&&!(c in e))return!1}else{var h=new WPe;if(s)var m=s(d,u,c,e,t,h);if(!(m===void 0?YPe(u,d,JPe|XPe,s,h):m))return!1}}return!0}var eIe=ZPe,tIe=cf;function rIe(e){return e===e&&!tIe(e)}var zX=rIe,nIe=zX,sIe=HC;function aIe(e){for(var t=sIe(e),r=t.length;r--;){var s=t[r],a=e[s];t[r]=[s,a,nIe(a)]}return t}var iIe=aIe;function oIe(e,t){return function(r){return r==null?!1:r[e]===t&&(t!==void 0||e in Object(r))}}var VX=oIe,lIe=eIe,cIe=iIe,dIe=VX;function uIe(e){var t=cIe(e);return t.length==1&&t[0][2]?dIe(t[0][0],t[0][1]):function(r){return r===e||lIe(r,e,t)}}var hIe=uIe;function fIe(e,t){return e!=null&&t in Object(e)}var mIe=fIe,pIe=XJ,AIe=zO,gIe=vo,xIe=VO,vIe=GO,bIe=kC;function yIe(e,t,r){t=pIe(t,e);for(var s=-1,a=t.length,i=!1;++s<a;){var o=bIe(t[s]);if(!(i=e!=null&&r(e,o)))break;e=e[o]}return i||++s!=a?i:(a=e==null?0:e.length,!!a&&vIe(a)&&xIe(o,a)&&(gIe(e)||AIe(e)))}var wIe=yIe,jIe=mIe,NIe=wIe;function _Ie(e,t){return e!=null&&NIe(e,t,jIe)}var CIe=_Ie,SIe=qO,kIe=ZJ,EIe=CIe,BIe=CO,TIe=zX,PIe=VX,IIe=kC,OIe=1,FIe=2;function LIe(e,t){return BIe(e)&&TIe(t)?PIe(IIe(e),t):function(r){var s=kIe(r,e);return s===void 0&&s===t?EIe(r,e):SIe(t,s,OIe|FIe)}}var DIe=LIe;function RIe(e){return e}var g0=RIe;function UIe(e){return function(t){return t==null?void 0:t[e]}}var MIe=UIe,$Ie=IO;function QIe(e){return function(t){return $Ie(t,e)}}var HIe=QIe,zIe=MIe,VIe=HIe,GIe=CO,qIe=kC;function KIe(e){return GIe(e)?zIe(qIe(e)):VIe(e)}var WIe=KIe,YIe=hIe,JIe=DIe,XIe=g0,ZIe=vo,eOe=WIe;function tOe(e){return typeof e=="function"?e:e==null?XIe:typeof e=="object"?ZIe(e)?JIe(e[0],e[1]):YIe(e):eOe(e)}var _d=tOe;function rOe(e,t,r,s){for(var a=e.length,i=r+(s?1:-1);s?i--:++i<a;)if(t(e[i],i,e))return i;return-1}var GX=rOe;function nOe(e){return e!==e}var sOe=nOe;function aOe(e,t,r){for(var s=r-1,a=e.length;++s<a;)if(e[s]===t)return s;return-1}var iOe=aOe,oOe=GX,lOe=sOe,cOe=iOe;function dOe(e,t,r){return t===t?cOe(e,t,r):oOe(e,lOe,r)}var uOe=dOe,hOe=uOe;function fOe(e,t){var r=e==null?0:e.length;return!!r&&hOe(e,t,0)>-1}var mOe=fOe;function pOe(e,t,r){for(var s=-1,a=e==null?0:e.length;++s<a;)if(r(t,e[s]))return!0;return!1}var AOe=pOe;function gOe(){}var xOe=gOe,z5=$X,vOe=xOe,bOe=HO,yOe=1/0,wOe=z5&&1/bOe(new z5([,-0]))[1]==yOe?function(e){return new z5(e)}:vOe,jOe=wOe,NOe=TX,_Oe=mOe,COe=AOe,SOe=IX,kOe=jOe,EOe=HO,BOe=200;function TOe(e,t,r){var s=-1,a=_Oe,i=e.length,o=!0,l=[],c=l;if(r)o=!1,a=COe;else if(i>=BOe){var d=t?null:kOe(e);if(d)return EOe(d);o=!1,a=SOe,c=new NOe}else c=t?[]:l;e:for(;++s<i;){var u=e[s],h=t?t(u):u;if(u=r||u!==0?u:0,o&&h===h){for(var m=c.length;m--;)if(c[m]===h)continue e;t&&c.push(h),l.push(u)}else a(c,h,r)||(c!==l&&c.push(h),l.push(u))}return l}var POe=TOe,IOe=_d,OOe=POe;function FOe(e,t){return e&&e.length?OOe(e,IOe(t)):[]}var LOe=FOe;const h8=wn(LOe);function qX(e,t,r){return t===!0?h8(e,r):er(t)?h8(e,t):e}function xg(e){"@babel/helpers - typeof";return xg=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},xg(e)}var DOe=["ref"];function f8(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,s)}return r}function Gd(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?f8(Object(r),!0).forEach(function(s){zC(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):f8(Object(r)).forEac
vendor: 4,254 bytes, line 1203
1203h(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}function ROe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function m8(e,t){for(var r=0;r<t.length;r++){var s=t[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,WX(s.key),s)}}function UOe(e,t,r){return t&&m8(e.prototype,t),r&&m8(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function MOe(e,t,r){return t=K2(t),$Oe(e,KX()?Reflect.construct(t,r||[],K2(e).constructor):t.apply(e,r))}function $Oe(e,t){if(t&&(xg(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return QOe(e)}function QOe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function KX(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(KX=function(){return!!e})()}function K2(e){return K2=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},K2(e)}function HOe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&wT(e,t)}function wT(e,t){return wT=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,a){return s.__proto__=a,s},wT(e,t)}function zC(e,t,r){return t=WX(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function WX(e){var t=zOe(e,"string");return xg(t)=="symbol"?t:t+""}function zOe(e,t){if(xg(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(xg(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function VOe(e,t){if(e==null)return{};var r=GOe(e,t),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)s=i[a],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(r[s]=e[s])}return r}function GOe(e,t){if(e==null)return{};var r={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;r[s]=e[s]}return r}function qOe(e){return e.value}function KOe(e,t){if(oe.isValidElement(e))return oe.cloneElement(e,t);if(typeof e=="function")return oe.createElement(e,t);t.ref;var r=VOe(t,DOe);return oe.createElement(QO,r)}var p8=1,Mi=function(e){function t(){var r;ROe(this,t);for(var s=arguments.length,a=new Array(s),i=0;i<s;i++)a[i]=arguments[i];return r=MOe(this,t,[].concat(a)),zC(r,"lastBoundingBox",{width:-1,height:-1}),r}return HOe(t,e),UOe(t,[{key:"componentDidMount",value:function(){this.updateBBox()}},{key:"componentDidUpdate",value:function(){this.updateBBox()}},{key:"getBBox",value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var s=this.wrapperNode.getBoundingClientRect();return s.height=this.wrapperNode.offsetHeight,s.width=this.wrapperNode.offsetWidth,s}return null}},{key:"updateBBox",value:function(){var s=this.props.onBBoxUpdate,a=this.getBBox();a?(Math.abs(a.width-this.lastBoundingBox.width)>p8||Math.abs(a.height-this.lastBoundingBox.height)>p8)&&(this.lastBoundingBox.width=a.width,this.lastBoundingBox.height=a.height,s&&s(a)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,s&&s(null))}},{key:"getBBoxSnapshot",value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?Gd({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(s){var a=this.props,i=a.layout,o=a.align,l=a.verticalAlign,c=a.margin,d=a.chartWidth,u=a.chartHeight,h,m;if(!s||(s.left===void 0||s.left===null)&&(s.right===void 0||s.right===null))if(o==="center"&&i==="vertical"){var f=this.getBBoxSnapshot();h={left:((d||0)-f.width)/2}}else h=o==="right"?{right:c&&c.right||0}:{left:c&&c.left||0};if(!s||(s.top===void 0||s.top===null)&&(s.bottom===void 0||s.bottom===null))if(l==="middle"){var p=this.getBBoxSnapsh
1203ot();m={top:((u||0)-p.height)/2}}else m=l==="bottom"?{bottom:c&&c.bottom||0}:{top:c&&c.top||0};return Gd(Gd({},h),m)}},{key:"render",value:function(){var s=this,a=this.props,i=a.content,o=a.width,l=a.height,c=a.wrapperStyle,d=a.payloadUniqBy,u=a.payload,h=Gd(Gd({position:"absolute",width:o||"auto",height:l||"auto"},this.getDefaultPosition(c)),c);return oe.createElement("div",{className:"recharts-legend-wrapper",style:h,ref:function(f){s.wrapperNode=f}},KOe(i,Gd(Gd({},this.props),{},{payload:qX(u,d,qOe)})))}}],[{key:"getWithHeight",value:function(s,a){var i=Gd(Gd({},this.defaultProps),s.props),o=i.layout;return o==="vertical"&&lt(s.props.height)?{height:s.props.height}:o==="horizontal"?{width:s.props.width||a}:null}}])}(g.PureComponent);zC(Mi,"displayName","Legend");zC(Mi,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var A8=Dy,WOe=zO,YOe=vo,g8=A8?A8.isConcatSpreadable:void 0;function JOe(e){return YOe(e)||WOe(e)||!!(g8&&e&&e[g8])}var XOe=JOe,ZOe=FX,eFe=XOe;function YX(e,t,r,s,a){var i=-1,o=e.length;for(r||(r=eFe),a||(a=[]);++i<o;){var l=e[i];t>0&&r(l)?t>1?YX(l,t-1,r,s,a):ZOe(a,l):s||(a[a.length]=l)}return a}var JX=YX;function tFe(e){return function(t,r,s){for(var a=-1,i=Object(t),o=s(t),l=o.length;l--;){var c=o[e?l:++a];if(r(i[c],c,i)===!1)break}return t}}var rFe=tFe,nFe=rFe,sFe=nFe(),aFe=sFe,iFe=aFe,oFe=HC;function lFe(e,t){return e&&iFe(e,t,oFe)}var XX=lFe,cFe=Ry;function dFe(e,t){return function(r,s){if(r==null)return r;if(!cFe(r))return e(r,s);for(var a=r.length,i=t?a:-1,o=Object(r);(t?i--:++i<a)&&s(o[i],i,o)!==!1;);return r}}var uFe=dFe,hFe=XX,fFe=uFe,mFe=fFe(hFe),KO=mFe,pFe=KO,AFe=Ry;function gFe(e,t){var r=-1,s=AFe(e)?Array(e.length):[];return pFe(e,function(a,i,o){s[++r]=t(a,i,o)}),s}var ZX=gFe;function xFe(e,t){var r=e.length;for(e.sort(t);r--;)e[r]=e[r].value;return e}var vFe=xFe,x8=c0;function bFe(e,t){if(e!==t){var r=e!==void 0,s=e===null,a=e===e,i=x8(e),o=t!==void 0,l=t===null,c=t===t,d=x8(t);if(!l&&!d&&!i&&e>t||i&&o&&c&&!l&&!d||s&&o&&c||!r&&c||!a)return 1;if(!s&&!i&&!d&&e<t||d&&r&&a&&!s&&!i||l&&r&&a||!o&&a||!c)return-1}return 0}var yFe=bFe,wFe=yFe;function jFe(e,t,r){for(var s=-1,a=e.criteria,i=t.criteria,o=a.length,l=r.length;++s<o;){var c=wFe(a[s],i[s]);if(c){if(s>=l)return c;var d=r[s];return c*(d=="desc"?-1:1)}}return e.index-t.index}var NFe=jFe,V5=PO,_Fe=IO,CFe=_d,SFe=ZX,kFe=vFe,EFe=RX,BFe=NFe,TFe=g0,PFe=vo;function IFe(e,t,r){t.length?t=V5(t,function(i){return PFe(i)?function(o){return _Fe(o,i.length===1?i[0]:i)}:i}):t=[TFe];var s=-1;t=V5(t,EFe(CFe));var a=SFe(e,function(i,o,l){var c=V5(t,function(d){return d(i)});return{criteria:c,index:++s,value:i}});return kFe(a,function(i,o){return BFe(i,o,r)})}var OFe=IFe;function FFe(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}var LFe=FFe,DFe=LFe,v8=Math.max;function RFe(e,t,r){return t=v8(t===void 0?e.length-1:t,0),function(){for(var s=arguments,a=-1,i=v8(s.length-t,0),o=Array(i);++a<i;)o[a]=s[t+a];a=-1;for(var l=Array(t+1);++a<t;)l[a]=s[a];return l[t]=r(o),DFe(e,this,l)}}var UFe=RFe;function MFe(e){return function(){return e}}var $Fe=MFe,QFe=np,HFe=function(){try{var e=QFe(Object,"defineProperty");return e({},"",{}),e}catch{}}(),eZ=HFe,zFe=$Fe,b8=eZ,VFe=g0,GFe=b8?function(e,t){return b8(e,"toString",{configurable:!0,enumerable:!1,value:zFe(t),writable:!0})}:VFe,qFe=GFe,KFe=800,WFe=16,YFe=Date.now;function JFe(e){var t=0,r=0;return function(){var s=YFe(),a=WFe-(s-r);if(r=s,a>0){if(++t>=KFe)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var XFe=JFe,ZFe=qFe,e6e=XFe,t6e=e6e(ZFe),r6e=t6e,n6e=g0,s6e=UFe,a6e=r6e;function i6e(e,t){return a6e(s6e(e,t,n6e),e+"")}var o6e=i6e,l6e=kO,c6e=Ry,d6e=VO,u6e=cf;function h6e(e,t,r){if(!u6e(r))return!1;var s=typeof t;return(s=="number"?c6e(r)&&d6e(t,r.length):s=="string"&&t in r)?l6e(r[t],e):!1}var VC=h6e,f6e=JX,m6e=OFe,p6e=o6e,y8=VC,A6e=p6e(function(e,t){if(e==null)return[];var r=t.length;return r>1&&y8(e,t[0],t[1])?t=[]:r>2&&y8(t[0],t[1],t[2])&&(t=[t[0]]),m6e(e,f6e(t,1),[])}),g6e=A6e;const WO=wn(g6e);function vb(e){"@babel/helpers - typeof";return vb=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},vb(e)}function jT(){return jT=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];
vendor: 15,066 bytes, lines 1203-1204
1203for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},jT.apply(this,arguments)}function x6e(e,t){return w6e(e)||y6e(e,t)||b6e(e,t)||v6e()}function v6e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1204In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function b6e(e,t){if(e){if(typeof e=="string")return w8(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return w8(e,t)}}function w8(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,s=new Array(t);r<t;r++)s[r]=e[r];return s}function y6e(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var s,a,i,o,l=[],c=!0,d=!1;try{if(i=(r=r.call(e)).next,t!==0)for(;!(c=(s=i.call(r)).done)&&(l.push(s.value),l.length!==t);c=!0);}catch(u){d=!0,a=u}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(d)throw a}}return l}}function w6e(e){if(Array.isArray(e))return e}function j8(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,s)}return r}function G5(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?j8(Object(r),!0).forEach(function(s){j6e(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):j8(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}function j6e(e,t,r){return t=N6e(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function N6e(e){var t=_6e(e,"string");return vb(t)=="symbol"?t:t+""}function _6e(e,t){if(vb(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(vb(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function C6e(e){return Array.isArray(e)&&Da(e[0])&&Da(e[1])?e.join(" ~ "):e}var S6e=function(t){var r=t.separator,s=r===void 0?" : ":r,a=t.contentStyle,i=a===void 0?{}:a,o=t.itemStyle,l=o===void 0?{}:o,c=t.labelStyle,d=c===void 0?{}:c,u=t.payload,h=t.formatter,m=t.itemSorter,f=t.wrapperClassName,p=t.labelClassName,A=t.label,v=t.labelFormatter,x=t.accessibilityLayer,b=x===void 0?!1:x,y=function(){if(u&&u.length){var B={padding:0,margin:0},L=(m?WO(u,m):u).map(function(P,F){if(P.type==="none")return null;var M=G5({display:"block",paddingTop:4,paddingBottom:4,color:P.color||"#000"},l),I=P.formatter||h||C6e,$=P.value,V=P.name,R=$,Q=V;if(I&&R!=null&&Q!=null){var U=I($,V,P,F,u);if(Array.isArray(U)){var D=x6e(U,2);R=D[0],Q=D[1]}else R=U}return oe.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(F),style:M},Da(Q)?oe.createElement("span",{className:"recharts-tooltip-item-name"},Q):null,Da(Q)?oe.createElement("span",{className:"recharts-tooltip-item-separator"},s):null,oe.createElement("span",{className:"recharts-tooltip-item-value"},R),oe.createElement("span",{className:"recharts-tooltip-item-unit"},P.unit||""))});return oe.createElement("ul",{className:"recharts-tooltip-item-list",style:B},L)}return null},w=G5({margin:0,padding:10,backgroundColor:"#fff",border:"1px solid #ccc",whiteSpace:"nowrap"},i),j=G5({margin:0},d),N=!wr(A),_=N?A:"",S=fr("recharts-default-tooltip",f),C=fr("recharts-tooltip-label",p);N&&v&&u!==void 0&&u!==null&&(_=v(A,u));var E=b?{role:"status","aria-live":"assertive"}:{};return oe.createElement("div",jT({className:S,style:w},E),oe.createElement("p",{className:C,style:j},oe.isValidElement(_)?_:"".concat(_)),y())};function bb(e){"@babel/helpers - typeof";return bb=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},bb(e)}function i1(e,t,r){return t=k6e(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function k6e(e){var t=E6e(e,"string");return bb(t)=="symbol"?t:t+""}function E6e(e,t){if(bb(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(bb(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Ax="recharts-tooltip-wrapper",B6e={visibility:"hidden"};function T6e(e){var t=e.coordinate,r=e.translateX,s=e.translateY;return fr(Ax,i1(i1(i1(i1({},"".concat(Ax,"-right"),lt(r)&&t&&lt(t.x)&&r>=t.x),"".concat(Ax,"-left"),lt(r)&&t&&lt(t.x)&&r<t.x),"".concat(Ax,"-bottom"),lt(s)&&t&&lt(t.y)&&s>=t.y),"".concat(Ax,"-top"),lt(s)&&t&&lt(t.y)&&s<t.y))}function N8(e){var t=e.allowEscapeViewBox,r=e.coordinate,s=e.key,a=e.offsetTopLeft,i=e.position,o=e.reverseDirection,l=e.tooltipDimension,c=e.viewBox,d=e.viewBoxDimension;if(i&&lt(i[s]))return i[s];var u=r[s]-l-a,h=r[s]+a;if(t[s])return o[s]?u:h;if(o[s]){var m=u,f=c[s];return m<f?Math.max(h,c[s]):Math.max(u,c[s])}var p=h+l,A=c[s]+d;return p>A?Math.max(u,c[s]):Math.max(h,c[s])}function P6e(e){var t=e.translateX,r=e.translateY,s=e.useTranslate3d;return{transform:s?"translate3d(".concat(t,"px, ").concat(r,"px, 0)"):"translate(".concat(t,"px, ").concat(r,"px)")}}function I6e(e){var t=e.allowEscapeViewBox,r=e.coordinate,s=e.offsetTopLeft,a=e.position,i=e.reverseDirection,o=e.tooltipBox,l=e.useTranslate3d,c=e.viewBox,d,u,h;return o.height>0&&o.width>0&&r?(u=N8({allowEscapeViewBox:t,coordinate:r,key:"x",offsetTopLeft:s,position:a,reverseDirection:i,tooltipDimension:o.width,viewBox:c,viewBoxDimension:c.width}),h=N8({allowEscapeViewBox:t,coordinate:r,key:"y",offsetTopLeft:s,position:a,reverseDirection:i,tooltipDimension:o.height,viewBox:c,viewBoxDimension:c.height}),d=P6e({translateX:u,translateY:h,useTranslate3d:l})):d=B6e,{cssProperties:d,cssClasses:T6e({translateX:u,translateY:h,coordinate:r})}}function vg(e){"@babel/helpers - typeof";return vg=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},vg(e)}function _8(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,s)}return r}function C8(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?_8(Object(r),!0).forEach(function(s){_T(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):_8(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}function O6e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function F6e(e,t){for(var r=0;r<t.length;r++){var s=t[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,rZ(s.key),s)}}function L6e(e,t,r){return t&&F6e(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function D6e(e,t,r){return t=W2(t),R6e(e,tZ()?Reflect.construct(t,r||[],W2(e).constructor):t.apply(e,r))}function R6e(e,t){if(t&&(vg(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return U6e(e)}function U6e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function tZ(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(tZ=function(){return!!e})()}function W2(e){return W2=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},W2(e)}function M6e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&NT(e,t)}function NT(e,t){return NT=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,a){return s.__proto__=a,s},NT(e,t)}function _T(e,t,r){return t=rZ(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function rZ(e){var t=$6e(e,"string");return vg(t)=="symbol"?t:t+""}function $6e(e,t){if(vg(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(vg(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var S8=1,Q6e=function(e){function t(){var r;O6e(this,t);for(var s=arguments.length,a=new Array(s),i=0;i<s;i++)a[i]=arguments[i];return r=D6e(this,t,[].concat(a)),_T(r,"state",{dismissed:!1,dismissedAtCoordinate:{x:0,y:0},lastBoundingBox:{width:-1,height:-1}}),_T(r,"handleKeyDown",function(o){if(o.key==="Escape"){var l,c,d,u;r.setState({dismissed:!0,dismissedAtCoordinate:{x:(l=(c=r.props.coordinate)===null||c===void 0?void 0:c.x)!==null&&l!==void 0?l:0,y:(d=(u=r.props.coordinate)===null||u===void 0?void 0:u.y)!==null&&d!==void 0?d:0}})}}),r}return M6e(t,e),L6e(t,[{key:"updateBBox",value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var s=this.wrapperNode.getBoundingClientRect();(Math.abs(s.width-this.state.lastBoundingBox.width)>S8||Math.abs(s.height-this.state.lastBoundingBox.height)>S8)&&this.setState({lastBoundingBox:{width:s.width,height:s.height}})}else(this.state.lastBoundingBox.width!==-1||this.state.lastBoundingBox.height!==-1)&&this.setState({lastBoundingBox:{width:-1,height:-1}})}},{key:"componentDidMount",value:function(){document.addEventListener("keydown",this.handleKeyDown),this.updateBBox()}},{key:"componentWillUnmount",value:function(){document.removeEventListener("keydown",this.handleKeyDown)}},{key:"componentDidUpdate",value:function(){var s,a;this.props.active&&this.updateBBox(),this.state.dismissed&&(((s=this.props.coordinate)===null||s===void 0?void 0:s.x)!==this.state.dismissedAtCoordinate.x||((a=this.props.coordinate)===null||a===void 0?void 0:a.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:"render",value:function(){var s=this,a=this.props,i=a.active,o=a.allowEscapeViewBox,l=a.animationDuration,c=a.animationEasing,d=a.children,u=a.coordinate,h=a.hasPayload,m=a.isAnimationActive,f=a.offset,p=a.position,A=a.reverseDirection,v=a.useTranslate3d,x=a.viewBox,b=a.wrapperStyle,y=I6e({allowEscapeViewBox:o,coordinate:u,offsetTopLeft:f,position:p,reverseDirection:A,tooltipBox:this.state.lastBoundingBox,useTranslate3d:v,viewBox:x}),w=y.cssClasses,j=y.cssProperties,N=C8(C8({transition:m&&i?"transform ".concat(l,"ms ").concat(c):void 0},j),{},{pointerEvents:"none",visibility:!this.state.dismissed&&i&&h?"visible":"hidden",position:"absolute",top:0,left:0},b);return oe.createElement("div",{tabIndex:-1,className:w,style:N,ref:function(S){s.wrapperNode=S}},d)}}])}(g.PureComponent),H6e=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},Uu={isSsr:H6e()};function bg(e){"@babel/helpers - typeof";return bg=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},bg(e)}function k8(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,s)}return r}function E8(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?k8(Object(r),!0).forEach(function(s){YO(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):k8(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}function z6e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function V6e(e,t){for(var r=0;r<t.length;r++){var s=t[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,sZ(s.key),s)}}function G6e(e,t,r){return t&&V6e(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function q6e(e,t,r){return t=Y2(t),K6e(e,nZ()?Reflect.construct(t,r||[],Y2(e).constructor):t.apply(e,r))}function K6e(e,t){if(t&&(bg(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return W6e(e)}function W6e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function nZ(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(nZ=function(){return!!e})()}function Y2(e){return Y2=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Y2(e)}function Y6e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&CT(e,t)}function CT(e,t){return CT=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,a){return s.__proto__=a,s},CT(e,t)}function YO(e,t,r){return t=sZ(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function sZ(e){var t=J6e(e,"string");return bg(t)=="symbol"?t:t+""}function J6e(e,t){if(bg(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(bg(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function X6e(e){return e.dataKey}function Z6e(e,t){return oe.isValidElement(e)?oe.cloneElement(e,t):typeof e=="function"?oe.createElement(e,t):oe.createElement(S6e,t)}var Aa=function(e){function t(){return z6e(this,t),q6e(this,t,arguments)}return Y6e(t,e),G6e(t,[{key:"render",value:function(){var s=this,a=this.props,i=a.active,o=a.allowEscapeViewBox,l=a.animationDuration,c=a.animationEasing,d=a.content,u=a.coordinate,h=a.filterNull,m=a.isAnimationActive,f=a.offset,p=a.payload,A=a.payloadUniqBy,v=a.position,x=a.reverseDirection,b=a.useTranslate3d,y=a.viewBox,w=a.wrapperStyle,j=p??[];h&&j.length&&(j=qX(p.filter(function(_){return _.value!=null&&(_.hide!==!0||s.props.includeHidden)}),A,X6e));var N=j.length>0;return oe.createElement(Q6e,{allowEscapeViewBox:o,animationDuration:l,animationEasing:c,isAnimationActive:m,active:i,coordinate:u,hasPayload:N,offset:f,position:v,reverseDirection:x,useTranslate3d:b,viewBox:y,wrapperStyle:w},Z6e(d,E8(E8({},this.props),{},{payload:j})))}}])}(g.PureComponent);
1204YO(Aa,"displayName","Tooltip");YO(Aa,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!Uu.isSsr,itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,viewBox:{x:0,y:0,height:0,width:0},wrapperStyle:{}});var eLe=Nd,tLe=function(){return eLe.Date.now()},rLe=tLe,nLe=/\s/;function sLe(e){for(var t=e.length;t--&&nLe.test(e.charAt(t)););return t}var aLe=sLe,iLe=aLe,oLe=/^\s+/;function lLe(e){return e&&e.slice(0,iLe(e)+1).replace(oLe,"")}var cLe=lLe,dLe=cLe,B8=cf,uLe=c0,T8=NaN,hLe=/^[-+]0x[0-9a-f]+$/i,fLe=/^0b[01]+$/i,mLe=/^0o[0-7]+$/i,pLe=parseInt;function ALe(e){if(typeof e=="number")return e;if(uLe(e))return T8;if(B8(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=B8(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=dLe(e);var r=fLe.test(e);return r||mLe.test(e)?pLe(e.slice(2),r?2:8):hLe.test(e)?T8:+e}var aZ=ALe,gLe=cf,q5=rLe,P8=aZ,xLe="Expected a function",vLe=Math.max,bLe=Math.min;function yLe(e,t,r){var s,a,i,o,l,c,d=0,u=!1,h=!1,m=!0;if(typeof e!="function")throw new TypeError(xLe);t=P8(t)||0,gLe(r)&&(u=!!r.leading,h="maxWait"in r,i=h?vLe(P8(r.maxWait)||0,t):i,m="trailing"in r?!!r.trailing:m);function f(N){var _=s,S=a;return s=a=void 0,d=N,o=e.apply(S,_),o}function p(N){return d=N,l=setTimeout(x,t),u?f(N):o}function A(N){var _=N-c,S=N-d,C=t-_;return h?bLe(C,i-S):C}function v(N){var _=N-c,S=N-d;return c===void 0||_>=t||_<0||h&&S>=i}function x(){var N=q5();if(v(N))return b(N);l=setTimeout(x,A(N))}function b(N){return l=void 0,m&&s?f(N):(s=a=void 0,o)}function y(){l!==void 0&&clearTimeout(l),d=0,s=c=a=l=void 0}function w(){return l===void 0?o:b(q5())}function j(){var N=q5(),_=v(N);if(s=arguments,a=this,c=N,_){if(l===void 0)return p(c);if(h)return clearTimeout(l),l=setTimeout(x,t),f(c)}return l===void 0&&(l=setTimeout(x,t)),o}return j.cancel=y,j.flush=w,j}var wLe=yLe,jLe=wLe,NLe=cf,_Le="Expected a function";function CLe(e,t,r){var s=!0,a=!0;if(typeof e!="function")throw new TypeError(_Le);return NLe(r)&&(s="leading"in r?!!r.leading:s,a="trailing"in r?!!r.trailing:a),jLe(e,t,{leading:s,maxWait:t,trailing:a})}var SLe=CLe;const iZ=wn(SLe);function yb(e){"@babel/helpers - typeof";return yb=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yb(e)}function I8(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,s)}return r}function o1(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?I8(Object(r),!0).forEach(function(s){kLe(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):I8(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}function kLe(e,t,r){return t=ELe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ELe(e){var t=BLe(e,"string");return yb(t)=="symbol"?t:t+""}function BLe(e,t){if(yb(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(yb(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function TLe(e,t){return FLe(e)||OLe(e,t)||ILe(e,t)||PLe()}function PLe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1205In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ILe(e,t){if(e){if(typeof e=="string")return O8(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return O8(e,t)}}function O8(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,s=new Array(t);r<t;r++)s[r]=e[r];return s}function OLe(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var s,a,i,o,l=[],c=!0,d=!1;try{if(i=(r=r.call(e)).next,t!==0)for(;!(c=(s=i.call(r)).done)&&(l.push(s.value),l.length!==t);c=!0);}catch(u){d=!0,a=u}
vendor: 13,778 bytes, lines 1205-1211
1205finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(d)throw a}}return l}}function FLe(e){if(Array.isArray(e))return e}var Sl=g.forwardRef(function(e,t){var r=e.aspect,s=e.initialDimension,a=s===void 0?{width:-1,height:-1}:s,i=e.width,o=i===void 0?"100%":i,l=e.height,c=l===void 0?"100%":l,d=e.minWidth,u=d===void 0?0:d,h=e.minHeight,m=e.maxHeight,f=e.children,p=e.debounce,A=p===void 0?0:p,v=e.id,x=e.className,b=e.onResize,y=e.style,w=y===void 0?{}:y,j=g.useRef(null),N=g.useRef();N.current=b,g.useImperativeHandle(t,function(){return Object.defineProperty(j.current,"current",{get:function(){return console.warn("The usage of ref.current.current is deprecated and will no longer be supported."),j.current},configurable:!0})});var _=g.useState({containerWidth:a.width,containerHeight:a.height}),S=TLe(_,2),C=S[0],E=S[1],T=g.useCallback(function(L,P){E(function(F){var M=Math.round(L),I=Math.round(P);return F.containerWidth===M&&F.containerHeight===I?F:{containerWidth:M,containerHeight:I}})},[]);g.useEffect(function(){var L=function(V){var R,Q=V[0].contentRect,U=Q.width,D=Q.height;T(U,D),(R=N.current)===null||R===void 0||R.call(N,U,D)};A>0&&(L=iZ(L,A,{trailing:!0,leading:!1}));var P=new ResizeObserver(L),F=j.current.getBoundingClientRect(),M=F.width,I=F.height;return T(M,I),P.observe(j.current),function(){P.disconnect()}},[T,A]);var B=g.useMemo(function(){var L=C.containerWidth,P=C.containerHeight;if(L<0||P<0)return null;yc(um(o)||um(c),`The width(%s) and height(%s) are both fixed numbers,
1206       maybe you don't need to use a ResponsiveContainer.`,o,c),yc(!r||r>0,"The aspect(%s) must be greater than zero.",r);var F=um(o)?L:o,M=um(c)?P:c;r&&r>0&&(F?M=F/r:M&&(F=M*r),m&&M>m&&(M=m)),yc(F>0||M>0,`The width(%s) and height(%s) of chart should be greater than 0,
1207       please check the style of container, or the props width(%s) and height(%s),
1208       or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the
1209       height and width.`,F,M,o,c,u,h,r);var I=!Array.isArray(f)&&bu(f.type).endsWith("Chart");return oe.Children.map(f,function($){return oe.isValidElement($)?g.cloneElement($,o1({width:F,height:M},I?{style:o1({height:"100%",width:"100%",maxHeight:M,maxWidth:F},$.props.style)}:{})):$})},[r,f,c,m,h,u,C,o]);return oe.createElement("div",{id:v?"".concat(v):void 0,className:fr("recharts-responsive-container",x),style:o1(o1({},w),{},{width:o,height:c,minWidth:u,minHeight:h,maxHeight:m}),ref:j},B)}),yg=function(t){return null};yg.displayName="Cell";function wb(e){"@babel/helpers - typeof";return wb=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},wb(e)}function F8(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,s)}return r}function ST(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?F8(Object(r),!0).forEach(function(s){LLe(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):F8(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}function LLe(e,t,r){return t=DLe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function DLe(e){var t=RLe(e,"string");return wb(t)=="symbol"?t:t+""}function RLe(e,t){if(wb(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(wb(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Tp={widthCache:{},cacheCount:0},ULe=2e3,MLe={position:"absolute",top:"-20000px",left:0,padding:0,margin:0,border:"none",whiteSpace:"pre"},L8="recharts_measurement_span";function $Le(e){var t=ST({},e);return Object.keys(t).forEach(function(r){t[r]||delete t[r]}),t}var Av=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||Uu.isSsr)return{width:0,height:0};var s=$Le(r),a=JSON.stringify({text:t,copyStyle:s});if(Tp.widthCache[a])return Tp.widthCache[a];try{var i=document.getElementById(L8);i||(i=document.createElement("span"),i.setAttribute("id",L8),i.setAttribute("aria-hidden","true"),document.body.appendChild(i));var o=ST(ST({},MLe),s);Object.assign(i.style,o),i.textContent="".concat(t);var l=i.getBoundingClientRect(),c={width:l.width,height:l.height};return Tp.widthCache[a]=c,++Tp.cacheCount>ULe&&(Tp.cacheCount=0,Tp.widthCache={}),c}catch{return{width:0,height:0}}},QLe=function(t){return{top:t.top+window.scrollY-document.documentElement.clientTop,left:t.left+window.scrollX-document.documentElement.clientLeft}};function jb(e){"@babel/helpers - typeof";return jb=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},jb(e)}function J2(e,t){return GLe(e)||VLe(e,t)||zLe(e,t)||HLe()}function HLe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1210In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function zLe(e,t){if(e){if(typeof e=="string")return D8(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return D8(e,t)}}function D8(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,s=new Array(t);r<t;r++)s[r]=e[r];return s}function VLe(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var s,a,i,o,l=[],c=!0,d=!1;try{if(i=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;c=!1}else for(;!(c=(s=i.call(r)).done)&&(l.push(s.value),l.length!==t);c=!0);}catch(u){d=!0,a=u}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(d)throw a}}return l}}function GLe(e){if(Array.isArray(e))return e}function qLe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function R8(e,t){for(var r=0;r<t.length;r++){var s=t[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,WLe(s.key),s)}}function KLe(e,t,r){return t&&R8(e.prototype,t),r&&R8(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function WLe(e){var t=YLe(e,"string");return jb(t)=="symbol"?t:t+""}function YLe(e,t){if(jb(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(jb(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var U8=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,M8=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,JLe=/^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/,XLe=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,oZ={cm:96/2.54,mm:96/25.4,pt:96/72,pc:96/6,in:96,Q:96/(2.54*40),px:1},ZLe=Object.keys(oZ),vA="NaN";function eDe(e,t){return e*oZ[t]}var l1=function(){function e(t,r){qLe(this,e),this.num=t,this.unit=r,this.num=t,this.unit=r,Number.isNaN(t)&&(this.unit=""),r!==""&&!JLe.test(r)&&(this.num=NaN,this.unit=""),ZLe.includes(r)&&(this.num=eDe(t,r),this.unit="px")}return KLe(e,[{key:"add",value:function(r){return this.unit!==r.unit?new e(NaN,""):new e(this.num+r.num,this.unit)}},{key:"subtract",value:function(r){return this.unit!==r.unit?new e(NaN,""):new e(this.num-r.num,this.unit)}},{key:"multiply",value:function(r){return this.unit!==""&&r.unit!==""&&this.unit!==r.unit?new e(NaN,""):new e(this.num*r.num,this.unit||r.unit)}},{key:"divide",value:function(r){return this.unit!==""&&r.unit!==""&&this.unit!==r.unit?new e(NaN,""):new e(this.num/r.num,this.unit||r.unit)}},{key:"toString",value:function(){return"".concat(this.num).concat(this.unit)}},{key:"isNaN",value:function(){return Number.isNaN(this.num)}}],[{key:"parse",value:function(r){var s,a=(s=XLe.exec(r))!==null&&s!==void 0?s:[],i=J2(a,3),o=i[1],l=i[2];return new e(parseFloat(o),l??"")}}])}();function lZ(e){if(e.includes(vA))return vA;for(var t=e;t.includes("*")||t.includes("/");){var r,s=(r=U8.exec(t))!==null&&r!==void 0?r:[],a=J2(s,4),i=a[1],o=a[2],l=a[3],c=l1.parse(i??""),d=l1.parse(l??""),u=o==="*"?c.multiply(d):c.divide(d);if(u.isNaN())return vA;t=t.replace(U8,u.toString())}for(;t.includes("+")||/.-\d+(?:\.\d+)?/.test(t);){var h,m=(h=M8.exec(t))!==null&&h!==void 0?h:[],f=J2(m,4),p=f[1],A=f[2],v=f[3],x=l1.parse(p??""),b=l1.parse(v??""),y=A==="+"?x.add(b):x.subtract(b);if(y.isNaN())return vA;t=t.replace(M8,y.toString())}return t}var $8=/\(([^()]*)\)/;function tDe(e){for(var t=e;t.includes("(");){var r=$8.exec(t),s=J2(r,2),a=s[1];t=t.replace($8,lZ(a))}return t}function rDe(e){var t=e.replace(/\s+/g,"");return t=tDe(t),t=lZ(t),t}function nDe(e){try{return rDe(e)}catch{return vA}}function K5(e){var t=nDe(e.slice(5,-1));return t===vA?"":t}var sDe=["x","y","lineHeight","capHeight","scaleToFit","textAnchor","verticalAnchor","fill"],aDe=["dx","dy","angle","className","breakAll"];function kT(){return kT=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},kT.apply(this,arguments)}function Q8(e,t){if(e==null)return{};var r=iDe(e,t),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)s=i[a],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(r[s]=e[s])}return r}function iDe(e,t){if(e==null)return{};var r={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;r[s]=e[s]}return r}function H8(e,t){return dDe(e)||cDe(e,t)||lDe(e,t)||oDe()}function oDe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1211In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function lDe(e,t){if(e){if(typeof e=="string")return z8(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return z8(e,t)}}function z8(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,s=new Array(t);r<t;r++)s[r]=e[r];return s}function cDe(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var s,a,i,o,l=[],c=!0,d=!1;try{if(i=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;c=!1}else for(;!(c=(s=i.call(r)).done)&&(l.push(s.value),l.length!==t);c=!0);}catch(u){d=!0,a=u}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(d)throw a}}return l}}function dDe(e){if(Array.isArray(e))return e}var cZ=/[ \f\n\r\t\v\u2028\u2029]+/,dZ=function(t){var r=t.children,s=t.breakAll,a=t.style;try{var i=[];wr(r)||(s?i=r.toString().split(""):i=r.toString().split(cZ));var o=i.map(function(c){return{word:c,width:Av(c,a).width}}),l=s?0:Av(" ",a).width;return{wordsWithComputedWidth:o,spaceWidth:l}}catch{return null}},uDe=function(t,r,s,a,i){var o=t.maxLines,l=t.children,c=t.style,d=t.breakAll,u=lt(o),h=l,m=function(){var F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return F.reduce(function(M,I){var $=I.word,V=I.width,R=M[M.length-1];if(R&&(a==null||i||R.width+V+s<Number(a)))R.words.push($),R.width+=V+s;else{var Q={words:[$],width:V};M.push(Q)}return M},[])},f=m(r),p=function(F){return F.reduce(function(M,I){return M.width>I.width?M:I})};if(!u)return f;for(var A="…",v=function(F){var M=h.slice(0,F),I=dZ({breakAll:d,style:c,children:M+A}).wordsWithComputedWidth,$=m(I),V=$.length>o||p($).width>Number(a);return[V,$]},x=0,b=h.length-1,y=0,w;x<=b&&y<=h.length-1;){var j=Math.floor((x+b)/2),N=j-1,_=v(N),S=H8(_,2),C=S[0],E=S[1],T=v(j),B=H8(T,1),L=B[0];if(!C&&!L&&(x=j+1),C&&L&&(b=j-1),!C&&L){w=E;break}y++}return w||f},V8=function(t){var r=wr(t)?[]:t.toString().split(cZ);return[{words:r}]},hDe=function(t){var r=t.width,s=t.scaleToFit,a=t.children,i=t.style,o=t.breakAll,l=t.maxLines;if((r||s)&&!Uu.isSsr){var c,d,u=dZ({breakAll:o,children:a,style:i});if(u){var h=u.wordsWithComputedWidth,m=u.spaceWidth;c=h,d=m}else return V8(a);return uDe({breakAll:o,children:a,maxLines:l,style:i},c,d,r,s)}return V8(a)},G8="#808080",$m=function(t){var r=t.x,s=r===void 0?0:r,a=t.y,i=a===void 0?0:a,o=t.lineHeight,l=o===void 0?"1em":o,c=t.capHeight,d=c===void 0?"0.71em":c,u=t.scaleToFit,h=u===void 0?!1:u,m=t.textAnchor,f=m===void 0?"start":m,p=t.verticalAnchor,A=p===void 0?"end":p,v=t.fill,x=v===void 0?G8:v,b=Q8(t,sDe),y=g.useMemo(function(){return hDe({breakAll:b.breakAll,children:b.children,maxLines:b.maxLines,scaleToFit:h,style:b.style,width:b.width})},[b.breakAll,b.children,b.maxLines,h,b.style,b.width]),w=b.dx,j=b.dy,N=b.angle,_=b.className,S=b.breakAll,C=Q8(b,aDe);if(!Da(s)||!Da(i))return null;var E=s+(lt(w)?w:0),T=i+(lt(j)?j:0),B;switch(A){case"start":B=K5("calc(".concat(d,")"));break;case"middle":B=K5("calc(".concat((y.length-1)/2," * -").concat(l," + (").concat(d," / 2))"));break;default:B=K5("calc(".concat(y.length-1," * -").concat(l,")"));break}var L=[];if(h){var P=y[0].width,F=b.width;L.push("scale(".concat((lt(F)?F/P:1)/P,")"))}return N&&L.push("rotate(".concat(N,", ").concat(E,", ").concat(T,")")),L.length&&(C.transform=L.join(" ")),oe.createElement("text",kT({},Dt(C,!0),{x:E,y:T,className:fr("recharts-text",_),textAnchor:f,fill:x.includes("url")?G8:x}),y.map(function(M,I){var $=M.words.join(S?"":" ");return oe.createElement("tspan",{x:E,dy:I===0?B:l,key:"".concat($,"-").concat(I
1211)},$)}))};function Rh(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function fDe(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function JO(e){let t,r,s;e.length!==2?(t=Rh,r=(l,c)=>Rh(e(l),c),s=(l,c)=>e(l)-c):(t=e===Rh||e===fDe?e:mDe,r=e,s=e);function a(l,c,d=0,u=l.length){if(d<u){if(t(c,c)!==0)return u;do{const h=d+u>>>1;r(l[h],c)<0?d=h+1:u=h}while(d<u)}return d}function i(l,c,d=0,u=l.length){if(d<u){if(t(c,c)!==0)return u;do{const h=d+u>>>1;r(l[h],c)<=0?d=h+1:u=h}while(d<u)}return d}function o(l,c,d=0,u=l.length){const h=a(l,c,d,u-1);return h>d&&s(l[h-1],c)>-s(l[h],c)?h-1:h}return{left:a,center:o,right:i}}function mDe(){return 0}function uZ(e){return e===null?NaN:+e}function*pDe(e,t){for(let r of e)r!=null&&(r=+r)>=r&&(yield r)}const ADe=JO(Rh),Uy=ADe.right;JO(uZ).center;class q8 extends Map{constructor(t,r=vDe){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),t!=null)for(const[s,a]of t)this.set(s,a)}get(t){return super.get(K8(this,t))}has(t){return super.has(K8(this,t))}set(t,r){return super.set(gDe(this,t),r)}delete(t){return super.delete(xDe(this,t))}}function K8({_intern:e,_key:t},r){const s=t(r);return e.has(s)?e.get(s):r}function gDe({_intern:e,_key:t},r){const s=t(r);return e.has(s)?e.get(s):(e.set(s,r),r)}function xDe({_intern:e,_key:t},r){const s=t(r);return e.has(s)&&(r=e.get(s),e.delete(s)),r}function vDe(e){return e!==null&&typeof e=="object"?e.valueOf():e}function bDe(e=Rh){if(e===Rh)return hZ;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,r)=>{const s=e(t,r);return s||s===0?s:(e(r,r)===0)-(e(t,t)===0)}}function hZ(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(e<t?-1:e>t?1:0)}const yDe=Math.sqrt(50),wDe=Math.sqrt(10),jDe=Math.sqrt(2);function X2(e,t,r){const s=(t-e)/Math.max(0,r),a=Math.floor(Math.log10(s)),i=s/Math.pow(10,a),o=i>=yDe?10:i>=wDe?5:i>=jDe?2:1;let l,c,d;return a<0?(d=Math.pow(10,-a)/o,l=Math.round(e*d),c=Math.round(t*d),l/d<e&&++l,c/d>t&&--c,d=-d):(d=Math.pow(10,a)*o,l=Math.round(e/d),c=Math.round(t/d),l*d<e&&++l,c*d>t&&--c),c<l&&.5<=r&&r<2?X2(e,t,r*2):[l,c,d]}function ET(e,t,r){if(t=+t,e=+e,r=+r,!(r>0))return[];if(e===t)return[e];const s=t<e,[a,i,o]=s?X2(t,e,r):X2(e,t,r);if(!(i>=a))return[];const l=i-a+1,c=new Array(l);if(s)if(o<0)for(let d=0;d<l;++d)c[d]=(i-d)/-o;else for(let d=0;d<l;++d)c[d]=(i-d)*o;else if(o<0)for(let d=0;d<l;++d)c[d]=(a+d)/-o;else for(let d=0;d<l;++d)c[d]=(a+d)*o;return c}function BT(e,t,r){return t=+t,e=+e,r=+r,X2(e,t,r)[2]}function TT(e,t,r){t=+t,e=+e,r=+r;const s=t<e,a=s?BT(t,e,r):BT(e,t,r);return(s?-1:1)*(a<0?1/-a:a)}function W8(e,t){let r;for(const s of e)s!=null&&(r<s||r===void 0&&s>=s)&&(r=s);return r}function Y8(e,t){let r;for(const s of e)s!=null&&(r>s||r===void 0&&s>=s)&&(r=s);return r}function fZ(e,t,r=0,s=1/0,a){if(t=Math.floor(t),r=Math.floor(Math.max(0,r)),s=Math.floor(Math.min(e.length-1,s)),!(r<=t&&t<=s))return e;for(a=a===void 0?hZ:bDe(a);s>r;){if(s-r>600){const c=s-r+1,d=t-r+1,u=Math.log(c),h=.5*Math.exp(2*u/3),m=.5*Math.sqrt(u*h*(c-h)/c)*(d-c/2<0?-1:1),f=Math.max(r,Math.floor(t-d*h/c+m)),p=Math.min(s,Math.floor(t+(c-d)*h/c+m));fZ(e,t,f,p,a)}const i=e[t];let o=r,l=s;for(gx(e,r,t),a(e[s],i)>0&&gx(e,r,s);o<l;){for(gx(e,o,l),++o,--l;a(e[o],i)<0;)++o;for(;a(e[l],i)>0;)--l}a(e[r],i)===0?gx(e,r,l):(++l,gx(e,l,s)),l<=t&&(r=l+1),t<=l&&(s=l-1)}return e}function gx(e,t,r){const s=e[t];e[t]=e[r],e[r]=s}function NDe(e,t,r){if(e=Float64Array.from(pDe(e)),!(!(s=e.length)||isNaN(t=+t))){if(t<=0||s<2)return Y8(e);if(t>=1)return W8(e);var s,a=(s-1)*t,i=Math.floor(a),o=W8(fZ(e,i).subarray(0,i+1)),l=Y8(e.subarray(i+1));return o+(l-o)*(a-i)}}function _De(e,t,r=uZ){if(!(!(s=e.length)||isNaN(t=+t))){if(t<=0||s<2)return+r(e[0],0,e);if(t>=1)return+r(e[s-1],s-1,e);var s,a=(s-1)*t,i=Math.floor(a),o=+r(e[i],i,e),l=+r(e[i+1],i+1,e);return o+(l-o)*(a-i)}}function CDe(e,t,r){e=+e,t=+t,r=(a=arguments.length)<2?(t=e,e=0,1):a<3?1:+r;for(var s=-1,a=Math.max(0,Math.ceil((t-e)/r))|0,i=new Array(a);++s<a;)i[s]=e+s*r;return i}function Vl(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}function Mu(e,t){switch(arguments.length){case 0:break;case 1:{typeof e=="function"?this.interpolator(e):this.range(e);break}default:{this.domain(e),typeof t=="function"?this.interpolator(t):this.range(t);break}}return this}
vendor: 7,904 bytes, line 1211
1211const PT=Symbol("implicit");function XO(){var e=new q8,t=[],r=[],s=PT;function a(i){let o=e.get(i);if(o===void 0){if(s!==PT)return s;e.set(i,o=t.push(i)-1)}return r[o%r.length]}return a.domain=function(i){if(!arguments.length)return t.slice();t=[],e=new q8;for(const o of i)e.has(o)||e.set(o,t.push(o)-1);return a},a.range=function(i){return arguments.length?(r=Array.from(i),a):r.slice()},a.unknown=function(i){return arguments.length?(s=i,a):s},a.copy=function(){return XO(t,r).unknown(s)},Vl.apply(a,arguments),a}function Nb(){var e=XO().unknown(void 0),t=e.domain,r=e.range,s=0,a=1,i,o,l=!1,c=0,d=0,u=.5;delete e.unknown;function h(){var m=t().length,f=a<s,p=f?a:s,A=f?s:a;i=(A-p)/Math.max(1,m-c+d*2),l&&(i=Math.floor(i)),p+=(A-p-i*(m-c))*u,o=i*(1-c),l&&(p=Math.round(p),o=Math.round(o));var v=CDe(m).map(function(x){return p+i*x});return r(f?v.reverse():v)}return e.domain=function(m){return arguments.length?(t(m),h()):t()},e.range=function(m){return arguments.length?([s,a]=m,s=+s,a=+a,h()):[s,a]},e.rangeRound=function(m){return[s,a]=m,s=+s,a=+a,l=!0,h()},e.bandwidth=function(){return o},e.step=function(){return i},e.round=function(m){return arguments.length?(l=!!m,h()):l},e.padding=function(m){return arguments.length?(c=Math.min(1,d=+m),h()):c},e.paddingInner=function(m){return arguments.length?(c=Math.min(1,m),h()):c},e.paddingOuter=function(m){return arguments.length?(d=+m,h()):d},e.align=function(m){return arguments.length?(u=Math.max(0,Math.min(1,m)),h()):u},e.copy=function(){return Nb(t(),[s,a]).round(l).paddingInner(c).paddingOuter(d).align(u)},Vl.apply(h(),arguments)}function mZ(e){var t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,delete e.paddingOuter,e.copy=function(){return mZ(t())},e}function gv(){return mZ(Nb.apply(null,arguments).paddingInner(1))}function ZO(e,t,r){e.prototype=t.prototype=r,r.constructor=e}function pZ(e,t){var r=Object.create(e.prototype);for(var s in t)r[s]=t[s];return r}function My(){}var _b=.7,Z2=1/_b,FA="\\s*([+-]?\\d+)\\s*",Cb="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",ud="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",SDe=/^#([0-9a-f]{3,8})$/,kDe=new RegExp(`^rgb\\(${FA},${FA},${FA}\\)$`),EDe=new RegExp(`^rgb\\(${ud},${ud},${ud}\\)$`),BDe=new RegExp(`^rgba\\(${FA},${FA},${FA},${Cb}\\)$`),TDe=new RegExp(`^rgba\\(${ud},${ud},${ud},${Cb}\\)$`),PDe=new RegExp(`^hsl\\(${Cb},${ud},${ud}\\)$`),IDe=new RegExp(`^hsla\\(${Cb},${ud},${ud},${Cb}\\)$`),J8={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};ZO(My,Sb,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:X8,formatHex:X8,formatHex8:ODe,formatHsl:FDe,formatRgb:Z8,toString:Z8});function X8(){return this.rgb().formatHex()}function ODe(){return this.rgb().formatHex8()}function FDe(){return AZ(this).formatHsl()}function Z8(){return this.rgb().formatRgb()}function Sb(e){var t,r;return e=(e+"").trim().toLowerCase(),(t=SDe.exec(e))?(r=t[1].length,t=parseInt(t[1],16),r===6?e$(t):r===3?new ao(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):r===8?c1(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?c1(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=kDe.exec(e))?new ao(t[1],t[2],t[3],1):(t=EDe.exec(e))?new ao(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=BDe.exec(e))?c1(t[1],t[2],t[3],t[4]):(t=TDe.exec(e))?c1(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=PDe.exec(e))?n$(t[1],t[2]/100,t[3]/100,1):(t=IDe.exec(e))?n$(t[1],t[2]/100,t[3]/100,t[4]):J8.hasOwnProperty(e)?e$(J8[e]):e==="transparent"?new ao(NaN,NaN,NaN,0):null}function e$(e){return new ao(e>>16&255,e>>8&255,e&255,1)}function c1(e,t,r,s){return s<=0&&(e=t=r=NaN),new ao(e,t,r,s)}function LDe(e){return e instanceof My||(e=Sb(e)),e?(e=e.rgb(),new ao(e.r,e.g,e.b,e.opacity)):new ao}function IT(e,t,r,s){return arguments.length===1?LDe(e):new ao(e,t,r,s??1)}function ao(e,t,r,s){this.r=+e,this.g=+t,this.b=+r,this.opacity=+s}ZO(ao,IT,pZ(My,{brighter(e){return e=e==null?Z2:Math.pow(Z2,e),new ao(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?_b:Math.pow(_b,e),new ao(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ao(ym(this.r),ym(this.g),ym(this.b),eN(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:t$,formatHex:t$,formatHex8:DDe,formatRgb:r$,toString:r$}));function t$(){return`#${hm(this.r)}${hm(this.g)}${hm(this.b)}`}function DDe(){return`#${hm(this.r)}${hm(this.g)}${hm(this.b)}${hm((isNaN(this.opacity)?1:this.opacity)*255)}`}function r$(){const e=eN(this.opacity);return`${e===1?"rgb(":"rgba("}${ym(this.r)}, ${ym(this.g)}, ${ym(this.b)}${e===1?")":`, ${e})`}`}function eN(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ym(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function hm(e){return e=ym(e),(e<16?"0":"")+e.toString(16)}function n$(e,t,r,s){return s<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new pc(e,t,r,s)}function AZ(e){if(e instanceof pc)return new pc(e.h,e.s,e.l,e.opacity);if(e instanceof My||(e=Sb(e)),!e)return new pc;if(e instanceof pc)return e;e=e.rgb();var t=e.r/255,r=e.g/255,s=e.b/255,a=Math.min(t,r,s),i=Math.max(t,r,s),o=NaN,l=i-a,c=(i+a)/2;
vendor: 5,323 bytes, line 1211
1211return l?(t===i?o=(r-s)/l+(r<s)*6:r===i?o=(s-t)/l+2:o=(t-r)/l+4,l/=c<.5?i+a:2-i-a,o*=60):l=c>0&&c<1?0:o,new pc(o,l,c,e.opacity)}function RDe(e,t,r,s){return arguments.length===1?AZ(e):new pc(e,t,r,s??1)}function pc(e,t,r,s){this.h=+e,this.s=+t,this.l=+r,this.opacity=+s}ZO(pc,RDe,pZ(My,{brighter(e){return e=e==null?Z2:Math.pow(Z2,e),new pc(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?_b:Math.pow(_b,e),new pc(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,s=r+(r<.5?r:1-r)*t,a=2*r-s;return new ao(W5(e>=240?e-240:e+120,a,s),W5(e,a,s),W5(e<120?e+240:e-120,a,s),this.opacity)},clamp(){return new pc(s$(this.h),d1(this.s),d1(this.l),eN(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=eN(this.opacity);return`${e===1?"hsl(":"hsla("}${s$(this.h)}, ${d1(this.s)*100}%, ${d1(this.l)*100}%${e===1?")":`, ${e})`}`}}));function s$(e){return e=(e||0)%360,e<0?e+360:e}function d1(e){return Math.max(0,Math.min(1,e||0))}function W5(e,t,r){return(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)*255}const eF=e=>()=>e;function UDe(e,t){return function(r){return e+r*t}}function MDe(e,t,r){return e=Math.pow(e,r),t=Math.pow(t,r)-e,r=1/r,function(s){return Math.pow(e+s*t,r)}}function $De(e){return(e=+e)==1?gZ:function(t,r){return r-t?MDe(t,r,e):eF(isNaN(t)?r:t)}}function gZ(e,t){var r=t-e;return r?UDe(e,r):eF(isNaN(e)?t:e)}const a$=function e(t){var r=$De(t);function s(a,i){var o=r((a=IT(a)).r,(i=IT(i)).r),l=r(a.g,i.g),c=r(a.b,i.b),d=gZ(a.opacity,i.opacity);return function(u){return a.r=o(u),a.g=l(u),a.b=c(u),a.opacity=d(u),a+""}}return s.gamma=e,s}(1);function QDe(e,t){t||(t=[]);var r=e?Math.min(t.length,e.length):0,s=t.slice(),a;return function(i){for(a=0;a<r;++a)s[a]=e[a]*(1-i)+t[a]*i;return s}}function HDe(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function zDe(e,t){var r=t?t.length:0,s=e?Math.min(r,e.length):0,a=new Array(s),i=new Array(r),o;for(o=0;o<s;++o)a[o]=x0(e[o],t[o]);for(;o<r;++o)i[o]=t[o];return function(l){for(o=0;o<s;++o)i[o]=a[o](l);return i}}function VDe(e,t){var r=new Date;return e=+e,t=+t,function(s){return r.setTime(e*(1-s)+t*s),r}}function tN(e,t){return e=+e,t=+t,function(r){return e*(1-r)+t*r}}function GDe(e,t){var r={},s={},a;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(a in t)a in e?r[a]=x0(e[a],t[a]):s[a]=t[a];return function(i){for(a in r)s[a]=r[a](i);return s}}var OT=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Y5=new RegExp(OT.source,"g");function qDe(e){return function(){return e}}function KDe(e){return function(t){return e(t)+""}}function WDe(e,t){var r=OT.lastIndex=Y5.lastIndex=0,s,a,i,o=-1,l=[],c=[];for(e=e+"",t=t+"";(s=OT.exec(e))&&(a=Y5.exec(t));)(i=a.index)>r&&(i=t.slice(r,i),l[o]?l[o]+=i:l[++o]=i),(s=s[0])===(a=a[0])?l[o]?l[o]+=a:l[++o]=a:(l[++o]=null,c.push({i:o,x:tN(s,a)})),r=Y5.lastIndex;return r<t.length&&(i=t.slice(r),l[o]?l[o]+=i:l[++o]=i),l.length<2?c[0]?KDe(c[0].x):qDe(t):(t=c.length,function(d){for(var u=0,h;u<t;++u)l[(h=c[u]).i]=h.x(d);return l.join("")})}function x0(e,t){var r=typeof t,s;return t==null||r==="boolean"?eF(t):(r==="number"?tN:r==="string"?(s=Sb(t))?(t=s,a$):WDe:t instanceof Sb?a$:t instanceof Date?VDe:HDe(t)?QDe:Array.isArray(t)?zDe:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?GDe:tN)(e,t)}function tF(e,t){return e=+e,t=+t,function(r){return Math.round(e*(1-r)+t*r)}}function YDe(e,t){t===void 0&&(t=e,e=x0);for(var r=0,s=t.length-1,a=t[0],i=new Array(s<0?0:s);r<s;)i[r]=e(a,a=t[++r]);return function(o){var l=Math.max(0,Math.min(s-1,Math.floor(o*=s)));return i[l](o-l)}}function JDe(e){return function(){return e}}function rN(e){return+e}var i$=[0,1];function zi(e){return e}function FT(e,t){return(t-=e=+e)?function(r){return(r-e)/t}:JDe(isNaN(t)?NaN:.5)}function XDe(e,t){var r;return e>t&&(r=e,e=t,t=r),function(s){return Math.max(e,Math.min(t,s))}}function ZDe(e,t,r){var s=e[0],a=e[1],i=t[0],o=t[1];return a<s?(s=FT(a,s),i=r(o,i)):(s=FT(s,a),i=r(i,o)),function(l){return i(s(l))}}function eRe(e,t,r){var s=Math.min(e.length,t.length)-1,a=new Array(s),i=new Array(s),o=-1;for(e[s]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++o<s;)a[o]=FT(e[o],e[o+1]),i[o]=r(t[o],t[o+1]);return function(l){var c=Uy(e,l,1,s)-1;return i[c](a[c](l))}}function $y(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function GC(){var e=i$,t=i$,r=x0,s,a,i,o=zi,l,c,d;function u(){var m=Math.min(e.length,t.length);return o!==zi&&(o=XDe(e[0],e[m-1])),l=m>2?eRe:ZDe,c=d=null,h}function h(m){return m==null||isNaN(m=+m)?i:(c||(c=l(e.map(s),t,r)))(s(o(m)))}return h.invert=function(m){return o(a((d||(d=l(t,e.map(s),tN)))(m)))},h.domain=function(m){return arguments.length?(e=Array.from(m,rN),u()):e.slice()},h.range=function(m){return arguments.length?(t=Array.from(m),u()):t.slice()},h.rangeRound=function(m){return t=Array.from(m),r=tF,u()},h.clamp=function(m){return arguments.length?(o=m?!0:zi,u()):o!==zi},h.interpolate=function(m){return arguments.length?(r=m,u()):r},h.unknown=function(m){return arguments.length?(i=m,h):i},function(m,f){return s=m,a=f,u()}}function rF(){return GC()(zi,zi)}
vendor: 4,597 bytes, line 1211
1211function tRe(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function nN(e,t){if(!isFinite(e)||e===0)return null;var r=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"),s=e.slice(0,r);return[s.length>1?s[0]+s.slice(2):s,+e.slice(r+1)]}function wg(e){return e=nN(Math.abs(e)),e?e[1]:NaN}function rRe(e,t){return function(r,s){for(var a=r.length,i=[],o=0,l=e[0],c=0;a>0&&l>0&&(c+l+1>s&&(l=Math.max(1,s-c)),i.push(r.substring(a-=l,a+l)),!((c+=l+1)>s));)l=e[o=(o+1)%e.length];return i.reverse().join(t)}}function nRe(e){return function(t){return t.replace(/[0-9]/g,function(r){return e[+r]})}}var sRe=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function kb(e){if(!(t=sRe.exec(e)))throw new Error("invalid format: "+e);var t;return new nF({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}kb.prototype=nF.prototype;function nF(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}nF.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function aRe(e){e:for(var t=e.length,r=1,s=-1,a;r<t;++r)switch(e[r]){case".":s=a=r;break;case"0":s===0&&(s=r),a=r;break;default:if(!+e[r])break e;s>0&&(s=0);break}return s>0?e.slice(0,s)+e.slice(a+1):e}var sN;function iRe(e,t){var r=nN(e,t);if(!r)return sN=void 0,e.toPrecision(t);var s=r[0],a=r[1],i=a-(sN=Math.max(-8,Math.min(8,Math.floor(a/3)))*3)+1,o=s.length;return i===o?s:i>o?s+new Array(i-o+1).join("0"):i>0?s.slice(0,i)+"."+s.slice(i):"0."+new Array(1-i).join("0")+nN(e,Math.max(0,t+i-1))[0]}function o$(e,t){var r=nN(e,t);if(!r)return e+"";var s=r[0],a=r[1];return a<0?"0."+new Array(-a).join("0")+s:s.length>a+1?s.slice(0,a+1)+"."+s.slice(a+1):s+new Array(a-s.length+2).join("0")}const l$={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:tRe,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>o$(e*100,t),r:o$,s:iRe,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function c$(e){return e}var d$=Array.prototype.map,u$=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function oRe(e){var t=e.grouping===void 0||e.thousands===void 0?c$:rRe(d$.call(e.grouping,Number),e.thousands+""),r=e.currency===void 0?"":e.currency[0]+"",s=e.currency===void 0?"":e.currency[1]+"",a=e.decimal===void 0?".":e.decimal+"",i=e.numerals===void 0?c$:nRe(d$.call(e.numerals,String)),o=e.percent===void 0?"%":e.percent+"",l=e.minus===void 0?"−":e.minus+"",c=e.nan===void 0?"NaN":e.nan+"";function d(h,m){h=kb(h);var f=h.fill,p=h.align,A=h.sign,v=h.symbol,x=h.zero,b=h.width,y=h.comma,w=h.precision,j=h.trim,N=h.type;N==="n"?(y=!0,N="g"):l$[N]||(w===void 0&&(w=12),j=!0,N="g"),(x||f==="0"&&p==="=")&&(x=!0,f="0",p="=");var _=(m&&m.prefix!==void 0?m.prefix:"")+(v==="$"?r:v==="#"&&/[boxX]/.test(N)?"0"+N.toLowerCase():""),S=(v==="$"?s:/[%p]/.test(N)?o:"")+(m&&m.suffix!==void 0?m.suffix:""),C=l$[N],E=/[defgprs%]/.test(N);w=w===void 0?6:/[gprs]/.test(N)?Math.max(1,Math.min(21,w)):Math.max(0,Math.min(20,w));function T(B){var L=_,P=S,F,M,I;if(N==="c")P=C(B)+P,B="";else{B=+B;var $=B<0||1/B<0;if(B=isNaN(B)?c:C(Math.abs(B),w),j&&(B=aRe(B)),$&&+B==0&&A!=="+"&&($=!1),L=($?A==="("?A:l:A==="-"||A==="("?"":A)+L,P=(N==="s"&&!isNaN(B)&&sN!==void 0?u$[8+sN/3]:"")+P+($&&A==="("?")":""),E){for(F=-1,M=B.length;++F<M;)if(I=B.charCodeAt(F),48>I||I>57){P=(I===46?a+B.slice(F+1):B.slice(F))+P,B=B.slice(0,F);break}}}y&&!x&&(B=t(B,1/0));var V=L.length+B.length+P.length,R=V<b?new Array(b-V+1).join(f):"";switch(y&&x&&(B=t(R+B,R.length?b-P.length:1/0),R=""),p){case"<":B=L+B+P+R;break;case"=":B=L+R+B+P;break;case"^":B=R.slice(0,V=R.length>>1)+L+B+P+R.slice(V);break;default:B=R+L+B+P;break}return i(B)}return T.toString=function(){return h+""},T}function u(h,m){var f=Math.max(-8,Math.min(8,Math.floor(wg(m)/3)))*3,p=Math.pow(10,-f),A=d((h=kb(h),h.type="f",h),{suffix:u$[8+f/3]});return function(v){return A(p*v)}}return{format:d,formatPrefix:u}}var u1,sF,xZ;
1211lRe({thousands:",",grouping:[3],currency:["$",""]});function lRe(e){return u1=oRe(e),sF=u1.format,xZ=u1.formatPrefix,u1}function cRe(e){return Math.max(0,-wg(Math.abs(e)))}function dRe(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(wg(t)/3)))*3-wg(Math.abs(e)))}function uRe(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,wg(t)-wg(e))+1}function vZ(e,t,r,s){var a=TT(e,t,r),i;switch(s=kb(s??",f"),s.type){case"s":{var o=Math.max(Math.abs(e),Math.abs(t));return s.precision==null&&!isNaN(i=dRe(a,o))&&(s.precision=i),xZ(s,o)}case"":case"e":case"g":case"p":case"r":{s.precision==null&&!isNaN(i=uRe(a,Math.max(Math.abs(e),Math.abs(t))))&&(s.precision=i-(s.type==="e"));break}case"f":case"%":{s.precision==null&&!isNaN(i=cRe(a))&&(s.precision=i-(s.type==="%")*2);break}}return sF(s)}function df(e){var t=e.domain;return e.ticks=function(r){var s=t();return ET(s[0],s[s.length-1],r??10)},e.tickFormat=function(r,s){var a=t();return vZ(a[0],a[a.length-1],r??10,s)},e.nice=function(r){r==null&&(r=10);var s=t(),a=0,i=s.length-1,o=s[a],l=s[i],c,d,u=10;for(l<o&&(d=o,o=l,l=d,d=a,a=i,i=d);u-- >0;){if(d=BT(o,l,r),d===c)return s[a]=o,s[i]=l,t(s);if(d>0)o=Math.floor(o/d)*d,l=Math.ceil(l/d)*d;else if(d<0)o=Math.ceil(o*d)/d,l=Math.floor(l*d)/d;else break;c=d}return e},e}function aN(){var e=rF();return e.copy=function(){return $y(e,aN())},Vl.apply(e,arguments),df(e)}function bZ(e){var t;function r(s){return s==null||isNaN(s=+s)?t:s}return r.invert=r,r.domain=r.range=function(s){return arguments.length?(e=Array.from(s,rN),r):e.slice()},r.unknown=function(s){return arguments.length?(t=s,r):t},r.copy=function(){return bZ(e).unknown(t)},e=arguments.length?Array.from(e,rN):[0,1],df(r)}function yZ(e,t){e=e.slice();var r=0,s=e.length-1,a=e[r],i=e[s],o;return i<a&&(o=r,r=s,s=o,o=a,a=i,i=o),e[r]=t.floor(a),e[s]=t.ceil(i),e}function h$(e){return Math.log(e)}function f$(e){return Math.exp(e)}function hRe(e){return-Math.log(-e)}function fRe(e){return-Math.exp(-e)}function mRe(e){return isFinite(e)?+("1e"+e):e<0?0:e}function pRe(e){return e===10?mRe:e===Math.E?Math.exp:t=>Math.pow(e,t)}function ARe(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function m$(e){return(t,r)=>-e(-t,r)}function aF(e){const t=e(h$,f$),r=t.domain;let s=10,a,i;function o(){return a=ARe(s),i=pRe(s),r()[0]<0?(a=m$(a),i=m$(i),e(hRe,fRe)):e(h$,f$),t}return t.base=function(l){return arguments.length?(s=+l,o()):s},t.domain=function(l){return arguments.length?(r(l),o()):r()},t.ticks=l=>{const c=r();let d=c[0],u=c[c.length-1];const h=u<d;h&&([d,u]=[u,d]);let m=a(d),f=a(u),p,A;const v=l==null?10:+l;let x=[];if(!(s%1)&&f-m<v){if(m=Math.floor(m),f=Math.ceil(f),d>0){for(;m<=f;++m)for(p=1;p<s;++p)if(A=m<0?p/i(-m):p*i(m),!(A<d)){if(A>u)break;x.push(A)}}else for(;m<=f;++m)for(p=s-1;p>=1;--p)if(A=m>0?p/i(-m):p*i(m),!(A<d)){if(A>u)break;x.push(A)}x.length*2<v&&(x=ET(d,u,v))}else x=ET(m,f,Math.min(f-m,v)).map(i);return h?x.reverse():x},t.tickFormat=(l,c)=>{if(l==null&&(l=10),c==null&&(c=s===10?"s":","),typeof c!="function"&&(!(s%1)&&(c=kb(c)).precision==null&&(c.trim=!0),c=sF(c)),l===1/0)return c;const d=Math.max(1,s*l/t.ticks().length);return u=>{let h=u/i(Math.round(a(u)));return h*s<s-.5&&(h*=s),h<=d?c(u):""}},t.nice=()=>r(yZ(r(),{floor:l=>i(Math.floor(a(l))),ceil:l=>i(Math.ceil(a(l)))})),t}function wZ(){const e=aF(GC()).domain([1,10]);return e.copy=()=>$y(e,wZ()).base(e.base()),Vl.apply(e,arguments),e}function p$(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function A$(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function iF(e){var t=1,r=e(p$(t),A$(t));return r.constant=function(s){return arguments.length?e(p$(t=+s),A$(t)):t},df(r)}function jZ(){var e=iF(GC());return e.copy=function(){return $y(e,jZ()).constant(e.constant())},Vl.apply(e,arguments)}function g$(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function gRe(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function xRe(e){return e<0?-e*e:e*e}function oF(e){var t=e(zi,zi),r=1;function s(){return r===1?e(zi,zi):r===.5?e(gRe,xRe):e(g$(r),g$(1/r))}return t.exponent=function(a){return arguments.length?(r=+a,s()):r},df(t)}function lF(){var e=oF(GC());return e.copy=function(){return $y(e,lF()).exponent(e.exponent())},Vl.apply(e,arguments),e}function vRe(){return lF.apply(null,arguments).exponent(.5)}function x$(e){return Math.sign(e)*e*e}function bRe(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function NZ(){var e=rF(),t=[0,1],r=!1,s;function a(i){var o=bRe(e(i));return isNaN(o)?s:r?Math.round(o):o}return a.invert=function(i){return e.invert(x$(i))},a.domain=function(i){return arguments.length?(e.domain(i),a):e.domain()},a.range=function(i){return arguments.length?(e.range((t=Array.from(i,rN)).map(x$)),a):t.slice()}
1211,a.rangeRound=function(i){return a.range(i).round(!0)},a.round=function(i){return arguments.length?(r=!!i,a):r},a.clamp=function(i){return arguments.length?(e.clamp(i),a):e.clamp()},a.unknown=function(i){return arguments.length?(s=i,a):s},a.copy=function(){return NZ(e.domain(),t).round(r).clamp(e.clamp()).unknown(s)},Vl.apply(a,arguments),df(a)}function _Z(){var e=[],t=[],r=[],s;function a(){var o=0,l=Math.max(1,t.length);for(r=new Array(l-1);++o<l;)r[o-1]=_De(e,o/l);return i}function i(o){return o==null||isNaN(o=+o)?s:t[Uy(r,o)]}return i.invertExtent=function(o){var l=t.indexOf(o);return l<0?[NaN,NaN]:[l>0?r[l-1]:e[0],l<r.length?r[l]:e[e.length-1]]},i.domain=function(o){if(!arguments.length)return e.slice();e=[];for(let l of o)l!=null&&!isNaN(l=+l)&&e.push(l);return e.sort(Rh),a()},i.range=function(o){return arguments.length?(t=Array.from(o),a()):t.slice()},i.unknown=function(o){return arguments.length?(s=o,i):s},i.quantiles=function(){return r.slice()},i.copy=function(){return _Z().domain(e).range(t).unknown(s)},Vl.apply(i,arguments)}function CZ(){var e=0,t=1,r=1,s=[.5],a=[0,1],i;function o(c){return c!=null&&c<=c?a[Uy(s,c,0,r)]:i}function l(){var c=-1;for(s=new Array(r);++c<r;)s[c]=((c+1)*t-(c-r)*e)/(r+1);return o}return o.domain=function(c){return arguments.length?([e,t]=c,e=+e,t=+t,l()):[e,t]},o.range=function(c){return arguments.length?(r=(a=Array.from(c)).length-1,l()):a.slice()},o.invertExtent=function(c){var d=a.indexOf(c);return d<0?[NaN,NaN]:d<1?[e,s[0]]:d>=r?[s[r-1],t]:[s[d-1],s[d]]},o.unknown=function(c){return arguments.length&&(i=c),o},o.thresholds=function(){return s.slice()},o.copy=function(){return CZ().domain([e,t]).range(a).unknown(i)},Vl.apply(df(o),arguments)}function SZ(){var e=[.5],t=[0,1],r,s=1;function a(i){return i!=null&&i<=i?t[Uy(e,i,0,s)]:r}return a.domain=function(i){return arguments.length?(e=Array.from(i),s=Math.min(e.length,t.length-1),a):e.slice()},a.range=function(i){return arguments.length?(t=Array.from(i),s=Math.min(e.length,t.length-1),a):t.slice()},a.invertExtent=function(i){var o=t.indexOf(i);return[e[o-1],e[o]]},a.unknown=function(i){return arguments.length?(r=i,a):r},a.copy=function(){return SZ().domain(e).range(t).unknown(r)},Vl.apply(a,arguments)}const J5=new Date,X5=new Date;function Ua(e,t,r,s){function a(i){return e(i=arguments.length===0?new Date:new Date(+i)),i}return a.floor=i=>(e(i=new Date(+i)),i),a.ceil=i=>(e(i=new Date(i-1)),t(i,1),e(i),i),a.round=i=>{const o=a(i),l=a.ceil(i);return i-o<l-i?o:l},a.offset=(i,o)=>(t(i=new Date(+i),o==null?1:Math.floor(o)),i),a.range=(i,o,l)=>{const c=[];if(i=a.ceil(i),l=l==null?1:Math.floor(l),!(i<o)||!(l>0))return c;let d;do c.push(d=new Date(+i)),t(i,l),e(i);while(d<i&&i<o);return c},a.filter=i=>Ua(o=>{if(o>=o)for(;e(o),!i(o);)o.setTime(o-1)},(o,l)=>{if(o>=o)if(l<0)for(;++l<=0;)for(;t(o,-1),!i(o););else for(;--l>=0;)for(;t(o,1),!i(o););}),r&&(a.count=(i,o)=>(J5.setTime(+i),X5.setTime(+o),e(J5),e(X5),Math.floor(r(J5,X5))),a.every=i=>(i=Math.floor(i),!isFinite(i)||!(i>0)?null:i>1?a.filter(s?o=>s(o)%i===0:o=>a.count(0,o)%i===0):a)),a}const iN=Ua(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);iN.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?Ua(t=>{t.setTime(Math.floor(t/e)*e)},(t,r)=>{t.setTime(+t+r*e)},(t,r)=>(r-t)/e):iN);iN.range;const cu=1e3,Fl=cu*60,du=Fl*60,ku=du*24,cF=ku*7,v$=ku*30,Z5=ku*365,fm=Ua(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*cu)},(e,t)=>(t-e)/cu,e=>e.getUTCSeconds());fm.range;const dF=Ua(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*cu)},(e,t)=>{e.setTime(+e+t*Fl)},(e,t)=>(t-e)/Fl,e=>e.getMinutes());dF.range;const uF=Ua(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*Fl)},(e,t)=>(t-e)/Fl,e=>e.getUTCMinutes());uF.range;const hF=Ua(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*cu-e.getMinutes()*Fl)},(e,t)=>{e.setTime(+e+t*du)},(e,t)=>(t-e)/du,e=>e.getHours());hF.range;const fF=Ua(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*du)},(e,t)=>(t-e)/du,e=>e.getUTCHours());fF.range;const Qy=Ua(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Fl)/ku,e=>e.getDate()-1);Qy.range;const qC=Ua(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/ku,e=>e.getUTCDate()-1);qC.range;
vendor: 4,242 bytes, line 1211
1211const kZ=Ua(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/ku,e=>Math.floor(e/ku));kZ.range;function ap(e){return Ua(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,r)=>{t.setDate(t.getDate()+r*7)},(t,r)=>(r-t-(r.getTimezoneOffset()-t.getTimezoneOffset())*Fl)/cF)}const KC=ap(0),oN=ap(1),yRe=ap(2),wRe=ap(3),jg=ap(4),jRe=ap(5),NRe=ap(6);KC.range;oN.range;yRe.range;wRe.range;jg.range;jRe.range;NRe.range;function ip(e){return Ua(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCDate(t.getUTCDate()+r*7)},(t,r)=>(r-t)/cF)}const WC=ip(0),lN=ip(1),_Re=ip(2),CRe=ip(3),Ng=ip(4),SRe=ip(5),kRe=ip(6);WC.range;lN.range;_Re.range;CRe.range;Ng.range;SRe.range;kRe.range;const mF=Ua(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());mF.range;const pF=Ua(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());pF.range;const Eu=Ua(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());Eu.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Ua(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,r)=>{t.setFullYear(t.getFullYear()+r*e)});Eu.range;const Bu=Ua(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());Bu.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Ua(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCFullYear(t.getUTCFullYear()+r*e)});Bu.range;function EZ(e,t,r,s,a,i){const o=[[fm,1,cu],[fm,5,5*cu],[fm,15,15*cu],[fm,30,30*cu],[i,1,Fl],[i,5,5*Fl],[i,15,15*Fl],[i,30,30*Fl],[a,1,du],[a,3,3*du],[a,6,6*du],[a,12,12*du],[s,1,ku],[s,2,2*ku],[r,1,cF],[t,1,v$],[t,3,3*v$],[e,1,Z5]];function l(d,u,h){const m=u<d;m&&([d,u]=[u,d]);const f=h&&typeof h.range=="function"?h:c(d,u,h),p=f?f.range(d,+u+1):[];return m?p.reverse():p}function c(d,u,h){const m=Math.abs(u-d)/h,f=JO(([,,v])=>v).right(o,m);if(f===o.length)return e.every(TT(d/Z5,u/Z5,h));if(f===0)return iN.every(Math.max(TT(d,u,h),1));const[p,A]=o[m/o[f-1][2]<o[f][2]/m?f-1:f];return p.every(A)}return[l,c]}const[ERe,BRe]=EZ(Bu,pF,WC,kZ,fF,uF),[TRe,PRe]=EZ(Eu,mF,KC,Qy,hF,dF);function eE(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function tE(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function xx(e,t,r){return{y:e,m:t,d:r,H:0,M:0,S:0,L:0}}function IRe(e){var t=e.dateTime,r=e.date,s=e.time,a=e.periods,i=e.days,o=e.shortDays,l=e.months,c=e.shortMonths,d=vx(a),u=bx(a),h=vx(i),m=bx(i),f=vx(o),p=bx(o),A=vx(l),v=bx(l),x=vx(c),b=bx(c),y={a:I,A:$,b:V,B:R,c:null,d:_$,e:_$,f:rUe,g:hUe,G:mUe,H:ZRe,I:eUe,j:tUe,L:BZ,m:nUe,M:sUe,p:Q,q:U,Q:k$,s:E$,S:aUe,u:iUe,U:oUe,V:lUe,w:cUe,W:dUe,x:null,X:null,y:uUe,Y:fUe,Z:pUe,"%":S$},w={a:D,A:q,b:G,B:Y,c:null,d:C$,e:C$,f:vUe,g:EUe,G:TUe,H:AUe,I:gUe,j:xUe,L:PZ,m:bUe,M:yUe,p:K,q:X,Q:k$,s:E$,S:wUe,u:jUe,U:NUe,V:_Ue,w:CUe,W:SUe,x:null,X:null,y:kUe,Y:BUe,Z:PUe,"%":S$},j={a:E,A:T,b:B,B:L,c:P,d:j$,e:j$,f:WRe,g:w$,G:y$,H:N$,I:N$,j:VRe,L:KRe,m:zRe,M:GRe,p:C,q:HRe,Q:JRe,s:XRe,S:qRe,u:RRe,U:URe,V:MRe,w:DRe,W:$Re,x:F,X:M,y:w$,Y:y$,Z:QRe,"%":YRe};y.x=N(r,y),y.X=N(s,y),y.c=N(t,y),w.x=N(r,w),w.X=N(s,w),w.c=N(t,w);function N(ne,ae){return function(J){var W=[],ie=-1,he=0,ee=ne.length,xe,we,Se;for(J instanceof Date||(J=new Date(+J));++ie<ee;)ne.charCodeAt(ie)===37&&(W.push(ne.slice(he,ie)),(we=b$[xe=ne.charAt(++ie)])!=null?xe=ne.charAt(++ie):we=xe==="e"?" ":"0",(Se=ae[xe])&&(xe=Se(J,we)),W.push(xe),he=ie+1);return W.push(ne.slice(he,ie)),W.join("")}}function _(ne,ae){return function(J){var W=xx(1900,void 0,1),ie=S(W,ne,J+="",0),he,ee;if(ie!=J.length)return null;if("Q"in W)return new Date(W.Q);
vendor: 7,247 bytes, line 1211
1211if("s"in W)return new Date(W.s*1e3+("L"in W?W.L:0));if(ae&&!("Z"in W)&&(W.Z=0),"p"in W&&(W.H=W.H%12+W.p*12),W.m===void 0&&(W.m="q"in W?W.q:0),"V"in W){if(W.V<1||W.V>53)return null;"w"in W||(W.w=1),"Z"in W?(he=tE(xx(W.y,0,1)),ee=he.getUTCDay(),he=ee>4||ee===0?lN.ceil(he):lN(he),he=qC.offset(he,(W.V-1)*7),W.y=he.getUTCFullYear(),W.m=he.getUTCMonth(),W.d=he.getUTCDate()+(W.w+6)%7):(he=eE(xx(W.y,0,1)),ee=he.getDay(),he=ee>4||ee===0?oN.ceil(he):oN(he),he=Qy.offset(he,(W.V-1)*7),W.y=he.getFullYear(),W.m=he.getMonth(),W.d=he.getDate()+(W.w+6)%7)}else("W"in W||"U"in W)&&("w"in W||(W.w="u"in W?W.u%7:"W"in W?1:0),ee="Z"in W?tE(xx(W.y,0,1)).getUTCDay():eE(xx(W.y,0,1)).getDay(),W.m=0,W.d="W"in W?(W.w+6)%7+W.W*7-(ee+5)%7:W.w+W.U*7-(ee+6)%7);return"Z"in W?(W.H+=W.Z/100|0,W.M+=W.Z%100,tE(W)):eE(W)}}function S(ne,ae,J,W){for(var ie=0,he=ae.length,ee=J.length,xe,we;ie<he;){if(W>=ee)return-1;if(xe=ae.charCodeAt(ie++),xe===37){if(xe=ae.charAt(ie++),we=j[xe in b$?ae.charAt(ie++):xe],!we||(W=we(ne,J,W))<0)return-1}else if(xe!=J.charCodeAt(W++))return-1}return W}function C(ne,ae,J){var W=d.exec(ae.slice(J));return W?(ne.p=u.get(W[0].toLowerCase()),J+W[0].length):-1}function E(ne,ae,J){var W=f.exec(ae.slice(J));return W?(ne.w=p.get(W[0].toLowerCase()),J+W[0].length):-1}function T(ne,ae,J){var W=h.exec(ae.slice(J));return W?(ne.w=m.get(W[0].toLowerCase()),J+W[0].length):-1}function B(ne,ae,J){var W=x.exec(ae.slice(J));return W?(ne.m=b.get(W[0].toLowerCase()),J+W[0].length):-1}function L(ne,ae,J){var W=A.exec(ae.slice(J));return W?(ne.m=v.get(W[0].toLowerCase()),J+W[0].length):-1}function P(ne,ae,J){return S(ne,t,ae,J)}function F(ne,ae,J){return S(ne,r,ae,J)}function M(ne,ae,J){return S(ne,s,ae,J)}function I(ne){return o[ne.getDay()]}function $(ne){return i[ne.getDay()]}function V(ne){return c[ne.getMonth()]}function R(ne){return l[ne.getMonth()]}function Q(ne){return a[+(ne.getHours()>=12)]}function U(ne){return 1+~~(ne.getMonth()/3)}function D(ne){return o[ne.getUTCDay()]}function q(ne){return i[ne.getUTCDay()]}function G(ne){return c[ne.getUTCMonth()]}function Y(ne){return l[ne.getUTCMonth()]}function K(ne){return a[+(ne.getUTCHours()>=12)]}function X(ne){return 1+~~(ne.getUTCMonth()/3)}return{format:function(ne){var ae=N(ne+="",y);return ae.toString=function(){return ne},ae},parse:function(ne){var ae=_(ne+="",!1);return ae.toString=function(){return ne},ae},utcFormat:function(ne){var ae=N(ne+="",w);return ae.toString=function(){return ne},ae},utcParse:function(ne){var ae=_(ne+="",!0);return ae.toString=function(){return ne},ae}}}var b$={"-":"",_:" ",0:"0"},Ja=/^\s*\d+/,ORe=/^%/,FRe=/[\\^$*+?|[\]().{}]/g;function fn(e,t,r){var s=e<0?"-":"",a=(s?-e:e)+"",i=a.length;return s+(i<r?new Array(r-i+1).join(t)+a:a)}function LRe(e){return e.replace(FRe,"\\$&")}function vx(e){return new RegExp("^(?:"+e.map(LRe).join("|")+")","i")}function bx(e){return new Map(e.map((t,r)=>[t.toLowerCase(),r]))}function DRe(e,t,r){var s=Ja.exec(t.slice(r,r+1));return s?(e.w=+s[0],r+s[0].length):-1}function RRe(e,t,r){var s=Ja.exec(t.slice(r,r+1));return s?(e.u=+s[0],r+s[0].length):-1}function URe(e,t,r){var s=Ja.exec(t.slice(r,r+2));return s?(e.U=+s[0],r+s[0].length):-1}function MRe(e,t,r){var s=Ja.exec(t.slice(r,r+2));return s?(e.V=+s[0],r+s[0].length):-1}function $Re(e,t,r){var s=Ja.exec(t.slice(r,r+2));return s?(e.W=+s[0],r+s[0].length):-1}function y$(e,t,r){var s=Ja.exec(t.slice(r,r+4));return s?(e.y=+s[0],r+s[0].length):-1}function w$(e,t,r){var s=Ja.exec(t.slice(r,r+2));return s?(e.y=+s[0]+(+s[0]>68?1900:2e3),r+s[0].length):-1}function QRe(e,t,r){var s=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(r,r+6));return s?(e.Z=s[1]?0:-(s[2]+(s[3]||"00")),r+s[0].length):-1}function HRe(e,t,r){var s=Ja.exec(t.slice(r,r+1));return s?(e.q=s[0]*3-3,r+s[0].length):-1}function zRe(e,t,r){var s=Ja.exec(t.slice(r,r+2));return s?(e.m=s[0]-1,r+s[0].length):-1}function j$(e,t,r){var s=Ja.exec(t.slice(r,r+2));return s?(e.d=+s[0],r+s[0].length):-1}function VRe(e,t,r){var s=Ja.exec(t.slice(r,r+3));return s?(e.m=0,e.d=+s[0],r+s[0].length):-1}function N$(e,t,r){var s=Ja.exec(t.slice(r,r+2));return s?(e.H=+s[0],r+s[0].length):-1}function GRe(e,t,r){var s=Ja.exec(t.slice(r,r+2));return s?(e.M=+s[0],r+s[0].length):-1}function qRe(e,t,r){var s=Ja.exec(t.slice(r,r+2));return s?(e.S=+s[0],r+s[0].length):-1}function KRe(e,t,r){var s=Ja.exec(t.slice(r,r+3));return s?(e.L=+s[0],r+s[0].length):-1}function WRe(e,t,r){var s=Ja.exec(t.slice(r,r+6));return s?(e.L=Math.floor(s[0]/1e3),r+s[0].length):-1}function YRe(e,t,r){var s=ORe.exec(t.slice(r,r+1));return s?r+s[0].length:-1}function JRe(e,t,r){var s=Ja.exec(t.slice(r));return s?(e.Q=+s[0],r+s[0].length):-1}function XRe(e,t,r){var s=Ja.exec(t.slice(r));return s?(e.s=+s[0],r+s[0].length):-1}function _$(e,t){return fn(e.getDate(),t,2)}function ZRe(e,t){return fn(e.getHours(),t,2)}function eUe(e,t){return fn(e.getHours()%12||12,t,2)}function tUe(e,t){return fn(1+Qy.count(Eu(e),e),t,3)}function BZ(e,t){return fn(e.getMilliseconds(),t,3)}function rUe(e,t){return BZ(e,t)+"000"}function nUe(e,t){return fn(e.getMonth()+1,t,2)}function sUe(e,t){return fn(e.getMinutes(),t,2)}function aUe(e,t){return fn(e.getSeconds(),t,2)}function iUe(e){var t=e.getDay();return t===0?7:t}function oUe(e,t){return fn(KC.count(Eu(e)-1,e),t,2)}function TZ(e){var t=e.getDay();return t>=4||t===0?jg(e):jg.ceil(e)}function lUe(e,t){return e=TZ(e),fn(jg.count(Eu(e),e)+(Eu(e).getDay()===4),t,2)}function cUe(e){return e.getDay()}function dUe(e,t){return fn(oN.count(Eu(e)-1,e),t,2)}function uUe(e,t){return fn(e.getFullYear()%100,t,2)}function hUe(e,t){return e=TZ(e),fn(e.getFullYear()%100,t,2)}function fUe(e,t){return fn(e.getFullYear()%1e4,t,4)}function mUe(e,t){var r=e.getDay();return e=r>=4||r===0?jg(e):jg.ceil(e),fn(e.getFullYear()%1e4,t,4)}function pUe(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+fn(t/60|0,"0",2)+fn(t%60,"0",2)}function C$(e,t){return fn(e.getUTCDate(),t,2)}function AUe(e,t){return fn(e.getUTCHours(),t,2)}function gUe(e,t){return fn(e.getUTCHours()%12||12,t,2)}function xUe(e,t){return fn(1+qC.count(Bu(e),e),t,3)}function PZ(e,t){return fn(e.getUTCMilliseconds(),t,3)}function vUe(e,t){return PZ(e,t)+"000"}function bUe(e,t){return fn(e.getUTCMonth()+1,t,2)}function yUe(e,t){return fn(e.getUTCMinutes(),t,2)}function wUe(e,t){return fn(e.getUTCSeconds(),t,2)}function jUe(e){var t=e.getUTCDay();return t===0?7:t}function NUe(e,t){return fn(WC.count(Bu(e)-1,e),t,2)}function IZ(e){var t=e.getUTCDay();return t>=4||t===0?Ng(e):Ng.ceil(e)}function _Ue(e,t){return e=IZ(e),fn(Ng.count(Bu(e),e)+(Bu(e).getUTCDay()===4),t,2)}function CUe(e){return e.getUTCDay()}function SUe(e,t){return fn(lN.count(Bu(e)-1,e),t,2)}function kUe(e,t){return fn(e.getUTCFullYear()%100,t,2)}function EUe(e,t){return e=IZ(e),fn(e.getUTCFullYear()%100,t,2)}function BUe(e,t){return fn(e.getUTCFullYear()%1e4,t,4)}function TUe(e,t){var r=e.getUTCDay();return e=r>=4||r===0?Ng(e):Ng.ceil(e),fn(e.getUTCFullYear()%1e4,t,4)}function PUe(){return"+0000"}function S$(){return"%"}function k$(e){return+e}function E$(e){return Math.floor(+e/1e3)}var Pp,OZ,FZ;IUe({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Frid
1211ay","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function IUe(e){return Pp=IRe(e),OZ=Pp.format,Pp.parse,FZ=Pp.utcFormat,Pp.utcParse,Pp}function OUe(e){return new Date(e)}function FUe(e){return e instanceof Date?+e:+new Date(+e)}function AF(e,t,r,s,a,i,o,l,c,d){var u=rF(),h=u.invert,m=u.domain,f=d(".%L"),p=d(":%S"),A=d("%I:%M"),v=d("%I %p"),x=d("%a %d"),b=d("%b %d"),y=d("%B"),w=d("%Y");function j(N){return(c(N)<N?f:l(N)<N?p:o(N)<N?A:i(N)<N?v:s(N)<N?a(N)<N?x:b:r(N)<N?y:w)(N)}return u.invert=function(N){return new Date(h(N))},u.domain=function(N){return arguments.length?m(Array.from(N,FUe)):m().map(OUe)},u.ticks=function(N){var _=m();return e(_[0],_[_.length-1],N??10)},u.tickFormat=function(N,_){return _==null?j:d(_)},u.nice=function(N){var _=m();return(!N||typeof N.range!="function")&&(N=t(_[0],_[_.length-1],N??10)),N?m(yZ(_,N)):u},u.copy=function(){return $y(u,AF(e,t,r,s,a,i,o,l,c,d))},u}function LUe(){return Vl.apply(AF(TRe,PRe,Eu,mF,KC,Qy,hF,dF,fm,OZ).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function DUe(){return Vl.apply(AF(ERe,BRe,Bu,pF,WC,qC,fF,uF,fm,FZ).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function YC(){var e=0,t=1,r,s,a,i,o=zi,l=!1,c;function d(h){return h==null||isNaN(h=+h)?c:o(a===0?.5:(h=(i(h)-r)*a,l?Math.max(0,Math.min(1,h)):h))}d.domain=function(h){return arguments.length?([e,t]=h,r=i(e=+e),s=i(t=+t),a=r===s?0:1/(s-r),d):[e,t]},d.clamp=function(h){return arguments.length?(l=!!h,d):l},d.interpolator=function(h){return arguments.length?(o=h,d):o};function u(h){return function(m){var f,p;return arguments.length?([f,p]=m,o=h(f,p),d):[o(0),o(1)]}}return d.range=u(x0),d.rangeRound=u(tF),d.unknown=function(h){return arguments.length?(c=h,d):c},function(h){return i=h,r=h(e),s=h(t),a=r===s?0:1/(s-r),d}}function uf(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function LZ(){var e=df(YC()(zi));return e.copy=function(){return uf(e,LZ())},Mu.apply(e,arguments)}function DZ(){var e=aF(YC()).domain([1,10]);return e.copy=function(){return uf(e,DZ()).base(e.base())},Mu.apply(e,arguments)}function RZ(){var e=iF(YC());return e.copy=function(){return uf(e,RZ()).constant(e.constant())},Mu.apply(e,arguments)}function gF(){var e=oF(YC());return e.copy=function(){return uf(e,gF()).exponent(e.exponent())},Mu.apply(e,arguments)}function RUe(){return gF.apply(null,arguments).exponent(.5)}function UZ(){var e=[],t=zi;function r(s){if(s!=null&&!isNaN(s=+s))return t((Uy(e,s,1)-1)/(e.length-1))}return r.domain=function(s){if(!arguments.length)return e.slice();e=[];for(let a of s)a!=null&&!isNaN(a=+a)&&e.push(a);return e.sort(Rh),r},r.interpolator=function(s){return arguments.length?(t=s,r):t},r.range=function(){return e.map((s,a)=>t(a/(e.length-1)))},r.quantiles=function(s){return Array.from({length:s+1},(a,i)=>NDe(e,i/s))},r.copy=function(){return UZ(t).domain(e)},Mu.apply(r,arguments)}function JC(){var e=0,t=.5,r=1,s=1,a,i,o,l,c,d=zi,u,h=!1,m;function f(A){return isNaN(A=+A)?m:(A=.5+((A=+u(A))-i)*(s*A<s*i?l:c),d(h?Math.max(0,Math.min(1,A)):A))}f.domain=function(A){return arguments.length?([e,t,r]=A,a=u(e=+e),i=u(t=+t),o=u(r=+r),l=a===i?0:.5/(i-a),c=i===o?0:.5/(o-i),s=i<a?-1:1,f):[e,t,r]},f.clamp=function(A){return arguments.length?(h=!!A,f):h},f.interpolator=function(A){return arguments.length?(d=A,f):d};function p(A){return function(v){var x,b,y;return arguments.length?([x,b,y]=v,d=YDe(A,[x,b,y]),f):[d(0),d(.5),d(1)]}}return f.range=p(x0),f.rangeRound=p(tF),f.unknown=function(A){return arguments.length?(m=A,f):m},function(A){return u=A,a=A(e),i=A(t),o=A(r),l=a===i?0:.5/(i-a),c=i===o?0:.5/(o-i),s=i<a?-1:1,f}}function MZ(){var e=df(JC()(zi));return e.copy=function(){return uf(e,MZ())},Mu.apply(e,arguments)}function $Z(){var e=aF(JC()).domain([.1,1,10]);return e.copy=function(){return uf(e,$Z()).base(e.base())},Mu.apply(e,arguments)}function QZ(){var e=iF(JC());return e.copy=function(){return uf(e,QZ()).constant(e.constant())},Mu.apply(e,arguments)}function xF(){var e=oF(JC());return e.copy=function(){return uf(e,xF()).exponent(e.exponent())},Mu.apply(e,arguments)}function UUe(){return xF.apply(null,arguments).exponent(.5)}const B$=Object.freeze(Object.defineProperty({__proto__:null,scaleBand:Nb,scaleDiverging:MZ,scaleDivergingLog:$Z,scaleDivergingPow:xF,scaleDivergingSqrt:UUe,scaleDivergingSymlog:QZ,scaleIdentity:bZ,scaleImplicit:PT,scaleLinear:aN,scaleLog:wZ,scaleOrdinal:XO,scalePoint:gv,scalePow:lF,scaleQuantile:_Z,scaleQuantize:CZ,scaleRadial:NZ,scaleSequential:LZ,scaleSequentialLog:DZ,scaleSequentialPow:gF,scaleSequentialQuantile:UZ,scaleSequentialSqrt:RUe,scaleSequentialSymlog:RZ,scaleSqrt:vRe,scaleSymlog:jZ,scaleThreshold:SZ,scaleTime:LUe,scaleUtc:DUe,tickFormat:vZ},Symbol.toStringTag,{value:"Module"}));var MUe=c0;function $Ue(e,t,r){for(var s=-1,a=e.length;++s<a;){var i=e[s],o=t(i);if(o!=null&&(l===void 0?o===o&&!MUe(o):r(o,l)))var l=o,c=i}return c}var XC=$Ue;function QUe(e,t){return e>t}var HZ=QUe,HUe=XC,zUe=HZ,VUe=g0;function GUe(e){return e&&e.length?HUe(e,VUe,zUe):void 0}var qUe=GUe;const Ch=wn(qUe);function KUe(e,t){return e<t}var zZ=KUe,WUe=XC,YUe=zZ,JUe=g0;function XUe(e){return e&&e.length?WUe(e,JUe,YUe):void 0}var ZUe=XUe;const ZC=wn(ZUe);var eMe=PO,tMe=_d,rMe=ZX,nMe=vo;function sMe(e,t){var r=nMe(e)?eMe:rMe;return r(e,tMe(t))}var aMe=sMe,iMe=JX,oMe=aMe;function lMe(e,t){return iMe(oMe(e,t),1)}var cMe=lMe;const dMe=wn(cMe);var uMe=qO;function hMe(e,t){return uMe(e,t)}var fMe=hMe;const Yh=wn(fMe);
vendor: 103,476 bytes, lines 1211-1256
1211var v0=1e9,mMe={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},bF,ws=!0,Ul="[DecimalError] ",wm=Ul+"Invalid argument: ",vF=Ul+"Exponent out of range: ",b0=Math.floor,Wf=Math.pow,pMe=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Ho,Ha=1e7,ds=7,VZ=9007199254740991,cN=b0(VZ/ds),Bt={};Bt.absoluteValue=Bt.abs=function(){var e=new this.constructor(this);return e.s&&(e.s=1),e};Bt.comparedTo=Bt.cmp=function(e){var t,r,s,a,i=this;if(e=new i.constructor(e),i.s!==e.s)return i.s||-e.s;if(i.e!==e.e)return i.e>e.e^i.s<0?1:-1;for(s=i.d.length,a=e.d.length,t=0,r=s<a?s:a;t<r;++t)if(i.d[t]!==e.d[t])return i.d[t]>e.d[t]^i.s<0?1:-1;return s===a?0:s>a^i.s<0?1:-1};Bt.decimalPlaces=Bt.dp=function(){var e=this,t=e.d.length-1,r=(t-e.e)*ds;if(t=e.d[t],t)for(;t%10==0;t/=10)r--;return r<0?0:r};Bt.dividedBy=Bt.div=function(e){return yu(this,new this.constructor(e))};Bt.dividedToIntegerBy=Bt.idiv=function(e){var t=this,r=t.constructor;return qn(yu(t,new r(e),0,1),r.precision)};Bt.equals=Bt.eq=function(e){return!this.cmp(e)};Bt.exponent=function(){return ba(this)};Bt.greaterThan=Bt.gt=function(e){return this.cmp(e)>0};Bt.greaterThanOrEqualTo=Bt.gte=function(e){return this.cmp(e)>=0};Bt.isInteger=Bt.isint=function(){return this.e>this.d.length-2};Bt.isNegative=Bt.isneg=function(){return this.s<0};Bt.isPositive=Bt.ispos=function(){return this.s>0};Bt.isZero=function(){return this.s===0};Bt.lessThan=Bt.lt=function(e){return this.cmp(e)<0};Bt.lessThanOrEqualTo=Bt.lte=function(e){return this.cmp(e)<1};Bt.logarithm=Bt.log=function(e){var t,r=this,s=r.constructor,a=s.precision,i=a+5;if(e===void 0)e=new s(10);else if(e=new s(e),e.s<1||e.eq(Ho))throw Error(Ul+"NaN");if(r.s<1)throw Error(Ul+(r.s?"NaN":"-Infinity"));return r.eq(Ho)?new s(0):(ws=!1,t=yu(Eb(r,i),Eb(e,i),i),ws=!0,qn(t,a))};Bt.minus=Bt.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?KZ(t,e):GZ(t,(e.s=-e.s,e))};Bt.modulo=Bt.mod=function(e){var t,r=this,s=r.constructor,a=s.precision;if(e=new s(e),!e.s)throw Error(Ul+"NaN");return r.s?(ws=!1,t=yu(r,e,0,1).times(e),ws=!0,r.minus(t)):qn(new s(r),a)};Bt.naturalExponential=Bt.exp=function(){return qZ(this)};Bt.naturalLogarithm=Bt.ln=function(){return Eb(this)};Bt.negated=Bt.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};Bt.plus=Bt.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?GZ(t,e):KZ(t,(e.s=-e.s,e))};Bt.precision=Bt.sd=function(e){var t,r,s,a=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(wm+e);if(t=ba(a)+1,s=a.d.length-1,r=s*ds+1,s=a.d[s],s){for(;s%10==0;s/=10)r--;for(s=a.d[0];s>=10;s/=10)r++}return e&&t>r?t:r};Bt.squareRoot=Bt.sqrt=function(){var e,t,r,s,a,i,o,l=this,c=l.constructor;if(l.s<1){if(!l.s)return new c(0);throw Error(Ul+"NaN")}for(e=ba(l),ws=!1,a=Math.sqrt(+l),a==0||a==1/0?(t=nd(l.d),(t.length+e)%2==0&&(t+="0"),a=Math.sqrt(t),e=b0((e+1)/2)-(e<0||e%2),a==1/0?t="5e"+e:(t=a.toExponential(),t=t.slice(0,t.indexOf("e")+1)+e),s=new c(t)):s=new c(a.toString()),r=c.precision,a=o=r+3;;)if(i=s,s=i.plus(yu(l,i,o+2)).times(.5),nd(i.d).slice(0,o)===(t=nd(s.d)).slice(0,o)){if(t=t.slice(o-3,o+1),a==o&&t=="4999"){if(qn(i,r+1,0),i.times(i).eq(l)){s=i;break}}else if(t!="9999")break;o+=4}return ws=!0,qn(s,r)};Bt.times=Bt.mul=function(e){var t,r,s,a,i,o,l,c,d,u=this,h=u.constructor,m=u.d,f=(e=new h(e)).d;if(!u.s||!e.s)return new h(0);for(e.s*=u.s,r=u.e+e.e,c=m.length,d=f.length,c<d&&(i=m,m=f,f=i,o=c,c=d,d=o),i=[],o=c+d,s=o;s--;)i.push(0);for(s=d;--s>=0;){for(t=0,a=c+s;a>s;)l=i[a]+f[s]*m[a-s-1]+t,i[a--]=l%Ha|0,t=l/Ha|0;i[a]=(i[a]+t)%Ha|0}for(;!i[--o];)i.pop();return t?++r:i.shift(),e.d=i,e.e=r,ws?qn(e,h.precision):e};Bt.toDecimalPlaces=Bt.todp=function(e,t){var r=this,s=r.constructor;return r=new s(r),e===void 0?r:(xd(e,0,v0),t===void 0?t=s.rounding:xd(t,0,8),qn(r,e+ba(r)+1,t))};Bt.toExponential=function(e,t){var r,s=this,a=s.constructor;return e===void 0?r=Qm(s,!0):(xd(e,0,v0),t===void 0?t=a.rounding:xd(t,0,8),s=qn(new a(s),e+1,t),r=Qm(s,!0,e+1)),r};Bt.toFixed=function(e,t){var r,s,a=this,i=a.constructor;return e===void 0?Qm(a):(xd(e,0,v0),t===void 0?t=i.rounding:xd(t,0,8),s=qn(new i(a),e+ba(a)+1,t),r=Qm(s.abs(),!1,e+ba(s)+1),a.isneg()&&!a.isZero()?"-"+r:r)};Bt.toInteger=Bt.toint=function(){var e=this,t=e.constructor;return qn(new t(e),ba(e)+1,t.rounding)};Bt.toNumber=function(){return+this};Bt.toPower=Bt.pow=function(e){var t,r,s,a,i,o,l=this,c=l.constructor,d=12,u=+(e=new c(e));if(!e.s)return new c(Ho);if(l=new c(l),!l.s){if(e.s<1)throw Error(Ul+"Infinity");return l}if(l.eq(Ho))return l;if(s=c.precision,e.eq(Ho))return qn(l,s);if(t=e.e,r=e.d.length-1,o=t>=r,i=l.s,o){if((r=u<0?-u:u)<=VZ){for(a=new c(Ho),t=Math.ceil(s/ds+4),ws=!1;r%2&&(a=a.times(l),P$(a.d,t)),r=b0(r/2),r!==0;)l=l.times(l),P$(l.d,t);return ws=!0,e.s<0?new c(Ho).div(a):qn(a,s)}}else if(i<0)throw Error(Ul+"NaN");return i=i<0&&e.d[Math.max(t,r)]&1?-1:1,l.s=1,ws=!1,a=e.times(Eb(l,s+d)),ws=!0,a=qZ(a),a.s=i,a};Bt.toPrecision=function(e,t){var r,s,a=this,i=a.constructor;return e===void 0?(r=ba(a),s=Qm(a,r<=i.toExpNeg||r>=i.toExpPos)):(xd(e,1,v0),t===void 0?t=i.rounding:xd(t,0,8),a=qn(new i(a),e,t),r=ba(a),s=Qm(a,e<=r||r<=i.toExpNeg,e)),s};Bt.toSignificantDigits=Bt.tosd=function(e,t){var r=this,s=r.constructor;return e===void 0?(e=s.precision,t=s.rounding):(xd(e,1,v0),t===void 0?t=s.rounding:xd(t,0,8)),qn(new s(r),e,t)};Bt.toString=Bt.valueOf=Bt.val=Bt.toJSON=Bt[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=ba(e),r=e.constructor;return Qm(e,t<=r.toExpNeg||t>=r.toExpPos)};function GZ(e,t){var r,s,a,i,o,l,c,d,u=e.constructor,h=u.precision;if(!e.s||!t.s)return t.s||(t=new u(e)),ws?qn(t,h):t;if(c=e.d,d=t.d,o=e.e,a=t.e,c=c.slice(),i=o-a,i){for(i<0?(s=c,i=-i,l=d.length):(s=d,a=o,l=c.length),o=Math.ceil(h/ds),l=o>l?o+1:l+1,i>l&&(i=l,s.length=1),s.reverse();i--;)s.push(0);s.reverse()}for(l=c.length,i=d.length,l-i<0&&(i=l,s=d,d=c,c=s),r=0;i;)r=(c[--i]=c[i]+d[i]+r)/Ha|0,c[i]%=Ha;for(r&&(c.unshift(r),++a),l=c.length;c[--l]==0;)c.pop();return t.d=c,t.e=a,ws?qn(t,h):t}function xd(e,t,r){if(e!==~~e||e<t||e>r)throw Error(wm+e)}function nd(e){var t,r,s,a=e.length-1,i="",o=e[0];if(a>0){for(i+=o,t=1;t<a;t++)s=e[t]+"",r=ds-s.length,r&&(i+=Ah(r)),i+=s;o=e[t],s=o+"",r=ds-s.length,r&&(i+=Ah(r))}else if(o===0)return"0";for(;o%10===0;)o/=10;return i+o}var yu=function(){function e(s,a){var i,o=0,l=s.length;for(s=s.slice();l--;)i=s[l]*a+o,s[l]=i%Ha|0,o=i/Ha|0;return o&&s.unshift(o),s}function t(s,a,i,o){var l,c;if(i!=o)c=i>o?1:-1;else for(l=c=0;l<i;l++)if(s[l]!=a[l]){c=s[l]>a[l]?1:-1;break}return c}function r(s,a,i){for(var o=0;i--;)s[i]-=o,o=s[i]<a[i]?1:0,s[i]=o*Ha+s[i]-a[i];for(;!s[0]&&s.length>1;)s.shift()}return function(s,a,i,o){var l,c,d,u,h,m,f,p,A,v,x,b,y,w,j,N,_,S,C=s.constructor,E=s.s==a.s?1:-1,T=s.d,B=a.d;if(!s.s)return new C(s);if(!a.s)throw Error(Ul+"Division by zero");for(c=s.e-a.e,_=B.length,j=T.length,f=new C(E),p=f.d=[],d=0;B[d]==(T[d]||0);)++d;if(B[d]>(T[d]||0)&&--c,i==null?b=i=C.precision:o?b=i+(ba(s)-ba(a))+1:b=i,b<0)return new C(0);if(b=b/ds+2|0,d=0,_==1)for(u=0,B=B[0],b++;(d<j||u)&&b--;d++)y=u*Ha+(T[d]||0),p[d]=y/B|0,u=y%B|0;else{for(u=Ha/(B[0]+1)|0,u>1&&(B=e(B,u),T=e(T,u),_=B.length,j=T.length),w=_,A=T.slice(0,_),v=A.length;v<_;)A[v++]=0;S=B.slice(),S.unshift(0),N=B[0],B[1]>=Ha/2&&++N;do u=0,l=t(B,A,_,v),l<0?(x=A[0],_!=v&&(x=x*Ha+(A[1]||0)),u=x/N|0,u>1?(u>=Ha&&(u=Ha-1),h=e(B,u),m=h.length,v=A.length,l=t(h,A,m,v),l==1&&(u--,r(h,_<m?S:B,m))):(u==0&&(l=u=1),h=B.slice()),m=h.length,m<v&&h.unshift(0),r(A,h,v),l==-1&&(v=A.length,l=t(B,A,_,v),l<1&&(u++,r(A,_<v?S:B,v))),v=A.length):l===0&&(u++,A=[0]),p[d++]=u,l&&A[0]?A[v++]=T[w]||0:(A=[T[w]],v=1);while((w++<j||A[0]!==void 0)&&b--)}return p[0]||p.shift(),f.e=c,qn(f,o?i+ba(f)+1:i)}}();function qZ(e,t){var r,s,a,i,o,l,c=0,d=0,u=e.constructor,h=u.precision;if(ba(e)>16)throw Error(vF+ba(e));if(!e.s)return new u(Ho);for(ws=!1,l=h,o=new u(.03125);e.abs().gte(.1);)e=e.times(o),d+=5;for(s=Math.log(Wf(2,d))/Math.LN10*2+5|0,l+=s,r=a=i=new u(Ho),u.precision=l;;){if(a=qn(a.times(e),l),r=r.times(++c),o=i.plus(yu(a,r,l)),nd(o.d).slice(0,l)===nd(i.d).slice(0,l)){for(;d--;)i=qn(i.times(i),l);return u.precision=h,t==null?(ws=!0,qn(i,h)):i}i=o}}function ba(e){for(var t=e.e*ds,r=e.d[0];r>=10;r/=10)t++;return t}function rE(e,t,r){if(t>e.LN10.sd())throw ws=!0,r&&(e.precision=r),Error(Ul+"LN10 precision limit exceeded");return qn(new e(e.LN10),t)}function Ah(e){for(var t="";e--;)t+="0";return t}function Eb(e,t){var r,s,a,i,o,l,c,d,u,h=1,m=10,f=e,p=f.d,A=f.constructor,v=A.precision;if(f.s<1)throw Error(Ul+(f.s?"NaN":"-Infinity"));if(f.eq(Ho))return new A(0);if(t==null?(ws=!1,d=v):d=t,f.eq(10))return t==null&&(ws=!0),rE(A,d);if(d+=m,A.precision=d,r=nd(p),s=r.charAt(0),i=ba(f),Math.abs(i)<15e14){for(;s<7&&s!=1||s==1&&r.charAt(1)>3;)f=f.times(e),r=nd(f.d),s=r.charAt(0),h++;i=ba(f),s>1?(f=new A("0."+r),i++):f=new A(s+"."+r.slice(1))}else return c=rE(A,d+2,v).times(i+""),f=Eb(new A(s+"."+r.slice(1)),d-m).plus(c),A.precision=v,t==null?(ws=!0,qn(f,v)):f;for(l=o=f=yu(f.minus(Ho),f.plus(Ho),d),u=qn(f.times(f),d),a=3;;){if(o=qn(o.times(u),d),c=l.plus(yu(o,new A(a),d)),nd(c.d).slice(0,d)===nd(l.d).slice(0,d))return l=l.times(2),i!==0&&(l=l.plus(rE(A,d+2,v).times(i+""))),l=yu(l,new A(h),d),A.precision=v,t==null?(ws=!0,qn(l,v)):l;l=c,a+=2}}function T$(e,t){var r,s,a;for((r=t.indexOf("."))>-1&&(t=t.replace(".","")),(s=t.search(/e/i))>0?(r<0&&(r=s),r+=+t.slice(s+1),t=t.substring(0,s)):r<0&&(r=t.length),s=0;t.charCodeAt(s)===48;)++s;for(a=t.length;t.charCodeAt(a-1)===48;)--a;if(t=t.slice(s,a),t){if(a-=s,r=r-s-1,e.e=b0(r/ds),e.d=[],s=(r+1)%ds,r<0&&(s+=ds),s<a){for(s&&e.d.push(+t.slice(0,s)),a-=ds;s<a;)e.d.push(+t.slice(s,s+=ds));t=t.slice(s),s=ds-t.length}else s-=a;for(;s--;)t+="0";if(e.d.push(+t),ws&&(e.e>cN||e.e<-cN))throw Error(vF+r)}else e.s=0,e.e=0,e.d=[0];return e}function qn(e,t,r){var s,a,i,o,l,c,d,u,h=e.d;for(o=1,i=h[0];i>=10;i/=10)o++;if(s=t-o,s<0)s+=ds,a=t,d=h[u=0];else{if(u=Math.ceil((s+1)/ds),i=h.length,u>=i)return e;for(d=i=h[u],o=1;i>=10;i/=10)o++;s%=ds,a=s-ds+o}if(r!==void 0&&(i=Wf(10,o-a-1),l=d/i%10|0,c=t<0||h[u+1]!==void 0||d%i,c=r<4?(l||c)&&(r==0||r==(e.s<0?3:2)):l>5||l==5&&(r==4||c||r==6&&(s>0?a>0?d/Wf(10,o-a):0:h[u-1])%10&1||r==(e.s<0?8:7))),t<1||!h[0])return c?(i=ba(e),h.length=1,t=t-i-1,h[0]=Wf(10,(ds-t%ds)%ds),e.e=b0(-t/ds)||0):(h.length=1,h[0]=e.e=e.s=0),e;if(s==0?(h.length=u,i=1,u--):(h.length=u+1,i=Wf(10,ds-s),h[u]=a>0?(d/Wf(10,o-a)%Wf(10,a)|0)*i:0),c)for(;;)if(u==0){(h[0]+=i)==Ha&&(h[0]=1,++e.e);break}else{if(h[u]+=i,h[u]!=Ha)break;h[u--]=0,i=1}for(s=h.length;h[--s]===0;)h.pop();if(ws&&(e.e>cN||e.e<-cN))throw Error(vF+ba(e));return e}function KZ(e,t){var r,s,a,i,o,l,c,d,u,h,m=e.constructor,f=m.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new m(e),ws?qn(t,f):t;if(c=e.d,h=t.d,s=t.e,d=e.e,c=c.slice(),o=d-s,o){for(u=o<0,u?(r=c,o=-o,l=h.length):(r=h,s=d,l=c.length),a=Math.max(Math.ceil(f/ds),l)+2,o>a&&(o=a,r.length=1),r.reverse(),a=o;a--;)r.push(0);r.reverse()}else{for(a=c.length,l=h.length,u=a<l,u&&(l=a),a=0;a<l;a++)if(c[a]!=h[a]){u=c[a]<h[a];break}o=0}for(u&&(r=c,c=h,h=r,t.s=-t.s),l=c.length,a=h.length-l;a>0;--a)c[l++]=0;for(a=h.length;a>o;){if(c[--a]<h[a]){for(i=a;i&&c[--i]===0;)c[i]=Ha-1;--c[i],c[a]+=Ha}c[a]-=h[a]}for(;c[--l]===0;)c.pop();for(;c[0]===0;c.shift())--s;return c[0]?(t.d=c,t.e=s,ws?qn(t,f):t):new m(0)}function Qm(e,t,r){var s,a=ba(e),i=nd(e.d),o=i.length;return t?(r&&(s=r-o)>0?i=i.charAt(0)+"."+i.slice(1)+Ah(s):o>1&&(i=i.charAt(0)+"."+i.slice(1)),i=i+(a<0?"e":"e+")+a):a<0?(i="0."+Ah(-a-1)+i,r&&(s=r-o)>0&&(i+=Ah(s))):a>=o?(i+=Ah(a+1-o),r&&(s=r-a-1)>0&&(i=i+"."+Ah(s))):((s=a+1)<o&&(i=i.slice(0,s)+"."+i.slice(s)),r&&(s=r-o)>0&&(a+1===o&&(i+="."),i+=Ah(s))),e.s<0?"-"+i:i}function P$(e,t){if(e.length>t)return e.length=t,!0}function WZ(e){var t,r,s;function a(i){var o=this;if(!(o instanceof a))return new a(i);if(o.constructor=a,i instanceof a){o.s=i.s,o.e=i.e,o.d=(i=i.d)?i.slice():i;return}if(typeof i=="number"){if(i*0!==0)throw Error(wm+i);if(i>0)o.s=1;else if(i<0)i=-i,o.s=-1;else{o.s=0,o.e=0,o.d=[0];return}if(i===~~i&&i<1e7){o.e=0,o.d=[i];return}return T$(o,i.toString())}else if(typeof i!="string")throw Error(wm+i);if(i.charCodeAt(0)===45?(i=i.slice(1),o.s=-1):o.s=1,pMe.test(i))T$(o,i);else throw Error(wm+i)}if(a.prototype=Bt,a.ROUND_UP=0,a.ROUND_DOWN=1,a.ROUND_CEIL=2,a.ROUND_FLOOR=3,a.ROUND_HALF_UP=4,a.ROUND_HALF_DOWN=5,a.ROUND_HALF_EVEN=6,a.ROUND_HALF_CEIL=7,a.ROUND_HALF_FLOOR=8,a.clone=WZ,a.config=a.set=AMe,e===void 0&&(e={}),e)for(s=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t<s.length;)e.hasOwnProperty(r=s[t++])||(e[r]=this[r]);return a.config(e),a}function AMe(e){if(!e||typeof e!="object")throw Error(Ul+"Object expected");var t,r,s,a=["precision",1,v0,"rounding",0,8,"toExpNeg",-1/0,0,"toExpPos",0,1/0];for(t=0;t<a.length;t+=3)if((s=e[r=a[t]])!==void 0)if(b0(s)===s&&s>=a[t+1]&&s<=a[t+2])this[r]=s;else throw Error(wm+r+": "+s);if((s=e[r="LN10"])!==void 0)if(s==Math.LN10)this[r]=new this(s);else throw Error(wm+r+": "+s);return this}var bF=WZ(mMe);Ho=new bF(1);const Dn=bF;function gMe(e){return yMe(e)||bMe(e)||vMe(e)||xMe()}function xMe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
1212In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function vMe(e,t){if(e){if(typeof e=="string")return LT(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return LT(e,t)}}function bMe(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function yMe(e){if(Array.isArray(e))return LT(e)}function LT(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,s=new Array(t);r<t;r++)s[r]=e[r];return s}var wMe=function(t){return t},YZ={},JZ=function(t){return t===YZ},I$=function(t){return function r(){return arguments.length===0||arguments.length===1&&JZ(arguments.length<=0?void 0:arguments[0])?r:t.apply(void 0,arguments)}},jMe=function e(t,r){return t===1?r:I$(function(){for(var s=arguments.length,a=new Array(s),i=0;i<s;i++)a[i]=arguments[i];var o=a.filter(function(l){return l!==YZ}).length;return o>=t?r.apply(void 0,a):e(t-o,I$(function(){for(var l=arguments.length,c=new Array(l),d=0;d<l;d++)c[d]=arguments[d];var u=a.map(function(h){return JZ(h)?c.shift():h});return r.apply(void 0,gMe(u).concat(c))}))})},eS=function(t){return jMe(t.length,t)},DT=function(t,r){for(var s=[],a=t;a<r;++a)s[a-t]=a;return s},NMe=eS(function(e,t){return Array.isArray(t)?t.map(e):Object.keys(t).map(function(r){return t[r]}).map(e)}),_Me=function(){for(var t=arguments.length,r=new Array(t),s=0;s<t;s++)r[s]=arguments[s];if(!r.length)return wMe;var a=r.reverse(),i=a[0],o=a.slice(1);return function(){return o.reduce(function(l,c){return c(l)},i.apply(void 0,arguments))}},RT=function(t){return Array.isArray(t)?t.reverse():t.split("").reverse.join("")},XZ=function(t){var r=null,s=null;return function(){for(var a=arguments.length,i=new Array(a),o=0;o<a;o++)i[o]=arguments[o];return r&&i.every(function(l,c){return l===r[c]})||(r=i,s=t.apply(void 0,i)),s}};function CMe(e){var t;return e===0?t=1:t=Math.floor(new Dn(e).abs().log(10).toNumber())+1,t}function SMe(e,t,r){for(var s=new Dn(e),a=0,i=[];s.lt(t)&&a<1e5;)i.push(s.toNumber()),s=s.add(r),a++;return i}var kMe=eS(function(e,t,r){var s=+e,a=+t;return s+r*(a-s)}),EMe=eS(function(e,t,r){var s=t-+e;return s=s||1/0,(r-e)/s}),BMe=eS(function(e,t,r){var s=t-+e;return s=s||1/0,Math.max(0,Math.min(1,(r-e)/s))});const tS={rangeStep:SMe,getDigitCount:CMe,interpolateNumber:kMe,uninterpolateNumber:EMe,uninterpolateTruncation:BMe};function UT(e){return IMe(e)||PMe(e)||ZZ(e)||TMe()}function TMe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
1213In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function PMe(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function IMe(e){if(Array.isArray(e))return MT(e)}function Bb(e,t){return LMe(e)||FMe(e,t)||ZZ(e,t)||OMe()}function OMe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1214In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ZZ(e,t){if(e){if(typeof e=="string")return MT(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return MT(e,t)}}function MT(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,s=new Array(t);r<t;r++)s[r]=e[r];return s}function FMe(e,t){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(e)))){var r=[],s=!0,a=!1,i=void 0;try{for(var o=e[Symbol.iterator](),l;!(s=(l=o.next()).done)&&(r.push(l.value),!(t&&r.length===t));s=!0);}catch(c){a=!0,i=c}finally{try{!s&&o.return!=null&&o.return()}finally{if(a)throw i}}return r}}function LMe(e){if(Array.isArray(e))return e}function eee(e){var t=Bb(e,2),r=t[0],s=t[1],a=r,i=s;return r>s&&(a=s,i=r),[a,i]}function tee(e,t,r){if(e.lte(0))return new Dn(0);var s=tS.getDigitCount(e.toNumber()),a=new Dn(10).pow(s),i=e.div(a),o=s!==1?.05:.1,l=new Dn(Math.ceil(i.div(o).toNumber())).add(r).mul(o),c=l.mul(a);return t?c:new Dn(Math.ceil(c))}function DMe(e,t,r){var s=1,a=new Dn(e);if(!a.isint()&&r){var i=Math.abs(e);i<1?(s=new Dn(10).pow(tS.getDigitCount(e)-1),a=new Dn(Math.floor(a.div(s).toNumber())).mul(s)):i>1&&(a=new Dn(Math.floor(e)))}else e===0?a=new Dn(Math.floor((t-1)/2)):r||(a=new Dn(Math.floor(e)));var o=Math.floor((t-1)/2),l=_Me(NMe(function(c){return a.add(new Dn(c-o).mul(s)).toNumber()}),DT);return l(0,t)}function ree(e,t,r,s){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((t-e)/(r-1)))return{step:new Dn(0),tickMin:new Dn(0),tickMax:new Dn(0)};var i=tee(new Dn(t).sub(e).div(r-1),s,a),o;e<=0&&t>=0?o=new Dn(0):(o=new Dn(e).add(t).div(2),o=o.sub(new Dn(o).mod(i)));var l=Math.ceil(o.sub(e).div(i).toNumber()),c=Math.ceil(new Dn(t).sub(o).div(i).toNumber()),d=l+c+1;return d>r?ree(e,t,r,s,a+1):(d<r&&(c=t>0?c+(r-d):c,l=t>0?l:l+(r-d)),{step:i,tickMin:o.sub(new Dn(l).mul(i)),tickMax:o.add(new Dn(c).mul(i))})}function RMe(e){var t=Bb(e,2),r=t[0],s=t[1],a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=Math.max(a,2),l=eee([r,s]),c=Bb(l,2),d=c[0],u=c[1];if(d===-1/0||u===1/0){var h=u===1/0?[d].concat(UT(DT(0,a-1).map(function(){return 1/0}))):[].concat(UT(DT(0,a-1).map(function(){return-1/0})),[u]);return r>s?RT(h):h}if(d===u)return DMe(d,a,i);var m=ree(d,u,o,i),f=m.step,p=m.tickMin,A=m.tickMax,v=tS.rangeStep(p,A.add(new Dn(.1).mul(f)),f);return r>s?RT(v):v}function UMe(e,t){var r=Bb(e,2),s=r[0],a=r[1],i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=eee([s,a]),l=Bb(o,2),c=l[0],d=l[1];if(c===-1/0||d===1/0)return[s,a];if(c===d)return[c];var u=Math.max(t,2),h=tee(new Dn(d).sub(c).div(u-1),i,0),m=[].concat(UT(tS.rangeStep(new Dn(c),new Dn(d).sub(new Dn(.99).mul(h)),h)),[d]);return s>a?RT(m):m}var MMe=XZ(RMe),$Me=XZ(UMe),QMe="Invariant failed";function Hm(e,t){throw new Error(QMe)}var HMe=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function _g(e){"@babel/helpers - typeof";return _g=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_g(e)}function dN(){return dN=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},dN.apply(this,arguments)}function zMe(e,t){return KMe(e)||qMe(e,t)||GMe(e,t)||VMe()}function VMe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1215In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function GMe(e,t){if(e){if(typeof e=="string")return O$(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return O$(e,t)}}function O$(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,s=new Array(t);r<t;r++)s[r]=e[r];return s}function qMe(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var s,a,i,o,l=[],c=!0,d=!1;try{if(i=(r=r.call(e)).next,t!==0)for(;!(c=(s=i.call(r)).done)&&(l.push(s.value),l.length!==t);c=!0);}catch(u){d=!0,a=u}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(d)throw a}}return l}}function KMe(e){if(Array.isArray(e))return e}function WMe(e,t){if(e==null)return{};var r=YMe(e,t),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)s=i[a],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(r[s]=e[s])}return r}function YMe(e,t){if(e==null)return{};var r={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;r[s]=e[s]}return r}function JMe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function XMe(e,t){for(var r=0;r<t.length;r++){var s=t[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,aee(s.key),s)}}function ZMe(e,t,r){return t&&XMe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function e8e(e,t,r){return t=uN(t),t8e(e,nee()?Reflect.construct(t,r||[],uN(e).constructor):t.apply(e,r))}function t8e(e,t){if(t&&(_g(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return r8e(e)}function r8e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function nee(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(nee=function(){return!!e})()}function uN(e){return uN=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},uN(e)}function n8e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&$T(e,t)}function $T(e,t){return $T=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,a){return s.__proto__=a,s},$T(e,t)}function see(e,t,r){return t=aee(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function aee(e){var t=s8e(e,"string");return _g(t)=="symbol"?t:t+""}function s8e(e,t){if(_g(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(_g(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Hy=function(e){function t(){return JMe(this,t),e8e(this,t,arguments)}return n8e(t,e),ZMe(t,[{key:"render",value:function(){var s=this.props,a=s.offset,i=s.layout,o=s.width,l=s.dataKey,c=s.data,d=s.dataPointFormatter,u=s.xAxis,h=s.yAxis,m=WMe(s,HMe),f=Dt(m,!1);this.props.direction==="x"&&u.type!=="number"&&Hm();var p=c.map(function(A){var v=d(A,l),x=v.x,b=v.y,y=v.value,w=v.errorVal;if(!w)return null;var j=[],N,_;if(Array.isArray(w)){var S=zMe(w,2);N=S[0],_=S[1]}else N=_=w;if(i==="vertical"){var C=u.scale,E=b+a,T=E+o,B=E-o,L=C(y-N),P=C(y+_);j.push({x1:P,y1:T,x2:P,y2:B}),j.push({x1:L,y1:E,x2:P,y2:E}),j.push({x1:L,y1:T,x2:L,y2:B})}else if(i==="horizontal"){var F=h.scale,M=x+a,I=M-o,$=M+o,V=F(y-N),R=F(y+_);j.push({x1:I,y1:R,x2:$,y2:R}),j.push({x1:M,y1:V,x2:M,y2:R}),j.push({x1:I,y1:V,x2:$,y2:V})}return oe.createElement(Qr,dN({className:"recharts-errorBar",key:"bar-".concat(j.map(function(Q){return"".concat(Q.x1,"-").concat(Q.x2,"-").concat(Q.y1,"-").concat(Q.y2)}))},f),j.map(function(Q){return oe.createElement("line",dN({},Q,{key:"line-".concat(Q.x1,"-").concat(Q.x2,"-").concat(Q.y1,"-").concat(Q.y2)}))}))});return oe.createElement(Qr,{className:"recharts-errorBars"},p)}}])}(oe.Component);see(Hy,"defaultProps",{stroke:"black",strokeWidth:1.5,width:5,offset:0,layout:"horizontal"});see(Hy,"displayName","ErrorBar");function Tb(e){"@babel/helpers - typeof";return Tb=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Tb(e)}function F$(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,s)}return r}function Lf(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?F$(Object(r),!0).forEach(function(s){a8e(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):F$(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}function a8e(e,t,r){return t=i8e(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i8e(e){var t=o8e(e,"string");return Tb(t)=="symbol"?t:t+""}function o8e(e,t){if(Tb(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(Tb(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var iee=function(t){var r=t.children,s=t.formattedGraphicalItems,a=t.legendWidth,i=t.legendContent,o=Do(r,Mi);if(!o)return null;var l=Mi.defaultProps,c=l!==void 0?Lf(Lf({},l),o.props):{},d;return o.props&&o.props.payload?d=o.props&&o.props.payload:i==="children"?d=(s||[]).reduce(function(u,h){var m=h.item,f=h.props,p=f.sectors||f.data||[];return u.concat(p.map(function(A){return{type:o.props.iconType||m.props.legendType,value:A.name,color:A.fill,payload:A}}))},[]):d=(s||[]).map(function(u){var h=u.item,m=h.type.defaultProps,f=m!==void 0?Lf(Lf({},m),h.props):{},p=f.dataKey,A=f.name,v=f.legendType,x=f.hide;return{inactive:x,dataKey:p,type:c.iconType||v||"square",color:yF(h),value:A||p,payload:f}}),Lf(Lf(Lf({},c),Mi.getWithHeight(o,a)),{},{payload:d,item:o})};function Pb(e){"@babel/helpers - typeof";return Pb=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Pb(e)}function L$(e){return u8e(e)||d8e(e)||c8e(e)||l8e()}function l8e(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
1216In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function c8e(e,t){if(e){if(typeof e=="string")return QT(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return QT(e,t)}}function d8e(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function u8e(e){if(Array.isArray(e))return QT(e)}function QT(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,s=new Array(t);r<t;r++)s[r]=e[r];return s}function D$(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,s)}return r}function $s(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?D$(Object(r),!0).forEach(function(s){LA(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):D$(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}function LA(e,t,r){return t=h8e(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function h8e(e){var t=f8e(e,"string");return Pb(t)=="symbol"?t:t+""}function f8e(e,t){if(Pb(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(Pb(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ps(e,t,r){return wr(e)||wr(t)?r:Da(t)?Zo(e,t,r):er(t)?t(e):r}function xv(e,t,r,s){var a=dMe(e,function(l){return Ps(l,t)});if(r==="number"){var i=a.filter(function(l){return lt(l)||parseFloat(l)});return i.length?[ZC(i),Ch(i)]:[1/0,-1/0]}var o=s?a.filter(function(l){return!wr(l)}):a;return o.map(function(l){return Da(l)||l instanceof Date?l:""})}var m8e=function(t){var r,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],a=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,o=-1,l=(r=s==null?void 0:s.length)!==null&&r!==void 0?r:0;if(l<=1)return 0;if(i&&i.axisType==="angleAxis"&&Math.abs(Math.abs(i.range[1]-i.range[0])-360)<=1e-6)for(var c=i.range,d=0;d<l;d++){var u=d>0?a[d-1].coordinate:a[l-1].coordinate,h=a[d].coordinate,m=d>=l-1?a[0].coordinate:a[d+1].coordinate,f=void 0;if(Qi(h-u)!==Qi(m-h)){var p=[];if(Qi(m-h)===Qi(c[1]-c[0])){f=m;var A=h+c[1]-c[0];p[0]=Math.min(A,(A+u)/2),p[1]=Math.max(A,(A+u)/2)}else{f=u;var v=m+c[1]-c[0];p[0]=Math.min(h,(v+h)/2),p[1]=Math.max(h,(v+h)/2)}var x=[Math.min(h,(f+h)/2),Math.max(h,(f+h)/2)];if(t>x[0]&&t<=x[1]||t>=p[0]&&t<=p[1]){o=a[d].index;break}}else{var b=Math.min(u,m),y=Math.max(u,m);if(t>(b+h)/2&&t<=(y+h)/2){o=a[d].index;break}}}else for(var w=0;w<l;w++)if(w===0&&t<=(s[w].coordinate+s[w+1].coordinate)/2||w>0&&w<l-1&&t>(s[w].coordinate+s[w-1].coordinate)/2&&t<=(s[w].coordinate+s[w+1].coordinate)/2||w===l-1&&t>(s[w].coordinate+s[w-1].coordinate)/2){o=s[w].index;break}return o},yF=function(t){var r,s=t,a=s.type.displayName,i=(r=t.type)!==null&&r!==void 0&&r.defaultProps?$s($s({},t.type.defaultProps),t.props):t.props,o=i.stroke,l=i.fill,c;switch(a){case"Line":c=o;break;case"Area":case"Radar":c=o&&o!=="none"?o:l;break;default:c=l;break}return c},p8e=function(t){var r=t.barSize,s=t.totalSize,a=t.stackGroups,i=a===void 0?{}:a;if(!i)return{};for(var o={},l=Object.keys(i),c=0,d=l.length;c<d;c++)for(var u=i[l[c]].stackGroups,h=Object.keys(u),m=0,f=h.length;m<f;m++){var p=u[h[m]],A=p.items,v=p.cateAxisId,x=A.filter(function(_){return bu(_.type).indexOf("Bar")>=0});if(x&&x.length){var b=x[0].type.defaultProps,y=b!==void 0?$s($s({},b),x[0].props):x[0].props,w=y.barSize,j=y[v];o[j]||(o[j]=[]);var N=wr(w)?r:w;o[j].push({item:x[0],stackList:x.slice(1),barSize:wr(N)?void 0:Hi(N,s,0)})}}return o},A8e=function(t){var r=t.barGap,s=t.barCategoryGap,a=t.bandSize,i=t.sizeList,o=i===void 0?[]:i,l=t.maxBarSize,c=o.length;if(c<1)return null;var d=Hi(r,a,0,!0),u,h=[];if(o[0].barSize===+o[0].barSize){var m=!1,f=a/c,p=o.reduce(function(w,j){return w+j.barSize||0},0);p+=(c-1)*d,p>=a&&(p-=(c-1)*d,d=0),p>=a&&f>0&&(m=!0,f*=.9,p=c*f);var A=(a-p)/2>>0,v={offset:A-d,size:0};u=o.reduce(function(w,j){var N={item:j.item,position:{offset:v.offset+v.size+d,size:m?f:j.barSize}},_=[].concat(L$(w),[N]);return v=_[_.length-1].position,j.stackList&&j.stackList.length&&j.stackList.forEach(function(S){_.push({item:S,position:v})}),_},h)}else{var x=Hi(s,a,0,!0);a-2*x-(c-1)*d<=0&&(d=0);var b=(a-2*x-(c-1)*d)/c;b>1&&(b>>=0);var y=l===+l?Math.min(b,l):b;u=o.reduce(function(w,j,N){var _=[].concat(L$(w),[{item:j.item,position:{offset:x+(b+d)*N+(b-y)/2,size:y}}]);return j.stackList&&j.stackList.length&&j.stackList.forEach(function(S){_.push({item:S,position:_[_.length-1].position})}),_},h)}return u},g8e=function(t,r,s,a){var i=s.children,o=s.width,l=s.margin,c=o-(l.left||0)-(l.right||0),d=iee({children:i,legendWidth:c});if(d){var u=a||{},h=u.width,m=u.height,f=d.align,p=d.verticalAlign,A=d.layout;if((A==="vertical"||A==="horizontal"&&p==="middle")&&f!=="center"&&lt(t[f]))return $s($s({},t),{},LA({},f,t[f]+(h||0)));if((A==="horizontal"||A==="vertical"&&f==="center")&&p!=="middle"&&lt(t[p]))return $s($s({},t),{},LA({},p,t[p]+(m||0)))}return t},x8e=function(t,r,s){return wr(r)?!0:t==="horizontal"?r==="yAxis":t==="vertical"||s==="x"?r==="xAxis":s==="y"?r==="yAxis":!0},oee=function(t,r,s,a,i){var o=r.props.children,l=el(o,Hy).filter(function(d){return x8e(a,i,d.props.direction)});if(l&&l.length){var c=l.map(function(d){return d.props.dataKey});return t.reduce(function(d,u){var h=Ps(u,s);if(wr(h))return d;var m=Array.isArray(h)?[ZC(h),Ch(h)]:[h,h],f=c.reduce(function(p,A){var v=Ps(u,A,0),x=m[0]-Math.abs(Array.isArray(v)?v[0]:v),b=m[1]+Math.abs(Array.isArray(v)?v[1]:v);return[Math.min(x,p[0]),Math.max(b,p[1])]},[1/0,-1/0]);return[Math.min(f[0],d[0]),Math.max(f[1],d[1])]},[1/0,-1/0])}return null},v8e=function(t,r,s,a,i){var o=r.map(function(l){return oee(t,l,s,i,a)}).filter(function(l){return!wr(l)});return o&&o.length?o.reduce(function(l,c){return[Math.min(l[0],c[0]),Math.max(l[1],c[1])]},[1/0,-1/0]):null},lee=function(t,r,s,a,i){var o=r.map(function(c){var d=c.props.dataKey;return s==="number"&&d&&oee(t,c,d,a)||xv(t,d,s,i)});if(s==="number")return o.reduce(function(c,d){return[Math.min(c[0],d[0]),Math.max(c[1],d[1])]},[1/0,-1/0]);var l={};return o.reduce(function(c,d){for(var u=0,h=d.length;u<h;u++)l[d[u]]||(l[d[u]]=!0,c.push(d[u]));return c},[])},cee=function(t,r){return t==="horizontal"&&r==="xAxis"||t==="vertical"&&r==="yAxis"||t==="centric"&&r==="angleAxis"||t==="radial"&&r==="radiusAxis"},dee=function(t,r,s,a){if(a)return t.map(function(c){return c.coordinate});var i,o,l=t.map(function(c){return c.coordinate===r&&(i=!0),c.coordinate===s&&(o=!0),c.coordinate});return i||l.push(r),o||l.push(s),l},uu=function(t,r,s){if(!t)return null;var a=t.scale,i=t.duplicateDomain,o=t.type,l=t.range,c=t.realScaleType==="scaleBand"?a.bandwidth()/2:2,d=(r||s)&&o==="category"&&a.bandwidth?a.bandwidth()/c:0;if(d=t.axisType==="angleAxis"&&(l==null?void 0:l.length)>=2?Qi(l[0]-l[1])*2*d:d,r&&(t.ticks||t.niceTicks)){var u=(t.ticks||t.niceTicks).map(function(h){var m=i?i.indexOf(h):h;return{coordinate:a(m)+d,value:h,offset:d}});return u.filter(function(h){return!m0(h.coordinate)})}return t.isCategorical&&t.categoricalDomain?t.categoricalDomain.map(function(h,m){return{coordinate:a(h)+d,value:h,index:m,offset:d}}):a.ticks&&!s?a.ticks(t.tickCount).map(function(h){return{coordinate:a(h)+d,value:h,offset:d}}):a.domain().map(function(h,m){return{coordinate:a(h)+d,value:i?i[h]:h,index:m,offset:d}})},nE=new WeakMap,h1=function(t,r){if(typeof r!="function")return t;nE.has(t)||nE.set(t,new WeakMap);var s=nE.get(t);if(s.has(r))return s.get(r);var a=function(){t.apply(void 0,arguments),r.apply(void 0,arguments)};return s.set(r,a),a},uee=function(t,r,s){var a=t.scale,i=t.type,o=t.layout,l=t.axisType;if(a==="auto")return o==="radial"&&l==="radiusAxis"?{scale:Nb(),realScaleType:"band"}:o==="radial"&&l==="angleAxis"?{scale:aN(),realScaleType:"linear"}:i==="category"&&r&&(r.indexOf("LineChart")>=0||r.indexOf("AreaChart")>=0||r.indexOf("ComposedChart")>=0&&!s)?{scale:gv(),realScaleType:"point"}:i==="category"?{scale:Nb(),realScaleType:"band"}:{scale:aN(),realScaleType:"linear"};if(Um(a)){var c="scale".concat(UC(a));return{scale:(B$[c]||gv)(),realScaleType:B$[c]?c:"point"}}return er(a)?{scale:a}:{scale:gv(),realScaleType:"point"}},R$=1e-4,hee=function(t){var r=t.domain();if(!(!r||r.length<=2)){var s=r.length,a=t.range(),i=Math.min(a[0],a[1])-R$,o=Math.max(a[0],a[1])+R$,l=t(r[0]),c=t(r[s-1]);(l<i||l>o||c<i||c>o)&&t.domain([r[0],r[s-1]])}},b8e=function(t,r){if(!t)return null;for(var s=0,a=t.length;s<a;s++)if(t[s].item===r)return t[s].position;return null},y8e=function(t,r){if(!r||r.length!==2||!lt(r[0])||!lt(r[1]))return t;var s=Math.min(r[0],r[1]),a=Math.max(r[0],r[1]),i=[t[0],t[1]];return(!lt(t[0])||t[0]<s)&&(i[0]=s),(!lt(t[1])||t[1]>a)&&(i[1]=a),i[0]>a&&(i[0]=a),i[1]<s&&(i[1]=s),i},w8e=function(t){var r=t.length;if(!(r<=0))for(var s=0,a=t[0].length;s<a;++s)for(var i=0,o=0,l=0;l<r;++l){var c=m0(t[l][s][1])?t[l][s][0]:t[l][s][1];c>=0?(t[l][s][0]=i,t[l][s][1]=i+c,i=t[l][s][1]):(t[l][s][0]=o,t[l][s][1]=o+c,o=t[l][s][1])}},j8e=function(t){var r=t.length;if(!(r<=0))for(var s=0,a=t[0].length;s<a;++s)for(var i=0,o=0;o<r;++o){var l=m0(t[o][s][1])?t[o][s][0]:t[o][s][1];l>=0?(t[o][s][0]=i,t[o][s][1]=i+l,i=t[o][s][1]):(t[o][s][0]=0,t[o][s][1]=0)}},N8e={sign:w8e,expand:H4e,none:Ag,silhouette:z4e,wiggle:V4e,positive:j8e},_8e=function(t,r,s){var a=r.map(function(l){return l.props.dataKey}),i=N8e[s],o=Q4e().keys(a).value(function(l,c){return+Ps(l,c,0)}).order(fT).offset(i);return o(t)},C8e=function(t,r,s,a,i,o){if(!t)return null;var l=o?r.reverse():r,c={},d=l.reduce(function(h,m){var f,p=(f=m.type)!==null&&f!==void 0&&f.defaultProps?$s($s({},m.type.defaultProps),m.props):m.props,A=p.stackId,v=p.hide;if(v)return h;var x=p[s],b=h[x]||{hasStack:!1,stackGroups:{}};if(Da(A)){var y=b.stackGroups[A]||{numericAxisId:s,cateAxisId:a,items:[]};y.items.push(m),b.hasStack=!0,b.stackGroups[A]=y}else b.stackGroups[sp("_stackId_")]={numericAxisId:s,cateAxisId:a,items:[m]};return $s($s({},h),{},LA({},x,b))},c),u={};return Object.keys(d).reduce(function(h,m){var f=d[m];if(f.hasStack){var p={};f.stackGroups=Object.keys(f.stackGroups).reduce(function(A,v){var x=f.stackGroups[v];return $s($s({},A),{},LA({},v,{numericAxisId:s,cateAxisId:a,items:x.items,stackedData:_8e(t,x.items,i)}))},p)}return $s($s({},h),{},LA({},m,f))},u)},fee=function(t,r){var s=r.realScaleType,a=r.type,i=r.tickCount,o=r.originalDomain,l=r.allowDecimals,c=s||r.scale;if(c!=="auto"&&c!=="linear")return null;if(i&&a==="number"&&o&&(o[0]==="auto"||o[1]==="auto")){var d=t.domain();if(!d.length)return null;var u=MMe(d,i,l);return t.domain([ZC(u),Ch(u)]),{niceTicks:u}}if(i&&a==="number"){var h=t.domain(),m=$Me(h,i,l);return{niceTicks:m}}return null};function hN(e){var t=e.axis,r=e.ticks,s=e.bandSize,a=e.entry,i=e.index,o=e.dataKey;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!wr(a[t.dataKey])){var l=D2(r,"value",a[t.dataKey]);if(l)return l.coordinate+s/2}return r[i]?r[i].coordinate+s/2:null}var c=Ps(a,wr(o)?t.dataKey:o);return wr(c)?null:t.scale(c)}var U$=function(t){var r=t.axis,s=t.ticks,a=t.offset,i=t.bandSize,o=t.entry,l=t.index;if(r.type==="category")return s[l]?s[l].coordinate+a:null;var c=Ps(o,r.dataKey,r.domain[l]);return wr(c)?null:r.scale(c)-i/2+a},S8e=function(t){var r=t.numericAxis,s=r.scale.domain();if(r.type==="number"){var a=Math.min(s[0],s[1]),i=Math.max(s[0],s[1]);return a<=0&&i>=0?0:i<0?i:a}return s[0]},k8e=function(t,r){var s,a=(s=t.type)!==null&&s!==void 0&&s.defaultProps?$s($s({},t.type.defaultProps),t.props):t.props,i=a.stackId;if(Da(i)){var o=r[i];if(o){var l=o.items.indexOf(t);return l>=0?o.stackedData[l]:null}}return null},E8e=function(t){return t.reduce(function(r,s){return[ZC(s.concat([r[0]]).filter(lt)),Ch(s.concat([r[1]]).filter(lt))]},[1/0,-1/0])},mee=function(t,r,s){return Object.keys(t).reduce(function(a,i){var o=t[i],l=o.stackedData,c=l.reduce(function(d,u){var h=E8e(u.slice(r,s+1));return[Math.min(d[0],h[0]),Math.max(d[1],h[1])]},[1/0,-1/0]);return[Math.min(c[0],a[0]),Math.max(c[1],a[1])]},[1/0,-1/0]).map(function(a){return a===1/0||a===-1/0?0:a})},M$=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,$$=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,HT=function(t,r,s){if(er(t))return t(r,s);if(!Array.isArray(t))return r;var a=[];if(lt(t[0]))a[0]=s?t[0]:Math.min(t[0],r[0]);else if(M$.test(t[0])){var i=+M$.exec(t[0])[1];a[0]=r[0]-i}else er(t[0])?a[0]=t[0](r[0]):a[0]=r[0];if(lt(t[1]))a[1]=s?t[1]:Math.max(t[1],r[1]);else if($$.test(t[1])){var o=+$$.exec(t[1])[1];a[1]=r[1]+o}else er(t[1])?a[1]=t[1](r[1]):a[1]=r[1];return a},fN=function(t,r,s){if(t&&t.scale&&t.scale.bandwidth){var a=t.scale.bandwidth();if(!s||a>0)return a}if(t&&r&&r.length>=2){for(var i=WO(r,function(h){return h.coordinate}),o=1/0,l=1,c=i.length;l<c;l++){var d=i[l],u=i[l-1];o=Math.min((d.coordinate||0)-(u.coordinate||0),o)}return o===1/0?0:o}return s?void 0:0},Q$=function(t,r,s){return!t||!t.length||Yh(t,Zo(s,"type.defaultProps.domain"))?r:t},pee=function(t,r){var s=t.type.defaultProps?$s($s({},t.type.defaultProps),t.props):t.props,a=s.dataKey,i=s.name,o=s.unit,l=s.formatter,c=s.tooltipType,d=s.chartType,u=s.hide;return $s($s({},Dt(t,!1)),{},{dataKey:a,unit:o,formatter:l,name:i||a,color:yF(t),value:Ps(r,a),type:c,payload:r,chartType:d,hide:u})};function Ib(e){"@babel/helpers - typeof";return Ib=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ib(e)}function H$(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,s)}return r}function eu(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?H$(Object(r),!0).forEach(function(s){Aee(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):H$(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}function Aee(e,t,r){return t=B8e(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function B8e(e){var t=T8e(e,"string");return Ib(t)=="symbol"?t:t+""}function T8e(e,t){if(Ib(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(Ib(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function P8e(e,t){return L8e(e)||F8e(e,t)||O8e(e,t)||I8e()}function I8e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1217In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function O8e(e,t){if(e){if(typeof e=="string")return z$(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return z$(e,t)}}function z$(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,s=new Array(t);r<t;r++)s[r]=e[r];return s}function F8e(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var s,a,i,o,l=[],c=!0,d=!1;try{if(i=(r=r.call(e)).next,t!==0)for(;!(c=(s=i.call(r)).done)&&(l.push(s.value),l.length!==t);c=!0);}catch(u){d=!0,a=u}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(d)throw a}}return l}}function L8e(e){if(Array.isArray(e))return e}var mN=Math.PI/180,D8e=function(t){return t*180/Math.PI},yn=function(t,r,s,a){return{x:t+Math.cos(-mN*a)*s,y:r+Math.sin(-mN*a)*s}},gee=function(t,r){var s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(t-(s.left||0)-(s.right||0)),Math.abs(r-(s.top||0)-(s.bottom||0)))/2},xee=function(t,r,s,a,i){var o=t.width,l=t.height,c=t.startAngle,d=t.endAngle,u=Hi(t.cx,o,o/2),h=Hi(t.cy,l,l/2),m=gee(o,l,s),f=Hi(t.innerRadius,m,0),p=Hi(t.outerRadius,m,m*.8),A=Object.keys(r);return A.reduce(function(v,x){var b=r[x],y=b.domain,w=b.reversed,j;if(wr(b.range))a==="angleAxis"?j=[c,d]:a==="radiusAxis"&&(j=[f,p]),w&&(j=[j[1],j[0]]);else{j=b.range;var N=j,_=P8e(N,2);c=_[0],d=_[1]}var S=uee(b,i),C=S.realScaleType,E=S.scale;E.domain(y).range(j),hee(E);var T=fee(E,eu(eu({},b),{},{realScaleType:C})),B=eu(eu(eu({},b),T),{},{range:j,radius:p,realScaleType:C,scale:E,cx:u,cy:h,innerRadius:f,outerRadius:p,startAngle:c,endAngle:d});return eu(eu({},v),{},Aee({},x,B))},{})},R8e=function(t,r){var s=t.x,a=t.y,i=r.x,o=r.y;return Math.sqrt(Math.pow(s-i,2)+Math.pow(a-o,2))},U8e=function(t,r){var s=t.x,a=t.y,i=r.cx,o=r.cy,l=R8e({x:s,y:a},{x:i,y:o});if(l<=0)return{radius:l};var c=(s-i)/l,d=Math.acos(c);return a>o&&(d=2*Math.PI-d),{radius:l,angle:D8e(d),angleInRadian:d}},M8e=function(t){var r=t.startAngle,s=t.endAngle,a=Math.floor(r/360),i=Math.floor(s/360),o=Math.min(a,i);return{startAngle:r-o*360,endAngle:s-o*360}},$8e=function(t,r){var s=r.startAngle,a=r.endAngle,i=Math.floor(s/360),o=Math.floor(a/360),l=Math.min(i,o);return t+l*360},V$=function(t,r){var s=t.x,a=t.y,i=U8e({x:s,y:a},r),o=i.radius,l=i.angle,c=r.innerRadius,d=r.outerRadius;if(o<c||o>d)return!1;if(o===0)return!0;var u=M8e(r),h=u.startAngle,m=u.endAngle,f=l,p;if(h<=m){for(;f>m;)f-=360;for(;f<h;)f+=360;p=f>=h&&f<=m}else{for(;f>h;)f-=360;for(;f<m;)f+=360;p=f>=m&&f<=h}return p?eu(eu({},r),{},{radius:o,angle:$8e(f,r)}):null},vee=function(t){return!g.isValidElement(t)&&!er(t)&&typeof t!="boolean"?t.className:""};function Ob(e){"@babel/helpers - typeof";return Ob=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ob(e)}var Q8e=["offset"];function H8e(e){return q8e(e)||G8e(e)||V8e(e)||z8e()}function z8e(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
1218In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function V8e(e,t){if(e){if(typeof e=="string")return zT(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return zT(e,t)}}function G8e(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function q8e(e){if(Array.isArray(e))return zT(e)}function zT(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,s=new Array(t);r<t;r++)s[r]=e[r];return s}function K8e(e,t){if(e==null)return{};var r=W8e(e,t),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)s=i[a],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(r[s]=e[s])}return r}function W8e(e,t){if(e==null)return{};var r={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;r[s]=e[s]}return r}function G$(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,s)}return r}function Ba(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?G$(Object(r),!0).forEach(function(s){Y8e(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):G$(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}function Y8e(e,t,r){return t=J8e(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function J8e(e){var t=X8e(e,"string");return Ob(t)=="symbol"?t:t+""}function X8e(e,t){if(Ob(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(Ob(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Fb(){return Fb=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},Fb.apply(this,arguments)}var Z8e=function(t){var r=t.value,s=t.formatter,a=wr(t.children)?r:t.children;return er(s)?s(a):a},e$e=function(t,r){var s=Qi(r-t),a=Math.min(Math.abs(r-t),360);return s*a},t$e=function(t,r,s){var a=t.position,i=t.viewBox,o=t.offset,l=t.className,c=i,d=c.cx,u=c.cy,h=c.innerRadius,m=c.outerRadius,f=c.startAngle,p=c.endAngle,A=c.clockWise,v=(h+m)/2,x=e$e(f,p),b=x>=0?1:-1,y,w;a==="insideStart"?(y=f+b*o,w=A):a==="insideEnd"?(y=p-b*o,w=!A):a==="end"&&(y=p+b*o,w=A),w=x<=0?w:!w;var j=yn(d,u,v,y),N=yn(d,u,v,y+(w?1:-1)*359),_="M".concat(j.x,",").concat(j.y,`
1219    A`).concat(v,",").concat(v,",0,1,").concat(w?0:1,`,
1220    `).concat(N.x,",").concat(N.y),S=wr(t.id)?sp("recharts-radial-line-"):t.id;return oe.createElement("text",Fb({},s,{dominantBaseline:"central",className:fr("recharts-radial-bar-label",l)}),oe.createElement("defs",null,oe.createElement("path",{id:S,d:_})),oe.createElement("textPath",{xlinkHref:"#".concat(S)},r))},r$e=function(t){var r=t.viewBox,s=t.offset,a=t.position,i=r,o=i.cx,l=i.cy,c=i.innerRadius,d=i.outerRadius,u=i.startAngle,h=i.endAngle,m=(u+h)/2;if(a==="outside"){var f=yn(o,l,d+s,m),p=f.x,A=f.y;return{x:p,y:A,textAnchor:p>=o?"start":"end",verticalAnchor:"middle"}}if(a==="center")return{x:o,y:l,textAnchor:"middle",verticalAnchor:"middle"};if(a==="centerTop")return{x:o,y:l,textAnchor:"middle",verticalAnchor:"start"};if(a==="centerBottom")return{x:o,y:l,textAnchor:"middle",verticalAnchor:"end"};var v=(c+d)/2,x=yn(o,l,v,m),b=x.x,y=x.y;return{x:b,y,textAnchor:"middle",verticalAnchor:"middle"}},n$e=function(t){var r=t.viewBox,s=t.parentViewBox,a=t.offset,i=t.position,o=r,l=o.x,c=o.y,d=o.width,u=o.height,h=u>=0?1:-1,m=h*a,f=h>0?"end":"start",p=h>0?"start":"end",A=d>=0?1:-1,v=A*a,x=A>0?"end":"start",b=A>0?"start":"end";if(i==="top"){var y={x:l+d/2,y:c-h*a,textAnchor:"middle",verticalAnchor:f};return Ba(Ba({},y),s?{height:Math.max(c-s.y,0),width:d}:{})}if(i==="bottom"){var w={x:l+d/2,y:c+u+m,textAnchor:"middle",verticalAnchor:p};return Ba(Ba({},w),s?{height:Math.max(s.y+s.height-(c+u),0),width:d}:{})}if(i==="left"){var j={x:l-v,y:c+u/2,textAnchor:x,verticalAnchor:"middle"};return Ba(Ba({},j),s?{width:Math.max(j.x-s.x,0),height:u}:{})}if(i==="right"){var N={x:l+d+v,y:c+u/2,textAnchor:b,verticalAnchor:"middle"};return Ba(Ba({},N),s?{width:Math.max(s.x+s.width-N.x,0),height:u}:{})}var _=s?{width:d,height:u}:{};return i==="insideLeft"?Ba({x:l+v,y:c+u/2,textAnchor:b,verticalAnchor:"middle"},_):i==="insideRight"?Ba({x:l+d-v,y:c+u/2,textAnchor:x,verticalAnchor:"middle"},_):i==="insideTop"?Ba({x:l+d/2,y:c+m,textAnchor:"middle",verticalAnchor:p},_):i==="insideBottom"?Ba({x:l+d/2,y:c+u-m,textAnchor:"middle",verticalAnchor:f},_):i==="insideTopLeft"?Ba({x:l+v,y:c+m,textAnchor:b,verticalAnchor:p},_):i==="insideTopRight"?Ba({x:l+d-v,y:c+m,textAnchor:x,verticalAnchor:p},_):i==="insideBottomLeft"?Ba({x:l+v,y:c+u-m,textAnchor:b,verticalAnchor:f},_):i==="insideBottomRight"?Ba({x:l+d-v,y:c+u-m,textAnchor:x,verticalAnchor:f},_):d0(i)&&(lt(i.x)||um(i.x))&&(lt(i.y)||um(i.y))?Ba({x:l+Hi(i.x,d),y:c+Hi(i.y,u),textAnchor:"end",verticalAnchor:"end"},_):Ba({x:l+d/2,y:c+u/2,textAnchor:"middle",verticalAnchor:"middle"},_)},s$e=function(t){return"cx"in t&&lt(t.cx)};function qa(e){var t=e.offset,r=t===void 0?5:t,s=K8e(e,Q8e),a=Ba({offset:r},s),i=a.viewBox,o=a.position,l=a.value,c=a.children,d=a.content,u=a.className,h=u===void 0?"":u,m=a.textBreakAll;if(!i||wr(l)&&wr(c)&&!g.isValidElement(d)&&!er(d))return null;if(g.isValidElement(d))return g.cloneElement(d,a);var f;if(er(d)){if(f=g.createElement(d,a),g.isValidElement(f))return f}else f=Z8e(a);var p=s$e(i),A=Dt(a,!0);if(p&&(o==="insideStart"||o==="insideEnd"||o==="end"))return t$e(a,f,A);var v=p?r$e(a):n$e(a);return oe.createElement($m,Fb({className:fr("recharts-label",h)},A,v,{breakAll:m}),f)}qa.displayName="Label";var bee=function(t){var r=t.cx,s=t.cy,a=t.angle,i=t.startAngle,o=t.endAngle,l=t.r,c=t.radius,d=t.innerRadius,u=t.outerRadius,h=t.x,m=t.y,f=t.top,p=t.left,A=t.width,v=t.height,x=t.clockWise,b=t.labelViewBox;if(b)return b;if(lt(A)&&lt(v)){if(lt(h)&&lt(m))return{x:h,y:m,width:A,height:v};if(lt(f)&&lt(p))return{x:f,y:p,width:A,height:v}}return lt(h)&&lt(m)?{x:h,y:m,width:0,height:0}:lt(r)&&lt(s)?{cx:r,cy:s,startAngle:i||a||0,endAngle:o||a||0,innerRadius:d||0,outerRadius:u||c||l||0,clockWise:x}:t.viewBox?t.viewBox:{}},a$e=function(t,r){return t?t===!0?oe.createElement(qa,{key:"label-implicit",viewBox:r}):Da(t)?oe.createElement(qa,{key:"label-implicit",viewBox:r,value:t}):g.isValidElement(t)?t.type===qa?g.cloneElement(t,{key:"label-implicit",viewBox:r}):oe.createElement(qa,{key:"label-implicit",content:t,viewBox:r}):er(t)?oe.createElement(qa,{key:"label-implicit",content:t,viewBox:r}):d0(t)?oe.createElement(qa,Fb({viewBox:r},t,{key:"label-implicit"})):null:null},i$e=function(t,r){var s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!t||!t.children&&s&&!t.label)return null;var a=t.children,i=bee(t),o=el(a,qa).map(function(c,d){return g.cloneElement(c,{viewBox:r||i,key:"label-".concat(d)})});if(!s)return o;var l=a$e(t.label,r||i);return[l].concat(H8e(o))};qa.parseViewBox=bee;qa.renderCallByParent=i$e;function o$e(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}var l$e=o$e;const yee=wn(l$e);function Lb(e){"@babel/helpers - typeof";return Lb=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Lb(e)}var c$e=["valueAccessor"],d$e=["data","dataKey","clockWise","id","textBreakAll"];function u$e(e){return p$e(e)||m$e(e)||f$e(e)||h$e()}function h$e(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
1221In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function f$e(e,t){if(e){if(typeof e=="string")return VT(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return VT(e,t)}}function m$e(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function p$e(e){if(Array.isArray(e))return VT(e)}function VT(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,s=new Array(t);r<t;r++)s[r]=e[r];return s}function pN(){return pN=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},pN.apply(this,arguments)}function q$(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,s)}return r}function K$(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?q$(Object(r),!0).forEach(function(s){A$e(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):q$(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}function A$e(e,t,r){return t=g$e(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function g$e(e){var t=x$e(e,"string");return Lb(t)=="symbol"?t:t+""}function x$e(e,t){if(Lb(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(Lb(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function W$(e,t){if(e==null)return{};var r=v$e(e,t),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)s=i[a],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(r[s]=e[s])}return r}function v$e(e,t){if(e==null)return{};var r={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;r[s]=e[s]}return r}var b$e=function(t){return Array.isArray(t.value)?yee(t.value):t.value};function wc(e){var t=e.valueAccessor,r=t===void 0?b$e:t,s=W$(e,c$e),a=s.data,i=s.dataKey,o=s.clockWise,l=s.id,c=s.textBreakAll,d=W$(s,d$e);return!a||!a.length?null:oe.createElement(Qr,{className:"recharts-label-list"},a.map(function(u,h){var m=wr(i)?r(u,h):Ps(u&&u.payload,i),f=wr(l)?{}:{id:"".concat(l,"-").concat(h)};return oe.createElement(qa,pN({},Dt(u,!0),d,f,{parentViewBox:u.parentViewBox,value:m,textBreakAll:c,viewBox:qa.parseViewBox(wr(o)?u:K$(K$({},u),{},{clockWise:o})),key:"label-".concat(h),index:h}))}))}wc.displayName="LabelList";function y$e(e,t){return e?e===!0?oe.createElement(wc,{key:"labelList-implicit",data:t}):oe.isValidElement(e)||er(e)?oe.createElement(wc,{key:"labelList-implicit",data:t,content:e}):d0(e)?oe.createElement(wc,pN({data:t},e,{key:"labelList-implicit"})):null:null}function w$e(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&r&&!e.label)return null;var s=e.children,a=el(s,wc).map(function(o,l){return g.cloneElement(o,{data:t,key:"labelList-".concat(l)})});if(!r)return a;var i=y$e(e.label,t);return[i].concat(u$e(a))}wc.renderCallByParent=w$e;function Db(e){"@babel/helpers - typeof";return Db=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Db(e)}function GT(){return GT=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},GT.apply(this,arguments)}function Y$(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,s)}return r}function J$(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Y$(Object(r),!0).forEach(function(s){j$e(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Y$(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}function j$e(e,t,r){return t=N$e(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function N$e(e){var t=_$e(e,"string");return Db(t)=="symbol"?t:t+""}function _$e(e,t){if(Db(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(Db(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var C$e=function(t,r){var s=Qi(r-t),a=Math.min(Math.abs(r-t),359.999);return s*a},f1=function(t){var r=t.cx,s=t.cy,a=t.radius,i=t.angle,o=t.sign,l=t.isExternal,c=t.cornerRadius,d=t.cornerIsExternal,u=c*(l?1:-1)+a,h=Math.asin(c/u)/mN,m=d?i:i+o*h,f=yn(r,s,u,m),p=yn(r,s,a,m),A=d?i-o*h:i,v=yn(r,s,u*Math.cos(h*mN),A);return{center:f,circleTangency:p,lineTangency:v,theta:h}},wee=function(t){var r=t.cx,s=t.cy,a=t.innerRadius,i=t.outerRadius,o=t.startAngle,l=t.endAngle,c=C$e(o,l),d=o+c,u=yn(r,s,i,o),h=yn(r,s,i,d),m="M ".concat(u.x,",").concat(u.y,`
1222    A `).concat(i,",").concat(i,`,0,
1223    `).concat(+(Math.abs(c)>180),",").concat(+(o>d),`,
1224    `).concat(h.x,",").concat(h.y,`
1225  `);if(a>0){var f=yn(r,s,a,o),p=yn(r,s,a,d);m+="L ".concat(p.x,",").concat(p.y,`
1226            A `).concat(a,",").concat(a,`,0,
1227            `).concat(+(Math.abs(c)>180),",").concat(+(o<=d),`,
1228            `).concat(f.x,",").concat(f.y," Z")}else m+="L ".concat(r,",").concat(s," Z");return m},S$e=function(t){var r=t.cx,s=t.cy,a=t.innerRadius,i=t.outerRadius,o=t.cornerRadius,l=t.forceCornerRadius,c=t.cornerIsExternal,d=t.startAngle,u=t.endAngle,h=Qi(u-d),m=f1({cx:r,cy:s,radius:i,angle:d,sign:h,cornerRadius:o,cornerIsExternal:c}),f=m.circleTangency,p=m.lineTangency,A=m.theta,v=f1({cx:r,cy:s,radius:i,angle:u,sign:-h,cornerRadius:o,cornerIsExternal:c}),x=v.circleTangency,b=v.lineTangency,y=v.theta,w=c?Math.abs(d-u):Math.abs(d-u)-A-y;if(w<0)return l?"M ".concat(p.x,",").concat(p.y,`
1229        a`).concat(o,",").concat(o,",0,0,1,").concat(o*2,`,0
1230        a`).concat(o,",").concat(o,",0,0,1,").concat(-o*2,`,0
1231      `):wee({cx:r,cy:s,innerRadius:a,outerRadius:i,startAngle:d,endAngle:u});var j="M ".concat(p.x,",").concat(p.y,`
1232    A`).concat(o,",").concat(o,",0,0,").concat(+(h<0),",").concat(f.x,",").concat(f.y,`
1233    A`).concat(i,",").concat(i,",0,").concat(+(w>180),",").concat(+(h<0),",").concat(x.x,",").concat(x.y,`
1234    A`).concat(o,",").concat(o,",0,0,").concat(+(h<0),",").concat(b.x,",").concat(b.y,`
1235  `);if(a>0){var N=f1({cx:r,cy:s,radius:a,angle:d,sign:h,isExternal:!0,cornerRadius:o,cornerIsExternal:c}),_=N.circleTangency,S=N.lineTangency,C=N.theta,E=f1({cx:r,cy:s,radius:a,angle:u,sign:-h,isExternal:!0,cornerRadius:o,cornerIsExternal:c}),T=E.circleTangency,B=E.lineTangency,L=E.theta,P=c?Math.abs(d-u):Math.abs(d-u)-C-L;if(P<0&&o===0)return"".concat(j,"L").concat(r,",").concat(s,"Z");j+="L".concat(B.x,",").concat(B.y,`
1236      A`).concat(o,",").concat(o,",0,0,").concat(+(h<0),",").concat(T.x,",").concat(T.y,`
1237      A`).concat(a,",").concat(a,",0,").concat(+(P>180),",").concat(+(h>0),",").concat(_.x,",").concat(_.y,`
1238      A`).concat(o,",").concat(o,",0,0,").concat(+(h<0),",").concat(S.x,",").concat(S.y,"Z")}else j+="L".concat(r,",").concat(s,"Z");return j},k$e={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},jee=function(t){var r=J$(J$({},k$e),t),s=r.cx,a=r.cy,i=r.innerRadius,o=r.outerRadius,l=r.cornerRadius,c=r.forceCornerRadius,d=r.cornerIsExternal,u=r.startAngle,h=r.endAngle,m=r.className;if(o<i||u===h)return null;var f=fr("recharts-sector",m),p=o-i,A=Hi(l,p,0,!0),v;return A>0&&Math.abs(u-h)<360?v=S$e({cx:s,cy:a,innerRadius:i,outerRadius:o,cornerRadius:Math.min(A,p/2),forceCornerRadius:c,cornerIsExternal:d,startAngle:u,endAngle:h}):v=wee({cx:s,cy:a,innerRadius:i,outerRadius:o,startAngle:u,endAngle:h}),oe.createElement("path",GT({},Dt(r,!0),{className:f,d:v,role:"img"}))};function Rb(e){"@babel/helpers - typeof";return Rb=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Rb(e)}function qT(){return qT=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},qT.apply(this,arguments)}function X$(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,s)}return r}function Z$(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?X$(Object(r),!0).forEach(function(s){E$e(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):X$(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}function E$e(e,t,r){return t=B$e(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function B$e(e){var t=T$e(e,"string");return Rb(t)=="symbol"?t:t+""}function T$e(e,t){if(Rb(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(Rb(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var e7={curveBasisClosed:T4e,curveBasisOpen:P4e,curveBasis:B4e,curveBumpX:A4e,curveBumpY:g4e,curveLinearClosed:I4e,curveLinear:$C,curveMonotoneX:O4e,curveMonotoneY:F4e,curveNatural:L4e,curveStep:D4e,curveStepAfter:U4e,curveStepBefore:R4e},m1=function(t){return t.x===+t.x&&t.y===+t.y},yx=function(t){return t.x},wx=function(t){return t.y},P$e=function(t,r){if(er(t))return t;var s="curve".concat(UC(t));return(s==="curveMonotone"||s==="curveBump")&&r?e7["".concat(s).concat(r==="vertical"?"Y":"X")]:e7[s]||$C},I$e=function(t){var r=t.type,s=r===void 0?"linear":r,a=t.points,i=a===void 0?[]:a,o=t.baseLine,l=t.layout,c=t.connectNulls,d=c===void 0?!1:c,u=P$e(s,l),h=d?i.filter(function(A){return m1(A)}):i,m;if(Array.isArray(o)){var f=d?o.filter(function(A){return m1(A)}):o,p=h.map(function(A,v){return Z$(Z$({},A),{},{base:f[v]})});return l==="vertical"?m=s1().y(wx).x1(yx).x0(function(A){return A.base.x}):m=s1().x(yx).y1(wx).y0(function(A){return A.base.y}),m.defined(m1).curve(u),m(p)}return l==="vertical"&&lt(o)?m=s1().y(wx).x1(yx).x0(o):lt(o)?m=s1().x(yx).y1(wx).y0(o):m=AX().x(yx).y(wx),m.defined(m1).curve(u),m(h)},jm=function(t){var r=t.className,s=t.points,a=t.path,i=t.pathRef;if((!s||!s.length)&&!a)return null;var o=s&&s.length?I$e(t):a;return g.createElement("path",qT({},Dt(t,!1),R2(t),{className:fr("recharts-curve",r),d:o,ref:i}))},Nee={exports:{}},O$e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",F$e=O$e,L$e=F$e;function _ee(){}function Cee(){}Cee.resetWarningCache=_ee;var D$e=function(){function e(s,a,i,o,l,c){if(c!==L$e){var d=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw d.name="Invariant Violation",d}}e.isRequired=e;function t(){return e}var r={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:Cee,resetWarningCache:_ee};return r.PropTypes=r,r};Nee.exports=D$e();var R$e=Nee.exports;const Nn=wn(R$e),{getOwnPropertyNames:U$e,getOwnPropertySymbols:M$e}=Object,{hasOwnProperty:$$e}=Object.prototype;function sE(e,t){return function(s,a,i){return e(s,a,i)&&t(s,a,i)}}function p1(e){return function(r,s,a){if(!r||!s||typeof r!="object"||typeof s!="object")return e(r,s,a);const{cache:i}=a,o=i.get(r),l=i.get(s);if(o&&l)return o===s&&l===r;i.set(r,s),i.set(s,r);const c=e(r,s,a);return i.delete(r),i.delete(s),c}}function Q$e(e){return e!=null?e[Symbol.toStringTag]:void 0}function t7(e){return U$e(e).concat(M$e(e))}const H$e=Object.hasOwn||((e,t)=>$$e.call(e,t));function op(e,t){return e===t||!e&&!t&&e!==e&&t!==t}const z$e="__v",V$e="__o",G$e="_owner",{getOwnPropertyDescriptor:r7,keys:n7}=Object;function q$e(e,t){return e.byteLength===t.byteLength&&AN(new Uint8Array(e),new Uint8Array(t))}function K$e(e,t,r){let s=e.length;if(t.length!==s)return!1;for(;s-- >0;)if(!r.equals(e[s],t[s],s,s,e,t,r))return!1;return!0}function W$e(e,t){return e.byteLength===t.byteLength&&AN(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function Y$e(e,t){return op(e.getTime(),t.getTime())}function J$e(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function X$e(e,t){return e===t}function s7(e,t,r){const s=e.size;if(s!==t.size)return!1;if(!s)return!0;const a=new Array(s),i=e.entries();let o,l,c=0;for(;(o=i.next())&&!o.done;){const d=t.entries();let u=!1,h=0;for(;(l=d.next())&&!l.done;){if(a[h]){h++;continue}const m=o.value,f=l.value;if(r.equals(m[0],f[0],c,h,e,t,r)&&r.equals(m[1],f[1],m[0],f[0],e,t,r)){u=a[h]=!0;break}h++}if(!u)return!1;c++}return!0}const Z$e=op;function e7e(e,t,r){const s=n7(e);let a=s.length;if(n7(t).length!==a)return!1;for(;a-- >0;)if(!See(e,t,r,s[a]))return!1;return!0}function jx(e,t,r){const s=t7(e);let a=s.length;if(t7(t).length!==a)return!1;let i,o,l;for(;a-- >0;)if(i=s[a],!See(e,t,r,i)||(o=r7(e,i),l=r7(t,i),(o||l)&&(!o||!l||o.configurable!==l.configurable||o.enumerable!==l.enumerable||o.writable!==l.writable)))return!1;return!0}function t7e(e,t){return op(e.valueOf(),t.valueOf())}function r7e(e,t){return e.source===t.source&&e.flags===t.flags}function a7(e,t,r){const s=e.size;if(s!==t.size)return!1;if(!s)return!0;const a=new Array(s),i=e.values();let o,l;for(;(o=i.next())&&!o.done;){const c=t.values();let d=!1,u=0;for(;(l=c.next())&&!l.done;){if(!a[u]&&r.equals(o.value,l.value,o.value,l.value,e,t,r)){d=a[u]=!0;break}u++}if(!d)return!1}return!0}function AN(e,t){let r=e.byteLength;if(t.byteLength!==r||e.byteOffset!==t.byteOffset)return!1;for(;r-- >0;)if(e[r]!==t[r])return!1;return!0}function n7e(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function See(e,t,r,s){return(s===G$e||s===V$e||s===z$e)&&(e.$$typeof||t.$$typeof)?!0:H$e(t,s)&&r.equals(e[s],t[s],s,s,e,t,r)}const s7e="[object ArrayBuffer]",a7e="[object Arguments]",i7e="[object Boolean]",o7e="[object DataView]",l7e="[object Date]",c7e="[object Error]",d7e="[object Map]",u7e="[object Number]",h7e="[object Object]",f7e="[object RegExp]",m7e="[object Set]",p7e="[object String]",A7e={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},g7e="[object URL]",x7e=Object.prototype.toString;function v7e({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:r,areDatesEqual:s,areErrorsEqual:a,areFunctionsEqual:i,areMapsEqual:o,areNumbersEqual:l,areObjectsEqual:c,arePrimitiveWrappersEqual:d,areRegExpsEqual:u,areSetsEqual:h,areTypedArraysEqual:m,areUrlsEqual:f,unknownTagComparators:p}){return function(v,x,b){if(v===x)return!0;if(v==null||x==null)return!1;const y=typeof v;if(y!==typeof x)return!1;if(y!=="object")return y==="number"?l(v,x,b):y==="function"?i(v,x,b):!1;const w=v.constructor;if(w!==x.constructor)return!1;if(w===Object)return c(v,x,b);if(Array.isArray(v))return t(v,x,b);if(w===Date)return s(v,x,b);if(w===RegExp)return u(v,x,b);if(w===Map)return o(v,x,b);if(w===Set)return h(v,x,b);const j=x7e.call(v);if(j===l7e)return s(v,x,b);if(j===f7e)return u(v,x,b);if(j===d7e)return o(v,x,b);if(j===m7e)return h(v,x,b);if(j===h7e)return typeof v.then!="function"&&typeof x.then!="function"&&c(v,x,b);if(j===g7e)return f(v,x,b);if(j===c7e)return a(v,x,b);if(j===a7e)return c(v,x,b);if(A7e[j])return m(v,x,b);if(j===s7e)return e(v,x,b);if(j===o7e)return r(v,x,b);if(j===i7e||j===u7e||j===p7e)return d(v,x,b);if(p){let N=p[j];if(!N){const _=Q$e(v);_&&(N=p[_])}if(N)return N(v,x,b)}return!1}}function b7e({circular:e,createCustomConfig:t,strict:r}){let s={areArrayBuffersEqual:q$e,areArraysEqual:r?jx:K$e,areDataViewsEqual:W$e,areDatesEqual:Y$e,areErrorsEqual:J$e,areFunctionsEqual:X$e,areMapsEqual:r?sE(s7,jx):s7,areNumbersEqual:Z$e,areObjectsEqual:r?jx:e7e,arePrimitiveWrappersEqual:t7e,areRegExpsEqual:r7e,areSetsEqual:r?sE(a7,jx):a7,areTypedArraysEqual:r?sE(AN,jx):AN,areUrlsEqual:n7e,unknownTagComparators:void 0};if(t&&(s=Object.assign({},s,t(s))),e){const a=p1(s.areArraysEqual),i=p1(s.areMapsEqual),o=p1(s.areObjectsEqual),l=p1(s.areSetsEqual);s=Object.assign({},s,{areArraysEqual:a,areMapsEqual:i,areObjectsEqual:o,areSetsEqual:l})}return s}function y7e(e){return function(t,r,s,a,i,o,l){return e(t,r,l)}}function w7e({circular:e,comparator:t,createState:r,equals:s,strict:a}){if(r)return function(l,c){const{cache:d=e?new WeakMap:void 0,meta:u}=r();return t(l,c,{cache:d,equals:s,meta:u,strict:a})};if(e)return function(l,c){return t(l,c,{cache:new WeakMap,equals:s,meta:void 0,strict:a})};const i={cache:void 0,equals:s,meta:void 0,strict:a};return function(l,c){return t(l,c,i)}}const j7e=hf();hf({strict:!0});hf({circular:!0});hf({circular:!0,strict:!0});hf({createInternalComparator:()=>op});hf({strict:!0,createInternalComparator:()=>op});hf({circular:!0,createInternalComparator:()=>op});hf({circular:!0,createInternalComparator:()=>op,strict:!0});function hf(e={}){const{circular:t=!1,createInternalComparator:r,createState:s,strict:a=!1}=e,i=b7e(e),o=v7e(i),l=r?r(o):y7e(o);return w7e({circular:t,comparator:o,createState:s,equals:l,strict:a})}function N7e(e){typeof requestAnimationFrame<"u"&&requestAnimationFrame(e)}function i7(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=-1,s=function a(i){r<0&&(r=i),i-r>t?(e(i),r=-1):N7e(a)};requestAnimationFrame(s)}function KT(e){"@babel/helpers - typeof";return KT=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},KT(e)}function _7e(e){return E7e(e)||k7e(e)||S7e(e)||C7e()}function C7e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1239In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function S7e(e,t){if(e){if(typeof e=="string")return o7(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return o7(e,t)}}function o7(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,s=new Array(t);r<t;r++)s[r]=e[r];return s}function k7e(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function E7e(e){if(Array.isArray(e))return e}function B7e(){var e={},t=function(){return null},r=!1,s=function a(i){if(!r){if(Array.isArray(i)){if(!i.length)return;var o=i,l=_7e(o),c=l[0],d=l.slice(1);if(typeof c=="number"){i7(a.bind(null,d),c);return}a(c),i7(a.bind(null,d));return}KT(i)==="object"&&(e=i,t(e)),typeof i=="function"&&i()}};return{stop:function(){r=!0},start:function(i){r=!1,s(i)},subscribe:function(i){return t=i,function(){t=function(){return null}}}}}function Ub(e){"@babel/helpers - typeof";return Ub=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ub(e)}function l7(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,s)}return r}function c7(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?l7(Object(r),!0).forEach(function(s){kee(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):l7(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}function kee(e,t,r){return t=T7e(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function T7e(e){var t=P7e(e,"string");return Ub(t)==="symbol"?t:String(t)}function P7e(e,t){if(Ub(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(Ub(s)!=="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var I7e=function(t,r){return[Object.keys(t),Object.keys(r)].reduce(function(s,a){return s.filter(function(i){return a.includes(i)})})},O7e=function(t){return t},F7e=function(t){return t.replace(/([A-Z])/g,function(r){return"-".concat(r.toLowerCase())})},vv=function(t,r){return Object.keys(r).reduce(function(s,a){return c7(c7({},s),{},kee({},a,t(a,r[a])))},{})},d7=function(t,r,s){return t.map(function(a){return"".concat(F7e(a)," ").concat(r,"ms ").concat(s)}).join(",")};function L7e(e,t){return U7e(e)||R7e(e,t)||Eee(e,t)||D7e()}function D7e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1240In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function R7e(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var s,a,i,o,l=[],c=!0,d=!1;try{if(i=(r=r.call(e)).next,t!==0)for(;!(c=(s=i.call(r)).done)&&(l.push(s.value),l.length!==t);c=!0);}catch(u){d=!0,a=u}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(d)throw a}}return l}}function U7e(e){if(Array.isArray(e))return e}function M7e(e){return H7e(e)||Q7e(e)||Eee(e)||$7e()}function $7e(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
1241In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Eee(e,t){if(e){if(typeof e=="string")return WT(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return WT(e,t)}}function Q7e(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function H7e(e){if(Array.isArray(e))return WT(e)}function WT(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,s=new Array(t);r<t;r++)s[r]=e[r];return s}var gN=1e-4,Bee=function(t,r){return[0,3*t,3*r-6*t,3*t-3*r+1]},Tee=function(t,r){return t.map(function(s,a){return s*Math.pow(r,a)}).reduce(function(s,a){return s+a})},u7=function(t,r){return function(s){var a=Bee(t,r);return Tee(a,s)}},z7e=function(t,r){return function(s){var a=Bee(t,r),i=[].concat(M7e(a.map(function(o,l){return o*l}).slice(1)),[0]);return Tee(i,s)}},h7=function(){for(var t=arguments.length,r=new Array(t),s=0;s<t;s++)r[s]=arguments[s];var a=r[0],i=r[1],o=r[2],l=r[3];if(r.length===1)switch(r[0]){case"linear":a=0,i=0,o=1,l=1;break;case"ease":a=.25,i=.1,o=.25,l=1;break;case"ease-in":a=.42,i=0,o=1,l=1;break;case"ease-out":a=.42,i=0,o=.58,l=1;break;case"ease-in-out":a=0,i=0,o=.58,l=1;break;default:{var c=r[0].split("(");if(c[0]==="cubic-bezier"&&c[1].split(")")[0].split(",").length===4){var d=c[1].split(")")[0].split(",").map(function(v){return parseFloat(v)}),u=L7e(d,4);a=u[0],i=u[1],o=u[2],l=u[3]}}}var h=u7(a,o),m=u7(i,l),f=z7e(a,o),p=function(x){return x>1?1:x<0?0:x},A=function(x){for(var b=x>1?1:x,y=b,w=0;w<8;++w){var j=h(y)-b,N=f(y);if(Math.abs(j-b)<gN||N<gN)return m(y);y=p(y-j/N)}return m(y)};return A.isStepper=!1,A},V7e=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=t.stiff,s=r===void 0?100:r,a=t.damping,i=a===void 0?8:a,o=t.dt,l=o===void 0?17:o,c=function(u,h,m){var f=-(u-h)*s,p=m*i,A=m+(f-p)*l/1e3,v=m*l/1e3+u;return Math.abs(v-h)<gN&&Math.abs(A)<gN?[h,0]:[v,A]};return c.isStepper=!0,c.dt=l,c},G7e=function(){for(var t=arguments.length,r=new Array(t),s=0;s<t;s++)r[s]=arguments[s];var a=r[0];if(typeof a=="string")switch(a){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return h7(a);case"spring":return V7e();default:if(a.split("(")[0]==="cubic-bezier")return h7(a)}return typeof a=="function"?a:null};function Mb(e){"@babel/helpers - typeof";return Mb=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Mb(e)}function f7(e){return W7e(e)||K7e(e)||Pee(e)||q7e()}function q7e(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
1242In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function K7e(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function W7e(e){if(Array.isArray(e))return JT(e)}function m7(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,s)}return r}function ai(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?m7(Object(r),!0).forEach(function(s){YT(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):m7(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}function YT(e,t,r){return t=Y7e(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Y7e(e){var t=J7e(e,"string");return Mb(t)==="symbol"?t:String(t)}function J7e(e,t){if(Mb(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(Mb(s)!=="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function X7e(e,t){return tQe(e)||eQe(e,t)||Pee(e,t)||Z7e()}function Z7e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1243In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Pee(e,t){if(e){if(typeof e=="string")return JT(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return JT(e,t)}}function JT(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,s=new Array(t);r<t;r++)s[r]=e[r];return s}function eQe(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var s,a,i,o,l=[],c=!0,d=!1;try{if(i=(r=r.call(e)).next,t!==0)for(;!(c=(s=i.call(r)).done)&&(l.push(s.value),l.length!==t);c=!0);}catch(u){d=!0,a=u}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(d)throw a}}return l}}function tQe(e){if(Array.isArray(e))return e}var xN=function(t,r,s){return t+(r-t)*s},XT=function(t){var r=t.from,s=t.to;return r!==s},rQe=function e(t,r,s){var a=vv(function(i,o){if(XT(o)){var l=t(o.from,o.to,o.velocity),c=X7e(l,2),d=c[0],u=c[1];return ai(ai({},o),{},{from:d,velocity:u})}return o},r);return s<1?vv(function(i,o){return XT(o)?ai(ai({},o),{},{velocity:xN(o.velocity,a[i].velocity,s),from:xN(o.from,a[i].from,s)}):o},r):e(t,a,s-1)};const nQe=function(e,t,r,s,a){var i=I7e(e,t),o=i.reduce(function(v,x){return ai(ai({},v),{},YT({},x,[e[x],t[x]]))},{}),l=i.reduce(function(v,x){return ai(ai({},v),{},YT({},x,{from:e[x],velocity:0,to:t[x]}))},{}),c=-1,d,u,h=function(){return null},m=function(){return vv(function(x,b){return b.from},l)},f=function(){return!Object.values(l).filter(XT).length},p=function(x){d||(d=x);var b=x-d,y=b/r.dt;l=rQe(r,l,y),a(ai(ai(ai({},e),t),m())),d=x,f()||(c=requestAnimationFrame(h))},A=function(x){u||(u=x);var b=(x-u)/s,y=vv(function(j,N){return xN.apply(void 0,f7(N).concat([r(b)]))},o);if(a(ai(ai(ai({},e),t),y)),b<1)c=requestAnimationFrame(h);else{var w=vv(function(j,N){return xN.apply(void 0,f7(N).concat([r(1)]))},o);a(ai(ai(ai({},e),t),w))}};return h=r.isStepper?p:A,function(){return requestAnimationFrame(h),function(){cancelAnimationFrame(c)}}};function Cg(e){"@babel/helpers - typeof";return Cg=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Cg(e)}var sQe=["children","begin","duration","attributeName","easing","isActive","steps","from","to","canBegin","onAnimationEnd","shouldReAnimate","onAnimationReStart"];function aQe(e,t){if(e==null)return{};var r=iQe(e,t),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)s=i[a],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(r[s]=e[s])}return r}function iQe(e,t){if(e==null)return{};var r={},s=Object.keys(e),a,i;for(i=0;i<s.length;i++)a=s[i],!(t.indexOf(a)>=0)&&(r[a]=e[a]);return r}function aE(e){return dQe(e)||cQe(e)||lQe(e)||oQe()}function oQe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
1244In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function lQe(e,t){if(e){if(typeof e=="string")return ZT(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ZT(e,t)}}function cQe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function dQe(e){if(Array.isArray(e))return ZT(e)}function ZT(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,s=new Array(t);r<t;r++)s[r]=e[r];return s}function p7(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,s)}return r}function nc(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?p7(Object(r),!0).forEach(function(s){Yx(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):p7(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}function Yx(e,t,r){return t=Iee(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function uQe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function hQe(e,t){for(var r=0;r<t.length;r++){var s=t[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,Iee(s.key),s)}}function fQe(e,t,r){return t&&hQe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Iee(e){var t=mQe(e,"string");return Cg(t)==="symbol"?t:String(t)}function mQe(e,t){if(Cg(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(Cg(s)!=="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function pQe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&e3(e,t)}function e3(e,t){return e3=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,a){return s.__proto__=a,s},e3(e,t)}function AQe(e){var t=gQe();return function(){var s=vN(e),a;if(t){var i=vN(this).constructor;a=Reflect.construct(s,arguments,i)}else a=s.apply(this,arguments);return t3(this,a)}}function t3(e,t){if(t&&(Cg(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return r3(e)}function r3(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function gQe(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function vN(e){return vN=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},vN(e)}var Ml=function(e){pQe(r,e);var t=AQe(r);function r(s,a){var i;uQe(this,r),i=t.call(this,s,a);var o=i.props,l=o.isActive,c=o.attributeName,d=o.from,u=o.to,h=o.steps,m=o.children,f=o.duration;if(i.handleStyleChange=i.handleStyleChange.bind(r3(i)),i.changeStyle=i.changeStyle.bind(r3(i)),!l||f<=0)return i.state={style:{}},typeof m=="function"&&(i.state={style:u}),t3(i);if(h&&h.length)i.state={style:h[0].style};else if(d){if(typeof m=="function")return i.state={style:d},t3(i);i.state={style:c?Yx({},c,d):d}}else i.state={style:{}};return i}return fQe(r,[{key:"componentDidMount",value:function(){var a=this.props,i=a.isActive,o=a.canBegin;this.mounted=!0,!(!i||!o)&&this.runAnimation(this.props)}},{key:"componentDidUpdate",value:function(a){var i=this.props,o=i.isActive,l=i.canBegin,c=i.attributeName,d=i.shouldReAnimate,u=i.to,h=i.from,m=this.state.style;if(l){if(!o){var f={style:c?Yx({},c,u):u};this.state&&m&&(c&&m[c]!==u||!c&&m!==u)&&this.setState(f);return}if(!(j7e(a.to,u)&&a.canBegin&&a.isActive)){var p=!a.canBegin||!a.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var A=p||d?h:a.to;if(this.state&&m){var v={style:c?Yx({},c,A):A};(c&&m[c]!==A||!c&&m!==A)&&this.setState(v)}this.runAnimation(nc(nc({},this.props),{},{from:A,begin:0}))}}}},{key:"componentWillUnmount",value:function(){this.mounted=!1;var a=this.props.onAnimationEnd;this.unSubscribe&&this.unSubscribe(),this.manager&&(this.manager.stop(),this.manager=null),this.stopJSAnimation&&this.stopJSAnimation(),a&&a()}},{key:"handleStyleChange",value:function(a){this.changeStyle(a)}},{key:"changeStyle",value:function(a){this.mounted&&this.setState({style:a})}},{key:"runJSAnimation",value:function(a){var i=this,o=a.from,l=a.to,c=a.duration,d=a.easing,u=a.begin,h=a.onAnimationEnd,m=a.onAnimationStart,f=nQe(o,l,G7e(d),c,this.changeStyle),p=function(){i.stopJSAnimation=f()};this.manager.start([m,u,p,c,h])}},{key:"runStepAnimation",value:function(a){var i=this,o=a.steps,l=a.begin,c=a.onAnimationStart,d=o[0],u=d.style,h=d.duration,m=h===void 0?0:h,f=function(A,v,x){if(x===0)return A;var b=v.duration,y=v.easing,w=y===void 0?"ease":y,j=v.style,N=v.properties,_=v.onAnimationEnd,S=x>0?o[x-1]:v,C=N||Object.keys(j);if(typeof w=="function"||w==="spring")return[].concat(aE(A),[i.runJSAnimation.bind(i,{from:S.style,to:j,duration:b,easing:w}),b]);var E=d7(C,b,w),T=nc(nc(nc({},S.style),j),{},{transition:E});return[].concat(aE(A),[T,b,_]).filter(O7e)};return this.manager.start([c].concat(aE(o.reduce(f,[u,Math.max(m,l)])),[a.onAnimationEnd]))}},{key:"runAnimation",value:function(a){this.manager||(this.manager=B7e());var i=a.begin,o=a.duration,l=a.attributeName,c=a.to,d=a.easing,u=a.onAnimationStart,h=a.onAnimationEnd,m=a.steps,f=a.children,p=this.manager;if(this.unSubscribe=p.subscribe(this.handleStyleChange),typeof d=="function"||typeof f=="function"||d==="spring"){this.runJSAnimation(a);return}if(m.length>1){this.runStepAnimation(a);return}var A=l?Yx({},l,c):c,v=d7(Object.keys(A),o,d);p.start([u,i,nc(nc({},A),{},{transition:v}),o,h])}},{key:"render",value:function(){var a=this.props,i=a.children;a.begin;var o=a.duration;a.attributeName,a.easing;var l=a.isActive;a.steps,a.from,a.to,a.canBegin,a.onAnimationEnd,a.shouldReAnimate,a.onAnimationReStart;var c=aQe(a,sQe),d=g.Children.count(i),u=this.state.style;if(typeof i=="function")return i(u);if(!l||d===0||o<=0)return i;var h=function(f){var p=f.props,A=p.style,v=A===void 0?{}:A,x=p.className,b=g.cloneElement(f,nc(nc({},c),{},{style:nc(nc({},v),u),className:x}));return b};return d===1?h(g.Children.only(i)):oe.createElement("div",null,g.Children.map(i,function(m){return h(m)}))}}]),r}(g.PureComponent);Ml.displayName="Animate";Ml.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}};Ml.propTypes={from:Nn.oneOfType([Nn.object,Nn.string]),to:Nn.oneOfType([Nn.object,Nn.string]),attributeName:Nn.string,duration:Nn.number,begin:Nn.number,easing:Nn.oneOfType([Nn.string,Nn.func]),steps:Nn.arrayOf(Nn.shape({duration:Nn.number.isRequired,style:Nn.object.isRequired,easing:Nn.oneOfType([Nn.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),Nn.func]),properties:Nn.arrayOf("string"),onAnimationEnd:Nn.func})),children:Nn.oneOfType([Nn.node,Nn.func]),isActive:Nn.bool,canBegin:Nn.bool,onAnimationEnd:Nn.func,shouldReAnimate:Nn.bool,onAnimationStart:Nn.func,onAnimationReStart:Nn.func};function n3(){return n3=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var s in r)({}).hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},n3.apply(null,arguments)}function $b(e){"@babel/helpers - typeof";return $b=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},$b(e)}function bN(){return bN=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},bN.apply(this,arguments)}function xQe(e,t){return wQe(e)||yQe(e,t)||bQe(e,t)||vQe()}function vQe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1245In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function bQe(e,t){if(e){if(typeof e=="string")return A7(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return A7(e,t)}}function A7(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,s=new Array(t);r<t;r++)s[r]=e[r];return s}function yQe(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var s,a,i,o,l=[],c=!0,d=!1;try{if(i=(r=r.call(e)).next,t!==0)for(;!(c=(s=i.call(r)).done)&&(l.push(s.value),l.length!==t);c=!0);}catch(u){d=!0,a=u}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(d)throw a}}return l}}function wQe(e){if(Array.isArray(e))return e}function g7(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,s)}return r}function x7(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?g7(Object(r),!0).forEach(function(s){jQe(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):g7(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}function jQe(e,t,r){return t=NQe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function NQe(e){var t=_Qe(e,"string");return $b(t)=="symbol"?t:t+""}function _Qe(e,t){if($b(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if($b(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var v7=function(t,r,s,a,i){var o=Math.min(Math.abs(s)/2,Math.abs(a)/2),l=a>=0?1:-1,c=s>=0?1:-1,d=a>=0&&s>=0||a<0&&s<0?1:0,u;if(o>0&&i instanceof Array){for(var h=[0,0,0,0],m=0,f=4;m<f;m++)h[m]=i[m]>o?o:i[m];u="M".concat(t,",").concat(r+l*h[0]),h[0]>0&&(u+="A ".concat(h[0],",").concat(h[0],",0,0,").concat(d,",").concat(t+c*h[0],",").concat(r)),u+="L ".concat(t+s-c*h[1],",").concat(r),h[1]>0&&(u+="A ".concat(h[1],",").concat(h[1],",0,0,").concat(d,`,
1246        `).concat(t+s,",").concat(r+l*h[1])),u+="L ".concat(t+s,",").concat(r+a-l*h[2]),h[2]>0&&(u+="A ".concat(h[2],",").concat(h[2],",0,0,").concat(d,`,
1247        `).concat(t+s-c*h[2],",").concat(r+a)),u+="L ".concat(t+c*h[3],",").concat(r+a),h[3]>0&&(u+="A ".concat(h[3],",").concat(h[3],",0,0,").concat(d,`,
1248        `).concat(t,",").concat(r+a-l*h[3])),u+="Z"}else if(o>0&&i===+i&&i>0){var p=Math.min(o,i);u="M ".concat(t,",").concat(r+l*p,`
1249            A `).concat(p,",").concat(p,",0,0,").concat(d,",").concat(t+c*p,",").concat(r,`
1250            L `).concat(t+s-c*p,",").concat(r,`
1251            A `).concat(p,",").concat(p,",0,0,").concat(d,",").concat(t+s,",").concat(r+l*p,`
1252            L `).concat(t+s,",").concat(r+a-l*p,`
1253            A `).concat(p,",").concat(p,",0,0,").concat(d,",").concat(t+s-c*p,",").concat(r+a,`
1254            L `).concat(t+c*p,",").concat(r+a,`
1255            A `).concat(p,",").concat(p,",0,0,").concat(d,",").concat(t,",").concat(r+a-l*p," Z")}else u="M ".concat(t,",").concat(r," h ").concat(s," v ").concat(a," h ").concat(-s," Z");return u},CQe=function(t,r){if(!t||!r)return!1;var s=t.x,a=t.y,i=r.x,o=r.y,l=r.width,c=r.height;if(Math.abs(l)>0&&Math.abs(c)>0){var d=Math.min(i,i+l),u=Math.max(i,i+l),h=Math.min(o,o+c),m=Math.max(o,o+c);return s>=d&&s<=u&&a>=h&&a<=m}return!1},SQe={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},wF=function(t){var r=x7(x7({},SQe),t),s=g.useRef(),a=g.useState(-1),i=xQe(a,2),o=i[0],l=i[1];g.useEffect(function(){if(s.current&&s.current.getTotalLength)try{var w=s.current.getTotalLength();w&&l(w)}catch{}},[]);var c=r.x,d=r.y,u=r.width,h=r.height,m=r.radius,f=r.className,p=r.animationEasing,A=r.animationDuration,v=r.animationBegin,x=r.isAnimationActive,b=r.isUpdateAnimationActive;if(c!==+c||d!==+d||u!==+u||h!==+h||u===0||h===0)return null;var y=fr("recharts-rectangle",f);return b?oe.createElement(Ml,{canBegin:o>0,from:{width:u,height:h,x:c,y:d},to:{width:u,height:h,x:c,y:d},duration:A,animationEasing:p,isActive:b},function(w){var j=w.width,N=w.height,_=w.x,S=w.y;return oe.createElement(Ml,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:v,duration:A,isActive:x,easing:p},oe.createElement("path",bN({},Dt(r,!0),{className:y,d:v7(_,S,j,N,m),ref:s})))}):oe.createElement("path",bN({},Dt(r,!0),{className:y,d:v7(c,d,u,h,m)}))},kQe=["points","className","baseLinePoints","connectNulls"];function bA(){return bA=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},bA.apply(this,arguments)}function EQe(e,t){if(e==null)return{};var r=BQe(e,t),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)s=i[a],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(r[s]=e[s])}return r}function BQe(e,t){if(e==null)return{};var r={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;r[s]=e[s]}return r}function b7(e){return OQe(e)||IQe(e)||PQe(e)||TQe()}function TQe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
1256In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function PQe(e,t){if(e){if(typeof e=="string")return s3(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return s3(e,t)}}function IQe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function OQe(e){if(Array.isArray(e))return s3(e)}function s3(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,s=new Array(t);r<t;r++)s[r]=e[r];return s}var y7=function(t){return t&&t.x===+t.x&&t.y===+t.y},FQe=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],r=[[]];return t.forEach(function(s){y7(s)?r[r.length-1].push(s):r[r.length-1].length>0&&r.push([])}),y7(t[0])&&r[r.length-1].push(t[0]),r[r.length-1].length<=0&&(r=r.slice(0,-1)),r},bv=function(t,r){var s=FQe(t);r&&(s=[s.reduce(function(i,o){return[].concat(b7(i),b7(o))},[])]);var a=s.map(function(i){return i.reduce(function(o,l,c){return"".concat(o).concat(c===0?"M":"L").concat(l.x,",").concat(l.y)},"")}).join("");return s.length===1?"".concat(a,"Z"):a},LQe=function(t,r,s){var a=bv(t,s);return"".concat(a.slice(-1)==="Z"?a.slice(0,-1):a,"L").concat(bv(r.reverse(),s).slice(1))},Oee=function(t){var r=t.points,s=t.className,a=t.baseLinePoints,i=t.connectNulls,o=EQe(t,kQe);if(!r||!r.length)return null;var l=fr("recharts-polygon",s);if(a&&a.length){var c=o.stroke&&o.stroke!=="none",d=LQe(r,a,i);return oe.createElement("g",{className:l},oe.createElement("path",bA({},Dt(o,!0),{fill:d.slice(-1)==="Z"?o.fill:"none",stroke:"none",d})),c?oe.createElement("path",bA({},Dt(o,!0),{fill:"none",d:bv(r,i)})):null,c?oe.createElement("path",bA({},Dt(o,!0),{fill:"none",d:bv(a,i)})):null)}var u=bv(r,i);return oe.createElement("path",bA({},Dt(o,!0),{fill:u.slice(-1)==="Z"?o.fill:"none",className:l,d:u}))};function a3(){return a3=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},a3.apply(this,arguments)}var y0=function(t){var r=t.cx,s=t.cy,a=t.r,i=t.className,o=fr("recharts-dot",i);return r===+r&&s===+s&&a===+a?g.createElement("circle",a3({},Dt(t,!1),R2(t),{className:o,cx:r,cy:s,r:a})):null};function Qb(e){"@babel/helpers - typeof";return Qb=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Qb(e)}var DQe=["x","y","top","left","width","height","className"];function i3(){return i3=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},i3.apply(this,arguments)}function w7(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,s)}return r}function RQe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?w7(Object(r),!0).forEach(function(s){UQe(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):w7(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}function UQe(e,t,r){return t=MQe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function MQe(e){var t=$Qe(e,"string");return Qb(t)=="symbol"?t:t+""}function $Qe(e,t){if(Qb(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(Qb(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function QQe(e,t){if(e==null)return{};var r=HQe(e,t),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)s=i[a],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(r[s]=e[s])}return r}function HQe(e,t){if(e==null)return{};var r={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;r[s]=e[s]}return r}var zQe=function(t,r,s,a,i,o){return"M".concat(t,",").concat(i,"v").concat(a,"M").concat(o,",").concat(r,"h").concat(s)},VQe=function(t){var r=t.x,s=r===void 0?0:r,a=t.y,i=a===void 0?0:a,o=t.top,l=o===void 0?0:o,c=t.left,d=c===void 0?0:c,u=t.width,h=u===void 0?0:u,m=t.height,f=m===void 0?0:m,p=t.className,A=QQe(t,DQe),v=RQe({x:s,y:i,top:l,left:d,width:h,height:f},A);return!lt(s)||!lt(i)||!lt(h)||!lt(f)||!lt(l)||!lt(d)?null:oe.createElement("path",i3({},Dt(v,!0),{className:fr("recharts-cross",p),d:zQe(s,i,h,f,l,d)}))},GQe=["cx","cy","innerRadius","outerRadius","gridType","radialLines"];function Hb(e){"@babel/helpers - typeof";return Hb=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Hb(e)}function qQe(e,t){if(e==null)return{};var r=KQe(e,t),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)s=i[a],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(r[s]=e[s])}return r}function KQe(e,t){if(e==null)return{};var r={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;r[s]=e[s]}return r}function Tu(){return Tu=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];
1256for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},Tu.apply(this,arguments)}function j7(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,s)}return r}function zb(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?j7(Object(r),!0).forEach(function(s){WQe(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):j7(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}function WQe(e,t,r){return t=YQe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function YQe(e){var t=JQe(e,"string");return Hb(t)=="symbol"?t:t+""}function JQe(e,t){if(Hb(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(Hb(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var XQe=function(t,r,s,a){var i="";return a.forEach(function(o,l){var c=yn(r,s,t,o);l?i+="L ".concat(c.x,",").concat(c.y):i+="M ".concat(c.x,",").concat(c.y)}),i+="Z",i},ZQe=function(t){var r=t.cx,s=t.cy,a=t.innerRadius,i=t.outerRadius,o=t.polarAngles,l=t.radialLines;if(!o||!o.length||!l)return null;var c=zb({stroke:"#ccc"},Dt(t,!1));return oe.createElement("g",{className:"recharts-polar-grid-angle"},o.map(function(d){var u=yn(r,s,a,d),h=yn(r,s,i,d);return oe.createElement("line",Tu({},c,{key:"line-".concat(d),x1:u.x,y1:u.y,x2:h.x,y2:h.y}))}))},eHe=function(t){var r=t.cx,s=t.cy,a=t.radius,i=t.index,o=zb(zb({stroke:"#ccc"},Dt(t,!1)),{},{fill:"none"});return oe.createElement("circle",Tu({},o,{className:fr("recharts-polar-grid-concentric-circle",t.className),key:"circle-".concat(i),cx:r,cy:s,r:a}))},tHe=function(t){var r=t.radius,s=t.index,a=zb(zb({stroke:"#ccc"},Dt(t,!1)),{},{fill:"none"});return oe.createElement("path",Tu({},a,{className:fr("recharts-polar-grid-concentric-polygon",t.className),key:"path-".concat(s),d:XQe(r,t.cx,t.cy,t.polarAngles)}))},rHe=function(t){var r=t.polarRadius,s=t.gridType;return!r||!r.length?null:oe.createElement("g",{className:"recharts-polar-grid-concentric"},r.map(function(a,i){var o=i;return s==="circle"?oe.createElement(eHe,Tu({key:o},t,{radius:a,index:i})):oe.createElement(tHe,Tu({key:o},t,{radius:a,index:i}))}))},Fee=function(t){var r=t.cx,s=r===void 0?0:r,a=t.cy,i=a===void 0?0:a,o=t.innerRadius,l=o===void 0?0:o,c=t.outerRadius,d=c===void 0?0:c,u=t.gridType,h=u===void 0?"polygon":u,m=t.radialLines,f=m===void 0?!0:m,p=qQe(t,GQe);return d<=0?null:oe.createElement("g",{className:"recharts-polar-grid"},oe.createElement(ZQe,Tu({cx:s,cy:i,innerRadius:l,outerRadius:d,gridType:h,radialLines:f},p)),oe.createElement(rHe,Tu({cx:s,cy:i,innerRadius:l,outerRadius:d,gridType:h,radialLines:f},p)))};Fee.displayName="PolarGrid";var nHe=XC,sHe=HZ,aHe=_d;function iHe(e,t){return e&&e.length?nHe(e,aHe(t),sHe):void 0}var oHe=iHe;const lHe=wn(oHe);var cHe=XC,dHe=_d,uHe=zZ;function hHe(e,t){return e&&e.length?cHe(e,dHe(t),uHe):void 0}var fHe=hHe;const mHe=wn(fHe);var pHe=["cx","cy","angle","ticks","axisLine"],AHe=["ticks","tick","angle","tickFormatter","stroke"];function Sg(e){"@babel/helpers - typeof";return Sg=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Sg(e)}function yv(){return yv=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];
vendor: 9,657 bytes, line 1256
1256for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},yv.apply(this,arguments)}function N7(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,s)}return r}function Df(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?N7(Object(r),!0).forEach(function(s){rS(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):N7(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}function _7(e,t){if(e==null)return{};var r=gHe(e,t),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)s=i[a],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(r[s]=e[s])}return r}function gHe(e,t){if(e==null)return{};var r={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;r[s]=e[s]}return r}function xHe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function C7(e,t){for(var r=0;r<t.length;r++){var s=t[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,Dee(s.key),s)}}function vHe(e,t,r){return t&&C7(e.prototype,t),r&&C7(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function bHe(e,t,r){return t=yN(t),yHe(e,Lee()?Reflect.construct(t,r||[],yN(e).constructor):t.apply(e,r))}function yHe(e,t){if(t&&(Sg(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return wHe(e)}function wHe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Lee(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Lee=function(){return!!e})()}function yN(e){return yN=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},yN(e)}function jHe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&o3(e,t)}function o3(e,t){return o3=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,a){return s.__proto__=a,s},o3(e,t)}function rS(e,t,r){return t=Dee(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Dee(e){var t=NHe(e,"string");return Sg(t)=="symbol"?t:t+""}function NHe(e,t){if(Sg(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(Sg(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var w0=function(e){function t(){return xHe(this,t),bHe(this,t,arguments)}return jHe(t,e),vHe(t,[{key:"getTickValueCoord",value:function(s){var a=s.coordinate,i=this.props,o=i.angle,l=i.cx,c=i.cy;return yn(l,c,a,o)}},{key:"getTickTextAnchor",value:function(){var s=this.props.orientation,a;switch(s){case"left":a="end";break;case"right":a="start";break;default:a="middle";break}return a}},{key:"getViewBox",value:function(){var s=this.props,a=s.cx,i=s.cy,o=s.angle,l=s.ticks,c=lHe(l,function(u){return u.coordinate||0}),d=mHe(l,function(u){return u.coordinate||0});return{cx:a,cy:i,startAngle:o,endAngle:o,innerRadius:d.coordinate||0,outerRadius:c.coordinate||0}}},{key:"renderAxisLine",value:function(){var s=this.props,a=s.cx,i=s.cy,o=s.angle,l=s.ticks,c=s.axisLine,d=_7(s,pHe),u=l.reduce(function(p,A){return[Math.min(p[0],A.coordinate),Math.max(p[1],A.coordinate)]},[1/0,-1/0]),h=yn(a,i,u[0],o),m=yn(a,i,u[1],o),f=Df(Df(Df({},Dt(d,!1)),{},{fill:"none"},Dt(c,!1)),{},{x1:h.x,y1:h.y,x2:m.x,y2:m.y});return oe.createElement("line",yv({className:"recharts-polar-radius-axis-line"},f))}},{key:"renderTicks",value:function(){var s=this,a=this.props,i=a.ticks,o=a.tick,l=a.angle,c=a.tickFormatter,d=a.stroke,u=_7(a,AHe),h=this.getTickTextAnchor(),m=Dt(u,!1),f=Dt(o,!1),p=i.map(function(A,v){var x=s.getTickValueCoord(A),b=Df(Df(Df(Df({textAnchor:h,transform:"rotate(".concat(90-l,", ").concat(x.x,", ").concat(x.y,")")},m),{},{stroke:"none",fill:d},f),{},{index:v},x),{},{payload:A});return oe.createElement(Qr,yv({className:fr("recharts-polar-radius-axis-tick",vee(o)),key:"tick-".concat(A.coordinate)},Mm(s.props,A,v)),t.renderTickItem(o,b,c?c(A.value,v):A.value))});return oe.createElement(Qr,{className:"recharts-polar-radius-axis-ticks"},p)}},{key:"render",value:function(){var s=this.props,a=s.ticks,i=s.axisLine,o=s.tick;return!a||!a.length?null:oe.createElement(Qr,{className:fr("recharts-polar-radius-axis",this.props.className)},i&&this.renderAxisLine(),o&&this.renderTicks(),qa.renderCallByParent(this.props,this.getViewBox()))}}],[{key:"renderTickItem",value:function(s,a,i){var o;return oe.isValidElement(s)?o=oe.cloneElement(s,a):er(s)?o=s(a):o=oe.createElement($m,yv({},a,{className:"recharts-polar-radius-axis-tick-value"}),i),o}}])}(g.PureComponent);rS(w0,"displayName","PolarRadiusAxis");rS(w0,"axisType","radiusAxis");rS(w0,"defaultProps",{type:"number",radiusAxisId:0,cx:0,cy:0,angle:0,orientation:"right",stroke:"#ccc",axisLine:!0,tick:!0,tickCount:5,allowDataOverflow:!1,scale:"auto",allowDuplicatedCategory:!0});function kg(e){"@babel/helpers - typeof";return kg=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},kg(e)}function Zf(){return Zf=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},Zf.apply(this,arguments)}function S7(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,s)}return r}function Rf(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?S7(Object(r),!0).forEach(function(s){nS(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):S7(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}function _He(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function k7(e,t){for(var r=0;r<t.length;r++){var s=t[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,Uee(s.key),s)}}function CHe(e,t,r){return t&&k7(e.prototype,t),r&&k7(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function SHe(e,t,r){return t=wN(t),kHe(e,Ree()?Reflect.construct(t,r||[],wN(e).constructor):t.apply(e,r))}function kHe(e,t){if(t&&(kg(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return EHe(e)}function EHe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ree(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Ree=function(){return!!e})()}function wN(e){return wN=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},wN(e)}function BHe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l3(e,t)}function l3(e,t){return l3=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,a){return s.__proto__=a,s},l3(e,t)}function nS(e,t,r){return t=Uee(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Uee(e){var t=THe(e,"string");return kg(t)=="symbol"?t:t+""}function THe(e,t){if(kg(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(kg(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var PHe=Math.PI/180,E7=1e-5,j0=function(e){function t(){return _He(this,t),SHe(this,t,arguments)}return BHe(t,e),CHe(t,[{key:"getTickLineCoord",value:function(s){var a=this.props,i=a.cx,o=a.cy,l=a.radius,c=a.orientation,d=a.tickSize,u=d||8,h=yn(i,o,l,s.coordinate),m=yn(i,o,l+(c==="inner"?-1:1)*u,s.coordinate);return{x1:h.x,y1:h.y,x2:m.x,y2:m.y}}},{key:"getTickTextAnchor",value:function(s){var a=this.props.orientation,i=Math.cos(-s.coordinate*PHe),o;return i>E7?o=a==="outer"?"start":"end":i<-E7?o=a==="outer"?"end":"start":o="middle",o}},{key:"renderAxisLine",value:function(){var s=this.props,a=s.cx,i=s.cy,o=s.radius,l=s.axisLine,c=s.axisLineType,d=Rf(Rf({},Dt(this.props,!1)),{},{fill:"none"},Dt(l,!1));if(c==="circle")return oe.createElement(y0,Zf({className:"recharts-polar-angle-axis-line"},d,{cx:a,cy:i,r:o}));var u=this.props.ticks,h=u.map(function(m){return yn(a,i,o,m.coordinate)});return oe.createElement(Oee,Zf({className:"recharts-polar-angle-axis-line"},d,{points:h}))}},{key:"renderTicks",value:function(){var s=this,a=this.props,i=a.ticks,o=a.tick,l=a.tickLine,c=a.tickFormatter,d=a.stroke,u=Dt(this.props,!1),h=Dt(o,!1),m=Rf(Rf({},u),{},{fill:"none"}
1256,Dt(l,!1)),f=i.map(function(p,A){var v=s.getTickLineCoord(p),x=s.getTickTextAnchor(p),b=Rf(Rf(Rf({textAnchor:x},u),{},{stroke:"none",fill:d},h),{},{index:A,payload:p,x:v.x2,y:v.y2});return oe.createElement(Qr,Zf({className:fr("recharts-polar-angle-axis-tick",vee(o)),key:"tick-".concat(p.coordinate)},Mm(s.props,p,A)),l&&oe.createElement("line",Zf({className:"recharts-polar-angle-axis-tick-line"},m,v)),o&&t.renderTickItem(o,b,c?c(p.value,A):p.value))});return oe.createElement(Qr,{className:"recharts-polar-angle-axis-ticks"},f)}},{key:"render",value:function(){var s=this.props,a=s.ticks,i=s.radius,o=s.axisLine;return i<=0||!a||!a.length?null:oe.createElement(Qr,{className:fr("recharts-polar-angle-axis",this.props.className)},o&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(s,a,i){var o;return oe.isValidElement(s)?o=oe.cloneElement(s,a):er(s)?o=s(a):o=oe.createElement($m,Zf({},a,{className:"recharts-polar-angle-axis-tick-value"}),i),o}}])}(g.PureComponent);nS(j0,"displayName","PolarAngleAxis");nS(j0,"axisType","angleAxis");nS(j0,"defaultProps",{type:"category",angleAxisId:0,scale:"auto",cx:0,cy:0,orientation:"outer",axisLine:!0,tickLine:!0,tickSize:8,tick:!0,hide:!1,allowDuplicatedCategory:!0});var IHe=MX,OHe=IHe(Object.getPrototypeOf,Object),FHe=OHe,LHe=Du,DHe=FHe,RHe=Ru,UHe="[object Object]",MHe=Function.prototype,$He=Object.prototype,Mee=MHe.toString,QHe=$He.hasOwnProperty,HHe=Mee.call(Object);function zHe(e){if(!RHe(e)||LHe(e)!=UHe)return!1;var t=DHe(e);if(t===null)return!0;var r=QHe.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&Mee.call(r)==HHe}var VHe=zHe;const GHe=wn(VHe);var qHe=Du,KHe=Ru,WHe="[object Boolean]";function YHe(e){return e===!0||e===!1||KHe(e)&&qHe(e)==WHe}var JHe=YHe;const XHe=wn(JHe);function Vb(e){"@babel/helpers - typeof";return Vb=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Vb(e)}function jN(){return jN=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];
vendor: 17,771 bytes, lines 1256-1257
1256for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},jN.apply(this,arguments)}function ZHe(e,t){return n9e(e)||r9e(e,t)||t9e(e,t)||e9e()}function e9e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1257In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function t9e(e,t){if(e){if(typeof e=="string")return B7(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return B7(e,t)}}function B7(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,s=new Array(t);r<t;r++)s[r]=e[r];return s}function r9e(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var s,a,i,o,l=[],c=!0,d=!1;try{if(i=(r=r.call(e)).next,t!==0)for(;!(c=(s=i.call(r)).done)&&(l.push(s.value),l.length!==t);c=!0);}catch(u){d=!0,a=u}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(d)throw a}}return l}}function n9e(e){if(Array.isArray(e))return e}function T7(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,s)}return r}function P7(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?T7(Object(r),!0).forEach(function(s){s9e(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):T7(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}function s9e(e,t,r){return t=a9e(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a9e(e){var t=i9e(e,"string");return Vb(t)=="symbol"?t:t+""}function i9e(e,t){if(Vb(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(Vb(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var I7=function(t,r,s,a,i){var o=s-a,l;return l="M ".concat(t,",").concat(r),l+="L ".concat(t+s,",").concat(r),l+="L ".concat(t+s-o/2,",").concat(r+i),l+="L ".concat(t+s-o/2-a,",").concat(r+i),l+="L ".concat(t,",").concat(r," Z"),l},o9e={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},l9e=function(t){var r=P7(P7({},o9e),t),s=g.useRef(),a=g.useState(-1),i=ZHe(a,2),o=i[0],l=i[1];g.useEffect(function(){if(s.current&&s.current.getTotalLength)try{var y=s.current.getTotalLength();y&&l(y)}catch{}},[]);var c=r.x,d=r.y,u=r.upperWidth,h=r.lowerWidth,m=r.height,f=r.className,p=r.animationEasing,A=r.animationDuration,v=r.animationBegin,x=r.isUpdateAnimationActive;if(c!==+c||d!==+d||u!==+u||h!==+h||m!==+m||u===0&&h===0||m===0)return null;var b=fr("recharts-trapezoid",f);return x?oe.createElement(Ml,{canBegin:o>0,from:{upperWidth:0,lowerWidth:0,height:m,x:c,y:d},to:{upperWidth:u,lowerWidth:h,height:m,x:c,y:d},duration:A,animationEasing:p,isActive:x},function(y){var w=y.upperWidth,j=y.lowerWidth,N=y.height,_=y.x,S=y.y;return oe.createElement(Ml,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:v,duration:A,easing:p},oe.createElement("path",jN({},Dt(r,!0),{className:b,d:I7(_,S,w,j,N),ref:s})))}):oe.createElement("g",null,oe.createElement("path",jN({},Dt(r,!0),{className:b,d:I7(c,d,u,h,m)})))},c9e=["option","shapeType","propTransformer","activeClassName","isActive"];function Gb(e){"@babel/helpers - typeof";return Gb=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Gb(e)}function d9e(e,t){if(e==null)return{};var r=u9e(e,t),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)s=i[a],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(r[s]=e[s])}return r}function u9e(e,t){if(e==null)return{};var r={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;r[s]=e[s]}return r}function O7(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,s)}return r}function NN(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?O7(Object(r),!0).forEach(function(s){h9e(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):O7(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}function h9e(e,t,r){return t=f9e(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function f9e(e){var t=m9e(e,"string");return Gb(t)=="symbol"?t:t+""}function m9e(e,t){if(Gb(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(Gb(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function p9e(e,t){return NN(NN({},t),e)}function A9e(e,t){return e==="symbols"}function F7(e){var t=e.shapeType,r=e.elementProps;switch(t){case"rectangle":return oe.createElement(wF,r);case"trapezoid":return oe.createElement(l9e,r);case"sector":return oe.createElement(jee,r);case"symbols":if(A9e(t))return oe.createElement($O,r);break;default:return null}}function g9e(e){return g.isValidElement(e)?e.props:e}function $ee(e){var t=e.option,r=e.shapeType,s=e.propTransformer,a=s===void 0?p9e:s,i=e.activeClassName,o=i===void 0?"recharts-active-shape":i,l=e.isActive,c=d9e(e,c9e),d;if(g.isValidElement(t))d=g.cloneElement(t,NN(NN({},c),g9e(t)));else if(er(t))d=t(c);else if(GHe(t)&&!XHe(t)){var u=a(t,c);d=oe.createElement(F7,{shapeType:r,elementProps:u})}else{var h=c;d=oe.createElement(F7,{shapeType:r,elementProps:h})}return l?oe.createElement(Qr,{className:o},d):d}function sS(e,t){return t!=null&&"trapezoids"in e.props}function aS(e,t){return t!=null&&"sectors"in e.props}function qb(e,t){return t!=null&&"points"in e.props}function x9e(e,t){var r,s,a=e.x===(t==null||(r=t.labelViewBox)===null||r===void 0?void 0:r.x)||e.x===t.x,i=e.y===(t==null||(s=t.labelViewBox)===null||s===void 0?void 0:s.y)||e.y===t.y;return a&&i}function v9e(e,t){var r=e.endAngle===t.endAngle,s=e.startAngle===t.startAngle;return r&&s}function b9e(e,t){var r=e.x===t.x,s=e.y===t.y,a=e.z===t.z;return r&&s&&a}function y9e(e,t){var r;return sS(e,t)?r=x9e:aS(e,t)?r=v9e:qb(e,t)&&(r=b9e),r}function w9e(e,t){var r;return sS(e,t)?r="trapezoids":aS(e,t)?r="sectors":qb(e,t)&&(r="points"),r}function j9e(e,t){if(sS(e,t)){var r;return(r=t.tooltipPayload)===null||r===void 0||(r=r[0])===null||r===void 0||(r=r.payload)===null||r===void 0?void 0:r.payload}if(aS(e,t)){var s;return(s=t.tooltipPayload)===null||s===void 0||(s=s[0])===null||s===void 0||(s=s.payload)===null||s===void 0?void 0:s.payload}return qb(e,t)?t.payload:{}}function N9e(e){var t=e.activeTooltipItem,r=e.graphicalItem,s=e.itemData,a=w9e(r,t),i=j9e(r,t),o=s.filter(function(c,d){var u=Yh(i,c),h=r.props[a].filter(function(p){var A=y9e(r,t);return A(p,t)}),m=r.props[a].indexOf(h[h.length-1]),f=d===m;return u&&f}),l=s.indexOf(o[o.length-1]);return l}var Ej;function Eg(e){"@babel/helpers - typeof";return Eg=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Eg(e)}function yA(){return yA=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},yA.apply(this,arguments)}function L7(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,s)}return r}function ts(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?L7(Object(r),!0).forEach(function(s){Ol(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):L7(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}function _9e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function D7(e,t){for(var r=0;r<t.length;r++){var s=t[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,Hee(s.key),s)}}function C9e(e,t,r){return t&&D7(e.prototype,t),r&&D7(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function S9e(e,t,r){return t=_N(t),k9e(e,Qee()?Reflect.construct(t,r||[],_N(e).constructor):t.apply(e,r))}function k9e(e,t){if(t&&(Eg(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return E9e(e)}function E9e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Qee(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Qee=function(){return!!e})()}function _N(e){return _N=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},_N(e)}function B9e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c3(e,t)}function c3(e,t){return c3=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,a){return s.__proto__=a,s},c3(e,t)}function Ol(e,t,r){return t=Hee(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Hee(e){var t=T9e(e,"string");return Eg(t)=="symbol"?t:t+""}function T9e(e,t){if(Eg(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(Eg(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Sc=function(e){function t(r){var s;return _9e(this,t),s=S9e(this,t,[r]),Ol(s,"pieRef",null),Ol(s,"sectorRefs",[]),Ol(s,"id",sp("recharts-pie-")),Ol(s,"handleAnimationEnd",function(){var a=s.props.onAnimationEnd;s.setState({isAnimationFinished:!0}),er(a)&&a()}),Ol(s,"handleAnimationStart",function(){var a=s.props.onAnimationStart;s.setState({isAnimationFinished:!1}),er(a)&&a()}),s.state={isAnimationFinished:!r.isAnimationActive,prevIsAnimationActive:r.isAnimationActive,prevAnimationId:r.animationId,sectorToFocus:0},s}return B9e(t,e),C9e(t,[{key:"isActiveIndex",value:function(s){var a=this.props.activeIndex;return Array.isArray(a)?a.indexOf(s)!==-1:s===a}},{key:"hasActiveIndex",value:function(){var s=this.props.activeIndex;return Array.isArray(s)?s.length!==0:s||s===0}},{key:"renderLabels",value:function(s){var a=this.props.isAnimationActive;if(a&&!this.state.isAnimationFinished)return null;var i=this.props,o=i.label,l=i.labelLine,c=i.dataKey,d=i.valueKey,u=Dt(this.props,!1),h=Dt(o,!1),m=Dt(l,!1),f=o&&o.offsetRadius||20,p=s.map(function(A,v){var x=(A.startAngle+A.endAngle)/2,b=yn(A.cx,A.cy,A.outerRadius+f,x),y=ts(ts(ts(ts({},u),A),{},{stroke:"none"},h),{},{index:v,textAnchor:t.getTextAnchor(b.x,A.cx)},b),w=ts(ts(ts(ts({},u),A),{},{fill:"none",stroke:A.fill},m),{},{index:v,points:[yn(A.cx,A.cy,A.outerRadius,x),b]}),j=c;return wr(c)&&wr(d)?j="value":wr(c)&&(j=d),oe.createElement(Qr,{key:"label-".concat(A.startAngle,"-").concat(A.endAngle,"-").concat(A.midAngle,"-").concat(v)},l&&t.renderLabelLineItem(l,w,"line"),t.renderLabelItem(o,y,Ps(A,j)))});return oe.createElement(Qr,{className:"recharts-pie-labels"},p)}},{key:"renderSectorsStatically",value:function(s){var a=this,i=this.props,o=i.activeShape,l=i.blendStroke,c=i.inactiveShape;return s.map(function(d,u){if((d==null?void 0:d.startAngle)===0&&(d==null?void 0:d.endAngle)===0&&s.length!==1)return null;var h=a.isActiveIndex(u),m=c&&a.hasActiveIndex()?c:null,f=h?o:m,p=ts(ts({},d),{},{stroke:l?d.fill:d.stroke,tabIndex:-1});return oe.createElement(Qr,yA({ref:function(v){v&&!a.sectorRefs.includes(v)&&a.sectorRefs.push(v)},tabIndex:-1,className:"recharts-pie-sector"},Mm(a.props,d,u),{key:"sector-".concat(d==null?void 0:d.startAngle,"-").concat(d==null?void 0:d.endAngle,"-").concat(d.midAngle,"-").concat(u)}),oe.createElement($ee,yA({option:f,isActive:h,shapeType:"sector"},p)))})}},{key:"renderSectorsWithAnimation",value:function(){var s=this,a=this.props,i=a.sectors,o=a.isAnimationActive,l=a.animationBegin,c=a.animationDuration,d=a.animationEasing,u=a.animationId,h=this.state,m=h.prevSectors,f=h.prevIsAnimationActive;return oe.createElement(Ml,{begin:l,duration:c,isActive:o,easing:d,from:{t:0},to:{t:1},key:"pie-".concat(u,"-").concat(f),onAnimationStart:this.handleAnimationStart,onAnimationEnd:this.handleAnimationEnd},function(p){var A=p.t,v=[],x=i&&i[0],b=x.startAngle;return i.forEach(function(y,w){var j=m&&m[w],N=w>0?Zo(y,"paddingAngle",0):0;if(j){var _=ks(j.endAngle-j.startAngle,y.endAngle-y.startAngle),S=ts(ts({},y),{},{startAngle:b+N,endAngle:b+_(A)+N});v.push(S),b=S.endAngle}else{var C=y.endAngle,E=y.startAngle,T=ks(0,C-E),B=T(A),L=ts(ts({},y),{},{startAngle:b+N,endAngle:b+B+N});v.push(L),b=L.endAngle}}),oe.createElement(Qr,null,s.renderSectorsStatically(v))})}},{key:"attachKeyboardHandlers",value:function(s){var a=this;s.onkeydown=function(i){if(!i.altKey)switch(i.key){case"ArrowLeft":{var o=++a.state.sectorToFocus%a.sectorRefs.length;a.sectorRefs[o].focus(),a.setState({sectorToFocus:o});break}case"ArrowRight":{var l=--a.state.sectorToFocus<0?a.sectorRefs.length-1:a.state.sectorToFocus%a.sectorRefs.length;a.sectorRefs[l].focus(),a.setState({sectorToFocus:l});break}case"Escape":{a.sectorRefs[a.state.sectorToFocus].blur(),a.setState({sectorToFocus:0});break}}}}},{key:"renderSectors",value:function(){var s=this.props,a=s.sectors,i=s.isAnimationActive,o=this.state.prevSectors;return i&&a&&a.length&&(!o||!Yh(o,a))?this.renderSectorsWithAnimation():this.renderSectorsStatically(a)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var s=this,a=this.props,i=a.hide,o=a.sectors,l=a.className,c=a.label,d=a.cx,u=a.cy,h=a.innerRadius,m=a.outerRadius,f=a.isAnimationActive,p=this.state.isAnimationFinished;if(i||!o||!o.length||!lt(d)||!lt(u)||!lt(h)||!lt(m))return null;var A=fr("recharts-pie",l);return oe.createElement(Qr,{tabIndex:this.props.rootTabIndex,className:A,ref:function(x){s.pieRef=x}},this.renderSectors(),c&&this.renderLabels(o),qa.renderCallByParent(this.props,null,!1),(!f||p)&&wc.renderCallByParent(this.props,o,!1))}}],[{key:"getDerivedStateFromProps",value:function(s,a){return a.prevIsAnimationActive!==s.isAnimationActive?{prevIsAnimationActive:s.isAnimationActive,prevAnimationId:s.animationId,curSectors:s.sectors,prevSectors:[],isAnimationFinished:!0}:s.isAnimationActive&&s.animationId!==a.prevAnimationId?{prevAnimationId:s.animationId,curSectors:s.sectors,prevSectors:a.curSectors,isAnimationFinished:!0}:s.sectors!==a.curSectors?{curSectors:s.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(s,a){return s>a?"start":s<a?"end":"middle"}},{key:"renderLabelLineItem",value:function(s,a,i){if(oe.isValidElement(s))return oe.cloneElement(s,a);if(er(s))return s(a);var o=fr("recharts-pie-label-line",typeof s!="boolean"?s.className:"");return oe.createElement(jm,yA({},a,{key:i,type:"linear",className:o}))}},{key:"renderLabelItem",value:function(s,a,i){if(oe.isValidElement(s))return oe.cloneElement(s,a);var o=i;if(er(s)&&(o=s(a),oe.isValidElement(o)))return o;var l=fr("recharts-pie-label-text",typeof s!="boolean"&&!er(s)?s.className:"");return oe.createElement($m,yA({},a,{alignmentBaseline:"middle",className:l}),o)}}])}(g.PureComponent);Ej=Sc;Ol(Sc,"displayName","Pie");Ol(Sc,"defaultProps",{stroke:"#fff",fill:"#808080",legendType:"rect",cx:"50%",cy:"50%",startAngle:0,endAngle:360,innerRadius:0,outerRadius:"80%",paddingAngle:0,labelLine:!0,hide:!1,minAngle:0,isAnimationActive:!Uu.isSsr,animationBegin:400,animationDuration:1500,animationEasing:"ease",nameKey:"name",blendStroke:!1,rootTabIndex:0});Ol(Sc,"parseDeltaAngle",function(e,t){var r=Qi(t-e),s=Math.min(Math.abs(t-e),360);return r*s});Ol(Sc,"getRealPieData",function(e){var t=e.data,r=e.children,s=Dt(e,!1),a=el(r,yg);return t&&t.length?t.map(function(i,o){return ts(ts(ts({payload:i},s),i),a&&a[o]&&a[o].props)}):a&&a.length?a.map(function(i){return ts(ts({},s),i.props)}):[]});Ol(Sc,"parseCoordinateOfPie",function(e,t){var r=t.top,s=t.left,a=t.width,i=t.height,o=gee(a,i),l=s+Hi(e.cx,a,a/2),c=r+Hi(e.cy,i,i/2),d=Hi(e.innerRadius,o,0),u=Hi(e.outerRadius,o,o*.8),h=e.maxRadius||Math.sqrt(a*a+i*i)/2;return{cx:l,cy:c,innerRadius:d,outerRadius:u,maxRadius:h}});Ol(Sc,"getComposedData",function(e){var t=e.item,r=e.offset,s=t.type.defaultProps!==void 0?ts(ts({},t.type.defaultProps),t.props):t.props,a=Ej.getRealPieData(s);if(!a||!a.length)return null;var i=s.cornerRadius,o=s.startAngle,l=s.endAngle,c=s.paddingAngle,d=s.dataKey,u=s.nameKey,h=s.valueKey,m=s.tooltipType,f=Math.abs(s.minAngle),p=Ej.parseCoordinateOfPie(s,r),A=Ej.parseDeltaAngle(o,l),v=Math.abs(A),x=d;wr(d)&&wr(h)?(yc(!1,`Use "dataKey" to specify the value of pie,
1258      the props "valueKey" will be deprecated in 1.1.0`),x="value"):wr(d)&&(yc(!1,`Use "dataKey" to specify the value of pie,
1259      the props "valueKey" will be deprecated in 1.1.0`),x=h);var b=a.filter(function(S){return Ps(S,x,0)!==0}).length,y=(v>=360?b:b-1)*c,w=v-b*f-y,j=a.reduce(function(S,C){var E=Ps(C,x,0);return S+(lt(E)?E:0)},0),N;if(j>0){var _;N=a.map(function(S,C){var E=Ps(S,x,0),T=Ps(S,u,C),B=(lt(E)?E:0)/j,L;C?L=_.endAngle+Qi(A)*c*(E!==0?1:0):L=o;var P=L+Qi(A)*((E!==0?f:0)+B*w),F=(L+P)/2,M=(p.innerRadius+p.outerRadius)/2,I=[{name:T,value:E,payload:S,dataKey:x,type:m}],$=yn(p.cx,p.cy,M,F);return _=ts(ts(ts({percent:B,cornerRadius:i,name:T,tooltipPayload:I,midAngle:F,middleRadius:M,tooltipPosition:$},S),p),{},{value:Ps(S,x),startAngle:L,endAngle:P,payload:S,paddingAngle:Qi(A)*c}),_})}return ts(ts({},p),{},{sectors:N,data:a})});function P9e(e){return e&&e.length?e[0]:void 0}var I9e=P9e,O9e=I9e;const F9e=wn(O9e);var L9e=["key"];function Bg(e){"@babel/helpers - typeof";return Bg=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Bg(e)}function D9e(e,t){if(e==null)return{};var r=R9e(e,t),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)s=i[a],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(r[s]=e[s])}return r}function R9e(e,t){if(e==null)return{};var r={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;r[s]=e[s]}return r}function CN(){return CN=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];
vendor: 5,895 bytes, line 1259
1259for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},CN.apply(this,arguments)}function R7(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,s)}return r}function Di(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?R7(Object(r),!0).forEach(function(s){su(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):R7(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}function U9e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function U7(e,t){for(var r=0;r<t.length;r++){var s=t[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,Vee(s.key),s)}}function M9e(e,t,r){return t&&U7(e.prototype,t),r&&U7(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function $9e(e,t,r){return t=SN(t),Q9e(e,zee()?Reflect.construct(t,r||[],SN(e).constructor):t.apply(e,r))}function Q9e(e,t){if(t&&(Bg(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return H9e(e)}function H9e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function zee(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(zee=function(){return!!e})()}function SN(e){return SN=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},SN(e)}function z9e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&d3(e,t)}function d3(e,t){return d3=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,a){return s.__proto__=a,s},d3(e,t)}function su(e,t,r){return t=Vee(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Vee(e){var t=V9e(e,"string");return Bg(t)=="symbol"?t:t+""}function V9e(e,t){if(Bg(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(Bg(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var zy=function(e){function t(){var r;U9e(this,t);for(var s=arguments.length,a=new Array(s),i=0;i<s;i++)a[i]=arguments[i];return r=$9e(this,t,[].concat(a)),su(r,"state",{isAnimationFinished:!1}),su(r,"handleAnimationEnd",function(){var o=r.props.onAnimationEnd;r.setState({isAnimationFinished:!0}),er(o)&&o()}),su(r,"handleAnimationStart",function(){var o=r.props.onAnimationStart;r.setState({isAnimationFinished:!1}),er(o)&&o()}),su(r,"handleMouseEnter",function(o){var l=r.props.onMouseEnter;l&&l(r.props,o)}),su(r,"handleMouseLeave",function(o){var l=r.props.onMouseLeave;l&&l(r.props,o)}),r}return z9e(t,e),M9e(t,[{key:"renderDots",value:function(s){var a=this.props,i=a.dot,o=a.dataKey,l=Dt(this.props,!1),c=Dt(i,!0),d=s.map(function(u,h){var m=Di(Di(Di({key:"dot-".concat(h),r:3},l),c),{},{dataKey:o,cx:u.x,cy:u.y,index:h,payload:u});return t.renderDotItem(i,m)});return oe.createElement(Qr,{className:"recharts-radar-dots"},d)}},{key:"renderPolygonStatically",value:function(s){var a=this.props,i=a.shape,o=a.dot,l=a.isRange,c=a.baseLinePoints,d=a.connectNulls,u;return oe.isValidElement(i)?u=oe.cloneElement(i,Di(Di({},this.props),{},{points:s})):er(i)?u=i(Di(Di({},this.props),{},{points:s})):u=oe.createElement(Oee,CN({},Dt(this.props,!0),{onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave,points:s,baseLinePoints:l?c:null,connectNulls:d})),oe.createElement(Qr,{className:"recharts-radar-polygon"},u,o?this.renderDots(s):null)}},{key:"renderPolygonWithAnimation",value:function(){var s=this,a=this.props,i=a.points,o=a.isAnimationActive,l=a.animationBegin,c=a.animationDuration,d=a.animationEasing,u=a.animationId,h=this.state.prevPoints;return oe.createElement(Ml,{begin:l,duration:c,isActive:o,easing:d,from:{t:0},to:{t:1},key:"radar-".concat(u),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(m){var f=m.t,p=h&&h.length/i.length,A=i.map(function(v,x){var b=h&&h[Math.floor(x*p)];if(b){var y=ks(b.x,v.x),w=ks(b.y,v.y);return Di(Di({},v),{},{x:y(f),y:w(f)})}var j=ks(v.cx,v.x),N=ks(v.cy,v.y);return Di(Di({},v),{},{x:j(f),y:N(f)})});return s.renderPolygonStatically(A)})}},{key:"renderPolygon",value:function(){var s=this.props,a=s.points,i=s.isAnimationActive,o=s.isRange,l=this.state.prevPoints;return i&&a&&a.length&&!o&&(!l||!Yh(l,a))?this.renderPolygonWithAnimation():this.renderPolygonStatically(a)}},{key:"render",value:function(){var s=this.props,a=s.hide,i=s.className,o=s.points,l=s.isAnimationActive;if(a||!o||!o.length)return null;var c=this.state.isAnimationFinished,d=fr("recharts-radar",i);return oe.createElement(Qr,{className:d},this.renderPolygon(),(!l||c)&&wc.renderCallByParent(this.props,o))}}],[{key:"getDerivedStateFromProps",value:function(s,a){return s.animationId!==a.prevAnimationId?{prevAnimationId:s.animationId,curPoints:s.points,prevPoints:a.curPoints}:s.points!==a.curPoints?{curPoints:s.points}:null}},{key:"renderDotItem",value:function(s,a){var i;if(oe.isValidElement(s))i=oe.cloneElement(s,a);else if(er(s))i=s(a);else{var o=a.key,l=D9e(a,L9e);i=oe.createElement(y0,CN({},l,{key:o,className:fr("recharts-radar-dot",typeof s!="boolean"?s.className:"")}))}return i}}])}(g.PureComponent);su(zy,"displayName","Radar");su(zy,"defaultProps",{angleAxisId:0,radiusAxisId:0,hide:!1,activeDot:!0,dot:!1,legendT
1259ype:"rect",isAnimationActive:!Uu.isSsr,animationBegin:0,animationDuration:1500,animationEasing:"ease"});su(zy,"getComposedData",function(e){var t=e.radiusAxis,r=e.angleAxis,s=e.displayedData,a=e.dataKey,i=e.bandSize,o=r.cx,l=r.cy,c=!1,d=[],u=r.type!=="number"?i??0:0;s.forEach(function(m,f){var p=Ps(m,r.dataKey,f),A=Ps(m,a),v=r.scale(p)+u,x=Array.isArray(A)?yee(A):A,b=wr(x)?void 0:t.scale(x);Array.isArray(A)&&A.length>=2&&(c=!0),d.push(Di(Di({},yn(o,l,b,v)),{},{name:p,value:A,cx:o,cy:l,radius:b,angle:v,payload:m}))});var h=[];return c&&d.forEach(function(m){if(Array.isArray(m.value)){var f=F9e(m.value),p=wr(f)?void 0:t.scale(f);h.push(Di(Di({},m),{},{radius:p},yn(o,l,p,m.angle)))}else h.push(m)}),{points:d,isRange:c,baseLinePoints:h}});var G9e=Math.ceil,q9e=Math.max;function K9e(e,t,r,s){for(var a=-1,i=q9e(G9e((t-e)/(r||1)),0),o=Array(i);i--;)o[s?i:++a]=e,e+=r;return o}var W9e=K9e,Y9e=aZ,M7=1/0,J9e=17976931348623157e292;function X9e(e){if(!e)return e===0?e:0;if(e=Y9e(e),e===M7||e===-M7){var t=e<0?-1:1;return t*J9e}return e===e?e:0}var Gee=X9e,Z9e=W9e,eze=VC,iE=Gee;function tze(e){return function(t,r,s){return s&&typeof s!="number"&&eze(t,r,s)&&(r=s=void 0),t=iE(t),r===void 0?(r=t,t=0):r=iE(r),s=s===void 0?t<r?1:-1:iE(s),Z9e(t,r,s,e)}}var rze=tze,nze=rze,sze=nze(),aze=sze;const kN=wn(aze);function Kb(e){"@babel/helpers - typeof";return Kb=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Kb(e)}function $7(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,s)}return r}function Q7(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?$7(Object(r),!0).forEach(function(s){qee(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):$7(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}function qee(e,t,r){return t=ize(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ize(e){var t=oze(e,"string");return Kb(t)=="symbol"?t:t+""}function oze(e,t){if(Kb(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(Kb(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var lze=["Webkit","Moz","O","ms"],cze=function(t,r){var s=t.replace(/(\w)/,function(i){return i.toUpperCase()}),a=lze.reduce(function(i,o){return Q7(Q7({},i),{},qee({},o+s,r))},{});return a[t]=r,a};function Tg(e){"@babel/helpers - typeof";return Tg=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Tg(e)}function EN(){return EN=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];
vendor: 9,245 bytes, line 1259
1259for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},EN.apply(this,arguments)}function H7(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,s)}return r}function oE(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?H7(Object(r),!0).forEach(function(s){Lo(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):H7(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}function dze(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function z7(e,t){for(var r=0;r<t.length;r++){var s=t[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,Wee(s.key),s)}}function uze(e,t,r){return t&&z7(e.prototype,t),r&&z7(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function hze(e,t,r){return t=BN(t),fze(e,Kee()?Reflect.construct(t,r||[],BN(e).constructor):t.apply(e,r))}function fze(e,t){if(t&&(Tg(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return mze(e)}function mze(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Kee(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Kee=function(){return!!e})()}function BN(e){return BN=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},BN(e)}function pze(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&u3(e,t)}function u3(e,t){return u3=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,a){return s.__proto__=a,s},u3(e,t)}function Lo(e,t,r){return t=Wee(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Wee(e){var t=Aze(e,"string");return Tg(t)=="symbol"?t:t+""}function Aze(e,t){if(Tg(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(Tg(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var gze=function(t){var r=t.data,s=t.startIndex,a=t.endIndex,i=t.x,o=t.width,l=t.travellerWidth;if(!r||!r.length)return{};var c=r.length,d=gv().domain(kN(0,c)).range([i,i+o-l]),u=d.domain().map(function(h){return d(h)});return{isTextActive:!1,isSlideMoving:!1,isTravellerMoving:!1,isTravellerFocused:!1,startX:d(s),endX:d(a),scale:d,scaleValues:u}},V7=function(t){return t.changedTouches&&!!t.changedTouches.length},Pg=function(e){function t(r){var s;return dze(this,t),s=hze(this,t,[r]),Lo(s,"handleDrag",function(a){s.leaveTimer&&(clearTimeout(s.leaveTimer),s.leaveTimer=null),s.state.isTravellerMoving?s.handleTravellerMove(a):s.state.isSlideMoving&&s.handleSlideDrag(a)}),Lo(s,"handleTouchMove",function(a){a.changedTouches!=null&&a.changedTouches.length>0&&s.handleDrag(a.changedTouches[0])}),Lo(s,"handleDragEnd",function(){s.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var a=s.props,i=a.endIndex,o=a.onDragEnd,l=a.startIndex;o==null||o({endIndex:i,startIndex:l})}),s.detachDragEndListener()}),Lo(s,"handleLeaveWrapper",function(){(s.state.isTravellerMoving||s.state.isSlideMoving)&&(s.leaveTimer=window.setTimeout(s.handleDragEnd,s.props.leaveTimeOut))}),Lo(s,"handleEnterSlideOrTraveller",function(){s.setState({isTextActive:!0})}),Lo(s,"handleLeaveSlideOrTraveller",function(){s.setState({isTextActive:!1})}),Lo(s,"handleSlideDragStart",function(a){var i=V7(a)?a.changedTouches[0]:a;s.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:i.pageX}),s.attachDragEndListener()}),s.travellerDragStartHandlers={startX:s.handleTravellerDragStart.bind(s,"startX"),endX:s.handleTravellerDragStart.bind(s,"endX")},s.state={},s}return pze(t,e),uze(t,[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(s){var a=s.startX,i=s.endX,o=this.state.scaleValues,l=this.props,c=l.gap,d=l.data,u=d.length-1,h=Math.min(a,i),m=Math.max(a,i),f=t.getIndexInRange(o,h),p=t.getIndexInRange(o,m);return{startIndex:f-f%c,endIndex:p===u?u:p-p%c}}},{key:"getTextOfTick",value:function(s){var a=this.props,i=a.data,o=a.tickFormatter,l=a.dataKey,c=Ps(i[s],l,s);return er(o)?o(c,s):c}},{key:"attachDragEndListener",value:function(){window.addEventListener("mouseup",this.handleDragEnd,!0),window.addEventListener("touchend",this.handleDragEnd,!0),window.addEventListener("mousemove",this.handleDrag,!0)}},{key:"detachDragEndListener",value:function(){window.removeEventListener("mouseup",this.handleDragEnd,!0),window.removeEventListener("touchend",this.handleDragEnd,!0),window.removeEventListener("mousemove",this.handleDrag,!0)}},{key:"handleSlideDrag",value:function(s){var a=this.state,i=a.slideMoveStartX,o=a.startX,l=a.endX,c=this.props,d=c.x,u=c.width,h=c.travellerWidth,m=c.startIndex,f=c.endIndex,p=c.onChange,A=s.pageX-i;A>0?A=Math.min(A,d+u-h-l,d+u-h-o):A<0&&(A=Math.max(A,d-o,d-l));var v=this.getIndex({startX:o+A,endX:l+A});(v.startIndex!==m||v.endIndex!==f)&&p&&p(v),this.setState({startX:o+A,endX:l+A,slideMoveStartX:s.pageX})}},{key:"handleTravellerDragStart",value:function(s,a){var i=V7(a)?a.changedTouches[0]:a;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:s,brushMoveStartX:i.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(s){var a=this.state,i=a.brushMoveStartX,o=a.movingTravellerId,l=a.endX,c=a.startX,d=this.state[o],u=this.props,h=u.x,m=u.width,f=u.travellerWidth,p=u.onChange,A=u.gap,v=u.data,x={startX:this.state.startX,endX:this.state.endX},b=s.pageX-i;b>0?b=Math.min(b,h+m-f-d):b<0&&(b=Math.max(b,h-d)),x[o]=d+b;var y=this.getIndex(x),w=y.startIndex,j=y.endIndex,N=function(){var S=v.length-1;return o==="startX"&&(l>c?w%A===0:j%A===0)||l<c&&j===S||o==="endX"&&(l>c?j%A===0:w%A===0)||l>c&&j===S};this.setState(Lo(Lo({},o,d+b),"brushMoveStartX",s.pageX),function(){p&&N()&&p(y)})}},{key:"handleTravellerMoveKeyboard",value:function(s,a){var i=this,o=this.state,l=o.scaleValues,c=o.startX,d=o.endX,u=this.state[a],h=l.indexOf(u);if(h!==-1){var m=h+s;if(!(m===-1||m>=l.length)){var f=l[m];a==="startX"&&f>=d||a==="endX"&&f<=c||this.setState(Lo({},a,f),function(){i.props.onChange(i.getIndex({startX:i.state.startX,endX:i.state.endX}))})}}}},{key:"renderBackground",value:function(){var s=this.props,a=s.x,i=s.y,o=s.width,l=s.height,c=s.fill,d=s.stroke;return oe.createElement("rect",{stroke:d,fill:c,x:a,y:i,width:o,height:l})}},{key:"renderPanorama",value:function(){var s=this.props,a=s.x,i=s.y,o=s.width,l=s.height,c=s.data,d=s.children,u=s.padding,h=g.Children.only(d);return h?oe.cloneElement(h,{x:a,y:i,width:o,height:l,margin:u,compact:!0,data:c}):null}},{key:"renderTravellerLayer",value:function(s,a){var i,o,l=this,c=this.props,d=c.y,u=c.travellerWidth,h=c.height,m=c.traveller,f=c.ariaLabel,p=c.data,A=c.startIndex,v=c.endIndex,x=Math.max(s,this.props.x),b=oE(oE({},Dt(this.props,!1)),{},{x,y:d,width:u,height:h}),y=f||"Min value: ".concat((i=p[A])===null||i===void 0?void 0:i.name,", Max value: ").concat((o=p[v])===null||o===void 0?void 0:o.name);return oe.createElement(Qr,{tabIndex:0,role:"slider","aria-label":y,"aria-valuenow":s,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[a],onTouchStart:this.travellerDragStartHandlers[a],onKeyDown:function(j){["ArrowLeft","ArrowRight"].includes(j.key)&&(j.preventDefault(),j.stopPropagation(),l.handleTravellerMoveKeyboard(j.key==="ArrowRight"?1:-1,a))},onFocus:function(){l.setState({isTravellerFocused:!0})},onBlur:function(){l.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},t.renderTraveller(m,b))}},{key:"renderSlide",value:function(s,a){var i=this.props,o=i.y,l=i.height,c=i.stroke,d=i.travellerWidth,u=Math.min(s,a)+d,h=Math.max(Math.abs(a-s)-d,0);return oe.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:"move"},stroke:"none",fill:c,fillOpacity:.2,x:u,y:o,width:h,height:l})}},{key:"renderText",value:function(){var s=this.props,a=s.startIndex,i=s.endIndex,o=s.y,l=s.height,c=s.travellerWidth,d=s.stroke,u=this.state,h=u.startX,m=u.endX,f=5,p={pointerEvents:"none",fill:d};return oe.createElement(Qr,{className:"recharts-brush-texts"},oe.createElement($m,EN({textAnchor:"end",verticalAnchor:"middle",x:Math.min(h,m)-f,y:o+l/2},p),this.getTextOfTick(a)),oe.createElement($m,EN({textAnchor:"start",verticalAnchor:"middle",x:Math.max(h,m)+c+f,y:o+l/2}
1259,p),this.getTextOfTick(i)))}},{key:"render",value:function(){var s=this.props,a=s.data,i=s.className,o=s.children,l=s.x,c=s.y,d=s.width,u=s.height,h=s.alwaysShowText,m=this.state,f=m.startX,p=m.endX,A=m.isTextActive,v=m.isSlideMoving,x=m.isTravellerMoving,b=m.isTravellerFocused;if(!a||!a.length||!lt(l)||!lt(c)||!lt(d)||!lt(u)||d<=0||u<=0)return null;var y=fr("recharts-brush",i),w=oe.Children.count(o)===1,j=cze("userSelect","none");return oe.createElement(Qr,{className:y,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:j},this.renderBackground(),w&&this.renderPanorama(),this.renderSlide(f,p),this.renderTravellerLayer(f,"startX"),this.renderTravellerLayer(p,"endX"),(A||v||x||b||h)&&this.renderText())}}],[{key:"renderDefaultTraveller",value:function(s){var a=s.x,i=s.y,o=s.width,l=s.height,c=s.stroke,d=Math.floor(i+l/2)-1;return oe.createElement(oe.Fragment,null,oe.createElement("rect",{x:a,y:i,width:o,height:l,fill:c,stroke:"none"}),oe.createElement("line",{x1:a+1,y1:d,x2:a+o-1,y2:d,fill:"none",stroke:"#fff"}),oe.createElement("line",{x1:a+1,y1:d+2,x2:a+o-1,y2:d+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(s,a){var i;return oe.isValidElement(s)?i=oe.cloneElement(s,a):er(s)?i=s(a):i=t.renderDefaultTraveller(a),i}},{key:"getDerivedStateFromProps",value:function(s,a){var i=s.data,o=s.width,l=s.x,c=s.travellerWidth,d=s.updateId,u=s.startIndex,h=s.endIndex;if(i!==a.prevData||d!==a.prevUpdateId)return oE({prevData:i,prevTravellerWidth:c,prevUpdateId:d,prevX:l,prevWidth:o},i&&i.length?gze({data:i,width:o,x:l,travellerWidth:c,startIndex:u,endIndex:h}):{scale:null,scaleValues:null});if(a.scale&&(o!==a.prevWidth||l!==a.prevX||c!==a.prevTravellerWidth)){a.scale.range([l,l+o-c]);var m=a.scale.domain().map(function(f){return a.scale(f)});return{prevData:i,prevTravellerWidth:c,prevUpdateId:d,prevX:l,prevWidth:o,startX:a.scale(s.startIndex),endX:a.scale(s.endIndex),scaleValues:m}}return null}},{key:"getIndexInRange",value:function(s,a){for(var i=s.length,o=0,l=i-1;l-o>1;){var c=Math.floor((o+l)/2);s[c]>a?l=c:o=c}return a>=s[l]?l:o}}])}(g.PureComponent);Lo(Pg,"displayName","Brush");Lo(Pg,"defaultProps",{height:40,travellerWidth:5,gap:1,fill:"#fff",stroke:"#666",padding:{top:1,right:1,bottom:1,left:1},leaveTimeOut:1e3,alwaysShowText:!1});var xze=KO;function vze(e,t){var r;return xze(e,function(s,a,i){return r=t(s,a,i),!r}),!!r}var bze=vze,yze=PX,wze=_d,jze=bze,Nze=vo,_ze=VC;function Cze(e,t,r){var s=Nze(e)?yze:jze;return r&&_ze(e,t,r)&&(t=void 0),s(e,wze(t))}var Sze=Cze;const kze=wn(Sze);var hd=function(t,r){var s=t.alwaysShow,a=t.ifOverflow;return s&&(a="extendDomain"),a===r},G7=eZ;function Eze(e,t,r){t=="__proto__"&&G7?G7(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}var Bze=Eze,Tze=Bze,Pze=XX,Ize=_d;function Oze(e,t){var r={};return t=Ize(t),Pze(e,function(s,a,i){Tze(r,a,t(s,a,i))}),r}var Fze=Oze;const Lze=wn(Fze);function Dze(e,t){for(var r=-1,s=e==null?0:e.length;++r<s;)if(!t(e[r],r,e))return!1;return!0}var Rze=Dze,Uze=KO;function Mze(e,t){var r=!0;return Uze(e,function(s,a,i){return r=!!t(s,a,i),r}),r}var $ze=Mze,Qze=Rze,Hze=$ze,zze=_d,Vze=vo,Gze=VC;function qze(e,t,r){var s=Vze(e)?Qze:Hze;return r&&Gze(e,t,r)&&(t=void 0),s(e,zze(t))}var Kze=qze;const Yee=wn(Kze);var Wze=["x","y"];function Wb(e){"@babel/helpers - typeof";return Wb=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Wb(e)}function h3(){return h3=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];
vendor: 16,818 bytes, line 1259
1259for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},h3.apply(this,arguments)}function q7(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,s)}return r}function Nx(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?q7(Object(r),!0).forEach(function(s){Yze(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):q7(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}function Yze(e,t,r){return t=Jze(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Jze(e){var t=Xze(e,"string");return Wb(t)=="symbol"?t:t+""}function Xze(e,t){if(Wb(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(Wb(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Zze(e,t){if(e==null)return{};var r=eVe(e,t),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)s=i[a],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(r[s]=e[s])}return r}function eVe(e,t){if(e==null)return{};var r={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;r[s]=e[s]}return r}function tVe(e,t){var r=e.x,s=e.y,a=Zze(e,Wze),i="".concat(r),o=parseInt(i,10),l="".concat(s),c=parseInt(l,10),d="".concat(t.height||a.height),u=parseInt(d,10),h="".concat(t.width||a.width),m=parseInt(h,10);return Nx(Nx(Nx(Nx(Nx({},t),a),o?{x:o}:{}),c?{y:c}:{}),{},{height:u,width:m,name:t.name,radius:t.radius})}function K7(e){return oe.createElement($ee,h3({shapeType:"rectangle",propTransformer:tVe,activeClassName:"recharts-active-bar"},e))}var rVe=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(s,a){if(typeof t=="number")return t;var i=lt(s)||rEe(s);return i?t(s,a):(i||Hm(),r)}},nVe=["value","background"],Jee;function Ig(e){"@babel/helpers - typeof";return Ig=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ig(e)}function sVe(e,t){if(e==null)return{};var r=aVe(e,t),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)s=i[a],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(r[s]=e[s])}return r}function aVe(e,t){if(e==null)return{};var r={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;r[s]=e[s]}return r}function TN(){return TN=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},TN.apply(this,arguments)}function W7(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,s)}return r}function ha(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?W7(Object(r),!0).forEach(function(s){Sh(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):W7(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}function iVe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Y7(e,t){for(var r=0;r<t.length;r++){var s=t[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,Zee(s.key),s)}}function oVe(e,t,r){return t&&Y7(e.prototype,t),r&&Y7(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function lVe(e,t,r){return t=PN(t),cVe(e,Xee()?Reflect.construct(t,r||[],PN(e).constructor):t.apply(e,r))}function cVe(e,t){if(t&&(Ig(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return dVe(e)}function dVe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Xee(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Xee=function(){return!!e})()}function PN(e){return PN=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},PN(e)}function uVe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&f3(e,t)}function f3(e,t){return f3=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,a){return s.__proto__=a,s},f3(e,t)}function Sh(e,t,r){return t=Zee(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Zee(e){var t=hVe(e,"string");return Ig(t)=="symbol"?t:t+""}function hVe(e,t){if(Ig(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(Ig(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var vc=function(e){function t(){var r;iVe(this,t);for(var s=arguments.length,a=new Array(s),i=0;i<s;i++)a[i]=arguments[i];return r=lVe(this,t,[].concat(a)),Sh(r,"state",{isAnimationFinished:!1}),Sh(r,"id",sp("recharts-bar-")),Sh(r,"handleAnimationEnd",function(){var o=r.props.onAnimationEnd;r.setState({isAnimationFinished:!0}),o&&o()}),Sh(r,"handleAnimationStart",function(){var o=r.props.onAnimationStart;r.setState({isAnimationFinished:!1}),o&&o()}),r}return uVe(t,e),oVe(t,[{key:"renderRectanglesStatically",value:function(s){var a=this,i=this.props,o=i.shape,l=i.dataKey,c=i.activeIndex,d=i.activeBar,u=Dt(this.props,!1);return s&&s.map(function(h,m){var f=m===c,p=f?d:o,A=ha(ha(ha({},u),h),{},{isActive:f,option:p,index:m,dataKey:l,onAnimationStart:a.handleAnimationStart,onAnimationEnd:a.handleAnimationEnd});return oe.createElement(Qr,TN({className:"recharts-bar-rectangle"},Mm(a.props,h,m),{key:"rectangle-".concat(h==null?void 0:h.x,"-").concat(h==null?void 0:h.y,"-").concat(h==null?void 0:h.value,"-").concat(m)}),oe.createElement(K7,A))})}},{key:"renderRectanglesWithAnimation",value:function(){var s=this,a=this.props,i=a.data,o=a.layout,l=a.isAnimationActive,c=a.animationBegin,d=a.animationDuration,u=a.animationEasing,h=a.animationId,m=this.state.prevData;return oe.createElement(Ml,{begin:c,duration:d,isActive:l,easing:u,from:{t:0},to:{t:1},key:"bar-".concat(h),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(f){var p=f.t,A=i.map(function(v,x){var b=m&&m[x];if(b){var y=ks(b.x,v.x),w=ks(b.y,v.y),j=ks(b.width,v.width),N=ks(b.height,v.height);return ha(ha({},v),{},{x:y(p),y:w(p),width:j(p),height:N(p)})}if(o==="horizontal"){var _=ks(0,v.height),S=_(p);return ha(ha({},v),{},{y:v.y+v.height-S,height:S})}var C=ks(0,v.width),E=C(p);return ha(ha({},v),{},{width:E})});return oe.createElement(Qr,null,s.renderRectanglesStatically(A))})}},{key:"renderRectangles",value:function(){var s=this.props,a=s.data,i=s.isAnimationActive,o=this.state.prevData;return i&&a&&a.length&&(!o||!Yh(o,a))?this.renderRectanglesWithAnimation():this.renderRectanglesStatically(a)}},{key:"renderBackground",value:function(){var s=this,a=this.props,i=a.data,o=a.dataKey,l=a.activeIndex,c=Dt(this.props.background,!1);return i.map(function(d,u){d.value;var h=d.background,m=sVe(d,nVe);if(!h)return null;var f=ha(ha(ha(ha(ha({},m),{},{fill:"#eee"},h),c),Mm(s.props,d,u)),{},{onAnimationStart:s.handleAnimationStart,onAnimationEnd:s.handleAnimationEnd,dataKey:o,index:u,className:"recharts-bar-background-rectangle"});return oe.createElement(K7,TN({key:"background-bar-".concat(u),option:s.props.background,isActive:u===l},f))})}},{key:"renderErrorBar",value:function(s,a){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var i=this.props,o=i.data,l=i.xAxis,c=i.yAxis,d=i.layout,u=i.children,h=el(u,Hy);if(!h)return null;var m=d==="vertical"?o[0].height/2:o[0].width/2,f=function(v,x){var b=Array.isArray(v.value)?v.value[1]:v.value;return{x:v.x,y:v.y,value:b,errorVal:Ps(v,x)}},p={clipPath:s?"url(#clipPath-".concat(a,")"):null};return oe.createElement(Qr,p,h.map(function(A){return oe.cloneElement(A,{key:"error-bar-".concat(a,"-").concat(A.props.dataKey),data:o,xAxis:l,yAxis:c,layout:d,offset:m,dataPointFormatter:f})}))}},{key:"render",value:function(){var s=this.props,a=s.hide,i=s.data,o=s.className,l=s.xAxis,c=s.yAxis,d=s.left,u=s.top,h=s.width,m=s.height,f=s.isAnimationActive,p=s.background,A=s.id;if(a||!i||!i.length)return null;var v=this.state.isAnimationFinished,x=fr("recharts-bar",o),b=l&&l.allowDataOverflow,y=c&&c.allowDataOverflow,w=b||y,j=wr(A)?this.id:A;return oe.createElement(Qr,{className:x},b||y?oe.createElement("defs",null,oe.createElement("clipPath",{id:"clipPath-".concat(j)},oe.createElement("rect",{x:b?d:d-h/2,y:y?u:u-m/2,width:b?h:h*2,height:y?m:m*2}))):null,oe.createElement(Qr,{className:"recharts-bar-rectangles",clipPath:w?"url(#clipPath-".concat(j,")"):null},p?this.renderBackground():null,this.renderRectangles()),this.renderErrorBar(w,j),(!f||v)&&wc.renderCallByParent(this.props,i))}}],[{key:"getDerivedStateFromProps",value:function(s,a){return s.animationId!==a.prevAnimationId?{prevAnimationId:s.animationId,curData:s.data,prevData:a.curData}:s.data!==a.curData?{curData:s.data}:null}}])}(g.PureComponent);Jee=vc;Sh(vc,"displayName","Bar");Sh(vc,"defaultProps",{xAxisId:0,yAxisId:0,legendType:"rect",minPointSize:0,hide:!1,data:[],layout:"vertical",activeBar:!1,isAnimationActive:!Uu.isSsr,animationBegin:0,animationDuration:400,animationEasing:"ease"});Sh(vc,"getComposedData",function(e){var t=e.props,r=e.item,s=e.barPosition,a=e.bandSize,i=e.xAxis,o=e.yAxis,l=e.xAxisTicks,c=e.yAxisTicks,d=e.stackedData,u=e.dataStartIndex,h=e.displayedData,m=e.offset,f=b8e(s,r);if(!f)return null;var p=t.layout,A=r.type.defaultProps,v=A!==void 0?ha(ha({},A),r.props):r.props,x=v.dataKey,b=v.children,y=v.minPointSize,w=p==="horizontal"?o:i,j=d?w.scale.domain():null,N=S8e({numericAxis:w}),_=el(b,yg),S=h.map(function(C,E){var T,B,L,P,F,M;d?T=y8e(d[u+E],j):(T=Ps(C,x),Array.isArray(T)||(T=[N,T]));var I=rVe(y,Jee.defaultProps.minPointSize)(T[1],E);if(p==="horizontal"){var $,V=[o.scale(T[0]),o.scale(T[1])],R=V[0],Q=V[1];B=U$({axis:i,ticks:l,bandSize:a,offset:f.offset,entry:C,index:E}),L=($=Q??R)!==null&&$!==void 0?$:void 0,P=f.size;var U=R-Q;if(F=Number.isNaN(U)?0:U,M={x:B,y:o.y,width:P,height:o.height},Math.abs(I)>0&&Math.abs(F)<Math.abs(I)){var D=Qi(F||I)*(Math.abs(I)-Math.abs(F));L-=D,F+=D}}else{var q=[i.scale(T[0]),i.scale(T[1])],G=q[0],Y=q[1];if(B=G,L=U$({axis:o,ticks:c,bandSize:a,offset:f.offset,entry:C,index:E}),P=Y-G,F=f.size,M={x:i.x,y:L,width:i.width,height:F},Math.abs(I)>0&&Math.abs(P)<Math.abs(I)){var K=Qi(P||I)*(Math.abs(I)-Math.abs(P));P+=K}}return ha(ha(ha({},C),{},{x:B,y:L,width:P,height:F,value:d?T:T[1],payload:C,background:M},_&&_[E]&&_[E].props),{},{tooltipPayload:[pee(r,C)],tooltipPosition:{x:B+P/2,y:L+F/2}})});return ha({data:S,layout:p},m)});function Yb(e){"@babel/helpers - typeof";return Yb=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Yb(e)}function fVe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function J7(e,t){for(var r=0;r<t.length;r++){var s=t[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,ete(s.key),s)}}function mVe(e,t,r){return t&&J7(e.prototype,t),r&&J7(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function X7(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,s)}return r}function fc(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?X7(Object(r),!0).forEach(function(s){iS(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):X7(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}function iS(e,t,r){return t=ete(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ete(e){var t=pVe(e,"string");return Yb(t)=="symbol"?t:t+""}function pVe(e,t){if(Yb(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(Yb(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var jF=function(t,r,s,a,i){var o=t.width,l=t.height,c=t.layout,d=t.children,u=Object.keys(r),h={left:s.left,leftMirror:s.left,right:o-s.right,rightMirror:o-s.right,top:s.top,topMirror:s.top,bottom:l-s.bottom,bottomMirror:l-s.bottom},m=!!Do(d,vc);return u.reduce(function(f,p){var A=r[p],v=A.orientation,x=A.domain,b=A.padding,y=b===void 0?{}:b,w=A.mirror,j=A.reversed,N="".concat(v).concat(w?"Mirror":""),_,S,C,E,T;if(A.type==="number"&&(A.padding==="gap"||A.padding==="no-gap")){var B=x[1]-x[0],L=1/0,P=A.categoricalDomain.sort(aEe);if(P.forEach(function(q,G){G>0&&(L=Math.min((q||0)-(P[G-1]||0),L))}),Number.isFinite(L)){var F=L/B,M=A.layout==="vertical"?s.height:s.width;if(A.padding==="gap"&&(_=F*M/2),A.padding==="no-gap"){var I=Hi(t.barCategoryGap,F*M),$=F*M/2;_=$-I-($-I)/M*I}}}a==="xAxis"?S=[s.left+(y.left||0)+(_||0),s.left+s.width-(y.right||0)-(_||0)]:a==="yAxis"?S=c==="horizontal"?[s.top+s.height-(y.bottom||0),s.top+(y.top||0)]:[s.top+(y.top||0)+(_||0),s.top+s.height-(y.bottom||0)-(_||0)]:S=A.range,j&&(S=[S[1],S[0]]);var V=uee(A,i,m),R=V.scale,Q=V.realScaleType;R.domain(x).range(S),hee(R);var U=fee(R,fc(fc({},A),{},{realScaleType:Q}));a==="xAxis"?(T=v==="top"&&!w||v==="bottom"&&w,C=s.left,E=h[N]-T*A.height):a==="yAxis"&&(T=v==="left"&&!w||v==="right"&&w,C=h[N]-T*A.width,E=s.top);var D=fc(fc(fc({},A),U),{},{realScaleType:Q,x:C,y:E,scale:R,width:a==="xAxis"?s.width:A.width,height:a==="yAxis"?s.height:A.height});return D.bandSize=fN(D,U),!A.hide&&a==="xAxis"?h[N]+=(T?-1:1)*D.height:A.hide||(h[N]+=(T?-1:1)*D.width),fc(fc({},f),{},iS({},p,D))},{})},tte=function(t,r){var s=t.x,a=t.y,i=r.x,o=r.y;return{x:Math.min(s,i),y:Math.min(a,o),width:Math.abs(i-s),height:Math.abs(o-a)}},AVe=function(t){var r=t.x1,s=t.y1,a=t.x2,i=t.y2;return tte({x:r,y:s},{x:a,y:i})},rte=function(){function e(t){fVe(this,e),this.scale=t}return mVe(e,[{key:"domain",get:function(){return this.scale.domain}},{key:"range",get:function(){return this.scale.range}},{key:"rangeMin",get:function(){return this.range()[0]}},{key:"rangeMax",get:function(){return this.range()[1]}},{key:"bandwidth",get:function(){return this.scale.bandwidth}},{key:"apply",value:function(r){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=s.bandAware,i=s.position;if(r!==void 0){if(i)switch(i){case"start":return this.scale(r);case"middle":{var o=this.bandwidth?this.bandwidth()/2:0;return this.scale(r)+o}case"end":{var l=this.bandwidth?this.bandwidth():0;return this.scale(r)+l}default:return this.scale(r)}if(a){var c=this.bandwidth?this.bandwidth()/2:0;return this.scale(r)+c}return this.scale(r)}}},{key:"isInRange",value:function(r){var s=this.range(),a=s[0],i=s[s.length-1];return a<=i?r>=a&&r<=i:r>=i&&r<=a}}],[{key:"create",value:function(r){return new e(r)}}])}();iS(rte,"EPS",1e-4);var NF=function(t){var r=Object.keys(t).reduce(function(s,a){return fc(fc({},s),{},iS({},a,rte.create(t[a])))},{});return fc(fc({},r),{},{apply:function(a){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=i.bandAware,l=i.position;return Lze(a,function(c,d){return r[d].apply(c,{bandAware:o,position:l})})},isInRange:function(a){return Yee(a,function(i,o){return r[o].isInRange(i)})}})};function gVe(e){return(e%180+180)%180}var xVe=function(t){var r=t.width,s=t.height,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,i=gVe(a),o=i*Math.PI/180,l=Math.atan(s/r),c=o>l&&o<Math.PI-l?s/Math.sin(o):r/Math.cos(o);return Math.abs(c)},vVe=_d,bVe=Ry,yVe=HC;function wVe(e){return function(t,r,s){var a=Object(t);if(!bVe(t)){var i=vVe(r);t=yVe(t),r=function(l){return i(a[l],l,a)}}var o=e(t,r,s);return o>-1?a[i?t[o]:o]:void 0}}
1259var jVe=wVe,NVe=Gee;function _Ve(e){var t=NVe(e),r=t%1;return t===t?r?t-r:t:0}var CVe=_Ve,SVe=GX,kVe=_d,EVe=CVe,BVe=Math.max;function TVe(e,t,r){var s=e==null?0:e.length;if(!s)return-1;var a=r==null?0:EVe(r);return a<0&&(a=BVe(s+a,0)),SVe(e,kVe(t),a)}var PVe=TVe,IVe=jVe,OVe=PVe,FVe=IVe(OVe),LVe=FVe;const DVe=wn(LVe);var RVe=l5e(function(e){return{x:e.left,y:e.top,width:e.width,height:e.height}},function(e){return["l",e.left,"t",e.top,"w",e.width,"h",e.height].join("")}),_F=g.createContext(void 0),CF=g.createContext(void 0),nte=g.createContext(void 0),ste=g.createContext({}),ate=g.createContext(void 0),ite=g.createContext(0),ote=g.createContext(0),Z7=function(t){var r=t.state,s=r.xAxisMap,a=r.yAxisMap,i=r.offset,o=t.clipPathId,l=t.children,c=t.width,d=t.height,u=RVe(i);return oe.createElement(_F.Provider,{value:s},oe.createElement(CF.Provider,{value:a},oe.createElement(ste.Provider,{value:i},oe.createElement(nte.Provider,{value:u},oe.createElement(ate.Provider,{value:o},oe.createElement(ite.Provider,{value:d},oe.createElement(ote.Provider,{value:c},l)))))))},UVe=function(){return g.useContext(ate)},lte=function(t){var r=g.useContext(_F);r==null&&Hm();var s=r[t];return s==null&&Hm(),s},MVe=function(){var t=g.useContext(_F);return wh(t)},$Ve=function(){var t=g.useContext(CF),r=DVe(t,function(s){return Yee(s.domain,Number.isFinite)});return r||wh(t)},cte=function(t){var r=g.useContext(CF);r==null&&Hm();var s=r[t];return s==null&&Hm(),s},QVe=function(){var t=g.useContext(nte);return t},HVe=function(){return g.useContext(ste)},SF=function(){return g.useContext(ote)},kF=function(){return g.useContext(ite)};function Og(e){"@babel/helpers - typeof";return Og=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Og(e)}function zVe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function VVe(e,t){for(var r=0;r<t.length;r++){var s=t[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,ute(s.key),s)}}function GVe(e,t,r){return t&&VVe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function qVe(e,t,r){return t=IN(t),KVe(e,dte()?Reflect.construct(t,r||[],IN(e).constructor):t.apply(e,r))}function KVe(e,t){if(t&&(Og(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return WVe(e)}function WVe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function dte(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(dte=function(){return!!e})()}function IN(e){return IN=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},IN(e)}function YVe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&m3(e,t)}function m3(e,t){return m3=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,a){return s.__proto__=a,s},m3(e,t)}function eQ(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,s)}return r}function tQ(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?eQ(Object(r),!0).forEach(function(s){EF(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):eQ(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}function EF(e,t,r){return t=ute(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ute(e){var t=JVe(e,"string");return Og(t)=="symbol"?t:t+""}function JVe(e,t){if(Og(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(Og(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function XVe(e,t){return rGe(e)||tGe(e,t)||eGe(e,t)||ZVe()}
vendor: 102,387 bytes, lines 1259-1264
1259function ZVe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1260In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function eGe(e,t){if(e){if(typeof e=="string")return rQ(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return rQ(e,t)}}function rQ(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,s=new Array(t);r<t;r++)s[r]=e[r];return s}function tGe(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var s,a,i,o,l=[],c=!0,d=!1;try{if(i=(r=r.call(e)).next,t!==0)for(;!(c=(s=i.call(r)).done)&&(l.push(s.value),l.length!==t);c=!0);}catch(u){d=!0,a=u}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(d)throw a}}return l}}function rGe(e){if(Array.isArray(e))return e}function p3(){return p3=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},p3.apply(this,arguments)}var nGe=function(t,r){var s;return oe.isValidElement(t)?s=oe.cloneElement(t,r):er(t)?s=t(r):s=oe.createElement("line",p3({},r,{className:"recharts-reference-line-line"})),s},sGe=function(t,r,s,a,i,o,l,c,d){var u=i.x,h=i.y,m=i.width,f=i.height;if(s){var p=d.y,A=t.y.apply(p,{position:o});if(hd(d,"discard")&&!t.y.isInRange(A))return null;var v=[{x:u+m,y:A},{x:u,y:A}];return c==="left"?v.reverse():v}if(r){var x=d.x,b=t.x.apply(x,{position:o});if(hd(d,"discard")&&!t.x.isInRange(b))return null;var y=[{x:b,y:h+f},{x:b,y:h}];return l==="top"?y.reverse():y}if(a){var w=d.segment,j=w.map(function(N){return t.apply(N,{position:o})});return hd(d,"discard")&&kze(j,function(N){return!t.isInRange(N)})?null:j}return null};function aGe(e){var t=e.x,r=e.y,s=e.segment,a=e.xAxisId,i=e.yAxisId,o=e.shape,l=e.className,c=e.alwaysShow,d=UVe(),u=lte(a),h=cte(i),m=QVe();if(!d||!m)return null;yc(c===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');var f=NF({x:u.scale,y:h.scale}),p=Da(t),A=Da(r),v=s&&s.length===2,x=sGe(f,p,A,v,m,e.position,u.orientation,h.orientation,e);if(!x)return null;var b=XVe(x,2),y=b[0],w=y.x,j=y.y,N=b[1],_=N.x,S=N.y,C=hd(e,"hidden")?"url(#".concat(d,")"):void 0,E=tQ(tQ({clipPath:C},Dt(e,!0)),{},{x1:w,y1:j,x2:_,y2:S});return oe.createElement(Qr,{className:fr("recharts-reference-line",l)},nGe(o,E),qa.renderCallByParent(e,AVe({x1:w,y1:j,x2:_,y2:S})))}var BF=function(e){function t(){return zVe(this,t),qVe(this,t,arguments)}return YVe(t,e),GVe(t,[{key:"render",value:function(){return oe.createElement(aGe,this.props)}}])}(oe.Component);EF(BF,"displayName","ReferenceLine");EF(BF,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,fill:"none",stroke:"#ccc",fillOpacity:1,strokeWidth:1,position:"middle"});function A3(){return A3=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},A3.apply(this,arguments)}function Fg(e){"@babel/helpers - typeof";return Fg=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Fg(e)}function nQ(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,s)}return r}function sQ(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?nQ(Object(r),!0).forEach(function(s){oS(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):nQ(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}function iGe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function oGe(e,t){for(var r=0;r<t.length;r++){var s=t[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,fte(s.key),s)}}function lGe(e,t,r){return t&&oGe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function cGe(e,t,r){return t=ON(t),dGe(e,hte()?Reflect.construct(t,r||[],ON(e).constructor):t.apply(e,r))}function dGe(e,t){if(t&&(Fg(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return uGe(e)}function uGe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function hte(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(hte=function(){return!!e})()}function ON(e){return ON=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},ON(e)}function hGe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&g3(e,t)}function g3(e,t){return g3=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,a){return s.__proto__=a,s},g3(e,t)}function oS(e,t,r){return t=fte(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function fte(e){var t=fGe(e,"string");return Fg(t)=="symbol"?t:t+""}function fGe(e,t){if(Fg(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(Fg(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var mGe=function(t){var r=t.x,s=t.y,a=t.xAxis,i=t.yAxis,o=NF({x:a.scale,y:i.scale}),l=o.apply({x:r,y:s},{bandAware:!0});return hd(t,"discard")&&!o.isInRange(l)?null:l},lS=function(e){function t(){return iGe(this,t),cGe(this,t,arguments)}return hGe(t,e),lGe(t,[{key:"render",value:function(){var s=this.props,a=s.x,i=s.y,o=s.r,l=s.alwaysShow,c=s.clipPathId,d=Da(a),u=Da(i);if(yc(l===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.'),!d||!u)return null;var h=mGe(this.props);if(!h)return null;var m=h.x,f=h.y,p=this.props,A=p.shape,v=p.className,x=hd(this.props,"hidden")?"url(#".concat(c,")"):void 0,b=sQ(sQ({clipPath:x},Dt(this.props,!0)),{},{cx:m,cy:f});return oe.createElement(Qr,{className:fr("recharts-reference-dot",v)},t.renderDot(A,b),qa.renderCallByParent(this.props,{x:m-o,y:f-o,width:2*o,height:2*o}))}}])}(oe.Component);oS(lS,"displayName","ReferenceDot");oS(lS,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,r:10,fill:"#fff",stroke:"#ccc",fillOpacity:1,strokeWidth:1});oS(lS,"renderDot",function(e,t){var r;return oe.isValidElement(e)?r=oe.cloneElement(e,t):er(e)?r=e(t):r=oe.createElement(y0,A3({},t,{cx:t.cx,cy:t.cy,className:"recharts-reference-dot-dot"})),r});function x3(){return x3=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},x3.apply(this,arguments)}function Lg(e){"@babel/helpers - typeof";return Lg=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Lg(e)}function aQ(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,s)}return r}function iQ(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?aQ(Object(r),!0).forEach(function(s){cS(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):aQ(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}function pGe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function AGe(e,t){for(var r=0;r<t.length;r++){var s=t[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,pte(s.key),s)}}function gGe(e,t,r){return t&&AGe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function xGe(e,t,r){return t=FN(t),vGe(e,mte()?Reflect.construct(t,r||[],FN(e).constructor):t.apply(e,r))}function vGe(e,t){if(t&&(Lg(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return bGe(e)}function bGe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function mte(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(mte=function(){return!!e})()}function FN(e){return FN=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},FN(e)}function yGe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&v3(e,t)}function v3(e,t){return v3=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,a){return s.__proto__=a,s},v3(e,t)}function cS(e,t,r){return t=pte(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function pte(e){var t=wGe(e,"string");return Lg(t)=="symbol"?t:t+""}function wGe(e,t){if(Lg(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(Lg(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var jGe=function(t,r,s,a,i){var o=i.x1,l=i.x2,c=i.y1,d=i.y2,u=i.xAxis,h=i.yAxis;if(!u||!h)return null;var m=NF({x:u.scale,y:h.scale}),f={x:t?m.x.apply(o,{position:"start"}):m.x.rangeMin,y:s?m.y.apply(c,{position:"start"}):m.y.rangeMin},p={x:r?m.x.apply(l,{position:"end"}):m.x.rangeMax,y:a?m.y.apply(d,{position:"end"}):m.y.rangeMax};return hd(i,"discard")&&(!m.isInRange(f)||!m.isInRange(p))?null:tte(f,p)},dS=function(e){function t(){return pGe(this,t),xGe(this,t,arguments)}return yGe(t,e),gGe(t,[{key:"render",value:function(){var s=this.props,a=s.x1,i=s.x2,o=s.y1,l=s.y2,c=s.className,d=s.alwaysShow,u=s.clipPathId;yc(d===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');var h=Da(a),m=Da(i),f=Da(o),p=Da(l),A=this.props.shape;if(!h&&!m&&!f&&!p&&!A)return null;var v=jGe(h,m,f,p,this.props);if(!v&&!A)return null;var x=hd(this.props,"hidden")?"url(#".concat(u,")"):void 0;return oe.createElement(Qr,{className:fr("recharts-reference-area",c)},t.renderRect(A,iQ(iQ({clipPath:x},Dt(this.props,!0)),v)),qa.renderCallByParent(this.props,v))}}])}(oe.Component);cS(dS,"displayName","ReferenceArea");cS(dS,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,r:10,fill:"#ccc",fillOpacity:.5,stroke:"none",strokeWidth:1});cS(dS,"renderRect",function(e,t){var r;return oe.isValidElement(e)?r=oe.cloneElement(e,t):er(e)?r=e(t):r=oe.createElement(wF,x3({},t,{className:"recharts-reference-area-rect"})),r});function Ate(e,t,r){if(t<1)return[];if(t===1&&r===void 0)return e;for(var s=[],a=0;a<e.length;a+=t)s.push(e[a]);return s}function NGe(e,t,r){var s={width:e.width+t.width,height:e.height+t.height};return xVe(s,r)}function _Ge(e,t,r){var s=r==="width",a=e.x,i=e.y,o=e.width,l=e.height;return t===1?{start:s?a:i,end:s?a+o:i+l}:{start:s?a+o:i+l,end:s?a:i}}function LN(e,t,r,s,a){if(e*t<e*s||e*t>e*a)return!1;var i=r();return e*(t-e*i/2-s)>=0&&e*(t+e*i/2-a)<=0}function CGe(e,t){return Ate(e,t+1)}function SGe(e,t,r,s,a){for(var i=(s||[]).slice(),o=t.start,l=t.end,c=0,d=1,u=o,h=function(){var p=s==null?void 0:s[c];if(p===void 0)return{v:Ate(s,d)};var A=c,v,x=function(){return v===void 0&&(v=r(p,A)),v},b=p.coordinate,y=c===0||LN(e,b,x,u,l);y||(c=0,u=o,d+=1),y&&(u=b+e*(x()/2+a),c+=d)},m;d<=i.length;)if(m=h(),m)return m.v;return[]}function Jb(e){"@babel/helpers - typeof";return Jb=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Jb(e)}function oQ(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,s)}return r}function Ni(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?oQ(Object(r),!0).forEach(function(s){kGe(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):oQ(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}function kGe(e,t,r){return t=EGe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function EGe(e){var t=BGe(e,"string");return Jb(t)=="symbol"?t:t+""}function BGe(e,t){if(Jb(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(Jb(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function TGe(e,t,r,s,a){for(var i=(s||[]).slice(),o=i.length,l=t.start,c=t.end,d=function(m){var f=i[m],p,A=function(){return p===void 0&&(p=r(f,m)),p};if(m===o-1){var v=e*(f.coordinate+e*A()/2-c);i[m]=f=Ni(Ni({},f),{},{tickCoord:v>0?f.coordinate-v*e:f.coordinate})}else i[m]=f=Ni(Ni({},f),{},{tickCoord:f.coordinate});var x=LN(e,f.tickCoord,A,l,c);x&&(c=f.tickCoord-e*(A()/2+a),i[m]=Ni(Ni({},f),{},{isShow:!0}))},u=o-1;u>=0;u--)d(u);return i}function PGe(e,t,r,s,a,i){var o=(s||[]).slice(),l=o.length,c=t.start,d=t.end;if(i){var u=s[l-1],h=r(u,l-1),m=e*(u.coordinate+e*h/2-d);o[l-1]=u=Ni(Ni({},u),{},{tickCoord:m>0?u.coordinate-m*e:u.coordinate});var f=LN(e,u.tickCoord,function(){return h},c,d);f&&(d=u.tickCoord-e*(h/2+a),o[l-1]=Ni(Ni({},u),{},{isShow:!0}))}for(var p=i?l-1:l,A=function(b){var y=o[b],w,j=function(){return w===void 0&&(w=r(y,b)),w};if(b===0){var N=e*(y.coordinate-e*j()/2-c);o[b]=y=Ni(Ni({},y),{},{tickCoord:N<0?y.coordinate-N*e:y.coordinate})}else o[b]=y=Ni(Ni({},y),{},{tickCoord:y.coordinate});var _=LN(e,y.tickCoord,j,c,d);_&&(c=y.tickCoord+e*(j()/2+a),o[b]=Ni(Ni({},y),{},{isShow:!0}))},v=0;v<p;v++)A(v);return o}function TF(e,t,r){var s=e.tick,a=e.ticks,i=e.viewBox,o=e.minTickGap,l=e.orientation,c=e.interval,d=e.tickFormatter,u=e.unit,h=e.angle;if(!a||!a.length||!s)return[];if(lt(c)||Uu.isSsr)return CGe(a,typeof c=="number"&&lt(c)?c:0);var m=[],f=l==="top"||l==="bottom"?"width":"height",p=u&&f==="width"?Av(u,{fontSize:t,letterSpacing:r}):{width:0,height:0},A=function(y,w){var j=er(d)?d(y.value,w):y.value;return f==="width"?NGe(Av(j,{fontSize:t,letterSpacing:r}),p,h):Av(j,{fontSize:t,letterSpacing:r})[f]},v=a.length>=2?Qi(a[1].coordinate-a[0].coordinate):1,x=_Ge(i,v,f);return c==="equidistantPreserveStart"?SGe(v,x,A,a,o):(c==="preserveStart"||c==="preserveStartEnd"?m=PGe(v,x,A,a,o,c==="preserveStartEnd"):m=TGe(v,x,A,a,o),m.filter(function(b){return b.isShow}))}var IGe=["viewBox"],OGe=["viewBox"],FGe=["ticks"];function Dg(e){"@babel/helpers - typeof";return Dg=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Dg(e)}function wA(){return wA=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},wA.apply(this,arguments)}function lQ(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,s)}return r}function Ea(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?lQ(Object(r),!0).forEach(function(s){PF(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):lQ(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}function lE(e,t){if(e==null)return{};var r=LGe(e,t),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)s=i[a],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(r[s]=e[s])}return r}function LGe(e,t){if(e==null)return{};var r={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;r[s]=e[s]}return r}function DGe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function cQ(e,t){for(var r=0;r<t.length;r++){var s=t[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,xte(s.key),s)}}function RGe(e,t,r){return t&&cQ(e.prototype,t),r&&cQ(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function UGe(e,t,r){return t=DN(t),MGe(e,gte()?Reflect.construct(t,r||[],DN(e).constructor):t.apply(e,r))}function MGe(e,t){if(t&&(Dg(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return $Ge(e)}function $Ge(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function gte(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(gte=function(){return!!e})()}function DN(e){return DN=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},DN(e)}function QGe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&b3(e,t)}function b3(e,t){return b3=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,a){return s.__proto__=a,s},b3(e,t)}function PF(e,t,r){return t=xte(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function xte(e){var t=HGe(e,"string");return Dg(t)=="symbol"?t:t+""}function HGe(e,t){if(Dg(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(Dg(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var N0=function(e){function t(r){var s;return DGe(this,t),s=UGe(this,t,[r]),s.state={fontSize:"",letterSpacing:""},s}return QGe(t,e),RGe(t,[{key:"shouldComponentUpdate",value:function(s,a){var i=s.viewBox,o=lE(s,IGe),l=this.props,c=l.viewBox,d=lE(l,OGe);return!OA(i,c)||!OA(o,d)||!OA(a,this.state)}},{key:"componentDidMount",value:function(){var s=this.layerReference;if(s){var a=s.getElementsByClassName("recharts-cartesian-axis-tick-value")[0];a&&this.setState({fontSize:window.getComputedStyle(a).fontSize,letterSpacing:window.getComputedStyle(a).letterSpacing})}}},{key:"getTickLineCoord",value:function(s){var a=this.props,i=a.x,o=a.y,l=a.width,c=a.height,d=a.orientation,u=a.tickSize,h=a.mirror,m=a.tickMargin,f,p,A,v,x,b,y=h?-1:1,w=s.tickSize||u,j=lt(s.tickCoord)?s.tickCoord:s.coordinate;switch(d){case"top":f=p=s.coordinate,v=o+ +!h*c,A=v-y*w,b=A-y*m,x=j;break;case"left":A=v=s.coordinate,p=i+ +!h*l,f=p-y*w,x=f-y*m,b=j;break;case"right":A=v=s.coordinate,p=i+ +h*l,f=p+y*w,x=f+y*m,b=j;break;default:f=p=s.coordinate,v=o+ +h*c,A=v+y*w,b=A+y*m,x=j;break}return{line:{x1:f,y1:A,x2:p,y2:v},tick:{x,y:b}}}},{key:"getTickTextAnchor",value:function(){var s=this.props,a=s.orientation,i=s.mirror,o;switch(a){case"left":o=i?"start":"end";break;case"right":o=i?"end":"start";break;default:o="middle";break}return o}},{key:"getTickVerticalAnchor",value:function(){var s=this.props,a=s.orientation,i=s.mirror,o="end";switch(a){case"left":case"right":o="middle";break;case"top":o=i?"start":"end";break;default:o=i?"end":"start";break}return o}},{key:"renderAxisLine",value:function(){var s=this.props,a=s.x,i=s.y,o=s.width,l=s.height,c=s.orientation,d=s.mirror,u=s.axisLine,h=Ea(Ea(Ea({},Dt(this.props,!1)),Dt(u,!1)),{},{fill:"none"});if(c==="top"||c==="bottom"){var m=+(c==="top"&&!d||c==="bottom"&&d);h=Ea(Ea({},h),{},{x1:a,y1:i+m*l,x2:a+o,y2:i+m*l})}else{var f=+(c==="left"&&!d||c==="right"&&d);h=Ea(Ea({},h),{},{x1:a+f*o,y1:i,x2:a+f*o,y2:i+l})}return oe.createElement("line",wA({},h,{className:fr("recharts-cartesian-axis-line",Zo(u,"className"))}))}},{key:"renderTicks",value:function(s,a,i){var o=this,l=this.props,c=l.tickLine,d=l.stroke,u=l.tick,h=l.tickFormatter,m=l.unit,f=TF(Ea(Ea({},this.props),{},{ticks:s}),a,i),p=this.getTickTextAnchor(),A=this.getTickVerticalAnchor(),v=Dt(this.props,!1),x=Dt(u,!1),b=Ea(Ea({},v),{},{fill:"none"},Dt(c,!1)),y=f.map(function(w,j){var N=o.getTickLineCoord(w),_=N.line,S=N.tick,C=Ea(Ea(Ea(Ea({textAnchor:p,verticalAnchor:A},v),{},{stroke:"none",fill:d},x),S),{},{index:j,payload:w,visibleTicksCount:f.length,tickFormatter:h});return oe.createElement(Qr,wA({className:"recharts-cartesian-axis-tick",key:"tick-".concat(w.value,"-").concat(w.coordinate,"-").concat(w.tickCoord)},Mm(o.props,w,j)),c&&oe.createElement("line",wA({},b,_,{className:fr("recharts-cartesian-axis-tick-line",Zo(c,"className"))})),u&&t.renderTickItem(u,C,"".concat(er(h)?h(w.value,j):w.value).concat(m||"")))});return oe.createElement("g",{className:"recharts-cartesian-axis-ticks"},y)}},{key:"render",value:function(){var s=this,a=this.props,i=a.axisLine,o=a.width,l=a.height,c=a.ticksGenerator,d=a.className,u=a.hide;if(u)return null;var h=this.props,m=h.ticks,f=lE(h,FGe),p=m;return er(c)&&(p=m&&m.length>0?c(this.props):c(f)),o<=0||l<=0||!p||!p.length?null:oe.createElement(Qr,{className:fr("recharts-cartesian-axis",d),ref:function(v){s.layerReference=v}},i&&this.renderAxisLine(),this.renderTicks(p,this.state.fontSize,this.state.letterSpacing),qa.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(s,a,i){var o,l=fr(a.className,"recharts-cartesian-axis-tick-value");return oe.isValidElement(s)?o=oe.cloneElement(s,Ea(Ea({},a),{},{className:l})):er(s)?o=s(Ea(Ea({},a),{},{className:l})):o=oe.createElement($m,wA({},a,{className:"recharts-cartesian-axis-tick-value"}),i),o}}])}(g.Component);PF(N0,"displayName","CartesianAxis");PF(N0,"defaultProps",{x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd"});var zGe=["x1","y1","x2","y2","key"],VGe=["offset"];function zm(e){"@babel/helpers - typeof";return zm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},zm(e)}function dQ(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,s)}return r}function Si(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?dQ(Object(r),!0).forEach(function(s){GGe(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):dQ(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}function GGe(e,t,r){return t=qGe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function qGe(e){var t=KGe(e,"string");return zm(t)=="symbol"?t:t+""}function KGe(e,t){if(zm(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(zm(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function mm(){return mm=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},mm.apply(this,arguments)}function uQ(e,t){if(e==null)return{};var r=WGe(e,t),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)s=i[a],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(r[s]=e[s])}return r}function WGe(e,t){if(e==null)return{};var r={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;r[s]=e[s]}return r}var YGe=function(t){var r=t.fill;if(!r||r==="none")return null;var s=t.fillOpacity,a=t.x,i=t.y,o=t.width,l=t.height,c=t.ry;return oe.createElement("rect",{x:a,y:i,ry:c,width:o,height:l,stroke:"none",fill:r,fillOpacity:s,className:"recharts-cartesian-grid-bg"})};function vte(e,t){var r;if(oe.isValidElement(e))r=oe.cloneElement(e,t);else if(er(e))r=e(t);else{var s=t.x1,a=t.y1,i=t.x2,o=t.y2,l=t.key,c=uQ(t,zGe),d=Dt(c,!1);d.offset;var u=uQ(d,VGe);r=oe.createElement("line",mm({},u,{x1:s,y1:a,x2:i,y2:o,fill:"none",key:l}))}return r}function JGe(e){var t=e.x,r=e.width,s=e.horizontal,a=s===void 0?!0:s,i=e.horizontalPoints;if(!a||!i||!i.length)return null;var o=i.map(function(l,c){var d=Si(Si({},e),{},{x1:t,y1:l,x2:t+r,y2:l,key:"line-".concat(c),index:c});return vte(a,d)});return oe.createElement("g",{className:"recharts-cartesian-grid-horizontal"},o)}function XGe(e){var t=e.y,r=e.height,s=e.vertical,a=s===void 0?!0:s,i=e.verticalPoints;if(!a||!i||!i.length)return null;var o=i.map(function(l,c){var d=Si(Si({},e),{},{x1:l,y1:t,x2:l,y2:t+r,key:"line-".concat(c),index:c});return vte(a,d)});return oe.createElement("g",{className:"recharts-cartesian-grid-vertical"},o)}function ZGe(e){var t=e.horizontalFill,r=e.fillOpacity,s=e.x,a=e.y,i=e.width,o=e.height,l=e.horizontalPoints,c=e.horizontal,d=c===void 0?!0:c;if(!d||!t||!t.length)return null;var u=l.map(function(m){return Math.round(m+a-a)}).sort(function(m,f){return m-f});a!==u[0]&&u.unshift(0);var h=u.map(function(m,f){var p=!u[f+1],A=p?a+o-m:u[f+1]-m;if(A<=0)return null;var v=f%t.length;return oe.createElement("rect",{key:"react-".concat(f),y:m,x:s,height:A,width:i,stroke:"none",fill:t[v],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return oe.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},h)}function eqe(e){var t=e.vertical,r=t===void 0?!0:t,s=e.verticalFill,a=e.fillOpacity,i=e.x,o=e.y,l=e.width,c=e.height,d=e.verticalPoints;if(!r||!s||!s.length)return null;var u=d.map(function(m){return Math.round(m+i-i)}).sort(function(m,f){return m-f});i!==u[0]&&u.unshift(0);var h=u.map(function(m,f){var p=!u[f+1],A=p?i+l-m:u[f+1]-m;if(A<=0)return null;var v=f%s.length;return oe.createElement("rect",{key:"react-".concat(f),x:m,y:o,width:A,height:c,stroke:"none",fill:s[v],fillOpacity:a,className:"recharts-cartesian-grid-bg"})});return oe.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},h)}var tqe=function(t,r){var s=t.xAxis,a=t.width,i=t.height,o=t.offset;return dee(TF(Si(Si(Si({},N0.defaultProps),s),{},{ticks:uu(s,!0),viewBox:{x:0,y:0,width:a,height:i}})),o.left,o.left+o.width,r)},rqe=function(t,r){var s=t.yAxis,a=t.width,i=t.height,o=t.offset;return dee(TF(Si(Si(Si({},N0.defaultProps),s),{},{ticks:uu(s,!0),viewBox:{x:0,y:0,width:a,height:i}})),o.top,o.top+o.height,r)},Ip={horizontal:!0,vertical:!0,stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function au(e){var t,r,s,a,i,o,l=SF(),c=kF(),d=HVe(),u=Si(Si({},e),{},{stroke:(t=e.stroke)!==null&&t!==void 0?t:Ip.stroke,fill:(r=e.fill)!==null&&r!==void 0?r:Ip.fill,horizontal:(s=e.horizontal)!==null&&s!==void 0?s:Ip.horizontal,horizontalFill:(a=e.horizontalFill)!==null&&a!==void 0?a:Ip.horizontalFill,vertical:(i=e.vertical)!==null&&i!==void 0?i:Ip.vertical,verticalFill:(o=e.verticalFill)!==null&&o!==void 0?o:Ip.verticalFill,x:lt(e.x)?e.x:d.left,y:lt(e.y)?e.y:d.top,width:lt(e.width)?e.width:d.width,height:lt(e.height)?e.height:d.height}),h=u.x,m=u.y,f=u.width,p=u.height,A=u.syncWithTicks,v=u.horizontalValues,x=u.verticalValues,b=MVe(),y=$Ve();if(!lt(f)||f<=0||!lt(p)||p<=0||!lt(h)||h!==+h||!lt(m)||m!==+m)return null;var w=u.verticalCoordinatesGenerator||tqe,j=u.horizontalCoordinatesGenerator||rqe,N=u.horizontalPoints,_=u.verticalPoints;if((!N||!N.length)&&er(j)){var S=v&&v.length,C=j({yAxis:y?Si(Si({},y),{},{ticks:S?v:y.ticks}):void 0,width:l,height:c,offset:d},S?!0:A);yc(Array.isArray(C),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(zm(C),"]")),Array.isArray(C)&&(N=C)}if((!_||!_.length)&&er(w)){var E=x&&x.length,T=w({xAxis:b?Si(Si({},b),{},{ticks:E?x:b.ticks}):void 0,width:l,height:c,offset:d},E?!0:A);yc(Array.isArray(T),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(zm(T),"]")),Array.isArray(T)&&(_=T)}return oe.createElement("g",{className:"recharts-cartesian-grid"},oe.createElement(YGe,{fill:u.fill,fillOpacity:u.fillOpacity,x:u.x,y:u.y,width:u.width,height:u.height,ry:u.ry}),oe.createElement(JGe,mm({},u,{offset:d,horizontalPoints:N,xAxis:b,yAxis:y})),oe.createElement(XGe,mm({},u,{offset:d,verticalPoints:_,xAxis:b,yAxis:y})),oe.createElement(ZGe,mm({},u,{horizontalPoints:N})),oe.createElement(eqe,mm({},u,{verticalPoints:_})))}au.displayName="CartesianGrid";var nqe=["type","layout","connectNulls","ref"],sqe=["key"];function Rg(e){"@babel/helpers - typeof";return Rg=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Rg(e)}function hQ(e,t){if(e==null)return{};var r=aqe(e,t),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)s=i[a],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(r[s]=e[s])}return r}function aqe(e,t){if(e==null)return{};var r={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;r[s]=e[s]}return r}function wv(){return wv=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},wv.apply(this,arguments)}function fQ(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,s)}return r}function Io(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?fQ(Object(r),!0).forEach(function(s){mc(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):fQ(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}function Op(e){return cqe(e)||lqe(e)||oqe(e)||iqe()}function iqe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
1261In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function oqe(e,t){if(e){if(typeof e=="string")return y3(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return y3(e,t)}}function lqe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function cqe(e){if(Array.isArray(e))return y3(e)}function y3(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,s=new Array(t);r<t;r++)s[r]=e[r];return s}function dqe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function mQ(e,t){for(var r=0;r<t.length;r++){var s=t[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,yte(s.key),s)}}function uqe(e,t,r){return t&&mQ(e.prototype,t),r&&mQ(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function hqe(e,t,r){return t=RN(t),fqe(e,bte()?Reflect.construct(t,r||[],RN(e).constructor):t.apply(e,r))}function fqe(e,t){if(t&&(Rg(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return mqe(e)}function mqe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function bte(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(bte=function(){return!!e})()}function RN(e){return RN=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},RN(e)}function pqe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&w3(e,t)}function w3(e,t){return w3=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,a){return s.__proto__=a,s},w3(e,t)}function mc(e,t,r){return t=yte(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function yte(e){var t=Aqe(e,"string");return Rg(t)=="symbol"?t:t+""}function Aqe(e,t){if(Rg(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(Rg(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Vm=function(e){function t(){var r;dqe(this,t);for(var s=arguments.length,a=new Array(s),i=0;i<s;i++)a[i]=arguments[i];return r=hqe(this,t,[].concat(a)),mc(r,"state",{isAnimationFinished:!0,totalLength:0}),mc(r,"generateSimpleStrokeDasharray",function(o,l){return"".concat(l,"px ").concat(o-l,"px")}),mc(r,"getStrokeDasharray",function(o,l,c){var d=c.reduce(function(x,b){return x+b});if(!d)return r.generateSimpleStrokeDasharray(l,o);for(var u=Math.floor(o/d),h=o%d,m=l-o,f=[],p=0,A=0;p<c.length;A+=c[p],++p)if(A+c[p]>h){f=[].concat(Op(c.slice(0,p)),[h-A]);break}var v=f.length%2===0?[0,m]:[m];return[].concat(Op(t.repeat(c,u)),Op(f),v).map(function(x){return"".concat(x,"px")}).join(", ")}),mc(r,"id",sp("recharts-line-")),mc(r,"pathRef",function(o){r.mainCurve=o}),mc(r,"handleAnimationEnd",function(){r.setState({isAnimationFinished:!0}),r.props.onAnimationEnd&&r.props.onAnimationEnd()}),mc(r,"handleAnimationStart",function(){r.setState({isAnimationFinished:!1}),r.props.onAnimationStart&&r.props.onAnimationStart()}),r}return pqe(t,e),uqe(t,[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var s=this.getTotalLength();this.setState({totalLength:s})}}},{key:"componentDidUpdate",value:function(){if(this.props.isAnimationActive){var s=this.getTotalLength();s!==this.state.totalLength&&this.setState({totalLength:s})}}},{key:"getTotalLength",value:function(){var s=this.mainCurve;try{return s&&s.getTotalLength&&s.getTotalLength()||0}catch{return 0}}},{key:"renderErrorBar",value:function(s,a){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var i=this.props,o=i.points,l=i.xAxis,c=i.yAxis,d=i.layout,u=i.children,h=el(u,Hy);if(!h)return null;var m=function(A,v){return{x:A.x,y:A.y,value:A.value,errorVal:Ps(A.payload,v)}},f={clipPath:s?"url(#clipPath-".concat(a,")"):null};return oe.createElement(Qr,f,h.map(function(p){return oe.cloneElement(p,{key:"bar-".concat(p.props.dataKey),data:o,xAxis:l,yAxis:c,layout:d,dataPointFormatter:m})}))}},{key:"renderDots",value:function(s,a,i){var o=this.props.isAnimationActive;if(o&&!this.state.isAnimationFinished)return null;var l=this.props,c=l.dot,d=l.points,u=l.dataKey,h=Dt(this.props,!1),m=Dt(c,!0),f=d.map(function(A,v){var x=Io(Io(Io({key:"dot-".concat(v),r:3},h),m),{},{index:v,cx:A.x,cy:A.y,value:A.value,dataKey:u,payload:A.payload,points:d});return t.renderDotItem(c,x)}),p={clipPath:s?"url(#clipPath-".concat(a?"":"dots-").concat(i,")"):null};return oe.createElement(Qr,wv({className:"recharts-line-dots",key:"dots"},p),f)}},{key:"renderCurveStatically",value:function(s,a,i,o){var l=this.props,c=l.type,d=l.layout,u=l.connectNulls;l.ref;var h=hQ(l,nqe),m=Io(Io(Io({},Dt(h,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:a?"url(#clipPath-".concat(i,")"):null,points:s},o),{},{type:c,layout:d,connectNulls:u});return oe.createElement(jm,wv({},m,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(s,a){var i=this,o=this.props,l=o.points,c=o.strokeDasharray,d=o.isAnimationActive,u=o.animationBegin,h=o.animationDuration,m=o.animationEasing,f=o.animationId,p=o.animateNewValues,A=o.width,v=o.height,x=this.state,b=x.prevPoints,y=x.totalLength;return oe.createElement(Ml,{begin:u,duration:h,isActive:d,easing:m,from:{t:0},to:{t:1},key:"line-".concat(f),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(w){var j=w.t;if(b){var N=b.length/l.length,_=l.map(function(B,L){var P=Math.floor(L*N);if(b[P]){var F=b[P],M=ks(F.x,B.x),I=ks(F.y,B.y);return Io(Io({},B),{},{x:M(j),y:I(j)})}if(p){var $=ks(A*2,B.x),V=ks(v/2,B.y);return Io(Io({},B),{},{x:$(j),y:V(j)})}return Io(Io({},B),{},{x:B.x,y:B.y})});return i.renderCurveStatically(_,s,a)}var S=ks(0,y),C=S(j),E;if(c){var T="".concat(c).split(/[,\s]+/gim).map(function(B){return parseFloat(B)});E=i.getStrokeDasharray(C,y,T)}else E=i.generateSimpleStrokeDasharray(y,C);return i.renderCurveStatically(l,s,a,{strokeDasharray:E})})}},{key:"renderCurve",value:function(s,a){var i=this.props,o=i.points,l=i.isAnimationActive,c=this.state,d=c.prevPoints,u=c.totalLength;return l&&o&&o.length&&(!d&&u>0||!Yh(d,o))?this.renderCurveWithAnimation(s,a):this.renderCurveStatically(o,s,a)}},{key:"render",value:function(){var s,a=this.props,i=a.hide,o=a.dot,l=a.points,c=a.className,d=a.xAxis,u=a.yAxis,h=a.top,m=a.left,f=a.width,p=a.height,A=a.isAnimationActive,v=a.id;if(i||!l||!l.length)return null;var x=this.state.isAnimationFinished,b=l.length===1,y=fr("recharts-line",c),w=d&&d.allowDataOverflow,j=u&&u.allowDataOverflow,N=w||j,_=wr(v)?this.id:v,S=(s=Dt(o,!1))!==null&&s!==void 0?s:{r:3,strokeWidth:2},C=S.r,E=C===void 0?3:C,T=S.strokeWidth,B=T===void 0?2:T,L=nX(o)?o:{},P=L.clipDot,F=P===void 0?!0:P,M=E*2+B;return oe.createElement(Qr,{className:y},w||j?oe.createElement("defs",null,oe.createElement("clipPath",{id:"clipPath-".concat(_)},oe.createElement("rect",{x:w?m:m-f/2,y:j?h:h-p/2,width:w?f:f*2,height:j?p:p*2})),!F&&oe.createElement("clipPath",{id:"clipPath-dots-".concat(_)},oe.createElement("rect",{x:m-M/2,y:h-M/2,width:f+M,height:p+M}))):null,!b&&this.renderCurve(N,_),this.renderErrorBar(N,_),(b||o)&&this.renderDots(N,F,_),(!A||x)&&wc.renderCallByParent(this.props,l))}}],[{key:"getDerivedStateFromProps",value:function(s,a){return s.animationId!==a.prevAnimationId?{prevAnimationId:s.animationId,curPoints:s.points,prevPoints:a.curPoints}:s.points!==a.curPoints?{curPoints:s.points}:null}},{key:"repeat",value:function(s,a){for(var i=s.length%2!==0?[].concat(Op(s),[0]):s,o=[],l=0;l<a;++l)o=[].concat(Op(o),Op(i));return o}},{key:"renderDotItem",value:function(s,a){var i;if(oe.isValidElement(s))i=oe.cloneElement(s,a);else if(er(s))i=s(a);else{var o=a.key,l=hQ(a,sqe),c=fr("recharts-line-dot",typeof s!="boolean"?s.className:"");i=oe.createElement(y0,wv({key:o},l,{className:c}))}return i}}])}(g.PureComponent);mc(Vm,"displayName","Line");mc(Vm,"defaultProps",{xAxisId:0,yAxisId:0,connectNulls:!1,activeDot:!0,dot:!0,legendType:"line",stroke:"#3182bd",strokeWidth:1,fill:"#fff",points:[],isAnimationActive:!Uu.isSsr,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",hide:!1,label:!1});mc(Vm,"getComposedData",function(e){var t=e.props,r=e.xAxis,s=e.yAxis,a=e.xAxisTicks,i=e.yAxisTicks,o=e.dataKey,l=e.bandSize,c=e.displayedData,d=e.offset,u=t.layout,h=c.map(function(m,f){var p=Ps(m,o);return u==="horizontal"?{x:hN({axis:r,ticks:a,bandSize:l,entry:m,index:f}),y:wr(p)?null:s.scale(p),value:p,payload:m}:{x:wr(p)?null:r.scale(p),y:hN({axis:s,ticks:i,bandSize:l,entry:m,index:f}),value:p,payload:m}});return Io({points:h,layout:u},d)});var gqe=["layout","type","stroke","connectNulls","isRange","ref"],xqe=["key"],wte;function Ug(e){"@babel/helpers - typeof";return Ug=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ug(e)}function jte(e,t){if(e==null)return{};var r=vqe(e,t),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)s=i[a],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(r[s]=e[s])}return r}function vqe(e,t){if(e==null)return{};var r={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;r[s]=e[s]}return r}function pm(){return pm=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},pm.apply(this,arguments)}function pQ(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,s)}return r}function uh(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?pQ(Object(r),!0).forEach(function(s){sd(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):pQ(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}function bqe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function AQ(e,t){for(var r=0;r<t.length;r++){var s=t[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,_te(s.key),s)}}function yqe(e,t,r){return t&&AQ(e.prototype,t),r&&AQ(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function wqe(e,t,r){return t=UN(t),jqe(e,Nte()?Reflect.construct(t,r||[],UN(e).constructor):t.apply(e,r))}function jqe(e,t){if(t&&(Ug(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Nqe(e)}function Nqe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Nte(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Nte=function(){return!!e})()}function UN(e){return UN=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},UN(e)}function _qe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&j3(e,t)}function j3(e,t){return j3=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,a){return s.__proto__=a,s},j3(e,t)}function sd(e,t,r){return t=_te(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _te(e){var t=Cqe(e,"string");return Ug(t)=="symbol"?t:t+""}function Cqe(e,t){if(Ug(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(Ug(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var ff=function(e){function t(){var r;bqe(this,t);for(var s=arguments.length,a=new Array(s),i=0;i<s;i++)a[i]=arguments[i];return r=wqe(this,t,[].concat(a)),sd(r,"state",{isAnimationFinished:!0}),sd(r,"id",sp("recharts-area-")),sd(r,"handleAnimationEnd",function(){var o=r.props.onAnimationEnd;r.setState({isAnimationFinished:!0}),er(o)&&o()}),sd(r,"handleAnimationStart",function(){var o=r.props.onAnimationStart;r.setState({isAnimationFinished:!1}),er(o)&&o()}),r}return _qe(t,e),yqe(t,[{key:"renderDots",value:function(s,a,i){var o=this.props.isAnimationActive,l=this.state.isAnimationFinished;if(o&&!l)return null;var c=this.props,d=c.dot,u=c.points,h=c.dataKey,m=Dt(this.props,!1),f=Dt(d,!0),p=u.map(function(v,x){var b=uh(uh(uh({key:"dot-".concat(x),r:3},m),f),{},{index:x,cx:v.x,cy:v.y,dataKey:h,value:v.value,payload:v.payload,points:u});return t.renderDotItem(d,b)}),A={clipPath:s?"url(#clipPath-".concat(a?"":"dots-").concat(i,")"):null};return oe.createElement(Qr,pm({className:"recharts-area-dots"},A),p)}},{key:"renderHorizontalRect",value:function(s){var a=this.props,i=a.baseLine,o=a.points,l=a.strokeWidth,c=o[0].x,d=o[o.length-1].x,u=s*Math.abs(c-d),h=Ch(o.map(function(m){return m.y||0}));return lt(i)&&typeof i=="number"?h=Math.max(i,h):i&&Array.isArray(i)&&i.length&&(h=Math.max(Ch(i.map(function(m){return m.y||0})),h)),lt(h)?oe.createElement("rect",{x:c<d?c:c-u,y:0,width:u,height:Math.floor(h+(l?parseInt("".concat(l),10):1))}):null}},{key:"renderVerticalRect",value:function(s){var a=this.props,i=a.baseLine,o=a.points,l=a.strokeWidth,c=o[0].y,d=o[o.length-1].y,u=s*Math.abs(c-d),h=Ch(o.map(function(m){return m.x||0}));return lt(i)&&typeof i=="number"?h=Math.max(i,h):i&&Array.isArray(i)&&i.length&&(h=Math.max(Ch(i.map(function(m){return m.x||0})),h)),lt(h)?oe.createElement("rect",{x:0,y:c<d?c:c-u,width:h+(l?parseInt("".concat(l),10):1),height:Math.floor(u)}):null}},{key:"renderClipRect",value:function(s){var a=this.props.layout;return a==="vertical"?this.renderVerticalRect(s):this.renderHorizontalRect(s)}},{key:"renderAreaStatically",value:function(s,a,i,o){var l=this.props,c=l.layout,d=l.type,u=l.stroke,h=l.connectNulls,m=l.isRange;l.ref;var f=jte(l,gqe);return oe.createElement(Qr,{clipPath:i?"url(#clipPath-".concat(o,")"):null},oe.createElement(jm,pm({},Dt(f,!0),{points:s,connectNulls:h,type:d,baseLine:a,layout:c,stroke:"none",className:"recharts-area-area"})),u!=="none"&&oe.createElement(jm,pm({},Dt(this.props,!1),{className:"recharts-area-curve",layout:c,type:d,connectNulls:h,fill:"none",points:s})),u!=="none"&&m&&oe.createElement(jm,pm({},Dt(this.props,!1),{className:"recharts-area-curve",layout:c,type:d,connectNulls:h,fill:"none",points:a})))}},{key:"renderAreaWithAnimation",value:function(s,a){var i=this,o=this.props,l=o.points,c=o.baseLine,d=o.isAnimationActive,u=o.animationBegin,h=o.animationDuration,m=o.animationEasing,f=o.animationId,p=this.state,A=p.prevPoints,v=p.prevBaseLine;return oe.createElement(Ml,{begin:u,duration:h,isActive:d,easing:m,from:{t:0},to:{t:1},key:"area-".concat(f),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(x){var b=x.t;if(A){var y=A.length/l.length,w=l.map(function(S,C){var E=Math.floor(C*y);if(A[E]){var T=A[E],B=ks(T.x,S.x),L=ks(T.y,S.y);return uh(uh({},S),{},{x:B(b),y:L(b)})}return S}),j;if(lt(c)&&typeof c=="number"){var N=ks(v,c);j=N(b)}else if(wr(c)||m0(c)){var _=ks(v,0);j=_(b)}else j=c.map(function(S,C){var E=Math.floor(C*y);if(v[E]){var T=v[E],B=ks(T.x,S.x),L=ks(T.y,S.y);return uh(uh({},S),{},{x:B(b),y:L(b)})}return S});return i.renderAreaStatically(w,j,s,a)}return oe.createElement(Qr,null,oe.createElement("defs",null,oe.createElement("clipPath",{id:"animationClipPath-".concat(a)},i.renderClipRect(b))),oe.createElement(Qr,{clipPath:"url(#animationClipPath-".concat(a,")")},i.renderAreaStatically(l,c,s,a)))})}},{key:"renderArea",value:function(s,a){var i=this.props,o=i.points,l=i.baseLine,c=i.isAnimationActive,d=this.state,u=d.prevPoints,h=d.prevBaseLine,m=d.totalLength;return c&&o&&o.length&&(!u&&m>0||!Yh(u,o)||!Yh(h,l))?this.renderAreaWithAnimation(s,a):this.renderAreaStatically(o,l,s,a)}},{key:"render",value:function(){var s,a=this.props,i=a.hide,o=a.dot,l=a.points,c=a.className,d=a.top,u=a.left,h=a.xAxis,m=a.yAxis,f=a.width,p=a.height,A=a.isAnimationActive,v=a.id;if(i||!l||!l.length)return null;var x=this.state.isAnimationFinished,b=l.length===1,y=fr("recharts-area",c),w=h&&h.allowDataOverflow,j=m&&m.allowDataOverflow,N=w||j,_=wr(v)?this.id:v,S=(s=Dt(o,!1))!==null&&s!==void 0?s:{r:3,strokeWidth:2},C=S.r,E=C===void 0?3:C,T=S.strokeWidth,B=T===void 0?2:T,L=nX(o)?o:{},P=L.clipDot,F=P===void 0?!0:P,M=E*2+B;return oe.createElement(Qr,{className:y},w||j?oe.createElement("defs",null,oe.createElement("clipPath",{id:"clipPath-".concat(_)},oe.createElement("rect",{x:w?u:u-f/2,y:j?d:d-p/2,width:w?f:f*2,height:j?p:p*2})),!F&&oe.createElement("clipPath",{id:"clipPath-dots-".concat(_)},oe.createElement("rect",{x:u-M/2,y:d-M/2,width:f+M,height:p+M}))):null,b?null:this.renderArea(N,_),(o||b)&&this.renderDots(N,F,_),(!A||x)&&wc.renderCallByParent(this.props,l))}}],[{key:"getDerivedStateFromProps",value:function(s,a){return s.animationId!==a.prevAnimationId?{prevAnimationId:s.animationId,curPoints:s.points,curBaseLine:s.baseLine,prevPoints:a.curPoints,prevBaseLine:a.curBaseLine}:s.points!==a.curPoints||s.baseLine!==a.curBaseLine?{curPoints:s.points,curBaseLine:s.baseLine}:null}}])}(g.PureComponent);wte=ff;sd(ff,"displayName","Area");sd(ff,"defaultProps",{stroke:"#3182bd",fill:"#3182bd",fillOpacity:.6,xAxisId:0,yAxisId:0,legendType:"line",connectNulls:!1,points:[],dot:!1,activeDot:!0,hide:!1,isAnimationActive:!Uu.isSsr,animationBegin:0,animationDuration:1500,animationEasing:"ease"});sd(ff,"getBaseValue",function(e,t,r,s){var a=e.layout,i=e.baseValue,o=t.props.baseValue,l=o??i;if(lt(l)&&typeof l=="number")return l;var c=a==="horizontal"?s:r,d=c.scale.domain();if(c.type==="number"){var u=Math.max(d[0],d[1]),h=Math.min(d[0],d[1]);return l==="dataMin"?h:l==="dataMax"||u<0?u:Math.max(Math.min(d[0],d[1]),0)}return l==="dataMin"?d[0]:l==="dataMax"?d[1]:d[0]});sd(ff,"getComposedData",function(e){var t=e.props,r=e.item,s=e.xAxis,a=e.yAxis,i=e.xAxisTicks,o=e.yAxisTicks,l=e.bandSize,c=e.dataKey,d=e.stackedData,u=e.dataStartIndex,h=e.displayedData,m=e.offset,f=t.layout,p=d&&d.length,A=wte.getBaseValue(t,r,s,a),v=f==="horizontal",x=!1,b=h.map(function(w,j){var N;p?N=d[u+j]:(N=Ps(w,c),Array.isArray(N)?x=!0:N=[A,N]);var _=N[1]==null||p&&Ps(w,c)==null;return v?{x:hN({axis:s,ticks:i,bandSize:l,entry:w,index:j}),y:_?null:a.scale(N[1]),value:N,payload:w}:{x:_?null:s.scale(N[1]),y:hN({axis:a,ticks:o,bandSize:l,entry:w,index:j}),value:N,payload:w}}),y;return p||x?y=b.map(function(w){var j=Array.isArray(w.value)?w.value[0]:null;return v?{x:w.x,y:j!=null&&w.y!=null?a.scale(j):null}:{x:j!=null?s.scale(j):null,y:w.y}}):y=v?a.scale(A):s.scale(A),uh({points:b,baseLine:y,layout:f,isRange:x},m)});sd(ff,"renderDotItem",function(e,t){var r;if(oe.isValidElement(e))r=oe.cloneElement(e,t);else if(er(e))r=e(t);else{var s=fr("recharts-area-dot",typeof e!="boolean"?e.className:""),a=t.key,i=jte(t,xqe);r=oe.createElement(y0,pm({},i,{key:a,className:s}))}return r});function Mg(e){"@babel/helpers - typeof";return Mg=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Mg(e)}function Sqe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function kqe(e,t){for(var r=0;r<t.length;r++){var s=t[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,kte(s.key),s)}}function Eqe(e,t,r){return t&&kqe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Bqe(e,t,r){return t=MN(t),Tqe(e,Cte()?Reflect.construct(t,r||[],MN(e).constructor):t.apply(e,r))}function Tqe(e,t){if(t&&(Mg(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Pqe(e)}function Pqe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Cte(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Cte=function(){return!!e})()}function MN(e){return MN=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},MN(e)}function Iqe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&N3(e,t)}function N3(e,t){return N3=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,a){return s.__proto__=a,s},N3(e,t)}function Ste(e,t,r){return t=kte(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function kte(e){var t=Oqe(e,"string");return Mg(t)=="symbol"?t:t+""}function Oqe(e,t){if(Mg(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(Mg(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function _3(){return _3=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},_3.apply(this,arguments)}function Fqe(e){var t=e.xAxisId,r=SF(),s=kF(),a=lte(t);return a==null?null:g.createElement(N0,_3({},a,{className:fr("recharts-".concat(a.axisType," ").concat(a.axisType),a.className),viewBox:{x:0,y:0,width:r,height:s},ticksGenerator:function(o){return uu(o,!0)}}))}var zo=function(e){function t(){return Sqe(this,t),Bqe(this,t,arguments)}return Iqe(t,e),Eqe(t,[{key:"render",value:function(){return g.createElement(Fqe,this.props)}}])}(g.Component);Ste(zo,"displayName","XAxis");Ste(zo,"defaultProps",{allowDecimals:!0,hide:!1,orientation:"bottom",width:0,height:30,mirror:!1,xAxisId:0,tickCount:5,type:"category",padding:{left:0,right:0},allowDataOverflow:!1,scale:"auto",reversed:!1,allowDuplicatedCategory:!0});function $g(e){"@babel/helpers - typeof";return $g=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},$g(e)}function Lqe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Dqe(e,t){for(var r=0;r<t.length;r++){var s=t[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,Tte(s.key),s)}}function Rqe(e,t,r){return t&&Dqe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Uqe(e,t,r){return t=$N(t),Mqe(e,Ete()?Reflect.construct(t,r||[],$N(e).constructor):t.apply(e,r))}function Mqe(e,t){if(t&&($g(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return $qe(e)}function $qe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ete(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Ete=function(){return!!e})()}function $N(e){return $N=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},$N(e)}function Qqe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&C3(e,t)}function C3(e,t){return C3=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,a){return s.__proto__=a,s},C3(e,t)}function Bte(e,t,r){return t=Tte(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Tte(e){var t=Hqe(e,"string");return $g(t)=="symbol"?t:t+""}function Hqe(e,t){if($g(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if($g(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function S3(){return S3=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},S3.apply(this,arguments)}var zqe=function(t){var r=t.yAxisId,s=SF(),a=kF(),i=cte(r);return i==null?null:g.createElement(N0,S3({},i,{className:fr("recharts-".concat(i.axisType," ").concat(i.axisType),i.className),viewBox:{x:0,y:0,width:s,height:a},ticksGenerator:function(l){return uu(l,!0)}}))},so=function(e){function t(){return Lqe(this,t),Uqe(this,t,arguments)}return Qqe(t,e),Rqe(t,[{key:"render",value:function(){return g.createElement(zqe,this.props)}}])}(g.Component);Bte(so,"displayName","YAxis");Bte(so,"defaultProps",{allowDuplicatedCategory:!0,allowDecimals:!0,hide:!1,orientation:"left",width:60,height:0,mirror:!1,yAxisId:0,tickCount:5,type:"number",padding:{top:0,bottom:0},allowDataOverflow:!1,scale:"auto",reversed:!1});function gQ(e){return Kqe(e)||qqe(e)||Gqe(e)||Vqe()}function Vqe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
1262In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Gqe(e,t){if(e){if(typeof e=="string")return k3(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return k3(e,t)}}function qqe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Kqe(e){if(Array.isArray(e))return k3(e)}function k3(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,s=new Array(t);r<t;r++)s[r]=e[r];return s}var E3=function(t,r,s,a,i){var o=el(t,BF),l=el(t,lS),c=[].concat(gQ(o),gQ(l)),d=el(t,dS),u="".concat(a,"Id"),h=a[0],m=r;if(c.length&&(m=c.reduce(function(A,v){if(v.props[u]===s&&hd(v.props,"extendDomain")&&lt(v.props[h])){var x=v.props[h];return[Math.min(A[0],x),Math.max(A[1],x)]}return A},m)),d.length){var f="".concat(h,"1"),p="".concat(h,"2");m=d.reduce(function(A,v){if(v.props[u]===s&&hd(v.props,"extendDomain")&&lt(v.props[f])&&lt(v.props[p])){var x=v.props[f],b=v.props[p];return[Math.min(A[0],x,b),Math.max(A[1],x,b)]}return A},m)}return i&&i.length&&(m=i.reduce(function(A,v){return lt(v)?[Math.min(A[0],v),Math.max(A[1],v)]:A},m)),m},Pte={exports:{}};(function(e){var t=Object.prototype.hasOwnProperty,r="~";function s(){}Object.create&&(s.prototype=Object.create(null),new s().__proto__||(r=!1));function a(c,d,u){this.fn=c,this.context=d,this.once=u||!1}function i(c,d,u,h,m){if(typeof u!="function")throw new TypeError("The listener must be a function");var f=new a(u,h||c,m),p=r?r+d:d;return c._events[p]?c._events[p].fn?c._events[p]=[c._events[p],f]:c._events[p].push(f):(c._events[p]=f,c._eventsCount++),c}function o(c,d){--c._eventsCount===0?c._events=new s:delete c._events[d]}function l(){this._events=new s,this._eventsCount=0}l.prototype.eventNames=function(){var d=[],u,h;if(this._eventsCount===0)return d;for(h in u=this._events)t.call(u,h)&&d.push(r?h.slice(1):h);return Object.getOwnPropertySymbols?d.concat(Object.getOwnPropertySymbols(u)):d},l.prototype.listeners=function(d){var u=r?r+d:d,h=this._events[u];if(!h)return[];if(h.fn)return[h.fn];for(var m=0,f=h.length,p=new Array(f);m<f;m++)p[m]=h[m].fn;return p},l.prototype.listenerCount=function(d){var u=r?r+d:d,h=this._events[u];return h?h.fn?1:h.length:0},l.prototype.emit=function(d,u,h,m,f,p){var A=r?r+d:d;if(!this._events[A])return!1;var v=this._events[A],x=arguments.length,b,y;if(v.fn){switch(v.once&&this.removeListener(d,v.fn,void 0,!0),x){case 1:return v.fn.call(v.context),!0;case 2:return v.fn.call(v.context,u),!0;case 3:return v.fn.call(v.context,u,h),!0;case 4:return v.fn.call(v.context,u,h,m),!0;case 5:return v.fn.call(v.context,u,h,m,f),!0;case 6:return v.fn.call(v.context,u,h,m,f,p),!0}for(y=1,b=new Array(x-1);y<x;y++)b[y-1]=arguments[y];v.fn.apply(v.context,b)}else{var w=v.length,j;for(y=0;y<w;y++)switch(v[y].once&&this.removeListener(d,v[y].fn,void 0,!0),x){case 1:v[y].fn.call(v[y].context);break;case 2:v[y].fn.call(v[y].context,u);break;case 3:v[y].fn.call(v[y].context,u,h);break;case 4:v[y].fn.call(v[y].context,u,h,m);break;default:if(!b)for(j=1,b=new Array(x-1);j<x;j++)b[j-1]=arguments[j];v[y].fn.apply(v[y].context,b)}}return!0},l.prototype.on=function(d,u,h){return i(this,d,u,h,!1)},l.prototype.once=function(d,u,h){return i(this,d,u,h,!0)},l.prototype.removeListener=function(d,u,h,m){var f=r?r+d:d;if(!this._events[f])return this;if(!u)return o(this,f),this;var p=this._events[f];if(p.fn)p.fn===u&&(!m||p.once)&&(!h||p.context===h)&&o(this,f);else{for(var A=0,v=[],x=p.length;A<x;A++)(p[A].fn!==u||m&&!p[A].once||h&&p[A].context!==h)&&v.push(p[A]);v.length?this._events[f]=v.length===1?v[0]:v:o(this,f)}return this},l.prototype.removeAllListeners=function(d){var u;return d?(u=r?r+d:d,this._events[u]&&o(this,u)):(this._events=new s,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=r,l.EventEmitter=l,e.exports=l})(Pte);var Wqe=Pte.exports;const Yqe=wn(Wqe);var cE=new Yqe,dE="recharts.syncMouseEvents";function Xb(e){"@babel/helpers - typeof";return Xb=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Xb(e)}function Jqe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Xqe(e,t){for(var r=0;r<t.length;r++){var s=t[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,Ite(s.key),s)}}function Zqe(e,t,r){return t&&Xqe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function uE(e,t,r){return t=Ite(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ite(e){var t=eKe(e,"string");return Xb(t)=="symbol"?t:t+""}function eKe(e,t){if(Xb(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(Xb(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var tKe=function(){function e(){Jqe(this,e),uE(this,"activeIndex",0),uE(this,"coordinateList",[]),uE(this,"layout","horizontal")}return Zqe(e,[{key:"setDetails",value:function(r){var s,a=r.coordinateList,i=a===void 0?null:a,o=r.container,l=o===void 0?null:o,c=r.layout,d=c===void 0?null:c,u=r.offset,h=u===void 0?null:u,m=r.mouseHandlerCallback,f=m===void 0?null:m;this.coordinateList=(s=i??this.coordinateList)!==null&&s!==void 0?s:[],this.container=l??this.container,this.layout=d??this.layout,this.offset=h??this.offset,this.mouseHandlerCallback=f??this.mouseHandlerCallback,this.activeIndex=Math.min(Math.max(this.activeIndex,0),this.coordinateList.length-1)}},{key:"focus",value:function(){this.spoofMouse()}},{key:"keyboardEvent",value:function(r){if(this.coordinateList.length!==0)switch(r.key){case"ArrowRight":{if(this.layout!=="horizontal")return;this.activeIndex=Math.min(this.activeIndex+1,this.coordinateList.length-1),this.spoofMouse();break}case"ArrowLeft":{if(this.layout!=="horizontal")return;this.activeIndex=Math.max(this.activeIndex-1,0),this.spoofMouse();break}}}},{key:"setIndex",value:function(r){this.activeIndex=r}},{key:"spoofMouse",value:function(){var r,s;if(this.layout==="horizontal"&&this.coordinateList.length!==0){var a=this.container.getBoundingClientRect(),i=a.x,o=a.y,l=a.height,c=this.coordinateList[this.activeIndex].coordinate,d=((r=window)===null||r===void 0?void 0:r.scrollX)||0,u=((s=window)===null||s===void 0?void 0:s.scrollY)||0,h=i+c+d,m=o+this.offset.top+l/2+u;this.mouseHandlerCallback({pageX:h,pageY:m})}}}])}();function rKe(e,t,r){if(r==="number"&&t===!0&&Array.isArray(e)){var s=e==null?void 0:e[0],a=e==null?void 0:e[1];if(s&&a&&lt(s)&&lt(a))return!0}return!1}function nKe(e,t,r,s){var a=s/2;return{stroke:"none",fill:"#ccc",x:e==="horizontal"?t.x-a:r.left+.5,y:e==="horizontal"?r.top+.5:t.y-a,width:e==="horizontal"?s:r.width-1,height:e==="horizontal"?r.height-1:s}}function Ote(e){var t=e.cx,r=e.cy,s=e.radius,a=e.startAngle,i=e.endAngle,o=yn(t,r,s,a),l=yn(t,r,s,i);return{points:[o,l],cx:t,cy:r,radius:s,startAngle:a,endAngle:i}}function sKe(e,t,r){var s,a,i,o;if(e==="horizontal")s=t.x,i=s,a=r.top,o=r.top+r.height;else if(e==="vertical")a=t.y,o=a,s=r.left,i=r.left+r.width;else if(t.cx!=null&&t.cy!=null)if(e==="centric"){var l=t.cx,c=t.cy,d=t.innerRadius,u=t.outerRadius,h=t.angle,m=yn(l,c,d,h),f=yn(l,c,u,h);s=m.x,a=m.y,i=f.x,o=f.y}else return Ote(t);return[{x:s,y:a},{x:i,y:o}]}function Zb(e){"@babel/helpers - typeof";return Zb=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Zb(e)}function xQ(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,s)}return r}function A1(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?xQ(Object(r),!0).forEach(function(s){aKe(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):xQ(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}function aKe(e,t,r){return t=iKe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function iKe(e){var t=oKe(e,"string");return Zb(t)=="symbol"?t:t+""}function oKe(e,t){if(Zb(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(Zb(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function lKe(e){var t,r,s=e.element,a=e.tooltipEventType,i=e.isActive,o=e.activeCoordinate,l=e.activePayload,c=e.offset,d=e.activeTooltipIndex,u=e.tooltipAxisBandSize,h=e.layout,m=e.chartName,f=(t=s.props.cursor)!==null&&t!==void 0?t:(r=s.type.defaultProps)===null||r===void 0?void 0:r.cursor;if(!s||!f||!i||!o||m!=="ScatterChart"&&a!=="axis")return null;var p,A=jm;if(m==="ScatterChart")p=o,A=VQe;else if(m==="BarChart")p=nKe(h,o,c,u),A=wF;else if(h==="radial"){var v=Ote(o),x=v.cx,b=v.cy,y=v.radius,w=v.startAngle,j=v.endAngle;p={cx:x,cy:b,startAngle:w,endAngle:j,innerRadius:y,outerRadius:y},A=jee}else p={points:sKe(h,o,c)},A=jm;var N=A1(A1(A1(A1({stroke:"#ccc",pointerEvents:"none"},c),p),Dt(f,!1)),{},{payload:l,payloadIndex:d,className:fr("recharts-tooltip-cursor",f.className)});return g.isValidElement(f)?g.cloneElement(f,N):g.createElement(A,N)}var cKe=["item"],dKe=["children","className","width","height","style","compact","title","desc"];function Qg(e){"@babel/helpers - typeof";return Qg=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Qg(e)}function jA(){return jA=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},jA.apply(this,arguments)}function vQ(e,t){return fKe(e)||hKe(e,t)||Lte(e,t)||uKe()}function uKe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1263In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function hKe(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var s,a,i,o,l=[],c=!0,d=!1;try{if(i=(r=r.call(e)).next,t!==0)for(;!(c=(s=i.call(r)).done)&&(l.push(s.value),l.length!==t);c=!0);}catch(u){d=!0,a=u}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(d)throw a}}return l}}function fKe(e){if(Array.isArray(e))return e}function bQ(e,t){if(e==null)return{};var r=mKe(e,t),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)s=i[a],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(r[s]=e[s])}return r}function mKe(e,t){if(e==null)return{};var r={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;r[s]=e[s]}return r}function pKe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function AKe(e,t){for(var r=0;r<t.length;r++){var s=t[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,Dte(s.key),s)}}function gKe(e,t,r){return t&&AKe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function xKe(e,t,r){return t=QN(t),vKe(e,Fte()?Reflect.construct(t,r||[],QN(e).constructor):t.apply(e,r))}function vKe(e,t){if(t&&(Qg(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return bKe(e)}function bKe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Fte(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Fte=function(){return!!e})()}function QN(e){return QN=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},QN(e)}function yKe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&B3(e,t)}function B3(e,t){return B3=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,a){return s.__proto__=a,s},B3(e,t)}function Hg(e){return NKe(e)||jKe(e)||Lte(e)||wKe()}function wKe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
1264In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Lte(e,t){if(e){if(typeof e=="string")return T3(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return T3(e,t)}}function jKe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function NKe(e){if(Array.isArray(e))return T3(e)}function T3(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,s=new Array(t);r<t;r++)s[r]=e[r];return s}function yQ(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,s)}return r}function Je(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?yQ(Object(r),!0).forEach(function(s){cr(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):yQ(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}function cr(e,t,r){return t=Dte(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Dte(e){var t=_Ke(e,"string");return Qg(t)=="symbol"?t:t+""}function _Ke(e,t){if(Qg(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(Qg(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var CKe={xAxis:["bottom","top"],yAxis:["left","right"]},SKe={width:"100%",height:"100%"},Rte={x:0,y:0};function g1(e){return e}var kKe=function(t,r){return r==="horizontal"?t.x:r==="vertical"?t.y:r==="centric"?t.angle:t.radius},EKe=function(t,r,s,a){var i=r.find(function(u){return u&&u.index===s});if(i){if(t==="horizontal")return{x:i.coordinate,y:a.y};if(t==="vertical")return{x:a.x,y:i.coordinate};if(t==="centric"){var o=i.coordinate,l=a.radius;return Je(Je(Je({},a),yn(a.cx,a.cy,l,o)),{},{angle:o,radius:l})}var c=i.coordinate,d=a.angle;return Je(Je(Je({},a),yn(a.cx,a.cy,c,d)),{},{angle:d,radius:c})}return Rte},uS=function(t,r){var s=r.graphicalItems,a=r.dataStartIndex,i=r.dataEndIndex,o=(s??[]).reduce(function(l,c){var d=c.props.data;return d&&d.length?[].concat(Hg(l),Hg(d)):l},[]);return o.length>0?o:t&&t.length&&lt(a)&&lt(i)?t.slice(a,i+1):[]};function Ute(e){return e==="number"?[0,"auto"]:void 0}var P3=function(t,r,s,a){var i=t.graphicalItems,o=t.tooltipAxis,l=uS(r,t);return s<0||!i||!i.length||s>=l.length?null:i.reduce(function(c,d){var u,h=(u=d.props.data)!==null&&u!==void 0?u:r;h&&t.dataStartIndex+t.dataEndIndex!==0&&t.dataEndIndex-t.dataStartIndex>=s&&(h=h.slice(t.dataStartIndex,t.dataEndIndex+1));var m;if(o.dataKey&&!o.allowDuplicatedCategory){var f=h===void 0?l:h;m=D2(f,o.dataKey,a)}else m=h&&h[s]||l[s];return m?[].concat(Hg(c),[pee(d,m)]):c},[])},wQ=function(t,r,s,a){var i=a||{x:t.chartX,y:t.chartY},o=kKe(i,s),l=t.orderedTooltipTicks,c=t.tooltipAxis,d=t.tooltipTicks,u=m8e(o,l,d,c);if(u>=0&&d){var h=d[u]&&d[u].value,m=P3(t,r,u,h),f=EKe(s,l,u,i);return{activeTooltipIndex:u,activeLabel:h,activePayload:m,activeCoordinate:f}}return null},BKe=function(t,r){var s=r.axes,a=r.graphicalItems,i=r.axisType,o=r.axisIdKey,l=r.stackGroups,c=r.dataStartIndex,d=r.dataEndIndex,u=t.layout,h=t.children,m=t.stackOffset,f=cee(u,i);return s.reduce(function(p,A){var v,x=A.type.defaultProps!==void 0?Je(Je({},A.type.defaultProps),A.props):A.props,b=x.type,y=x.dataKey,w=x.allowDataOverflow,j=x.allowDuplicatedCategory,N=x.scale,_=x.ticks,S=x.includeHidden,C=x[o];if(p[C])return p;var E=uS(t.data,{graphicalItems:a.filter(function(U){var D,q=o in U.props?U.props[o]:(D=U.type.defaultProps)===null||D===void 0?void 0:D[o];return q===C}),dataStartIndex:c,dataEndIndex:d}),T=E.length,B,L,P;rKe(x.domain,w,b)&&(B=HT(x.domain,null,w),f&&(b==="number"||N!=="auto")&&(P=xv(E,y,"category")));var F=Ute(b);if(!B||B.length===0){var M,I=(M=x.domain)!==null&&M!==void 0?M:F;if(y){if(B=xv(E,y,b),b==="category"&&f){var $=sEe(B);j&&$?(L=B,B=kN(0,T)):j||(B=Q$(I,B,A).reduce(function(U,D){return U.indexOf(D)>=0?U:[].concat(Hg(U),[D])},[]))}else if(b==="category")j?B=B.filter(function(U){return U!==""&&!wr(U)}):B=Q$(I,B,A).reduce(function(U,D){return U.indexOf(D)>=0||D===""||wr(D)?U:[].concat(Hg(U),[D])},[]);else if(b==="number"){var V=v8e(E,a.filter(function(U){var D,q,G=o in U.props?U.props[o]:(D=U.type.defaultProps)===null||D===void 0?void 0:D[o],Y="hide"in U.props?U.props.hide:(q=U.type.defaultProps)===null||q===void 0?void 0:q.hide;return G===C&&(S||!Y)}),y,i,u);V&&(B=V)}f&&(b==="number"||N!=="auto")&&(P=xv(E,y,"category"))}else f?B=kN(0,T):l&&l[C]&&l[C].hasStack&&b==="number"?B=m==="expand"?[0,1]:mee(l[C].stackGroups,c,d):B=lee(E,a.filter(function(U){var D=o in U.props?U.props[o]:U.type.defaultProps[o],q="hide"in U.props?U.props.hide:U.type.defaultProps.hide;return D===C&&(S||!q)}),b,u,!0);if(b==="number")B=E3(h,B,C,i,_),I&&(B=HT(I,B,w));else if(b==="category"&&I){var R=I,Q=B.every(function(U){return R.indexOf(U)>=0});Q&&(B=R)}}return Je(Je({},p),{},cr({},C,Je(Je({},x),{},{axisType:i,domain:B,categoricalDomain:P,duplicateDomain:L,originalDomain:(v=x.domain)!==null&&v!==void 0?v:F,isCategorical:f,layout:u})))},{})},TKe=function(t,r){var s=r.graphicalItems,a=r.Axis,i=r.axisType,o=r.axisIdKey,l=r.stackGroups,c=r.dataStartIndex,d=r.dataEndIndex,u=t.layout,h=t.children,m=uS(t.data,{graphicalItems:s,dataStartIndex:c,dataEndIndex:d}),f=m.length,p=cee(u,i),A=-1;return s.reduce(function(v,x){var b=x.type.defaultProps!==void 0?Je(Je({},x.type.defaultProps),x.props):x.props,y=b[o],w=Ute("number");if(!v[y]){A++;var j;return p?j=kN(0,f):l&&l[y]&&l[y].hasStack?(j=mee(l[y].stackGroups,c,d),j=E3(h,j,y,i)):(j=HT(w,lee(m,s.filter(function(N){var _,S,C=o in N.props?N.props[o]:(_=N.type.defaultProps)===null||_===void 0?void 0:_[o],E="hide"in N.props?N.props.hide:(S=N.type.defaultProps)===null||S===void 0?void 0:S.hide;return C===y&&!E}),"number",u),a.defaultProps.allowDataOverflow),j=E3(h,j,y,i)),Je(Je({},v),{},cr({},y,Je(Je({axisType:i},a.defaultProps),{},{hide:!0,orientation:Zo(CKe,"".concat(i,".").concat(A%2),null),domain:j,originalDomain:w,isCategorical:p,layout:u})))}return v},{})},PKe=function(t,r){var s=r.axisType,a=s===void 0?"xAxis":s,i=r.AxisComp,o=r.graphicalItems,l=r.stackGroups,c=r.dataStartIndex,d=r.dataEndIndex,u=t.children,h="".concat(a,"Id"),m=el(u,i),f={};return m&&m.length?f=BKe(t,{axes:m,graphicalItems:o,axisType:a,axisIdKey:h,stackGroups:l,dataStartIndex:c,dataEndIndex:d}):o&&o.length&&(f=TKe(t,{Axis:i,graphicalItems:o,axisType:a,axisIdKey:h,stackGroups:l,dataStartIndex:c,dataEndIndex:d})),f},IKe=function(t){var r=wh(t),s=uu(r,!1,!0);return{tooltipTicks:s,orderedTooltipTicks:WO(s,function(a){return a.coordinate}),tooltipAxis:r,tooltipAxisBandSize:fN(r,s)}},jQ=function(t){var r=t.children,s=t.defaultShowTooltip,a=Do(r,Pg),i=0,o=0;return t.data&&t.data.length!==0&&(o=t.data.length-1),a&&a.props&&(a.props.startIndex>=0&&(i=a.props.startIndex),a.props.endIndex>=0&&(o=a.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:i,dataEndIndex:o,activeTooltipIndex:-1,isTooltipActive:!!s}},OKe=function(t){return!t||!t.length?!1:t.some(function(r){var s=bu(r&&r.type);return s&&s.indexOf("Bar")>=0})},NQ=function(t){return t==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:t==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:t==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},FKe=function(t,r){var s=t.props,a=t.graphicalItems,i=t.xAxisMap,o=i===void 0?{}:i,l=t.yAxisMap,c=l===void 0?{}:l,d=s.width,u=s.height,h=s.children,m=s.margin||{},f=Do(h,Pg),p=Do(h,Mi),A=Object.keys(c).reduce(function(j,N){var _=c[N],S=_.orientation;return!_.mirror&&!_.hide?Je(Je({},j),{},cr({},S,j[S]+_.width)):j},{left:m.left||0,right:m.right||0}),v=Object.keys(o).reduce(function(j,N){var _=o[N],S=_.orientation;return!_.mirror&&!_.hide?Je(Je({},j),{},cr({},S,Zo(j,"".concat(S))+_.height)):j},{top:m.top||0,bottom:m.bottom||0}),x=Je(Je({},v),A),b=x.bottom;f&&(x.bottom+=f.props.height||Pg.defaultProps.height),p&&r&&(x=g8e(x,a,s,r));var y=d-x.left-x.right,w=u-x.top-x.bottom;return Je(Je({brushBottom:b},x),{},{width:Math.max(y,0),height:Math.max(w,0)})},LKe=function(t,r){if(r==="xAxis")return t[r].width;if(r==="yAxis")return t[r].height},Vy=function(t){var r=t.chartName,s=t.GraphicalChild,a=t.defaultTooltipEventType,i=a===void 0?"axis":a,o=t.validateTooltipEventTypes,l=o===void 0?["axis"]:o,c=t.axisComponents,d=t.legendContent,u=t.formatAxisMap,h=t.defaultProps,m=function(x,b){var y=b.graphicalItems,w=b.stackGroups,j=b.offset,N=b.updateId,_=b.dataStartIndex,S=b.dataEndIndex,C=x.barSize,E=x.layout,T=x.barGap,B=x.barCategoryGap,L=x.maxBarSize,P=NQ(E),F=P.numericAxisName,M=P.cateAxisName,I=OKe(y),$=[];return y.forEach(function(V,R){var Q=uS(x.data,{graphicalItems:[V],dataStartIndex:_,dataEndIndex:S}),U=V.type.defaultProps!==void 0?Je(Je({},V.type.defaultProps),V.props):V.props,D=U.dataKey,q=U.maxBarSize,G=U["".concat(F,"Id")],Y=U["".concat(M,"Id")],K={},X=c.reduce(function(re,se){var Ae=b["".concat(se.axisType,"Map")],Pe=U["".concat(se.axisType,"Id")];Ae&&Ae[Pe]||se.axisType==="zAxis"||Hm();var Oe=Ae[Pe];return Je(Je({},re),{},cr(cr({},se.axisType,Oe),"".concat(se.axisType,"Ticks"),uu(Oe)))},K),ne=X[M],ae=X["".concat(M,"Ticks")],J=w&&w[G]&&w[G].hasStack&&k8e(V,w[G].stackGroups),W=bu(V.type).indexOf("Bar")>=0,ie=fN(ne,ae),he=[],ee=I&&p8e({barSize:C,stackGroups:w,totalSize:LKe(X,M)});if(W){var xe,we,Se=wr(q)?L:q,pe=(xe=(we=fN(ne,ae,!0))!==null&&we!==void 0?we:Se)!==null&&xe!==void 0?xe:0;he=A8e({barGap:T,barCategoryGap:B,bandSize:pe!==ie?pe:ie,sizeList:ee[Y],maxBarSize:Se}),pe!==ie&&(he=he.map(function(re){return Je(Je({},re),{},{position:Je(Je({},re.position),{},{offset:re.position.offset-pe/2})})}))}var Ce=V&&V.type&&V.type.getComposedData;Ce&&$.push({props:Je(Je({},Ce(Je(Je({},X),{},{displayedData:Q,props:x,dataKey:D,item:V,bandSize:ie,barPosition:he,offset:j,stackedData:J,layout:E,dataStartIndex:_,dataEndIndex:S}))),{},cr(cr(cr({key:V.key||"item-".concat(R)},F,X[F]),M,X[M]),"animationId",N)),childIndex:AEe(V,x.children),item:V})}),$},f=function(x,b){var y=x.props,w=x.dataStartIndex,j=x.dataEndIndex,N=x.updateId;if(!LM({props:y}))return null;var _=y.children,S=y.layout,C=y.stackOffset,E=y.data,T=y.reverseStackOrder,B=NQ(S),L=B.numericAxisName,P=B.cateAxisName,F=el(_,s),M=C8e(E,F,"".concat(L,"Id"),"".concat(P,"Id"),C,T),I=c.reduce(function(U,D){var q="".concat(D.axisType,"Map");return Je(Je({},U),{},cr({},q,PKe(y,Je(Je({},D),{},{graphicalItems:F,stackGroups:D.axisType===L&&M,dataStartIndex:w,dataEndIndex:j}))))},{}),$=FKe(Je(Je({},I),{},{props:y,graphicalItems:F}),b==null?void 0:b.legendBBox);Object.keys(I).forEach(function(U){I[U]=u(y,I[U],$,U.replace("Map",""),r)});var V=I["".concat(P,"Map")],R=IKe(V),Q=m(y,Je(Je({},I),{},{dataStartIndex:w,dataEndIndex:j,updateId:N,graphicalItems:F,stackGroups:M,offset:$}));return Je(Je({formattedGraphicalItems:Q,graphicalItems:F,offset:$,stackGroups:M},R),I)},p=function(v){function x(b){var y,w,j;return pKe(this,x),j=xKe(this,x,[b]),cr(j,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),cr(j,"accessibilityManager",new tKe),cr(j,"handleLegendBBoxUpdate",function(N){if(N){var _=j.state,S=_.dataStartIndex,C=_.dataEndIndex,E=_.updateId;j.setState(Je({legendBBox:N},f({props:j.props,dataStartIndex:S,dataEndIndex:C,updateId:E},Je(Je({},j.state),{},{legendBBox:N}))))}}),cr(j,"handleReceiveSyncEvent",function(N,_,S){if(j.props.syncId===N){if(S===j.eventEmitterSymbol&&typeof j.props.syncMethod!="function")return;j.applySyncEvent(_)}}),cr(j,"handleBrushChange",function(N){var _=N.startIndex,S=N.endIndex;if(_!==j.state.dataStartIndex||S!==j.state.dataEndIndex){var C=j.state.updateId;j.setState(function(){return Je({dataStartIndex:_,dataEndIndex:S},f({props:j.props,dataStartIndex:_,dataEndIndex:S,updateId:C},j.state))}),j.triggerSyncEvent({dataStartIndex:_,dataEndIndex:S})}}),cr(j,"handleMouseEnter",function(N){var _=j.getMouseInfo(N);if(_){var S=Je(Je({},_),{},{isTooltipActive:!0});j.setState(S),j.triggerSyncEvent(S);var C=j.props.onMouseEnter;er(C)&&C(S,N)}}),cr(j,"triggeredAfterMouseMove",function(N){var _=j.getMouseInfo(N),S=_?Je(Je({},_),{},{isTooltipActive:!0}):{isTooltipActive:!1};j.setState(S),j.triggerSyncEvent(S);var C=j.props.onMouseMove;er(C)&&C(S,N)}),cr(j,"handleItemMouseEnter",function(N){j.setState(function(){return{isTooltipActive:!0,activeItem:N,activePayload:N.tooltipPayload,activeCoordinate:N.tooltipPosition||{x:N.cx,y:N.cy}}})}),cr(j,"handleItemMouseLeave",function(){j.setState(function(){return{isTooltipActive:!1}})}),cr(j,"handleMouseMove",function(N){N.persist(),j.throttleTriggeredAfterMouseMove(N)}),cr(j,"handleMouseLeave",function(N){j.throttleTriggeredAfterMouseMove.cancel();var _={isTooltipActive:!1};j.setState(_),j.triggerSyncEvent(_);var S=j.props.onMouseLeave;er(S)&&S(_,N)}),cr(j,"handleOuterEvent",function(N){var _=pEe(N),S=Zo(j.props,"".concat(_));if(_&&er(S)){var C,E;/.*touch.*/i.test(_)?E=j.getMouseInfo(N.changedTouches[0]):E=j.getMouseInfo(N),S((C=E)!==null&&C!==void 0?C:{},N)}}),cr(j,"handleClick",function(N){var _=j.getMouseInfo(N);if(_){var S=Je(Je({},_),{},{isTooltipActive:!0});j.setState(S),j.triggerSyncEvent(S);var C=j.props.onClick;er(C)&&C(S,N)}}),cr(j,"handleMouseDown",function(N){var _=j.props.onMouseDown;if(er(_)){var S=j.getMouseInfo(N);_(S,N)}}),cr(j,"handleMouseUp",function(N){var _=j.props.onMouseUp;if(er(_)){var S=j.getMouseInfo(N);_(S,N)}}),cr(j,"handleTouchMove",function(N){N.changedTouches!=null&&N.changedTouches.length>0&&j.throttleTriggeredAfterMouseMove(N.changedTouches[0])}),cr(j,"handleTouchStart",function(N){N.changedTouches!=null&&N.changedTouches.length>0&&j.handleMouseDown(N.changedTouches[0])}),cr(j,"handleTouchEnd",function(N){N.changedTouches!=null&&N.changedTouches.length>0&&j.handleMouseUp(N.changedTouches[0])}),cr(j,"handleDoubleClick",function(N){var _=j.props.onDoubleClick;if(er(_)){var S=j.getMouseInfo(N);_(S,N)}}),cr(j,"handleContextMenu",function(N){var _=j.props.onContextMenu;if(er(_)){var S=j.getMouseInfo(N);_(S,N)}}),cr(j,"triggerSyncEvent",function(N){j.props.syncId!==void 0&&cE.emit(dE,j.props.syncId,N,j.eventEmitterSymbol)}),cr(j,"applySyncEvent",function(N){var _=j.props,S=_.layout,C=_.syncMethod,E=j.state.updateId,T=N.dataStartIndex,B=N.dataEndIndex;if(N.dataStartIndex!==void 0||N.dataEndIndex!==void 0)j.setState(Je({dataStartIndex:T,dataEndIndex:B},f({props:j.props,dataStartIndex:T,dataEndIndex:B,updateId:E},j.state)));else if(N.activeTooltipIndex!==void 0){var L=N.chartX,P=N.chartY,F=N.activeTooltipIndex,M=j.state,I=M.offset,$=M.tooltipTicks;if(!I)return;if(typeof C=="function")F=C($,N);else if(C==="value"){F=-1;for(var V=0;V<$.length;V++)if($[V].value===N.activeLabel){F=V;break}}var R=Je(Je({},I),{},{x:I.left,y:I.top}),Q=Math.min(L,R.x+R.width),U=Math.min(P,R.y+R.height),D=$[F]&&$[F].value,q=P3(j.state,j.props.data,F),G=$[F]?{x:S==="horizontal"?$[F].coordinate:Q,y:S==="horizontal"?U:$[F].coordinate}:Rte;j.setState(Je(Je({},N),{},{activeLabel:D,activeCoordinate:G,activePayload:q,activeTooltipIndex:F}))}else j.setState(N)}),cr(j,"renderCursor",function(N){var _,S=j.state,C=S.isTooltipActive,E=S.activeCoordinate,T=S.activePayload,B=S.offset,L=S.activeTooltipIndex,P=S.tooltipAxisBandSize,F=j.getTooltipEventType(),M=(_=N.props.active)!==null&&_!==void 0?_:C,I=j.props.layout,$=N.key||"_recharts-cursor";return oe.createElement(lKe,{key:$,activeCoordinate:E,activePayload:T,activeTooltipIndex:L,chartName:r,element:N,isActive:M,layout:I,offset:B,tooltipAxisBandSize:P,tooltipEventType:F})}),cr(j,"renderPolarAxis",function(N,_,S){var C=Zo(N,"type.axisType"),E=Zo(j.state,"".concat(C,"Map")),T=N.type.defaultProps,B=T!==void 0?Je(Je({},T),N.props):N.props,L=E&&E[B["".concat(C,"Id")]];return g.cloneElement(N,Je(Je({},L),{},{className:fr(C,L.className),key:N.key||"".concat(_,"-").concat(S),ticks:uu(L,!0)}))}),cr(j,"renderPolarGrid",function(N){var _=N.props,S=_.radialLines,C=_.polarAngles,E=_.polarRadius,T=j.state,B=T.radiusAxisMap,L=T.angleAxisMap,P=wh(B),F=wh(L),M=F.cx,I=F.cy,$=F.innerRadius,V=F.outerRadius;return g.cloneElement(N,{polarAngles:Array.isArray(C)?C:uu(F,!0).map(function(R){return R.coordinate}),polarRadius:Array.isArray(E)?E:uu(P,!0).map(function(R){return R.coordinate}),cx:M,cy:I,innerRadius:$,outerRadius:V,key:N.key||"polar-grid",radialLines:S})}),cr(j,"renderLegend",function(){var N=j.state.formattedGraphicalItems,_=j.props,S=_.children,C=_.width,E=_.height,T=j.props.margin||{},B=C-(T.left||0)-(T.right||0),L=iee({children:S,formattedGraphicalItems:N,legendWidth:B,legendContent:d});if(!L)return null;var P=L.item,F=bQ(L,cKe);return g.cloneElement(P,Je(Je({},F),{},{chartWidth:C,chartHeight:E,margin:T,onBBoxUpdate:j.handleLegendBBoxUpdate}))}),cr(j,"renderTooltip",function(){var N,_=j.props,S=_.children,C=_.accessibilityLayer,E=Do(S,Aa);if(!E)return null;var T=j.state,B=T.isTooltipActive,L=T.activeCoordinate,P=T.activePayload,F=T.activeLabel,M=T.offset,I=(N=E.props.active)!==null&&N!==void 0?N:B;return g.cloneElement(E,{viewBox:Je(Je({},M),{},{x:M.left,y:M.top}),active:I,label:F,payload:I?P:[],coordinate:L,accessibilityLayer:C})}),cr(j,"renderBrush",function(N){var _=j.props,S=_.margin,C=_.data,E=j.state,T=E.offset,B=E.dataStartIndex,L=E.dataEndIndex,P=E.updateId;return g.cloneElement(N,{key:N.key||"_recharts-brush",onChange:h1(j.handleBrushChange,N.props.onChange),data:C,x:lt(N.props.x)?N.props.x:T.left,y:lt(N.props.y)?N.props.y:T.top+T.height+T.brushBottom-(S.bottom||0),width:lt(N.props.width)?N.props.width:T.width,startIndex:B,endIndex:L,updateId:"brush-".concat(P)})}),cr(j,"renderReferenceElement",function(N,_,S){if(!N)return null;var C=j,E=C.clipPathId,T=j.state,B=T.xAxisMap,L=T.yAxisMap,P=T.offset,F=N.type.defaultProps||{},M=N.props,I=M.xAxisId,$=I===void 0?F.xAxisId:I,V=M.yAxisId,R=V===void 0?F.yAxisId:V;return g.cloneElement(N,{key:N.key||"".concat(_,"-").concat(S),xAxis:B[$],yAxis:L[R],viewBox:{x:P.left,y:P.top,width:P.width,height:P.height},clipPathId:E})}),cr(j,"renderActivePoints",function(N){var _=N.item,S=N.activePoint,C=N.basePoint,E=N.childIndex,T=N.isRange,B=[],L=_.props.key,P=_.item.type.defaultProps!==void 0?Je(Je({},_.item.type.defaultProps),_.item.props):_.item.props,F=P.activeDot,M=P.dataKey,I=Je(Je({index:E,dataKey:M,cx:S.x,cy:S.y,r:4,fill:yF(_.item),strokeWidth:2,stroke:"#fff",payload:S.payload,value:S.value},Dt(F,!1)),R2(F));return B.push(x.renderActiveDot(F,I,"".concat(L,"-activePoint-").concat(E))),C?B.push(x.renderActiveDot(F,Je(Je({},I),{},{cx:C.x,cy:C.y}),"".concat(L,"-basePoint-").concat(E))):T&&B.push(null),B}),cr(j,"renderGraphicChild",function(N,_,S){var C=j.filterFormatItem(N,_,S);if(!C)return null;var E=j.getTooltipEventType(),T=j.state,B=T.isTooltipActive,L=T.tooltipAxis,P=T.activeTooltipIndex,F=T.activeLabel,M=j.props.children,I=Do(M,Aa),$=C.props,V=$.points,R=$.isRange,Q=$.baseLine,U=C.item.type.defaultProps!==void 0?Je(Je({},C.item.type.defaultProps),C.item.props):C.item.props,D=U.activeDot,q=U.hide,G=U.activeBar,Y=U.activeShape,K=!!(!q&&B&&I&&(D||G||Y)),X={};E!=="axis"&&I&&I.props.trigger==="click"?X={onClick:h1(j.handleItemMouseEnter,N.props.onClick)}:E!=="axis"&&(X={onMouseLeave:h1(j.handleItemMouseLeave,N.props.onMouseLeave),onMouseEnter:h1(j.handleItemMouseEnter,N.props.onMouseEnter)});var ne=g.cloneElement(N,Je(Je({},C.props),X));function ae(se){return typeof L.dataKey=="function"?L.dataKey(se.payload):null}if(K)if(P>=0){var J,W;if(L.dataKey&&!L.allowDuplicatedCategory){var ie=typeof L.dataKey=="function"?ae:"payload.".concat(L.dataKey.toString());J=D2(V,ie,F),W=R&&Q&&D2(Q,ie,F)}else J=V==null?void 0:V[P],W=R&&Q&&Q[P];if(Y||G){var he=N.props.activeIndex!==void 0?N.props.activeIndex:P;return[g.cloneElement(N,Je(Je(Je({},C.props),X),{},{activeIndex:he})),null,null]}if(!wr(J))return[ne].concat(Hg(j.renderActivePoints({item:C,activePoint:J,basePoint:W,childIndex:P,isRange:R})))}else{var ee,xe=(ee=j.getItemByXY(j.state.activeCoordinate))!==null&&ee!==void 0?ee:{graphicalItem:ne},we=xe.graphicalItem,Se=we.item,pe=Se===void 0?N:Se,Ce=we.childIndex,re=Je(Je(Je({},C.props),X),{},{activeIndex:Ce});return[g.cloneElement(pe,re),null,null]}return R?[ne,null,null]:[ne,null]}),cr(j,"renderCustomized",function(N,_,S){return g.cloneElement(N,Je(Je({key:"recharts-customized-".concat(S)},j.props),j.state))}),cr(j,"renderMap",{CartesianGrid:{handler:g1,once:!0},ReferenceArea:{handler:j.renderReferenceElement},ReferenceLine:{handler:g1},ReferenceDot:{handler:j.renderReferenceElement},XAxis:{handler:g1},YAxis:{handler:g1},Brush:{handler:j.renderBrush,once:!0},Bar:{handler:j.renderGraphicChild},Line:{handler:j.renderGraphicChild},Area:{handler:j.renderGraphicChild},Radar:{handler:j.renderGraphicChild},RadialBar:{handler:j.renderGraphicChild},Scatter:{handler:j.renderGraphicChild},Pie:{handler:j.renderGraphicChild},Funnel:{handler:j.renderGraphicChild},Tooltip:{handler:j.renderCursor,once:!0},PolarGrid:{handler:j.renderPolarGrid,once:!0},PolarAngleAxis:{handler:j.renderPolarAxis},PolarRadiusAxis:{handler:j.renderPolarAxis},Customized:{handler:j.renderCustomized}}),j.clipPathId="".concat((y=b.id)!==null&&y!==void 0?y:sp("recharts"),"-clip"),j.throttleTriggeredAfterMouseMove=iZ(j.triggeredAfterMouseMove,(w=b.throttleDelay)!==null&&w!==void 0?w:1e3/60),j.state={},j}return yKe(x,v),gKe(x,[{key:"componentDidMount",value:function(){var y,w;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(y=this.props.margin.left)!==null&&y!==void 0?y:0,top:(w=this.props.margin.top)!==null&&w!==void 0?w:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var y=this.props,w=y.children,j=y.data,N=y.height,_=y.layout,S=Do(w,Aa);if(S){var C=S.props.defaultIndex;if(!(typeof C!="number"||C<0||C>this.state.tooltipTicks.length-1)){var E=this.state.tooltipTicks[C]&&this.state.tooltipTicks[C].value,T=P3(this.state,j,C,E),B=this.state.tooltipTicks[C].coordinate,L=(this.state.offset.top+N)/2,P=_==="horizontal",F=P?{x:B,y:L}:{y:B,x:L},M=this.state.formattedGraphicalItems.find(function($){var V=$.item;return V.type.name==="Scatter"});M&&(F=Je(Je({},F),M.props.points[C].tooltipPosition),T=M.props.points[C].tooltipPayload);var I={activeTooltipIndex:C,isTooltipActive:!0,activeLabel:E,activePayload:T,activeCoordinate:F};this.setState(I),this.renderCursor(S),this.accessibilityManager.setIndex(C)}}}},{key:"getSnapshotBeforeUpdate",value:function(y,w){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==w.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==y.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==y.margin){var j,N;this.accessibilityManager.setDetails({offset:{left:(j=this.props.margin.left)!==null&&j!==void 0?j:0,top:(N=this.props.margin.top)!==null&&N!==void 0?N:0}})}return null}},{key:"componentDidUpdate",value:function(y){sT([Do(y.children,Aa)],[Do(this.props.children,Aa)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var y=Do(this.props.children,Aa);if(y&&typeof y.props.shared=="boolean"){var w=y.props.shared?"axis":"item";return l.indexOf(w)>=0?w:i}return i}},{key:"getMouseInfo",value:function(y){if(!this.container)return null;var w=this.container,j=w.getBoundingClientRect(),N=QLe(j),_={chartX:Math.round(y.pageX-N.left),chartY:Math.round(y.pageY-N.top)},S=j.width/w.offsetWidth||1,C=this.inRange(_.chartX,_.chartY,S);if(!C)return null;var E=this.state,T=E.xAxisMap,B=E.yAxisMap,L=this.getTooltipEventType(),P=wQ(this.state,this.props.data,this.props.layout,C);if(L!=="axis"&&T&&B){var F=wh(T).scale,M=wh(B).scale,I=F&&F.invert?F.invert(_.chartX):null,$=M&&M.invert?M.invert(_.chartY):null;return Je(Je({},_),{},{xValue:I,yValue:$},P)}return P?Je(Je({},_),P):null}},{key:"inRange",value:function(y,w){var j=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,N=this.props.layout,_=y/j,S=w/j;if(N==="horizontal"||N==="vertical"){var C=this.state.offset,E=_>=C.left&&_<=C.left+C.width&&S>=C.top&&S<=C.top+C.height;return E?{x:_,y:S}:null}var T=this.state,B=T.angleAxisMap,L=T.radiusAxisMap;if(B&&L){var P=wh(B);return V$({x:_,y:S},P)}return null}},{key:"parseEventsOfWrapper",value:function(){var y=this.props.children,w=this.getTooltipEventType(),j=Do(y,Aa),N={};j&&w==="axis"&&(j.props.trigger==="click"?N={onClick:this.handleClick}:N={onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu});var _=R2(this.props,this.handleOuterEvent);return Je(Je({},_),N)}},{key:"addListener",value:function(){cE.on(dE,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){cE.removeListener(dE,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(y,w,j){for(var N=this.state.formattedGraphicalItems,_=0,S=N.length;_<S;_++){var C=N[_];if(C.item===y||C.props.key===y.key||w===bu(C.item.type)&&j===C.childIndex)return C}return null}},{key:"renderClipPath",value:function(){var y=this.clipPathId,w=this.state.offset,j=w.left,N=w.top,_=w.height,S=w.width;return oe.createElement("defs",null,oe.createElement("clipPath",{id:y},oe.createElement("rect",{x:j,y:N,height:_,width:S})))}},{key:"getXScales",value:function(){var y=this.state.xAxisMap;return y?Object.entries(y).reduce(function(w,j){var N=vQ(j,2),_=N[0],S=N[1];return Je(Je({},w),{},cr({},_,S.scale))},{}):null}},{key:"getYScales",value:function(){var y=this.state.yAxisMap;return y?Object.entries(y).reduce(function(w,j){var N=vQ(j,2),_=N[0],S=N[1];return Je(Je({},w),{},cr({},_,S.scale))},{}):null}},{key:"getXScaleByAxisId",value:function(y){var w;return(w=this.state.xAxisMap)===null||w===void 0||(w=w[y])===null||w===void 0?void 0:w.scale}},{key:"getYScaleByAxisId",value:function(y){var w;return(w=this.state.yAxisMap)===null||w===void 0||(w=w[y])===null||w===void 0?void 0:w.scale}},{key:"getItemByXY",value:function(y){var w=this.state,j=w.formattedGraphicalItems,N=w.activeItem;if(j&&j.length)for(var _=0,S=j.length;_<S;_++){var C=j[_],E=C.props,T=C.item,B=T.type.defaultProps!==void 0?Je(Je({},T.type.defaultProps),T.props):T.props,L=bu(T.type);if(L==="Bar"){var P=(E.data||[]).find(function($){return CQe(y,$)});if(P)return{graphicalItem:C,payload:P}}else if(L==="RadialBar"){var F=(E.data||[]).find(function($){return V$(y,$)});if(F)return{graphicalItem:C,payload:F}}else if(sS(C,N)||aS(C,N)||qb(C,N)){var M=N9e({graphicalItem:C,activeTooltipItem:N,itemData:B.data}),I=B.activeIndex===void 0?M:B.activeIndex;return{graphicalItem:Je(Je({},C),{},{childIndex:I}),payload:qb(C,N)?B.data[M]:C.props.data[M]}}}return null}},{key:"render",value:function(){var y=this;if(!LM(this))return null;var w=this.props,j=w.children,N=w.className,_=w.width,S=w.height,C=w.style,E=w.compact,T=w.title,B=w.desc,L=bQ(w,dKe),P=Dt(L,!1);if(E)return oe.createElement(Z7,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},oe.createElement(iT,jA({},P,{width:_,height:S,title:T,desc:B}),this.renderClipPath(),RM(j,this.renderMap)));if(this.props.accessibilityLayer){var F,M;P.tabIndex=(F=this.props.tabIndex)!==null&&F!==void 0?F:0,P.role=(M=this.props.role)!==null&&M!==void 0?M:"application",P.onKeyDown=function($){y.accessibilityManager.keyboardEvent($)},P.onFocus=function(){y.accessibilityManager.focus()}}var I=this.parseEventsOfWrapper();return oe.createElement(Z7,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},oe.createElement("div",jA({className:fr("recharts-wrapper",N),style:Je({position:"relative",cursor:"default",width:_,height:S},C)},I,{ref:function(V){y.container=V}}),oe.createElement(iT,jA({},P,{width:_,height:S,title:T,desc:B,style:SKe}),this.renderClipPath(),RM(j,this.renderMap)),this.renderLegend(),this.renderTooltip()))}}])}(g.Component);cr(p,"displayName",r),cr(p,"defaultProps",Je({layout:"horizontal",stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:"index"},h)),cr(p,"getDerivedStateFromProps",function(v,x){var b=v.dataKey,y=v.data,w=v.children,j=v.width,N=v.height,_=v.layout,S=v.stackOffset,C=v.margin,E=x.dataStartIndex,T=x.dataEndIndex;if(x.updateId===void 0){var B=jQ(v);return Je(Je(Je({},B),{},{updateId:0},f(Je(Je({props:v},B),{},{updateId:0}),x)),{},{prevDataKey:b,prevData:y,prevWidth:j,prevHeight:N,prevLayout:_,prevStackOffset:S,prevMargin:C,prevChildren:w})}if(b!==x.prevDataKey||y!==x.prevData||j!==x.prevWidth||N!==x.prevHeight||_!==x.prevLayout||S!==x.prevStackOffset||!OA(C,x.prevMargin)){var L=jQ(v),P={chartX:x.chartX,chartY:x.chartY,isTooltipActive:x.isTooltipActive},F=Je(Je({},wQ(x,y,_)),{},{updateId:x.updateId+1}),M=Je(Je(Je({},L),P),F);return Je(Je(Je({},M),f(Je({props:v},M),x)),{},{prevDataKey:b,prevData:y,prevWidth:j,prevHeight:N,prevLayout:_,prevStackOffset:S,prevMargin:C,prevChildren:w})}if(!sT(w,x.prevChildren)){var I,$,V,R,Q=Do(w,Pg),U=Q&&(I=($=Q.props)===null||$===void 0?void 0:$.startIndex)!==null&&I!==void 0?I:E,D=Q&&(V=(R=Q.props)===null||R===void 0?void 0:R.endIndex)!==null&&V!==void 0?V:T,q=U!==E||D!==T,G=!wr(y),Y=G&&!q?x.updateId:x.updateId+1;return Je(Je({updateId:Y},f(Je(Je({props:v},x),{},{updateId:Y,dataStartIndex:U,dataEndIndex:D}),x)),{},{prevChildren:w,dataStartIndex:U,dataEndIndex:D})}return null}),cr(p,"renderActiveDot",function(v,x,b){var y;return g.isValidElement(v)?y=g.cloneElement(v,x):er(v)?y=v(x):y=oe.createElement(y0,x),oe.createElement(Qr,{className:"recharts-active-dot",key:b},y)});var A=g.forwardRef(function(x,b){return oe.createElement(p,jA({},x,{ref:b}))});return A.displayName=p.displayName,A},Mte=Vy({chartName:"LineChart",GraphicalChild:Vm,axisComponents:[{axisType:"xAxis",AxisComp:zo},{axisType:"yAxis",AxisComp:so}],formatAxisMap:jF}),Jx=Vy({chartName:"BarChart",GraphicalChild:vc,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:zo},{axisType:"yAxis",AxisComp:so}],formatAxisMap:jF}),I3=Vy({chartName:"PieChart",GraphicalChild:Sc,validateTooltipEventTypes:["item"],defaultTooltipEventType:"item",legendContent:"children",axisComponents:[{axisType:"angleAxis",AxisComp:j0},{axisType:"radiusAxis",AxisComp:w0}],formatAxisMap:xee,defaultProps:{layout:"centric",startAngle:0,endAngle:360,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"}}),DKe=Vy({chartName:"RadarChart",GraphicalChild:zy,axisComponents:[{axisType:"angleAxis",AxisComp:j0},{axisType:"radiusAxis",AxisComp:w0}],formatAxisMap:xee,defaultProps:{layout:"centric",startAngle:90,endAngle:-270,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"}}),RKe=Vy({chartName:"AreaChart",GraphicalChild:ff,axisComponents:[{axisType:"xAxis",AxisComp:zo},{axisType:"yAxis",AxisComp:so}],formatAxisMap:jF});const UKe=({className:e})=>n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e,children:n.jsx("path",{d:"M9 12a4 4 0 1 0 4 4V4a
12645 5 0 0 0 5 5"})}),hu=(e,t="h-5 w-5")=>{if(!e)return null;switch(e.toLowerCase()){case"linkedin":return n.jsx(ky,{className:t});case"twitter":return n.jsx(kr,{className:t});case"facebook":return n.jsx(_u,{className:t});case"instagram":return n.jsx(Vh,{className:t});case"youtube":return n.jsx(kI,{className:t});case"tiktok":return n.jsx(UKe,{className:t});case"bing":return n.jsx(Is,{className:t});case"google_ads":return n.jsx(Is,{className:t});default:return n.jsx(Is,{className:t})}},MKe={twitter:"X/Twitter",facebook:"Facebook",instagram:"Instagram",linkedin:"LinkedIn",youtube:"YouTube",tiktok:"TikTok",bing:"Bing",google_ads:"Google Ads"},em=e=>MKe[e]||e;function Gl(e={}){const{autoDetect:t=!0,defaultTimezone:r=Sy,updateProfile:s=!0}=e,{user:a,updateProfile:i}=wa(),[o,l]=g.useState(r),[c,d]=g.useState(!0),[u,h]=g.useState(!1),[m,f]=g.useState(null);g.useEffect(()=>{async function P(){var F,M;d(!0),f(null);try{if(a){const I=((F=a.user_metadata)==null?void 0:F.timezone)||((M=a.app_metadata)==null?void 0:M.timezone);if(I&&El(I))l(I);else{const{data:$}=await de.schema("marketing_and_customer_success").from("profiles").select("timezone").eq("id",a.id).single();$!=null&&$.timezone&&El($.timezone)?l($.timezone):t?await A():l(r)}}else if(t){const I=Xv();El(I)?l(I):l(r)}else l(r)}catch(I){console.error("Error loading user timezone:",I),f("Failed to load timezone"),l(r)}finally{d(!1)}}P()},[a,t,r]);const p=g.useCallback(async P=>{if(!El(P)){const F=`Invalid timezone: ${P}`;throw f(F),new Error(F)}if(f(null),l(P),a&&s&&i)try{await i({timezone:P})}catch(F){console.error("Error updating timezone in profile:",F),f("Failed to save timezone to profile")}},[a,s,i]),A=g.useCallback(async()=>{h(!0),f(null);try{const P=Xv();if(El(P))await p(P);else throw new Error("Could not detect a valid timezone")}catch(P){console.error("Error auto-detecting timezone:",P),f("Failed to detect timezone")}finally{h(!1)}},[p]),v=g.useCallback(async()=>{await p(r)},[p,r]),x=g.useCallback((P,F=BR)=>Il(P,o,F),[o]),b=g.useCallback((P,F=!1)=>{try{return(typeof P=="string"?new Date(P):P).toLocaleTimeString("en-US",{timeZone:o,hour12:!F,hour:"numeric",minute:"2-digit"})}catch(M){return console.error("Error formatting time:",M),(typeof P=="string"?new Date(P):P).toLocaleTimeString("en-US",{hour12:!F,hour:"numeric",minute:"2-digit"})}},[o]),y=g.useCallback((P,F=BR)=>OAe(P,o,F),[o]),w=g.useCallback(()=>rg(o),[o]),j=g.useCallback(P=>IAe(P,o),[o]),N=g.useCallback(()=>Zv(o),[o]),_=g.useCallback(P=>FAe(o,P),[o]),S=g.useCallback(P=>LAe(o,P),[o]),C=g.useCallback((P,F)=>eb(P,o,F),[o]),E=g.useCallback((P,F)=>AB(P,o,F),[o]),T=g.useCallback((P,F)=>nK(P,o,F),[o]),B=g.useCallback((P,F)=>RAe(P,o,F),[o]);return g.useMemo(()=>({timezone:o,isLoading:c,isAutoDetecting:u,error:m,setTimezone:p,detectAndSetTimezone:A,resetTimezone:v,formatDate:x,formatTime:b,formatDateWithTimezone:y,getCurrentTime:w,fromUTC:j,getDisplayName:N,getAbbreviation:_,isDSTActive:S,isValidTimezone:El,getRelativeTime:C,getSmartRelativeTime:E,getContextualTime:T,getTimeUntil:B}),[o,c,u,m,p,A,v,x,b,y,w,j,N,_,S,C,E,T,B])}function $Ke({size:e="sm",variant:t="text",showFullName:r=!1,showOffset:s=!1,className:a,showTooltip:i=!0,icon:o,label:l="Time shown in"}){const{timezone:c,getAbbreviation:d,getDisplayName:u,isLoading:h}=Gl();if(h)return n.jsx("div",{className:ye("text-muted-foreground animate-pulse",a),children:n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx(Vr,{className:"h-3 w-3"}),n.jsx("span",{className:"text-xs",children:"Loading timezone..."})]})});const m=d(),f=u(),A=(w=>{try{const j=new Date,N=new Date(j.getTime()+j.getTimezoneOffset()*6e4),S=(new Date(N.toLocaleString("en-US",{timeZone:w})).getTime()-N.getTime())/(1e3*60*60),C=S>=0?"+":"-",E=Math.abs(S),T=Math.floor(E),B=E%1*60;return`${C}${T.toString().padStart(2,"0")}:${B.toString().padStart(2,"0")}`}catch{return"+00:00"}})(c),v=new Date().toLocaleDateString("en",{timeZone:c,timeZoneName:"short"}).includes("DT"),b=(()=>{switch(t){case"badge":return n.jsxs(Be,{variant:"outline",className:ye("text-xs",a),children:[o||n.jsx(Vr,{className:"h-3 w-3 mr-1"}),r?f:m,s&&` (${A})`]});case"icon":return n.jsx("div",{className:ye("flex items-center gap-1 text-muted-foreground",a),children:o||n.jsx(Vr,{className:"h-4 w-4"})});case"full":return n.jsxs("div",{className:ye("flex items-center gap-2 text-sm text-muted-foreground",a),children:[o||n.jsx(Is,{className:"h-4 w-4"}),n.jsxs("span",{children:[l," ",r?f:c,s&&` (${A})`]})]});case"text":default:const w={sm:"text-xs",md:"text-sm",lg:"text-base"};return n.jsxs("span",{className:ye("text-muted-foreground flex items-center gap-1",w[e],a),children:[o||n.jsx(Vr,{className:"h-3 w-3"}),r?f:m,s&&` (${A})`]})}})();if(!i)return b;const y=n.jsxs("div",{className:"space-y-2 text-xs",children:[n.jsx("div",{className:"font-medium",children:f}),n.jsxs("div",{className:"space-y-1 text-muted-foreground",children:[n.jsxs("div",{children:["Timezone: ",c]}),n.jsxs("div",{children:["Abbreviation: ",m]}
1264),n.jsxs("div",{children:["UTC Offset: ",A]}),v&&n.jsx("div",{className:"text-orange-500",children:"🌞 Daylight Saving Time is active"})]})]});return n.jsx(Ya,{children:n.jsxs(Hs,{children:[n.jsx(zs,{asChild:!0,children:n.jsx("div",{className:"cursor-help",children:b})}),n.jsx(Vn,{children:y})]})})}function IF({date:e,timezones:t=xc.slice(0,6).map(f=>f.value),teamMembers:r,showBusinessHours:s=!0,showWarnings:a=!0,maxTimezones:i=8,size:o="md",trigger:l,showAbbreviations:c=!0,showOffsets:d=!0,className:u,side:h="top",disabled:m=!1}){const f=g.useMemo(()=>{const j=t.slice(0,i);return r0(e,j,r)},[e,t,r,i]),p=g.useMemo(()=>{const j=f.filter(C=>C.isBusinessHours).length,N=f.filter(C=>C.isWeekend).length,_=f.filter(C=>C.warningLevel==="warning").length,S=f.filter(C=>C.warningLevel==="caution").length;return{total:f.length,businessHoursCount:j,weekendCount:N,warningCount:_,cautionCount:S,businessHoursRatio:f.length>0?j/f.length:0}},[f]),v={sm:{text:"text-xs",spacing:"space-y-1",padding:"p-2",maxWidth:"max-w-xs"},md:{text:"text-sm",spacing:"space-y-2",padding:"p-3",maxWidth:"max-w-sm"},lg:{text:"text-sm",spacing:"space-y-3",padding:"p-4",maxWidth:"max-w-md"}}[o],x=n.jsxs("div",{className:ye("cursor-help inline-flex items-center gap-1",u),children:[n.jsx(Vr,{className:"h-4 w-4 text-muted-foreground"}),n.jsxs("span",{className:"text-sm text-muted-foreground",children:[f.length," timezone",f.length!==1?"s":""]})]});if(m)return l||x;const b=j=>{const N=()=>{if(!a)return null;switch(j.warningLevel){case"warning":return n.jsx(hn,{className:"h-3 w-3 text-amber-500"});case"caution":return n.jsx(qi,{className:"h-3 w-3 text-blue-500"});default:return s&&j.isBusinessHours?n.jsx(qt,{className:"h-3 w-3 text-green-500"}):null}},_=()=>{const S=r==null?void 0:r.find(E=>E.timezone===j.timezone);if(S!=null&&S.name)return S.name;const C=xc.find(E=>E.value===j.timezone);return(C==null?void 0:C.label)||j.displayName};return n.jsxs("div",{className:"flex items-center justify-between gap-3 py-1",children:[n.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[N(),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"font-medium truncate",children:_()}),(c||d)&&n.jsxs("div",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[c&&n.jsx("span",{children:j.abbreviation}),c&&d&&n.jsx("span",{children:"•"}),d&&n.jsx("span",{children:j.offset})]})]})]}),n.jsxs("div",{className:"text-right",children:[n.jsx("div",{className:"font-semibold",children:j.formatted}),a&&j.warningMessage&&n.jsx("div",{className:"text-xs text-muted-foreground",children:j.warningMessage})]})]},j.timezone)},y=()=>{if(!s&&!a)return null;const j=()=>p.warningCount>0?"text-amber-600":p.businessHoursRatio>=.8?"text-green-600":p.businessHoursRatio>=.5?"text-blue-600":"text-muted-foreground",N=()=>p.businessHoursRatio===1?"Perfect for all timezones":p.businessHoursRatio>=.8?"Good for most timezones":p.businessHoursRatio>=.5?"Acceptable for some timezones":p.weekendCount>p.total/2?"Weekend for most timezones":"Challenging for most timezones";return n.jsxs("div",{className:"border-b pb-2 mb-2",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(sb,{className:"h-4 w-4 text-muted-foreground"}),n.jsx("span",{className:"font-medium",children:"Global Time"})]}),n.jsxs(Be,{variant:"secondary",className:ye("text-xs",j()),children:[p.businessHoursCount,"/",p.total," business hours"]})]}),(p.warningCount>0||p.weekendCount>0)&&n.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:N()})]})},w=n.jsx("div",{className:ye(v.maxWidth,v.padding),children:n.jsxs("div",{className:ye(v.text,v.spacing),children:[y(),n.jsx("div",{className:"space-y-1",children:f.map(j=>b(j))}),t.length>i&&n.jsxs("div",{className:"pt-2 mt-2 border-t text-xs text-muted-foreground text-center",children:["+",t.length-i," more timezone",t.length-i!==1?"s":""]})]})});return n.jsx(Ya,{children:n.jsxs(Hs,{children:[n.jsx(zs,{asChild:!0,children:l||x}),n.jsx(Vn,{side:h,className:"border-none shadow-lg",children:n.jsx(Te,{className:"border-0 shadow-none",children:w})})]})})}function QKe({date:e,timezones:t,teamMembers:r,className:s,...a}){const i=g.useMemo(()=>{const u=(t||xc.slice(0,4).map(h=>h.value)).slice(0,4);return r0(e,u,r)},[e,t,r]),o=i.filter(u=>u.isBusinessHours).length,l=i.filter(u=>u.warningLevel==="warning").length,c=()=>l>0?"bg-amber-500":o===i.length?"bg-green-500":o>=i.length/2?"bg-blue-500":"bg-gray-400",d=n.jsxs("div",{className:ye("inl
1264ine-flex items-center gap-1 cursor-help",s),children:[n.jsx("div",{className:ye("w-2 h-2 rounded-full",c())}),n.jsxs("span",{className:"text-xs text-muted-foreground",children:[i.length,"TZ"]})]});return n.jsx(IF,{date:e,timezones:t,teamMembers:r,size:"sm",trigger:d,...a})}function HKe(e={}){const{defaultTimezones:t=xc.slice(0,3).map(v=>v.value)}=e,[r,s]=g.useState([]),[a]=g.useState(!1),[i]=g.useState(null);g.useEffect(()=>{const v=t.map((x,b)=>{var y;return{id:`default-${b}`,timezone:x,name:((y=xc.find(w=>w.value===x))==null?void 0:y.label)||x}});s(v)},[t]);const o=g.useCallback(async v=>{const x={id:`local-${Date.now()}`,name:v.name,timezone:v.timezone,workingHours:v.workingHours};s(b=>[...b,x])},[]),l=g.useCallback(async(v,x)=>{s(b=>b.map(y=>y.id===v?{...y,...x}:y))},[]),c=g.useCallback(async v=>{s(x=>x.filter(b=>b.id!==v))},[]),d=g.useCallback(async()=>{},[]),u=g.useCallback(v=>{const x=r.map(b=>b.timezone);return r0(v,x,r)},[r]),h=g.useCallback(v=>{const x=r.map(b=>b.timezone);return aK(v,x)},[r]),m=g.useCallback((v,x={})=>{const b=r.map(y=>y.timezone);return jI(v,b,x)},[r]),f=g.useMemo(()=>[...new Set(r.map(v=>v.timezone))],[r]),p=g.useMemo(()=>f.length>1,[f]),A=g.useMemo(()=>{const v=xc.map(x=>x.value);return v.filter(x=>f.includes(x)||f.some(b=>{const y=v.indexOf(x),w=v.indexOf(b);return y>=0&&w>=0&&Math.abs(y-w)<=2}))},[f]);return g.useMemo(()=>({teamMembers:r,isLoading:a,error:i,addTeamMember:o,updateTeamMember:l,removeTeamMember:c,refreshTeamMembers:d,convertForTeam:u,getTeamSchedulingRecommendations:h,suggestTeamMeetingTimes:m,teamTimezones:f,isGlobalTeam:p,relevantBusinessTimezones:A}),[r,a,i,o,l,c,d,u,h,m,f,p,A])}function zKe(){const e=g.useCallback(s=>{const a=xc.map(i=>i.value);return r0(s,a)},[]),t=g.useCallback(s=>{const a=xc.map(i=>i.value);return aK(s,a)},[]),r=g.useCallback((s,a={})=>{const i=xc.map(o=>o.value);return jI(s,i,a)},[]);return g.useMemo(()=>({businessTimezones:xc,convertForBusinessTimezones:e,getBusinessSchedulingRecommendations:t,suggestBusinessMeetingTimes:r}),[e,t,r])}function Uh({date:e,format:t,showTimezone:r=!0,showRelative:s=!1,relativeMode:a="smart",relativeContext:i="normal",relativeOptions:o={},showTooltip:l=!0,size:c="sm",className:d,showIcon:u=!1,icon:h,dateOnly:m=!1,timeOnly:f=!1,preferRelative:p=!1,showGlobalTimezones:A=!1,teamId:v,globalTimezones:x,showBusinessHours:b=!0,globalTooltipType:y="full",maxGlobalTimezones:w=6}){const{formatDate:j,formatTime:N,getAbbreviation:_,getDisplayName:S,timezone:C,isLoading:E}=Gl(),{teamMembers:T,isGlobalTeam:B}=HKe({});if(E)return n.jsxs("div",{className:ye("text-muted-foreground animate-pulse flex items-center gap-1",d),children:[u&&(h||n.jsx(Vr,{className:"h-3 w-3"})),n.jsx("span",{children:"Loading..."})]});const L=typeof e=="string"?new Date(e):e,P=_(L),F=S(),M=()=>f?N(L):m?j(L,"MMM dd, yyyy"):t?j(L,t):j(L),I=()=>{if(!s)return null;switch(a){case"simple":return eb(L,C,o).relative;case"smart":return AB(L,C,o);case"contextual":return nK(L,C,i);default:return AB(L,C,o)}},$=M(),V=I(),R=p&&V,Q=R?V:$,U=R?$:V,D={xs:"text-xs",sm:"text-sm",md:"text-base",lg:"text-lg"},q=()=>u?h||(A?n.jsx(Is,{className:"h-3 w-3"}):f?n.jsx(Vr,{className:"h-3 w-3"}):n.jsx(Kn,{className:"h-3 w-3"})):null,G=n.jsxs("div",{className:ye("flex items-center gap-1",D[c],d),children:[q(),n.jsxs("span",{className:"flex items-center gap-1",children:[n.jsx("span",{className:R?"font-medium text-primary":"",children:Q}),U&&n.jsxs("span",{className:"text-muted-foreground text-xs",children:["(",U,")"]}),r&&n.jsx("span",{className:"text-muted-foreground",children:P})]})]});if(!l)return G;if(A){const ne=x||(B?T.map(ae=>ae.timezone):void 0);return y==="compact"?n.jsx(QKe,{date:L,timezones:ne,teamMembers:T,showBusinessHours:b,maxTimezones:w,className:"cursor-help"}):n.jsx(IF,{date:L,timezones:ne,teamMembers:T,showBusinessHours:b,maxTimezones:w,trigger:n.jsx("div",{className:"cursor-help",children:G})})}const K=(()=>{if(!s)return null;const ne=eb(L,C,o);return{relative:ne.relative,isPast:ne.isPast,unit:ne.unit,value:ne.value,diffMs:ne.diffMs}})(),X=n.jsxs("div",{className:"space-y-2 text-xs",children:[n.jsx("div",{className:"font-medium",children:j(L,"EEEE, MMMM dd, yyyy 'at' h:mm a")}),n.jsxs("div",{className:"space-y-1 text-muted-foreground",children:[n.jsxs("div",{children:["Timezone: ",F]}),n.jsxs("div",{children:["Code: ",P]}),n.jsxs("div",{children:["UTC: ",L.toISOString()]}
1264),!f&&n.jsxs("div",{children:["Local browser: ",L.toLocaleString()]}),K&&n.jsxs("div",{className:"border-t pt-1 mt-1",children:[n.jsx("div",{className:"text-xs font-medium mb-1",children:"Relative Time Info:"}),n.jsxs("div",{children:["Display: ",K.relative]}),n.jsxs("div",{children:["Direction: ",K.isPast?"Past":"Future"]}),n.jsxs("div",{children:["Primary unit: ",K.unit]}),K.value!==0&&n.jsxs("div",{children:["Value: ",Math.abs(K.value)," ",K.unit]}),n.jsxs("div",{children:["Difference: ",Math.abs(K.diffMs/1e3).toFixed(0)," seconds"]}),n.jsxs("div",{children:["Mode: ",a]}),a==="contextual"&&n.jsxs("div",{children:["Context: ",i]})]})]})]});return n.jsx(Ya,{children:n.jsxs(Hs,{children:[n.jsx(zs,{asChild:!0,children:n.jsx("div",{className:"cursor-help",children:G})}),n.jsx(Vn,{children:X})]})})}function ey({placement:e="inline",showSettingsLink:t=!0,showCurrentTime:r=!1,className:s,compact:a=!1,message:i="All times are displayed in",isDismissible:o=!1,onDismiss:l}){const c=xr(),{getDisplayName:d,getAbbreviation:u,getCurrentTime:h,formatTime:m,isLoading:f}=Gl();if(f)return n.jsx("div",{className:ye("text-muted-foreground animate-pulse",x()),children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Is,{className:"h-4 w-4"}),n.jsx("span",{className:"text-sm",children:"Loading timezone..."})]})});const p=d(),A=u(),v=r?h():null;function x(){const y="flex items-center justify-between gap-4";switch(e){case"header":return ye(y,"px-4 py-2 bg-muted/30 border-b text-sm",s);case"footer":return ye(y,"px-4 py-3 bg-muted/50 border-t text-xs text-muted-foreground",s);case"sidebar":return ye("p-3 border rounded-lg bg-card text-xs",s);case"inline":default:return ye("flex items-center gap-2 text-sm text-muted-foreground",s)}}const b=()=>{c("/profile")};return a?n.jsxs("div",{className:x(),children:[n.jsx("div",{className:"flex items-center gap-2",children:n.jsx($Ke,{variant:"text",size:"sm",showTooltip:!0,className:"text-xs"})}),t&&n.jsx(te,{variant:"ghost",size:"sm",onClick:b,className:"h-6 px-2 text-xs",children:n.jsx(fs,{className:"h-3 w-3"})})]}):!a&&e==="header"?n.jsxs("div",{className:ye("flex flex-col items-center gap-3 px-4 py-3 bg-muted/30 border-b text-sm text-center",s),children:[n.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-3 text-sm font-medium text-foreground",children:[n.jsxs(Be,{variant:"outline",className:"text-xs px-3 py-1",children:["Times in ",A]}),r&&v&&n.jsxs("span",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[n.jsx(Vr,{className:"h-3 w-3"}),n.jsxs("span",{children:["Current time: ",m(v)]})]})]}),n.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-2 text-xs text-muted-foreground",children:[t&&n.jsxs(te,{variant:"ghost",size:"sm",onClick:b,className:"text-xs px-3 h-7",children:[n.jsx(fs,{className:"h-3 w-3 mr-1"}),"Change Timezone"]}),o&&l&&n.jsx(te,{variant:"ghost",size:"sm",onClick:l,className:"text-xs px-3 h-7",children:"×"})]})]}):n.jsxs("div",{className:x(),children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Is,{className:"h-4 w-4 text-muted-foreground"}),n.jsxs("span",{className:"text-sm",children:[i," ",n.jsx("span",{className:"font-medium",children:p})]}),n.jsx(Be,{variant:"outline",className:"text-xs",children:A})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[r&&v&&n.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground border-l pl-3",children:[n.jsx(Vr,{className:"h-3 w-3"}),n.jsxs("span",{children:["Current time: ",m(v)]})]}),t&&n.jsxs(te,{variant:"ghost",size:"sm",onClick:b,className:"text-xs",children:[n.jsx(fs,{className:"h-3 w-3 mr-1"}),"Change Timezone"]}),o&&l&&n.jsx(te,{variant:"ghost",size:"sm",onClick:l,className:"text-xs",children:"×"})]})]})}var hS="Tabs",[VKe]=Ki(hS,[M_]),$te=M_(),[GKe,OF]=VKe(hS),Qte=g.forwardRef((e,t)=>{const{__scopeTabs:r,value:s,onValueChange:a,defaultValue:i,orientation:o="horizontal",dir:l,activationMode:c="automatic",...d}=e,u=Xg(l),[h,m]=lo({prop:s,onChange:a,defaultProp:i??"",caller:hS});return n.jsx(GKe,{scope:r,baseId:tf(),value:h,onValueChange:m,orientation:o,dir:u,activationMode:c,children:n.jsx(sr.div,{dir:u,"data-orientation":o,...d,ref:t})})});Qte.displayName=hS;var Hte="TabsList",zte=g.forwardRef((e,t)=>
1264{const{__scopeTabs:r,loop:s=!0,...a}=e,i=OF(Hte,r),o=$te(r);return n.jsx(qG,{asChild:!0,...o,orientation:i.orientation,dir:i.dir,loop:s,children:n.jsx(sr.div,{role:"tablist","aria-orientation":i.orientation,...a,ref:t})})});zte.displayName=Hte;var Vte="TabsTrigger",Gte=g.forwardRef((e,t)=>{const{__scopeTabs:r,value:s,disabled:a=!1,...i}=e,o=OF(Vte,r),l=$te(r),c=Wte(o.baseId,s),d=Yte(o.baseId,s),u=s===o.value;return n.jsx(KG,{asChild:!0,...l,focusable:!a,active:u,children:n.jsx(sr.button,{type:"button",role:"tab","aria-selected":u,"aria-controls":d,"data-state":u?"active":"inactive","data-disabled":a?"":void 0,disabled:a,id:c,...i,ref:t,onMouseDown:yt(e.onMouseDown,h=>{!a&&h.button===0&&h.ctrlKey===!1?o.onValueChange(s):h.preventDefault()}),onKeyDown:yt(e.onKeyDown,h=>{[" ","Enter"].includes(h.key)&&o.onValueChange(s)}),onFocus:yt(e.onFocus,()=>{const h=o.activationMode!=="manual";!u&&!a&&h&&o.onValueChange(s)})})})});Gte.displayName=Vte;var qte="TabsContent",Kte=g.forwardRef((e,t)=>{const{__scopeTabs:r,value:s,forceMount:a,children:i,...o}=e,l=OF(qte,r),c=Wte(l.baseId,s),d=Yte(l.baseId,s),u=s===l.value,h=g.useRef(u);return g.useEffect(()=>{const m=requestAnimationFrame(()=>h.current=!1);return()=>cancelAnimationFrame(m)},[]),n.jsx(xo,{present:a||u,children:({present:m})=>n.jsx(sr.div,{"data-state":u?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":c,hidden:!m,id:d,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:h.current?"0s":void 0},children:m&&i})})});Kte.displayName=qte;function Wte(e,t){return`${e}-trigger-${t}`}function Yte(e,t){return`${e}-content-${t}`}var Jte=Qte,fS=zte,mS=Gte,pS=Kte;const Cs=Jte,ps=g.forwardRef(({className:e,...t},r)=>n.jsx(fS,{ref:r,className:ye("inline-flex items-center justify-center rounded-lg bg-muted p-0.5 text-muted-foreground/70",e),...t}));ps.displayName=fS.displayName;const pt=g.forwardRef(({className:e,...t},r)=>n.jsx(mS,{ref:r,className:ye("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1.5 text-sm font-medium outline-offset-2 transition-all hover:text-muted-foreground focus-visible:outline focus-visible:outline-2 focus-visible:outline-ring/70 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm data-[state=active]:shadow-black/5",e),...t}));pt.displayName=mS.displayName;const Ct=g.forwardRef(({className:e,...t},r)=>n.jsx(pS,{ref:r,className:ye("mt-2 outline-offset-2 focus-visible:outline focus-visible:outline-2 focus-visible:outline-ring/70",e),...t}));Ct.displayName=pS.displayName;const qKe=e=>{var t;try{if(e.image_url)return e.image_url;if(e.thumbnail_url)return e.thumbnail_url;if(e.content_json){const r=typeof e.content_json=="string"?JSON.parse(e.content_json):e.content_json;if(r.image_url)return r.image_url;if(r.thumbnail_url)return r.thumbnail_url;if(r.images&&Array.isArray(r.images)&&r.images.length>0)return r.images[0];if(r.media&&Array.isArray(r.media)){const s=r.media.find(a=>a.type==="image");if(s!=null&&s.url)return s.url}}if(e.content&&typeof e.content=="string")try{const r=JSON.parse(e.content);if(r.image_url)return r.image_url;if(r.thumbnail_url)return r.thumbnail_url;if(((t=r.media)==null?void 0:t.length)>0){const s=r.media.find(a=>{var i;return a.type==="image"||((i=a.url)==null?void 0:i.match(/\.(jpg|jpeg|png|gif|webp)$/i))});if(s!=null&&s.url)return s.url}}catch{}}catch(r){console.error("Error extracting image from content:",r)}return null},KKe=e=>{var t;try{if(e.video_url)return!0;if(e.content_json){const r=typeof e.content_json=="string"?JSON.parse(e.content_json):e.content_json;if(r.video_url)return!0;if(r.media&&Array.isArray(r.media))return r.media.some(s=>s.type==="video")}if(e.content&&typeof e.content=="string")try{const r=JSON.parse(e.content);if(r.video_url)return!0;if(((t=r.media)==null?void 0:t.length)>0)return r.media.some(s=>{var a;return s.type==="video"||((a=s.url)==null?void 0:a.match(/\.(mp4|mov|avi|webm)$/i))})}catch{}}catch(r){console.error("Error checking for video in content:",r)}return!1},WKe=e=>{try{if(e.text_preview)return e.text_preview;
1264if(e.content_json){const t=typeof e.content_json=="string"?JSON.parse(e.content_json):e.content_json;if(t.content){const r=t.content.replace(/<[^>]*>/g,"").trim();if(r)return r.length>300?r.substring(0,297)+"...":r}if(t.caption)return t.caption.length>300?t.caption.substring(0,297)+"...":t.caption;if(t.text)return t.text.length>300?t.text.substring(0,297)+"...":t.text;if(t.posts&&Array.isArray(t.posts)&&t.posts.length>0){const r=t.posts[0];if(r.text)return r.text.length>300?r.text.substring(0,297)+"...":r.text;if(r.caption)return r.caption.length>300?r.caption.substring(0,297)+"...":r.caption}}if(e.content&&typeof e.content=="string")try{const t=JSON.parse(e.content);if(t.text)return t.text.length>300?t.text.substring(0,297)+"...":t.text;if(t.caption)return t.caption.length>300?t.caption.substring(0,297)+"...":t.caption;if(t.content){const r=t.content.replace(/<[^>]*>/g,"").trim();if(r)return r.length>300?r.substring(0,297)+"...":r}}catch{}}catch(t){console.error("Error extracting text preview from content:",t)}return null},YKe=e=>({BLOG_POST:"Blog Post",SOCIAL_MEDIA:"Social Media",EMAIL:"Email",VIDEO:"Video",PODCAST:"Podcast",INFOGRAPHIC:"Infographic",LANDING_PAGE:"Landing Page",AD:"Advertisement",PRESENTATION:"Presentation",CONTENT:"Content"})[e]||e,FF=({contents:e,loading:t=!1,onContentClick:r,title:s,description:a,emptyMessage:i="No content available",showCampaign:o=!1})=>{const l=()=>"grid grid-cols-1 md:grid-cols-2 gap-3 md:gap-4";return t?n.jsxs("div",{className:"space-y-4",children:[s&&n.jsxs("div",{children:[n.jsx(Lt,{className:"h-7 w-48 mb-2"}),a&&n.jsx(Lt,{className:"h-4 w-96"})]}),n.jsx("div",{className:l(),children:[...Array(6)].map((c,d)=>n.jsxs(Te,{className:"overflow-hidden border-blue-200/50 bg-gradient-to-br from-white via-blue-50/20 to-indigo-50/30",children:[n.jsx(Lt,{className:"h-40 w-full"}),n.jsxs("div",{className:"p-4 space-y-2",children:[n.jsx(Lt,{className:"h-4 w-3/4"}),n.jsx(Lt,{className:"h-3 w-full"}),n.jsx(Lt,{className:"h-3 w-2/3"}),n.jsx("div",{className:"flex gap-2 mt-3",children:n.jsx(Lt,{className:"h-5 w-16"})}),n.jsx(Lt,{className:"h-8 w-full mt-3"})]})]},d))})]}):!e||e.length===0?n.jsxs("div",{className:"space-y-4",children:[s&&n.jsxs("div",{children:[n.jsx("h3",{className:"text-lg font-semibold text-gray-900",children:s}),a&&n.jsx("p",{className:"text-sm text-gray-600 mt-1",children:a})]}),n.jsx("div",{className:"flex items-center justify-center py-8 px-4 bg-gradient-to-br from-white via-blue-50/20 to-indigo-50/30 rounded-xl border border-blue-200/50 shadow-sm",children:n.jsxs("div",{className:"text-center max-w-md",children:[n.jsx(mr,{className:"h-10 w-10 text-blue-400 mx-auto mb-3"}),n.jsx("p",{className:"text-sm text-gray-600",children:i})]})})]}):n.jsxs("div",{className:"space-y-4",children:[s&&n.jsxs("div",{children:[n.jsx("h3",{className:"text-lg font-semibold text-gray-900",children:s}),a&&n.jsx("p",{className:"text-sm text-gray-600 mt-1",children:a})]}),n.jsx("div",{className:l(),children:e.map(c=>{const d=qKe(c),u=KKe(c),h=WKe(c),m=hu(c.platform||c.platform_key);return n.jsxs("div",{className:"group relative bg-gradient-to-br from-white via-blue-50/20 to-indigo-50/30 rounded-xl shadow-sm hover:shadow-xl transition-all duration-300 overflow-hidden cursor-pointer flex flex-col border border-blue-200/50",onClick:()=>r==null?void 0:r(c),children:[d||u?n.jsxs("div",{className:"relative h-40 overflow-hidden rounded-t-xl bg-gradient-to-br from-gray-100 to-gray-200",children:[d?n.jsxs(n.Fragment,{children:[n.jsx("img",{src:d,alt:c.title||c.name||"Content",className:"w-full h-full object-cover group-hover:scale-110 transition-transform duration-700",onError:f=>{const p=f.currentTarget;p.style.display="none";const A=p.parentElement;A&&(A.classList.add("flex","items-center","justify-center"),A.innerHTML='<div class="p-4 bg-white/80 backdrop-blur-sm rounded-xl shadow-sm"><svg class="h-8 w-8 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"></path></svg></div>')}}),u&&n.jsx("div",{className:"absolute top-3 right-3 p-2 bg-black/50 backdrop-blur-sm rounded-full",children:n.jsx(fi,{className:"h-4 w-4 text-white"})})]}):u?n.jsx("div",{className:"flex items-center justify-center h-full bg-gradient-to-br from-purple-100 to-blue-200",children:n.jsx("div",{className:"p-4 bg-white/80 backdrop-blur-sm rounded-xl shadow-sm",children:n.jsx(fi,{className:"h-8 w-8 text-purple-600"})})}):null,n.jsx("div",{className:"absolute top-3 left-3 flex gap-2",children:c.display_status==="ARCHIVED"?n.jsx("div",{className:"px-2 py-1 bg-gray-600/90 backdrop-blur-sm rounded-full",children:n.jsxs("span",{className:"text-white text-xs font-medium flex items-center gap-1",children:[n.jsx(rb,{className:"h-3 w-3"})," Archived"]})}):c.display_status==="DELETED"?n.jsx("div",{className:"px-2 py-1 bg-red-600/90 backdrop-blur-sm rounded-full",children:n.jsxs("span",{className:"text-white text-xs font-medium flex items-center gap-1",children:[n.jsx(va,{className:"h-3 w-3"})," Deleted"]})}):c.display_status==="PUBLISHED"||c.is_published?n.jsx("div",{className:"px-2 py-1 bg-green-500/90 backdrop-blur-sm rounded-full",children:n.jsx("span",{className:"text-white text-xs font-medium flex items-center gap-1",children:"✓ Published"})}):c.display_status==="SCHEDULED"||c.is_scheduled?n.jsx("div",{className:"px-2 py-1 bg-orange-500/90 backdrop-blur-sm rounded-full",children:n.jsx("span",{className:"text-white text-xs font-medium flex items-center gap-1",children:"⏰ Scheduled"})}):c.display_status==="PROCESSING"?n.jsx("div",{className:"px-2 py-1 bg-blue-500/90 backdrop-blur-sm rounded-full",children:n.jsx("span",{className:"text-white text-xs font-medium",children:"Publishing..."})}):c.display_status==="FAILED"?n.jsx("div",{className:"px-2 py-1 bg-red-500/90 backdrop-blur-sm rounded-full",children:n.jsx("span",{className:"text-white text-xs font-medium",children:"Failed"})}):c.display_status==="CANCELLED"?n.jsx("div",{className:"px-2 py-1 bg-gray-500/90 backdrop-blur-sm rounded-full",children:n.jsx("span",{className:"text-white text-xs font-medium",children:"Unpublished"})}):c.display_status==="DRAFT"||c.status==="GENERATING"?n.jsx("div",{className:"px-2 py-1 bg-blue-500/90 backdrop-blur-sm rounded-full",children:n.jsx("span",{className:"text-white text-xs font-medium",children:"Draft"})}):c.display_status==="READY"||c.is_ready?n.jsx("div",{className:"px-2 py-1 bg-gray-500/90 backdrop-blur-sm rounded-full",children:n.jsx("span",{className:"text-white text-xs font-medium",children:"Ready"})}):null})]}):n.jsxs("div",{className:"relative h-28 bg-gradient-to-br from-gray-50 to-blue-50 flex items-center justify-center rounded-t-xl",children:[n.jsx("div",{className:"p-4 bg-white/80 backdrop-blur-sm rounded-xl shadow-sm",children:n.jsx(Xr,{className:"h-8 w-8 text-blue-600"})}),n.jsx("div",{className:"absolute top-3 left-3",children:c.display_status==="ARCHIVED"?n.jsx("div",{className:"px-2 py-1 bg-gray-600/90 backdrop-blur-sm rounded-full",children:n.jsxs("span",{className:"text-white text-xs font-medium flex items-center gap-1",children:[n.jsx(rb,{className:"h-3 w-3"})," Archived"]})}):c.display_status==="DELETED"?n.jsx("div",{className:"px-2 py-1 bg-red-600/90 backdrop-blur-sm rounded-full",children:n.jsxs("span",{className:"text-white text-xs font-medium flex items-center gap-1",children:[n.jsx(va,{className:"h-3 w-3"})," Deleted"]})}):c.display_status==="PUBLISHED"||c.is_published?n.jsx("div",{className:"px-2 py-1 bg-green-500/90 backdrop-blur-sm rounded-full",children:n.jsx("span",{className:"text-white text-xs font-medium",children:"✓ Published"})}):c.display_status==="SCHEDULED"||c.is_scheduled?n.jsx("div",{className:"px-2 py-1 bg-orange-500/90 backdrop-blur-sm rounded-full",children:n.jsx("span",{className:"text-white text-xs font-medium",children:"⏰ Scheduled"})}):c.display_status==="PROCESSING"?n.jsx("div",{className:"px-2 py-1 bg-blue-500/90 backdrop-blur-sm rounded-full",children:n.jsx("span",{className:"text-white text-xs font-medium",children:"Publishing..."})}):c.display_status==="FAILED"?n.jsx("div",{className:"px-2 py-1 bg-red-500/90 backdrop-blur-sm rounded-full",children:n.jsx("span",{className:"text-white text-xs font-medium",children:"Failed"})}):c.display_status==="CANCELLED"?n.jsx("div",{className:"px-2 py-1 bg-gray-500/90 backdrop-blur-sm rounded-full",children:n.jsx("span",{className:"text-white text-xs font-medium",children:"Unpublished"})}):c.display_status==="DRAFT"||c.status==="GENERATING"?n.jsx("div",{className:"px-2 py-1 bg-blue-500/90 backdrop-blur-sm rounded-full",children:n.jsx("span",{className:"text-white text-xs font-medium",children:"Draft"})}):c.display_status==="READY"||c.is_ready?n.jsx("div",{className:"px-2 py-1 bg-gray-500/90 backdrop-blur-sm rounded-full",children:n.jsx("span",{className:"text-white text-xs font-medium",children:"Ready"})}):null}),n.jsx("div",{className:"absolute top-3 right-3",children:m})]}),n.jsxs("div",{className:"relative p-4 flex-1 flex flex-col",children:[n.jsx("h3",{className:"text-base font-bold text-gray-900 group-hover:text-blue-700 transition-colors duration-300 line-clamp-2 mb-2",children:c.title||c.name||c.caption||"Untitled Content"}),h&&n.jsx("p",{className:"text-xs text-gray-600 line-clamp-2 mb-2 leading-relaxed",children:h}),n.jsxs("div",{className:"flex flex-wrap items-center gap-2 mb-2",children:[c.content_type&&n.jsx(Be,{className:"bg-gradient-to-r from-blue-500 to-indigo-600 text-white text-xs font-medium shadow-sm",children:YKe(c.content_type)}),!d&&!u&&m&&n.jsx("div",{className:"text-gray-500",children:m})]}),n.jsxs("div",{className:"space-y-2 mb-4 flex-1",children:[o&&c.campaign&&n.jsxs("div",{className:"flex items-center justify-between text-xs",children:[n.jsx("span",{className:"text-gray-600 font-medium",children:"Campaign"}),n.jsx("span",{className:"text-blue-600 font-medium truncate max-w-[100px]",children:c.campaign.name})]}),n.jsxs("div",{className:"flex items-center justify-between text-xs",children:[n.jsx("span",{className:"text-gray-600 font-medium",children:c.is_published?"Published":c.is_scheduled?"Scheduled":"Created"}
1264),n.jsx(Uh,{date:c.effective_publish_time||c.created_at,showRelative:!0,showTimezone:!1,size:"sm",showTooltip:!0,relativeMode:"smart",preferRelative:!0,relativeOptions:{shortFormat:!0,absoluteThreshold:7},className:"text-right max-w-[100px] truncate"})]})]}),n.jsx("button",{className:"w-full px-3 py-2 bg-gradient-to-r from-blue-600 to-indigo-600 hover:from-blue-700 hover:to-indigo-700 text-white font-medium rounded-lg shadow-sm hover:shadow-md transition-all duration-200 text-xs",children:"View/Edit"})]})]},c.id)})})]})},JKe=e=>!e||typeof e!="object"?null:e,XKe=e=>{try{return e?Array.isArray(e)?e.filter(t=>t&&typeof t=="object"&&"url"in t):[]:[]}catch(t){return console.error("Error parsing interesting links:",t),[]}},ZKe=()=>{const{id:e}=Ei(),[t,r]=g.useState(null),[s,a]=g.useState(!1),[i,o]=g.useState(!1),[l,c]=g.useState([]),[d,u]=g.useState(!0),[h,m]=g.useState(!0),[f,p]=g.useState(!1),A=xr(),{isAdmin:v}=rp(),{toast:x}=sn(),b=["Used","Unused","Unranked","Archived"],y=t?JKe(t.metadata):null;g.useEffect(()=>{w(),j()},[e]);const w=async()=>{if(e)try{m(!0);const{data:C,error:E}=await de.from("convergences").select(`
1265                    *,
1266                    brands!inner (
1267                        id,
1268                        brand_name
1269                    ),
1270                    news_contents (
1271                        id,
1272                        name,
1273                        description,
1274                        trend_analysis,
1275                        primary_keyword,
1276                        months_till_peak,
1277                        total_duration_in_months,
1278                        virality_score,
1279                        virality_explanation,
1280                        comparable_trends,
1281                        business_opportunities_analysis,
1282                        audience_and_brand_analysis,
1283                        raw_headline,
1284                        raw_content,
1285                        longevity_in_days,
1286                        authoritative_urls,
1287                        interesting_links
1288                    )
1289                `).eq("id",e).single();if(E)throw E;C&&r(C)}catch(C){console.error("Error fetching convergence details:",C),x({title:"Error",description:"Failed to load convergence details",variant:"destructive"})}finally{m(!1)}},j=async()=>{if(e)try{u(!0);const{data:C,error:E}=await de.from("content_management_view").select("*").eq("convergence_id",e).order("created_at",{ascending:!1});if(E)throw E;c(C||[])}catch(C){console.error("Error fetching related content:",C)}finally{u(!1)}},N=async C=>{if(!(!t||!e||f))try{p(!0);const{error:E}=await de.from("convergences").update({status:C}).eq("id",e);if(E)throw E;r(T=>T?{...T,status:C}:null),x({title:"Status Updated",description:`Convergence status changed to ${C}`})}catch(E){console.error("Error updating convergence status:",E),x({title:"Error",description:"Failed to update convergence status",variant:"destructive"})}finally{p(!1)}},_=C=>Object.entries(C).map(([E,T])=>`${E}:
1290${typeof T=="object"?JSON.stringify(T,null,2):String(T)}
1291
1292`).join(""),S=async()=>{if(t)try{const C=_(t);await navigator.clipboard.writeText(C),o(!0),x({title:"Copied to clipboard",description:"Raw convergence data has been copied to clipboard"}),setTimeout(()=>{o(!1)},2e3)}catch(C){console.error("Failed to copy:",C),x({title:"Failed to copy",description:"Could not copy data to clipboard",variant:"destructive"})}};return h?n.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 via-white to-blue-50/30 relative overflow-hidden",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsxs("div",{className:"relative container mx-auto p-6 max-w-7xl space-y-6",children:[n.jsx(Lt,{className:"h-10 w-32"}),n.jsx(Lt,{className:"h-12 w-64"}),n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[n.jsx(Lt,{className:"h-64 rounded-xl"}),n.jsx(Lt,{className:"h-64 rounded-xl"})]}),n.jsx(Lt,{className:"h-96 rounded-xl"})]})]}):t?n.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 via-white to-blue-50/30 relative overflow-hidden",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsxs("div",{className:"relative container mx-auto p-6 max-w-7xl space-y-8",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs(te,{variant:"ghost",onClick:()=>A("/convergences"),className:"group hover:bg-white/70",children:[n.jsx(Yo,{className:"h-4 w-4 mr-2 transition-transform group-hover:-translate-x-1"}),"Back to Convergences"]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Status:"}),n.jsxs(ur,{value:t.status,onValueChange:N,disabled:f,children:[n.jsx(or,{className:"w-32 h-8 text-xs",children:n.jsx(hr,{})}),n.jsx(lr,{children:b.map(C=>n.jsx(Fe,{value:C,className:"text-xs",children:C},C))})]})]}),n.jsx(Be,{variant:t.status==="Used"?"secondary":"default",className:"shadow-sm",children:t.status})]})]}),n.jsxs("div",{className:"relative overflow-hidden bg-gradient-to-br from-white via-blue-50/30 to-indigo-50/40 rounded-2xl border border-blue-200/50 shadow-sm",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsxs("div",{className:"relative h-64 lg:h-80 overflow-hidden",children:[n.jsx("img",{src:t.image_url||I2,alt:t.name,className:"w-full h-full object-cover",onError:C=>{C.currentTarget.src=I2}}),n.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/70 via-black/40 to-transparent"}),n.jsx("div",{className:"absolute bottom-0 left-0 right-0 p-8",children:n.jsx("div",{className:"bg-black/70 p-6 rounded-2xl backdrop-blur-md",children:n.jsxs("div",{className:"flex items-center gap-4",children:[n.jsx("div",{className:"p-3 bg-white/90 backdrop-blur-sm rounded-2xl shadow-lg",children:n.jsx(mr,{className:"h-8 w-8 text-blue-600"})}),n.jsxs("div",{children:[n.jsx("h1",{className:"text-4xl font-bold text-white mb-2",style:{color:"white"},children:t.name}),n.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx(Kn,{className:"h-4 w-4",style:{color:"white"}}),n.jsx("span",{className:"font-medium",style:{color:"white"},children:new Date(t.created_at).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})})]}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx(ui,{className:"h-4 w-4",style:{color:"white"}}),n.jsx("span",{className:"font-medium",style:{color:"white"},children:t.brands.brand_name})]}),t.expiration_date&&n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx(Kn,{className:"h-4 w-4",style:{color:"white"}}),n.jsxs("span",{className:"font-medium",style:{color:"white"},children:["Expires: ",new Date(t.expiration_date).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})]})]})]})]})]})})})]})]}),n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6 mb-6",children:[t.power_score&&n.jsxs(Te,{className:"bg-white rounded-lg border shadow-sm overflow-hidden",children:[n.jsx("div",{className:"p-4 border-b bg-gradient-to-r from-amber-50 to-orange-50",children:n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-10 h-10 bg-gradient-to-br from-amber-500 to-orange-600 rounded-full flex items-center justify-center shadow-lg",children:n.jsx(en,{className:"h-5 w-5 text-white"})}),n.jsxs("div",{children:[n.jsx("h2",{className:"text-lg font-semibold text-amber-900",children:"Power Score"}),n.jsx("p",{className:"text-sm text-amber-700",children:"Overall convergence strength"})]})]})}),n.jsx("div",{className:"p-6",children:n.jsxs("div",{className:"flex flex-col md:flex-row gap-4 items-center",children:[n.jsxs("div",{className:"relative w-32 h-32",children:[n.jsxs("svg",{className:"w-full h-full transform -rotate-90",children:[n.jsx("circle",{cx:"64",cy:"64",r:"56",fill:"none",stroke:"#E5E7EB",strokeWidth:"10",className:"opacity-25"}),n.jsx("circle",{cx:"64",cy:"64",r:"56",fill:"none",stroke:"url
1292(#powerGradient)",strokeWidth:"10",strokeLinecap:"round",strokeDasharray:`${(t.power_score||0)*3.52} 352`}),n.jsx("defs",{children:n.jsxs("linearGradient",{id:"powerGradient",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[n.jsx("stop",{offset:"0%",stopColor:"#F59E0B"}),n.jsx("stop",{offset:"100%",stopColor:"#DC2626"})]})})]}),n.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:n.jsx("span",{className:"text-4xl font-bold bg-gradient-to-r from-amber-600 to-orange-600 bg-clip-text text-transparent",children:t.power_score})})]}),(t.virality_score||t.relevance_score||t.interest_to_audience_score||t.crossover_potential_score)&&n.jsxs("div",{className:"flex-1 h-64 w-full",children:[n.jsx("h3",{className:"text-sm font-medium text-center text-gray-600 mb-2",children:"Score Breakdown"}),n.jsx(Sl,{width:"100%",height:"90%",children:n.jsxs(DKe,{cx:"50%",cy:"50%",outerRadius:"80%",data:[{subject:"Virality",score:t.virality_score||0,fullMark:10},{subject:"Relevance",score:t.relevance_score||0,fullMark:10},{subject:"Interest",score:t.interest_to_audience_score||0,fullMark:10},{subject:"Crossover",score:t.crossover_potential_score||0,fullMark:10}].filter(C=>t.virality_score&&C.subject==="Virality"||t.relevance_score&&C.subject==="Relevance"||t.interest_to_audience_score&&C.subject==="Interest"||t.crossover_potential_score&&C.subject==="Crossover"),children:[n.jsx(Fee,{stroke:"#e5e7eb"}),n.jsx(j0,{dataKey:"subject",tick:{fill:"#6b7280",fontSize:12}}),n.jsx(w0,{angle:30,domain:[0,10],tick:{fill:"#6b7280",fontSize:10}}),n.jsx(zy,{name:"Score",dataKey:"score",stroke:"#F59E0B",fill:"#F59E0B",fillOpacity:.6,dot:{fill:"#F59E0B",strokeWidth:0}}),n.jsx(Mi,{wrapperStyle:{fontSize:12,marginTop:"10px"}})]})})]})]})}),n.jsx("div",{className:"h-2 bg-gradient-to-r from-amber-200 via-orange-200 to-red-200"})]}),n.jsxs(Te,{className:"bg-white rounded-lg border shadow-sm overflow-hidden",children:[n.jsx("div",{className:"p-4 border-b bg-gradient-to-r from-blue-50 to-indigo-50",children:n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-10 h-10 bg-gradient-to-br from-blue-500 to-indigo-600 rounded-full flex items-center justify-center shadow-lg",children:n.jsx(ui,{className:"h-5 w-5 text-white"})}),n.jsxs("div",{children:[n.jsx("h2",{className:"text-lg font-semibold text-blue-900",children:"Related Content"}),n.jsx("p",{className:"text-sm text-blue-700",children:"Content using this convergence"})]})]}),n.jsxs(te,{onClick:()=>A(`/content/create?convergenceId=${t.id}&brandId=${t.brands.id}`),className:"bg-gradient-to-r from-blue-600 to-indigo-600 hover:from-blue-700 hover:to-indigo-700 text-white shadow-sm sm:ml-auto",children:[n.jsx(al,{className:"h-4 w-4 mr-2"}),"Create Content"]})]})}),n.jsx("div",{className:"p-6",children:n.jsx(FF,{contents:l,loading:d,emptyMessage:"No content has been created for this convergence yet",onContentClick:C=>A(`/content/${C.id}`),showCampaign:!0})}),n.jsx("div",{className:"h-2 bg-gradient-to-r from-blue-200 via-indigo-200 to-purple-200"})]})]}),n.jsxs(Te,{className:"bg-white rounded-lg border shadow-sm overflow-hidden mb-6",children:[n.jsx("div",{className:"p-4 border-b bg-gradient-to-r from-purple-50 to-violet-50",children:n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-10 h-10 bg-gradient-to-br from-purple-500 to-violet-600 rounded-full flex items-center justify-center shadow-lg",children:n.jsx(sa,{className:"h-5 w-5 text-white"})}),n.jsxs("div",{children:[n.jsx("h2",{className:"text-lg font-semibold text-purple-900",children:"Trend Information"}),n.jsx("p",{className:"text-sm text-purple-700",children:"Key trend details and analysis"})]})]})}),n.jsxs("div",{className:"p-6",children:[n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"font-medium mb-2",children:"Trend"}),n.jsx("p",{children:t.trend})]}),n.jsxs("div",{children:[n.jsx("h3",{className:"font-medium mb-2",children:"Trend Description"}),n.jsx("p",{children:t.trend_description})]})]}),t.news_contents&&n.jsxs("div",{className:"mt-6",children:[n.jsxs(te,{variant:"outline",onClick:()=>a(!s),className:"w-full justify-between",children:[n.jsx("span",{children:"Related News Content Details"}),n.jsx(_s,{className:`h-4 w-4 transform transition-transform ${s?"rotate-90":""}`})]}),s&&n.jsxs("div",{className:"mt-4 space-y-4",children:[t.news_contents.authoritative_urls&&n.jsxs("div",{children:[n.jsx("h3",{className:"font-medium mb-2",children:"Authoritative Sources"}),n.jsx("div",{className:"space-y-2",children:Array.isArray(t.news_contents.authoritative_urls)&&t.news_contents.authoritative_urls.map((C,E)=>n.jsxs("div",{className:"flex items-center",children:[n.jsx(Vs,{className:"h-4 w-4 text-blue-500 mr-2 flex-shrink-0"}),n.jsx("a",{href:C.url,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-blue-500 hover:underline truncate",children:C.title||
1292C.url})]},E))})]}),(()=>{const C=XKe(t.news_contents.interesting_links);return C.length>0&&n.jsxs("div",{children:[n.jsx("h3",{className:"font-medium mb-3",children:"Interesting Links"}),n.jsx("div",{className:"space-y-4",children:C.map((E,T)=>n.jsx("div",{className:"bg-muted/30 p-4 rounded-lg border",children:n.jsxs("div",{className:"flex gap-3",children:[E.image&&n.jsx("div",{className:"flex-shrink-0 w-20 h-20",children:n.jsx("img",{src:E.image,alt:E.title||"Content image",className:"w-full h-full object-cover rounded border",onError:B=>{B.target.style.display="none"}})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[E.title&&n.jsx("h4",{className:"font-medium text-sm mb-1 text-foreground line-clamp-2",children:E.title}),n.jsxs("div",{className:"flex items-center gap-1 mb-2",children:[n.jsx(Vs,{className:"h-3 w-3 text-blue-500 flex-shrink-0"}),n.jsx("a",{href:E.url,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-blue-500 hover:underline truncate",children:E.url})]}),n.jsxs("div",{className:"flex gap-2 text-xs text-muted-foreground mb-2",children:[E.author&&n.jsxs("span",{children:["By ",E.author]}),E.publishedDate&&n.jsxs("span",{children:["• ",new Date(E.publishedDate).toLocaleDateString()]})]}),E.contents&&n.jsx("p",{className:"text-xs text-muted-foreground line-clamp-3 leading-relaxed",children:E.contents})]})]})},T))})]})})(),t.news_contents.raw_headline&&n.jsxs("div",{children:[n.jsx("h3",{className:"font-medium mb-2",children:"Original Headline"}),n.jsx("p",{className:"text-sm",children:t.news_contents.raw_headline})]}),t.news_contents.raw_content&&n.jsxs("div",{children:[n.jsx("h3",{className:"font-medium mb-2",children:"Raw Content"}),n.jsx("p",{className:"text-sm",children:t.news_contents.raw_content})]}),t.news_contents.description&&n.jsxs("div",{children:[n.jsx("h3",{className:"font-medium mb-2",children:"Description"}),n.jsx("p",{className:"text-sm",children:t.news_contents.description})]}),t.news_contents.contents&&n.jsxs("div",{children:[n.jsx("h3",{className:"font-medium mb-2",children:"Contents"}),n.jsx("p",{className:"text-sm whitespace-pre-wrap",children:t.news_contents.contents})]}),t.news_contents.images&&n.jsxs("div",{children:[n.jsx("h3",{className:"font-medium mb-2",children:"Images"}),n.jsx("div",{className:"space-y-2",children:(()=>{try{return(Array.isArray(t.news_contents.images)?t.news_contents.images:[]).map((E,T)=>n.jsx("div",{className:"border rounded p-2",children:n.jsx("img",{src:typeof E=="string"?E:(E==null?void 0:E.url)||E,alt:`News content image ${T+1}`,className:"max-w-full h-auto rounded",onError:B=>{B.target.style.display="none"}})},T))}catch{return n.jsx("p",{className:"text-sm text-muted-foreground",children:"Error loading images"})}})()})]}),t.news_contents.trend_analysis&&n.jsxs("div",{children:[n.jsx("h3",{className:"font-medium mb-2",children:"Trend Analysis"}),n.jsx("p",{className:"text-sm",children:t.news_contents.trend_analysis})]}
1292),t.news_contents.business_opportunities_analysis&&n.jsxs("div",{children:[n.jsx("h3",{className:"font-medium mb-2",children:"Business Opportunities"}),n.jsx("p",{className:"text-sm",children:t.news_contents.business_opportunities_analysis})]}),t.news_contents.audience_and_brand_analysis&&n.jsxs("div",{children:[n.jsx("h3",{className:"font-medium mb-2",children:"Audience & Brand Analysis"}),n.jsx("p",{className:"text-sm",children:t.news_contents.audience_and_brand_analysis})]}),n.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.news_contents.months_till_peak&&n.jsxs("div",{children:[n.jsx("h3",{className:"font-medium mb-2",children:"Months Till Peak"}),n.jsx("p",{className:"text-sm",children:t.news_contents.months_till_peak})]}),t.news_contents.total_duration_in_months&&n.jsxs("div",{children:[n.jsx("h3",{className:"font-medium mb-2",children:"Total Duration (Months)"}),n.jsx("p",{className:"text-sm",children:t.news_contents.total_duration_in_months})]}),t.news_contents.longevity_in_days&&n.jsxs("div",{children:[n.jsx("h3",{className:"font-medium mb-2",children:"Longevity (Days)"}),n.jsx("p",{className:"text-sm",children:t.news_contents.longevity_in_days})]})]})]})]})]}),n.jsx("div",{className:"h-2 bg-gradient-to-r from-purple-200 via-violet-200 to-indigo-200"})]}),n.jsxs(Te,{className:"bg-white rounded-lg border shadow-sm overflow-hidden mb-6",children:[n.jsx("div",{className:"p-4 border-b bg-gradient-to-r from-cyan-50 to-teal-50",children:n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-10 h-10 bg-gradient-to-br from-cyan-500 to-teal-600 rounded-full flex items-center justify-center shadow-lg",children:n.jsx(qi,{className:"h-5 w-5 text-white"})}),n.jsxs("div",{children:[n.jsx("h2",{className:"text-lg font-semibold text-cyan-900",children:"Convergence Details"}),n.jsx("p",{className:"text-sm text-cyan-700",children:"In-depth convergence information"})]})]})}),n.jsx("div",{className:"p-6",children:n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"font-medium mb-2",children:"Convergence"}),n.jsx("p",{className:"whitespace-pre-wrap",children:t.convergence})]}),n.jsx(xn,{className:"my-4"}),(y==null?void 0:y.ideas)&&n.jsx(n.Fragment,{children:n.jsxs("div",{className:"space-y-4",children:[y.ideas.unique_insights&&n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[n.jsx(ig,{className:"h-5 w-5 text-amber-500"}),n.jsx("h3",{className:"font-medium",children:"Unique Insights"})]}),n.jsx("p",{className:"whitespace-pre-wrap pl-7",children:y.ideas.unique_insights})]}),y.ideas.brand_opinion&&n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[n.jsx(Cc,{className:"h-5 w-5 text-blue-500"}),n.jsx("h3",{className:"font-medium",children:"Brand Opinion"})]}),n.jsx("p",{className:"whitespace-pre-wrap pl-7",children:y.ideas.brand_opinion})]}),y.ideas.hot_takes&&n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[n.jsx(wK,{className:"h-5 w-5 text-orange-500"}),n.jsx("h3",{className:"font-medium",children:"Hot Takes"})]}),n.jsx("p",{className:"whitespace-pre-wrap pl-7",children:y.ideas.hot_takes})]}),y.ideas.controversial_takes&&n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[n.jsx(hn,{className:"h-5 w-5 text-red-500"}),n.jsx("h3",{className:"font-medium",children:"Controversial Takes"})]}),n.jsx("p",{className:"whitespace-pre-wrap pl-7",children:y.ideas.controversial_takes})]}),t.promo_idea&&n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[n.jsx(en,{className:"h-5 w-5 text-yellow-500"}),n.jsx("h3",{className:"font-medium",children:"Promotional Idea"})]}),n.jsx("p",{className:"whitespace-pre-wrap pl-7",children:t.promo_idea})]})]})})]})}),n.jsx("div",{className:"h-2 bg-gradient-to-r from-cyan-200 via-teal-200 to-emerald-200"})]}),t.related_news_and_data&&n.jsxs(Te,{className:"bg-white rounded-lg border shadow-sm overflow-hidden mb-6",children:[n.jsx("div",{className:"p-4 border-b bg-gradient-to-r from-red-50 to-rose-50",children:n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-10 h-10 bg-gradient-to-br from-red-500 to-rose-600 rounded-full flex items-center justify-center shadow-lg",children:n.jsx(ui,{className:"h-5 w-5 text-white"})}),n.jsxs("div",{children:[n.jsx("h2",{className:"text-lg font-semibold text-red-900",children:"Related News and Data"}),n.jsx("p",{className:"text-sm text-red-700",children:"Supporting information and context"})]})]})}),n.jsx("div",{className:"p-6",children:n.jsx("p",{className:"whitespace-pre-wrap",children:t.related_news_and_data})}),n.jsx("div",{className:"h-2 bg-gradient-to-r from-red-200 via-rose-200 to-pink-200"})]}),n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6 mb-6",children:[t.virality_score&&n.jsxs(Te,{className:"bg-white rounded-lg border shadow-sm overflow-hidden",children:[n.jsx("div",{className:"p-4 border-b bg-gradient-to-r from-purple-50 to-violet-50",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("div",{className:"w-8 h-8 bg-gradient-to-br from-purple-500 to-violet-600 rounded-full flex items-center justify-center",children:n.jsx(sa,{className:"h-4 w-4 text-white"})}),n.jsx("h3",{className:"text-lg font-semibold text-purple-900",children:"Virality 
1292Score"})]}),n.jsx("span",{className:"text-2xl font-bold text-purple-600",children:t.virality_score})]})}),n.jsx("div",{className:"p-4",children:n.jsxs("div",{className:"flex flex-col",children:[t.virality_explanation&&n.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:t.virality_explanation}),t.virality_score_explanation&&n.jsx("p",{className:"text-sm text-muted-foreground",children:t.virality_score_explanation})]})}),n.jsx("div",{className:"h-1 bg-gradient-to-r from-purple-200 to-violet-200"})]}),t.relevance_score&&n.jsxs(Te,{className:"bg-white rounded-lg border shadow-sm overflow-hidden",children:[n.jsx("div",{className:"p-4 border-b bg-gradient-to-r from-blue-50 to-cyan-50",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("div",{className:"w-8 h-8 bg-gradient-to-br from-blue-500 to-cyan-600 rounded-full flex items-center justify-center",children:n.jsx(ui,{className:"h-4 w-4 text-white"})}),n.jsx("h3",{className:"text-lg font-semibold text-blue-900",children:"Relevance Score"})]}),n.jsx("span",{className:"text-2xl font-bold text-blue-600",children:t.relevance_score})]})}),n.jsx("div",{className:"p-4",children:n.jsxs("div",{className:"flex flex-col",children:[t.relevance_explanation&&n.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:t.relevance_explanation}),t.relevance_score_explanation&&n.jsx("p",{className:"text-sm text-muted-foreground",children:t.relevance_score_explanation})]})}),n.jsx("div",{className:"h-1 bg-gradient-to-r from-blue-200 to-cyan-200"})]}),t.interest_to_audience_score&&n.jsxs(Te,{className:"bg-white rounded-lg border shadow-sm overflow-hidden",children:[n.jsx("div",{className:"p-4 border-b bg-gradient-to-r from-green-50 to-emerald-50",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("div",{className:"w-8 h-8 bg-gradient-to-br from-green-500 to-emerald-600 rounded-full flex items-center justify-center",children:n.jsx(ig,{className:"h-4 w-4 text-white"})}),n.jsx("h3",{className:"text-lg font-semibold text-green-900",children:"Interest Score"})]}),n.jsx("span",{className:"text-2xl font-bold text-green-600",children:t.interest_to_audience_score})]})}),n.jsx("div",{className:"p-4",children:n.jsx("div",{className:"flex flex-col",children:t.interest_to_audience_explanation&&n.jsx("p",{className:"text-sm text-muted-foreground",children:t.interest_to_audience_explanation})})}),n.jsx("div",{className:"h-1 bg-gradient-to-r from-green-200 to-emerald-200"})]}),t.crossover_potential_score&&n.jsxs(Te,{className:"bg-white rounded-lg border shadow-sm overflow-hidden",children:[n.jsx("div",{className:"p-4 border-b bg-gradient-to-r from-orange-50 to-amber-50",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("div",{className:"w-8 h-8 bg-gradient-to-br from-orange-500 to-amber-600 rounded-full flex items-center justify-center",children:n.jsx(en,{className:"h-4 w-4 text-white"})}),n.jsx("h3",{className:"text-lg font-semibold text-orange-900",children:"Crossover Score"})]}),n.jsx("span",{className:"text-2xl font-bold text-orange-600",children:t.crossover_potential_score})]})}),n.jsx("div",{className:"p-4",children:n.jsx("div",{className:"flex flex-col",children:t.crossover_potential_explanation&&n.jsx("p",{className:"text-sm text-muted-foreground",children:t.crossover_potential_explanation})})}),n.jsx("div",{className:"h-1 bg-gradient-to-r from-orange-200 to-amber-200"})]})]}),n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[t.quick_products&&n.jsxs("div",{className:"relative overflow-hidden bg-white/60 backdrop-blur-sm rounded-xl border border-white/50 shadow-sm",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-green-50/30 via-transparent to-emerald-50/30"}),n.jsxs("div",{className:"relative p-6",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[n.jsx("div",{className:"p-2 bg-gradient-to-br from-green-100 to-emerald-100 rounded-lg",children:n.jsx(kve,{className:"h-5 w-5 text-green-600"})}),n.jsx("h2",{className:"text-xl font-bold text-gray-900",children:"Qu
1292ick Products"})]}),n.jsx("pre",{className:"whitespace-pre-wrap text-sm bg-white/40 p-4 rounded-lg border border-white/50",children:JSON.stringify(t.quick_products,null,2)})]})]}),t.digital_tools&&n.jsxs("div",{className:"relative overflow-hidden bg-white/60 backdrop-blur-sm rounded-xl border border-white/50 shadow-sm",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-purple-50/30 via-transparent to-indigo-50/30"}),n.jsxs("div",{className:"relative p-6",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[n.jsx("div",{className:"p-2 bg-gradient-to-br from-purple-100 to-indigo-100 rounded-lg",children:n.jsx(SI,{className:"h-5 w-5 text-purple-600"})}),n.jsx("h2",{className:"text-xl font-bold text-gray-900",children:"Digital Tools"})]}),n.jsx("pre",{className:"whitespace-pre-wrap text-sm bg-white/40 p-4 rounded-lg border border-white/50",children:JSON.stringify(t.digital_tools,null,2)})]})]})]}),t.facebook_targeting&&n.jsxs("div",{className:"relative overflow-hidden bg-white/60 backdrop-blur-sm rounded-xl border border-white/50 shadow-sm",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-blue-50/30 via-transparent to-indigo-50/30"}),n.jsxs("div",{className:"relative p-6",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[n.jsx("div",{className:"p-2 bg-gradient-to-br from-blue-100 to-indigo-100 rounded-lg",children:n.jsx(_u,{className:"h-5 w-5 text-blue-600"})}),n.jsx("h2",{className:"text-xl font-bold text-gray-900",children:"Facebook Targeting"})]}),n.jsx("pre",{className:"whitespace-pre-wrap text-sm bg-white/40 p-4 rounded-lg border border-white/50",children:JSON.stringify(t.facebook_targeting,null,2)})]})]}),n.jsx("div",{className:"flex justify-end gap-2",children:v&&n.jsxs(Zt,{children:[n.jsx(aC,{asChild:!0,children:n.jsxs(te,{variant:"destructive",className:"flex items-center gap-2",children:[n.jsx(Nve,{className:"h-4 w-4"}),"Raw convergence data [SUPERADMIN ONLY]"]})}),n.jsxs(Jt,{className:"max-w-[800px] max-h-[80vh]",children:[n.jsxs(_r,{className:"flex flex-row items-center justify-between pr-0",children:[n.jsx(tr,{children:"Raw Convergence Data"}),n.jsx(te,{variant:"outline",size:"sm",onClick:S,className:"flex items-center gap-2",children:i?n.jsxs(n.Fragment,{children:[n.jsx(Gn,{className:"h-4 w-4"})," Copied"]}):n.jsxs(n.Fragment,{children:[n.jsx(y0e,{className:"h-4 w-4"})," Copy to clipboard"]})})]}),n.jsx(ol,{className:"h-[60vh] w-full rounded-md p-4 bg-slate-50",children:n.jsx("pre",{className:"whitespace-pre-wrap font-mono text-sm",children:_(t)})})]})]})})]})]}):n.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 via-white to-blue-50/30 relative overflow-hidden",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsx("div",{className:"relative container mx-auto p-6 max-w-7xl",children:n.jsx(Te,{className:"bg-white/60 backdrop-blur-sm border-white/50 shadow-sm",children:n.jsxs("div",{className:"p-8 text-center",children:[n.jsx("h2",{className:"text-lg font-semibold mb-2",children:"Convergence Not Found"}),n.jsx("p",{className:"text-muted-foreground",children:"The convergence you're looking for doesn't exist."})]})})})]})},eWe={},_0=e=>{const[t,r]=g.useState(null),[s,a]=g.useState(null),[i,o]=g.useState([]),l=g.useCallback(async x=>{if(!x)return null;try{const{data:b,error:y}=await de.from("brands").select("*").eq("id",x).single();if(y)throw y;if(b)return r(b),b}catch(b){return console.error("Error fetching brand details:",b),null}},[]);g.useEffect(()=>{e&&l(e)},[e,l]);const c=g.useCallback(async()=>{const b=await(await fetch("../config/fieldMetadata.json")).json();a(b)},[]),d=g.useCallback(async(x,b,y)=>{try{const{data:w,error:j}=await de.from("brands").update({[b]:y}).eq("id",x).single();if(j)throw j;return t&&t.id===x&&r({...t,[b]:y}),w}catch(w){throw console.error("Error updating brand field:",w),w}},[t]),u=g.useCallback(async(x,b,y,w,j)=>{try{console.log("Function parameters:",{brandId:x,fieldName:b,additionalInstructions:y,existingValue:w,feedback:j});const N="https://worker.rainfactory.ai",_=await de.auth.getSession();if(!_.data.session)throw new Error("No session found");const S={brandId:x,fieldName:b,additionalInstructions:y};
1292w&&(S.existingValue=w),j&&(S.feedback=j);const C=await fetch(`${N}/rainfactory/brand-genius/generate_missing_field`,{method:"POST",headers:{Authorization:`Bearer ${_.data.session.access_token}`},body:JSON.stringify(S)}),E=await C.json();if(!C.ok){const T=new Error(E.error||"Failed to generate content");throw Object.assign(T,{isProviderOutage:E.isProviderOutage,status:C.status}),T}return E.result.generatedContent}catch(N){throw console.error("Error generating AI content:",N),N}},[]),h=g.useCallback(async x=>{try{const{data:b,error:y}=await de.from("products").select("*").eq("brand_id",x);if(y)throw y;return b}catch(b){throw console.error("Error fetching brand products:",b),b}},[]),m=g.useCallback(async x=>{try{const{data:b,error:y}=await de.from("campaigns").select("*").eq("brand_id",x);if(y)throw y;return b}catch(b){throw console.error("Error fetching brand campaigns:",b),b}},[]),f=g.useCallback(async x=>{try{const{data:b,error:y}=await de.from("convergences").select("*").eq("brand_id",x);if(y)throw y;return b}catch(b){throw console.error("Error fetching brand convergences:",b),b}},[]),p=g.useCallback(async x=>{try{const b={...x,brand_name:x.brand_name||"Untitled Brand",idea:x.idea||"New Brand Idea",url:x.url||"",created_at:new Date().toISOString(),updated_at:new Date().toISOString(),id:eWe.randomUUID()},{data:y,error:w}=await de.from("brands").insert(b).single();if(w)throw w;return r(y),y}catch(b){throw console.error("Error creating brand:",b),b}},[t]),A=g.useCallback(async()=>{try{const{data:{user:x}}=await de.auth.getUser();if(!x)return[];const{data:b,error:y}=await de.from("brands").select("*").neq("status","DELETED").eq("status","ACTIVE").order("brand_name");if(y)throw y;const{data:w,error:j}=await de.from("brand_access").select(`
1293          access_level,
1294          expires_at,
1295          brand:brands!inner(
1296            id,
1297            brand_name,
1298            account_id,
1299            status
1300          )
1301        `).eq("user_id",x.id).or("expires_at.is.null,expires_at.gt."+new Date().toISOString());if(j)throw j;const N=new Map;b==null||b.forEach(C=>{N.set(C.id,C)}),w==null||w.forEach(C=>{const E=C.brand;E.status==="ACTIVE"&&!N.has(E.id)&&N.set(E.id,E)});const S=Array.from(N.values()).filter(C=>C.brand_name&&C.brand_name.trim()!==""&&C.status==="ACTIVE").sort((C,E)=>C.brand_name.localeCompare(E.brand_name));return console.log("Filtered brands for sidebar:",S.map(C=>({id:C.id,name:C.brand_name,status:C.status}))),o(S),S}catch(x){return console.error("Error fetching brands:",x),[]}},[]);g.useEffect(()=>{A()},[A]);const v=g.useCallback(async x=>{if(!(t!=null&&t.id))return null;try{const{data:b,error:y}=await de.from("brands").update({...x,updated_at:new Date().toISOString()}).eq("id",t.id).select().single();if(y)throw y;return r(b),b}catch(b){throw console.error("Error updating brand:",b),b}},[t]);return{brand:t,loading:e?!t:!1,setCurrentBrand:r,readyBrands:i,fieldMetadata:s,fetchFieldMetadata:c,updateBrandField:d,updateBrand:v,generateAIContent:u,fetchBrandDetails:l,fetchBrandProducts:h,fetchBrandCampaigns:m,fetchBrandConvergences:f,createBrand:p,fetchAllBrands:A}};function ed({size:e="default",className:t}){return n.jsx("div",{className:ye("animate-spin rounded-full border-2 border-current border-t-transparent",e==="default"&&"h-5 w-5",e==="sm"&&"h-4 w-4",e==="lg"&&"h-8 w-8",t)})}function AS(e){const t=xr();ehe(g.useCallback(r=>{if(e)return r.preventDefault(),r.returnValue="You have unsaved changes. Are you sure you want to leave?"},[e])),g.useEffect(()=>{if(!e)return;const r=i=>{if(e)return i.preventDefault(),i.returnValue="You have unsaved changes. Are you sure you want to leave?",i.returnValue},s=i=>{e&&(window.confirm("You have unsaved changes. Are you sure you want to leave?")||(i.preventDefault(),window.history.pushState(null,"",window.location.href)))},a=i=>{const l=i.target.closest("a");l&&l.href&&!l.href.startsWith("javascript:")&&!l.href.startsWith("#")&&l.target!=="_blank"&&!l.hasAttribute("download")&&e&&(window.confirm("You have unsaved changes. Are you sure you want to leave?")||i.preventDefault())};return window.addEventListener("beforeunload",r),window.addEventListener("popstate",s),document.addEventListener("click",a),()=>{window.removeEventListener("beforeunload",r),window.removeEventListener("popstate",s),document.removeEventListener("click",a)}},[e,t])}var LF="ToastProvider",[DF,tWe,rWe]=F_("Toast"),[Xte]=Ki("Toast",[rWe]),[nWe,gS]=Xte(LF),Zte=e=>{const{__scopeToast:t,label:r="Notification",duration:s=5e3,swipeDirection:a="right",swipeThreshold:i=50,children:o}=e,[l,c]=g.useState(null),[d,u]=g.useState(0),h=g.useRef(!1),m=g.useRef(!1);return r.trim()||console.error(`Invalid prop \`label\` supplied to \`${LF}\`. Expected non-empty \`string\`.`),n.jsx(DF.Provider,{scope:t,children:n.jsx(nWe,{scope:t,label:r,duration:s,swipeDirection:a,swipeThreshold:i,toastCount:d,viewport:l,onViewportChange:c,onToastAdd:g.useCallback(()=>u(f=>f+1),[]),onToastRemove:g.useCallback(()=>u(f=>f-1),[]),isFocusedToastEscapeKeyDownRef:h,isClosePausedRef:m,children:o})})};Zte.displayName=LF;var ere="ToastViewport",sWe=["F8"],O3="toast.viewportPause",F3="toast.viewportResume",tre=g.forwardRef((e,t)=>
1301{const{__scopeToast:r,hotkey:s=sWe,label:a="Notifications ({hotkey})",...i}=e,o=gS(ere,r),l=tWe(r),c=g.useRef(null),d=g.useRef(null),u=g.useRef(null),h=g.useRef(null),m=zr(t,h,o.onViewportChange),f=s.join("+").replace(/Key/g,"").replace(/Digit/g,""),p=o.toastCount>0;g.useEffect(()=>{const v=x=>{var y;s.length!==0&&s.every(w=>x[w]||x.code===w)&&((y=h.current)==null||y.focus())};return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[s]),g.useEffect(()=>{const v=c.current,x=h.current;if(p&&v&&x){const b=()=>{if(!o.isClosePausedRef.current){const N=new CustomEvent(O3);x.dispatchEvent(N),o.isClosePausedRef.current=!0}},y=()=>{if(o.isClosePausedRef.current){const N=new CustomEvent(F3);x.dispatchEvent(N),o.isClosePausedRef.current=!1}},w=N=>{!v.contains(N.relatedTarget)&&y()},j=()=>{v.contains(document.activeElement)||y()};return v.addEventListener("focusin",b),v.addEventListener("focusout",w),v.addEventListener("pointermove",b),v.addEventListener("pointerleave",j),window.addEventListener("blur",b),window.addEventListener("focus",y),()=>{v.removeEventListener("focusin",b),v.removeEventListener("focusout",w),v.removeEventListener("pointermove",b),v.removeEventListener("pointerleave",j),window.removeEventListener("blur",b),window.removeEventListener("focus",y)}}},[p,o.isClosePausedRef]);const A=g.useCallback(({tabbingDirection:v})=>{const b=l().map(y=>{const w=y.ref.current,j=[w,...gWe(w)];return v==="forwards"?j:j.reverse()});return(v==="forwards"?b.reverse():b).flat()},[l]);return g.useEffect(()=>{const v=h.current;if(v){const x=b=>{var j,N,_;const y=b.altKey||b.ctrlKey||b.metaKey;if(b.key==="Tab"&&!y){const S=document.activeElement,C=b.shiftKey;if(b.target===v&&C){(j=d.current)==null||j.focus();return}const B=A({tabbingDirection:C?"backwards":"forwards"}),L=B.findIndex(P=>P===S);hE(B.slice(L+1))?b.preventDefault():C?(N=d.current)==null||N.focus():(_=u.current)==null||_.focus()}};return v.addEventListener("keydown",x),()=>v.removeEventListener("keydown",x)}},[l,A]),n.jsxs(Rde,{ref:c,role:"region","aria-label":a.replace("{hotkey}",f),tabIndex:-1,style:{pointerEvents:p?void 0:"none"},children:[p&&n.jsx(L3,{ref:d,onFocusFromOutsideViewport:()=>{const v=A({tabbingDirection:"forwards"});hE(v)}}),n.jsx(DF.Slot,{scope:r,children:n.jsx(sr.ol,{tabIndex:-1,...i,ref:m})}),p&&n.jsx(L3,{ref:u,onFocusFromOutsideViewport:()=>{const v=A({tabbingDirection:"backwards"});hE(v)}})]})});tre.displayName=ere;var rre="ToastFocusProxy",L3=g.forwardRef((e,t)=>{const{__scopeToast:r,onFocusFromOutsideViewport:s,...a}=e,i=gS(rre,r);return n.jsx(dC,{tabIndex:0,...a,ref:t,style:{position:"fixed"},onFocus:o=>{var d;const l=o.relatedTarget;!((d=i.viewport)!=null&&d.contains(l))&&s()}})});L3.displayName=rre;var Gy="Toast",aWe="toast.swipeStart",iWe="toast.swipeMove",oWe="toast.swipeCancel",lWe="toast.swipeEnd",nre=g.forwardRef((e,t)=>{const{forceMount:r,open:s,defaultOpen:a,onOpenChange:i,...o}=e,[l,c]=lo({prop:s,defaultProp:a??!0,onChange:i,caller:Gy});return n.jsx(xo,{present:r||l,children:n.jsx(uWe,{open:l,...o,ref:t,onClose:()=>c(!1),onPause:$o(e.onPause),onResume:$o(e.onResume),onSwipeStart:yt(e.onSwipeStart,d=>{d.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:yt(e.onSwipeMove,d=>{const{x:u,y:h}=d.detail.delta;d.currentTarget.setAttribute("data-swipe","move"),d.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${u}px`),d.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${h}px`)}),onSwipeCancel:yt(e.onSwipeCancel,d=>{d.currentTarget.setAttribute("data-swipe","cancel"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),d.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:yt(e.onSwipeEnd,d=>{const{x:u,y:h}=d.detail.delta;d.currentTarget.setAttribute("data-swipe","end"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),d.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${u}px`),d.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${h}px`),c(!1)})})})});nre.displayName=Gy;var[cWe,dWe]=Xte(Gy,{onClose(){}}),uWe=g.forwardRef((e,t)=>
1301{const{__scopeToast:r,type:s="foreground",duration:a,open:i,onClose:o,onEscapeKeyDown:l,onPause:c,onResume:d,onSwipeStart:u,onSwipeMove:h,onSwipeCancel:m,onSwipeEnd:f,...p}=e,A=gS(Gy,r),[v,x]=g.useState(null),b=zr(t,P=>x(P)),y=g.useRef(null),w=g.useRef(null),j=a||A.duration,N=g.useRef(0),_=g.useRef(j),S=g.useRef(0),{onToastAdd:C,onToastRemove:E}=A,T=$o(()=>{var F;(v==null?void 0:v.contains(document.activeElement))&&((F=A.viewport)==null||F.focus()),o()}),B=g.useCallback(P=>{!P||P===1/0||(window.clearTimeout(S.current),N.current=new Date().getTime(),S.current=window.setTimeout(T,P))},[T]);g.useEffect(()=>{const P=A.viewport;if(P){const F=()=>{B(_.current),d==null||d()},M=()=>{const I=new Date().getTime()-N.current;_.current=_.current-I,window.clearTimeout(S.current),c==null||c()};return P.addEventListener(O3,M),P.addEventListener(F3,F),()=>{P.removeEventListener(O3,M),P.removeEventListener(F3,F)}}},[A.viewport,j,c,d,B]),g.useEffect(()=>{i&&!A.isClosePausedRef.current&&B(j)},[i,j,A.isClosePausedRef,B]),g.useEffect(()=>(C(),()=>E()),[C,E]);const L=g.useMemo(()=>v?dre(v):null,[v]);return A.viewport?n.jsxs(n.Fragment,{children:[L&&n.jsx(hWe,{__scopeToast:r,role:"status","aria-live":s==="foreground"?"assertive":"polite",children:L}),n.jsx(cWe,{scope:r,onClose:T,children:rd.createPortal(n.jsx(DF.ItemSlot,{scope:r,children:n.jsx(Ude,{asChild:!0,onEscapeKeyDown:yt(l,()=>{A.isFocusedToastEscapeKeyDownRef.current||T(),A.isFocusedToastEscapeKeyDownRef.current=!1}),children:n.jsx(sr.li,{tabIndex:0,"data-state":i?"open":"closed","data-swipe-direction":A.swipeDirection,...p,ref:b,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:yt(e.onKeyDown,P=>{P.key==="Escape"&&(l==null||l(P.nativeEvent),P.nativeEvent.defaultPrevented||(A.isFocusedToastEscapeKeyDownRef.current=!0,T()))}),onPointerDown:yt(e.onPointerDown,P=>{P.button===0&&(y.current={x:P.clientX,y:P.clientY})}),onPointerMove:yt(e.onPointerMove,P=>{if(!y.current)return;const F=P.clientX-y.current.x,M=P.clientY-y.current.y,I=!!w.current,$=["left","right"].includes(A.swipeDirection),V=["left","up"].includes(A.swipeDirection)?Math.min:Math.max,R=$?V(0,F):0,Q=$?0:V(0,M),U=P.pointerType==="touch"?10:2,D={x:R,y:Q},q={originalEvent:P,delta:D};I?(w.current=D,x1(iWe,h,q,{discrete:!1})):_Q(D,A.swipeDirection,U)?(w.current=D,x1(aWe,u,q,{discrete:!1}),P.target.setPointerCapture(P.pointerId)):(Math.abs(F)>U||Math.abs(M)>U)&&(y.current=null)}),onPointerUp:yt(e.onPointerUp,P=>{const F=w.current,M=P.target;if(M.hasPointerCapture(P.pointerId)&&M.releasePointerCapture(P.pointerId),w.current=null,y.current=null,F){const I=P.currentTarget,$={originalEvent:P,delta:F};_Q(F,A.swipeDirection,A.swipeThreshold)?x1(lWe,f,$,{discrete:!0}):x1(oWe,m,$,{discrete:!0}),I.addEventListener("click",V=>V.preventDefault(),{once:!0})}})})})}),A.viewport)})]}):null}),hWe=e=>{const{__scopeToast:t,children:r,...s}=e,a=gS(Gy,t),[i,o]=g.useState(!1),[l,c]=g.useState(!1);return pWe(()=>o(!0)),g.useEffect(()=>{const d=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(d)},[]),l?null:n.jsx(O_,{asChild:!0,children:n.jsx(dC,{...s,children:i&&n.jsxs(n.Fragment,{children:[a.label," ",r]})})})},fWe="ToastTitle",sre=g.forwardRef((e,t)=>{const{__scopeToast:r,...s}=e;return n.jsx(sr.div,{...s,ref:t})});sre.displayName=fWe;var mWe="ToastDescription",are=g.forwardRef((e,t)=>{const{__scopeToast:r,...s}=e;return n.jsx(sr.div,{...s,ref:t})});are.displayName=mWe;var ire="ToastAction",ore=g.forwardRef((e,t)=>{const{altText:r,...s}=e;return r.trim()?n.jsx(cre,{altText:r,asChild:!0,children:n.jsx(RF,{...s,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${ire}\`. Expected non-empty \`string\`.`),null)});ore.displayName=ire;var lre="ToastClose",RF=g.forwardRef((e,t)=>{const{__scopeToast:r,...s}=e,a=dWe(lre,r);return n.jsx(cre,{asChild:!0,children:n.jsx(sr.button,{type:"button",...s,ref:t,onClick:yt(e.onClick,a.onClose)})})});RF.displayName=lre;var cre=g.forwardRef((e,t)=>{const{__scopeToast:r,altText:s,...a}=e;return n.jsx(sr.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":s||void 0,...a,ref:t})});function dre(e){const t=[];
1301return Array.from(e.childNodes).forEach(s=>{if(s.nodeType===s.TEXT_NODE&&s.textContent&&t.push(s.textContent),AWe(s)){const a=s.ariaHidden||s.hidden||s.style.display==="none",i=s.dataset.radixToastAnnounceExclude==="";if(!a)if(i){const o=s.dataset.radixToastAnnounceAlt;o&&t.push(o)}else t.push(...dre(s))}}),t}function x1(e,t,r,{discrete:s}){const a=r.originalEvent.currentTarget,i=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:r});t&&a.addEventListener(e,t,{once:!0}),s?Mde(a,i):a.dispatchEvent(i)}var _Q=(e,t,r=0)=>{const s=Math.abs(e.x),a=Math.abs(e.y),i=s>a;return t==="left"||t==="right"?i&&s>r:!i&&a>r};function pWe(e=()=>{}){const t=$o(e);co(()=>{let r=0,s=0;return r=window.requestAnimationFrame(()=>s=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(r),window.cancelAnimationFrame(s)}},[t])}function AWe(e){return e.nodeType===e.ELEMENT_NODE}function gWe(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const a=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||a?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function hE(e){const t=document.activeElement;return e.some(r=>r===t?!0:(r.focus(),document.activeElement!==t))}var xWe=Zte,ure=tre,hre=nre,fre=sre,mre=are,pre=ore,Are=RF;const vWe=xWe,gre=g.forwardRef(({className:e,...t},r)=>n.jsx(ure,{ref:r,className:ye("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",e),...t}));gre.displayName=ure.displayName;const bWe=Jm("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),xre=g.forwardRef(({className:e,variant:t,...r},s)=>n.jsx(hre,{ref:s,className:ye(bWe({variant:t}),e),...r}));xre.displayName=hre.displayName;const yWe=g.forwardRef(({className:e,...t},r)=>n.jsx(pre,{ref:r,className:ye("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",e),...t}));yWe.displayName=pre.displayName;const vre=g.forwardRef(({className:e,...t},r)=>n.jsx(Are,{ref:r,className:ye("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",e),"toast-close":"",...t,children:n.jsx(kr,{className:"h-4 w-4"})}));vre.displayName=Are.displayName;const bre=g.forwardRef(({className:e,...t},r)=>n.jsx(fre,{ref:r,className:ye("text-sm font-semibold",e),...t}));bre.displayName=fre.displayName;const yre=g.forwardRef(({className:e,...t},r)=>n.jsx(mre,{ref:r,className:ye("text-sm opacity-90",e),...t}));yre.displayName=mre.displayName;function xS(){const{toasts:e}=sn();
1301return n.jsxs(vWe,{children:[e.map(function({id:t,title:r,description:s,action:a,...i}){return n.jsxs(xre,{...i,children:[n.jsxs("div",{className:"grid gap-1",children:[r&&n.jsx(bre,{children:r}),s&&n.jsx(yre,{children:s})]}),a,n.jsx(vre,{})]},t)}),n.jsx(gre,{})]})}const wWe={name:"ID",hidden:!0,description:"Unique identifier for the brand",example:"c20ae39e-6fa3-4368-b692-5e6e37c3dd90",bestPractices:"Use a UUID (version 4) for globally unique identifiers",group:"System",inputControl:"Input[disabled]",options:[],keyField:!1,allowAiGeneration:!1,howItsUsed:"Your brand's unique identifier helps us link your content and data across our system, ensuring all generated content is properly associated with your brand"},jWe={name:"Site",hidden:!0,description:"The website of the brand",example:"rainfactory.io",bestPractices:"Use a memorable, brand-relevant domain name that's easy to spell and type",group:"Brand Identity",inputControl:"Input[url]",options:[],keyField:!1,allowAiGeneration:!1,howItsUsed:"Your website URL helps us analyze your existing content and brand presence, allowing us to generate content that aligns with your current web presence and messaging"},NWe={name:"Brand Name",hidden:!1,description:"It all starts with your brand's name.",example:"Operational AI",bestPractices:"Choose a unique, memorable name that reflects your brand identity and is easy to pronounce",group:"Brand Identity",inputControl:"Input[text]",allowAiGeneration:!1,options:[],keyField:!0,howItsUsed:"Your brand name is used throughout our system to personalize content and ensure all generated materials maintain consistent branding and voice that matches your identity"},_We={name:"Tagline",hidden:!1,allowAiGeneration:!0,keyField:!1,inputControl:"Input[text]",options:[],description:"A short, catchy phrase that captures the essence of your brand",example:"AI automation for busy professionals",group:"Brand Identity",bestPractices:"Keep it short and to the point. It should be a single sentence that captures the essence of your brand. It should be no more than 140 characters.",howItsUsed:"Your tagline helps us generate content that is consistent with your brand's identity and messaging"},CWe={name:"Products Overview",hidden:!1,description:"An overview of your brand's product offerings",example:"AI automation suite, consulting services, integration tools",bestPractices:"List all the products or services you offer and explain how they help your customers. Don’t just name them—clarify what problem they solve or what benefit they bring. <br>Example: Instead of just saying 'marketing platform', say 'Marketing platform – helps small teams publish content quickly using AI.'",group:"Brand Identity",inputControl:"Textarea",options:[],keyField:!0,allowAiGeneration:!0,howItsUsed:"Your product offerings help us identify news and trends specific to each product you sell, allowing us to generate targeted content that highlights how your products solve current market challenges"},SWe={name:"Niche",hidden:!1,description:"Your brand's niche or focus area",example:"Enterprise AI",bestPractices:`Define your niche as the specific market or problem your brand is focused on. This helps position you as an expert rather than trying to appeal to everyone.
1302
1303Example: 'AI content creation tools for real estate agents' is much clearer than just 'AI software.'`,group:"Target Market",inputControl:"Input[text]",options:[],keyField:!1,allowAiGeneration:!0,howItsUsed:"Your brand's niche helps us find highly relevant industry trends and news items, ensuring the content we generate positions you as a thought leader in your specific market segment"},kWe={name:"Target Market",hidden:!1,description:"Your brand's target audience or customer",example:"CIO's at large companies",bestPractices:`Think about who your ideal customers are. Consider things like their job titles, industries, company sizes, and what they care about. This helps you shape your messaging to speak directly to them.
1304
1305Example: 'Small business owners who want to automate marketing' helps guide your message more than just saying 'businesses'.`,group:"Target Market",inputControl:"Textarea",options:[],keyField:!0,allowAiGeneration:!0,howItsUsed:"Understanding your target audience helps us craft content that speaks directly to their needs, interests, and pain points, making your content more engaging and conversion-focused"},EWe={name:"Target Market Problems",hidden:!1,description:"The problems your target audience faces that your brand s
1305olves",example:"Inefficient business operations, lack of AI integration",bestPractices:`List the common challenges your customers face that your business helps solve. These pain points should be specific and relatable.
1306
1307Example: 'It’s hard to create content regularly without a big team' or 'We miss industry news because we don’t have time to keep up.'`,group:"Target Market",inputControl:"Textarea",options:[],keyField:!0,allowAiGeneration:!0,howItsUsed:"By knowing the problems your audience faces, we can generate content that demonstrates how your solutions address current market challenges and pain points"},BWe={name:"Target Geography",hidden:!1,description:"Your target geographic areas",example:"Global",bestPractices:`Think about where your customers live or work. Your message should reflect the language, culture, and needs of that location.
1308
1309Example: If you're focusing on English-speaking professionals, your target geography might be 'United States, UK, and Australia'.`,group:"Target Market",inputControl:"Input[text]",options:[],allowAiGeneration:!0,keyField:!1,howItsUsed:"Your target geography helps us prioritize region-specific news and trends, ensuring the content we generate is relevant to your target market's location and cultural context"},TWe={name:"Elevator Pitch",hidden:!1,description:"Your brand's short, compelling pitch",example:"The world of marketing is changing rapidly because of AI. The amount of new content being produced is going exponential, and it can be difficult to stand out from the noise, and difficult to stay top of mind as the news cycle shrinks. But Rainfactory uses AI to help brands lead the conversation in their market and build audiences that are ready to buy. Rainfactory listens for trends and news relevant to your customers and creates wonderful content that uses the tailwind of the news to build your brand.",bestPractices:`Write a short and compelling pitch that includes a trend your audience should care about, the problem it creates, the opportunity if they solve it, and how your product helps.
1310
1311Example: 'Marketing is evolving fast with AI. If businesses don’t keep up, they fall behind. But if they act now, they can lead the conversation. Our tool helps them do exactly that.'`,group:"Value Proposition",inputControl:"Textarea",options:[],keyField:!0,allowAiGeneration:!0,howItsUsed:"Your elevator pitch serves as the foundation for our content generation, helping us maintain consistent messaging that emphasizes your unique value proposition across all communications"},PWe={name:"Value Propositions",hidden:!1,description:"Your brand's key value propositions",example:"Amplify productivity, maximize efficiency, shape the future of business operations",bestPractices:`List 3–5 bullet points that describe the biggest ways your product helps people. Focus on benefits, not features.
1312
1313Example: '• Save 10+ hours/week • Stay ahead of trends • Automate repetitive tasks'. When a new customer lands on your website, and is wondering what you do, this describes the pain and time you save them.`,group:"Value Proposition",inputControl:"Textarea",options:[],keyField:!0,allowAiGeneration:!0,howItsUsed:"Your value propositions guide our content creation to consistently emphasize the unique benefits you offer, helping differentiate your brand in every piece of content we generate"},IWe={name:"Differentiators",hidden:!1,description:"Your brand's differentiators from competitors",example:"Strategic AI implementation, tailored solutions for large enterprises",bestPractices:`Think about what makes your business different or better than others. This could be your approach, technology, customer service, or pricing.
1314
1315Example: 'We offer tailored AI solutions instead of one-size-fits-all packages.'`,group:"Value Proposition",inputControl:"Textarea",options:[],keyField:!0,allowAiGeneration:!0,howItsUsed:"Understanding what makes your brand unique helps us create content that highlights your competitive advantages and positions you effectively against competitors"},OWe={name:"Distribution Channel",hidden:!1,description:"Your brand's main distribution channels",example:"Online ads, content marketing",bestPractices:`Select the platforms where your audience spends time and where your message will stand out. Don't try to be everywhere.
1316
1317Example: If your audience is on LinkedIn and reads blogs, focus there instead of TikTok or Snapchat.`,group:"Marketing Strategy",inputControl:"Input[text]",options:[],keyField:!1,allowAiGeneration:!0,howItsUsed:"Your distribution channels help us optimize content format and style for each platform where your content will appear, maximizing engagement across all channels"},FWe={name:"Status",hidden:!1,description:"The current status of the brand (ACTIVE or INACTIVE)",example:"ACTIVE",bestPractices:"Regularly review and update the brand status to reflect changes in the business",group:"System",inputControl:"Select",options:["ACTIVE","INACTIVE"],keyField:!1,allowAiGeneration:!1,howItsUsed:"Your brand's status determines whether we actively generate new content for your brand and maintain your content pipeline"},LWe={name:"Root Keywords",hidden:!1,description:"Your brand's primary keywords",example:"Enterprise AI, business operations, productivity",bestPractices:`Research keywords your customers search for online. These are the words you want to show up for in search engines.
1318
1319Example: If you sell AI tools for business, keywords might include 'AI workflow automation' or 'enterprise AI software'.`,group:"Marketing Strategy",inputControl:"Command",options:[],keyField:!1,allowAiGeneration:!0,howItsUsed:"Your primary keywords guide our content optimization and help us identify relevant trends and news items that align with your core focus areas"},DWe={name:"Competitors",hidden:!1,description:"Your brand's main competitors",example:"IBM Watson, Microsoft Azure AI, Google Cloud AI",bestPractices:`List your main competitors so you can stand out from them in your messaging. Knowing your competitors helps you to position yourself in the market, and see what others are finding sucess with in getting attion from your target market. 
1320
1321Example: Apple, Target, ACME, etc. `,group:"Target Market",inputControl:"Command",options:[],keyField:!1,allowAiGeneration:!0,howItsUsed:"Understanding your competitors helps us create unique content angles that differentiate your brand and identify opportunities your competitors might have missed"},RWe={name:"Brand Voice",hidden:!1,description:"What kind of tone or voice does your brand have?",example:"Always in the active voice, be the customer's friend.",bestPractices:"How do you want your content to sound?",group:"Marketing Strategy",inputControl:"Input[text]",options:[],keyField:!1,allowAiGeneration:!0,howItsUsed:"When content is being generated, we'll use this to ensure the content sounds like your brand."},UWe={name:"Content Strategy",hidden:!1,description:"The types of content your brand prefers to publish",example:"News commentary and reactions, Hot takes, Educational, Memes, Thought leadership, sales copy, etc.",group:"Marketing Strategy",inputControl:"Input[text]",options:[],keyField:!1,allowAiGeneration:!0,bestPractices:"Use natural language to de
1321scribe what you want to create. For example, 'Insightful news commentary and Though leadership, and every once in a while a meme.'",howItsUsed:"This is used to guide the types of content that are created--it allows you to more carefully steer the AI to create content you like."},MWe={name:"Example Content",hidden:!1,description:"Sample content to establish your brand's voice and tone",example:"Harness the power of AI to transform your business operations and stay ahead in the competitive landscape.",bestPractices:"Write a few lines of example marketing copy that shows your tone and personality. This helps keep your messaging consistent.",group:"Marketing Strategy",inputControl:"Textarea",options:[],keyField:!1,allowAiGeneration:!1,howItsUsed:"Your example content helps us maintain your brand's unique voice and tone across all generated content, ensuring consistency in your brand communications"},$We={name:"Brand Inspiration",hidden:!0,description:"Your sources of brand inspiration",example:"Leading tech innovators, successful AI implementations in Fortune 500 companies",bestPractices:`Think about companies, styles, or messaging that inspire you. This gives direction for your branding and content.
1322
1323Example: 'We’re inspired by tools that make complex ideas simple and user-friendly.'`,group:"Brand Identity",inputControl:"Textarea",options:[],keyField:!1,allowAiGeneration:!0,howItsUsed:"Your sources of inspiration help us align content with your brand aspirations while identifying innovative ways to position your brand in the market"},QWe={name:"Call to Action",hidden:!1,description:"Your brand's main call-to-action",example:"Schedule a demo",bestPractices:`Use action-oriented, compelling language that creates urgency and clearly communicates value. Your call-to-action should be short, clear, and encourage immediate action.
1324
1325Example: 'Get started', 'Schedule a demo', or 'Try it free today.'`,group:"Marketing Strategy",inputControl:"Input[text]",options:[],keyField:!1,allowAiGeneration:!0,howItsUsed:"Your preferred call-to-action helps us maintain consistent conversion goals across all generated content, driving specific user actions you want to encourage"},HWe={name:"Click-through Rate Assumption",hidden:!0,description:"Assumed click-through rate for the brand's marketing efforts",example:4,bestPractices:"Base on industry benchmarks and historical data; regularly update based on actual performance",group:"Performance Metrics",inputControl:"Input[number]",options:[],keyField:!1,allowAiGeneration:!0,howItsUsed:"Your click-through rate assumptions help us optimize content for better engagement and estimate potential campaign performance"},zWe={name:"Conversion Rate Assumption",hidden:!0,description:"Assumed conversion rate for the brand's marketing efforts",example:10,bestPractices:"Use realistic estimates based on industry standards and past performance; adjust regularly based on actual data",group:"Performance Metrics",inputControl:"Input[number]",options:[],keyField:!1,allowAiGeneration:!0,howItsUsed:"Your conversion rate assumptions help us tailor content to maximize conversion potential and project campaign ROI"},VWe={name:"Core Idea",hidden:!1,description:"Your brand's core idea or concept",example:"Enterprise AI automation platform",bestPractices:`Keep the idea clear, focused and aligned with market needs. Your brand idea is the main concept that everything else supports. Keep it focused and relevant to your audience.
1326
1327Example: 'Smart tools for busy professionals.'`,group:"Brand Identity",inputControl:"Textarea",options:[],keyField:!1,allowAiGeneration:!0,howItsUsed:"Your brand's core idea guides our content generation to ensure everything we create reinforces your fundamental brand concept and mission"},GWe={name:"Detailed Pitch",hidden:!0,description:"Your detailed brand pitch for presentations",example:"Our enterprise AI platform helps large organizations automate complex business processes...",bestPractices:"Focus on value proposition and clear benefits to the target market",group:"Value Proposition",inputControl:"Textarea",options:[],keyField:!1,allowAiGeneration:!0,howItsUsed:"Your detailed pitch helps us maintain consistent messaging in longer-form content, ensuring all materials align with your core value proposition"},qWe={name:"Account ID",hidden:!0,description:"Internal reference to the account that owns this brand",example:"123e4567-e89b-12d3-a456-426614174000",bestPractices:"System-managed field - do not modify directly",group:"System",inputControl:"Input[hidden]",options:[],keyField:!1,allowAiGeneration:!1,howItsUsed:"Your account ID helps us organize your brand data and ensure secure access to your content and settings"},KWe={name:"Created At",hidden:!0,description:"Timestamp when the brand was created",example:"2024-03-21T10:30:00Z",bestPractices:"System-managed field - do not modify directly",group:"System",inputControl:"Input[hidden]",options:[],keyField:!1,allowAiGeneration:!1,howItsUsed:"Your brand's creation date helps us track y
1327our brand's evolution and maintain historical context for content generation"},WWe={name:"Updated At",hidden:!0,description:"Timestamp when the brand was last updated",example:"2024-03-21T15:45:00Z",bestPractices:"System-managed field - do not modify directly",group:"System",inputControl:"Input[hidden]",options:[],keyField:!1,allowAiGeneration:!1,howItsUsed:"Tracking when your brand information is updated helps us know when to refresh your AI-generated content strategy"},YWe={name:"Description Embedding",hidden:!0,description:"Vector embedding of the brand description for similarity search",example:"[0.1, 0.2, 0.3, ...]",bestPractices:"System-managed field - do not modify directly",group:"System",inputControl:"Input[hidden]",options:[],keyField:!1,allowAiGeneration:!1,howItsUsed:"Your brand description's AI encoding helps us find relevant content opportunities and match your brand with similar successful content strategies"},JWe={name:"Copycat Of",hidden:!0,description:"If this brand finds inspiration from an existing well-known brand, this is the name of the original brand. Feel free to use 'n/a' if there is none.",example:"",bestPractices:"Think of brands which are similar to this one but historically have seen amazing success. Describe what they did that made them successful. Example: 'We admire how SimpleForms made complicated legal docs easy to understand for users.'",group:"Brand Identity",inputControl:"Input[text]",options:[],keyField:!1,allowAiGeneration:!1,howItsUsed:"Understanding brands that inspire you helps us learn from their successful strategies while creating unique content that differentiates your brand"},XWe={name:"Copycatted Origin Story",hidden:!0,description:"If this brand finds inspiration from an existing brand, this is the origin story of the original. Useful for strategy, go-to-market, and positioning. Feel free to use 'n/a' if there is none.",example:"",bestPractices:`Write a short version of the origin story of the brand you were inspired by. Focus on their success approach.
1328
1329Example: 'SimpleForms started when its founder couldn’t find legal help for a contract, so they made it simple and self-service.'`,group:"Brand Identity",inputControl:"Textarea",options:[],keyField:!1,allowAiGeneration:!1,howItsUsed:"Learning from successful brand stories helps us develop content that builds on proven narrative strategies while maintaining your unique identity"},ZWe={name:"Industry ID",hidden:!0,description:"The industry classification for this brand",example:"524113-A1",bestPractices:"Select the most specific industry that applies to this brand's primary business activity",group:"Brand Identity",inputControl:"Select",options:[],keyField:!1,allowAiGeneration:!1,howItsUsed:"Your industry classification helps us target content to your specific sector and identify relevant industry-specific trends and opportunities"},eYe={name:"Industry Description",hidden:!1,description:"How your brand fits into the selected industry",example:"Direct life insurance carrier specializing in term life policies for small business owners",bestPractices:"Provide specific details about how this brand operates and is positioned within its industry. Example: 'We focus on small-to-medium businesses that want to use AI to simplify operations without needing a full IT team.'",group:"Brand Identity",inputControl:"Textarea",options:[],keyField:!1,allowAiGeneration:!0,howItsUsed:"Understanding how you fit in your industry helps us generate content that positions your brand effectively within your specific market context"},tYe={name:"Brand Values",hidden:!1,description:"Core values and principles that define your brand's identity and culture",example:"Innovation, Sustainability, Customer-First, Transparency",bestPractices:"Define clear, actionable values that guide your brand's decisions and communications. Example: 'Speed, Simplicity, Customer-first, and Transparency.",group:"Brand Identity",inputControl:"Textarea",options:[],keyField:!1,allowAiGeneration:!0,howItsUsed:"Your brand values help us ensure all generated content aligns with your core principles and maintains consistency in messaging and tone"},rYe={name:"Words to Avoid",hidden:!1,description:"Words, phrases, or topics that should not be used in your brand's communications",example:"(this will be very industry specific. For example, if you are a yoga studio, you might want to say 'meditation' instead of 'mindfulness')",bestPractices:`Include terms that could have negative connotations or conflict with your brand positioning. List any words or phrases you don't want associated with your brand. This helps keep your content on-message.
1330
1331Example: 'Avoid terms like automation "replacing jobs"; we prefer phrases like "enhancing team capacity."'`,group:"Marketing Strategy",inputControl:"Textarea",options:[],keyField:!1,allowAiGeneration:!0,howItsUsed:"This list helps us avoid using words or phrases you don't while generating content. For example, if you're a supplements company and you want to avoid the use of the words 'drugs', you would use this feature."},nYe={name:"Topics to Avoid",hidden:!1,description:"Topics that should not be discussed in your brand's content",example:"Politics and religion",bestPractices:`Be specific about sensitive topics or subject areas that could be controversial for your brand or target audience. This helps prevent content generation on themes that might al
1331ienate customers or conflict with your brand positioning.
1332
1333Example: 'Avoid discussing political candidates, religious beliefs, or controversial social issues. Also avoid topics related to our competitors\\' pricing strategies.'`,group:"Marketing Strategy",inputControl:"Textarea",options:[],keyField:!1,allowAiGeneration:!0,howItsUsed:"This list helps us avoid generating content on sensitive or off-brand topics that could harm your reputation or alienate your target audience. Unlike 'Words to Avoid' which focuses on specific terms, this prevents entire subject areas from being discussed in your content."},sYe={name:"Business Type",hidden:!1,description:"Indicates whether your brand primarily sells to businesses (B2B) or consumers (B2C)",example:"B2C",bestPractices:"Choose B2B if you primarily sell to other businesses, or B2C if you sell directly to consumers. This choice affects content tone, marketing strategy, and sales approach.",group:"Brand Identity",inputControl:"Select",options:["B2C","B2B"],keyField:!0,allowAiGeneration:!1,howItsUsed:"This classification helps us tailor content, messaging, and marketing strategies to match your target audience's expectations and decision-making processes"},cs={id:wWe,site:jWe,brand_name:NWe,tagline:_We,products_overview:CWe,niche:SWe,target_market:kWe,target_market_problems:EWe,target_geography:BWe,elevator_pitch:TWe,value_props:PWe,differentiators:IWe,distribution_channel:OWe,status:FWe,root_keywords:LWe,competitors:DWe,brand_voice:RWe,preferred_types_of_content:UWe,example_content_to_set_tone:MWe,brand_inspiration:$We,call_to_action:QWe,clickthru_assumption:HWe,conversion_assumption:zWe,idea:VWe,pitch:GWe,account_id:qWe,created_at:KWe,updated_at:WWe,description_embedding:YWe,copycat_of:JWe,copycatted_origin_story:XWe,industry_id:ZWe,industry_description:eYe,brand_values:tYe,words_to_avoid:rYe,topics_to_avoid:nYe,b2b_b2c:sYe},Zr=g.forwardRef(({className:e,...t},r)=>n.jsx("textarea",{className:ye("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm r
1333ing-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...t}));Zr.displayName="Textarea";let v1=null;async function aYe(){if(v1)return v1;const e=await de.auth.getSession();if(!e.data.session)throw new Error("No session found");const r=await fetch("https://worker.rainfactory.ai/rainfactory/brand-genius/get_field_metadata",{method:"POST",headers:{Authorization:`Bearer ${e.data.session.access_token}`}});if(!r.ok)throw new Error("Failed to fetch field metadata");return v1=await r.json(),v1}function iYe(){return n.jsxs("div",{className:"flex flex-col space-y-3",children:[n.jsx(Lt,{className:"h-[125px] w-[250px] rounded-xl"}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(Lt,{className:"h-4 w-[250px]"}),n.jsx(Lt,{className:"h-4 w-[200px]"})]})]})}const oYe={SkeletonCard:iYe};var UF={};(function e(t,r,s,a){var i=!!(t.Worker&&t.Blob&&t.Promise&&t.OffscreenCanvas&&t.OffscreenCanvasRenderingContext2D&&t.HTMLCanvasElement&&t.HTMLCanvasElement.prototype.transferControlToOffscreen&&t.URL&&t.URL.createObjectURL),o=typeof Path2D=="function"&&typeof DOMMatrix=="function",l=function(){if(!t.OffscreenCanvas)return!1;try{var R=new OffscreenCanvas(1,1),Q=R.getContext("2d");Q.fillRect(0,0,1,1);var U=R.transferToImageBitmap();Q.createPattern(U,"no-repeat")}catch{return!1}return!0}();function c(){}function d(R){var Q=r.exports.Promise,U=Q!==void 0?Q:t.Promise;return typeof U=="function"?new U(R):(R(c,c),null)}var u=function(R,Q){return{transform:function(U){if(R)return U;if(Q.has(U))return Q.get(U);var D=new OffscreenCanvas(U.width,U.height),q=D.getContext("2d");return q.drawImage(U,0,0),Q.set(U,D),D},clear:function(){Q.clear()}}}(l,new Map),h=function(){var R=Math.floor(16.666666666666668),Q,U,D={},q=0;return typeof requestAnimationFrame=="function"&&typeof cancelAnimationFrame=="function"?(Q=function(G){var Y=Math.random();return D[Y]=requestAnimationFrame(function K(X){q===X||q+R-1<X?(q=X,delete D[Y],G()):D[Y]=requestAnimationFrame(K)}),Y},U=function(G){D[G]&&cancelAnimationFrame(D[G])}):(Q=function(G){return setTimeout(G,R)},U=function(G){return clearTimeout(G)}),{frame:Q,cancel:U}}(),m=function(){var R,Q,U={};function D(q){function G(Y,K){q.postMessage({options:Y||{},callback:K})}q.init=function(K){var X=K.transferControlToOffscreen();q.postMessage({canvas:X},[X])},q.fire=function(K,X,ne){if(Q)return G(K,null),Q;var ae=Math.random().toString(36).slice(2);return Q=d(function(J){function W(ie){ie.data.callback===ae&&(delete U[ae],q.removeEventListener("message",W),Q=null,u.clear(),ne(),J())}q.addEventListener("message",W),G(K,ae),U[ae]=W.bind(null,{data:{callback:ae}})}),Q},q.reset=function(){q.postMessage({reset:!0});for(var K in U)U[K](),delete U[K]}}return function(){if(R)return R;if(!s&&i){var q=["var CONFETTI, SIZE = {}, module = {};","("+e.toString()+")(this, module, true, SIZE);","onmessage = function(msg) {","  if (msg.data.options) {","    CONFETTI(msg.data.options).then(function () {","      if (msg.data.callback) {","        postMessage({ callback: msg.data.callback });","      }","    });","  } else if (msg.data.reset) {","    CONFETTI && CONFETTI.reset();","  } else if (msg.data.resize) {","    SIZE.width = msg.data.resize.width;","    SIZE.height = msg.data.resize.height;","  } else if (msg.data.canvas) {","    SIZE.width = msg.data.canvas.width;","    SIZE.height = msg.data.canvas.height;","    CONFETTI = module.exports.create(msg.data.canvas);","  }","}"].join(`
1334`);try{R=new Worker(URL.createObjectURL(new Blob([q])))}catch(G){return typeof console<"u"&&typeof console.warn=="function"&&console.warn("🎊 Could not load worker",G),null}D(R)}return R}}(),f={particleCount:50,angle:90,spread:45,startVelocity:45,decay:.9,gravity:1,drift:0,ticks:200,x:.5,y:.5,shapes:["square","circle"],zIndex:100,colors:["#26ccff","#a25afd","#ff5e7e","#88ff5a","#fcff42","#ffa62d","#ff36ff"],disableForReducedMotion:!1,scalar:1};function p(R,Q){return Q?Q(R):R}function A(R){return R!=null}function v(R,Q,U){return p(R&&A(R[Q])?R[Q]:f[Q],U)}function x(R){return R<0?0:Math.floor(R)}function b(R,Q){return Math.floor(Math.random()*(Q-R))+R}function y(R){return parseInt(R,16)}function w(R){return R.map(j)}function j(R){var Q=String(R).replace(/[^0-9a-f]/gi,"");return Q.length<6&&(Q=Q[0]+Q[0]+Q[1]+Q[1]+Q[2]+Q[2]),{r:y(Q.substring(0,2)),g:y(Q.substring(2,4)),b:y(Q.substring(4,6))}}function N(R){var Q=v(R,"origin",Object);return Q.x=v(Q,"x",Number),Q.y=v(Q,"y",Number),Q}function _(R){R.width=document.documentElement.clientWidth,R.height=document.documentElement.clientHeight}function S(R){var Q=R.getBoundingClientRect();R.width=Q.width,R.height=Q.height}function C(R){var Q=document.createElement("canvas");return Q.style.position="fixed",Q.style.top="0px",Q.style.left="0px",Q.style.pointerEvents="none",Q.style.zIndex=R,Q}function E(R,Q,U,D,q,G,Y,K,X){R.save(),R.translate(Q,U),R.rotate(G),R.scale(D,q),R.arc(0,0,1,Y,K,X),R.restore(
vendor: 5,139 bytes, line 1334
1334)}function T(R){var Q=R.angle*(Math.PI/180),U=R.spread*(Math.PI/180);return{x:R.x,y:R.y,wobble:Math.random()*10,wobbleSpeed:Math.min(.11,Math.random()*.1+.05),velocity:R.startVelocity*.5+Math.random()*R.startVelocity,angle2D:-Q+(.5*U-Math.random()*U),tiltAngle:(Math.random()*(.75-.25)+.25)*Math.PI,color:R.color,shape:R.shape,tick:0,totalTicks:R.ticks,decay:R.decay,drift:R.drift,random:Math.random()+2,tiltSin:0,tiltCos:0,wobbleX:0,wobbleY:0,gravity:R.gravity*3,ovalScalar:.6,scalar:R.scalar,flat:R.flat}}function B(R,Q){Q.x+=Math.cos(Q.angle2D)*Q.velocity+Q.drift,Q.y+=Math.sin(Q.angle2D)*Q.velocity+Q.gravity,Q.velocity*=Q.decay,Q.flat?(Q.wobble=0,Q.wobbleX=Q.x+10*Q.scalar,Q.wobbleY=Q.y+10*Q.scalar,Q.tiltSin=0,Q.tiltCos=0,Q.random=1):(Q.wobble+=Q.wobbleSpeed,Q.wobbleX=Q.x+10*Q.scalar*Math.cos(Q.wobble),Q.wobbleY=Q.y+10*Q.scalar*Math.sin(Q.wobble),Q.tiltAngle+=.1,Q.tiltSin=Math.sin(Q.tiltAngle),Q.tiltCos=Math.cos(Q.tiltAngle),Q.random=Math.random()+2);var U=Q.tick++/Q.totalTicks,D=Q.x+Q.random*Q.tiltCos,q=Q.y+Q.random*Q.tiltSin,G=Q.wobbleX+Q.random*Q.tiltCos,Y=Q.wobbleY+Q.random*Q.tiltSin;if(R.fillStyle="rgba("+Q.color.r+", "+Q.color.g+", "+Q.color.b+", "+(1-U)+")",R.beginPath(),o&&Q.shape.type==="path"&&typeof Q.shape.path=="string"&&Array.isArray(Q.shape.matrix))R.fill(I(Q.shape.path,Q.shape.matrix,Q.x,Q.y,Math.abs(G-D)*.1,Math.abs(Y-q)*.1,Math.PI/10*Q.wobble));else if(Q.shape.type==="bitmap"){var K=Math.PI/10*Q.wobble,X=Math.abs(G-D)*.1,ne=Math.abs(Y-q)*.1,ae=Q.shape.bitmap.width*Q.scalar,J=Q.shape.bitmap.height*Q.scalar,W=new DOMMatrix([Math.cos(K)*X,Math.sin(K)*X,-Math.sin(K)*ne,Math.cos(K)*ne,Q.x,Q.y]);W.multiplySelf(new DOMMatrix(Q.shape.matrix));var ie=R.createPattern(u.transform(Q.shape.bitmap),"no-repeat");ie.setTransform(W),R.globalAlpha=1-U,R.fillStyle=ie,R.fillRect(Q.x-ae/2,Q.y-J/2,ae,J),R.globalAlpha=1}else if(Q.shape==="circle")R.ellipse?R.ellipse(Q.x,Q.y,Math.abs(G-D)*Q.ovalScalar,Math.abs(Y-q)*Q.ovalScalar,Math.PI/10*Q.wobble,0,2*Math.PI):E(R,Q.x,Q.y,Math.abs(G-D)*Q.ovalScalar,Math.abs(Y-q)*Q.ovalScalar,Math.PI/10*Q.wobble,0,2*Math.PI);else if(Q.shape==="star")for(var he=Math.PI/2*3,ee=4*Q.scalar,xe=8*Q.scalar,we=Q.x,Se=Q.y,pe=5,Ce=Math.PI/pe;pe--;)we=Q.x+Math.cos(he)*xe,Se=Q.y+Math.sin(he)*xe,R.lineTo(we,Se),he+=Ce,we=Q.x+Math.cos(he)*ee,Se=Q.y+Math.sin(he)*ee,R.lineTo(we,Se),he+=Ce;else R.moveTo(Math.floor(Q.x),Math.floor(Q.y)),R.lineTo(Math.floor(Q.wobbleX),Math.floor(q)),R.lineTo(Math.floor(G),Math.floor(Y)),R.lineTo(Math.floor(D),Math.floor(Q.wobbleY));return R.closePath(),R.fill(),Q.tick<Q.totalTicks}function L(R,Q,U,D,q){var G=Q.slice(),Y=R.getContext("2d"),K,X,ne=d(function(ae){function J(){K=X=null,Y.clearRect(0,0,D.width,D.height),u.clear(),q(),ae()}function W(){s&&!(D.width===a.width&&D.height===a.height)&&(D.width=R.width=a.width,D.height=R.height=a.height),!D.width&&!D.height&&(U(R),D.width=R.width,D.height=R.height),Y.clearRect(0,0,D.width,D.height),G=G.filter(function(ie){return B(Y,ie)}),G.length?K=h.frame(W):J()}K=h.frame(W),X=J});return{addFettis:function(ae){return G=G.concat(ae),ne},canvas:R,promise:ne,reset:function(){K&&h.cancel(K),X&&X()}}}function P(R,Q){var U=!R,D=!!v(Q||{},"resize"),q=!1,G=v(Q,"disableForReducedMotion",Boolean),Y=i&&!!v(Q||{},"useWorker"),K=Y?m():null,X=U?_:S,ne=R&&K?!!R.__confetti_initialized:!1,ae=typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion)").matches,J;function W(he,ee,xe){for(var we=v(he,"particleCount",x),Se=v(he,"angle",Number),pe=v(he,"spread",Number),Ce=v(he,"startVelocity",Number),re=v(he,"decay",Number),se=v(he,"gravity",Number),Ae=v(he,"drift",Number),Pe=v(he,"colors",w),Oe=v(he,"ticks",Number),be=v(he,"shapes"),ue=v(he,"scalar"),Ee=!!v(he,"flat"),De=N(he),Ge=we,Ye=[],Tt=R.width*De.x,Nt=R.height*De.y;Ge--;)Ye.push(T({x:Tt,y:Nt,angle:Se,spread:pe,startVelocity:Ce,color:Pe[Ge%Pe.length],shape:be[b(0,be.length)],ticks:Oe,decay:re,gravity:se,drift:Ae,scalar:ue,flat:Ee}));return J?J.addFettis(Ye):(J=L(R,Ye,X,ee,xe),J.promise)}function ie(he){var ee=G||v(he,"disableForReducedMotion",Boolean),xe=v(he,"zIndex",Number);if(ee&&ae)return d(function(Ce){Ce()});U&&J?R=J.canvas:U&&!R&&(R=C(xe),document.body.appendChild(R)),D&&!ne&&X(R);var we={width:R.width,height:R.height};K&&!ne&&K.init(R),ne=!0,K&&(R.__confetti_initialized=!0);function Se(){if(K){var Ce={getBoundingClientRect:function(){if(!U)return R.getBoundingClientRect()}};X(Ce),K.postMessage({resize:{width:Ce.width,height:Ce.height}});return}we.width=we.height=null}function pe(){J=null,D&&(q=!1,t.removeEventListener("resize",Se)),U&&R&&(document.body.contains(R)&&document.body.removeChild(R),R=null,ne=!1)}return D&&!q&&(q=!0,t.addEventListener("resize",Se,!1)),K?K.fire(he,we,pe):W(he,we,pe)}return ie.reset=function(){K&&K.reset(),J&&J.reset()},ie}var F;function M(){return F||(F=P(null,{useWorker:!0,resize:!0})),F}function I(R,Q,U,D,q,G,Y){var K=new Path2D(R),X=new Path2D;X.addPath(K,new DOMMatrix(Q));var ne=new Path2D;return ne.addPath(X,new DOMMatrix([Math.cos(Y)*q,Math.sin(Y)*q,-Math.sin(Y)*G,Math.cos(Y)*G,U,D])),ne}function $(R){if(!o)throw new Error("path confetti are not supported in this browser");var Q,U;
1334typeof R=="string"?Q=R:(Q=R.path,U=R.matrix);var D=new Path2D(Q),q=document.createElement("canvas"),G=q.getContext("2d");if(!U){for(var Y=1e3,K=Y,X=Y,ne=0,ae=0,J,W,ie=0;ie<Y;ie+=2)for(var he=0;he<Y;he+=2)G.isPointInPath(D,ie,he,"nonzero")&&(K=Math.min(K,ie),X=Math.min(X,he),ne=Math.max(ne,ie),ae=Math.max(ae,he));J=ne-K,W=ae-X;var ee=10,xe=Math.min(ee/J,ee/W);U=[xe,0,0,xe,-Math.round(J/2+K)*xe,-Math.round(W/2+X)*xe]}return{type:"path",path:Q,matrix:U}}function V(R){var Q,U=1,D="#000000",q='"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", "EmojiOne Color", "Android Emoji", "Twemoji Mozilla", "system emoji", sans-serif';typeof R=="string"?Q=R:(Q=R.text,U="scalar"in R?R.scalar:U,q="fontFamily"in R?R.fontFamily:q,D="color"in R?R.color:D);var G=10*U,Y=""+G+"px "+q,K=new OffscreenCanvas(G,G),X=K.getContext("2d");X.font=Y;var ne=X.measureText(Q),ae=Math.ceil(ne.actualBoundingBoxRight+ne.actualBoundingBoxLeft),J=Math.ceil(ne.actualBoundingBoxAscent+ne.actualBoundingBoxDescent),W=2,ie=ne.actualBoundingBoxLeft+W,he=ne.actualBoundingBoxAscent+W;ae+=W+W,J+=W+W,K=new OffscreenCanvas(ae,J),X=K.getContext("2d"),X.font=Y,X.fillStyle=D,X.fillText(Q,ie,he);var ee=1/U;return{type:"bitmap",bitmap:K.transferToImageBitmap(),matrix:[ee,0,0,ee,-ae*ee/2,-J*ee/2]}}r.exports=function(){return M().apply(this,arguments)},r.exports.reset=function(){M().reset()},r.exports.create=P,r.exports.shapeFromPath=$,r.exports.shapeFromText=V})(function(){return typeof window<"u"?window:typeof self<"u"?self:this||{}}(),UF,!1);const wre=UF.exports;UF.exports.create;const MF=({fieldName:e,brand:t,defaultInstructions:r,fieldMetadata:s,existingValue:a,initialFeedback:i="",onApply:o,onClose:l})=>{const{generateAIContent:c}=_0(),[d,u]=g.useState(!0),[h,m]=g.useState(a||""),[f,p]=g.useState(!1),[A,v]=g.useState(null),x=g.useRef(!1),[b,y]=g.useState(i),[w,j]=g.useState(null);g.useEffect(()=>{aYe().then(v).catch(console.error)},[]);const N=A==null?void 0:A[e],_=async()=>{if(!(t!=null&&t.id)){console.error("Brand ID is required for content generation");return}p(!0);try{h&&j(h);const E=r.trim()||(N==null?void 0:N.bestPractices)||"",T=b?`User feedback: ${b}. Previous generation: "${h}". `:"",B=await c(t.id,e,`${T}${E}`,a,b);m(B),b&&y("")}catch(E){console.error("Error generating content:",E);const T=E instanceof Error?E.message:String(E),B=T.includes("service unavailable")||T.includes("provider error")||T.includes("insufficient_quota")||T.includes("exceeded your current quota")||(E==null?void 0:E.isProviderOutage);He({title:B?"Service Unavailable":"Error",description:B?"AI service is temporarily unavailable. Please try again later.":"Failed to generate content. Please try again.",variant:"destructive"}),B&&m("The AI service is temporarily unavailable. This is likely due to high demand or a temporary outage. Please try again in a few minutes.")}finally{p(!1)}};g.useEffect(()=>{!x.current&&(t!=null&&t.id)&&!f&&!a&&(x.current=!0,_())},[t==null?void 0:t.id,a]);const S=()=>{u(!1),l()},C=()=>{wre({particleCount:100,spread:70,origin:{y:.6}}),o(e,h),u(!1),l()};return n.jsx(Zt,{open:d,onOpenChange:E=>{E||S()},children:n.jsxs(Jt,{className:"sm:max-w-[600px] max-h-[90vh] overflow-y-auto bg-white",children:[n.jsxs(_r,{className:"space-y-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Gi,{className:"h-6 w-6 text-primary animate-pulse"}),n.jsx(tr,{className:"text-xl",children:"Brand Genius"})]}),n.jsxs(Hr,{className:"text-base",children:["Generating ",e.split("_").map(E=>E.charAt(0).toUpperCase()+E.slice(1)).join(" ")]})]}),s.description&&n.jsx(Ar,{className:"bg-muted/50 border-none mt-2",children:n.jsx(gr,{className:"text-sm text-muted-foreground",children:s.description})}),n.jsxs("div",{className:"space-y-4 mt-4",children:[f?n.jsx("div",{className:"flex items-center justify-center min-h-[200px]",children:n.jsx(oYe.SkeletonCard,{})}):n.jsxs(n.Fragment,{children:[n.jsx(Zr,{value:h,onChange:E=>m(E.target.value),rows:8,className:"min-h-[200px] max-h-[40vh] overflow-y-auto"}),w&&n.jsx("div",{className:"text-xs text-muted-foreground",children:n.jsx(te,{variant:"link",size:"sm",className:"p-0 h-auto",onClick:()=>m(w),children:"Revert to previous generation"})}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"feedback",children:"Feedback for regeneration"}),n.jsx(Zr,{id:"feedback",value:b,onChange:E=>y(E.target.value),placeholder:"Provide feedback to improve the generated content...",rows:2})]}),n.jsx(te,{onClick:_,disabled:f,variant:b?"default":"outline",className:"w-full",children:b?n.jsxs(n.Fragment,{children:[n.jsx(g2,{className:"mr-2 h-4 w-4"}),"Regenerate with Feedback"]}):n.jsxs(n.Fragment,{children:[n.jsx(mr,{className:"mr-2 h-4 w-4"}),"Generate"]})})]}),n.jsxs("div",{className:"flex justify-end space-x-2",children:[n.jsx(te,{onClick:S,variant:"outline",children:"Cancel"}),n.jsx(te,{onClick:C,disabled:!h,children:"Use"})]})]})]})})},lYe=()=>n.jsx("div",{className:"w-10 h-10 flex items-center justify-center bg-green-100 rounded-full",children:n.jsx(Gn,{className:"h-6 w-6 text-green-600"})});function ty({brand:e,showLink:t=!0,className:r=""}){const a=(()=>
1334{if(!e)return 0;const c=Object.keys(cs).filter(h=>{const m=cs[h];return!(m!=null&&m.hidden)&&h!=="status"}),d=c.length;return c.filter(h=>{const m=e[h];return m!=null&&m!==""}).length/d*100})(),o=(c=>c<20?{name:"Weak",color:"text-red-600"}:c<50?{name:"Ok",color:"text-yellow-600"}:c<80?{name:"Getting there",color:"text-blue-600"}:{name:"Strong",color:"text-green-600"})(a),l=[{name:"Weak",start:0,end:20,color:"bg-red-500"},{name:"Ok",start:20,end:50,color:"bg-yellow-500"},{name:"Getting there",start:50,end:80,color:"bg-blue-500"},{name:"Strong",start:80,end:100,color:"bg-green-500"}];return n.jsx("div",{className:ye("flex items-start gap-4 bg-muted p-6 rounded-lg",r),children:n.jsxs("div",{className:"flex-1",children:[n.jsx("div",{className:"flex items-center justify-between",children:t&&n.jsx(te,{asChild:!0,variant:"outline",size:"sm",children:n.jsxs(Ir,{to:"/brands/genius",className:"flex items-center gap-2",children:[n.jsx(Gi,{className:"h-4 w-4"}),n.jsx("span",{children:"Open Brand Genius"}),n.jsx(Vs,{className:"h-3 w-3"})]})})}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"The more complete your brand profile, the better your brand kit and AI content will be. Complete all fields in Brand Genius for optimal results."}),n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"flex-1 h-3 bg-muted-foreground/20 rounded-full overflow-hidden relative",children:n.jsx("div",{className:`h-full transition-all duration-500 ${a<20?"bg-red-500":a<50?"bg-yellow-500":a<80?"bg-blue-500":"bg-green-500"}`,style:{width:`${a}%`}})}),a===100&&n.jsx(lYe,{})]}),n.jsx("div",{className:"relative",children:n.jsx("div",{className:"flex justify-between relative",children:l.map((c,d)=>n.jsxs("div",{className:"flex flex-col items-center flex-1",children:[n.jsxs("div",{className:"relative w-full flex justify-center",children:[n.jsx("div",{className:`w-3 h-3 rounded-full border-2 border-background shadow-sm transition-all duration-300 ${a>=c.start?c.color:"bg-muted-foreground/30"}`}),d<l.length-1&&n.jsx("div",{className:"absolute top-1.5 left-1/2 w-full h-0.5 bg-muted-foreground/20 -z-10"})]}),n.jsx("span",{className:`text-xs font-medium mt-2 transition-colors duration-300 ${a>=c.start?o.color:"text-muted-foreground/60"}`,children:c.name}),n.jsxs("span",{className:"text-xs text-muted-foreground/50 mt-0.5",children:[c.start,"%",d===l.length-1?"+":""]})]},c.name))})})]}),a<100&&n.jsxs("p",{className:"text-xs text-muted-foreground",children:[a<20&&"Your brand needs significant completion to generate quality content.",a>=20&&a<50&&"Your brand is getting started. Add more details for better results.",a>=50&&a<80&&"Your brand is progressing well. Keep filling in fields to reach Strong status.",a>=80&&a<100&&"Your brand is strong! Complete the remaining fields for optimal performance."]})]})})}const ll=Qde,cl=Hde,CQ=Vde,cYe=zde,dYe=g.forwardRef(({className:e,inset:t,children:r,...s},a)=>n.jsxs(WG,{ref:a,className:ye("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",t&&"pl-8",e),...s,children:[r,n.jsx(_s,{className:"ml-auto h-4 w-4"})]}));dYe.displayName=WG.displayName;const uYe=g.forwardRef(({className:e,...t},r)=>n.jsx(YG,{ref:r,className:ye("z-50 min-w-[8rem] overflow-hidden rounded-md 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",e),...t}));uYe.displayName=YG.displayName;const fo=g.forwardRef(({className:e,sideOffset:t=4,...r},s)=>n.jsx($de,{children:n.jsx(JG,{ref:s,sideOffset:t,className:ye("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-white dark:bg-gray-800 p-1 text-black dark:text-white 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]:sli
1334de-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})}));fo.displayName=JG.displayName;const Fr=g.forwardRef(({className:e,inset:t,...r},s)=>n.jsx(XG,{ref:s,className:ye("relative flex cursor-default select-none items-center 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",t&&"pl-8",e),...r}));Fr.displayName=XG.displayName;const hYe=g.forwardRef(({className:e,children:t,checked:r,...s},a)=>n.jsxs(ZG,{ref:a,className:ye("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",e),checked:r,...s,children:[n.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:n.jsx(eq,{children:n.jsx(Gn,{className:"h-4 w-4"})})}),t]}));hYe.displayName=ZG.displayName;const jre=g.forwardRef(({className:e,children:t,...r},s)=>n.jsxs(tq,{ref:s,className:ye("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",e),...r,children:[n.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:n.jsx(eq,{children:n.jsx(vK,{className:"h-2 w-2 fill-current"})})}),t]}));jre.displayName=tq.displayName;const Am=g.forwardRef(({className:e,inset:t,...r},s)=>n.jsx(rq,{ref:s,className:ye("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...r}));Am.displayName=rq.displayName;const Mo=g.forwardRef(({className:e,...t},r)=>n.jsx(nq,{ref:r,className:ye("-mx-1 my-1 h-px bg-muted",e),...t}));Mo.displayName=nq.displayName;function fYe({size:e="default",className:t}){return n.jsx("div",{className:ye("animate-spin rounded-full border-2 border-current border-t-transparent",e==="default"&&"h-5 w-5",e==="sm"&&"h-4 w-4",e==="lg"&&"h-8 w-8",t)})}const mYe=()=>n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",className:"text-current",children:n.jsxs("g",{fill:"none",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",stroke:"currentColor",children:[n.jsx("circle",{cx:"9",cy:"9",r:"7.25"}),n.jsx("line",{x1:"9",y1:"12.819",x2:"9",y2:"8.25"}),n.jsx("path",{d:"M9,6.75c-.552,0-1-.449-1-1s.448-1,1-1,1,.449,1,1-.448,1-1,1Z",fill:"currentColor","data-stroke":"none",stroke:"none"})]})}),SQ={type:"spring",stiffness:500,damping:30,mass:1};function ry({state:e="initial",onReset:t,onSave:r,loadingText:s="Saving",successText:a="Changes Saved",initialText:i="Unsaved changes",resetText:o="Reset",saveText:l="Save",className:c,...d}){return n.jsx(ut.div,{className:ye("inline-flex h-10 items-center justify-center overflow-hidden rounded-full","bg-background/95 backdrop-blur","border border-black/[0.08] dark:border-white/[0.08]","shadow-[0_0_0_1px_rgba(0,0,0,0.08),0_8px_16px_-4px_rgba(0,0,0,0.1)]","dark:shadow-[0_0_0_1px_rgba(255,255,255,0.08),0_8px_16px_-4px_rgba(0,0,0,0.2)]",c),initial:!1,animate:{width:"auto"},transition:SQ,...d,children:n.jsxs("div",{className:"flex h-full items-center justify-between px-3",children:[n.jsx(qh,{mode:"wait",children:n.jsxs(ut.div,{className:"flex items-center gap-2 text-foreground",initial:{opacity:0}
1334,animate:{opacity:1},exit:{opacity:0},transition:{duration:0},children:[e==="loading"&&n.jsxs(n.Fragment,{children:[n.jsx(fYe,{size:"sm"}),n.jsx("div",{className:"text-[13px] font-normal leading-tight whitespace-nowrap",children:s})]}),e==="success"&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"p-0.5 bg-emerald-500/10 dark:bg-emerald-500/25 rounded-[99px] shadow-sm border border-emerald-500/20 dark:border-emerald-500/25 justify-center items-center gap-1.5 flex overflow-hidden",children:n.jsx(Gn,{className:"w-3.5 h-3.5 text-emerald-600 dark:text-emerald-500"})}),n.jsx("div",{className:"text-[13px] font-normal leading-tight whitespace-nowrap",children:a})]}),e==="initial"&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"text-foreground/80",children:n.jsx(mYe,{})}),n.jsx("div",{className:"text-[13px] font-normal leading-tight whitespace-nowrap",children:i})]})]},e)}),n.jsx(qh,{children:e==="initial"&&n.jsxs(ut.div,{className:"ml-2 flex items-center gap-2",initial:{opacity:0,width:0},animate:{opacity:1,width:"auto"},exit:{opacity:0,width:0},transition:{...SQ,opacity:{duration:0}},children:[n.jsx(te,{onClick:t,variant:"ghost",className:"h-7 px-3 py-0 rounded-[99px] text-[13px] font-normal hover:bg-muted/80 transition-colors",children:o}),n.jsx(te,{onClick:r,className:ye("h-7 px-3 py-0 rounded-[99px] text-[13px] font-medium","text-white","bg-gradient-to-b from-violet-500 to-violet-600","hover:from-violet-400 hover:to-violet-500","dark:shadow-[inset_0px_1px_0px_0px_rgba(255,255,255,0.2)]","shadow-[inset_0px_1px_0px_0px_rgba(255,255,255,0.4)]","transition-all duration-200"),children:l})]})})]})})}const kQ=(e,t)=>{if(!e)return"";const r=e[t];return r==null?"":String(r)},pYe=({localCurrentBrand:e,setLocalCurrentBrand:t,updateBrandField:r})=>{var ae;const[s,a]=g.useState(!1),[i,o]=g.useState(""),[l,c]=g.useState({}),[d,u]=g.useState([]),[h,m]=g.useState({}),[f,p]=g.useState(!0),[A,v]=g.useState("initial"),[x,b]=g.useState(!1),[y,w]=g.useState(!1),[j,N]=g.useState(""),[_,S]=g.useState(!1),[C,E]=g.useState({}),[T,B]=g.useState({}),L=Object.values(l).some(Boolean);g.useEffect(()=>{const J={};
1334Object.entries(cs).forEach(([W,ie])=>{const he=ie.group||"Other";J[he]||(J[he]=[]),J[he].push(W)}),m(J)},[]),g.useEffect(()=>{if(e){const J=Object.entries(h).reduce((W,[ie,he])=>{const ee=he.some(we=>{const Se=e[we];return Se==null||Se===""}),xe=he.some(we=>l[we]);return(ee||xe)&&W.push(ie),W},[]);u(J)}},[e,h,l]);const P=J=>{const W=cs[J];return(W==null?void 0:W.name)||J.split("_").map(ie=>ie.charAt(0).toUpperCase()+ie.slice(1)).join(" ")},F=J=>{if(["id","createdAt","updatedAt","wordpress_password"].includes(J))return!1;const ie=cs[J];return ie&&ie.allowAiGeneration===!0},M=J=>!["id","createdAt","updatedAt"].includes(J),I=J=>{if(o(J),e){const W=e[J];W&&String(W).trim()!==""?b(!0):(w(!1),a(!0))}else a(!0)},$=(J,W)=>{e&&(t({...e,[J]:W}),c({...l,[J]:!0}))},V=(J,W)=>{e&&(t({...e,[J]:W}),c({...l,[J]:!0}))},R=async J=>{if(!(!e||!l[J])){E(W=>({...W,[J]:!0}));try{const W=kQ(e,J);await r(e.id,J,W),c(ie=>{const he={...ie};return delete he[J],he}),E(ie=>{const he={...ie};return delete he[J],he}),B(ie=>({...ie,[J]:!0})),setTimeout(()=>{B(ie=>{const he={...ie};return delete he[J],he})},2e3);try{const ie=await de.auth.getSession();ie.data.session&&await fetch("https://worker.rainfactory.ai/rainfactory/brand-genius/process_updated_brand",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${ie.data.session.access_token}`},body:JSON.stringify({brandId:e.id})})}catch(ie){console.error("Failed to process updated brand:",ie)}return!0}catch(W){console.error(`Failed to save field ${J}:`,W);const ie=W instanceof Error?W.message:String(W),he=ie.includes("service unavailable")||ie.includes("provider error")||ie.includes("insufficient_quota")||(W==null?void 0:W.isProviderOutage);return He({title:he?"Service Unavailable":"Error Saving",description:he?"AI service is temporarily unavailable. Please try again later.":`Failed to save ${J.replace(/_/g," ")}. Please try again.`,variant:"destructive"}),E(ee=>{const xe={...ee};return delete xe[J],xe}),!1}}},Q=J=>{navigator.clipboard.writeText(J).then(()=>{He({title:"Copied to clipboard",description:"The content has been copied to your clipboard.",duration:2e3})}).catch(W=>{console.error("Failed to copy text: ",W),He({title:"Failed to copy",description:"There was an error copying to your clipboard.",variant:"destructive"})})},U=J=>{const ie=(h[J]||[]).some(he=>l[he]);u(he=>he.includes(J)?ie?he:he.filter(ee=>ee!==J):[...he,J])},D=J=>{const W=Object.entries(J).reduce((ie,[he,ee])=>{const xe=cs[he];return!(xe!=null&&xe.hidden)&&he!=="status"&&(ie[he]=ee),ie},{});return f?W:Object.entries(W).reduce((ie,[he,ee])=>((!ee||ee===""||l[he])&&(ie[he]=ee),ie),{})},q=e?Object.entries(h).reduce((J,[W,ie])=>{const he=ie;if(he.length>0){const ee=he.reduce((Ce,re)=>(Ce[re]=e[re],Ce),{}),xe=D(ee),we=he.some(Ce=>l[Ce]),Se=he.some(Ce=>{const re=e[Ce];return!re||re===""});(f||we||Se)&&(we&&he.forEach(Ce=>{l[Ce]&&(xe[Ce]=ee[Ce])}),Object.keys(xe).length>0&&(J[W]=xe))}return J},{}):{},G=J=>{const W=Object.keys(J).filter(ee=>{const xe=cs[ee];return!(xe!=null&&xe.hidden)}),ie=W.length,he=W.filter(ee=>{const xe=J[ee];return xe!=null&&xe!==""}).length;return ie===0?0:he/ie*100},Y=(J,W,ie,he=!1)=>{var Ce,re;const ee=cs[J],xe=((Ce=ee==null?void 0:ee.inputControl)==null?void 0:Ce.toLowerCase())||"",we=`${l[J]?"border-blue-500 bg-blue-50/50":""}`,Se=()=>{l[J]&&R(J)},pe=se=>{se.key==="Enter"&&xe!=="textarea"&&l[J]&&R(J)};if(xe.includes("textarea"))return n.jsx(Zr,{id:J,value:W,onChange:se=>ie(se.target.value),onBlur:Se,disabled:he,className:`min-h-[100px] ${we}`});if(xe.includes("select"))return n.jsx("div",{className:"flex flex-wrap gap-2",children:(re=ee.options)==null?void 0:re.map(se=>n.jsx(te,{variant:W===se?"default":"outline",onClick:()=>{ie(se),setTimeout(()=>R(J),0)},disabled:he,className:`${W===se?"bg-primary text-primary-foreground":""}`,children:se},se))});{const se=xe.includes("url")?"url":xe.includes("password")?"password":xe.includes("number")?"number":"text";return n.jsx(qe,{id:J,type:se,value:W,onChange:Ae=>ie(Ae.target.value),onBlur:Se,onKeyDown:pe,disabled:he||xe.includes("disabled")||xe.includes("hidden"),className:we})}},K=async()=>
1334{if(!e)return;v("loading");const J=Object.keys(l).filter(W=>l[W]);if(J.length===0){v("success"),setTimeout(()=>v("initial"),2e3);return}try{await Promise.all(J.map(W=>R(W))),v("success"),He({title:"All changes saved",description:"Your brand details have been updated",duration:2e3}),setTimeout(()=>v("initial"),2e3)}catch(W){console.error("Failed to save all changes:",W);const ie=W instanceof Error?W.message:String(W),he=ie.includes("service unavailable")||ie.includes("provider error")||ie.includes("insufficient_quota")||(W==null?void 0:W.isProviderOutage);He({title:he?"Service Unavailable":"Error Saving",description:he?"AI service is temporarily unavailable. Please try again later.":"Failed to save all changes. Please try again.",variant:"destructive"}),v("initial")}},X=()=>{c({}),E({}),B({}),He({title:"Changes discarded",description:"All unsaved changes have been discarded",duration:2e3})},ne=()=>{if(!e)return"";let J="";return Object.entries(h).forEach(([W,ie])=>{if(W==="System"||W==="Website Management")return;const he=ie.filter(ee=>{const xe=e[ee];return xe!=null&&xe!==""});he.length>0&&(J+=`
1335## ${W}
1336
1337`,he.forEach(ee=>{const xe=e[ee],we=P(ee);J+=`### ${we}
1338${xe}
1339
1340`}))}),J.trim()};return n.jsxs("div",{className:"flex flex-col gap-4",children:[n.jsx(ty,{brand:e,showLink:!1}),L&&n.jsx("div",{className:"hidden md:block",children:n.jsx(ry,{state:A,onSave:K,onReset:X,loadingText:"Saving changes...",successText:"All changes saved",initialText:"You have unsaved changes",resetText:"Cancel",saveText:"Save"})}),L&&n.jsx("div",{className:"fixed bottom-4 left-1/2 transform -translate-x-1/2 z-50 md:hidden",children:n.jsx(ry,{state:A,onSave:K,onReset:X,loadingText:"Saving changes...",successText:"All changes saved",initialText:"You have unsaved changes",resetText:"Cancel",saveText:"Save"})}),n.jsxs("div",{className:"flex items-center justify-between bg-muted/50 p-4 rounded-lg",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-medium",children:f?"Showing all fields":`${Object.values(q).reduce((J,W)=>J+Object.keys(W).length,0)} fields need attention`}),n.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Use the filter below to focus on specific fields that need your attention."})]}),n.jsx(te,{variant:"outline",size:"sm",onClick:()=>
1340p(!f),className:"flex items-center gap-2",children:f?n.jsxs(n.Fragment,{children:[n.jsx(nb,{className:"h-4 w-4"}),"Show Empty Only"]}):n.jsxs(n.Fragment,{children:[n.jsx(gd,{className:"h-4 w-4"}),"Show All Fields"]})})]}),n.jsx(ol,{className:"h-[calc(100vh-16rem)] rounded-lg border",children:n.jsx("div",{className:"p-4 space-y-4",children:Object.entries(q).map(([J,W])=>n.jsxs(Te,{children:[n.jsx(st,{className:"cursor-pointer",onClick:()=>U(J),children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx(ot,{className:"text-lg font-medium",children:J}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("div",{className:"w-[60px] bg-muted-foreground/20 rounded-full overflow-hidden",children:n.jsx("div",{className:`h-2 ${G(W)<33?"bg-red-500":G(W)<66?"bg-yellow-500":"bg-green-500"}`,style:{width:`${G(W)}%`}})}),n.jsxs(Be,{variant:"secondary",children:[Math.round(G(W)),"%"]}),n.jsxs(Be,{variant:"outline",children:[Object.keys(W).length," Fields"]}),d.includes(J)?n.jsx(Fu,{className:"h-4 w-4"}):n.jsx(Un,{className:"h-4 w-4"})]})]})}),n.jsx(qh,{children:d.includes(J)&&n.jsx(ut.div,{initial:{height:0},animate:{height:"auto"},exit:{height:0},transition:{duration:.2},children:n.jsx(Re,{className:"grid gap-6 p-4",children:Object.entries(W).map(([ie,he])=>{var ee,xe;return n.jsxs("div",{className:"space-y-3",children:[n.jsx(ze,{htmlFor:ie,className:"flex items-center text-sm font-medium",children:P(ie)}),n.jsxs("div",{className:"flex items-start justify-between gap-4",children:[n.jsx("p",{className:"text-sm text-muted-foreground flex-1",children:(ee=cs[ie])==null?void 0:ee.howItsUsed}),n.jsx("div",{className:"flex items-center gap-1 flex-shrink-0",children:n.jsxs(Ya,{children:[F(ie)&&n.jsxs(Hs,{children:[n.jsx(zs,{asChild:!0,children:n.jsx(te,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>I(ie),children:n.jsx(mr,{className:"h-4 w-4"})})}),n.jsx(Vn,{children:"Get AI suggestions"})]}),C[ie]&&n.jsxs(Hs,{children:[n.jsx(zs,{asChild:!0,children:n.jsx("div",{className:"h-6 w-6 flex items-center justify-center",children:n.jsx(ed,{size:"sm"})})}),n.jsx(Vn,{children:"Saving..."})]}),T[ie]&&n.jsxs(Hs,{children:[n.jsx(zs,{asChild:!0,children:n.jsx("div",{className:"h-6 w-6 flex items-center justify-center text-green-500",children:n.jsx(di,{className:"h-4 w-4"})})}),n.jsx(Vn,{children:"Saved"})]}),n.jsxs(Hs,{children:[n.jsx(zs,{asChild:!0,children:n.jsx(te,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>Q(he),children:n.jsx(Cn,{className:"h-4 w-4"})})}),n.jsx(Vn,{children:"Copy to clipboard"})]}),n.jsxs(ll,{children:[n.jsxs(Hs,{children:[n.jsx(zs,{asChild:!0,children:n.jsx(cl,{asChild:!0,children:n.jsx(te,{variant:"ghost",size:"icon",className:"h-6 w-6",children:n.jsx(ig,{className:"h-4 w-4"})})})}),n.jsx(Vn,{children:"Click to see best practices for this field"})]}),n.jsx(fo,{children:n.jsxs("div",{className:"p-4 max-w-sm",children:[n.jsx("p",{className:"font-semibold mb-2",children:"Best Practices:"}),n.jsx("p",{className:"text-sm",children:(xe=cs[ie])==null?void 0:xe.bestPractices})]})})]})]})})]}),Y(ie,kQ(e,ie),we=>$(ie,we),!M(ie))]},ie)})})})})]},J))})}),n.jsxs(te,{onClick:()=>S(!0),className:"mt-4",variant:"outline",children:[n.jsx(v0e,{className:"mr-2 h-4 w-4"}),"Show Brand Summary"]}),n.jsx(Zt,{open:_,onOpenChange:S,children:n.jsxs(Jt,{className:"sm:max-w-[800px] max-h-[80vh]",children:[n.jsxs(_r,{children:[n.jsx(tr,{children:"Brand Summary"}),n.jsx(Hr,{children:"A complete summary of all populated brand information."})]}),n.jsx(ol,{className:"mt-4 h-[50vh] rounded-md border p-4",children:n.jsx("pre",{className:"whitespace-pre-wrap font-mono text-sm",children:ne()})}),n.jsx("div",{className:"mt-4 flex justify-end",children:n.jsxs(te,{onClick:()=>{const J=ne();Q(J)},className:"w-auto",children:[n.jsx(Cn,{className:"mr-2 h-4 w-4"}),"Copy to Clipboard"]})})]})}),s&&n.jsx(MF,{fieldName:i,brand:e,defaultInstructions:((ae=cs[i])==null?void 0:ae.bestPractices)||"",fieldMetadata:cs[i]||{},existingValue:y?e[i]:void 0,initialFeedback:y?j:"",onApply:V,onClose:()=>{a(!1),w(!1),N("")}}),x&&n.jsx(Zt,{open:x,onOpenChange:b,children:n.jsxs(Jt,{className:"sm:max-w-[500px] p-6 bg-white",children:[n.jsxs(_r,{children:[n.jsx(tr,{children:"How would you like Brand Genius to help?"}),n.jsx(Hr,{children:"Choose how you want Brand Genius to assist with this field."})]}),n.jsxs("div",{className:"grid gap-4 py-4",children:[n.jsxs(te,{onClick:()=>{b(!1),w(!1),a(!0)},className:"w-full",children:[n.jsx(mr,{className:"mr-2 h-4 w-4"}),"Have Brand Genius generate a new answer for me"]}),n.jsxs(te,{onClick:()=>{b(!1),w(!0),N(""),a(!0)},variant:"outline",className:"w-full",children:[n.jsx(g2,{className:"mr-2 h-4 w-4"}),"Give Brand Genius feedback to improve the current answer"]})]})]})})]})};var qy=e=>e.type==="checkbox",gm=e=>e instanceof Date,to=e=>e==null;const Nre=e=>typeof e=="object";var ya=e=>!to(e)&&!Array.isArray(e)&&Nre(e)&&!gm(e),_re=e=>ya(e)&&e.target?qy(e.target)?e.target.checked:e.target.value:e,AYe=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,Cre=(e,t)=>
1340e.has(AYe(t)),gYe=e=>{const t=e.constructor&&e.constructor.prototype;return ya(t)&&t.hasOwnProperty("isPrototypeOf")},$F=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function ca(e){if(e instanceof Date)return new Date(e);const t=typeof FileList<"u"&&e instanceof FileList;if($F&&(e instanceof Blob||t))return e;const r=Array.isArray(e);if(!r&&!(ya(e)&&gYe(e)))return e;const s=r?[]:Object.create(Object.getPrototypeOf(e));for(const a in e)Object.prototype.hasOwnProperty.call(e,a)&&(s[a]=ca(e[a]));return s}var vS=e=>/^\w*$/.test(e),bs=e=>e===void 0,QF=e=>Array.isArray(e)?e.filter(Boolean):[],HF=e=>QF(e.replace(/["|']|\]/g,"").split(/\.|\[/)),At=(e,t,r)=>{if(!t||!ya(e))return r;const s=(vS(t)?[t]:HF(t)).reduce((a,i)=>to(a)?a:a[i],e);return bs(s)||s===e?bs(e[t])?r:e[t]:s},Uo=e=>typeof e=="boolean",$i=e=>typeof e=="function",Pn=(e,t,r)=>{let s=-1;const a=vS(t)?[t]:HF(t),i=a.length,o=i-1;for(;++s<i;){const l=a[s];let c=r;if(s!==o){const d=e[l];c=ya(d)||Array.isArray(d)?d:isNaN(+a[s+1])?{}:[]}if(l==="__proto__"||l==="constructor"||l==="prototype")return;e[l]=c,e=e[l]}};const HN={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},Ac={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},qd={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},zF=oe.createContext(null);zF.displayName="HookFormControlContext";const VF=()=>oe.useContext(zF);var Sre=(e,t,r,s=!0)=>{const a={defaultValues:t._defaultValues};for(const i in e)Object.defineProperty(a,i,{get:()=>{const o=i;return t._proxyFormState[o]!==Ac.all&&(t._proxyFormState[o]=!s||Ac.all),r&&(r[o]=!0),e[o]}});return a};const GF=typeof window<"u"?oe.useLayoutEffect:oe.useEffect;function xYe(e){const t=VF(),{control:r=t,disabled:s,name:a,exact:i}=e||{},[o,l]=oe.useState(r._formState),c=oe.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return GF(()=>r._subscribe({name:a,formState:c.current,exact:i,callback:d=>{!s&&l({...r._formState,...d})}}),[a,s,i]),oe.useEffect(()=>{c.current.isValid&&r._setValid(!0)},[r]),oe.useMemo(()=>Sre(o,r,c.current,!1),[o,r])}var Vo=e=>typeof e=="string",D3=(e,t,r,s,a)=>Vo(e)?(s&&t.watch.add(e),At(r,e,a)):Array.isArray(e)?e.map(i=>(s&&t.watch.add(i),At(r,i))):(s&&(t.watchAll=!0),r),R3=e=>to(e)||!Nre(e);function gc(e,t,r=new WeakSet){if(R3(e)||R3(t))return Object.is(e,t);if(gm(e)&&gm(t))return Object.is(e.getTime(),t.getTime());const s=Object.keys(e),a=Object.keys(t);if(s.length!==a.length)return!1;if(r.has(e)||r.has(t))return!0;r.add(e),r.add(t);for(const i of s){const o=e[i];if(!a.includes(i))return!1;if(i!=="ref"){const l=t[i];if(gm(o)&&gm(l)||ya(o)&&ya(l)||Array.isArray(o)&&Array.isArray(l)?!gc(o,l,r):!Object.is(o,l))return!1}}return!0}function vYe(e){const t=VF(),{control:r=t,name:s,defaultValue:a,disabled:i,exact:o,compute:l}=e||{},c=oe.useRef(a),d=oe.useRef(l),u=oe.useRef(void 0),h=oe.useRef(r),m=oe.useRef(s);d.current=l;const[f,p]=oe.useState(()=>{const w=r._getWatch(s,c.current);return d.current?d.current(w):w}),A=oe.useCallback(w=>{const j=D3(s,r._names,w||r._formValues,!1,c.current);return d.current?d.current(j):j},[r._formValues,r._names,s]),v=oe.useCallback(w=>{if(!i){const j=D3(s,r._names,w||r._formValues,!1,c.current);if(d.current){const N=d.current(j);gc(N,u.current)||(p(N),u.current=N)}else p(j)}},[r._formValues,r._names,i,s]);GF(()=>((h.current!==r||!gc(m.current,s))&&(h.current=r,m.current=s,v()),r._subscribe({name:s,formState:{values:!0},exact:o,callback:w=>{v(w.values)}})),[r,o,s,v]),oe.useEffect(()=>r._removeUnmounted());const x=h.current!==r,b=m.current,y=oe.useMemo(()=>{if(i)return null;const w=!x&&!gc(b,s);return x||w?A():null},[i,x,s,b,A]);return y!==null?y:f}function bYe(e){const t=VF(),{name:r,disabled:s,control:a=t,shouldUnregister:i,defaultValue:o,exact:l=!0}=e,c=Cre(a._names.array,r),d=oe.useMemo(()=>At(a._formValues,r,At(a._defaultValues,r,o)),[a,r,o]),u=vYe({control:a,name:r,defaultValue:d,exact:l}),h=xYe({control:a,name:r,exact:l}),m=oe.useRef(e),f=oe.useRef(void 0),p=oe.useRef(a.register(r,{...e.rules,value:u,...Uo(e.disabled)?{disabled:e.disabled}:{}}));m.current=e;const A=oe.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!At(h.errors,r)},isDirty:{enumerable:!0,get:()=>!!At(h.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!At(h.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!At(h.validatingFields,r)},error:{enumerable:!0,get:()=>At(h.errors,r)}}),[h,r]),v=oe.useCallback(w=>p.current.onChange({target:{value:_re(w),name:r},type:HN.CHANGE}),[r]),x=oe.useCallback(()=>p.current.onBlur({target:{value:At(a._formValues,r),name:r},type:HN.BLUR}),[r,a._formValues]),b=oe.useCallback(w=>{const j=At(a._fields,r);j&&j._f&&w&&(j._f.ref={focus:()=>$i(w.focus)&&w.focus(),select:()=>$i(w.select)&&w.select(),setCustomValidity:N=>$i(w.setCustomValidity)&&w.setCustomValidity(N),reportValidity:()=>$i(w.reportValidity)&&w.reportValidity()})},[a._fields,r]),y=oe.useMemo(()=>({name:r,value:u,...Uo(s)||h.disabled?{disabled:h.disabled||s}:{},onChange:v,onBlur:x,ref:b}),[r,s,h.disabled,v,x,b,u]);return oe.useEffect(()=>{const w=a._options.shouldUnregister||i,j=f.current;j&&j!==r&&!c&&a.unregister(j),a.register(r,{...m.current.rules,...Uo(m.current.disabled)?{disabled:m.current.disabled}:{}});const N=(_,S)=>{const C=At(a._fields,_);C&&C._f&&(C._f.mount=S)};if(N(r,!0),w){const _=ca(At(a._options.defaultValues,r,m.current.defaultValue));Pn(a._defaultValues,r,_),bs(At(a._formValues,r))&&Pn(a._formValues,r,_)}return!c&&a.register(r),f.current=r,()=>{(c?w&&!a._state.action:w)?a.unregister(r):N(r,!1)}},[r,a,c,i]),oe.useEffect(()=>{a._setDisabledField({disabled:s,name:r})},[s,r,a]),oe.useMemo(()=>({field:y,formState:h,fieldState:A}),[y,h,A])}const yYe=e=>e.render(bYe(e)),qF=oe.createContext(null);qF.displayName="HookFormContext";const wYe=()=>oe.useContext(qF),jYe=e=>{const{children:t,watch:r,getValues:s,getFieldState:a,setError:i,clearErrors:o,setValue:l,trigger:c,formState:d,resetField:u,reset:h,handleSubmit:m,unregister:f,control:p,register:A,setFocus:v,subscribe:x}=e;return oe.createElement(qF.Provider,{value:oe.useMemo(()=>({watch:r,getValues:s,getFieldState:a,setError:i,clearErrors:o,setValue:l,trigger:c,formState:d,resetField:u,reset:h,handleSubmit:m,unregister:f,control:p,register:A,setFocus:v,subscribe:x}),[o,p,d,a,s,m,A,h,u,i,v,l,x,c,f,r])},oe.createElement(zF.Provider,{value:p},t))};var kre=(e,t,r,s,a)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[s]:a||!0}}:{},jv=e=>Array.isArray(e)?e:[e],EQ=()=>{let e=[];return{get observers(){return e},next:a=>{for(const i of e)i.next&&i.next(a)},subscribe:a=>(e.push(a),{unsubscribe:()=>{e=e.filter(i=>i!==a)}}),unsubscribe:()=>{e=[]}}};function Ere(e,t){const r={};for(const s in e)if(e.hasOwnProperty(s)){const a=e[s],i=t[s];if(a&&ya(a)&&i){const o=Ere(a,i);ya(o)&&(r[s]=o)}else e[s]&&(r[s]=i)}return r}var Ri=e=>ya(e)&&!Object.keys(e).length,KF=e=>e.type==="file",zN=e=>{if(!$F)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Bre=e=>e.type==="select-multiple",WF=e=>e.type==="radio",NYe=e=>WF(e)||qy(e),fE=e=>zN(e)&&e.isConnected;function _Ye(e,t){const r=t.slice(0,-1).length;let s=0;for(;s<r;)e=bs(e)?s++:e[t[s++]];return e}function CYe(e){for(const t in e)if(e.hasOwnProperty(t)&&!bs(e[t]))return!1;return!0}function da(e,t){const r=Array.isArray(t)?t:vS(t)?[t]:HF(t),s=r.length===1?e:_Ye(e,r),a=r.length-1,i=r[a];return s&&delete s[i],a!==0&&(ya(s)&&Ri(s)||Array.isArray(s)&&CYe(s))&&da(e,r.slice(0,-1)),e}var SYe=e=>{for(const t in e)if($i(e[t]))return!0;return!1};function Tre(e){return Array.isArray(e)||ya(e)&&!SYe(e)}function U3(e,t={}){for(const r in e){const s=e[r];Tre(s)?(t[r]=Array.isArray(s)?[]:{},U3(s,t[r])):bs(s)||(t[r]=!0)}return t}function aA(e,t,r){r||(r=U3(t));for(const s in e){const a=e[s];if(Tre(a))bs(t)||R3(r[s])?r[s]=U3(a,Array.isArray(a)?[]:{}):aA(a,to(t)?{}:t[s],r[s]);else{const i=t[s];r[s]=!gc(a,i)}}return r}const BQ={value:!1,isValid:!1},TQ={value:!0,isValid:!0};var Pre=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!bs(e[0].attributes.value)?bs(e[0].value)||e[0].value===""?TQ:{value:e[0].value,isValid:!0}:TQ:BQ}return BQ},Ire=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:s})=>bs(e)?e:t?e===""?NaN:e&&+e:r&&Vo(e)?new Date(e):s?s(e):e;const PQ={isValid:!1,value:null};var Ore=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,PQ):PQ;function IQ(e){const t=e.ref;return KF(t)?t.files:WF(t)?Ore(e.refs).value:Bre(t)?[...t.selectedOptions].map(({value:r})=>r):qy(t)?Pre(e.refs).value:Ire(bs(t.value)?e.ref.value:t.value,e)}var kYe=(e,t,r,s)=>{const a={};for(const i of e){const o=At(t,i);o&&Pn(a,i,o._f)}return{criteriaMode:r,names:[...e],fields:a,shouldUseNativeValidation:s}},VN=e=>e instanceof RegExp,_x=e=>bs(e)?e:VN(e)?e.source:ya(e)?VN(e.value)?e.value.source:e.value:e,OQ=e=>({isOnSubmit:!e||e===Ac.onSubmit,isOnBlur:e===Ac.onBlur,isOnChange:e===Ac.onChange,isOnAll:e===Ac.all,isOnTouch:e===Ac.onTouched});const FQ="AsyncFunction";var EYe=e=>!!e&&!!e.validate&&!!($i(e.validate)&&e.validate.constructor.name===FQ||ya(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===FQ)),BYe=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),LQ=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(s=>e.startsWith(s)&&/^\.\w+/.test(e.slice(s.length))));const Nv=(e,t,r,s)=>{for(const a of r||Object.keys(e)){const i=At(e,a);if(i){const{_f:o,...l}=i;if(o){if(o.refs&&o.refs[0]&&t(o.refs[0],a)&&!s)return!0;
vendor: 4,044 bytes, line 1340
1340if(o.ref&&t(o.ref,o.name)&&!s)return!0;if(Nv(l,t))break}else if(ya(l)&&Nv(l,t))break}}};function DQ(e,t,r){const s=At(e,r);if(s||vS(r))return{error:s,name:r};const a=r.split(".");for(;a.length;){const i=a.join("."),o=At(t,i),l=At(e,i);if(o&&!Array.isArray(o)&&r!==i)return{name:r};if(l&&l.type)return{name:i,error:l};if(l&&l.root&&l.root.type)return{name:`${i}.root`,error:l.root};a.pop()}return{name:r}}var TYe=(e,t,r,s)=>{r(e);const{name:a,...i}=e;return Ri(i)||Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find(o=>t[o]===(!s||Ac.all))},PYe=(e,t,r)=>!e||!t||e===t||jv(e).some(s=>s&&(r?s===t:s.startsWith(t)||t.startsWith(s))),IYe=(e,t,r,s,a)=>a.isOnAll?!1:!r&&a.isOnTouch?!(t||e):(r?s.isOnBlur:a.isOnBlur)?!e:(r?s.isOnChange:a.isOnChange)?e:!0,OYe=(e,t)=>!QF(At(e,t)).length&&da(e,t),FYe=(e,t,r)=>{const s=jv(At(e,r));return Pn(s,"root",t[r]),Pn(e,r,s),e};function RQ(e,t,r="validate"){if(Vo(e)||Array.isArray(e)&&e.every(Vo)||Uo(e)&&!e)return{type:r,message:Vo(e)?e:"",ref:t}}var Fp=e=>ya(e)&&!VN(e)?e:{value:e,message:""},UQ=async(e,t,r,s,a,i)=>{const{ref:o,refs:l,required:c,maxLength:d,minLength:u,min:h,max:m,pattern:f,validate:p,name:A,valueAsNumber:v,mount:x}=e._f,b=At(r,A);if(!x||t.has(A))return{};const y=l?l[0]:o,w=B=>{a&&y.reportValidity&&(y.setCustomValidity(Uo(B)?"":B||""),y.reportValidity())},j={},N=WF(o),_=qy(o),S=N||_,C=(v||KF(o))&&bs(o.value)&&bs(b)||zN(o)&&o.value===""||b===""||Array.isArray(b)&&!b.length,E=kre.bind(null,A,s,j),T=(B,L,P,F=qd.maxLength,M=qd.minLength)=>{const I=B?L:P;j[A]={type:B?F:M,message:I,ref:o,...E(B?F:M,I)}};if(i?!Array.isArray(b)||!b.length:c&&(!S&&(C||to(b))||Uo(b)&&!b||_&&!Pre(l).isValid||N&&!Ore(l).isValid)){const{value:B,message:L}=Vo(c)?{value:!!c,message:c}:Fp(c);if(B&&(j[A]={type:qd.required,message:L,ref:y,...E(qd.required,L)},!s))return w(L),j}if(!C&&(!to(h)||!to(m))){let B,L;const P=Fp(m),F=Fp(h);if(!to(b)&&!isNaN(b)){const M=o.valueAsNumber||b&&+b;to(P.value)||(B=M>P.value),to(F.value)||(L=M<F.value)}else{const M=o.valueAsDate||new Date(b),I=R=>new Date(new Date().toDateString()+" "+R),$=o.type=="time",V=o.type=="week";Vo(P.value)&&b&&(B=$?I(b)>I(P.value):V?b>P.value:M>new Date(P.value)),Vo(F.value)&&b&&(L=$?I(b)<I(F.value):V?b<F.value:M<new Date(F.value))}if((B||L)&&(T(!!B,P.message,F.message,qd.max,qd.min),!s))return w(j[A].message),j}if((d||u)&&!C&&(Vo(b)||i&&Array.isArray(b))){const B=Fp(d),L=Fp(u),P=!to(B.value)&&b.length>+B.value,F=!to(L.value)&&b.length<+L.value;if((P||F)&&(T(P,B.message,L.message),!s))return w(j[A].message),j}if(f&&!C&&Vo(b)){const{value:B,message:L}=Fp(f);if(VN(B)&&!b.match(B)&&(j[A]={type:qd.pattern,message:L,ref:o,...E(qd.pattern,L)},!s))return w(L),j}if(p){if($i(p)){const B=await p(b,r),L=RQ(B,y);if(L&&(j[A]={...L,...E(qd.validate,L.message)},!s))return w(L.message),j}else if(ya(p)){let B={};for(const L in p){if(!Ri(B)&&!s)break;const P=RQ(await p[L](b,r),y,L);P&&(B={...P,...E(L,P.message)},w(P.message),s&&(j[A]=B))}if(!Ri(B)&&(j[A]={ref:y,...B},!s))return j}}return w(!0),j};const LYe={mode:Ac.onSubmit,reValidateMode:Ac.onChange,shouldFocusError:!0};function DYe(e={}){let t={...LYe,...e},r={submitCount:0,isDirty:!1,isReady:!1,isLoading:$i(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},s={},a=ya(t.defaultValues)||ya(t.values)?ca(t.defaultValues||t.values)||{}:{},i=t.shouldUnregister?{}:ca(a),o={action:!1,mount:!1,watch:!1,keepIsValid:!1},l={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},c,d=0;const u={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},h={...u};let m={...h};const f={array:EQ(),state:EQ()},p=t.criteriaMode===Ac.all,A=re=>se=>{clearTimeout(d),d=setTimeout(re,se)},v=async re=>{if(!o.keepIsValid&&!t.disabled&&(h.isValid||m.isValid||re)){let se;t.resolver?(se=Ri((await S()).errors),x()):se=await E(s,!0),se!==r.isValid&&f.state.next({isValid:se})}},x=(re,se)=>
vendor: 1,743 bytes, line 1340
1340{!t.disabled&&(h.isValidating||h.validatingFields||m.isValidating||m.validatingFields)&&((re||Array.from(l.mount)).forEach(Ae=>{Ae&&(se?Pn(r.validatingFields,Ae,se):da(r.validatingFields,Ae))}),f.state.next({validatingFields:r.validatingFields,isValidating:!Ri(r.validatingFields)}))},b=(re,se=[],Ae,Pe,Oe=!0,be=!0)=>{if(Pe&&Ae&&!t.disabled){if(o.action=!0,be&&Array.isArray(At(s,re))){const ue=Ae(At(s,re),Pe.argA,Pe.argB);Oe&&Pn(s,re,ue)}if(be&&Array.isArray(At(r.errors,re))){const ue=Ae(At(r.errors,re),Pe.argA,Pe.argB);Oe&&Pn(r.errors,re,ue),OYe(r.errors,re)}if((h.touchedFields||m.touchedFields)&&be&&Array.isArray(At(r.touchedFields,re))){const ue=Ae(At(r.touchedFields,re),Pe.argA,Pe.argB);Oe&&Pn(r.touchedFields,re,ue)}(h.dirtyFields||m.dirtyFields)&&(r.dirtyFields=aA(a,i)),f.state.next({name:re,isDirty:B(re,se),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else Pn(i,re,se)},y=(re,se)=>{Pn(r.errors,re,se),f.state.next({errors:r.errors})},w=re=>{r.errors=re,f.state.next({errors:r.errors,isValid:!1})},j=(re,se,Ae,Pe)=>{const Oe=At(s,re);if(Oe){const be=At(i,re,bs(Ae)?At(a,re):Ae);bs(be)||Pe&&Pe.defaultChecked||se?Pn(i,re,se?be:IQ(Oe._f)):F(re,be),o.mount&&!o.action&&v()}},N=(re,se,Ae,Pe,Oe)=>{let be=!1,ue=!1;const Ee={name:re};if(!t.disabled){if(!Ae||Pe){(h.isDirty||m.isDirty)&&(ue=r.isDirty,r.isDirty=Ee.isDirty=B(),be=ue!==Ee.isDirty);const De=gc(At(a,re),se);ue=!!At(r.dirtyFields,re),De?da(r.dirtyFields,re):Pn(r.dirtyFields,re,!0),Ee.dirtyFields=r.dirtyFields,be=be||(h.dirtyFields||m.dirtyFields)&&ue!==!De}if(Ae){const De=At(r.touchedFields,re);De||(Pn(r.touchedFields,re,Ae),Ee.touchedFields=r.touchedFields,be=be||(h.touchedFields||m.touchedFields)&&De!==Ae)}be&&Oe&&f.state.next(Ee)}return be?Ee:{}}
1340,_=(re,se,Ae,Pe)=>{const Oe=At(r.errors,re),be=(h.isValid||m.isValid)&&Uo(se)&&r.isValid!==se;if(t.delayError&&Ae?(c=A(()=>y(re,Ae)),c(t.delayError)):(clearTimeout(d),c=null,Ae?Pn(r.errors,re,Ae):da(r.errors,re)),(Ae?!gc(Oe,Ae):Oe)||!Ri(Pe)||be){const ue={...Pe,...be&&Uo(se)?{isValid:se}:{},errors:r.errors,name:re};r={...r,...ue},f.state.next(ue)}},S=async re=>(x(re,!0),await t.resolver(i,t.context,kYe(re||l.mount,s,t.criteriaMode,t.shouldUseNativeValidation))),C=async re=>{const{errors:se}=await S(re);if(x(re),re)for(const Ae of re){const Pe=At(se,Ae);Pe?Pn(r.errors,Ae,Pe):da(r.errors,Ae)}else r.errors=se;return se},E=async(re,se,Ae={valid:!0})=>{for(const Pe in re){const Oe=re[Pe];if(Oe){const{_f:be,...ue}=Oe;if(be){const Ee=l.array.has(be.name),De=Oe._f&&EYe(Oe._f);De&&h.validatingFields&&x([be.name],!0);const Ge=await UQ(Oe,l.disabled,i,p,t.shouldUseNativeValidation&&!se,Ee);if(De&&h.validatingFields&&x([be.name]),Ge[be.name]&&(Ae.valid=!1,se||e.shouldUseNativeValidation))break;!se&&(At(Ge,be.name)?Ee?FYe(r.errors,Ge,be.name):Pn(r.errors,be.name,Ge[be.name]):da(r.errors,be.name))}!Ri(ue)&&await E(ue,se,Ae)}}return Ae.valid},T=()=>{for(const re of l.unMount){const se=At(s,re);se&&(se._f.refs?se._f.refs.every(Ae=>!fE(Ae)):!fE(se._f.ref))&&X(re)}l.unMount=new Set},B=(re,se)=>!t.disabled&&(re&&se&&Pn(i,re,se),!gc(Q(),a)),L=(re,se,Ae)=>D3(re,l,{...o.mount?i:bs(se)?a:Vo(re)?{[re]:se}:se},Ae,se),P=re=>QF(At(o.mount?i:a,re,t.shouldUnregister?At(a,re,[]):[])),F=(re,se,Ae={})=>{const Pe=At(s,re);let Oe=se;if(Pe){const be=Pe._f;be&&(!be.disabled&&Pn(i,re,Ire(se,be)),Oe=zN(be.ref)&&to(se)?"":se,Bre(be.ref)?[...be.ref.options].forEach(ue=>ue.selected=Oe.includes(ue.value)):be.refs?qy(be.ref)?be.refs.forEach(ue=>{(!ue.defaultChecked||!ue.disabled)&&(Array.isArray(Oe)?ue.checked=!!Oe.find(Ee=>Ee===ue.value):ue.checked=Oe===ue.value||!!Oe)}):be.refs.forEach(ue=>ue.checked=ue.value===Oe):KF(be.ref)?be.ref.value="":(be.ref.value=Oe,be.ref.type||f.state.next({name:re,values:ca(i)})))}(Ae.shouldDirty||Ae.shouldTouch)&&N(re,Oe,Ae.shouldTouch,Ae.shouldDirty,!0),Ae.shouldValidate&&R(re)},M=(re,se,Ae)=>{for(const Pe in se){if(!se.hasOwnProperty(Pe))return;const Oe=se[Pe],be=re+"."+Pe,ue=At(s,be);(l.array.has(re)||ya(Oe)||ue&&!ue._f)&&!gm(Oe)?M(be,Oe,Ae):F(be,Oe,Ae)}},I=(re,se,Ae={})=>{const Pe=At(s,re),Oe=l.array.has(re),be=ca(se);Pn(i,re,be),Oe?(f.array.next({name:re,values:ca(i)}),(h.isDirty||h.dirtyFields||m.isDirty||m.dirtyFields)&&Ae.shouldDirty&&f.state.next({name:re,dirtyFields:aA(a,i),isDirty:B(re,be)})):Pe&&!Pe._f&&!to(be)?M(re,be,Ae):F(re,be,Ae),LQ(re,l)?f.state.next({...r,name:re,values:ca(i)}):f.state.next({name:o.mount?re:void 0,values:ca(i)})},$=async re=>{o.mount=!0;const se=re.target;let Ae=se.name,Pe=!0;const Oe=At(s,Ae),be=De=>{Pe=Number.isNaN(De)||gm(De)&&isNaN(De.getTime())||gc(De,At(i,Ae,De))},ue=OQ(t.mode),Ee=OQ(t.reValidateMode);if(Oe){let De,Ge;const Ye=se.type?IQ(Oe._f):_re(re),Tt=re.type===HN.BLUR||re.type===HN.FOCUS_OUT,Nt=!BYe(Oe._f)&&!t.resolver&&!At(r.errors,Ae)&&!Oe._f.deps||IYe(Tt,At(r.touchedFields,Ae),r.isSubmitted,Ee,ue),Pt=LQ(Ae,l,Tt);Pn(i,Ae,Ye),Tt?(!se||!se.readOnly)&&(Oe._f.onBlur&&Oe._f.onBlur(re),c&&c(0)):Oe._f.onChange&&Oe._f.onChange(re);const _t=N(Ae,Ye,Tt),zt=!Ri(_t)||Pt;if(!Tt&&f.state.next({name:Ae,type:re.type,values:ca(i)}),Nt)return(h.isValid||m.isValid)&&(t.mode==="onBlur"?Tt&&v():Tt||v()),zt&&f.state.next({name:Ae,...Pt?{}:_t});if(!Tt&&Pt&&f.state.next({...r}),t.resolver){const{errors:vt}=await S([Ae]);if(x([Ae]),be(Ye),Pe){const vr=DQ(r.errors,s,Ae),Rt=DQ(vt,s,vr.name||Ae);De=Rt.error,Ae=Rt.name,Ge=Ri(vt)}}else x([Ae],!0),De=(await UQ(Oe,l.disabled,i,p,t.shouldUseNativeValidation))[Ae],x([Ae]),be(Ye),Pe&&(De?Ge=!1:(h.isValid||m.isValid)&&(Ge=await E(s,!0)));Pe&&(Oe._f.deps&&(!Array.isArray(Oe._f.deps)||Oe._f.deps.length>0)&&R(Oe._f.deps),_(Ae,Ge,De,_t))}},V=(re,se)=>{if(At(r.errors,se)&&re.focus)return re.focus(),1},R=async(re,se={})=>{let Ae,Pe;const Oe=jv(re);if(t.resolver){const be=await C(bs(re)?re:Oe);Ae=Ri(be),Pe=re?!Oe.some(ue=>At(be,ue)):Ae}else re?(Pe=(await Promise.all(Oe.map(async be=>{const ue=At(s,be);return await E(ue&&ue._f?{[be]:ue}:ue)}))).every(Boolean),!(!Pe&&!r.isValid)&&v()):Pe=Ae=await E(s);return f.state.next({...!Vo(re)||(h.isValid||m.isValid)&&Ae!==r.isValid?{}:{name:re},...t.resolver||!re?{isValid:Ae}:{},errors:r.errors}),se.shouldFocus&&!Pe&&Nv(s,V,re?Oe:l.mount),Pe},Q=(re,se)=>{let Ae={...o.mount?i:a};return se&&(Ae=Ere(se.dirtyFields?r.dirtyFields:r.touchedFields,Ae)),bs(re)?Ae:Vo(re)?At(Ae,re):re.map(Pe=>At(Ae,Pe))},U=(re,se)=>({invalid:!!At((se||r).errors,re),isDirty:!!At((se||r).dirtyFields,re),error:At((se||r).errors,re),isValidating:!!At(r.validatingFields,re),isTouched:!!At((se||r).touchedFields,re)}),D=re=>{const se=re?jv(re):void 0;se==null||se.forEach(Ae=>da(r.errors,Ae)),se?se.forEach(Ae=>{f.state.next({name:Ae,errors:r.errors})}):f.state.next({errors:{}})},q=(re,se,Ae)=>{const Pe=(At(s,re,{_f:{}})._f||{}).ref,Oe=At(r.errors,re)||{},{ref:be,message:ue,type:Ee,...De}=Oe;Pn(r.errors,re,{...De,...se,ref:Pe}),f.state.next({name:re,errors:r.errors,isValid:!1}),Ae&&Ae.shouldFocus&&Pe&&Pe.focus&&Pe.focus()},G=(re,se)=>$i(re)?f.state.subscribe({next:Ae=>"values"in Ae&&re(L(void 0,se),Ae)}):L(re,se,!0),Y=re=>f.state.subscribe({next:se=>{PYe(re.name,se.name,re.exact)&&TYe(se,re.formState||h,Se,re.reRenderRoot)&&re.callback({values:{...i},...r,...se,defaultValues:a})}}).unsubscribe,K=re=>(o.mount=!0,m={...m,...re.formState},Y({...re,formState:{...u,...re.formState}})),X=(re,se={})=>{for(const Ae of re?jv(re):l.mount)l.mount.delete(Ae),l.array.delete(Ae),se.keepValue||(da(s,Ae),da(i,Ae)),!se.keepError&&da(r.errors,Ae),!se.keepDirty&&da(r.dirtyFields,Ae),!se.keepTouched&&da(r.touchedFields,Ae),!se.keepIsValidating&&da(r.validatingFields,Ae),!t.shouldUnregister&&!se.keepDefaultValue&&da(a,Ae);f.state.next({values:ca(i)}),f.state.next({...r,...se.keepDirty?{isDirty:B()}:{}}),!se.keepIsValid&&v()},ne=({disabled:re,name:se})=>
vendor: 5,760 bytes, line 1340
1340{if(Uo(re)&&o.mount||re||l.disabled.has(se)){const Oe=l.disabled.has(se)!==!!re;re?l.disabled.add(se):l.disabled.delete(se),Oe&&o.mount&&!o.action&&v()}},ae=(re,se={})=>{let Ae=At(s,re);const Pe=Uo(se.disabled)||Uo(t.disabled);return Pn(s,re,{...Ae||{},_f:{...Ae&&Ae._f?Ae._f:{ref:{name:re}},name:re,mount:!0,...se}}),l.mount.add(re),Ae?ne({disabled:Uo(se.disabled)?se.disabled:t.disabled,name:re}):j(re,!0,se.value),{...Pe?{disabled:se.disabled||t.disabled}:{},...t.progressive?{required:!!se.required,min:_x(se.min),max:_x(se.max),minLength:_x(se.minLength),maxLength:_x(se.maxLength),pattern:_x(se.pattern)}:{},name:re,onChange:$,onBlur:$,ref:Oe=>{if(Oe){ae(re,se),Ae=At(s,re);const be=bs(Oe.value)&&Oe.querySelectorAll&&Oe.querySelectorAll("input,select,textarea")[0]||Oe,ue=NYe(be),Ee=Ae._f.refs||[];if(ue?Ee.find(De=>De===be):be===Ae._f.ref)return;Pn(s,re,{_f:{...Ae._f,...ue?{refs:[...Ee.filter(fE),be,...Array.isArray(At(a,re))?[{}]:[]],ref:{type:be.type,name:re}}:{ref:be}}}),j(re,!1,void 0,be)}else Ae=At(s,re,{}),Ae._f&&(Ae._f.mount=!1),(t.shouldUnregister||se.shouldUnregister)&&!(Cre(l.array,re)&&o.action)&&l.unMount.add(re)}}},J=()=>t.shouldFocusError&&Nv(s,V,l.mount),W=re=>{Uo(re)&&(f.state.next({disabled:re}),Nv(s,(se,Ae)=>{const Pe=At(s,Ae);Pe&&(se.disabled=Pe._f.disabled||re,Array.isArray(Pe._f.refs)&&Pe._f.refs.forEach(Oe=>{Oe.disabled=Pe._f.disabled||re}))},0,!1))},ie=(re,se)=>async Ae=>{let Pe;Ae&&(Ae.preventDefault&&Ae.preventDefault(),Ae.persist&&Ae.persist());let Oe=ca(i);if(f.state.next({isSubmitting:!0}),t.resolver){const{errors:be,values:ue}=await S();x(),r.errors=be,Oe=ca(ue)}else await E(s);if(l.disabled.size)for(const be of l.disabled)da(Oe,be);if(da(r.errors,"root"),Ri(r.errors)){f.state.next({errors:{}});try{await re(Oe,Ae)}catch(be){Pe=be}}else se&&await se({...r.errors},Ae),J(),setTimeout(J);if(f.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Ri(r.errors)&&!Pe,submitCount:r.submitCount+1,errors:r.errors}),Pe)throw Pe},he=(re,se={})=>{At(s,re)&&(bs(se.defaultValue)?I(re,ca(At(a,re))):(I(re,se.defaultValue),Pn(a,re,ca(se.defaultValue))),se.keepTouched||da(r.touchedFields,re),se.keepDirty||(da(r.dirtyFields,re),r.isDirty=se.defaultValue?B(re,ca(At(a,re))):B()),se.keepError||(da(r.errors,re),h.isValid&&v()),f.state.next({...r}))},ee=(re,se={})=>{const Ae=re?ca(re):a,Pe=ca(Ae),Oe=Ri(re),be=Oe?a:Pe;if(se.keepDefaultValues||(a=Ae),!se.keepValues){if(se.keepDirtyValues){const ue=new Set([...l.mount,...Object.keys(aA(a,i))]);for(const Ee of Array.from(ue)){const De=At(r.dirtyFields,Ee),Ge=At(i,Ee),Ye=At(be,Ee);De&&!bs(Ge)?Pn(be,Ee,Ge):!De&&!bs(Ye)&&I(Ee,Ye)}}else{if($F&&bs(re))for(const ue of l.mount){const Ee=At(s,ue);if(Ee&&Ee._f){const De=Array.isArray(Ee._f.refs)?Ee._f.refs[0]:Ee._f.ref;if(zN(De)){const Ge=De.closest("form");if(Ge){Ge.reset();break}}}}if(se.keepFieldsRef)for(const ue of l.mount)I(ue,At(be,ue));else s={}}i=t.shouldUnregister?se.keepDefaultValues?ca(a):{}:ca(be),f.array.next({values:{...be}}),f.state.next({values:{...be}})}l={mount:se.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},o.mount=!h.isValid||!!se.keepIsValid||!!se.keepDirtyValues||!t.shouldUnregister&&!Ri(be),o.watch=!!t.shouldUnregister,o.keepIsValid=!!se.keepIsValid,o.action=!1,se.keepErrors||(r.errors={}),f.state.next({submitCount:se.keepSubmitCount?r.submitCount:0,isDirty:Oe?!1:se.keepDirty?r.isDirty:!!(se.keepDefaultValues&&!gc(re,a)),isSubmitted:se.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:Oe?{}:se.keepDirtyValues?se.keepDefaultValues&&i?aA(a,i):r.dirtyFields:se.keepDefaultValues&&re?aA(a,re):se.keepDirty?r.dirtyFields:{},touchedFields:se.keepTouched?r.touchedFields:{},errors:se.keepErrors?r.errors:{},isSubmitSuccessful:se.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:a})},xe=(re,se)=>ee($i(re)?re(i):re,{...t.resetOptions,...se}),we=(re,se={})=>{const Ae=At(s,re),Pe=Ae&&Ae._f;if(Pe){const Oe=Pe.refs?Pe.refs[0]:Pe.ref;Oe.focus&&setTimeout(()=>{Oe.focus(),se.shouldSelect&&$i(Oe.select)&&Oe.select()})}},Se=re=>{r={...r,...re}},Ce={control:{register:ae,unregister:X,getFieldState:U,handleSubmit:ie,setError:q,_subscribe:Y,_runSchema:S,_updateIsValidating:x,_focusError:J,_getWatch:L,_getDirty:B,_setValid:v,_setFieldArray:b,_setDisabledField:ne,_setErrors:w,_getFieldArray:P,_reset:ee,_resetDefaultValues:()=>$i(t.defaultValues)&&t.defaultValues().then(re=>{xe(re,t.resetOptions),f.state.next({isLoading:!1})}),_removeUnmounted:T,_disableForm:W,_subjects:f,_proxyFormState:h,get _fields(){return s},get _formValues(){return i},get _state(){return o},set _state(re){o=re},get _defaultValues(){return a},get _names(){return l},set _names(re){l=re},get _formState(){return r},get _options(){return t},set _options(re){t={...t,...re}}},subscribe:K,trigger:R,register:ae,handleSubmit:ie,watch:G,setValue:I,getValues:Q,reset:xe,resetField:he,clearErrors:D,unregister:X,setError:q,setFocus:we,getFieldState:U};return{...Ce,formControl:Ce}}function Cd(e={}){const t=oe.useRef(void 0),r=oe.useRef(void 0),[s,a]=oe.useState({isDirty:!1,isValidating:!1,isLoading:$i(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:$i(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:s},e.defaultValues&&!$i(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:o,...l}=DYe(e);t.current={...l,formState:s}}const i=t.current.control;return i._options=e,GF(()=>{const o=i._subscribe({formState:i._proxyFormState,callback:()=>a({...i._formState}
1340),reRenderRoot:!0});return a(l=>({...l,isReady:!0})),i._formState.isReady=!0,o},[i]),oe.useEffect(()=>i._disableForm(e.disabled),[i,e.disabled]),oe.useEffect(()=>{e.mode&&(i._options.mode=e.mode),e.reValidateMode&&(i._options.reValidateMode=e.reValidateMode)},[i,e.mode,e.reValidateMode]),oe.useEffect(()=>{e.errors&&(i._setErrors(e.errors),i._focusError())},[i,e.errors]),oe.useEffect(()=>{e.shouldUnregister&&i._subjects.state.next({values:i._getWatch()})},[i,e.shouldUnregister]),oe.useEffect(()=>{if(i._proxyFormState.isDirty){const o=i._getDirty();o!==s.isDirty&&i._subjects.state.next({isDirty:o})}},[i,s.isDirty]),oe.useEffect(()=>{var o;e.values&&!gc(e.values,r.current)?(i._reset(e.values,{keepFieldsRef:!0,...i._options.resetOptions}),!((o=i._options.resetOptions)===null||o===void 0)&&o.keepIsValid||i._setValid(),r.current=e.values,a(l=>({...l}))):i._resetDefaultValues()},[i,e.values]),oe.useEffect(()=>{i._state.mount||(i._setValid(),i._state.mount=!0),i._state.watch&&(i._state.watch=!1,i._subjects.state.next({...i._formState})),i._removeUnmounted()}),t.current.formState=oe.useMemo(()=>Sre(s,i),[i,s]),t.current}var Fre={exports:{}},Wn={};/**
1341 * @license React
1342 * react-is.production.js
1343 *
1344 * Copyright (c) Meta Platforms, Inc. and affiliates.
1345 *
1346 * This source code is licensed under the MIT license found in the
1347 * LICENSE file in the root directory of this source tree.
1348 */var YF=Symbol.for("react.transitional.element"),JF=Symbol.for("react.portal"),bS=Symbol.for("react.fragment"),yS=Symbol.for("react.strict_mode"),wS=Symbol.for("react.profiler"),jS=Symbol.for("react.consumer"),NS=Symbol.for("react.context"),_S=Symbol.for("react.forward_ref"),CS=Symbol.for("react.suspense"),SS=Symbol.for("react.suspense_list"),kS=Symbol.for("react.memo"),ES=Symbol.for("react.lazy"),RYe=Symbol.for("react.view_transition"),UYe=Symbol.for("react.client.reference");function ql(e){if(typeof e=="object"&&e!==null){var t=e.$$typeof;switch(t){case YF:switch(e=e.type,e){case bS:case wS:case yS:case CS:case SS:case RYe:return e;default:switch(e=e&&e.$$typeof,e){case NS:case _S:case ES:case kS:return e;case jS:return e;default:return t}}case JF:return t}}}Wn.ContextConsumer=jS;Wn.ContextProvider=NS;Wn.Element=YF;Wn.ForwardRef=_S;Wn.Fragment=bS;Wn.Lazy=ES;Wn.Memo=kS;Wn.Portal=JF;Wn.Profiler=wS;Wn.StrictMode=yS;Wn.Suspense=CS;Wn.SuspenseList=SS;Wn.isContextConsumer=function(e){return ql(e)===jS};Wn.isContextProvider=function(e){return ql(e)===NS};Wn.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===YF};Wn.isForwardRef=function(e){return ql(e)===_S};Wn.isFragment=function(e){return ql(e)===bS};Wn.isLazy=function(e){return ql(e)===ES};Wn.isMemo=function(e){return ql(e)===kS};Wn.isPortal=function(e){return ql(e)===JF};Wn.isProfiler=function(e){return ql(e)===wS};Wn.isStrictMode=function(e){return ql(e)===yS};Wn.isSuspense=function(e){return ql(e)===CS};Wn.isSuspenseList=function(e){return ql(e)===SS};Wn.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===bS||e===wS||e===yS||e===CS||e===SS||typeof e=="object"&&e!==null&&(e.$$typeof===ES||e.$$typeof===kS||e.$$typeof===NS||e.$$typeof===jS||e.$$typeof===_S||e.$$typeof===UYe||e.getModuleId!==void 0)};Wn.typeOf=ql;Fre.exports=Wn;var Lre=Fre.exports;function iu(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function Dre(e){if(g.isValidElement(e)||Lre.isValidElementType(e)||!iu(e))return e;const t={};return Object.keys(e).forEach(r=>{t[r]=Dre(e[r])}),t}function tl(e,t,r={clone:!0}){const s=r.clone?{...e}:e;return iu(e)&&iu(t)&&Object.keys(t).forEach(a=>{g.isValidElement(t[a])||Lre.isValidElementType(t[a])?s[a]=t[a]:iu(t[a])&&Object.prototype.hasOwnProperty.call(e,a)&&iu(e[a])?s[a]=tl(e[a],t[a],r):r.clone?s[a]=iu(t[a])?Dre(t[a]):t[a]:s[a]=t[a]}),s}function Gm(e,...t){const r=new URL(`https://mui.com/production-error/?code=${e}`);return t.forEach(s=>r.searchParams.append("args[]",s)),`Minified MUI error #${e}; visit ${r} for the full message.`}function zg(e){if(typeof e!="string")throw new Error(Gm(7));return e.charAt(0).toUpperCase()+e.slice(1)}function M3(e,t){const r={...t};for(const s in e)if(Object.prototype.hasOwnProperty.call(e,s)){const a=s;if(a==="components"||a==="slots")r[a]={...e[a],...r[a]};else if(a==="componentsProps"||a==="slotProps"){const i=e[a],o=t[a];if(!o)r[a]=i||{};else if(!i)r[a]=o;else{r[a]={...o};for(const l in i)if(Object.prototype.hasOwnProperty.call(i,l)){const c=l;r[a][c]=M3(i[c],o[c])}}}else r[a]===void 0&&(r[a]=e[a])}return r}function MYe(e,t,r=void 0){const s={};for(const a in e){const i=e[a];let o="",l=!0;for(let c=0;c<i.length;c+=1){const d=i[c];
1348d&&(o+=(l===!0?"":" ")+t(d),l=!1,r&&r[d]&&(o+=" "+r[d]))}s[a]=o}return s}const MQ=e=>e,$Ye=()=>{let e=MQ;return{configure(t){e=t},generate(t){return e(t)},reset(){e=MQ}}},QYe=$Ye(),HYe={active:"active",checked:"checked",completed:"completed",disabled:"disabled",error:"error",expanded:"expanded",focused:"focused",focusVisible:"focusVisible",open:"open",readOnly:"readOnly",required:"required",selected:"selected"};function Rre(e,t,r="Mui"){const s=HYe[t];return s?`${r}-${s}`:`${QYe.generate(e)}-${t}`}function zYe(e,t,r="Mui"){const s={};return t.forEach(a=>{s[a]=Rre(e,a,r)}),s}function VYe(e,t=Number.MIN_SAFE_INTEGER,r=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,r))}function _v(e,t){return t?tl(e,t,{clone:!1}):e}function $Q(e,t){if(!e.containerQueries)return t;const r=Object.keys(t).filter(s=>s.startsWith("@container")).sort((s,a)=>{var o,l;const i=/min-width:\s*([0-9.]+)/;return+(((o=s.match(i))==null?void 0:o[1])||0)-+(((l=a.match(i))==null?void 0:l[1])||0)});return r.length?r.reduce((s,a)=>{const i=t[a];return delete s[a],s[a]=i,s},{...t}):t}function GYe(e,t){return t==="@"||t.startsWith("@")&&(e.some(r=>t.startsWith(`@${r}`))||!!t.match(/^@\d/))}function qYe(e,t){const r=t.match(/^@([^/]+)?\/?(.+)?$/);if(!r)return null;const[,s,a]=r,i=Number.isNaN(+s)?s||0:+s;return e.containerQueries(a).up(i)}function KYe(e){const t=(i,o)=>i.replace("@media",o?`@container ${o}`:"@container");function r(i,o){i.up=(...l)=>t(e.breakpoints.up(...l),o),i.down=(...l)=>t(e.breakpoints.down(...l),o),i.between=(...l)=>t(e.breakpoints.between(...l),o),i.only=(...l)=>t(e.breakpoints.only(...l),o),i.not=(...l)=>{const c=t(e.breakpoints.not(...l),o);return c.includes("not all and")?c.replace("not all and ","").replace("min-width:","width<").replace("max-width:","width>").replace("and","or"):c}}const s={},a=i=>(r(s,i),s);return r(a),{...e,containerQueries:a}}const BS={xs:0,sm:600,md:900,lg:1200,xl:1536},QQ={keys:["xs","sm","md","lg","xl"],up:e=>`@media (min-width:${BS[e]}px)`},WYe={containerQueries:e=>({up:t=>{let r=typeof t=="number"?t:BS[t]||t;return typeof r=="number"&&(r=`${r}px`),e?`@container ${e} (min-width:${r})`:`@container (min-width:${r})`}})};function Pu(e,t,r){const s=e.theme||{};if(Array.isArray(t)){const i=s.breakpoints||QQ;return t.reduce((o,l,c)=>(o[i.up(i.keys[c])]=r(t[c]),o),{})}if(typeof t=="object"){const i=s.breakpoints||QQ;return Object.keys(t).reduce((o,l)=>{if(GYe(i.keys,l)){const c=qYe(s.containerQueries?s:WYe,l);c&&(o[c]=r(t[l],l))}else if(Object.keys(i.values||BS).includes(l)){const c=i.up(l);o[c]=r(t[l],l)}else{const c=l;o[c]=t[c]}return o},{})}return r(t)}function YYe(e={}){var r;return((r=e.keys)==null?void 0:r.reduce((s,a)=>{const i=e.up(a);return s[i]={},s},{}))||{}}function HQ(e,t){return e.reduce((r,s)=>{const a=r[s];return(!a||Object.keys(a).length===0)&&delete r[s],r},t)}function TS(e,t,r=!0){if(!t||typeof t!="string")return null;if(e&&e.vars&&r){const s=`vars.${t}`.split(".").reduce((a,i)=>a&&a[i]?a[i]:null,e);if(s!=null)return s}return t.split(".").reduce((s,a)=>s&&s[a]!=null?s[a]:null,e)}function GN(e,t,r,s=r){let a;return typeof e=="function"?a=e(r):Array.isArray(e)?a=e[r]||s:a=TS(e,r)||s,t&&(a=t(a,s,e)),a}function aa(e){const{prop:t,cssProperty:r=e.prop,themeKey:s,transform:a}=e,i=o=>{if(o[t]==null)return null;const l=o[t],c=o.theme,d=TS(c,s)||{};return Pu(o,l,h=>{let m=GN(d,a,h);return h===m&&typeof h=="string"&&(m=GN(d,a,`${t}${h==="default"?"":zg(h)}`,h)),r===!1?m:{[r]:m}})};return i.propTypes={},i.filterProps=[t],i}function JYe(e){const t={};return r=>(t[r]===void 0&&(t[r]=e(r)),t[r])}const XYe={m:"margin",p:"padding"},ZYe={t:"Top",r:"Right",b:"Bottom",l:"Left",x:["Left","Right"],y:["Top","Bottom"]},zQ={marginX:"mx",marginY:"my",paddingX:"px",paddingY:"py"},eJe=JYe(e=>{if(e.length>2)if(zQ[e])e=zQ[e];else return[e];const[t,r]=e.split(""),s=XYe[t],a=ZYe[r]||"";return Array.isArray(a)?a.map(i=>s+i):[s+a]}),XF=["m","mt","mr","mb","ml","mx","my","margin","marginTop","marginRight","marginBottom","marginLeft","marginX","marginY","marginInline","marginInlineStart","marginInlineEnd","marginBlock","marginBlockStart","marginBlockEnd"],ZF=["p","pt","pr","pb","pl","px","py","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingX","paddingY","paddingInline","paddingInlineStart","paddingInlineEnd","paddingBlock","paddingBlockStart","paddingBlockEnd"];[...XF,...ZF];function Ky(e,t,r,s){const a=TS(e,t,!0)??r;
1348return typeof a=="number"||typeof a=="string"?i=>typeof i=="string"?i:typeof a=="string"?`calc(${i} * ${a})`:a*i:Array.isArray(a)?i=>{if(typeof i=="string")return i;const o=Math.abs(i),l=a[o];return i>=0?l:typeof l=="number"?-l:`-${l}`}:typeof a=="function"?a:()=>{}}function e6(e){return Ky(e,"spacing",8)}function Wy(e,t){return typeof t=="string"||t==null?t:e(t)}function tJe(e,t){return r=>e.reduce((s,a)=>(s[a]=Wy(t,r),s),{})}function rJe(e,t,r,s){if(!t.includes(r))return null;const a=eJe(r),i=tJe(a,s),o=e[r];return Pu(e,o,i)}function Ure(e,t){const r=e6(e.theme);return Object.keys(e).map(s=>rJe(e,t,s,r)).reduce(_v,{})}function Ls(e){return Ure(e,XF)}Ls.propTypes={};Ls.filterProps=XF;function Ds(e){return Ure(e,ZF)}Ds.propTypes={};Ds.filterProps=ZF;function PS(...e){const t=e.reduce((s,a)=>(a.filterProps.forEach(i=>{s[i]=a}),s),{}),r=s=>Object.keys(s).reduce((a,i)=>t[i]?_v(a,t[i](s)):a,{});return r.propTypes={},r.filterProps=e.reduce((s,a)=>s.concat(a.filterProps),[]),r}function Bl(e){return typeof e!="number"?e:`${e}px solid`}function Kl(e,t){return aa({prop:e,themeKey:"borders",transform:t})}const nJe=Kl("border",Bl),sJe=Kl("borderTop",Bl),aJe=Kl("borderRight",Bl),iJe=Kl("borderBottom",Bl),oJe=Kl("borderLeft",Bl),lJe=Kl("borderColor"),cJe=Kl("borderTopColor"),dJe=Kl("borderRightColor"),uJe=Kl("borderBottomColor"),hJe=Kl("borderLeftColor"),fJe=Kl("outline",Bl),mJe=Kl("outlineColor"),IS=e=>{if(e.borderRadius!==void 0&&e.borderRadius!==null){const t=Ky(e.theme,"shape.borderRadius",4),r=s=>({borderRadius:Wy(t,s)});return Pu(e,e.borderRadius,r)}return null};IS.propTypes={};IS.filterProps=["borderRadius"];PS(nJe,sJe,aJe,iJe,oJe,lJe,cJe,dJe,uJe,hJe,IS,fJe,mJe);const OS=e=>{if(e.gap!==void 0&&e.gap!==null){const t=Ky(e.theme,"spacing",8),r=s=>({gap:Wy(t,s)});return Pu(e,e.gap,r)}return null};OS.propTypes={};OS.filterProps=["gap"];const FS=e=>{if(e.columnGap!==void 0&&e.columnGap!==null){const t=Ky(e.theme,"spacing",8),r=s=>({columnGap:Wy(t,s)});return Pu(e,e.columnGap,r)}return null};FS.propTypes={};FS.filterProps=["columnGap"];const LS=e=>{if(e.rowGap!==void 0&&e.rowGap!==null){const t=Ky(e.theme,"spacing",8),r=s=>({rowGap:Wy(t,s)});return Pu(e,e.rowGap,r)}return null};LS.propTypes={};LS.filterProps=["rowGap"];const pJe=aa({prop:"gridColumn"}),AJe=aa({prop:"gridRow"}),gJe=aa({prop:"gridAutoFlow"}),xJe=aa({prop:"gridAutoColumns"}),vJe=aa({prop:"gridAutoRows"}),bJe=aa({prop:"gridTemplateColumns"}),yJe=aa({prop:"gridTemplateRows"}),wJe=aa({prop:"gridTemplateAreas"}),jJe=aa({prop:"gridArea"});PS(OS,FS,LS,pJe,AJe,gJe,xJe,vJe,bJe,yJe,wJe,jJe);function DA(e,t){return t==="grey"?t:e}const NJe=aa({prop:"color",themeKey:"palette",transform:DA}),_Je=aa({prop:"bgcolor",cssProperty:"backgroundColor",themeKey:"palette",transform:DA}),CJe=aa({prop:"backgroundColor",themeKey:"palette",transform:DA});PS(NJe,_Je,CJe);function Go(e){return e<=1&&e!==0?`${e*100}%`:e}const SJe=aa({prop:"width",transform:Go}),t6=e=>{if(e.maxWidth!==void 0&&e.maxWidth!==null){const t=r=>{var a,i,o,l,c;const s=((o=(i=(a=e.theme)==null?void 0:a.breakpoints)==null?void 0:i.values)==null?void 0:o[r])||BS[r];return s?((c=(l=e.theme)==null?void 0:l.breakpoints)==null?void 0:c.unit)!=="px"?{maxWidth:`${s}${e.theme.breakpoints.unit}`}:{maxWidth:s}:{maxWidth:Go(r)}};return Pu(e,e.maxWidth,t)}return null};t6.filterProps=["maxWidth"];const kJe=aa({prop:"minWidth",transform:Go}),EJe=aa({prop:"height",transform:Go}),BJe=aa({prop:"maxHeight",transform:Go}),TJe=aa({prop:"minHeight",transform:Go});aa({prop:"size",cssProperty:"width",transform:Go});aa({prop:"size",cssProperty:"height",transform:Go});const PJe=aa({prop:"boxSizing"});PS(SJe,t6,kJe,EJe,BJe,TJe,PJe);const DS={border:{themeKey:"borders",transform:Bl},borderTop:{themeKey:"borders",transform:Bl},borderRight:{themeKey:"borders",transform:Bl},borderBottom:{themeKey:"borders",transform:Bl},borderLeft:{themeKey:"borders",transform:Bl},borderColor:{themeKey:"palette"},borderTopColor:{themeKey:"palette"},borderRightColor:{themeKey:"palette"},borderBottomColor:{themeKey:"palette"},borderLeftColor:{themeKey:"palette"},outline:{themeKey:"borders",transform:Bl},outlineColor:{themeKey:"palette"},borderRadius:{themeKey:"shape.borderRadius",style:IS},color:{themeKey:"palette",transform:DA},bgcolor:{themeKey:"palette",cssProperty:"backgroundColor",transform:DA},backgroundColor:{themeKey:"palette",transform:DA},p:{style:Ds},pt:{style:Ds},pr:{style:Ds},pb:{style:Ds},pl:{style:Ds},px:{style:Ds},py:{style:Ds},padding:{style:Ds},paddingTop:{style:Ds},paddingRight:{style:Ds}
1348,paddingBottom:{style:Ds},paddingLeft:{style:Ds},paddingX:{style:Ds},paddingY:{style:Ds},paddingInline:{style:Ds},paddingInlineStart:{style:Ds},paddingInlineEnd:{style:Ds},paddingBlock:{style:Ds},paddingBlockStart:{style:Ds},paddingBlockEnd:{style:Ds},m:{style:Ls},mt:{style:Ls},mr:{style:Ls},mb:{style:Ls},ml:{style:Ls},mx:{style:Ls},my:{style:Ls},margin:{style:Ls},marginTop:{style:Ls},marginRight:{style:Ls},marginBottom:{style:Ls},marginLeft:{style:Ls},marginX:{style:Ls},marginY:{style:Ls},marginInline:{style:Ls},marginInlineStart:{style:Ls},marginInlineEnd:{style:Ls},marginBlock:{style:Ls},marginBlockStart:{style:Ls},marginBlockEnd:{style:Ls},displayPrint:{cssProperty:!1,transform:e=>({"@media print":{display:e}})},display:{},overflow:{},textOverflow:{},visibility:{},whiteSpace:{},flexBasis:{},flexDirection:{},flexWrap:{},justifyContent:{},alignItems:{},alignContent:{},order:{},flex:{},flexGrow:{},flexShrink:{},alignSelf:{},justifyItems:{},justifySelf:{},gap:{style:OS},rowGap:{style:LS},columnGap:{style:FS},gridColumn:{},gridRow:{},gridAutoFlow:{},gridAutoColumns:{},gridAutoRows:{},gridTemplateColumns:{},gridTemplateRows:{},gridTemplateAreas:{},gridArea:{},position:{},zIndex:{themeKey:"zIndex"},top:{},right:{},bottom:{},left:{},boxShadow:{themeKey:"shadows"},width:{transform:Go},maxWidth:{style:t6},minWidth:{transform:Go},height:{transform:Go},maxHeight:{transform:Go},minHeight:{transform:Go},boxSizing:{},font:{themeKey:"font"},fontFamily:{themeKey:"typography"},fontSize:{themeKey:"typography"},fontStyle:{themeKey:"typography"},fontWeight:{themeKey:"typography"},letterSpacing:{},textTransform:{},lineHeight:{},textAlign:{},typography:{cssProperty:!1,themeKey:"typography"}};function IJe(...e){const t=e.reduce((s,a)=>s.concat(Object.keys(a)),[]),r=new Set(t);return e.every(s=>r.size===Object.keys(s).length)}function OJe(e,t){return typeof e=="function"?e(t):e}function FJe(){function e(r,s,a,i){const o={[r]:s,theme:a},l=i[r];if(!l)return{[r]:s};const{cssProperty:c=r,themeKey:d,transform:u,style:h}=l;if(s==null)return null;if(d==="typography"&&s==="inherit")return{[r]:s};const m=TS(a,d)||{};return h?h(o):Pu(o,s,p=>{let A=GN(m,u,p);return p===A&&typeof p=="string"&&(A=GN(m,u,`${r}${p==="default"?"":zg(p)}`,p)),c===!1?A:{[c]:A}})}function t(r){const{sx:s,theme:a={},nested:i}=r||{};if(!s)return null;const o=a.unstable_sxConfig??DS;function l(c){let d=c;if(typeof c=="function")d=c(a);else if(typeof c!="object")return c;if(!d)return null;const u=YYe(a.breakpoints),h=Object.keys(u);let m=u;return Object.keys(d).forEach(f=>{const p=OJe(d[f],a);if(p!=null)if(typeof p=="object")if(o[f])m=_v(m,e(f,p,a,o));else{const A=Pu({theme:a},p,v=>({[f]:v}));IJe(A,p)?m[f]=t({sx:p,theme:a,nested:!0}):m=_v(m,A)}else m=_v(m,e(f,p,a,o))}),!i&&a.modularCssLayers?{"@layer sx":$Q(a,HQ(h,m))}:$Q(a,HQ(h,m))}return Array.isArray(s)?s.map(l):l(s)}return t}const Vg=FJe();Vg.filterProps=["sx"];function LJe(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]}function DJe(e){var t=document.createElement("style");return t.setAttribute("data-emotion",e.key),e.nonce!==void 0&&t.setAttribute("nonce",e.nonce),t.appendChild(document.createTextNode("")),t.setAttribute("data-s",""),t}var RJe=function(){function e(r){var s=this;this._insertTag=function(a){var i;s.tags.length===0?s.insertionPoint?i=s.insertionPoint.nextSibling:s.prepend?i=s.container.firstChild:i=s.before:i=s.tags[s.tags.length-1].nextSibling,s.container.insertBefore(a,i),s.tags.push(a)},this.isSpeedy=r.speedy===void 0?!0:r.speedy,this.tags=[],this.ctr=0,this.nonce=r.nonce,this.key=r.key,this.container=r.container,this.prepend=r.prepend,this.insertionPoint=r.insertionPoint,this.before=null}var t=e.prototype;return t.hydrate=function(s){s.forEach(this._insertTag)},t.insert=function(s){this.ctr%(this.isSpeedy?65e3:1)===0&&this._insertTag(DJe(this));var a=this.tags[this.tags.length-1];if(this.isSpeedy){var i=LJe(a);try{i.insertRule(s,i.cssRules.length)}catch{}}else a.appendChild(document.createTextNode(s));this.ctr++}
vendor: 5,779 bytes, line 1348
1348,t.flush=function(){this.tags.forEach(function(s){var a;return(a=s.parentNode)==null?void 0:a.removeChild(s)}),this.tags=[],this.ctr=0},e}(),bi="-ms-",qN="-moz-",An="-webkit-",Mre="comm",r6="rule",n6="decl",UJe="@import",$re="@keyframes",MJe="@layer",$Je=Math.abs,RS=String.fromCharCode,QJe=Object.assign;function HJe(e,t){return ci(e,0)^45?(((t<<2^ci(e,0))<<2^ci(e,1))<<2^ci(e,2))<<2^ci(e,3):0}function Qre(e){return e.trim()}function zJe(e,t){return(e=t.exec(e))?e[0]:e}function gn(e,t,r){return e.replace(t,r)}function $3(e,t){return e.indexOf(t)}function ci(e,t){return e.charCodeAt(t)|0}function ny(e,t,r){return e.slice(t,r)}function Xc(e){return e.length}function s6(e){return e.length}function b1(e,t){return t.push(e),e}function VJe(e,t){return e.map(t).join("")}var US=1,Gg=1,Hre=0,mo=0,ga=0,C0="";function MS(e,t,r,s,a,i,o){return{value:e,root:t,parent:r,type:s,props:a,children:i,line:US,column:Gg,length:o,return:""}}function Cx(e,t){return QJe(MS("",null,null,"",null,null,0),e,{length:-e.length},t)}function GJe(){return ga}function qJe(){return ga=mo>0?ci(C0,--mo):0,Gg--,ga===10&&(Gg=1,US--),ga}function rl(){return ga=mo<Hre?ci(C0,mo++):0,Gg++,ga===10&&(Gg=1,US++),ga}function fd(){return ci(C0,mo)}function Bj(){return mo}function Yy(e,t){return ny(C0,e,t)}function sy(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function zre(e){return US=Gg=1,Hre=Xc(C0=e),mo=0,[]}function Vre(e){return C0="",e}function Tj(e){return Qre(Yy(mo-1,Q3(e===91?e+2:e===40?e+1:e)))}function KJe(e){for(;(ga=fd())&&ga<33;)rl();return sy(e)>2||sy(ga)>3?"":" "}function WJe(e,t){for(;--t&&rl()&&!(ga<48||ga>102||ga>57&&ga<65||ga>70&&ga<97););return Yy(e,Bj()+(t<6&&fd()==32&&rl()==32))}function Q3(e){for(;rl();)switch(ga){case e:return mo;case 34:case 39:e!==34&&e!==39&&Q3(ga);break;case 40:e===41&&Q3(e);break;case 92:rl();break}return mo}function YJe(e,t){for(;rl()&&e+ga!==57;)if(e+ga===84&&fd()===47)break;return"/*"+Yy(t,mo-1)+"*"+RS(e===47?e:rl())}function JJe(e){for(;!sy(fd());)rl();return Yy(e,mo)}function XJe(e){return Vre(Pj("",null,null,null,[""],e=zre(e),0,[0],e))}function Pj(e,t,r,s,a,i,o,l,c){for(var d=0,u=0,h=o,m=0,f=0,p=0,A=1,v=1,x=1,b=0,y="",w=a,j=i,N=s,_=y;v;)switch(p=b,b=rl()){case 40:if(p!=108&&ci(_,h-1)==58){$3(_+=gn(Tj(b),"&","&\f"),"&\f")!=-1&&(x=-1);break}case 34:case 39:case 91:_+=Tj(b);break;case 9:case 10:case 13:case 32:_+=KJe(p);break;case 92:_+=WJe(Bj()-1,7);continue;case 47:switch(fd()){case 42:case 47:b1(ZJe(YJe(rl(),Bj()),t,r),c);break;default:_+="/"}break;case 123*A:l[d++]=Xc(_)*x;case 125*A:case 59:case 0:switch(b){case 0:case 125:v=0;case 59+u:x==-1&&(_=gn(_,/\f/g,"")),f>0&&Xc(_)-h&&b1(f>32?GQ(_+";",s,r,h-1):GQ(gn(_," ","")+";",s,r,h-2),c);break;case 59:_+=";";default:if(b1(N=VQ(_,t,r,d,u,a,l,y,w=[],j=[],h),i),b===123)if(u===0)Pj(_,t,N,N,w,i,h,l,j);else switch(m===99&&ci(_,3)===110?100:m){case 100:case 108:case 109:case 115:Pj(e,N,N,s&&b1(VQ(e,N,N,0,0,a,l,y,a,w=[],h),j),a,j,h,l,s?w:j);break;default:Pj(_,N,N,N,[""],j,0,l,j)}}d=u=f=0,A=x=1,y=_="",h=o;break;case 58:h=1+Xc(_),f=p;default:if(A<1){if(b==123)--A;else if(b==125&&A++==0&&qJe()==125)continue}switch(_+=RS(b),b*A){case 38:x=u>0?1:(_+="\f",-1);break;case 44:l[d++]=(Xc(_)-1)*x,x=1;break;case 64:fd()===45&&(_+=Tj(rl())),m=fd(),u=h=Xc(y=_+=JJe(Bj())),b++;break;case 45:p===45&&Xc(_)==2&&(A=0)}}return i}function VQ(e,t,r,s,a,i,o,l,c,d,u){for(var h=a-1,m=a===0?i:[""],f=s6(m),p=0,A=0,v=0;p<s;++p)for(var x=0,b=ny(e,h+1,h=$Je(A=o[p])),y=e;x<f;++x)(y=Qre(A>0?m[x]+" "+b:gn(b,/&\f/g,m[x])))&&(c[v++]=y);return MS(e,t,r,a===0?r6:l,c,d,u)}function ZJe(e,t,r){return MS(e,t,r,Mre,RS(GJe()),ny(e,2,-2),0)}function GQ(e,t,r,s){return MS(e,t,r,n6,ny(e,0,s),ny(e,s+1,-1),s)}function RA(e,t){for(var r="",s=s6(e),a=0;a<s;a++)r+=t(e[a],a,e,t)||"";return r}function eXe(e,t,r,s){switch(e.type){case MJe:if(e.children.length)break;case UJe:case n6:return e.return=e.return||e.value;case Mre:return"";case $re:return e.return=e.value+"{"+RA(e.children,s)+"}";case r6:e.value=e.props.join(",")}return Xc(r=RA(e.children,s))?e.return=e.value+"{"+r+"}":""}function tXe(e){var t=s6(e);return function(r,s,a,i){for(var o="",l=0;l<t;l++)o+=e[l](r,s,a,i)||"";return o}}function rXe(e){return function(t){t.root||(t=t.return)&&e(t)}}function Gre(e){var t=Object.create(null);return function(r){return t[r]===void 0&&(t[r]=e(r)),t[r]}}var nXe=function(t,r,s){for(var a=0,i=0;a=i,i=fd(),a===38&&i===12&&(r[s]=1),!sy(i);)rl();return Yy(t,mo)},sXe=function(t,r){var s=-1,a=44;do switch(sy(a)){case 0:a===38&&fd()===12&&(r[s]=1),t[s]+=nXe(mo-1,r,s);break;case 2:t[s]+=Tj(a);break;case 4:if(a===44){t[++s]=fd()===58?"&\f":"",r[s]=t[s].length;break}default:t[s]+=RS(a)}while(a=rl());return t},aXe=function(t,r){return Vre(sXe(zre(t),r))},qQ=new WeakMap,iXe=function(t){if(!(t.type!=="rule"||!t.parent||t.length<1)){for(var r=t.value,s=t.parent,a=t.column===s.column&&t.line===s.line;s.type!=="rule";)if(s=s.parent,!s)return;if(!(t.props.length===1&&r.charCodeAt(0)!==58&&!qQ.get(s))&&!a){qQ.set(t,!0);for(var i=[],o=aXe(r,i),l=s.props,c=0,d=0;c<o.length;c++)for(var u=0;u<l.length;u++,d++)t.props[d]=i[c]?o[c].replace(/&\f/g,l[u]):l[u]+" "+o[c]}}},oXe=function(t){if(t.type==="decl"){var r=t.value;r.charCodeAt(0)===108&&r.charCodeAt(2)===98&&(t.return="",t.value="")}};function qre(e,t){switch(HJe(e,t)){case 5103:return An+"print-"+e+e;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return An+e+e;
vendor: 4,183 bytes, line 1348
1348case 5349:case 4246:case 4810:case 6968:case 2756:return An+e+qN+e+bi+e+e;case 6828:case 4268:return An+e+bi+e+e;case 6165:return An+e+bi+"flex-"+e+e;case 5187:return An+e+gn(e,/(\w+).+(:[^]+)/,An+"box-$1$2"+bi+"flex-$1$2")+e;case 5443:return An+e+bi+"flex-item-"+gn(e,/flex-|-self/,"")+e;case 4675:return An+e+bi+"flex-line-pack"+gn(e,/align-content|flex-|-self/,"")+e;case 5548:return An+e+bi+gn(e,"shrink","negative")+e;case 5292:return An+e+bi+gn(e,"basis","preferred-size")+e;case 6060:return An+"box-"+gn(e,"-grow","")+An+e+bi+gn(e,"grow","positive")+e;case 4554:return An+gn(e,/([^-])(transform)/g,"$1"+An+"$2")+e;case 6187:return gn(gn(gn(e,/(zoom-|grab)/,An+"$1"),/(image-set)/,An+"$1"),e,"")+e;case 5495:case 3959:return gn(e,/(image-set\([^]*)/,An+"$1$`$1");case 4968:return gn(gn(e,/(.+:)(flex-)?(.*)/,An+"box-pack:$3"+bi+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+An+e+e;case 4095:case 3583:case 4068:case 2532:return gn(e,/(.+)-inline(.+)/,An+"$1$2")+e;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(Xc(e)-1-t>6)switch(ci(e,t+1)){case 109:if(ci(e,t+4)!==45)break;case 102:return gn(e,/(.+:)(.+)-([^]+)/,"$1"+An+"$2-$3$1"+qN+(ci(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~$3(e,"stretch")?qre(gn(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(ci(e,t+1)!==115)break;case 6444:switch(ci(e,Xc(e)-3-(~$3(e,"!important")&&10))){case 107:return gn(e,":",":"+An)+e;case 101:return gn(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+An+(ci(e,14)===45?"inline-":"")+"box$3$1"+An+"$2$3$1"+bi+"$2box$3")+e}break;case 5936:switch(ci(e,t+11)){case 114:return An+e+bi+gn(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return An+e+bi+gn(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return An+e+bi+gn(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return An+e+bi+e+e}return e}var lXe=function(t,r,s,a){if(t.length>-1&&!t.return)switch(t.type){case n6:t.return=qre(t.value,t.length);break;case $re:return RA([Cx(t,{value:gn(t.value,"@","@"+An)})],a);case r6:if(t.length)return VJe(t.props,function(i){switch(zJe(i,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return RA([Cx(t,{props:[gn(i,/:(read-\w+)/,":"+qN+"$1")]})],a);case"::placeholder":return RA([Cx(t,{props:[gn(i,/:(plac\w+)/,":"+An+"input-$1")]}),Cx(t,{props:[gn(i,/:(plac\w+)/,":"+qN+"$1")]}),Cx(t,{props:[gn(i,/:(plac\w+)/,bi+"input-$1")]})],a)}return""})}},cXe=[lXe],dXe=function(t){var r=t.key;if(r==="css"){var s=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(s,function(A){var v=A.getAttribute("data-emotion");v.indexOf(" ")!==-1&&(document.head.appendChild(A),A.setAttribute("data-s",""))})}var a=t.stylisPlugins||cXe,i={},o,l=[];o=t.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+r+' "]'),function(A){for(var v=A.getAttribute("data-emotion").split(" "),x=1;x<v.length;x++)i[v[x]]=!0;l.push(A)});var c,d=[iXe,oXe];{var u,h=[eXe,rXe(function(A){u.insert(A)})],m=tXe(d.concat(a,h)),f=function(v){return RA(XJe(v),m)};c=function(v,x,b,y){u=b,f(v?v+"{"+x.styles+"}":x.styles),y&&(p.inserted[x.name]=!0)}}var p={key:r,sheet:new RJe({key:r,container:o,nonce:t.nonce,speedy:t.speedy,prepend:t.prepend,insertionPoint:t.insertionPoint}),nonce:t.nonce,inserted:i,registered:{},insert:c};return p.sheet.hydrate(l),p},uXe=!0;function hXe(e,t,r){var s="";return r.split(" ").forEach(function(a){e[a]!==void 0?t.push(e[a]+";"):a&&(s+=a+" ")}),s}var Kre=function(t,r,s){var a=t.key+"-"+r.name;(s===!1||uXe===!1)&&t.registered[a]===void 0&&(t.registered[a]=r.styles)},fXe=function(t,r,s){Kre(t,r,s);var a=t.key+"-"+r.name;if(t.inserted[r.name]===void 0){var i=r;do t.insert(r===i?"."+a:"",i,t.sheet,!0),i=i.next;while(i!==void 0)}};function mXe(e){for(var t=0,r,s=0,a=e.length;a>=4;++s,a-=4)r=e.charCodeAt(s)&255|(e.charCodeAt(++s)&255)<<8|(e.charCodeAt(++s)&255)<<16|(e.charCodeAt(++s)&255)<<24,r=(r&65535)*1540483477+((r>>>16)*59797<<16),r^=r>>>24,t=(r&65535)*1540483477+((r>>>16)*59797<<16)^(t&65535)*1540483477+((t>>>16)*59797<<16);switch(a){case 3:t^=(e.charCodeAt(s+2)&255)<<16;case 2:t^=(e.charCodeAt(s+1)&255)<<8;case 1:t^=e.charCodeAt(s)&255,t=(t&65535)*1540483477+((t>>
1348>16)*59797<<16)}return t^=t>>>13,t=(t&65535)*1540483477+((t>>>16)*59797<<16),((t^t>>>15)>>>0).toString(36)}var pXe={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},AXe=/[A-Z]|^ms/g,gXe=/_EMO_([^_]+?)_([^]*?)_EMO_/g,Wre=function(t){return t.charCodeAt(1)===45},KQ=function(t){return t!=null&&typeof t!="boolean"},mE=Gre(function(e){return Wre(e)?e:e.replace(AXe,"-$&").toLowerCase()}),WQ=function(t,r){switch(t){case"animation":case"animationName":if(typeof r=="string")return r.replace(gXe,function(s,a,i){return Zc={name:a,styles:i,next:Zc},a})}return pXe[t]!==1&&!Wre(t)&&typeof r=="number"&&r!==0?r+"px":r};function ay(e,t,r){if(r==null)return"";var s=r;if(s.__emotion_styles!==void 0)return s;switch(typeof r){case"boolean":return"";case"object":{var a=r;if(a.anim===1)return Zc={name:a.name,styles:a.styles,next:Zc},a.name;var i=r;if(i.styles!==void 0){var o=i.next;if(o!==void 0)for(;o!==void 0;)Zc={name:o.name,styles:o.styles,next:Zc},o=o.next;var l=i.styles+";";return l}return xXe(e,t,r)}case"function":{if(e!==void 0){var c=Zc,d=r(e);return Zc=c,ay(e,t,d)}break}}var u=r;if(t==null)return u;var h=t[u];return h!==void 0?h:u}function xXe(e,t,r){var s="";if(Array.isArray(r))for(var a=0;a<r.length;a++)s+=ay(e,t,r[a])+";";else for(var i in r){var o=r[i];if(typeof o!="object"){var l=o;t!=null&&t[l]!==void 0?s+=i+"{"+t[l]+"}":KQ(l)&&(s+=mE(i)+":"+WQ(i,l)+";")}else if(Array.isArray(o)&&typeof o[0]=="string"&&(t==null||t[o[0]]===void 0))for(var c=0;c<o.length;c++)KQ(o[c])&&(s+=mE(i)+":"+WQ(i,o[c])+";");else{var d=ay(e,t,o);switch(i){case"animation":case"animationName":{s+=mE(i)+":"+d+";";break}default:s+=i+"{"+d+"}"}}}return s}var YQ=/label:\s*([^\s;{]+)\s*(;|$)/g,Zc;function Yre(e,t,r){if(e.length===1&&typeof e[0]=="object"&&e[0]!==null&&e[0].styles!==void 0)return e[0];var s=!0,a="";Zc=void 0;var i=e[0];if(i==null||i.raw===void 0)s=!1,a+=ay(r,t,i);else{var o=i;a+=o[0]}for(var l=1;l<e.length;l++)if(a+=ay(r,t,e[l]),s){var c=i;a+=c[l]}YQ.lastIndex=0;for(var d="",u;(u=YQ.exec(a))!==null;)d+="-"+u[1];var h=mXe(a)+d;return{name:h,styles:a,next:Zc}}var vXe=function(t){return t()},bXe=Qv.useInsertionEffect?Qv.useInsertionEffect:!1,yXe=bXe||vXe,Jre=g.createContext(typeof HTMLElement<"u"?dXe({key:"css"}):null);Jre.Provider;var wXe=function(t){return g.forwardRef(function(r,s){var a=g.useContext(Jre);return t(r,a,s)})},jXe=g.createContext({}),NXe=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|fetchpriority|fetchPriority|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|popover|popoverTarget|popoverTargetAction|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRen
1348dering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,_Xe=Gre(function(e){return NXe.test(e)||e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)<91}),CXe=_Xe,SXe=function(t){return t!=="theme"},JQ=function(t){return typeof t=="string"&&t.charCodeAt(0)>96?CXe:SXe},XQ=function(t,r,s){var a;if(r){var i=r.shouldForwardProp;a=t.__emotion_forwardProp&&i?function(o){return t.__emotion_forwardProp(o)&&i(o)}:i}return typeof a!="function"&&s&&(a=t.__emotion_forwardProp),a},kXe=function(t){var r=t.cache,s=t.serialized,a=t.isStringTag;return Kre(r,s,a),yXe(function(){return fXe(r,s,a)}),null},EXe=function e(t,r){var s=t.__emotion_real===t,a=s&&t.__emotion_base||t,i,o;r!==void 0&&(i=r.label,o=r.target);var l=XQ(t,r,s),c=l||JQ(a),d=!c("as");return function(){var u=arguments,h=s&&t.__emotion_styles!==void 0?t.__emotion_styles.slice(0):[];if(i!==void 0&&h.push("label:"+i+";"),u[0]==null||u[0].raw===void 0)h.push.apply(h,u);else{var m=u[0];h.push(m[0]);for(var f=u.length,p=1;p<f;p++)h.push(u[p],m[p])}var A=wXe(function(v,x,b){var y=d&&v.as||a,w="",j=[],N=v;if(v.theme==null){N={};for(var _ in v)N[_]=v[_];N.theme=g.useContext(jXe)}typeof v.className=="string"?w=hXe(x.registered,j,v.className):v.className!=null&&(w=v.className+" ");var S=Yre(h.concat(j),x.registered,N);w+=x.key+"-"+S.name,o!==void 0&&(w+=" "+o);var C=d&&l===void 0?JQ(y):c,E={};for(var T in v)d&&T==="as"||C(T)&&(E[T]=v[T]);return E.className=w,b&&(E.ref=b),g.createElement(g.Fragment,null,g.createElement(kXe,{cache:x,serialized:S,isStringTag:typeof y=="string"}),g.createElement(y,E))});return A.displayName=i!==void 0?i:"Styled("+(typeof a=="string"?a:a.displayName||a.name||"Component")+")",A.defaultProps=t.defaultProps,A.__emotion_real=A,A.__emotion_base=a,A.__emotion_styles=h,A.__emotion_forwardProp=l,Object.defineProperty(A,"toString",{value:function(){return"."+o}}),A.withComponent=function(v,x){var b=e(v,n3({},r,x,{shouldForwardProp:XQ(A,x,!0)}));return b.apply(void 0,h)},A}},BXe=["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"],H3=EXe.bind(null);BXe.forEach(function(e){H3[e]=H3(e)});/**
1349 * @mui/styled-engine v6.5.0
1350 *
1351 * @license MIT
1352 * This source code is licensed under the MIT license found in the
1353 * LICENSE file in the root directory of this source tree.
1354 */function TXe(e,t){return H3(e,t)}function PXe(e,t){Array.isArray(e.__emotion_styles)&&(e.__emotion_styles=t(e.__emotion_styles))}const ZQ=[];function Nm(e){return ZQ[0]=e,Yre(ZQ)}const IXe=e=>{const t=Object.keys(e).map(r=>({key:r,val:e[r]}))||[];return t.sort((r,s)=>r.val-s.val),t.reduce((r,s)=>({...r,[s.key]:s.val}),{})};function OXe(e){const{values:t={xs:0,sm:600,md:900,lg:1200,xl:1536},unit:r="px",step:s=5,...a}=e,i=IXe(t),o=Object.keys(i);function l(m){return`@media (min-width:${typeof t[m]=="number"?t[m]:m}${r})`}function c(m){return`@media (max-width:${(typeof t[m]=="number"?t[m]:m)-s/100}${r})`}function d(m,f){const p=o.indexOf(f);return`@media (min-width:${typeof t[m]=="number"?t[m]:m}${r}) and (max-width:${(p!==-1&&typeof t[o[p]]=="number"?t[o[p]]:f)-s/100}${r})`}function u(m){return o.indexOf(m)+1<o.length?d(m,o[o.indexOf(m)+1]):l(m)}function h(m){const f=o.indexOf(m);return f===0?l(o[1]):f===o.length-1?c(o[f]):d(m,o[o.indexOf(m)+1]).replace("@media","@media not all and")}return{keys:o,values:i,up:l,down:c,between:d,only:u,not:h,unit:r,...a}}const FXe={borderRadius:4};function Xre(e=8,t=e6({spacing:e}
1354)){if(e.mui)return e;const r=(...s)=>(s.length===0?[1]:s).map(i=>{const o=t(i);return typeof o=="number"?`${o}px`:o}).join(" ");return r.mui=!0,r}function LXe(e,t){var s;const r=this;if(r.vars){if(!((s=r.colorSchemes)!=null&&s[e])||typeof r.getColorSchemeSelector!="function")return{};let a=r.getColorSchemeSelector(e);return a==="&"?t:((a.includes("data-")||a.includes("."))&&(a=`*:where(${a.replace(/\s*&$/,"")}) &`),{[a]:t})}return r.palette.mode===e?t:{}}function Zre(e={},...t){const{breakpoints:r={},palette:s={},spacing:a,shape:i={},...o}=e,l=OXe(r),c=Xre(a);let d=tl({breakpoints:l,direction:"ltr",components:{},palette:{mode:"light",...s},spacing:c,shape:{...FXe,...i}},o);return d=KYe(d),d.applyStyles=LXe,d=t.reduce((u,h)=>tl(u,h),d),d.unstable_sxConfig={...DS,...o==null?void 0:o.unstable_sxConfig},d.unstable_sx=function(h){return Vg({sx:h,theme:this})},d}function ene(e){const{variants:t,...r}=e,s={variants:t,style:Nm(r),isProcessed:!0};return s.style===r||t&&t.forEach(a=>{typeof a.style!="function"&&(a.style=Nm(a.style))}),s}const DXe=Zre();function pE(e){return e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"}function xm(e,t){return t&&e&&typeof e=="object"&&e.styles&&!e.styles.startsWith("@layer")&&(e.styles=`@layer ${t}{${String(e.styles)}}`),e}function RXe(e){return e?(t,r)=>r[e]:null}function UXe(e,t,r){e.theme=QXe(e.theme)?r:e.theme[t]||e.theme}function Ij(e,t,r){const s=typeof t=="function"?t(e):t;if(Array.isArray(s))return s.flatMap(a=>Ij(e,a,r));if(Array.isArray(s==null?void 0:s.variants)){let a;if(s.isProcessed)a=r?xm(s.style,r):s.style;else{const{variants:i,...o}=s;a=r?xm(Nm(o),r):o}return tne(e,s.variants,[a],r)}return s!=null&&s.isProcessed?r?xm(Nm(s.style),r):s.style:r?xm(Nm(s),r):s}function tne(e,t,r=[],s=void 0){var i;let a;e:for(let o=0;o<t.length;o+=1){const l=t[o];if(typeof l.props=="function"){if(a??(a={...e,...e.ownerState,ownerState:e.ownerState}),!l.props(a))continue}else for(const c in l.props)if(e[c]!==l.props[c]&&((i=e.ownerState)==null?void 0:i[c])!==l.props[c])continue e;typeof l.style=="function"?(a??(a={...e,...e.ownerState,ownerState:e.ownerState}),r.push(s?xm(Nm(l.style(a)),s):l.style(a))):r.push(s?xm(Nm(l.style),s):l.style)}return r}function MXe(e={}){const{themeId:t,defaultTheme:r=DXe,rootShouldForwardProp:s=pE,slotShouldForwardProp:a=pE}
1354=e;function i(l){UXe(l,t,r)}return(l,c={})=>{PXe(l,N=>N.filter(_=>_!==Vg));const{name:d,slot:u,skipVariantsResolver:h,skipSx:m,overridesResolver:f=RXe(zXe(u)),...p}=c,A=d&&d.startsWith("Mui")||u?"components":"custom",v=h!==void 0?h:u&&u!=="Root"&&u!=="root"||!1,x=m||!1;let b=pE;u==="Root"||u==="root"?b=s:u?b=a:HXe(l)&&(b=void 0);const y=TXe(l,{shouldForwardProp:b,label:$Xe(),...p}),w=N=>{if(N.__emotion_real===N)return N;if(typeof N=="function")return function(S){return Ij(S,N,S.theme.modularCssLayers?A:void 0)};if(iu(N)){const _=ene(N);return function(C){return _.variants?Ij(C,_,C.theme.modularCssLayers?A:void 0):C.theme.modularCssLayers?xm(_.style,A):_.style}}return N},j=(...N)=>{const _=[],S=N.map(w),C=[];if(_.push(i),d&&f&&C.push(function(L){var I,$;const F=($=(I=L.theme.components)==null?void 0:I[d])==null?void 0:$.styleOverrides;if(!F)return null;const M={};for(const V in F)M[V]=Ij(L,F[V],L.theme.modularCssLayers?"theme":void 0);return f(L,M)}),d&&!v&&C.push(function(L){var M,I;const P=L.theme,F=(I=(M=P==null?void 0:P.components)==null?void 0:M[d])==null?void 0:I.variants;return F?tne(L,F,[],L.theme.modularCssLayers?"theme":void 0):null}),x||C.push(Vg),Array.isArray(S[0])){const B=S.shift(),L=new Array(_.length).fill(""),P=new Array(C.length).fill("");let F;F=[...L,...B,...P],F.raw=[...L,...B.raw,...P],_.unshift(F)}const E=[..._,...S,...C],T=y(...E);return l.muiName&&(T.muiName=l.muiName),T};return y.withConfig&&(j.withConfig=y.withConfig),j}}function $Xe(e,t){return void 0}function QXe(e){for(const t in e)return!1;return!0}function HXe(e){return typeof e=="string"&&e.charCodeAt(0)>96}function zXe(e){return e&&e.charAt(0).toLowerCase()+e.slice(1)}function a6(e,t=0,r=1){return VYe(e,t,r)}function VXe(e){e=e.slice(1);const t=new RegExp(`.{1,${e.length>=6?2:1}}`,"g");let r=e.match(t);return r&&r[0].length===1&&(r=r.map(s=>s+s)),r?`rgb${r.length===4?"a":""}(${r.map((s,a)=>a<3?parseInt(s,16):Math.round(parseInt(s,16)/255*1e3)/1e3).join(", ")})`:""}function Jh(e){if(e.type)return e;if(e.charAt(0)==="#")return Jh(VXe(e));const t=e.indexOf("("),r=e.substring(0,t);if(!["rgb","rgba","hsl","hsla","color"].includes(r))throw new Error(Gm(9,e));let s=e.substring(t+1,e.length-1),a;if(r==="color"){if(s=s.split(" "),a=s.shift(),s.length===4&&s[3].charAt(0)==="/"&&(s[3]=s[3].slice(1)),!["srgb","display-p3","a98-rgb","prophoto-rgb","rec-2020"].includes(a))throw new Error(Gm(10,a))}else s=s.split(",");return s=s.map(i=>parseFloat(i)),{type:r,values:s,colorSpace:a}}const GXe=e=>{const t=Jh(e);return t.values.slice(0,3).map((r,s)=>t.type.includes("hsl")&&s!==0?`${r}%`:r).join(" ")},Xx=(e,t)=>{try{return GXe(e)}catch{return e}};function $S(e){const{type:t,colorSpace:r}=e;let{values:s}=e;return t.includes("rgb")?s=s.map((a,i)=>i<3?parseInt(a,10):a):t.includes("hsl")&&(s[1]=`${s[1]}%`,s[2]=`${s[2]}%`),t.includes("color")?s=`${r} ${s.join(" ")}`:s=`${s.join(", ")}`,`${t}(${s})`}function rne(e){e=Jh(e);const{values:t}=e,r=t[0],s=t[1]/100,a=t[2]/100,i=s*Math.min(a,1-a),o=(d,u=(d+r/30)%12)=>a-i*Math.max(Math.min(u-3,9-u,1),-1);let l="rgb";const c=[Math.round(o(0)*255),Math.round(o(8)*255),Math.round(o(4)*255)];return e.type==="hsla"&&(l+="a",c.push(t[3])),$S({type:l,values:c})}function z3(e){e=Jh(e);let t=e.type==="hsl"||e.type==="hsla"?Jh(rne(e)).values:e.values;return t=t.map(r=>(e.type!=="color"&&(r/=255),r<=.03928?r/12.92:((r+.055)/1.055)**2.4)),Number((.2126*t[0]+.7152*t[1]+.0722*t[2]).toFixed(3))}function qXe(e,t){const r=z3(e),s=z3(t);return(Math.max(r,s)+.05)/(Math.min(r,s)+.05)}function KXe(e,t){return e=Jh(e),t=a6(t),(e.type==="rgb"||e.type==="hsl")&&(e.type+="a"),e.type==="color"?e.values[3]=`/${t}`:e.values[3]=t,$S(e)}function y1(e,t,r){try{return KXe(e,t)}catch{return e}}function i6(e,t){if(e=Jh(e),t=a6(t),e.type.includes("hsl"))e.values[2]*=1-t;else if(e.type.includes("rgb")||e.type.includes("color"))for(let r=0;r<3;r+=1)e.values[r]*=1-t;return $S(e)}function Qn(e,t,r){try{return i6(e,t)}catch{return e}}function o6(e,t){if(e=Jh(e),t=a6(t),e.type.includes("hsl"))e.values[2]+=(100-e.values[2])*t;else if(e.type.includes("rgb"))for(let r=0;r<3;r+=1)e.values[r]+=(255-e.values[r])*t;else if(e.type.includes("color"))for(let r=0;r<3;r+=1)e.values[r]+=(1-e.values[r])*t;return $S(e)}function Hn(e,t,r){try{return o6(e,t)}catch{return e}}function WXe(e,t=.15){return z3(e)>.5?i6(e,t):o6(e,t)}function w1(e,t,r){try{return WXe(e,t)}catch{return e}}const YXe=g.createContext(void 0);function JXe(e){const{theme:t,name:r,props:s}=e;if(!t||!t.components||!t.components[r])return s;const a=t.components[r];return a.defaultProps?M3(a.defaultProps,s):!a.styleOverrides&&!a.variants?M3(a,s):s}function XXe({props:e,name:t}){const r=g.useContext(YXe);return JXe({props:e,name:t,theme:{components:r}})}const eH={theme:void 0};function ZXe(e){let t,r;return function(a){let i=t;return(i===void 0||a.theme!==r)&&(eH.theme=a.theme,i=ene(e(eH)),t=i,r=a.theme),i}}function eZe(e=""){function t(...s){if(!s.length)return"";const a=s[0];
1354return typeof a=="string"&&!a.match(/(#|\(|\)|(-?(\d*\.)?\d+)(px|em|%|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc))|^(-?(\d*\.)?\d+)$|(\d+ \d+ \d+)/)?`, var(--${e?`${e}-`:""}${a}${t(...s.slice(1))})`:`, ${a}`}return(s,...a)=>`var(--${e?`${e}-`:""}${s}${t(...a)})`}const tH=(e,t,r,s=[])=>{let a=e;t.forEach((i,o)=>{o===t.length-1?Array.isArray(a)?a[Number(i)]=r:a&&typeof a=="object"&&(a[i]=r):a&&typeof a=="object"&&(a[i]||(a[i]=s.includes(i)?[]:{}),a=a[i])})},tZe=(e,t,r)=>{function s(a,i=[],o=[]){Object.entries(a).forEach(([l,c])=>{(!r||r&&!r([...i,l]))&&c!=null&&(typeof c=="object"&&Object.keys(c).length>0?s(c,[...i,l],Array.isArray(c)?[...o,l]:o):t([...i,l],c,o))})}s(e)},rZe=(e,t)=>typeof t=="number"?["lineHeight","fontWeight","opacity","zIndex"].some(s=>e.includes(s))||e[e.length-1].toLowerCase().includes("opacity")?t:`${t}px`:t;function AE(e,t){const{prefix:r,shouldSkipGeneratingVar:s}=t||{},a={},i={},o={};return tZe(e,(l,c,d)=>{if((typeof c=="string"||typeof c=="number")&&(!s||!s(l,c))){const u=`--${r?`${r}-`:""}${l.join("-")}`,h=rZe(l,c);Object.assign(a,{[u]:h}),tH(i,l,`var(${u})`,d),tH(o,l,`var(${u}, ${h})`,d)}},l=>l[0]==="vars"),{css:a,vars:i,varsWithDefaults:o}}function nZe(e,t={}){const{getSelector:r=v,disableCssColorScheme:s,colorSchemeSelector:a}=t,{colorSchemes:i={},components:o,defaultColorScheme:l="light",...c}=e,{vars:d,css:u,varsWithDefaults:h}=AE(c,t);let m=h;const f={},{[l]:p,...A}=i;if(Object.entries(A||{}).forEach(([y,w])=>{const{vars:j,css:N,varsWithDefaults:_}=AE(w,t);m=tl(m,_),f[y]={css:N,vars:j}}),p){const{css:y,vars:w,varsWithDefaults:j}=AE(p,t);m=tl(m,j),f[l]={css:y,vars:w}}function v(y,w){var N,_;let j=a;if(a==="class"&&(j=".%s"),a==="data"&&(j="[data-%s]"),a!=null&&a.startsWith("data-")&&!a.includes("%s")&&(j=`[${a}="%s"]`),y){if(j==="media")return e.defaultColorScheme===y?":root":{[`@media (prefers-color-scheme: ${((_=(N=i[y])==null?void 0:N.palette)==null?void 0:_.mode)||y})`]:{":root":w}};if(j)return e.defaultColorScheme===y?`:root, ${j.replace("%s",String(y))}`:j.replace("%s",String(y))}return":root"}return{vars:m,generateThemeVars:()=>{let y={...d};return Object.entries(f).forEach(([,{vars:w}])=>{y=tl(y,w)}),y},generateStyleSheets:()=>{var S,C;const y=[],w=e.defaultColorScheme||"light";function j(E,T){Object.keys(T).length&&y.push(typeof E=="string"?{[E]:{...T}}:E)}j(r(void 0,{...u}),u);const{[w]:N,..._}=f;if(N){const{css:E}=N,T=(C=(S=i[w])==null?void 0:S.palette)==null?void 0:C.mode,B=!s&&T?{colorScheme:T,...E}:{...E};j(r(w,{...B}),B)}return Object.entries(_).forEach(([E,{css:T}])=>{var P,F;const B=(F=(P=i[E])==null?void 0:P.palette)==null?void 0:F.mode,L=!s&&B?{colorScheme:B,...T}:{...T};j(r(E,{...L}),L)}),y}}}function sZe(e){return function(r){return e==="media"?`@media (prefers-color-scheme: ${r})`:e?e.startsWith("data-")&&!e.includes("%s")?`[${e}="${r}"] &`:e==="class"?`.${r} &`:e==="data"?`[data-${r}] &`:`${e.replace("%s",r)} &`:"&"}}const iy={black:"#000",white:"#fff"},aZe={50:"#fafafa",100:"#f5f5f5",200:"#eeeeee",300:"#e0e0e0",400:"#bdbdbd",500:"#9e9e9e",600:"#757575",700:"#616161",800:"#424242",900:"#212121",A100:"#f5f5f5",A200:"#eeeeee",A400:"#bdbdbd",A700:"#616161"},Lp={50:"#f3e5f5",200:"#ce93d8",300:"#ba68c8",400:"#ab47bc",500:"#9c27b0",700:"#7b1fa2"},Dp={300:"#e57373",400:"#ef5350",500:"#f44336",700:"#d32f2f",800:"#c62828"},Sx={300:"#ffb74d",400:"#ffa726",500:"#ff9800",700:"#f57c00",900:"#e65100"},Rp={50:"#e3f2fd",200:"#90caf9",400:"#42a5f5",700:"#1976d2",800:"#1565c0"},Up={300:"#4fc3f7",400:"#29b6f6",500:"#03a9f4",700:"#0288d1",900:"#01579b"},Mp={300:"#81c784",400:"#66bb6a",500:"#4caf50",700:"#388e3c",800:"#2e7d32",900:"#1b5e20"};function nne(){return{text:{primary:"rgba(0, 0, 0, 0.87)",secondary:"rgba(0, 0, 0, 0.6)",disabled:"rgba(0, 0, 0, 0.38)"},divider:"rgba(0, 0, 0, 0.12)",background:{paper:iy.white,default:iy.white},action:{active:"rgba(0, 0, 0, 0.54)",hover:"rgba(0, 0, 0, 0.04)",hoverOpacity:.04,selected:"rgba(0, 0, 0, 0.08)",selectedOpacity:.08,disabled:"rgba(0, 0, 0, 0.26)",disabledBackground:"rgba(0, 0, 0, 0.12)",disabledOpacity:.38,focus:"rgba(0, 0, 0, 0.12)",focusOpacity:.12,activatedOpacity:.12}}}const iZe=nne();function sne(){return{text:{primary:iy.white,secondary:"rgba(255, 255, 255, 0.7)",disabled:"rgba(255, 255, 255, 0.5)",icon:"rgba(255, 255, 255, 0.5)"},divider:"rgba(255, 255, 255, 0.12)",background:{paper:"#121212",default:"#121212"},action:{active:iy.white,hover:"rgba(255, 255, 255, 0.08)",hoverOpacity:.08,selected:"rgba(255, 255, 255, 0.16)",selectedOpacity:.16,disabled:"rgba(255, 255, 255, 0.3)",disabledBackgroun
1354d:"rgba(255, 255, 255, 0.12)",disabledOpacity:.38,focus:"rgba(255, 255, 255, 0.12)",focusOpacity:.12,activatedOpacity:.24}}}const rH=sne();function nH(e,t,r,s){const a=s.light||s,i=s.dark||s*1.5;e[t]||(e.hasOwnProperty(r)?e[t]=e[r]:t==="light"?e.light=o6(e.main,a):t==="dark"&&(e.dark=i6(e.main,i)))}function oZe(e="light"){return e==="dark"?{main:Rp[200],light:Rp[50],dark:Rp[400]}:{main:Rp[700],light:Rp[400],dark:Rp[800]}}function lZe(e="light"){return e==="dark"?{main:Lp[200],light:Lp[50],dark:Lp[400]}:{main:Lp[500],light:Lp[300],dark:Lp[700]}}function cZe(e="light"){return e==="dark"?{main:Dp[500],light:Dp[300],dark:Dp[700]}:{main:Dp[700],light:Dp[400],dark:Dp[800]}}function dZe(e="light"){return e==="dark"?{main:Up[400],light:Up[300],dark:Up[700]}:{main:Up[700],light:Up[500],dark:Up[900]}}function uZe(e="light"){return e==="dark"?{main:Mp[400],light:Mp[300],dark:Mp[700]}:{main:Mp[800],light:Mp[500],dark:Mp[900]}}function hZe(e="light"){return e==="dark"?{main:Sx[400],light:Sx[300],dark:Sx[700]}:{main:"#ed6c02",light:Sx[500],dark:Sx[900]}}function l6(e){const{mode:t="light",contrastThreshold:r=3,tonalOffset:s=.2,...a}=e,i=e.primary||oZe(t),o=e.secondary||lZe(t),l=e.error||cZe(t),c=e.info||dZe(t),d=e.success||uZe(t),u=e.warning||hZe(t);function h(A){return qXe(A,rH.text.primary)>=r?rH.text.primary:iZe.text.primary}const m=({color:A,name:v,mainShade:x=500,lightShade:b=300,darkShade:y=700})=>{if(A={...A},!A.main&&A[x]&&(A.main=A[x]),!A.hasOwnProperty("main"))throw new Error(Gm(11,v?` (${v})`:"",x));if(typeof A.main!="string")throw new Error(Gm(12,v?` (${v})`:"",JSON.stringify(A.main)));return nH(A,"light",b,s),nH(A,"dark",y,s),A.contrastText||(A.contrastText=h(A.main)),A};let f;return t==="light"?f=nne():t==="dark"&&(f=sne()),tl({common:{...iy},mode:t,primary:m({color:i,name:"primary"}),secondary:m({color:o,name:"secondary",mainShade:"A400",lightShade:"A200",darkShade:"A700"}),error:m({color:l,name:"error"}),warning:m({color:u,name:"warning"}),info:m({color:c,name:"info"}),success:m({color:d,name:"success"}),grey:aZe,contrastThreshold:r,getContrastText:h,augmentColor:m,tonalOffset:s,...f},a)}function fZe(e){const t={};return Object.entries(e).forEach(s=>{const[a,i]=s;typeof i=="object"&&(t[a]=`${i.fontStyle?`${i.fontStyle} `:""}${i.fontVariant?`${i.fontVariant} `:""}${i.fontWeight?`${i.fontWeight} `:""}${i.fontStretch?`${i.fontStretch} `:""}${i.fontSize||""}${i.lineHeight?`/${i.lineHeight} `:""}${i.fontFamily||""}`)}),t}function mZe(e,t){return{toolbar:{minHeight:56,[e.up("xs")]:{"@media (orientation: landscape)":{minHeight:48}},[e.up("sm")]:{minHeight:64}},...t}}function pZe(e){return Math.round(e*1e5)/1e5}const sH={textTransform:"uppercase"},aH='"Roboto", "Helvetica", "Arial", sans-serif';function AZe(e,t){const{fontFamily:r=aH,fontSize:s=14,fontWeightLight:a=300,fontWeightRegular:i=400,fontWeightMedium:o=500,fontWeightBold:l=700,htmlFontSize:c=16,allVariants:d,pxToRem:u,...h}=typeof t=="function"?t(e):t,m=s/14,f=u||(v=>`${v/c*m}rem`),p=(v,x,b,y,w)=>({fontFamily:r,fontWeight:v,fontSize:f(x),lineHeight:b,...r===aH?{letterSpacing:`${pZe(y/x)}em`}:{},...w,...d}),A={h1:p(a,96,1.167,-1.5),h2:p(a,60,1.2,-.5),h3:p(i,48,1.167,0),h4:p(i,34,1.235,.25),h5:p(i,24,1.334,0),h6:p(o,20,1.6,.15),subtitle1:p(i,16,1.75,.15),subtitle2:p(o,14,1.57,.1),body1:p(i,16,1.5,.15),body2:p(i,14,1.43,.15),button:p(o,14,1.75,.4,sH),caption:p(i,12,1.66,.4),overline:p(i,12,2.66,1,sH),inherit:{fontFamily:"inherit",fontWeight:"inherit",fontSize:"inherit",lineHeight:"inherit",letterSpacing:"inherit"}};return tl({htmlFontSize:c,pxToRem:f,fontFamily:r,fontSize:s,fontWeightLight:a,fontWeightRegular:i,fontWeightMedium:o,fontWeightBold:l,...A},h,{clone:!1})}const gZe=.2,xZe=.14,vZe=.12;function gs(...e){return[`${e[0]}px ${e[1]}px ${e[2]}px ${e[3]}px rgba(0,0,0,${gZe})`,`${e[4]}px ${e[5]}px ${e[6]}px ${e[7]}px rgba(0,0,0,${xZe})`,`${e[8]}px ${e[9]}px ${e[10]}px ${e[11]}px rgba(0,0,0,${vZe})`].join(",")}const bZe=["none",gs(0,2,1,-1,0,1,1,0,0,1,3,0),gs(0,3,1,-2,0,2,2,0,0,1,5,0),gs(0,3,3,-2,0,3,4,0,0,1,8,0),gs(0,2,4,-1,0,4,5,0,0,1,10,0),gs(0,3,5,-1,0,5,8,0,0,1,14,0),gs(0,3,5,-1,0,6,10,0,0,1,18,0),gs(0,4,5,-2,0,7,10,1,0,2,16,1),gs(0,5,5,-3,0,8,10,1,0,3,14,2),gs(0,5,6,-3,0,9,12,1,0,3,16,2),gs(0,6,6,-3,0,10,14,1,0,4,18,3),gs(0,6,7,-4,0,11,15,1,0,4,20,3),gs(0,7,8,-4,0,12,17,2,0,5,22,4),gs(0,7,8,-4,0,13,19,2,0,5,24,4),gs(0,7,9,-4,0,14,21,2,0,5,26,4),gs(0,8,9,-5,0,15,22,2,0,6,28,5),gs(0,8,10,-5,0,16,24,2,0,6,30,5),gs(0,8,11,-5,0,17,26,2,0,6,32,5),gs(0,9,11,-5,0,18,28,2,0,7,34,6),gs(0,9,12,-6,0,19,29,2,0,7,36,6
1354),gs(0,10,13,-6,0,20,31,3,0,8,38,7),gs(0,10,13,-6,0,21,33,3,0,8,40,7),gs(0,10,14,-6,0,22,35,3,0,8,42,7),gs(0,11,14,-7,0,23,36,3,0,9,44,8),gs(0,11,15,-7,0,24,38,3,0,9,46,8)],yZe={easeInOut:"cubic-bezier(0.4, 0, 0.2, 1)",easeOut:"cubic-bezier(0.0, 0, 0.2, 1)",easeIn:"cubic-bezier(0.4, 0, 1, 1)",sharp:"cubic-bezier(0.4, 0, 0.6, 1)"},wZe={shortest:150,shorter:200,short:250,standard:300,complex:375,enteringScreen:225,leavingScreen:195};function iH(e){return`${Math.round(e)}ms`}function jZe(e){if(!e)return 0;const t=e/36;return Math.min(Math.round((4+15*t**.25+t/5)*10),3e3)}function NZe(e){const t={...yZe,...e.easing},r={...wZe,...e.duration};return{getAutoHeightDuration:jZe,create:(a=["all"],i={})=>{const{duration:o=r.standard,easing:l=t.easeInOut,delay:c=0,...d}=i;return(Array.isArray(a)?a:[a]).map(u=>`${u} ${typeof o=="string"?o:iH(o)} ${l} ${typeof c=="string"?c:iH(c)}`).join(",")},...e,easing:t,duration:r}}const _Ze={mobileStepper:1e3,fab:1050,speedDial:1050,appBar:1100,drawer:1200,modal:1300,snackbar:1400,tooltip:1500};function CZe(e){return iu(e)||typeof e>"u"||typeof e=="string"||typeof e=="boolean"||typeof e=="number"||Array.isArray(e)}function ane(e={}){const t={...e};function r(s){const a=Object.entries(s);for(let i=0;i<a.length;i++){const[o,l]=a[i];!CZe(l)||o.startsWith("unstable_")?delete s[o]:iu(l)&&(s[o]={...l},r(s[o]))}}return r(t),`import { unstable_createBreakpoints as createBreakpoints, createTransitions } from '@mui/material/styles';
1355
1356const theme = ${JSON.stringify(t,null,2)};
1357
1358theme.breakpoints = createBreakpoints(theme.breakpoints || {});
1359theme.transitions = createTransitions(theme.transitions || {});
1360
1361export default theme;`}function V3(e={},...t){const{breakpoints:r,mixins:s={},spacing:a,palette:i={},transitions:o={},typography:l={},shape:c,...d}=e;if(e.vars&&e.generateThemeVars===void 0)throw new Error(Gm(20));const u=l6(i),h=Zre(e);let m=tl(h,{mixins:mZe(h.breakpoints,s),palette:u,shadows:bZe.slice(),typography:AZe(u,l),transitions:NZe(o),zIndex:{..._Ze}});return m=tl(m,d),m=t.reduce((f,p)=>tl(f,p),m),m.unstable_sxConfig={...DS,...d==null?void 0:d.unstable_sxConfig},m.unstable_sx=function(p){return Vg({sx:p,theme:this})},m.toRuntimeSource=ane,m}function SZe(e){let t;return e<1?t=5.11916*e**2:t=4.5*Math.log(e+1)+2,Math.round(t*10)/1e3}const kZe=[...Array(25)].map((e,t)=>{if(t===0)return"none";const r=SZe(t);return`linear-gradient(rgba(255 255 255 / ${r}), rgba(255 255 255 / ${r}))`});function ine(e){return{inputPlaceholder:e==="dark"?.5:.42,inputUnderline:e==="dark"?.7:.42,switchTrackDisabled:e==="dark"?.2:.12,switchTrack:e==="dark"?.3:.38}}function one(e){return e==="dark"?kZe:[]}function EZe(e){const{palette:t={mode:"light"},opacity:r,overlays:s,...a}=e,i=l6(t);return{palette:i,opacity:{...ine(i.mode),...r},overlays:s||one(i.mode),...a}}function BZe(e){var t;return!!e[0].match(/(cssVarPrefix|colorSchemeSelector|modularCssLayers|rootSelector|typography|mixins|breakpoints|direction|transitions)/)||!!e[0].match(/sxConfig$/)||e[0]==="palette"&&!!((t=e[1])!=null&&t.match(/(mode|contrastThreshold|tonalOffset)/))}const TZe=e=>[...[...Array(25)].map((t,r)=>`--${e?`${e}-`:""}overlays-${r}`),`--${e?`${e}-`:""}palette-AppBar-darkBg`,`--${e?`${e}-`:""}palette-AppBar-darkColor`],PZe=e=>(t,r)=>{const s=e.rootSelector||":root",a=e.colorSchemeSelector;let i=a;if(a==="class"&&(i=".%s"),a==="data"&&(i="[data-%s]"),a!=null&&a.startsWith("data-")&&!a.includes("%s")&&(i=`[${a}="%s"]`),e.defaultColorScheme===t){if(t==="dark"){const o={};return TZe(e.cssVarPrefix).forEach(l=>{o[l]=r[l],delete r[l]}),i==="media"?{[s]:r,"@media (prefers-color-scheme: dark)":{[s]:o}}:i?{[i.replace("%s",t)]:o,[`${s}, ${i.replace("%s",t)}`]:r}:{[s]:{...r,...o}}}if(i&&i!=="media")return`${s}, ${i.replace("%s",String(t))}`}else if(t){if(i==="media")return{[`@media (prefers-color-scheme: ${String(t)})`]:{[s]:r}};if(i)return i.replace("%s",String(t))}return s};function IZe(e,t){t.forEach(r=>{e[r]||(e[r]={})})}function We(e,t,r){!e[t]&&r&&(e[t]=r)}function Zx(e){return typeof e!="string"||!e.startsWith("hsl")?e:rne(e)}function Kd(e,t){`${t}Channel`in e||(e[`${t}Channel`]=Xx(Zx(e[t])))}function OZe(e){return typeof e=="number"?`${e}px`:typeof e=="string"||typeof e=="function"||Array.isArray(e)?e:"8px"}const zc=e=>{try{return e()}catch{}},FZe=(e="mui")=>eZe(e);function gE(e,t,r,s){if(!t)return;t=t===!0?{}:t;const a=s==="dark"?"dark":"light";if(!r){e[s]=EZe({...t,palette:{mode:a,...t==null?void 0:t.palette}});return}const{palette:i,...o}=V3({...r,palette:{mode:a,...t==null?void 0:t.palette}});return e[s]={...t,palette:i,opacity:{...ine(a),...t==null?void 0:t.opacity}
1361,overlays:(t==null?void 0:t.overlays)||one(a)},o}function LZe(e={},...t){const{colorSchemes:r={light:!0},defaultColorScheme:s,disableCssColorScheme:a=!1,cssVarPrefix:i="mui",shouldSkipGeneratingVar:o=BZe,colorSchemeSelector:l=r.light&&r.dark?"media":void 0,rootSelector:c=":root",...d}=e,u=Object.keys(r)[0],h=s||(r.light&&u!=="light"?"light":u),m=FZe(i),{[h]:f,light:p,dark:A,...v}=r,x={...v};let b=f;if((h==="dark"&&!("dark"in r)||h==="light"&&!("light"in r))&&(b=!0),!b)throw new Error(Gm(21,h));const y=gE(x,b,d,h);p&&!x.light&&gE(x,p,void 0,"light"),A&&!x.dark&&gE(x,A,void 0,"dark");let w={defaultColorScheme:h,...y,cssVarPrefix:i,colorSchemeSelector:l,rootSelector:c,getCssVar:m,colorSchemes:x,font:{...fZe(y.typography),...y.font},spacing:OZe(d.spacing)};Object.keys(w.colorSchemes).forEach(C=>{const E=w.colorSchemes[C].palette,T=B=>{const L=B.split("-"),P=L[1],F=L[2];return m(B,E[P][F])};if(E.mode==="light"&&(We(E.common,"background","#fff"),We(E.common,"onBackground","#000")),E.mode==="dark"&&(We(E.common,"background","#000"),We(E.common,"onBackground","#fff")),IZe(E,["Alert","AppBar","Avatar","Button","Chip","FilledInput","LinearProgress","Skeleton","Slider","SnackbarContent","SpeedDialAction","StepConnector","StepContent","Switch","TableCell","Tooltip"]),E.mode==="light"){We(E.Alert,"errorColor",Qn(E.error.light,.6)),We(E.Alert,"infoColor",Qn(E.info.light,.6)),We(E.Alert,"successColor",Qn(E.success.light,.6)),We(E.Alert,"warningColor",Qn(E.warning.light,.6)),We(E.Alert,"errorFilledBg",T("palette-error-main")),We(E.Alert,"infoFilledBg",T("palette-info-main")),We(E.Alert,"successFilledBg",T("palette-success-main")),We(E.Alert,"warningFilledBg",T("palette-warning-main")),We(E.Alert,"errorFilledColor",zc(()=>E.getContrastText(E.error.main))),We(E.Alert,"infoFilledColor",zc(()=>E.getContrastText(E.info.main))),We(E.Alert,"successFilledColor",zc(()=>E.getContrastText(E.success.main))),We(E.Alert,"warningFilledColor",zc(()=>E.getContrastText(E.warning.main))),We(E.Alert,"errorStandardBg",Hn(E.error.light,.9)),We(E.Alert,"infoStandardBg",Hn(E.info.light,.9)),We(E.Alert,"successStandardBg",Hn(E.success.light,.9)),We(E.Alert,"warningStandardBg",Hn(E.warning.light,.9)),We(E.Alert,"errorIconColor",T("palette-error-main")),We(E.Alert,"infoIconColor",T("palette-info-main")),We(E.Alert,"successIconColor",T("palette-success-main")),We(E.Alert,"warningIconColor",T("palette-warning-main")),We(E.AppBar,"defaultBg",T("palette-grey-100")),We(E.Avatar,"defaultBg",T("palette-grey-400")),We(E.Button,"inheritContainedBg",T("palette-grey-300")),We(E.Button,"inheritContainedHoverBg",T("palette-grey-A100")),We(E.Chip,"defaultBorder",T("palette-grey-400")),We(E.Chip,"defaultAvatarColor",T("palette-grey-700")),We(E.Chip,"defaultIconColor",T("palette-grey-700")),We(E.FilledInput,"bg","rgba(0, 0, 0, 0.06)"),We(E.FilledInput,"hoverBg","rgba(0, 0, 0, 0.09)"),We(E.FilledInput,"disabledBg","rgba(0, 0, 0, 0.12)"),We(E.LinearProgress,"primaryBg",Hn(E.primary.main,.62)),We(E.LinearProgress,"secondaryBg",Hn(E.secondary.main,.62)),We(E.LinearProgress,"errorBg",Hn(E.error.main,.62)),We(E.LinearProgress,"infoBg",Hn(E.info.main,.62)),We(E.LinearProgress,"successBg",Hn(E.success.main,.62)),We(E.LinearProgress,"warningBg",Hn(E.warning.main,.62)),We(E.Skeleton,"bg",`rgba(${T("palette-text-primaryChannel")} / 0.11)`),We(E.Slider,"primaryTrack",Hn(E.primary.main,.62)),We(E.Slider,"secondaryTrack",Hn(E.secondary.main,.62)),We(E.Slider,"errorTrack",Hn(E.error.main,.62)),We(E.Slider,"infoTrack",Hn(E.info.main,.62)),We(E.Slider,"successTrack",Hn(E.success.main,.62)),We(E.Slider,"warningTrack",Hn(E.warning.main,.62));const B=w1(E.background.default,.8);We(E.SnackbarContent,"bg",B),We(E.SnackbarContent,"color",zc(()=>E.getContrastText(B))),We(E.SpeedDialAction,"fabHoverBg",w1(E.background.paper,.15)),We(E.StepConnector,"border",T("palette-grey-400")),We(E.StepContent,"border",T("palette-grey-400")),We(E.Switch,"defaultColor",T("palette-common-white")),We(E.Switch,"defaultDisabledColor",T("palette-grey-100")),We(E.Switch,"primaryDisabledColor",Hn(E.primary.main,.62)),We(E.Switch,"secondary
1361DisabledColor",Hn(E.secondary.main,.62)),We(E.Switch,"errorDisabledColor",Hn(E.error.main,.62)),We(E.Switch,"infoDisabledColor",Hn(E.info.main,.62)),We(E.Switch,"successDisabledColor",Hn(E.success.main,.62)),We(E.Switch,"warningDisabledColor",Hn(E.warning.main,.62)),We(E.TableCell,"border",Hn(y1(E.divider,1),.88)),We(E.Tooltip,"bg",y1(E.grey[700],.92))}if(E.mode==="dark"){We(E.Alert,"errorColor",Hn(E.error.light,.6)),We(E.Alert,"infoColor",Hn(E.info.light,.6)),We(E.Alert,"successColor",Hn(E.success.light,.6)),We(E.Alert,"warningColor",Hn(E.warning.light,.6)),We(E.Alert,"errorFilledBg",T("palette-error-dark")),We(E.Alert,"infoFilledBg",T("palette-info-dark")),We(E.Alert,"successFilledBg",T("palette-success-dark")),We(E.Alert,"warningFilledBg",T("palette-warning-dark")),We(E.Alert,"errorFilledColor",zc(()=>E.getContrastText(E.error.dark))),We(E.Alert,"infoFilledColor",zc(()=>E.getContrastText(E.info.dark))),We(E.Alert,"successFilledColor",zc(()=>E.getContrastText(E.success.dark))),We(E.Alert,"warningFilledColor",zc(()=>E.getContrastText(E.warning.dark))),We(E.Alert,"errorStandardBg",Qn(E.error.light,.9)),We(E.Alert,"infoStandardBg",Qn(E.info.light,.9)),We(E.Alert,"successStandardBg",Qn(E.success.light,.9)),We(E.Alert,"warningStandardBg",Qn(E.warning.light,.9)),We(E.Alert,"errorIconColor",T("palette-error-main")),We(E.Alert,"infoIconColor",T("palette-info-main")),We(E.Alert,"successIconColor",T("palette-success-main")),We(E.Alert,"warningIconColor",T("palette-warning-main")),We(E.AppBar,"defaultBg",T("palette-grey-900")),We(E.AppBar,"darkBg",T("palette-background-paper")),We(E.AppBar,"darkColor",T("palette-text-primary")),We(E.Avatar,"defaultBg",T("palette-grey-600")),We(E.Button,"inheritContainedBg",T("palette-grey-800")),We(E.Button,"inheritContainedHoverBg",T("palette-grey-700")),We(E.Chip,"defaultBorder",T("palette-grey-700")),We(E.Chip,"defaultAvatarColor",T("palette-grey-300")),We(E.Chip,"defaultIconColor",T("palette-grey-300")),We(E.FilledInput,"bg","rgba(255, 255, 255, 0.09)"),We(E.FilledInput,"hoverBg","rgba(255, 255, 255, 0.13)"),We(E.FilledInput,"disabledBg","rgba(255, 255, 255, 0.12)"),We(E.LinearProgress,"primaryBg",Qn(E.primary.main,.5)),We(E.LinearProgress,"secondaryBg",Qn(E.secondary.main,.5)),We(E.LinearProgress,"errorBg",Qn(E.error.main,.5)),We(E.LinearProgress,"infoBg",Qn(E.info.main,.5)),We(E.LinearProgress,"successBg",Qn(E.success.main,.5)),We(E.LinearProgress,"warningBg",Qn(E.warning.main,.5)),We(E.Skeleton,"bg",`rgba(${T("palette-text-primaryChannel")} / 0.13)`),We(E.Slider,"primaryTrack",Qn(E.primary.main,.5)),We(E.Slider,"secondaryTrack",Qn(E.secondary.main,.5)),We(E.Slider,"errorTrack",Qn(E.error.main,.5)),We(E.Slider,"infoTrack",Qn(E.info.main,.5)),We(E.Slider,"successTrack",Qn(E.success.main,.5)),We(E.Slider,"warningTrack",Qn(E.warning.main,.5));const B=w1(E.background.default,.98);We(E.SnackbarContent,"bg",B),We(E.SnackbarContent,"color",zc(()=>E.getContrastText(B))),We(E.SpeedDialAction,"fabHoverBg",w1(E.background.paper,.15)),We(E.StepConnector,"border",T("palette-grey-600")),We(E.StepContent,"border",T("palette-grey-600")),We(E.Switch,"defaultColor",T("palette-grey-300")),We(E.Switch,"defaultDisabledColor",T("palette-grey-600")),We(E.Switch,"primaryDisabledColor",Qn(E.primary.main,.55)),We(E.Switch,"secondaryDisabledColor",Qn(E.secondary.main,.55)),We(E.Switch,"errorDisabledColor",Qn(E.error.main,.55)),We(E.Switch,"infoDisabledColor",Qn(E.info.main,.55)),We(E.Switch,"successDisabledColor",Qn(E.success.main,.55)),We(E.Switch,"warningDisabledColor",Qn(E.warning.main,.55)),We(E.TableCell,"border",Qn(y1(E.divider,1),.68)),We(E.Tooltip,"bg",y1(E.grey[700],.92))}Kd(E.background,"default"),Kd(E.background,"paper"),Kd(E.common,"background"),Kd(E.common,"onBackground"),Kd(E,"divider"),Object.keys(E).forEac
1361h(B=>{const L=E[B];B!=="tonalOffset"&&L&&typeof L=="object"&&(L.main&&We(E[B],"mainChannel",Xx(Zx(L.main))),L.light&&We(E[B],"lightChannel",Xx(Zx(L.light))),L.dark&&We(E[B],"darkChannel",Xx(Zx(L.dark))),L.contrastText&&We(E[B],"contrastTextChannel",Xx(Zx(L.contrastText))),B==="text"&&(Kd(E[B],"primary"),Kd(E[B],"secondary")),B==="action"&&(L.active&&Kd(E[B],"active"),L.selected&&Kd(E[B],"selected")))})}),w=t.reduce((C,E)=>tl(C,E),w);const j={prefix:i,disableCssColorScheme:a,shouldSkipGeneratingVar:o,getSelector:PZe(w)},{vars:N,generateThemeVars:_,generateStyleSheets:S}=nZe(w,j);return w.vars=N,Object.entries(w.colorSchemes[w.defaultColorScheme]).forEach(([C,E])=>{w[C]=E}),w.generateThemeVars=_,w.generateStyleSheets=S,w.generateSpacing=function(){return Xre(d.spacing,e6(this))},w.getColorSchemeSelector=sZe(l),w.spacing=w.generateSpacing(),w.shouldSkipGeneratingVar=o,w.unstable_sxConfig={...DS,...d==null?void 0:d.unstable_sxConfig},w.unstable_sx=function(E){return Vg({sx:E,theme:this})},w.toRuntimeSource=ane,w}function oH(e,t,r){e.colorSchemes&&r&&(e.colorSchemes[t]={...r!==!0&&r,palette:l6({...r===!0?{}:r.palette,mode:t})})}function DZe(e={},...t){const{palette:r,cssVariables:s=!1,colorSchemes:a=r?void 0:{light:!0},defaultColorScheme:i=r==null?void 0:r.mode,...o}=e,l=i||"light",c=a==null?void 0:a[l],d={...a,...r?{[l]:{...typeof c!="boolean"&&c,palette:r}}:void 0};if(s===!1){if(!("colorSchemes"in e))return V3(e,...t);let u=r;"palette"in e||d[l]&&(d[l]!==!0?u=d[l].palette:l==="dark"&&(u={mode:"dark"}));const h=V3({...e,palette:u},...t);return h.defaultColorScheme=l,h.colorSchemes=d,h.palette.mode==="light"&&(h.colorSchemes.light={...d.light!==!0&&d.light,palette:h.palette},oH(h,"dark",d.dark)),h.palette.mode==="dark"&&(h.colorSchemes.dark={...d.dark!==!0&&d.dark,palette:h.palette},oH(h,"light",d.light)),h}return!r&&!("light"in d)&&l==="light"&&(d.light=!0),LZe({...o,colorSchemes:d,defaultColorScheme:l,...typeof s!="boolean"&&s},...t)}const RZe=DZe(),UZe="$$material";function MZe(e){return e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"}const $Ze=e=>MZe(e)&&e!=="classes",QZe=MXe({themeId:UZe,defaultTheme:RZe,rootShouldForwardProp:$Ze}),HZe=ZXe;function zZe(e){return XXe(e)}function VZe(e){return Rre("MuiSvgIcon",e)}zYe("MuiSvgIcon",["root","colorPrimary","colorSecondary","colorAction","colorError","colorDisabled","fontSizeInherit","fontSizeSmall","fontSizeMedium","fontSizeLarge"]);const GZe=e=>{const{color:t,fontSize:r,classes:s}=e,a={root:["root",t!=="inherit"&&`color${zg(t)}`,`fontSize${zg(r)}`]};return MYe(a,VZe,s)},qZe=QZe("svg",{name:"MuiSvgIcon",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:r}=e;return[t.root,r.color!=="inherit"&&t[`color${zg(r.color)}`],t[`fontSize${zg(r.fontSize)}`]]}})(HZe(({theme:e})=>{var t,r,s,a,i,o,l,c,d,u,h,m,f,p;return{userSelect:"none",width:"1em",height:"1em",display:"inline-block",flexShrink:0,transition:(a=(t=e.transitions)==null?void 0:t.create)==null?void 0:a.call(t,"fill",{duration:(s=(r=(e.vars??e).transitions)==null?void 0:r.duration)==null?void 0:s.shorter}),variants:[{props:A=>!A.hasSvgAsChild,style:{fill:"currentColor"}},{props:{fontSize:"inherit"},style:{fontSize:"inherit"}},{props:{fontSize:"small"},style:{fontSize:((o=(i=e.typography)==null?void 0:i.pxToRem)==null?void 0:o.call(i,20))||"1.25rem"}},{props:{fontSize:"medium"},style:{fontSize:((c=(l=e.typography)==null?void 0:l.pxToRem)==null?void 0:c.call(l,24))||"1.5rem"}},{props:{fontSize:"large"},style:{fontSize:((u=(d=e.typography)==null?void 0:d.pxToRem)==null?void 0:u.call(d,35))||"2.1875rem"}},...Object.entries((e.vars??e).palette).filter(([,A])=>A&&A.main).map(([A])=>{var v,x;return{props:{color:A},style:{color:(x=(v=(e.vars??e).palette)==null?void 0:v[A])==null?void 0:x.main}}}),{props:{color:"action"},style:{color:(m=(h=(e.vars??e).palette)==null?void 0:h.action)==null?void 0:m.active}},{props:{color:"disabled"},style:{color:(p=(f=(e.vars??e).palette)==null?void 0:f.action)==null?void 0:p.disabled}},{props:{color:"inherit"},style:{color:void 0}}]}})),G3=g.forwardRef(function(t,r){const s=zZe({props:t,name:"MuiSvgIcon"}),{children:a,className:i,color:o="inherit",component:l="svg",fontSize:c="medium",htmlColor:d,inheritViewBox:u=!1,titleAccess:h,viewBox:m="0 0 24 24",...f}=s,p=g.isValidElement(a)&&a.type==="svg",A={...s,color:o,component:l,fontSize:c,instanceFontSize:t.fontSize,inheritViewBox:u,viewBox:m,hasSvgAsChild:p},v={};u||(v.viewBox=m);const x=GZe(A);return n.jsxs(qZe,{as:l,className:fr(x.root,i),focusable:"false",color:d,"aria-hidden":h?void 0:!0,role:h?"
1361img":void 0,ref:r,...v,...f,...p&&a.props,ownerState:A,children:[p?a.props.children:a,h?n.jsx("title",{children:h}):null]})});G3.muiName="SvgIcon";function KZe(e,t){function r(s,a){return n.jsx(G3,{"data-testid":`${t}Icon`,ref:a,...s,children:e})}return r.muiName=G3.muiName,g.memo(g.forwardRef(r))}const KN=KZe(n.jsx("path",{d:"m19 9 1.25-2.75L23 5l-2.75-1.25L19 1l-1.25 2.75L15 5l2.75 1.25zm-7.5.5L9 4 6.5 9.5 1 12l5.5 2.5L9 20l2.5-5.5L17 12zM19 15l-1.25 2.75L15 19l2.75 1.25L19 23l1.25-2.75L23 19l-2.75-1.25z"}),"AutoAwesome");function c6({children:e,className:t,...r}){return n.jsx("button",{className:ye("group relative inline-flex h-11 animate-rainbow cursor-pointer items-center justify-center rounded-xl border-0 bg-[length:200%] px-8 py-2 font-medium text-primary-foreground transition-colors [background-clip:padding-box,border-box,border-box] [background-origin:border-box] [border:calc(0.08*1rem)_solid_transparent] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50","before:absolute before:bottom-[-20%] before:left-1/2 before:z-0 before:h-1/5 before:w-3/5 before:-translate-x-1/2 before:animate-rainbow before:bg-[linear-gradient(90deg,hsl(var(--color-1)),hsl(var(--color-5)),hsl(var(--color-3)),hsl(var(--color-4)),hsl(var(--color-2)))] before:bg-[length:200%] before:[filter:blur(calc(0.8*1rem))]","bg-[linear-gradient(#121213,#121213),linear-gradient(#121213_50%,rgba(18,18,19,0.6)_80%,rgba(18,18,19,0)),linear-gradient(90deg,hsl(var(--color-1)),hsl(var(--color-5)),hsl(var(--color-3)),hsl(var(--color-4)),hsl(var(--color-2)))]","dark:bg-[linear-gradient(#fff,#fff),linear-gradient(#fff_50%,rgba(255,255,255,0.6)_80%,rgba(0,0,0,0)),linear-gradient(90deg,hsl(var(--color-1)),hsl(var(--color-5)),hsl(var(--color-3)),hsl(var(--color-4)),hsl(var(--color-2)))]",t),...r,children:e})}const lne=g.createContext(null),d6=g.forwardRef(({className:e,value:t,onValueChange:r,children:s,...a},i)=>n.jsx(lne.Provider,{value:{value:t,onValueChange:r},children:n.jsx("div",{ref:i,className:ye("inline-flex rounded-md shadow-sm",e),role:"group",...a,children:s})}));d6.displayName="ButtonGroup";const u6=g.forwardRef(({className:e,value:t,children:r,disabled:s,...a},i)=>{const o=g.useContext(lne);if(!o)throw new Error("ButtonGroupItem must be used within a ButtonGroup");const{value:l,onValueChange:c}=o,d=l===t;return n.jsx("button",{ref:i,type:"button",className:ye("inline-flex items-center justify-center px-4 py-2 text-sm font-medium border border-border","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","disabled:cursor-not-allowed disabled:opacity-50",d?"bg-primary text-primary-foreground border-primary":"bg-background text-foreground hover:bg-accent hover:text-accent-foreground","first:rounded-l-md last:rounded-r-md","-ml-px first:ml-0",e),onClick:()=>c(t),"data-state":d?"checked":"unchecked","aria-checked":d,role:"radio",disabled:s,...a,children:r})});u6.displayName="ButtonGroupItem";function WZe({localCurrentBrand:e,setLocalCurrentBrand:t,updateBrandField:r,onSwitchToFormMode:s}){const[a,i]=g.useState(0),[o,l]=g.useState([]),[c,d]=g.useState(!1),[u,h]=g.useState(!1),[m,f]=g.useState("brand_name"),[p,A]=g.useState(!1),[v,x]=g.useState(""),[b,y]=g.useState(!1),[w,j]=g.useState(!1),[N,_]=g.useState(null),{register:S,setValue:C,watch:E}=Cd({defaultValues:{},mode:"onChange"}),T=o[a],B=T?T[0]:null,L=B?E(B):null;g.useEffect(()=>{if(B&&L!==void 0&&L!==null&&e){_(null);const R={...e,[B]:L};t(R)}},[L,B,e,t]),g.useEffect(()=>{if(e){const R=Object.entries(cs).filter(([Q,U])=>!U.hidden&&Q!=="status").sort((Q,U)=>Q[1].group.localeCompare(U[1].group));l(R),R.length>0&&a>=R.length&&i(0)}},[e,a]),g.useEffect(()=>{e&&o.length>0&&Object.keys(cs).forEach(R=>{C(R,e[R]||"")})},[e,o,C]),g.useEffect(()=>{_(null)},[a]);const P=async()=>{if(!e)return;const R=o[a][0],Q=E(R);if(!(!Q||typeof Q=="string"&&Q.trim()==="")){j(!0),_(null);try{const U={...e,[R]:Q};if(await r(e.id,R,String(Q)),console.log(`Successfully saved field: ${R} = ${Q}`),t(U),a>=o.length-1){console.log("Wizard completed! Setting completion state..."),y(!0),j(!1);return}const q=a+1;if(q<o.length){const G=o[q][0],Y=U[G];Y!==void 0&&C(G,Y)}i(q),j(!1)}catch(U){console.error("Error updating brand field:",U),j(!1),_(`Failed to save ${R}. Please try again.`)}}},F=()=>
1361{if(a>0){const R=o[a][0],Q=E(R);if(Q&&e){const G={...e,[R]:Q};t(G)}const U=a-1;i(U);const D=o[U][0],q=e==null?void 0:e[D];q!==void 0&&C(D,q)}};if(g.useEffect(()=>{var Q;const R=document.querySelector(`[name="${(Q=o[a])==null?void 0:Q[0]}"]`);R&&setTimeout(()=>{R.focus()},100)},[a,o]),b)return n.jsx("div",{className:"flex justify-center",children:n.jsx(Te,{className:"w-full max-w-2xl shadow-lg",children:n.jsxs(Re,{className:"p-8 text-center",children:[n.jsx(ty,{brand:e,showLink:!1}),n.jsxs("div",{className:"mt-6 space-y-4",children:[n.jsx("h2",{className:"text-2xl font-bold text-green-600 mb-2",children:"🎉 Brand Profile Complete!"}),n.jsx("p",{className:"text-muted-foreground",children:"Your brand profile is ready. You can now use Form Mode to make any updates or refinements."}),n.jsx("div",{className:"flex justify-center pt-4",children:n.jsxs(te,{onClick:s,className:"flex items-center gap-2",size:"lg",children:[n.jsx(K_,{className:"h-4 w-4"}),"Switch to Form Mode"]})})]})]})})});const M=o[a];if(!M||!e)return null;const[I,$]=M,V=I;return n.jsxs("div",{className:"flex justify-center",children:[n.jsx(Te,{className:"w-full max-w-2xl shadow-lg",children:n.jsx(Re,{className:"p-8 space-y-6",children:n.jsxs("form",{onSubmit:R=>(R.preventDefault(),R.stopPropagation(),console.log("Form submission prevented"),!1),children:[n.jsxs("div",{className:"mb-6",children:[n.jsx(ty,{brand:e,showLink:!1}),n.jsxs("div",{className:"mt-4 flex items-center justify-between text-sm text-muted-foreground",children:[n.jsxs("span",{children:["Field ",a+1," of ",o.length]}),n.jsx("span",{children:"Reviewing all fields"})]})]}),n.jsxs("div",{children:[n.jsx("h2",{className:"text-2xl font-bold mb-2",children:$.name}),n.jsx("p",{className:"text-muted-foreground",children:$.howItsUsed})]}),n.jsxs("div",{className:"space-y-4",children:[N&&n.jsxs(Ar,{variant:"destructive",children:[n.jsx(nr,{className:"h-4 w-4"}),n.jsx(Wa,{children:"Save Error"}),n.jsx(gr,{children:N})]}),$.inputControl==="Textarea"?n.jsx(Zr,{...S(V),placeholder:$.example.toString(),className:"min-h-[200px]",disabled:w,onKeyDown:R=>{R.key==="Enter"&&(R.ctrlKey||R.metaKey)&&!w&&(R.preventDefault(),P())}}):$.options&&$.options.length>0?n.jsx(d6,{value:E(V)||"",onValueChange:async R=>{if(!w&&e){C(V,R),j(!0),_(null);try{const Q={...e,[V]:R};await r(e.id,V,R),console.log(`Auto-saved field: ${V} = ${R}`),t(Q)}catch(Q){console.error("Error auto-saving field:",Q),_(`Failed to save ${V}. Please try again.`)}finally{j(!1)}}},className:"w-full",children:$.options.map(R=>n.jsx(u6,{value:R,className:"flex-1",disabled:w,children:R},R))}):n.jsx(qe,{...S(V),type:"text",placeholder:$.example.toString(),disabled:w,onKeyDown:R=>{console.log("Key pressed:",R.key,"Event:",R),R.key==="Enter"&&(R.preventDefault(),R.stopPropagation(),console.log("Enter prevented"))},onChange:R=>{console.log("Input changed:",R.target.value),S(V).onChange(R)}}),$.bestPractices&&n.jsxs(Ar,{children:[n.jsx(Wa,{children:"Best Practices"}),n.jsx(gr,{children:$.bestPractices})]}),$.allowAiGeneration&&n.jsxs(c6,{onClick:()=>{if(w)return;f(V);const R=E(V);R&&String(R).trim()!==""?h(!0):(A(!1),d(!0))},className:"w-full",disabled:w,children:[n.jsx(KN,{className:"mr-2"}),"Ask Brand Genius"]})]}),n.jsxs("div",{className:"flex justify-between pt-4",children:[n.jsxs(te,{type:"button",variant:"outline",onClick:F,disabled:a===0||w,children:[n.jsx(Nu,{className:"mr-2",size:16}),"Previous"]}),n.jsx(te,{type:"button",onClick:P,disabled:!E(V)||typeof E(V)=="string"&&E(V).trim()===""||w,className:"min-w-[120px]",children:w?n.jsxs(n.Fragment,{children:[n.jsx(ed,{size:"sm",className:"mr-2"}),"Saving..."]}):n.jsxs(n.Fragment,{children:[a===o.length-1?"Complete":"Next",n.jsx(_s,{className:"ml-2",size:16})]})})]})]})})}),c&&n.jsx(MF,{fieldName:m,brand:e,defaultInstructions:$.bestPractices,fieldMetadata:$,existingValue:p?E(m):void 0,initialFeedback:p?v:"",onApply:(R,Q)=>{C(R,Q),t(U=>U?{...U,[R]:Q}:null),d(!1),A(!1),x("")},onClose:()=>{d(!1),A(!1),x("")}}),u&&n.jsx(Zt,{open:u,onOpenChange:h,children:n.jsxs(Jt,{className:"sm:max-w-[500px] p-6 bg-white",children:[n.jsxs(_r,{children:[n.jsx(tr,{children:"How would you like Brand Genius to help?"}),n.jsx(Hr,{children:"Choose how you want Brand Genius to assist with this field."})]}),n.jsxs("div",{className:"grid gap-4 py-4",children:[n.jsxs(te,{onClick:()=>{h(!1),A(!1),d(!0)},className:"w-full",children:[n.jsx(KN,{className:"mr-2"}),"Have Brand Genius generate a new answer for me"]}),n.jsxs(te,{onClick:()=>{h(!1),A(!0),x(""),d(!0)},variant:"outline",className:"w-full",children:[n.jsx(mr,{className:"mr-2"}),"Give Brand Genius feedback to improve the current answer"]})]})]})})]})}const q3=()=>{const{selectedBrand:e}=mn(),{toast:t}=sn(),{isAdmin:r}=rp(),{fetchBrandDetails:s,updateBrandField:a}=_0(e==null?void 0:e.id),[i,o]=g.useState(null),[l,c]=g.useState("form"),[d,u]=g.useState(!1),[h,m]=g.useState(!1),f=g.useCallback(v=>{if(!v)return 0;const x=Object.keys(cs).filter(w=>{const j=cs[w];return!(j!=null&&j.hidden)&&w!=="status"}),b=x.length;return x.filter(w=>{const j=v[w];return j!=null&&j!==""}).length/b*100},[]),p=g.useCallback(()=>
1361{if(!i){t({title:"Export Failed",description:"No brand data to export",variant:"destructive"});return}const v=Object.keys(cs).reduce((j,N)=>{const _=cs[N];if(!(_!=null&&_.hidden)||_!=null&&_.keyField){const S=i[N];S!=null&&S!==""&&(j[N]=S)}return j},{}),x={version:"1.0",exportDate:new Date().toISOString(),brandName:i.brand_name,data:v},b=new Blob([JSON.stringify(x,null,2)],{type:"application/json"}),y=URL.createObjectURL(b),w=document.createElement("a");w.href=y,w.download=`${i.brand_name||"brand"}-${new Date().toISOString().split("T")[0]}.json`,document.body.appendChild(w),w.click(),document.body.removeChild(w),URL.revokeObjectURL(y),t({title:"Export Successful",description:`Brand data exported as ${w.download}`})},[i,t]),A=g.useCallback(()=>{const v=document.createElement("input");v.type="file",v.accept=".json",v.onchange=async x=>{var y;const b=(y=x.target.files)==null?void 0:y[0];if(b)try{const w=await b.text(),j=JSON.parse(w);if(!j.version||!j.data)throw new Error("Invalid import file format");if(!window.confirm(`Are you sure you want to import brand data? This will override the following fields:
1362
1363${Object.keys(j.data).join(", ")}
1364
1365Current brand: ${i==null?void 0:i.brand_name}
1366Importing from: ${j.brandName||"Unknown"}`))return;let _=0;const S=[];for(const[E,T]of Object.entries(j.data)){if(!(E in cs)){S.push(`Unknown field: ${E}`);continue}if(!(E==="id"||E==="created_at"||E==="updated_at"))try{await a(e.id,E,T),_++}catch(B){S.push(`Failed to update ${E}: ${B}`)}}const C=await s(e.id);C&&o(C),S.length>0?t({title:"Import Completed with Warnings",description:`Updated ${_} fields. Errors: ${S.join(", ")}`,variant:"default"}):t({title:"Import Successful",description:`Successfully updated ${_} brand fields`})}catch(w){console.error("Import error:",w),t({title:"Import Failed",description:w instanceof Error?w.message:"Failed to import brand data",variant:"destructive"})}},v.click()},[i,e,a,s,t]);return AS(h),g.useEffect(()=>{o(null),m(!1),u(!1)},[e==null?void 0:e.id]),g.useEffect(()=>{(async()=>{if(e!=null&&e.id)try{console.log("Initial load of brand data for ID:",e.id);const x=await s(e.id);if(x&&(o(x),!d)){const b=f(x);c(b<100?"wizard":"form"),u(!0)}}catch(x){console.error("Error loading brand data:",x)}})()},[e==null?void 0:e.id,s,d]),e?i?n.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 via-white to-purple-50/30 relative overflow-hidden",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsxs("div",{className:"relative container mx-auto p-6 max-w-7xl space-y-8",children:[n.jsxs("div",{className:"relative overflow-hidden bg-gradient-to-br from-white via-purple-50/30 to-indigo-50/40 rounded-2xl border border-purple-200/50 shadow-sm p-4 md:p-8",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsx("div",{className:"absolute top-0 right-0 w-40 h-40 bg-gradient-to-br from-purple-200/20 to-transparent rounded-full -translate-y-20 translate-x-20"}),n.jsxs("div",{className:"relative",children:[n.jsx("div",{className:"flex flex-col sm:flex-row sm:items-start justify-between gap-4 md:gap-6",children:n.jsxs("div",{className:"flex items-center gap-2 md:gap-4 flex-1",children:[n.jsx("div",{className:"p-2 md:p-3 bg-white/80 backdrop-blur-sm rounded-xl md:rounded-2xl shadow-lg",children:n.jsx(Gi,{className:"h-5 w-5 md:h-8 md:w-8 text-purple-600"})}),n.jsxs("div",{className:"flex-1",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-1 md:mb-2",children:[n.jsx("h1",{className:"text-2xl md:text-4xl font-bold bg-gradient-to-r from-purple-700 via-indigo-700 to-blue-700 bg-clip-text text-transparent",children:"Brand Genius"}),n.jsx(Ya,{delayDuration:200,children:n.jsxs(Hs,{children:[n.jsx(zs,{asChild:!0,children:n.jsx("button",{type:"button",className:"p-1.5 rounded-full hover:bg-purple-100/50 transition-colors flex-shrink-0","aria-label":"Brand Genius information",children:n.jsx(qi,{className:"h-4 w-4 md:h-5 md:w-5 text-purple-600"})})}),n.jsx(Vn,{side:"bottom",className:"max-w-xs p-3",children:n.jsx("p",{className:"text-sm leading-relaxed",children:"Your brand is the center of it all, driving your AI personality and preferences. Ensure it's fully set up for the best results!"})})]})})]}),n.jsx("p",{className:"text-gray-600 text-base md:text-lg leading-relaxed max-w-2xl hidden md:block",children:"Your brand is the center of it all, driving your AI personality and preferences. Ensure it's fully set up for the best results!"})]})]})}),n.jsxs("div",{className:"flex flex-wrap items-center gap-3 mt-4 md:mt-6",children:[r&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center gap-2 bg-white/60 backdrop-blur-sm rounded-xl p-2",children:[n.jsxs(te,{variant:"outline",size:"sm",onClick:p,className:"bg-white/50 border-white/50 hover:bg-white/70 transition-colors",title:"Export brand data as JSON",children:[n.jsx(Ad,{className:"h-4 w-4 mr-2"}),"Export"]}),n.jsxs(te,{variant:"outline",size:"sm",onClick:A,className:"bg-white/50 border-white/50 hover:bg-white/70 transition-colors",title:"Import brand data from JSON",children:[n.jsx(Y_,{className:"h-4 w-4 mr-2"}),"Import"]})]}),n.jsx("div",{className:"w-px h-8 bg-purple-200/50"})]}),n.jsxs("div",{className:"flex items-center gap-2 bg-white/60 backdrop-blur-sm rounded-xl p-2",children:[n.jsxs(te,{variant:l==="form"?"default":"outline",size:"sm",onClick:()=>c("form"),className:l==="form"?"bg-gradient-to-r from-purple-500 to-indigo-600 hover:from-purple-600 hover:to-indigo-700 text-white border-transparent":"bg-white/50 border-white/50 hover:bg-white/70 transition-colors",children:[n.jsx(K_,{className:"h-4 w-4 mr-2"}),"Form Mode"]}),n.jsxs(te,{variant:l==="wizard"?"default":"outline",size:"sm",onClick:()=>c("wizard"),className:l==="wizard"?"bg-gradient-to-r from-purple-500 to-indigo-600 hover:from-purple-600 hover:to-indigo-700 text-white border-transparent":"bg-white/50 border-white/50 hover:bg-white/70 transition-colors",children:[n.jsx(NB,{className:"h-4 w-4 mr-2"}),"Wizard Mode"]})]})]})]})]}),n.jsx(xS,{}),n.jsxs("div",{className:"relative overflow-hidden bg-white/60 backdrop-blur-sm rounded-2xl border border-white/50 shadow-sm",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-purple-50/20 via-trans
1366parent to-indigo-50/20"}),n.jsx("div",{className:"relative",children:l==="form"?n.jsx(pYe,{localCurrentBrand:i,setLocalCurrentBrand:o,updateBrandField:a}):n.jsx(WZe,{localCurrentBrand:i,setLocalCurrentBrand:o,updateBrandField:a,onSwitchToFormMode:()=>c("form")})})]})]})]}):n.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 via-white to-purple-50/30 relative overflow-hidden",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsxs("div",{className:"relative container mx-auto p-6 max-w-7xl space-y-8",children:[n.jsxs("div",{className:"relative overflow-hidden bg-gradient-to-br from-white via-purple-50/30 to-indigo-50/40 rounded-2xl border border-purple-200/50 shadow-sm p-4 md:p-8",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsx("div",{className:"absolute top-0 right-0 w-40 h-40 bg-gradient-to-br from-purple-200/20 to-transparent rounded-full -translate-y-20 translate-x-20"}),n.jsx("div",{className:"relative",children:n.jsxs("div",{className:"flex items-center gap-2 md:gap-4",children:[n.jsx("div",{className:"p-2 md:p-3 bg-white/80 backdrop-blur-sm rounded-xl md:rounded-2xl shadow-lg",children:n.jsx(Gi,{className:"h-5 w-5 md:h-8 md:w-8 text-purple-600"})}),n.jsxs("div",{className:"flex-1",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-1 md:mb-2",children:[n.jsx("h1",{className:"text-2xl md:text-4xl font-bold bg-gradient-to-r from-purple-700 via-indigo-700 to-blue-700 bg-clip-text text-transparent",children:"Brand Genius"}),n.jsx(Ya,{delayDuration:200,children:n.jsxs(Hs,{children:[n.jsx(zs,{asChild:!0,children:n.jsx("button",{type:"button",className:"p-1.5 rounded-full hover:bg-purple-100/50 transition-colors flex-shrink-0","aria-label":"Brand Genius information",children:n.jsx(qi,{className:"h-4 w-4 md:h-5 md:w-5 text-purple-600"})})}),n.jsx(Vn,{side:"bottom",className:"max-w-xs p-3",children:n.jsx("p",{className:"text-sm leading-relaxed",children:"Brand Genius is the control panel for your brand. Use Wizard Mode to get it to a strong level, and use Form Mode for reviewing and tweaking."})})]})})]}),n.jsx("p",{className:"text-gray-600 text-base md:text-lg leading-relaxed hidden md:block",children:"Brand Genius is the control panel for your brand. Use Wizard Mode to get it to a strong level, and use Form Mode for reviewing and tweaking."})]})]})})]}),n.jsx("div",{className:"flex items-center justify-center h-[calc(100vh-20rem)]",children:n.jsxs("div",{className:"relative",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-purple-200 to-indigo-200 rounded-full blur-xl opacity-30 animate-pulse"}),n.jsx(ed,{size:"lg"})]})})]})]}):n.jsx(ep,{})},YZe=(e,t)=>{const[r,s]=g.useState(""),[a,i]=g.useState(!1),[o,l]=g.useState(!0);return g.useEffect(()=>{if(!e){l(!1);return}(async()=>{try{l(!0);const{data:h,error:m}=await de.from("brands").select("url").eq("id",e).single();if(m)throw m;s(h.url||"")}catch(h){console.error("Error fetching brand URL:",h),He({title:"Error",description:"Failed to load brand URL",variant:"destructive"})}finally{l(!1)}})()},[e]),{brandUrl:r,setBrandUrl:s,isReanalyzing:a,loading:o,updateBrandUrl:async u=>{if(e)try{const{error:h}=await de.from("brands").update({url:u,default_landing_page:u,updated_at:new Date().toISOString()}).eq("id",e).select().single();if(h)throw h;s(u),t&&t(m=>m&&{...m,url:u,default_landing_page:u}),He({title:"URL Updated",description:"Brand URL has been updated successfully",variant:"default",className:"bg-green-50 dark:bg-green-900/10 border-green-200 dark:border-green-900/50"})}catch(h){console.error("Error updating brand URL:",h),He({title:"Error",description:"Failed to update brand URL",variant:"destructive"})}},reanalyzeWebsite:async()=>{var u;if(!e||!r){He({title:"Error",description:"Brand URL is required",variant:"destructive"});return}i(!0);try{const{error:h}=await de.from("brands").update({web_site_scraping_status:"PROCESSING"}).eq("id",e);if(h)throw h;const f=(u=(await de.auth.getSession()).data.session)==null?void 0:u.access_token,A=await(await fetch("https://worker.rainfactory.ai/rainfactory/web-site-scraper/rescrape",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${f}`},body:JSON.stringify({brandId:e,url:r})})).json();if(A.success)He({title:"Website Analysis Started",description:"The website is being analyzed to update your brand information. This may take a few minutes.",duration:5e3,variant:"default",className:"bg-green-50 dark:bg-green-900/10 border-green-200 dark:border-green-900/50"});else throw new Error(A.error||A.details||"Failed to start website analysis")}
1366catch(h){console.error("Error re-analyzing website:",h),He({title:"Error",description:h instanceof Error?h.message:"Failed to re-analyze website",variant:"destructive"});const{error:m}=await de.from("brands").update({web_site_scraping_status:"FAILED"}).eq("id",e);m&&console.error("Error updating brand status:",m)}finally{i(!1)}}}},JZe=({brandId:e,selectedBrand:t,setSelectedBrand:r})=>{const{toast:s}=sn(),[a,i]=g.useState(!1),[o,l]=g.useState((t==null?void 0:t.brand_name)||""),[c,d]=g.useState((t==null?void 0:t.timezone)||"America/Chicago"),[u,h]=g.useState(!1),[m,f]=g.useState(!1),[p,A]=g.useState((t==null?void 0:t.default_landing_page)||""),{updateBrandField:v}=_0(e),{brandUrl:x,setBrandUrl:b,isReanalyzing:y,loading:w,updateBrandUrl:j,reanalyzeWebsite:N}=YZe(e,r),_=w;g.useEffect(()=>{t!=null&&t.timezone&&d(t.timezone)},[t==null?void 0:t.timezone]),g.useEffect(()=>{A((t==null?void 0:t.default_landing_page)||"")},[t==null?void 0:t.default_landing_page]);const S=async F=>{if(!e||!F||!El(F)){s({title:"Error",description:"Invalid timezone selected",variant:"destructive"});return}h(!0);try{await v(e,"timezone",F),r({...t,timezone:F}),d(F),s({title:"Success",description:`Timezone updated to ${Zv(F)}`})}catch(M){console.error("Error updating timezone:",M),s({title:"Error",description:"Failed to update timezone",variant:"destructive"}),d((t==null?void 0:t.timezone)||"America/Chicago")}finally{h(!1)}},C=async()=>{if(!e||!o.trim()){s({title:"Error",description:"Brand name cannot be empty",variant:"destructive"});return}try{await v(e,"brand_name",o.trim()),r({...t,brand_name:o.trim()}),i(!1),s({title:"Success",description:"Brand name updated successfully"})}catch(F){console.error("Error updating brand name:",F),s({title:"Error",description:"Failed to update brand name",variant:"destructive"})}},E=()=>{l((t==null?void 0:t.brand_name)||""),i(!1)},T=async()=>{await j(x)},B=F=>{if(!F.trim())return!0;try{return new URL(F),!0}catch{return!1}},L=async()=>{if(!e){s({title:"Error",description:"Brand ID is missing",variant:"destructive"});return}const F=p.trim();if(F&&!B(F)){s({title:"Error",description:"Please enter a valid URL (e.g., https://example.com/landing)",variant:"destructive"});return}try{await v(e,"default_landing_page",F||null),r({...t,default_landing_page:F||null}),f(!1),s({title:"Success",description:F?"Default landing page updated successfully":"Default landing page cleared (will use main website URL)"})}catch(M){console.error("Error updating default landing page:",M),s({title:"Error",description:"Failed to update default landing page",variant:"destructive"})}},P=()=>{A((t==null?void 0:t.default_landing_page)||""),f(!1)};return n.jsxs("div",{className:"p-6 space-y-6",children:[n.jsxs("div",{className:"text-center mb-6",children:[n.jsx("div",{className:"inline-flex items-center gap-3 mb-4",children:n.jsx("div",{className:"p-3 bg-white/80 backdrop-blur-sm rounded-xl shadow-lg",children:n.jsx(fs,{className:"h-6 w-6 text-blue-600"})})}),n.jsx("h2",{className:"text-2xl font-bold bg-gradient-to-r from-blue-800 to-indigo-700 bg-clip-text text-transparent mb-2",children:"Global Settings"}),n.jsx("p",{className:"text-gray-600",children:"Configure core settings for your brand"})]}),n.jsxs("div",{className:"group relative overflow-hidden bg-white/60 backdrop-blur-sm rounded-xl border border-white/50 shadow-sm hover:shadow-md transition-all duration-300",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-blue-50/20 via-transparent to-indigo-50/20 opacity-0 group-hover:opacity-100 transition-opacity duration-300"}),n.jsxs("div",{className:"relative p-6",children:[n.jsxs("div",{className:"flex items-start gap-4 mb-4",children:[n.jsx("div",{className:"p-2 bg-gradient-to-br from-blue-100 to-indigo-200 rounded-lg shadow-sm",children:n.jsx(_j,{className:"h-5 w-5 text-blue-600"})}),n.jsxs("div",{className:"flex-1",children:[n.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-1",children:"Brand Name"}),n.jsx("p",{className:"text-sm text-gray-600",children:"Change the name of your brand. This will be displayed throughout the application."})]})]}),n.jsx("div",{className:"bg-gray-50/50 rounded-lg p-4",children:a?n.jsxs("div",{className:"space-y-3",children:[n.jsx(qe,{value:o,onChange:F=>l(F.target.value),placeholder:"Enter brand name",className:"bg-white border-gray-200 focus:border-blue-400",autoFocus:!0,onKeyDown:F=>{F.key==="Enter"?C():F.key==="Escape"&&E()}}),n.jsxs("div",{className:"flex gap-2",children:[n.jsxs(te,{onClick:C,size:"sm",className:"bg-gradient-to-r from-blue-600 to-indigo-600 hover:from-blue-700 hover:to-indigo-700 text-white shadow-sm",children:[n.jsx(ld,{className:"h-3 w-3 mr-2"}),"Save Changes"]}),n.jsxs(te,{variant:"outline",onClick:E,size:"sm",className:"border-gray-200 hover:bg-gray-50",children:[n.jsx(kr,{className:"h-3 w-3 mr-2"}),"Cancel"]})]})]}):n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(Be,{className:"bg-blue-100 text-blue-700 border-0 px-3 py-1",children:"Current Name"}),n.jsx("span",{className:"text-lg font-medium text-gray-900",children:(t==null?void 0:t.brand_name)||"Untitled Brand"})]}),n.jsxs(te,{variant:"outline",onClick:()=>i(!0),size:"sm",className:"bg-white hover:bg-blue-50 border-blue-200 text-blue-600 hover:text-blue-700",children:[n.jsx(_j,{className:"h-3 w-3 mr-2"}),"Edit Name"]})]})})]})]}),n.jsxs("div",{className:"group relative overflow-hidden bg-white/60 backdrop-blur-sm rounded-xl border border-white/50 shadow-sm hover:shadow-md transition-all duration-300",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-purple-50/20 via-trans
1366parent to-indigo-50/20 opacity-0 group-hover:opacity-100 transition-opacity duration-300"}),n.jsxs("div",{className:"relative p-6",children:[n.jsxs("div",{className:"flex items-start gap-4 mb-4",children:[n.jsx("div",{className:"p-2 bg-gradient-to-br from-purple-100 to-indigo-200 rounded-lg shadow-sm",children:n.jsx(Vr,{className:"h-5 w-5 text-purple-600"})}),n.jsxs("div",{className:"flex-1",children:[n.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-1",children:"Timezone"}),n.jsx("p",{className:"text-sm text-gray-600",children:`Set your brand's timezone for accurate content scheduling and "tomorrow's content today" email delivery.`})]}),n.jsxs(Be,{className:"bg-purple-100 text-purple-700 border-0 px-2 py-1 text-xs",children:[n.jsx(Vr,{className:"h-3 w-3 mr-1"}),"Scheduling"]})]}),n.jsx("div",{className:"space-y-4",children:n.jsxs("div",{className:"bg-purple-50/30 rounded-lg p-4",children:[n.jsx("label",{className:"text-sm font-medium text-gray-700 mb-3 block",children:"Brand Timezone"}),n.jsxs("div",{className:"space-y-3",children:[n.jsxs(ur,{value:c,onValueChange:S,disabled:u||!e,children:[n.jsx(or,{className:"bg-white border-purple-200 focus:border-purple-400",children:n.jsx(hr,{placeholder:"Select timezone..."})}),n.jsx(lr,{className:"max-h-80",children:DAe().map(F=>n.jsx(Fe,{value:F.value,children:n.jsxs("div",{className:"flex flex-col",children:[n.jsx("span",{className:"font-medium",children:F.label}),F.group&&n.jsx("span",{className:"text-xs text-muted-foreground",children:F.group})]})},F.value))})]}),c&&n.jsxs("div",{className:"flex items-center justify-between p-3 bg-white/50 rounded-lg border border-purple-200/50",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Vr,{className:"h-4 w-4 text-purple-600"}),n.jsxs("div",{children:[n.jsx("p",{className:"text-sm font-medium text-gray-900",children:"Current Time"}),n.jsx("p",{className:"text-xs text-gray-600",children:Zv(c)})]})]}),n.jsxs("div",{className:"text-right",children:[n.jsx("p",{className:"text-lg font-semibold text-gray-900",children:TA(rg(c),c)}),n.jsx("p",{className:"text-xs text-gray-600",children:rg(c).toLocaleDateString("en-US",{timeZone:c,weekday:"short",month:"short",day:"numeric"})})]})]})]}),n.jsx("div",{className:"mt-3 p-3 bg-blue-50/50 rounded-lg",children:n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx("div",{className:"p-1 bg-blue-200/50 rounded",children:n.jsx(fs,{className:"h-3 w-3 text-blue-600"})}),n.jsxs("div",{className:"text-xs text-blue-800",children:[n.jsx("p",{className:"font-medium mb-1",children:"How this affects your content:"}),n.jsxs("ul",{className:"space-y-1 list-disc list-inside text-blue-700",children:[n.jsx("li",{children:'Daily content digest emails use this timezone to determine "today" and "tomorrow"'}),n.jsx("li",{children:"Autoposter schedules content based on your local time"}),n.jsx("li",{children:"All scheduling features will respect this timezone setting"})]})]})]})}),u&&n.jsxs("div",{className:"mt-3 flex items-center gap-2 text-sm text-purple-600",children:[n.jsx(Es,{className:"h-3 w-3 animate-spin"}),"Updating timezone..."]})]})})]})]}),n.jsxs("div",{className:"group relative overflow-hidden bg-white/60 backdrop-blur-sm rounded-xl border border-white/50 shadow-sm hover:shadow-md transition-all duration-300",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-emerald-50/20 via-transparent to-teal-50/20 opacity-0 group-hover:opacity-100 transition-opacity duration-300"}),n.jsxs("div",{className:"relative p-6",children:[n.jsxs("div",{className:"flex items-start gap-4 mb-4",children:[n.jsx("div",{className:"p-2 bg-gradient-to-br from-emerald-100 to-teal-200 rounded-lg shadow-sm",children:n.jsx(Is,{className:"h-5 w-5 text-emerald-600"})}),n.jsxs("div",{className:"flex-1",children:[n.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-1",children:"Website Analyzer"}),n.jsx("p",{className:"text-sm text-gray-600",children:"Use an existing website to analyze your brand and import brand resources automatically."})]}),x&&n.jsxs(Be,{className:"bg-green-100 text-green-700 border-0 px-2 py-1 text-xs",children:[n.jsx(qt,{className:"h-3 w-3 mr-1"}),"Connected"]})]}),_?n.jsx("div",{className:"flex items-center justify-center h-32 bg-gray-50/50 rounded-lg",children:n.jsxs("div",{className:"flex flex-col items-center gap-3",children:[n.jsx(Es,{className:"h-8 w-8 text-emerald-600 animate-spin"}),n.jsx("span",{className:"text-sm text-gray-600",children:"Loading website data..."})]})}):n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"bg-emerald-50/30 rounded-lg p-4",children:[n.jsx("label",{className:"text-sm font-medium text-gray-700 mb-2 block",children:"Website URL"}),n.jsxs("div",{className:"flex gap-2",children:[n.jsxs("div",{className:"relative flex-1",children:[n.jsx(qe,{value:x,onChange:F=>b(F.target.value),placeholder:"https://yourbrand.com",className:"pl-10 bg-white border-emerald-200 focus:border-emerald-400"}),n.jsx(Is,{className:"absolute left-3 top-2.5 h-4 w-4 text-emerald-500"})]}),n.jsxs(te,{onClick:T,className:"bg-gradient-to-r from-emerald-600 to-teal-600 hover:from-emerald-700 hover:to-teal-700 text-white shadow-sm",children:[n.jsx(ld,{className:"h-4 w-4 mr-2"}),"Save URL"]})]}),n.jsx("p",{className:"text-xs text-gray-600 mt-2",children:"We'll analyze this website to extract brand colors, logos, and content style"})]}),x&&n.jsxs("div",{className:"flex items-center justify-between p-3 bg-gray-50/50 rounded-lg",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"p-2 bg-white rounded-lg shadow-sm",children:n.jsx(mr,{className:"h-4 w-4 text-amber-500"})}),n.jsxs("div",{children:[n.jsx("p",{className:"text-sm font-medium text-gray-900",children:"AI Analysis Available"}),n.jsx("p",{className:"text-xs text-gray-600",children:"Extract brand assets and style guidelines"})]})]}),n.jsx(te,{variant:"outline",onClick:N,disabled:y,className:`${y?"o
1366pacity-70 cursor-not-allowed":"bg-white hover:bg-amber-50 border-amber-200 text-amber-600 hover:text-amber-700"}`,size:"sm",children:y?n.jsxs(n.Fragment,{children:[n.jsx(Es,{className:"h-3 w-3 mr-2 animate-spin"}),"Analyzing..."]}):n.jsxs(n.Fragment,{children:[n.jsx(en,{className:"h-3 w-3 mr-2"}),"Re-Analyze"]})})]}),!x&&n.jsxs("div",{className:"flex items-start gap-3 p-3 bg-blue-50/50 rounded-lg",children:[n.jsx(nr,{className:"h-4 w-4 text-blue-600 mt-0.5"}),n.jsxs("div",{className:"text-sm text-blue-800",children:[n.jsx("p",{className:"font-medium mb-1",children:"No website connected"}),n.jsx("p",{className:"text-xs",children:"Add your website URL to unlock AI-powered brand analysis"})]})]})]})]})]}),n.jsxs("div",{className:"group relative overflow-hidden bg-white/60 backdrop-blur-sm rounded-xl border border-white/50 shadow-sm hover:shadow-md transition-all duration-300",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-orange-50/20 via-transparent to-amber-50/20 opacity-0 group-hover:opacity-100 transition-opacity duration-300"}),n.jsxs("div",{className:"relative p-6",children:[n.jsxs("div",{className:"flex items-start gap-4 mb-4",children:[n.jsx("div",{className:"p-2 bg-gradient-to-br from-orange-100 to-amber-200 rounded-lg shadow-sm",children:n.jsx(Vs,{className:"h-5 w-5 text-orange-600"})}),n.jsxs("div",{className:"flex-1",children:[n.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-1",children:"Default Landing Page"}),n.jsx("p",{className:"text-sm text-gray-600",children:"Set the default page users will land on when clicking links in your generated content."})]})]}),n.jsx("div",{className:"bg-orange-50/30 rounded-lg p-4",children:m?n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-gray-700 mb-2 block",children:"Landing Page URL"}),n.jsx(qe,{value:p,onChange:F=>A(F.target.value),placeholder:"https://yourbrand.com/landing",className:"bg-white border-orange-200 focus:border-orange-400",autoFocus:!0,onKeyDown:F=>{F.key==="Enter"?L():F.key==="Escape"&&P()}}),n.jsx("p",{className:"text-xs text-gray-600 mt-2",children:"Press Enter to save, Escape to cancel"})]}),n.jsxs("div",{className:"flex gap-2",children:[n.jsxs(te,{onClick:L,size:"sm",className:"bg-gradient-to-r from-orange-600 to-amber-600 hover:from-orange-700 hover:to-amber-700 text-white shadow-sm",children:[n.jsx(ld,{className:"h-3 w-3 mr-2"}),"Save Changes"]}),n.jsxs(te,{variant:"outline",onClick:P,size:"sm",className:"border-gray-200 hover:bg-gray-50",children:[n.jsx(kr,{className:"h-3 w-3 mr-2"}),"Cancel"]})]})]}):n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[n.jsx(Be,{className:"bg-orange-100 text-orange-700 border-0 px-3 py-1",children:"Current Landing Page"}),p?n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Vs,{className:"h-4 w-4 text-orange-600"}),n.jsx("span",{className:"text-sm font-medium text-gray-900 truncate max-w-md",children:p})]}):n.jsx("span",{className:"text-sm text-gray-600 italic",children:"Not set (using main website URL)"})]}),n.jsxs(te,{variant:"outline",onClick:()=>f(!0),size:"sm",className:"bg-white hover:bg-orange-50 border-orange-200 text-orange-600 hover:text-orange-700 ml-4",children:[n.jsx(_j,{className:"h-3 w-3 mr-2"}),"Edit"]})]}),n.jsx("div",{className:"p-3 bg-blue-50/50 rounded-lg",children:n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx("div",{className:"p-1 bg-blue-200/50 rounded",children:n.jsx(fs,{className:"h-3 w-3 text-blue-600"})}),n.jsxs("div",{className:"text-xs text-blue-800",children:[n.jsx("p",{className:"font-medium mb-1",children:"How this is used:"}),n.jsxs("ul",{className:"space-y-1 list-disc list-inside text-blue-700",children:[n.jsx("li",{children:"Links in generated social media posts will direct to this page"}),n.jsx("li",{children:"Blog post CTAs will use this as the primary action link"}),n.jsxs("li",{children:["If empty, defaults to your main website URL (",x||"not set",")"]})]}),n.jsx("p",{className:"mt-2 font-medium",children:"Use cases:"}),n.jsxs("ul",{className:"space-y-1 list-disc list-inside text-blue-700",children:[n.jsx("li",{children:"Campaign-specific landing pages"}),n.jsx("li",{children:"Product launch pages"}),n.jsx("li",{children:"Special promotional pages"}),n.jsx("li",{children:"Lead capture or sign-up pages"})]})]})]})})]})})]})]})]})},lH=()=>{const{id:e}=Ei(),t=xr(),{toast:r}=sn(),{selectedBrand:s,setSelectedBrand:a,refreshBrands:i}=mn(),[o,l]=g.useState(s),[c,d]=g.useState(!1),[u,h]=g.useState(!1),[m,f]=g.useState("");g.useEffect(()=>{l(s)},[s]);const p=x=>{l(x),a(x)},A=()=>{e&&navigator.clipboard.writeText(e).then(()=>{r({title:"Brand ID Copied",description:`Brand ID ${e} has been copied to clipboard`})}).catch(()=>{r({title:"Copy Failed",description:"Failed to copy brand ID to clipboard",variant:"destructive"})})},v=async()=>
1366{if(!e||!s)return;const x=s.brand_name;if(m!==x){r({title:"Invalid Confirmation",description:"The brand name doesn't match. Please try again.",variant:"destructive"});return}d(!0);try{const{error:b}=await de.from("brands").update({status:"DELETED",updated_at:new Date().toISOString()}).eq("id",e);if(b)throw b;r({title:"Brand Deleted",description:`"${x}" has been deleted successfully`}),a(null),await i(),t("/brands")}catch(b){console.error("Error deleting brand:",b),r({title:"Delete Failed",description:"Failed to delete brand. Please try again.",variant:"destructive"})}finally{d(!1),h(!1),f("")}};return n.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 via-white to-blue-50/30 relative overflow-hidden",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsxs("div",{className:"relative container mx-auto p-6 max-w-7xl space-y-8",children:[n.jsxs("div",{className:"relative overflow-hidden bg-gradient-to-br from-white via-blue-50/30 to-indigo-50/40 rounded-2xl border border-blue-200/50 shadow-sm p-8",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsx("div",{className:"absolute top-0 right-0 w-40 h-40 bg-gradient-to-br from-blue-200/20 to-transparent rounded-full -translate-y-20 translate-x-20"}),n.jsx("div",{className:"relative",children:n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start justify-between gap-6",children:[n.jsxs("div",{className:"flex items-center gap-4",children:[n.jsx("div",{className:"p-3 bg-white/80 backdrop-blur-sm rounded-2xl shadow-lg",children:n.jsx(fs,{className:"h-8 w-8 text-blue-600"})}),n.jsxs("div",{children:[n.jsxs("h1",{className:"text-4xl font-bold bg-gradient-to-r from-blue-700 via-indigo-700 to-purple-700 bg-clip-text text-transparent mb-2",children:[(o==null?void 0:o.brand_name)||(s==null?void 0:s.brand_name)||"Brand"," Settings"]}),n.jsx("p",{className:"text-gray-600 text-lg leading-relaxed",children:"Configure global settings and manage your brand"})]})]}),n.jsx("div",{className:"flex gap-3",children:n.jsxs(te,{variant:"outline",onClick:()=>t(`/brands/${e}`),className:"bg-white/50 border-white/50 hover:bg-white/70 transition-colors",children:[n.jsx(_s,{className:"h-4 w-4 mr-2"}),"Back to Brand"]})})]})})]}),n.jsxs("div",{className:"relative overflow-hidden bg-gradient-to-br from-gray-50/80 via-slate-50/60 to-white rounded-2xl border border-gray-200/60 shadow-sm",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-gray-50/30 via-transparent to-slate-50/20"}),n.jsxs("div",{className:"relative backdrop-blur-sm p-6",children:[n.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[n.jsx("div",{className:"p-2 bg-gradient-to-br from-gray-100 to-slate-200 rounded-xl shadow-sm",children:n.jsx(Gh,{className:"h-5 w-5 text-gray-600"})}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-lg font-semibold text-gray-900",children:"Brand Management"}),n.jsx("p",{className:"text-sm text-gray-600",children:"Administrative actions for your brand"})]})]}),n.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[n.jsxs("div",{className:"group relative overflow-hidden bg-white/60 backdrop-blur-sm rounded-xl border border-white/50 shadow-sm hover:shadow-md transition-all duration-300",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-blue-50/20 via-transparent to-indigo-50/20 opacity-0 group-hover:opacity-100 transition-opacity duration-300"}),n.jsxs("div",{className:"relative p-4",children:[n.jsxs("div",{className:"flex items-start gap-4",children:[n.jsx("div",{className:"p-2 bg-blue-100 rounded-lg",children:n.jsx(Cn,{className:"h-4 w-4 text-blue-600"})}),n.jsxs("div",{className:"flex-1",children:[n.jsx("h4",{className:"font-medium text-gray-900 mb-1",children:"Brand ID"}),n.jsx("p",{className:"text-sm text-gray-600 mb-3",children:"Copy your brand ID for support or integration purposes"}),n.jsx("code",{className:"text-xs bg-gray-100 px-2 py-1 rounded font-mono text-gray-700",children:e||"N/A"})]})]}),n.jsx("div",{className:"mt-4 pt-4 border-t border-gray-100",children:n.jsxs(te,{variant:"outline",size:"sm",onClick:A,className:"w-full bg-white hover:bg-blue-50 border-blue-200 text-blue-600 hover:text-blue-700 transition-colors",children:[n.jsx(Cn,{className:"h-3 w-3 mr-2"}),"Copy Brand ID"]})})]})]}),n.jsxs("div",{className:"group relative overflow-hidden bg-white/60 backdrop-blur-sm rounded-xl border border-white/50 shadow-sm hover:shadow-md transition-all duration-300",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-red-50/20 via-trans
1366parent to-pink-50/20 opacity-0 group-hover:opacity-100 transition-opacity duration-300"}),n.jsxs("div",{className:"relative p-4",children:[n.jsxs("div",{className:"flex items-start gap-4",children:[n.jsx("div",{className:"p-2 bg-red-100 rounded-lg",children:n.jsx(va,{className:"h-4 w-4 text-red-600"})}),n.jsxs("div",{className:"flex-1",children:[n.jsx("h4",{className:"font-medium text-gray-900 mb-1",children:"Delete Brand"}),n.jsx("p",{className:"text-sm text-gray-600 mb-3",children:"Permanently remove this brand and all associated data"}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(hn,{className:"h-3 w-3 text-amber-500"}),n.jsx("span",{className:"text-xs text-amber-700",children:"This action cannot be undone"})]})]})]}),n.jsx("div",{className:"mt-4 pt-4 border-t border-gray-100",children:n.jsxs(te,{variant:"outline",size:"sm",onClick:()=>h(!0),disabled:c,className:"w-full bg-white hover:bg-red-50 border-red-200 text-red-600 hover:text-red-700 transition-colors",children:[n.jsx(va,{className:"h-3 w-3 mr-2"}),c?"Deleting...":"Delete Brand"]})})]})]})]})]})]}),n.jsxs("div",{className:"relative overflow-hidden bg-gradient-to-br from-white via-blue-50/20 to-indigo-50/30 rounded-2xl border border-blue-200/50 shadow-sm",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsx("div",{className:"relative",children:n.jsx(JZe,{brandId:e,selectedBrand:o||s,setSelectedBrand:p},e)})]}),n.jsx(Zt,{open:u,onOpenChange:h,children:n.jsxs(Jt,{className:"max-w-md",children:[n.jsxs(_r,{children:[n.jsx(tr,{className:"text-xl font-bold text-red-600",children:"Delete Brand"}),n.jsxs(Hr,{className:"text-gray-600",children:["This action will permanently delete ",n.jsxs("span",{className:"font-semibold",children:['"',s==null?void 0:s.brand_name,'"']})," and all associated data including:"]})]}),n.jsxs("div",{className:"space-y-4 py-4",children:[n.jsxs(Ar,{className:"border-amber-200 bg-amber-50",children:[n.jsx(hn,{className:"h-4 w-4 text-amber-600"}),n.jsx(gr,{className:"text-amber-800",children:n.jsxs("ul",{className:"list-disc list-inside space-y-1 mt-2",children:[n.jsx("li",{children:"All content and campaigns"}),n.jsx("li",{children:"Platform connections and settings"}),n.jsx("li",{children:"Analytics and history"}),n.jsx("li",{children:"All convergences and trends"})]})})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("label",{className:"text-sm font-medium text-gray-700",children:["Type ",n.jsxs("span",{className:"font-semibold",children:['"',s==null?void 0:s.brand_name,'"']})," to confirm deletion:"]}),n.jsx(qe,{value:m,onChange:x=>f(x.target.value),placeholder:"Enter brand name",className:"w-full"})]})]}),n.jsxs(Sn,{className:"gap-2",children:[n.jsx(te,{variant:"outline",onClick:()=>{h(!1),f("")},disabled:c,children:"Cancel"}),n.jsx(te,{variant:"destructive",onClick:v,disabled:c||m!==(s==null?void 0:s.brand_name),children:c?"Deleting...":"Delete Brand"})]})]})})]}),n.jsx(xS,{})]})};function tm(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function XZe(e){if(!tm(e))return null;const t=e.file_size;return typeof t=="number"?t:null}const ZZe=({onFilesUploaded:e,onAddResource:t,isCompact:r=!1})=>{const[s,a]=g.useState(!1),i=g.useCallback(d=>{d.preventDefault(),a(!0)},[]),o=g.useCallback(()=>{a(!1)},[]),l=g.useCallback(d=>{if(d.preventDefault(),a(!1),d.dataTransfer.files&&d.dataTransfer.files.length>0){const u=Array.from(d.dataTransfer.files);e(u)}},[e]),c=g.useCallback(d=>{if(d.target.files&&d.target.files.length>0){const u=Array.from(d.target.files);e(u)}},[e]);return r?n.jsxs("div",{className:`relative overflow-hidden border-2 border-dashed rounded-xl p-4 flex flex-col items-center justify-center
1367          cursor-pointer transition-all duration-300 shadow-sm hover:shadow-md ${s?"border-emerald-400 bg-gradient-to-br from-emerald-50 to-teal-50 shadow-emerald-200/50":"border-emerald-200 bg-gradient-to-br from-emerald-25 to-white hover:border-emerald-300"}`,onDragOver:i,onDragLeave:o,onDrop:l,onClick:()=>{var d;return(d=document.getElementById("dropzone-file-compact"))==null?void 0:d.click()},children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsxs("div",{className:"relative text-center",children:[n.jsx("div",{className:`p-2 rounded-full mx-auto mb-2 transition-all duration-300 ${s?"bg-emerald-100 text-emerald-600 scale-110":"bg-emerald-50 text-emerald-500"}`,children:n.jsx(RR,{className:"h-6 w-6"})}),n.jsx("p",{className:"text-sm font-medium text-emerald-700",children:"Drop files here or click to upload"})]}),n.jsx("input",{id:"dropzone-file-compact",type:"file",className:"hidden",multiple:!0,onChange:c})]}):n.jsxs("div",{className:`relative overflow-hidden border-2 border-dashed rounded-2xl p-8 flex flex-col items-center justify-center
1368        cursor-pointer transition-all duration-300 shadow-lg hover:shadow-xl ${s?"border-emerald-400 bg-gradient-to-br from-emerald-50 via-teal-50 to-cyan-50 shadow-emerald-200/50 scale-[1.02]":"border-emerald-200 bg-gradient-to-br from-white via-emerald-25 to-white hover:border-emerald-300 hover:shadow-emerald-100/50"}`,onDragOver:i,onDragLeave:o,onDrop:l,onClick:()=>{var d;return(d=document.getElementById("dropzone-file"))==null?void 0:d.click()},children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsx("div",{className:"absolute top-0 right-0 w-32 h-32 bg-gradient-to-br from-emerald-200/20 to-transparent roun
1368ded-full -translate-y-16 translate-x-16"}),n.jsxs("div",{className:"relative text-center",children:[n.jsx("div",{className:`mb-6 p-4 rounded-2xl mx-auto transition-all duration-300 bg-white/80 backdrop-blur-sm shadow-lg ${s?"text-emerald-600 scale-110 shadow-emerald-200/50":"text-emerald-500 hover:scale-105"}`,children:n.jsx(RR,{className:"h-10 w-10 mx-auto"})}),n.jsx("h3",{className:"text-xl font-bold text-emerald-800 mb-2",children:"Drag & drop files here or click to upload"}),n.jsx("p",{className:"text-emerald-600 mb-6 max-w-md",children:"Supports images, videos, audio files, documents and data files. Upload multiple files at once."}),n.jsx("input",{id:"dropzone-file",type:"file",className:"hidden",multiple:!0,onChange:c}),n.jsxs("div",{className:"flex gap-3 justify-center",children:[n.jsxs(te,{type:"button",className:"bg-gradient-to-r from-emerald-500 to-teal-500 hover:from-emerald-600 hover:to-teal-600 shadow-lg hover:shadow-xl transition-all duration-300",children:[n.jsx(Y_,{className:"h-4 w-4 mr-2"}),"Upload Files"]}),n.jsx(tet,{onAddResource:t})]})]})]})},eet=({open:e,onOpenChange:t,onMediaSelected:r,brandId:s})=>{var S;const[a,i]=g.useState(""),[o,l]=g.useState("photos"),[c,d]=g.useState([]),[u,h]=g.useState(!1),[m,f]=g.useState(null),[p,A]=g.useState(1),[v,x]=g.useState(!0),[b,y]=g.useState(null);g.useEffect(()=>{e||(i(""),d([]),f(null),A(1),x(!0))},[e]);const w=async(C,E=1,T=!1)=>{if(C.trim()){h(!0);try{const B=await de.auth.getSession();if(!B.data.session)throw new Error("No active session");const L="https://worker.rainfactory.ai",P=await fetch(`${L}/rainfactory/content-functions/pexels-search`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${B.data.session.access_token}`},body:JSON.stringify({query:C,type:o,page:E,per_page:20})});if(!P.ok){const I=await P.json();throw new Error(I.error||"Failed to search Pexels")}const F=await P.json(),M=o==="photos"?F.photos:F.videos;d(T?I=>[...I,...M]:M),x(M.length===20)}catch(B){console.error("Error searching Pexels:",B),He({title:"Search Failed",description:B instanceof Error?B.message:"Failed to search Pexels",variant:"destructive"})}finally{h(!1)}}},j=C=>{C.preventDefault(),A(1),w(a,1,!1)},N=()=>{const C=p+1;A(C),w(a,C,!0)},_=async C=>{y(C.id);try{const E=await de.auth.getSession();if(!E.data.session)throw new Error("No active session");const T="https://worker.rainfactory.ai";let B,L,P;if(o==="photos"){const I=C;B=I.src.large,L=`pexels-${I.photographer.replace(/\s+/g,"-").toLowerCase()}-${I.id}.jpg`,P=I.alt||`Photo by ${I.photographer}`}else{const I=C;B=(I.video_files.find(V=>V.quality==="hd")||I.video_files[0]).link,L=`pexels-${I.user.name.replace(/\s+/g,"-").toLowerCase()}-${I.id}.mp4`,P=`Video by ${I.user.name}`}const F=await fetch(`${T}/rainfactory/content-functions/pexels-download`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${E.data.session.access_token}`},body:JSON.stringify({brandId:s,url:B,filename:L,description:P,type:o==="photos"?"image":"video",metadata:{pexels_id:C.id,pexels_url:C.url,photographer:o==="photos"?C.photographer:C.user.name,photographer_url:o==="photos"?C.photographer_url:C.user.url,width:C.width,height:C.height,source:"stock_media"}})});if(!F.ok){const I=await F.json();throw new Error(I.error||"Failed to download media")}const M=await F.json();He({title:"Media Added",description:"The media has been downloaded and added to your resources",variant:"default",className:"bg-green-50 dark:bg-green-900/10 border-green-200 dark:border-green-900/50"}),t(!1),r(B,o==="photos"?"image":"video",{resourceId:M.resourceId,pexels_id:C.id})}catch(E){console.error("Error downloading media:",E),He({title:"Download Failed",description:E instanceof Error?E.message:"Failed to download media",variant:"destructive"})}finally{y(null)}};return n.jsx(Zt,{open:e,onOpenChange:t,children:n.jsxs(Jt,{className:"sm:max-w-[900px] max-h-[90vh] flex flex-col",children:[n.jsxs(_r,{children:[n.jsx(tr,{children:"Search Stock"}),n.jsx(Hr,{children:"Search for high-quality free photos and videos"})]}),n.jsxs("form",{onSubmit:j,className:"flex gap-2",children:[n.jsxs("div",{className:"relative flex-1",children:[n.jsx(Ns,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),n.jsx(qe,{placeholder:`Search for ${o}...`,value:a,onChange:C=>i(C.target.value),className:"pl-9"})]}),n.jsx(Cs,{value:o,onValueChange:C=>l(C),className:"",children:n.jsxs(ps,{children:[n.jsxs(pt,{value:"photos",children:[n.jsx(Ra,{className:"h-4 w-4 mr-1"})," Photos"]}),n.jsxs(pt,{value:"videos",children:[n.jsx(fi,{className:"h-4 w-4 mr-1"})," Videos"]})]})}),n.jsx(te,{type:"submit",disabled:u||!a.trim(),children:u?n.jsx(kt,{className:"h-4 w-4 animate-spin"}):n.jsx(Ns,{className:"h-4 w-4"})})]}),n.jsx("div",{className:"flex-1 overflow-y-auto",children:c.length>0?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4 p-1",children:c.map(C=>n.jsxs("div",{className:"group relative",children:[n.jsx("div",{className:"aspect-square rounded-lg overflow-hidden bg-muted cursor-pointer",onClick:()=>f(C),children:o==="photos"?n.jsx("img",{src:C.src.medium,alt:C.alt,className:"w-full h-full object-cover transition-transform group-hover:scale-105"}):n.jsxs("div",{className:"relative w-full h-full",children:[n.jsx("img",{src:C.image,alt:`Video by ${C.user.name}`,className:"w-full h-full object-cover transition-transform group-hover:scale-105"}),n.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:n.jsx("div",{className:"bg-black/60 rounded-full p-2",children:n.jsx(fi,{className:"h-6 w-6 text-white"})})})]})}),n.jsx("div",{className:"absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity",children:n.jsx(te,{size:"sm",variant:"secondary",className:"bg-black/60 hover:bg-black/80 text-white border-0",onClick:E=>{E.stopPropagation(),_(C)},disabled:b===C.id,children:b===C.id?n.jsx(kt,{className:"h-4 w-4 animate-spin"}):n.jsx(Ad,{className:"h-4 w-4"})})}),n.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/60 to-transparent p-2 opacity-0 group-hover:opacity-100 transition-opacity",children:n.jsx("p",{className:"text-white text-xs truncate",children:o==="photos"?`Photo by ${C.photographer}`:`Video by ${C.user.name}`})})]},C.id))}),v&&n.jsx("div",{className:"flex justify-center mt-4",children:n.jsx(te,{variant:"outline",onClick:N,disabled:u,children:u?n.jsxs(n.Fragment,{children:[n.jsx(kt,{className:"mr-2 h-4 w-4 animate-spin"}),"Loading..."]}):"Load More"})})]}):n.jsx("div",{className:"flex flex-col items-center justify-center p-8 text-center",children:u?n.jsxs(n.Fragment,{children:[n.jsx(kt,{className:"h-8 w-8 animate-spin text-primary mb-2"}),n.jsx("p",{children:"Searching Pexels..."})]}):a?n.jsxs(n.Fragment,{children:[n.jsx(Ns,{className:"h-8 w-8 text-muted-foreground mb-2"}),n.jsxs("p",{className:"text-muted-foreground",children:['No results found for "',a,'"']})]}):n.jsxs(n.Fragment,{children:[n.jsx(Ra,{className:"h-8 w-8 text-muted-foreground mb-2"}),n.jsx("p",{className:"text-muted-foreground",children:"Search for high-quality photos and videos"})]})})}),n.jsx(Zt,{open:!!m,onOpenChange:()=>f(null),children:n.jsx(Jt,{className:"sm:max-w-[800px]",children:m&&n.jsxs(n.Fragment,{children:[n.jsxs(_r,{children:[n.jsx(tr,{children:o==="photos"?`Photo by ${m.photographer}`:`Video by ${m.user.name}`}),n.jsx(Hr,{children:o==="photos"?m.alt:`${m.width}×${m.height} • ${Math.floor(m.duration)}s`})]}),n.jsx("div",{className:"flex justify-center",children:o==="photos"?n.jsx("img",{src:m.src.large,alt:m.alt,className:"max-w-full max-h-[50vh] object-contain rounded-md"}):n.jsx("video",{src:(S=m.video_files[0])==null?void 0:S.link,poster:m.image,controls:!0,className:"max-w-full max-h-[50vh] rounded-md"})}),n.jsxs(Sn,{children:[n.jsxs("div",{className:"flex items-center gap-2 mr-auto",children:[n.jsxs(Be,{variant:"outline",children:[m.width,"×",m.height]}),n.jsxs("a",{href:o==="photos"?m.photographer_url:m.user.url,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-muted-foreground hover:text-foreground flex items-center gap-1",children:[n.jsx(li,{className:"h-3 w-3"}),o==="photos"?m.photographer:m.user.name]})]}),n.jsx(te,{variant:"outline",onClick:()=>f(null),children:"Close"}),n.jsx(te,{onClick:()=>_(m),disabled:b===m.id,children:b===m.id?n.jsxs(n.Fragment,{children:[n.jsx(kt,{className:"mr-2 h-4 w-4 animate-spin"}),"Adding..."]}):n.jsxs(n.Fragment,{children:[n.jsx(Ad,{className:"mr-2 h-4 w-4"}),"Add to Resources"]})})]})]})})}),n.jsxs(Sn,{children:[n.jsxs("div",{className:"text-xs text-muted-foreground mr-auto",children:["Photos and videos provided by ",n.jsx("a",{href:"https://www.pexels.com",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"Pexels"})]}),n.jsx(te,{variant:"outline",onClick:()=>t(!1),children:"Close"})]})]})})},tet=({onAddResource:e})=>{const[t,r]=g.useState(!1),[s,a]=g.useState("api"),[i,o]=g.useState(""),[l,c]=g.useState(""),[d,u]=g.useState(!1),h=()=>{a("api"),o(""),c(""),u(!1)},m=async()=>{try{if(u(!0),!i){He({title:"Missing URL",description:"Please enter a valid URL",variant:"destructive"}),u(!1);return}try{new URL(i)}catch{He({title:"Invalid URL",description:"Please enter a valid URL including http:// or https://",variant:"destructive"}),u(!1);return}const f=`${s}_${Date.now()}`;await e(s,l||"External resource",f,s==="api"?"application/json":null,i),r(!1),h()}catch(f){console.error("Error adding resource:",f),He({title:"Failed to Add Resource",description:f instanceof Error?f.message:"An error occurred adding the resource",variant:"destructive"}),u(!1)}};return n.jsxs(n.Fragment,{children:[n.jsxs(te,{variant:"outline",onClick:()=>r(!0),className:"bg-white/80 backdrop-blur-sm border-emerald-200 hover:bg-emerald-50 hover:border-emerald-300 text-emerald-700",children:[n.jsx(Im,{className:"h-4 w-4 mr-2"}),"Add via URL"]}),n.jsx(Zt,{open:t,onOpenChange:r,children:n.jsxs(Jt,{className:"sm:max-w-[500px] bg-gradient-to-br from-white via-emerald-50/30 to-teal-50/40 border border-emerald-200/50",children:[n.jsxs(_r,{className:"text-center pb-4",children:[n.jsx("div",{className:"mx-auto w-12 h-12 bg-emerald-100 rounded-full flex items-center justify-center mb-4",children:n.jsx(Im,{className:"h-6 w-6 text-emerald-600"})}),n.jsx(tr,{className:"text-xl font-bold text-emerald-800",children:"Add External Resource"}),n.jsx(Hr,{className:"text-emerald-600",children:"Add a resource via URL or API endpoint to your brand library"})]}),n.jsxs("div",{className:"grid gap-4 py-4",children:[n.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[n.jsx(ze,{htmlFor:"resource-type",className:"text-right",children:"Type"}),n.jsxs(ur,{value:s,onValueChange:f=>a(f),children:[n.jsx(or,{className:"col-span-3",id:"resource-type",children:n.jsx(hr,{placeholder:"Select resource type"})}),n.jsxs(lr,{children:[n.jsx(Fe,{value:"image",children:"Image URL"}),n.jsx(Fe,{value:"video",children:"Video URL"}),n.jsx(Fe,{value:"audio",children:"Audio URL"}),n.jsx(Fe,{value:"document",children:"Document URL"}),n.jsx(Fe,{value:"api",children:"API Endpoint"})]})]})]}),n.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[n.jsx(ze,{htmlFor:"url",className:"text-right",children:"URL"}),n.jsx(qe,{id:"url",value:i,onChange:f=>o(f.target.value),placeholder:"https://example.com/resource",className:"col-span-3"})]}),n.jsxs("div",{className:"grid grid-cols-4 items-start gap-4",children:[n.jsx(ze,{htmlFor:"description",className:"text-right pt-2",children:"Description"}
1368),n.jsx(qe,{id:"description",value:l,onChange:f=>c(f.target.value),placeholder:"Describe this resource",className:"col-span-3"})]})]}),n.jsxs(Sn,{children:[n.jsx(te,{variant:"outline",onClick:()=>r(!1),disabled:d,children:"Cancel"}),n.jsx(te,{onClick:m,disabled:d||!i,children:d?n.jsxs(n.Fragment,{children:[n.jsx(kt,{className:"mr-2 h-4 w-4 animate-spin"}),"Adding Resource..."]}):"Add Resource"})]})]})})]})},ret=e=>{if(e===0)return"0 Bytes";const t=1024,r=["Bytes","KB","MB","GB","TB"],s=Math.floor(Math.log(e)/Math.log(t));return parseFloat((e/Math.pow(t,s)).toFixed(2))+" "+r[s]},cne=(e,t)=>{switch(e){case"image":return n.jsx(Ra,{className:"h-8 w-8 text-blue-500"});case"video":return n.jsx(fi,{className:"h-8 w-8 text-red-500"});case"audio":return n.jsx(xB,{className:"h-8 w-8 text-green-500"});case"document":return n.jsx(Xr,{className:"h-8 w-8 text-amber-500"});case"data":return n.jsx(pd,{className:"h-8 w-8 text-purple-500"});case"api":return n.jsx(Vs,{className:"h-8 w-8 text-cyan-500"});default:if(t){if(t.startsWith("image/"))return n.jsx(Ra,{className:"h-8 w-8 text-blue-500"});if(t.startsWith("video/"))return n.jsx(fi,{className:"h-8 w-8 text-red-500"});if(t.startsWith("audio/"))return n.jsx(xB,{className:"h-8 w-8 text-green-500"});if(t.startsWith("application/pdf")||t.startsWith("text/"))return n.jsx(Xr,{className:"h-8 w-8 text-amber-500"});if(t.startsWith("application/zip")||t.startsWith("application/x-rar")||t.startsWith("application/x-7z"))return n.jsx(K0e,{className:"h-8 w-8 text-orange-500"})}return n.jsx(bB,{className:"h-8 w-8 text-gray-500"})}},net=({resource:e,onDelete:t,selected:r=!1,onToggleSelect:s,compactMode:a=!1,pickerMode:i=!1,focusable:o=!1,focused:l=!1,onKeyDown:c})=>{const d=cne(e.type,e.http_content_type),u=new Date(e.created_at).toLocaleDateString(),[h,m]=g.useState(!1),[f,p]=g.useState(!1),[A,v]=g.useState(!1),[x,b]=g.useState(!1),y=g.useRef(null),[w,j]=g.useState("");g.useEffect(()=>{h&&(console.log("Initializing description:",e.description),j(e.description||""))},[h,e.description]);const N=tm(e.metadata)&&e.metadata.pending_upload===!0,_=tm(e.metadata)&&e.metadata.upload_error===!0,S=tm(e.metadata)&&e.metadata.ai_generated===!0,E=(()=>{if(e.url_to_inject)try{const D=new URL(e.url_to_inject).pathname.split("/"),q=D[D.length-1];if(q)return decodeURIComponent(q)}catch{}return e.placeholder||e.id})(),T=async()=>{if(e.type==="api"&&e.url_to_inject){window.open(e.url_to_inject,"_blank");return}if(e.url_to_inject){const U=document.createElement("a");U.href=e.url_to_inject,U.download=E,U.target="_blank",document.body.appendChild(U),U.click(),U.remove()}else He({title:"Resource Not Available",description:"This resource does not have a downloadable URL yet.",variant:"destructive"})},[B,L]=g.useState(null);g.useEffect(()=>{if(e.type==="image"&&e.url_to_inject&&e.processed){const U=new Image;U.onload=()=>{L({width:U.width,height:U.height})},U.src=e.url_to_inject}},[e.type,e.url_to_inject,e.processed]),g.useEffect(()=>{if(e.type==="video"&&y.current){const U=y.current;x?(U.currentTime=0,U.muted=!0,U.play().catch(()=>{})):(U.pause(),U.currentTime=0)}},[x,e.type]);const P=e.type==="image"&&e.url_to_inject&&e.processed,F=e.type==="video"&&e.url_to_inject&&e.processed,M=XZe(e.metadata),I=M?ret(M):null,$=tm(e.metadata)&&typeof e.metadata.source=="string"?e.metadata.source:null,V=U=>{c&&c(U,e.id)},Q=(()=>{if(tm(e.metadata)){const U=e.metadata.width,D=e.metadata.height;if(U&&D)return{width:U,height:D}}return null})();return a?n.jsxs(Te,{className:`overflow-hidden transition-all duration-300 relative border-emerald-200/50 bg-white/90 backdrop-blur-sm ${i?"cursor-pointer hover:shadow-lg hover:shadow-emerald-100/50":""} ${r?"ring-2 ring-emerald-500 shadow-lg shadow-emerald-200/50 bg-emerald-50/40":i?"hover:ring-2 hover:ring-emerald-300/50 hover:bg-emerald-50/20":""} ${l?"ring-2 ring-emerald-400/70":""} ${N?"animate-pulse bg-emerald-50/30":""} ${_?"border-red-300 bg-red-50/30":""}`,onMouseEnter:()=>p(!0),onMouseLeave:()=>p(!1),onClick:()=>s&&s(e.id),tabIndex:o?0:void 0,onKeyDown:V,"aria-selected":r,children:[n.jsxs("div",{className:"flex items-center p-3 gap-3",children:[i&&n.jsx("div",{className:`absolute top-2 right-2 z-10 rounded-full w-6 h-6 flex items-center justify-center transition-all shadow-sm ${r?"bg-emerald-500 text-white scale-110":"bg-white/90 text-muted-foreground border-2 border-emerald-200"} ${f&&!r?"scale-105 border-emerald-300":""}`,children:r?n.jsx(Gn,{className:"h-4 w-4 stroke-[3]"}):n.jsx("div",{className:"h-4 w-4"})}),!i&&s&&n.jsx("div",{className:"flex-shrink-0",children:n.jsx(Xo,{checked:r,onCheckedChange:()=>s(e.id),"aria-label":"Select resource"})}),n.jsx("div",{className:"flex-shrink-0",children:P?n.jsx("div",{className:"w-12 h-12 rounded-md overflow-hidden border border-muted",onClick:U=>{i||(U.stopPropagation(),m(!0))},children:n.jsx("img",{src:e.url_to_inject,alt:e.description,className:"w-full h-full object-cover"})}):F?n.jsxs("div",{className:"w-12 h-12 rounded-md overflow-hidden border border-muted relative",onMouseEnter:()=>b(!0),onMouseLeave:()=>b(!1),onClick:U=>{i||(U.stopPropagation(),m(!0))},children:[n.jsx("video",{ref:y,src:e.url_to_inject,className:"w-full h-full object-cover",muted:!0,loop:!0,playsInl
1368ine:!0}),!x&&n.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/20",children:n.jsx(ho,{className:"h-4 w-4 text-white"})})]}):n.jsx("div",{className:"w-12 h-12 flex items-center justify-center rounded-md bg-muted/40",children:d})}),n.jsx("div",{className:"flex-grow min-w-0",children:n.jsxs("div",{className:"flex flex-col gap-1",children:[n.jsx("div",{className:"font-medium text-sm line-clamp-3",children:e.description}),n.jsxs("div",{className:"flex items-center flex-wrap gap-x-2 text-xs text-muted-foreground",children:[(!e.url_to_inject||N)&&n.jsx(Be,{variant:"outline",className:`px-1.5 py-0 h-5 font-normal ${N?"bg-blue-50 text-blue-700 border-blue-200":""} ${_?"bg-red-50 text-red-700 border-red-200":""}`,children:N?n.jsxs(n.Fragment,{children:[n.jsx(kt,{className:"h-3 w-3 mr-1 animate-spin"}),"Uploading"]}):_?n.jsxs(n.Fragment,{children:[n.jsx(va,{className:"h-3 w-3 mr-1"}),"Failed"]}):"Processing"}),S&&n.jsxs(Be,{variant:"secondary",className:"px-1.5 py-0 h-5 font-normal",children:[n.jsx(mr,{className:"h-3 w-3 mr-1"})," AI"]}),I&&n.jsx("span",{className:"text-xs text-muted-foreground",children:I}),B&&n.jsxs("span",{className:"text-xs text-muted-foreground",children:[B.width,"×",B.height]}),Q&&n.jsxs("span",{className:"text-xs text-muted-foreground",children:[Q.width,"×",Q.height]})]})]})}),n.jsx("div",{className:"flex-shrink-0 flex items-center gap-1",children:!i&&(P||F)&&f&&n.jsx(te,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground transition-opacity",onClick:U=>{U.stopPropagation(),m(!0)},children:n.jsx(Yw,{className:"h-4 w-4"})})})]}),n.jsx(Zt,{open:A,onOpenChange:v,children:n.jsxs(Jt,{className:"max-w-3xl",children:[n.jsxs(_r,{children:[n.jsx(tr,{children:"Edit Image"}),n.jsx(Hr,{children:"Crop, rotate, or adjust your image"})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-medium mb-2",children:"Original"}),n.jsx("div",{className:"bg-muted/30 rounded-md p-4 flex items-center justify-center",children:n.jsx("img",{src:e.url_to_inject,alt:"Original",className:"max-h-[240px] object-contain"})})]}),n.jsx("div",{children:n.jsx("h3",{className:"text-sm font-medium mb-2",children:"Preview"})})]}),n.jsxs("div",{className:"flex justify-center gap-4 py-2",children:[n.jsxs(te,{variant:"outline",size:"sm",children:[n.jsx(MR,{className:"h-4 w-4 mr-2"}),"Crop"]}),n.jsxs(te,{variant:"outline",size:"sm",children:[n.jsx(GR,{className:"h-4 w-4 mr-2"}),"Rotate"]}),n.jsxs(te,{variant:"outline",size:"sm",children:[n.jsx(x2,{className:"h-4 w-4 mr-2"}),"Adjust"]})]})]}),n.jsxs(Sn,{children:[n.jsx(te,{variant:"outline",onClick:()=>v(!1),children:"Cancel"}),n.jsx(te,{children:"Save as New"})]})]})})]}):n.jsxs(n.Fragment,{children:[n.jsxs(Te,{className:`overflow-hidden h-full flex flex-col transition-all duration-300 relative border-emerald-200/50 bg-white/90 backdrop-blur-sm ${i?"cursor-pointer hover:shadow-xl hover:shadow-emerald-100/50 hover:scale-[1.02]":"hover:shadow-xl hover:shadow-emerald-100/50 hover:scale-[1.02]"} ${r?"ring-2 ring-emerald-500 shadow-lg shadow-emerald-200/50 scale-[1.02] bg-emerald-50/40":i?"hover:ring-2 hover:ring-emerald-300/50 hover:bg-emerald-50/20":""} ${l?"ring-2 ring-emerald-400/70":""} ${N?"animate-pulse bg-emerald-50/30":""} ${_?"border-red-300 bg-red-50/30":""}`,onMouseEnter:()=>p(!0),onMouseLeave:()=>p(!1),onClick:()=>s&&s(e.id),tabIndex:o?0:void 0,onKeyDown:V,"aria-selected":r,children:[i&&n.jsx("div",{className:`absolute top-3 right-3 z-10 rounded-full w-7 h-7 flex items-center justify-center transition-all shadow-md ${r?"bg-emerald-500 text-white scale-110":"bg-white/90 text-muted-foreground border-2 border-emerald-200"} ${f&&!r?"scale-105 border-emerald-300":""}`,children:r?n.jsx(Gn,{className:"h-5 w-5 stroke-[3]"}):n.jsx("div",{className:"h-5 w-5"})}),P?n.jsxs("div",{className:"relative w-full h-48 overflow-hidden cursor-pointer group",onClick:U=>{i||(U.stopPropagation(),m(!0))},children:[n.jsx("img",{src:e.url_to_inject,alt:e.description,className:"w-full h-full object-cover transition-transform duration-500 group-hover:scale-105"}),n.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/60 via-trans
1368parent to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-300"}),n.jsxs("div",{className:"absolute bottom-0 left-0 right-0 p-2 opacity-0 group-hover:opacity-100 transition-opacity duration-300",children:[n.jsx("div",{className:"text-white text-sm font-medium truncate",children:e.description}),n.jsx("div",{className:"text-white/80 text-xs",children:E})]}),!i&&f&&n.jsx("div",{className:"absolute inset-0 flex items-center justify-center gap-2 bg-black/40 opacity-0 group-hover:opacity-100 transition-opacity duration-300",children:n.jsxs(te,{size:"sm",variant:"secondary",className:"bg-white/90 hover:bg-white transition-colors",onClick:U=>{U.stopPropagation(),m(!0)},children:[n.jsx(Yw,{className:"h-4 w-4 mr-1"}),"View"]})})]}):F?n.jsxs("div",{className:"relative w-full h-48 overflow-hidden cursor-pointer group",onMouseEnter:()=>b(!0),onMouseLeave:()=>b(!1),onClick:U=>{i||(U.stopPropagation(),m(!0))},children:[n.jsx("video",{ref:y,src:e.url_to_inject,className:"w-full h-full object-cover transition-transform duration-500 group-hover:scale-105",muted:!0,loop:!0,playsInline:!0}),!x&&n.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/20",children:n.jsx("div",{className:"bg-white/90 rounded-full p-3 transition-all group-hover:scale-110",children:n.jsx(ho,{className:"h-6 w-6 text-gray-800"})})}),n.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/60 via-trans
1368parent to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-300"}),n.jsxs("div",{className:"absolute bottom-0 left-0 right-0 p-2 opacity-0 group-hover:opacity-100 transition-opacity duration-300",children:[n.jsx("div",{className:"text-white text-sm font-medium truncate",children:e.description}),n.jsx("div",{className:"text-white/80 text-xs",children:E})]}),!i&&f&&n.jsxs("div",{className:"absolute inset-0 flex items-center justify-center gap-2 bg-black/40 opacity-0 group-hover:opacity-100 transition-opacity duration-300",children:[n.jsxs(te,{size:"sm",variant:"secondary",className:"bg-white/90 hover:bg-white transition-colors",onClick:U=>{U.stopPropagation(),m(!0)},children:[n.jsx(Yw,{className:"h-4 w-4 mr-1"}),"View"]}),n.jsxs(te,{size:"sm",variant:"secondary",className:"bg-white/90 hover:bg-white transition-colors",onClick:U=>{U.stopPropagation(),T()},disabled:!e.url_to_inject,children:[n.jsx(Ad,{className:"h-4 w-4 mr-1"}),"Download"]}),n.jsxs(te,{size:"sm",variant:"secondary",className:"bg-white/90 hover:bg-white text-red-600 hover:text-red-700 transition-colors",onClick:U=>{U.stopPropagation(),t(e.id)},children:[n.jsx(va,{className:"h-4 w-4 mr-1"}),"Delete"]})]})]}):n.jsx("div",{className:"p-4 flex items-center justify-center bg-muted/30 h-48",children:n.jsxs("div",{className:"flex flex-col items-center text-center",children:[n.jsx("div",{className:"w-16 h-16 flex items-center justify-center rounded-full bg-muted mb-2",children:d}),n.jsx("span",{className:"text-sm font-medium",children:e.type}),n.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:E})]})}),n.jsxs("div",{className:"flex-grow p-4",children:[n.jsxs("div",{className:"flex items-center mb-2",children:[!i&&s&&n.jsx(Xo,{checked:r,onCheckedChange:()=>s(e.id),"aria-label":"Select resource",className:"mr-2"}),n.jsx("h3",{className:"font-medium text-base line-clamp-3 flex-grow",children:e.description})]}),n.jsxs("div",{className:"flex flex-col gap-2",children:[n.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[(!e.url_to_inject||N||_)&&n.jsx(Be,{variant:N?"secondary":"outline",className:`px-2 py-0.5 font-normal ${N?"bg-blue-50 text-blue-700 border-blue-200":""} ${_?"bg-red-50 text-red-700 border-red-200":""}`,children:N?n.jsxs(n.Fragment,{children:[n.jsx(kt,{className:"h-3 w-3 mr-1 animate-spin"}),"Uploading"]}):_?n.jsxs(n.Fragment,{children:[n.jsx(va,{className:"h-3 w-3 mr-1"}),"Upload Failed"]}):"Processing"}),S&&n.jsxs(Be,{variant:"secondary",className:"px-2 py-0.5 font-normal",children:[n.jsx(mr,{className:"h-3 w-3 mr-1"})," AI-Generated"]})]}),n.jsxs("div",{className:"flex flex-wrap gap-1.5 mt-1",children:[e.type&&n.jsx(Be,{variant:"outline",className:"text-xs px-2 py-0.5 h-5 bg-muted/30",children:e.type}),I&&n.jsxs(Be,{variant:"outline",className:"text-xs flex items-center gap-1 px-2 py-0.5 h-5 bg-muted/30",children:[n.jsx(bB,{className:"h-3 w-3"}),I]}),B&&n.jsxs(Be,{variant:"outline",className:"text-xs flex items-center gap-1 px-2 py-0.5 h-5 bg-muted/30",children:[n.jsx(Ra,{className:"h-3 w-3"}),B.width,"×",B.height]}),Q&&n.jsxs(Be,{variant:"outline",className:"text-xs flex items-center gap-1 px-2 py-0.5 h-5 bg-muted/30",children:[n.jsx(fi,{className:"h-3 w-3"}),Q.width,"×",Q.height]})]})]})]}),n.jsxs("div",{className:"mt-auto",children:[n.jsx(xn,{}),n.jsxs("div",{className:"p-3",children:[!i&&(P||F)&&n.jsxs(te,{variant:"default",className:"w-full mb-2",onClick:U=>{U.stopPropagation(),m(!0)},children:[n.jsx(Yw,{className:"h-4 w-4 mr-2"}),"View"]}),n.jsx(uo,{className:"p-0 flex justify-between bg-gradient-to-r from-emerald-50/50 to-teal-50/50 border-t border-emerald-200/30",children:i?n.jsx(te,{variant:"ghost",size:"sm",onClick:U=>{U.stopPropagation(),s&&s(e.id)},className:r?"text-primary":"",children:r?n.jsxs(n.Fragment,{children:[n.jsx(Gn,{className:"h-4 w-4 mr-1"}),"Selected"]}):"Select"}):n.jsxs(n.Fragment,{children:[n.jsxs(te,{variant:"ghost",size:"sm",onClick:U=>{U.stopPropagation(),t(e.id)},className:"text-red-600 hover:text-red-700 hover:bg-red-50",children:[n.jsx(va,{className:"h-4 w-4 mr-1"}),"Delete"]}),n.jsxs(te,{variant:"ghost",size:"sm",onClick:U=>{U.stopPropagation(),T()},disabled:!e.url_to_inject,className:"hover:bg-primary/10",children:[e.type==="api"?n.jsx(Vs,{className:"h-4 w-4 mr-1"}):n.jsx(Ad,{className:"h-4 w-4 mr-1"}),e.type==="api"?"Open":"Download"]})]})})]})]}),n.jsx(Zt,{open:A,onOpenChange:v,children:n.jsxs(Jt,{className:"max-w-3xl",children:[n.jsxs(_r,{children:[n.jsx(tr,{children:"Edit Image"}),n.jsx(Hr,{children:"Crop, rotate, or adjust your image"})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-medium mb-2",children:"Original"}),n.jsx("div",{className:"bg-muted/30 rounded-md p-4 flex items-center justify-center",children:n.jsx("img",{src:e.url_to_inject,alt:"Original",className:"max-h-[240px] object-contain"})})]}),n.jsx("div",{children:n.jsx("h3",{className:"text-sm font-medium mb-2",children:"Preview"})})]}),n.jsxs("div",{className:"flex justify-center gap-4 py-2",children:[n.jsxs(te,{variant:"outline",size:"sm",children:[n.jsx(MR,{className:"h-4 w-4 mr-2"}),"Crop"]}),n.jsxs(te,{variant:"outline",size:"sm",children:[n.jsx(GR,{className:"h-4 w-4 mr-2"}),"Rotate"]}),n.jsxs(te,{variant:"outline",size:"sm",children:[n.jsx(x2,{className:"h-4 w-4 mr-2"}),"Adjust"]})]})]}),n.jsxs(Sn,{children:[n.jsx(te,{variant:"outline",onClick:()=>v(!1),children:"Cancel"}),n.jsx(te,{children:"Save as New"})]})]})})]}),n.jsx(Zt,{open:h,onOpenChange:m,children:n.jsxs(Jt,{className:"sm:max-w-[1100px] max-h-[90vh] flex flex-col overflow-hidden",children:[n.jsxs("div",{className:"flex-1 overflow-y-auto min-h-0",children:[n.jsx(_r,{children:n.jsxs("div",{className:"space-y-4",children:[$&&n.jsx("div",{children:n.jsxs(Be,{className:"capitalize",variant:"outline",children:["Source: ",String($).replace(/_/g," ")
1368]})}),n.jsxs("div",{children:[n.jsx(ze,{htmlFor:"resource-description",className:"text-sm font-medium",children:"Description"}),n.jsx("textarea",{id:"resource-description",value:w,onChange:U=>j(U.target.value),className:"mt-2 w-full min-h-[100px] p-3 border border-input bg-background rounded-md text-sm leading-relaxed resize-vertical focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent",placeholder:"Add a description for this resource..."})]}),e.url_to_inject&&n.jsx("div",{children:n.jsxs("a",{href:e.url_to_inject,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:underline flex items-center gap-1",children:[n.jsx(Im,{className:"h-3 w-3"}),n.jsx("span",{className:"text-xs truncate",children:e.url_to_inject})]})})]})}),n.jsx("div",{className:"flex justify-center mt-4",children:P?n.jsx("img",{src:e.url_to_inject,alt:w||"Resource image",className:"max-w-full max-h-[60vh] object-contain bg-muted/30 rounded-md"}):F?n.jsx("video",{src:e.url_to_inject,controls:!0,className:"max-w-full max-h-[60vh] object-contain bg-muted/30 rounded-md",autoPlay:!0,muted:!0,children:"Your browser does not support the video tag."}):null})]}),n.jsxs(Sn,{className:"flex-col sm:flex-row gap-2",children:[n.jsxs("div",{className:"flex flex-wrap gap-2 justify-start sm:mr-auto",children:[B&&n.jsxs(Be,{className:"flex items-center gap-1",children:[n.jsx(Ra,{className:"h-3 w-3"}),B.width,"×",B.height]}),Q&&n.jsxs(Be,{className:"flex items-center gap-1",children:[n.jsx(fi,{className:"h-3 w-3"}),Q.width,"×",Q.height]}),I&&n.jsxs(Be,{className:"flex items-center gap-1",variant:"outline",children:[n.jsx(bB,{className:"h-3 w-3"}),I]}),n.jsxs(Be,{className:"flex items-center gap-1",variant:"outline",children:[n.jsx(Kn,{className:"h-3 w-3"}),u]}),S&&n.jsxs(Be,{className:"flex items-center gap-1",variant:"secondary",children:[n.jsx(mr,{className:"h-3 w-3"}),"AI-Generated"]})]}),n.jsxs("div",{className:"flex gap-2 mt-2 sm:mt-0",children:[n.jsx(te,{variant:"outline",onClick:T,children:"Download"}),n.jsx(te,{onClick:async()=>{if(w!==(e.description||""))try{const{error:U}=await de.from("resource_cache").update({description:w}).eq("id",e.id);if(U)throw U;e.description=w,He({title:"Resource Updated",description:"The resource description has been updated.",variant:"default",className:"bg-green-50 dark:bg-green-900/10 border-green-200 dark:border-green-900/50"})}catch(U){console.error("Error updating resource:",U),He({title:"Update Failed",description:"Failed to update the resource.",variant:"destructive"})}m(!1)},children:"Save & Close"})]})]})]})})]})},dne=async(e,t,r=30,s=2e3)=>{let a=0;const i=async()=>{const{data:o,error:l}=await de.from("resource_cache").select("*").eq("id",e).single();return l?(console.error("Error polling resource status:",l),!0):o&&o.processed?(t(o),!0):(a++,a>=r)};return new Promise(o=>{const l=async()=>{await i()?o():setTimeout(l,s)};l()})},set=({open:e,onOpenChange:t,onImageGenerated:r,brandId:s})=>{const[a,i]=g.useState(""),[o,l]=g.useState(!1),[c,d]=g.useState(null),[u,h]=g.useState("realistic"),[m,f]=g.useState("1:1"),[p,A]=g.useState([]),[v,x]=g.useState(!1);g.useEffect(()=>{e||(i(""),d(null),l(!1))},[e]);const b=[{value:"realistic",label:"Realistic"},{value:"lifestyle",label:"Lifestyle"},{value:"product",label:"Product"},{value:"abstract",label:"Abstract"},{value:"cartoon",label:"Cartoon"},{value:"artistic",label:"Artistic"}],y=[{value:"1:1",label:"Square (1:1)",width:1024,height:1024},{value:"16:9",label:"Landscape (16:9)",width:1344,height:768},{value:"9:16",label:"Portrait (9:16)",width:768,height:1344},{value:"4:5",label:"Instagram (4:5)",width:820,height:1024},{value:"2:1",label:"Banner (2:1)",width:1344,height:672}],w=async()=>
1368{if(!(!s||!a.trim()))try{l(!0),p.includes(a)||A(M=>[a,...M.slice(0,9)]);const N=y.find(M=>M.value===m),_=(N==null?void 0:N.width)||1024,S=(N==null?void 0:N.height)||1024,C=`image_ai_${Date.now()}`,E=a.substring(0,100)+(a.length>100?"...":""),{data:T,error:B}=await de.from("resource_cache").insert({brand_id:s,description:E,placeholder:C,type:"image",processed:!1,required:!1,metadata:{source:"ai_generated",ai_generated:!0,ai_prompt:a,ai_style:u,width:_,height:S,aspect_ratio:m}}).select().single();if(B)throw new Error(B.message);const L="https://worker.rainfactory.ai",P=await de.auth.getSession();if(!P.data.session)throw new Error("No active session");const F=await fetch(`${L}/rainfactory/content-functions/generate-image`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${P.data.session.access_token}`},body:JSON.stringify({resourceId:T.id,prompt:a,style:u,width:_,height:S})});if(!F.ok){const M=await F.json();throw new Error(M.error||"Failed to generate image")}await dne(T.id,M=>{d(M),r(M)}),He({title:"Image Generated",description:"Your AI-generated image is ready",variant:"default",className:"bg-green-50 dark:bg-green-900/10 border-green-200 dark:border-green-900/50"})}catch(N){console.error("Error generating image:",N),He({title:"Generation Failed",description:N instanceof Error?N.message:"An error occurred while generating the image",variant:"destructive"})}finally{l(!1)}},j=()=>{const N=y.find(_=>_.value===m);return`${(N==null?void 0:N.width)||1024}×${(N==null?void 0:N.height)||1024}`};return n.jsx(Zt,{open:e,onOpenChange:t,children:n.jsxs(Jt,{className:"sm:max-w-[600px]",children:[n.jsxs(_r,{children:[n.jsx(tr,{children:"Generate Image with AI"}),n.jsx(Hr,{children:"Create a new image using AI by providing a detailed prompt"})]}),n.jsxs("div",{className:"grid gap-4 py-4",children:[n.jsxs("div",{className:"relative",children:[n.jsxs("div",{className:"flex",children:[n.jsxs("div",{className:"relative flex-1",children:[n.jsx(qe,{placeholder:"Describe the image you want to create...",value:a,onChange:N=>i(N.target.value),className:"pr-9"}),p.length>0&&n.jsx(te,{variant:"ghost",size:"icon",className:"absolute right-2 top-1/2 transform -translate-y-1/2 h-8 w-8",onClick:()=>x(!v),children:n.jsx(Vr,{className:"h-4 w-4"})})]}),n.jsx(te,{className:"ml-2",onClick:w,disabled:o||!a.trim(),children:o?n.jsxs(n.Fragment,{children:[n.jsx(kt,{className:"mr-2 h-4 w-4 animate-spin"}),"Generating..."]}):n.jsxs(n.Fragment,{children:[n.jsx(mr,{className:"mr-2 h-4 w-4"}),"Generate"]})})]}),v&&p.length>0&&n.jsx("div",{className:"absolute z-10 mt-1 w-full bg-background rounded-md border shadow-lg",children:n.jsxs("div",{className:"p-2",children:[n.jsx("h4",{className:"text-sm font-medium mb-1",children:"Recent Prompts"}),n.jsx("div",{className:"max-h-32 overflow-y-auto",children:p.map((N,_)=>n.jsx("div",{className:"px-2 py-1.5 text-sm rounded hover:bg-muted cursor-pointer",onClick:()=>{i(N),x(!1)},children:N},_))})]})})]}),n.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"style-preset",children:"Style Preset"}),n.jsxs(ur,{value:u,onValueChange:h,children:[n.jsx(or,{id:"style-preset",children:n.jsx(hr,{placeholder:"Select style"})}),n.jsx(lr,{children:b.map(N=>n.jsx(Fe,{value:N.value,children:N.label},N.value))})]})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"aspect-ratio",children:"Aspect Ratio"}),n.jsxs(ur,{value:m,onValueChange:f,children:[n.jsx(or,{id:"aspect-ratio",children:n.jsx(hr,{placeholder:"Select ratio"})}),n.jsx(lr,{children:y.map(N=>n.jsx(Fe,{value:N.value,children:N.label},N.value))})]}),n.jsxs("p",{className:"text-xs text-muted-foreground",children:[j()," pixels"]})]})]}),c&&c.url_to_inject&&n.jsxs("div",{className:"mt-4",children:[n.jsx("h4",{className:"text-sm font-medium mb-2",children:"Generated Image"}),n.jsx("div",{className:"flex justify-center bg-muted/30 rounded-md p-4",children:n.jsx("img",{src:c.url_to_inject,alt:c.description,className:"max-h-[300px] rounded-md object-contain"})}),n.jsx("div",{className:"flex justify-center mt-2",children:n.jsxs(Be,{className:"flex items-center gap-1",children:[n.jsx(Ra,{className:"h-3 w-3"}),j()]})})]})]}),n.jsxs(Sn,{className:"flex-col sm:flex-row gap-2",children:[n.jsx(te,{variant:"outline",onClick:()=>t(!1),className:"sm:ml-auto",children:c?"Close":"Cancel"}),c&&n.jsxs(te,{onClick:()=>{r(c),t(!1)},children:[n.jsx(Gn,{className:"mr-2 h-4 w-4"}),"Use Image"]})]})]})})},xE=[{label:"Upload Files",description:"Upload images, videos, audio, or documents to your brand resources.",icon:n.jsx(Y_,{className:"h-4 w-4 mr-2"}),action:"upload"},{label:"Search Stock",description:"Find high-quality free photos and videos from stock libraries.",icon:n.jsx(Ns,{className:"h-4 w-4 mr-2"}),action:"pexels"},{label:"Generate with AI",description:"Create a new image using AI by providing a prompt.",icon:n.jsx(mr,{className:"h-4 w-4 mr-2"}),action:"ai"}],cH=({onUploadClick:e,onGenerateAIClick:t,onPexelsClick:r})=>{const[s,a]=g.useState("0"),[i,o]=g.useState(!1),[l,c]=g.useState(!1),d=()=>{c(!0)},u=h=>{a(h);const m=xE[Number(h)].action;m==="upload"?e():m==="pexels"?r():m==="ai"?t():o(!0),c(!1)};return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"inline-flex -space-x-px divide-x divide-primary-foreground
1368/30 rounded-lg shadow-sm shadow-black/5 rtl:space-x-reverse",children:[n.jsxs(te,{className:"rounded-none shadow-none first:rounded-s-lg last:rounded-e-lg focus-visible:z-10",onClick:d,children:[xE[Number(s)].icon,"Add Files"]}),n.jsxs(ll,{open:l,onOpenChange:c,children:[n.jsx(cl,{asChild:!0,children:n.jsx(te,{className:"rounded-none shadow-none first:rounded-s-lg last:rounded-e-lg focus-visible:z-10",size:"icon","aria-label":"Options",children:n.jsx(Un,{size:16,strokeWidth:2,"aria-hidden":"true"})})}),n.jsx(fo,{className:"max-w-64 md:max-w-xs",side:"bottom",sideOffset:4,align:"end",children:n.jsx(cYe,{value:s,onValueChange:u,children:xE.map((h,m)=>n.jsx(jre,{value:String(m),className:"items-start [&>span]:pt-1.5 cursor-pointer",children:n.jsxs("div",{className:"flex flex-col gap-1",children:[n.jsxs("span",{className:"text-sm font-medium flex items-center",children:[h.icon,h.label]}),n.jsx("span",{className:"text-xs text-muted-foreground",children:h.description})]})},h.label))})})]})]}),n.jsx(Zt,{open:i,onOpenChange:o,children:n.jsxs(Jt,{children:[n.jsxs(_r,{children:[n.jsx(tr,{children:"Coming Soon"}),n.jsx(Hr,{children:'The "Generate with AI" feature is coming soon. Stay tuned!'})]}),n.jsx(Sn,{children:n.jsx(te,{onClick:()=>o(!1),children:"Close"})})]})})]})},aet=({selectedResource:e,onRemove:t})=>e?n.jsxs("div",{className:"fixed bottom-0 left-0 right-0 bg-background border-t p-3 flex items-center justify-between z-10",children:[n.jsxs("div",{className:"flex items-center",children:[n.jsx("div",{className:"h-12 w-12 rounded overflow-hidden mr-3 border",children:e.type==="image"&&e.url_to_inject?n.jsx("img",{src:e.url_to_inject,alt:e.description,className:"h-full w-full object-cover"}):n.jsx("div",{className:"h-full w-full flex items-center justify-center bg-muted",children:cne(e.type,e.http_content_type)})}),n.jsxs("div",{children:[n.jsx("p",{className:"text-sm font-medium",children:e.description}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"Selected"})]})]}),n.jsx("div",{className:"flex gap-2",children:n.jsx(te,{variant:"outline",size:"sm",onClick:t,children:"Remove"})})]}):null,iet=({open:e,onOpenChange:t,onFilesUploaded:r,onAddResource:s})=>n.jsx(Zt,{open:e,onOpenChange:t,children:n.jsxs(Jt,{className:"sm:max-w-[600px]",children:[n.jsxs(_r,{children:[n.jsx(tr,{children:"Upload Resources"}),n.jsx(Hr,{children:"Upload files to your brand resources"})]}),n.jsx("div",{className:"py-4",children:n.jsx(ZZe,{onFilesUploaded:a=>{r(a),t(!1)},onAddResource:async(...a)=>{await s(...a),t(!1)},isCompact:!1})}),n.jsx(Sn,{children:n.jsx(te,{variant:"outline",onClick:()=>t(!1),children:"Cancel"})})]})}),oy=({mode:e="manager",onResourceSelect:t,initialSelectedResource:r,onCancel:s,allowedTypes:a,brandId:i})=>{const{id:o}=Ei(),l=i||o||"",[c,d]=g.useState([]),[u,h]=g.useState([]),[m,f]=g.useState(!0),[p,A]=g.useState(""),[v,x]=g.useState("all"),b=["news_scraping","website_scraping","ai_generated","stock_media","user_upload","external_url"],[y,w]=g.useState(new Set(b)),j=ie=>{w(he=>{const ee=new Set(he);return ee.has(ie)?ee.delete(ie):ee.add(ie),ee})},N=y.size===b.length,_=()=>{w(ie=>ie.size===b.length?new Set:new Set(b))},[S,C]=g.useState(new Set),[E,T]=g.useState(null),[B,L]=g.useState(!1),[P,F]=g.useState(!1),[M,I]=g.useState(!1),[$,V]=g.useState(!1),[R,Q]=g.useState(!1),[U,D]=g.useState("newest"),[q,G]=g.useState(null);g.useEffect(()=>{(async()=>{if(l){f(!0);try{const{data:he,error:ee}=await de.from("resource_cache").select("*").eq("brand_id",l).order("created_at",{ascending:!1});if(ee)throw ee;d(he||[]),h(he||[])}catch(he){console.error("Error fetching resources:",he),He({title:"Failed to load resources",description:he instanceof Error?he.message:"An error occurred",variant:"destructive"})}finally{f(!1)}}})()},[l]),g.useEffect(()=>{if(e==="picker"&&r&&c.length>0){const ie=c.find(he=>he.id===r);ie&&(C(new Set([ie.id])),T(ie))}},[e,r,c]),g.useEffect(()=>{let ie=[...c];if(ie=ie.filter(he=>{const ee=he.metadata;if(!tm(ee))return!1;const xe=ee.source;return y.has(xe)}),p){const he=p.toLowerCase();ie=ie.filter(ee=>
1368{var xe,we,Se;return((xe=ee.description)==null?void 0:xe.toLowerCase().includes(he))||((we=ee.placeholder)==null?void 0:we.toLowerCase().includes(he))||((Se=ee.url_to_inject)==null?void 0:Se.toLowerCase().includes(he))})}v!=="all"&&(ie=ie.filter(he=>he.type===v)),a&&a.length>0&&(ie=ie.filter(he=>a.includes(he.type))),ie.sort((he,ee)=>{switch(U){case"newest":return new Date(ee.created_at).getTime()-new Date(he.created_at).getTime();case"oldest":return new Date(he.created_at).getTime()-new Date(ee.created_at).getTime();case"name":return(he.description||"").localeCompare(ee.description||"");default:return 0}}),h(ie)},[c,p,v,U,a,y]),g.useEffect(()=>{if(e==="picker")if(S.size===0)T(null);else{const ie=Array.from(S)[0],he=c.find(ee=>ee.id===ie);T(he||null)}},[S,c,e]);const Y=g.useCallback(ie=>{if(e==="picker"){C(new Set([ie]));const he=c.find(ee=>ee.id===ie);he&&t&&t(he)}else C(he=>{const ee=new Set(he);return ee.has(ie)?ee.delete(ie):ee.add(ie),ee})},[e,c,t]),K=async ie=>{try{const{error:he}=await de.from("resource_cache").delete().eq("id",ie);if(he)throw he;d(ee=>ee.filter(xe=>xe.id!==ie)),C(ee=>{const xe=new Set(ee);return xe.delete(ie),xe}),He({title:"Resource Deleted",description:"The resource has been deleted successfully",variant:"default"})}catch(he){console.error("Error deleting resource:",he),He({title:"Failed to Delete Resource",description:he instanceof Error?he.message:"An error occurred",variant:"destructive"})}},X=async()=>{try{const ie=Array.from(S);for(const he of ie){const{error:ee}=await de.from("resource_cache").delete().eq("id",he);if(ee)throw ee}d(he=>he.filter(ee=>!S.has(ee.id))),C(new Set),He({title:"Resources Deleted",description:`${ie.length} resources have been deleted successfully`,variant:"default"})}catch(ie){console.error("Error deleting resources:",ie),He({title:"Failed to Delete Resources",description:ie instanceof Error?ie.message:"An error occurred",variant:"destructive"})}},ne=async ie=>{if(!(!l||ie.length===0))try{const he=await de.auth.getSession();if(!he.data.session)throw new Error("No active session");const ee=[];for(const xe of ie){let we="document";xe.type.startsWith("image/")?we="image":xe.type.startsWith("video/")?we="video":xe.type.startsWith("audio/")?we="audio":(xe.type.startsWith("application/json")||xe.type.startsWith("text/csv")||xe.type.endsWith("spreadsheetml.sheet"))&&(we="data");const Se=`${we}_${Date.now()}_${xe.name.replace(/[^a-zA-Z0-9]/g,"_")}`,{data:pe,error:Ce}=await de.from("resource_cache").insert({brand_id:l,description:xe.name,placeholder:Se,type:we,processed:!1,required:!1,http_content_type:xe.type,metadata:{source:"user_upload",file_size:xe.size,file_name:xe.name,mime_type:xe.type,pending_upload:!0}}).select().single();if(Ce)throw Ce;ee.push(pe),d(re=>[pe,...re])}ee.length>0&&(G(ee[0].id),e==="picker"&&C(new Set([ee[0].id])));for(let xe=0;xe<ie.length;xe++){const we=ie[xe],Se=ee[xe];try{const pe=new FormData;pe.append("file",we),pe.append("resourceId",Se.id),pe.append("brandId",l);const Ce="https://worker.rainfactory.ai",re=await fetch(`${Ce}/rainfactory/content-functions/resource-upload`,{method:"POST",headers:{Authorization:`Bearer ${he.data.session.access_token}`},body:pe});if(!re.ok){const se=await re.json();throw new Error(se.error||"Failed to upload resource")}dne(Se.id,se=>{d(Ae=>Ae.map(Pe=>Pe.id===se.id?se:Pe))})}catch(pe){console.error(`Error uploading file ${we.name}:`,pe),d(Ce=>Ce.map(re=>re.id===Se.id?{...re,metadata:{...re.metadata,upload_error:!0,error_message:pe instanceof Error?pe.message:"Upload failed"}}:re))}}He({title:"Files Uploading",description:`${ie.length} ${ie.length===1?"file":"files"} being processed...`,variant:"default",className:"bg-green-50 dark:bg-green-900/10 border-green-200 dark:border-green-900/50"})}catch(he){console.error("Error preparing uploads:",he),He({title:"Upload Failed",description:he instanceof Error?he.message:"An error occurred preparing uploads",variant:"destructive"})}},ae=async(ie,he,ee,xe,we)=>{if(l)try{const{data:Se,error:pe}=await de.from("resource_cache").insert({brand_id:l,description:he,placeholder:ee,type:ie,processed:!0,required:!1,http_content_type:xe,url_to_inject:we,metadata:{source:"external_url"}}).select().single();if(pe)throw pe;d(Ce=>
1368[Se,...Ce]),He({title:"Resource Added",description:"External resource has been added successfully",variant:"default",className:"bg-green-50 dark:bg-green-900/10 border-green-200 dark:border-green-900/50"})}catch(Se){console.error("Error adding resource:",Se),He({title:"Failed to Add Resource",description:Se instanceof Error?Se.message:"An error occurred adding the resource",variant:"destructive"})}},J=(ie,he)=>{if(e==="picker")switch(ie.key){case"Enter":Y(he);break;case"ArrowRight":case"ArrowLeft":case"ArrowUp":case"ArrowDown":ie.preventDefault();const ee=u.findIndex(Se=>Se.id===he);if(ee===-1)return;let xe=ee;const we=Math.floor(window.innerWidth/300)||3;switch(ie.key){case"ArrowRight":xe=Math.min(ee+1,u.length-1);break;case"ArrowLeft":xe=Math.max(ee-1,0);break;case"ArrowUp":xe=Math.max(ee-we,0);break;case"ArrowDown":xe=Math.min(ee+we,u.length-1);break}xe!==ee&&G(u[xe].id);break}},W=()=>m?null:n.jsxs("div",{className:"relative overflow-hidden bg-gradient-to-br from-white via-emerald-50/30 to-teal-50/40 rounded-2xl border border-emerald-200/50 shadow-sm p-12",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsx("div",{className:"absolute top-0 right-0 w-32 h-32 bg-gradient-to-br from-emerald-200/20 to-transparent rounded-full -translate-y-16 translate-x-16"}),n.jsxs("div",{className:"relative flex flex-col items-center justify-center text-center",children:[n.jsx("div",{className:"p-4 bg-white/80 backdrop-blur-sm rounded-2xl shadow-lg mb-6",children:n.jsx(pd,{className:"h-12 w-12 text-emerald-500"})}),n.jsx("h3",{className:"text-2xl font-bold bg-gradient-to-r from-emerald-700 to-teal-700 bg-clip-text text-transparent mb-3",children:p||v!=="all"?"No resources found":"Build Your Resource Library"}),n.jsx("p",{className:"text-emerald-600 mb-8 max-w-lg text-lg leading-relaxed",children:p||v!=="all"?"Try adjusting your search or filters to find what you're looking for, or upload new resources to expand your library.":"Start by uploading your brand assets, generating AI content, or adding external resources to create a comprehensive media library."}),n.jsxs("div",{className:"flex flex-col gap-6 items-center",children:[n.jsx(cH,{onUploadClick:()=>I(!0),onGenerateAIClick:()=>V(!0),onPexelsClick:()=>Q(!0)}),n.jsxs("div",{className:"max-w-lg bg-white/60 backdrop-blur-sm rounded-xl border border-emerald-200/50 shadow-sm p-6",children:[n.jsxs("h4",{className:"font-semibold text-emerald-800 mb-3 flex items-center justify-center",children:[n.jsx(Xm,{className:"h-5 w-5 mr-2 text-emerald-600"}),"Resource Types You Can Add"]}),n.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[n.jsxs("div",{className:"flex items-center text-emerald-700",children:[n.jsx(Ra,{className:"h-4 w-4 mr-2 text-emerald-500"}),"Images & Photos"]}),n.jsxs("div",{className:"flex items-center text-emerald-700",children:[n.jsx(fi,{className:"h-4 w-4 mr-2 text-emerald-500"}),"Videos & Media"]}),n.jsxs("div",{className:"flex items-center text-emerald-700",children:[n.jsx(Xr,{className:"h-4 w-4 mr-2 text-emerald-500"}),"Documents"]}),n.jsxs("div",{className:"flex items-center text-emerald-700",children:[n.jsx(mr,{className:"h-4 w-4 mr-2 text-emerald-500"}),"AI Generated"]})]})]})]})]})]});return n.jsxs("div",{className:`container mx-auto ${e==="picker"?"h-[calc(100vh-140px)] flex flex-col":"mt-8"}`,children:[e==="manager"&&n.jsx("div",{className:"mb-8",children:n.jsxs("div",{className:"relative overflow-hidden bg-gradient-to-br from-white via-emerald-50/30 to-teal-50/40 rounded-2xl border border-emerald-200/50 shadow-sm p-8",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsx("div",{className:"absolute top-0 right-0 w-40 h-40 bg-gradient-to-br from-emerald-200/20 to-transparent rounded-full -translate-y-20 translate-x-20"}),n.jsx("div",{className:"relative",children:n.jsxs("div",{className:"flex items-center gap-4",children:[n.jsx("div",{className:"p-3 bg-white/80 backdrop-blur-sm rounded-2xl shadow-lg",children:n.jsx(pd,{className:"h-8 w-8 text-emerald-600"})}),n.jsxs("div",{children:[n.jsx("h1",{className:"text-4xl font-bold bg-gradient-to-r from-emerald-700 via-teal-700 to-cyan-700 bg-clip-text text-transparent mb-2",children:"Brand Resources"}),n.jsx("p",{className:"text-gray-600 text-lg leading-relaxed",children:"Manage your brand's visual assets and resources library. Upload, organize, and access all media files for content creation."})]})]})})]})}),n.jsx("div",{className:"bg-white/60 backdrop-blur-sm rounded-xl border border-emerald-200/50 shadow-sm p-4 mb-6",children:n.jsxs("div",{className:"flex justify-between items-center",children:[n.jsxs("div",{className:"flex items-center flex-1",children:[n.jsxs("div",{className:"relative w-full md:w-64 mr-4",children:[n.jsx(Ns,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),n.jsx(qe,{type:"search",placeholder:"Search resources...",className:"pl-9 w-full",value:p,onChange:ie=>A(ie.target.value)})]}),e==="manager"&&n.jsx(Cs,{value:v,onValueChange:ie=>x(ie),className:"hidden md:flex",children:n.jsxs(ps,{className:"bg-white/80 backdrop-blur-sm shadow-sm border border-emerald-200/50",children:[n.jsxs(pt,{value:"all",className:"data-[state=active]:bg-emerald-100 data-[state=active]:text-emerald-700",children:[n.jsx(sxe,{className:"h-4 w-4 mr-1"})," All"]}),n.jsxs(pt,{value:"image",className:"data-[state=active]:bg-blue-100 data-[state=active]:text-blue-700",children:[n.jsx(Ra,{className:"h-4 w-4 mr-1 text-blue-500"})," Images"]}),n.jsxs(pt,{value:"video",className:"data-[state=active]:bg-red-100 data-[state=active]:text-red-700",children:[n.jsx(fi,{className:"h-4 w-4 mr-1 text-red-500"})," Videos"]}),n.jsxs(pt,{value:"audio",className:"data-[state=active]:bg-purple-100 data-[state=active]:text-purple-700",children:[n.jsx(xB,{className:"h-4 w-4 mr-1 text-purple-500"})," Audio"]}),n.jsxs(pt,{value:"document",className:"data-[state=active]:bg-orange-100 data-[state=active]:text-orange-700",children:[n.jsx(Xr,{className:"h-4 w-4 mr-1 text-orange-500"})," Documents"]})]})})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs(ll,{children:[n.jsx(cl,{asChild:!0,children:n.jsxs(te,{variant:"outline",size:"sm",className:"h-9 bg-white/80 backdrop-blur-sm border-emerald-200/50 hover:bg-emerald-50",children:[n.jsx(ju,{className:"h-4 w-4 mr-2"}),"Sort"]})}),n.jsxs(fo,{align:"end",children:[n.jsx(Fr,{onClick:()=>D("newest"),children:"Newest first"}),n.jsx(Fr,{onClick:()=>D("oldest"),children:"Oldest first"}),n.jsx(Fr,{onClick:()=>D("name"),children:"Name (A-Z)"})]})]}),n.jsxs(ll,{children:[n.jsx(cl,{asChild:!0,children:n.jsxs(te,{variant:"outline",size:"sm",className:"h-9 bg-white/80 backdrop-blur-sm border-emerald-200/50 hover:bg-emerald-50",children:[n.jsx(x2,{className:"h-4 w-4 mr-2"}),"Sources"]})}),n.jsxs(fo,{align:"end",className:"w-52",children:[n.jsx(Fr,{onClick:_,children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Xo,{checked:N}),n.jsx("span",{className:"font-medium",children:"All"})]})}),n.jsx(xn,{className:"my-1"}),b.map(ie=>n.jsx(Fr,{onClick:()=>j(ie),children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Xo,{checked:y.has(ie)}),n.jsx("span",{className:"capitalize",children:String(ie).replace(/_/g," ")})]})},ie))]})]}),n.jsx(cH,{onUploadClick:()=>I(!0),onGenerateAIClick:()=>V(!0),onPexelsClick:()=>Q(!0),isCompact:e==="picker"}),e==="manager"&&S.size>0&&n.jsxs(te,{variant:"destructive",onClick:()=>F(!0),children:[n.jsx(va,{className:"h-4 w-4 mr-2"}),"Delete (",S.size,")"]}),e==="picker"&&E&&t&&n.jsxs(te,{onClick:()=>t(E),children:[n.jsx(Gn,{className:"h-4 w-4 mr-2"}),"Choose"]}),e==="picker"&&s&&n.jsx(te,{variant:"outline",onClick:s,children:"Cancel"})]})]})}),n.jsx("div",{className:e==="picker"?"flex-1 overflow-y-auto pr-2":"",children:m?n.jsxs("div",{className:"relative overflow-hidden bg-gradient-to-br from-white via-emerald-50/30 to-teal-50/40 rounded-2xl border border-emerald-200/50 shadow-sm p-12",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsxs("div",{className:"flex flex-col justify-center items-center text-center",children:[n.jsx("div",{className:"p-4 bg-white/80 backdrop-blur-sm rounded-2xl shadow-lg mb-4",children:n.jsx(kt,{className:"h-10 w-10 animate-spin text-emerald-500"})}),n.jsx("h3",{className:"text-xl font-semibold text-emerald-800 mb
1368-2",children:"Loading resources..."}),n.jsx("p",{className:"text-emerald-600",children:"Fetching your brand assets and media files"})]})]}):u.length===0?W():n.jsx("div",{className:`grid grid-cols-1 sm:grid-cols-2 ${e==="picker"?"lg:grid-cols-3":"lg:grid-cols-3 xl:grid-cols-4"} gap-6 mb-16`,children:u.map(ie=>n.jsx(net,{resource:ie,onDelete:()=>{T(ie),L(!0)},selected:S.has(ie.id),onToggleSelect:Y,pickerMode:e==="picker",focusable:e==="picker",focused:q===ie.id,onKeyDown:J,compactMode:e==="picker"},ie.id))})}),n.jsx(Zt,{open:B,onOpenChange:L,children:n.jsxs(Jt,{className:"bg-gradient-to-br from-white via-red-50/30 to-red-50/40 border border-red-200/50",children:[n.jsxs(_r,{className:"text-center pb-4",children:[n.jsx("div",{className:"mx-auto w-12 h-12 bg-red-100 rounded-full flex items-center justify-center mb-4",children:n.jsx(va,{className:"h-6 w-6 text-red-600"})}),n.jsx(tr,{className:"text-xl font-bold text-red-800",children:"Are you sure?"}),n.jsx(Hr,{className:"text-red-600",children:"This action cannot be undone. This will permanently delete the selected resource."})]}),n.jsxs(Sn,{children:[n.jsx(te,{variant:"outline",onClick:()=>L(!1),children:"Cancel"}),n.jsx(te,{onClick:()=>{E&&(K(E.id),C(new Set),T(null),L(!1))},variant:"destructive",children:"Delete"})]})]})}),n.jsx(Zt,{open:P,onOpenChange:F,children:n.jsxs(Jt,{className:"bg-gradient-to-br from-white via-red-50/30 to-red-50/40 border border-red-200/50",children:[n.jsxs(_r,{className:"text-center pb-4",children:[n.jsx("div",{className:"mx-auto w-12 h-12 bg-red-100 rounded-full flex items-center justify-center mb-4",children:n.jsx(va,{className:"h-6 w-6 text-red-600"})}),n.jsxs(tr,{className:"text-xl font-bold text-red-800",children:["Delete ",S.size," resources?"]}),n.jsx(Hr,{className:"text-red-600",children:"This action cannot be undone. This will permanently delete all selected resources."})]}),n.jsxs(Sn,{children:[n.jsx(te,{variant:"outline",onClick:()=>F(!1),children:"Cancel"}),n.jsx(te,{onClick:()=>{X(),F(!1)},variant:"destructive",children:"Delete All"})]})]})}),n.jsx(iet,{open:M,onOpenChange:I,onFilesUploaded:ne,onAddResource:ae}),n.jsx(set,{open:$,onOpenChange:V,onImageGenerated:ie=>{e==="picker"&&(C(new Set([ie.id])),t&&t(ie))},brandId:l||""}),n.jsx(eet,{open:R,onOpenChange:Q,onMediaSelected:()=>{(async()=>{if(l)try{const{data:he,error:ee}=await de.from("resource_cache").select("*").eq("brand_id",l).order("created_at",{ascending:!1});if(ee)throw ee;d(he||[])}catch(he){console.error("Error refreshing resources:",he)}})()},brandId:l||""}),e==="picker"&&E&&n.jsx(aet,{selectedResource:E,onRemove:()=>{C(new Set),T(null)}})]})};function oet(e){const[t,r]=g.useState({colors:[],typography:[],spacing:[],borders:[],other:[]}),[s,a]=g.useState(null),[i,o]=g.useState(!1),l=g.useCallback(m=>{if(!m)return{};const f={},p=/--([\w-]+)\s*:\s*([^;!]+)/g;let A;for(;(A=p.exec(m))!==null;){const v=`--${A[1]}`,x=A[2].trim();f[v]=x}return f},[]),c=g.useCallback(m=>{if(typeof window>"u")return"N/A";const f=document.querySelector(`[data-brand-id="${e}"]`);if(f){const p=getComputedStyle(f).getPropertyValue(m.replace("--","")).trim();if(p)return p}return getComputedStyle(document.documentElement).getPropertyValue(m.replace("--","")).trim()||"Not defined"},[e]),d=g.useCallback(m=>{const f={colors:[],typography:[],spacing:[],borders:[],other:[]};for(const[p,A]of Object.entries(m)){const v=c(p),x=document.querySelector(`[data-brand-id="${e}"]`);let b=!1;x&&v!=="Not defined"&&(b=v===A.trim()||v.replace(/\s+/g,"")===A.replace(/\s+/g,""));const y={name:p,value:A,appliedValue:v,isApplied:b};p.includes("color")||p.includes("-primary")||p.includes("-secondary")||p.includes("-accent")||p.includes("-success")||p.includes("-warning")||p.includes("-error")||p.includes("-bg-")?f.colors.push(y):p.includes("font")||p.includes("line-height")||p.includes("letter-spacing")?f.typography.push(y):p.includes("spacing")||p.includes("padding")||p.includes("margin")?f.spacing.push(y):p.includes("border")||p.includes("radius")?f.borders.push(y):f.other.push(y)}return f},[c,e]),u=g.useCallback(async m=>{o(!0);try{const{supabase:f}=await hs(async()=>{const{supabase:v}=await Promise.resolve().then(()=>dpe);return{supabase:v}},void 0),{data:p,error:A}=await f.from("brands").select("brand_css").eq("id",m).single();if(A){console.error("Error fetching brand CSS:",A);return}if(p!=null&&p.brand_css){console.log("Fetched brand CSS:",m),a(p.brand_css);const v=l(p.brand_css),x=d(v);r(x)}}catch(f){console.error("Error in fetchBrandCss:",f)}finally{o(!1)}},[l,d]),h=g.useCallback(()=>{s&&(window.dispatchEvent(new CustomEvent("refreshBrandTheme",{detail:{brandId:e}})),setTimeout(()=>{const m=l(s),f=d(m);r(f),console.log("Refreshed scoped theme variables for brand:",e)},100))},[e,s,l,d]);return{themeVariables:t,brandCss:s,isLoading:i,fetchBrandCss:u,refreshThemeVariables:h,getComputedValue:c}}function cet({brandId:e}){const[t,r]=g.useState(!1),{themeVariables:s,brandCss:a,isLoading:i,fetchBrandCss:o,refreshThemeVariables:l,getComputedValue:c}=oet(e);return g.useEffect(()=>{o(e)},[e,o]),typeof window>"u"?null:n.jsxs("div",{className:"fixed top-0 right-0 bg-black/80 text-white p-4 m-2 z-50 max-w-md max-h-[80vh] overflow-auto text-xs rounded",children:[n.jsxs("h3",{className:"text-sm font-bold mb-2 flex justify-between items-center",children:[n.jsx("span",{children:"Theme Variables"}),n.jsxs("div",{className:"flex space-x-2",children:[n.jsx("button",{onClick:()=>{l(),setTimeout(()=>{o(e)},300)},className:"bg-green-600 hover:bg-green-700 text-white px-2 py-1 rounded text-xs",children:"Refresh CSS"}),n.jsx("button",{onClick:()=>r(!t),className:"bg-blue-600 hover:bg-blue-700 text-white px-2 py-1 rounded text-xs",children:i?"Loading...":t?"Hide CSS":"Show Brand CSS"})]})]}),t?n.jsxs("div",{className:"mt-2",children:[n.jsx("h4",{className:"font-semibold mb-1",children:"Brand CSS:"}),n.jsx("pre",{className:"bg-black/50 p-2 rounded overflow-auto max-h-[60vh] whitespace-pre-wrap",children:a||"No CSS defined for this brand."}),Object.values(s).some(d=>d.length>0)&&n.jsxs("div",{className:"mt-4",children:[n.jsx("h4",{className:"font-semibold mb-1",children:"Extracted Variables:"}),s.colors.length>0&&n.jsxs("div",{className:"mb-3",children:[n.jsx("h5",{className:"text-blue-300 font-medium mb-1",children:"Brand Colors:"}),s.colors.map(d=>n.jsxs("div",{className:"mb-1 flex items-center",children:[n.jsx("span",{className:"w-4 h-4 mr-2 rounded",style:{backgroundColor:d.value.includes("#")?d.value:""}}),n.jsx("span",{className:"text-green-400",children:d.name}),": ",n.jsx("span",{children:d.value}),!d.isApplied&&d.appliedValue&&n.jsxs("span",{className:"ml-2 text-yellow-300 text-xs",children:["(Using: ",d.appliedValue,")"]})]},d.name))]}),s.typography.length>0&&n.jsxs("div",{className:"mb-3",children:[n.jsx("h5",{className:"text-blue-300 font-medium mb-1",children:"Typography:"}),s.typography.map(d=>n.jsxs("div",{className:"mb-1",children:[n.jsx("span",{className:"text-green-400",children:d.name}),": ",n.jsx("span",{children:d.value}),!d.isApplied&&d.appliedValue&&n.jsxs("span",{className:"ml-2 text-yellow-300 text-xs",children:["(Using: ",d.appliedValue,")"]})]},d.name))]}),s.spacing.length>0&&n.jsxs("div",{className:"mb-3",children:[n.jsx("h5",{className:"text-blue-300 font-medium mb-1",children:"Spacing:"}),s.spacing.map(d=>n.jsxs("div",{className:"mb-1",children:[n.jsx("span",{className:"text-green-400",children:d.name}),": ",n.jsx("span",{children:d.value}),!d.isApplied&&d.appliedValue&&n.jsxs("span",{className:"ml-2 text-yellow-300 text-xs",children:["(Using: ",d.appliedValue,")"]})]},d.name))]}),s.borders.length>0&&n.jsxs("div",{className:"mb-3",children:[n.jsx("h5",{className:"text-blue-300 font-medium mb-1",children:"Borders & Radius:"}),s.borders.map(d=>n.jsxs("div",{className:"mb-1",children:[n.jsx("span",{className:"text-green-400",children:d.name}),": ",n.jsx("span",{children:d.value}),!d.isApplied&&d.appliedValue&&n.jsxs("span",{className:"ml-2 text-yellow-300 text-xs",children:["(Using: ",d.appliedValue,")"]})]},d.name))]}),s.other.length>0&&n.jsxs("div",{className:"mb-3",children:[n.jsx("h5",{className:"text-blue-300 font-medium mb-1",children:"Other Variables:"}),s.other.map(d=>n.jsxs("div",{className:"mb-1",children:[n.jsx("span",{className:"text-green-400",children:d.name}),": ",n.jsx("span",{children:d.value}),!d.isApplied&&d.appliedValue&&n.jsxs("span",{className:"ml-2 text-yellow-300 text-xs",children:["(Using: ",d.appliedValue,")"]})]},d.name))]})]})]}):n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("div",{className:"w-4 h-4 rounded",style:{backgroundColor:c("--brand-primary")||"var(--brand-primary)"}}),n.jsxs("div",{children:["--brand-primary: ",c("--brand-primary")]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("div",{className:"w-4 h-4 rounded",style:{backgroundColor:c("--brand-secondary")||"var(--brand-secondary)"}}),n.jsxs("div",{children:["--brand-secondary: ",c("--brand-secondary")]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("div",{className:"w-4 h-4 rounded",style:{backgroundColor:c("--brand-accent")||"var(--brand-accent)"}}),n.jsxs("div",{children:["--brand-accent: ",c("--brand-accent")]})]}),n.jsxs("div",{className:"mt-4 pt-4 border-t border-white/20",children:[n.jsx("h5",{className:"font-medium mb-2",children:"Typography:"}),n.jsxs("div",{className:"grid grid-cols-1 gap-1",children:[n.jsxs("div",{children:["--font-heading: ",n.jsx("span",{style:{fontFamily:c("--font-heading")||"var(--font-heading, inherit)"},children:"Sample Text"})," ",c("--font-heading")]}),n.jsxs("div",{children:["--font-body: ",n.jsx("span",{style:{fontFamily:c("--font-body")||"var(--font-body, inherit)"},children:"Sample Text"})," ",c("--font-body")]}),n.jsxs("div",{children:["--brand-font-primary: ",n.jsx("span",{style:{fontFamily:c("--brand-font-primary")||"var(--brand-font-primary, inherit)"},children:"Sample Text"})," ",c("--brand-font-primary")]}),n.jsxs("div",{children:["--font-weight-normal: ",c("--font-weight-normal")]}),n.jsxs("div",{children:["--font-weight-bold: ",c("--font-weight-bold")]}),n.jsxs("div",{children:["--line-height: ",c("--line-height")]})]})]}),n.jsxs("div",{className:"mt-4 pt-4 border-t border-white/20",children:[n.jsx("h5",{className:"font-medium mb-2",children:"Layout & Spacing:"}),n.jsxs("div",{className:"grid grid-cols-1 gap-1",children:[n.jsxs("div",{children:["--border-radius-sm: ",c("--border-radius-sm")]}),n.jsxs("div",{children:["--border-radius-md: ",c("--border-radius-md")]}),n.jsxs("div",{children:["--border-radius-lg: ",c("--border-radius-lg")]}),n.jsxs("div",{children:["--border-radius-full: ",c("--border-radius-full")]}),n.jsxs("div",{children:["--spacing-xs: ",c("--spacing-xs")]}),n.jsxs("div",{children:["--spacing-sm: ",c("--spacing-sm")]}),n.jsxs("div",{children:["--spacing-md: ",c("--spacing-md")]}),n.jsxs("div",{children:["--spacing-lg: ",c("--spacing-lg")]}),n.jsxs("div",{children:["--spacing-xl: ",c("--spacing-xl")]})]})]}),n.jsx("div",{className:"mt-3 pt-3 border-t border-white/20",children:n.jsxs("div",{className:"text-xs text-gray-400",children:["Brand ID: ",e]})})]})]})}const QS=({brandId:e,children:t,contentType:r})=>{const{brand:s,fetchBrandDetails:a}=_0(e),i=g.useRef(null),[o,l]=g.useState(!1),[c,d]=g.useState(!1);g.useEffect(()=>{if(typeof window<"u"){const m=new URLSearchParams(window.location.search);d(m.get("debug")==="theme")}},[]),g.useEffect(()=>{e&&a(e)},[e,a]);const u=g.useCallback(m=>{if(!m)return;console.log(`Injecting scoped styles for brand ${e}...`);const f=`[data-brand-id="${e}"]`,A=(B=>{const L=/--([\w-]+)\s*:\s*([^;!]+)/g;let P;const F={};for(;(P=L.exec(B))!==null;){const M=`--${P[1]}`,I=P[2].trim();F[M]=I,i.current&&i.current.style.setProperty(M,I,"important")}return console.log("Applied CSS variables to wrapper container only:",F),F})(m),v=`brand-style-${e}`,x=document.getElementById(v);x&&x.parentNode&&x.parentNode.removeChild(x);const b=document.createElement("style");b.id=v,b.setAttribute("data-brand-id",e),b.setAttribute("data-content-type",r);const y=[];(m.includes("'Montserrat'")||m.includes('"Montserrat"'))&&y.push("Montserrat:wght@400;
1368700"),(m.includes("'Open Sans'")||m.includes('"Open Sans"'))&&y.push("Open+Sans:wght@400;600;700"),(m.includes("'Roboto'")||m.includes('"Roboto"'))&&y.push("Roboto:wght@400;500;700"),(m.includes("'Poppins'")||m.includes('"Poppins"'))&&y.push("Poppins:wght@400;500;600;700");let w="";if(y.length>0&&!m.includes("@import url")){const B=`@import url('https://fonts.googleapis.com/css2?family=${y.join("&family=")}&display=swap');
1369`;w=B,console.log("Added Google Fonts import:",B.trim())}let j=m;if(j=j.replace(/:root\s*{/g,`${f} {`),!m.includes(":root")){const B=Object.entries(A).map(([L,P])=>`  ${L}: ${P} !important;`).join(`
1370`);B&&(j=`${f} {
1371${B}
1372}
1373
1374`+j)}const N=j.split(`
1375`);let _=0,S=[];for(let B=0;B<N.length;B++){const L=N[B],P=(L.match(/{/g)||[]).length,F=(L.match(/}/g)||[]).length;if(_===0&&L.trim()&&!L.startsWith("@")&&!L.includes("/*")&&!L.includes("*/")&&L.includes("{")&&!L.includes(f)){const M=L.substring(0,L.indexOf("{")),I=L.substring(L.indexOf("{"));S.push(`${f} ${M.trim()} ${I}`)}else S.push(L);_+=P-F}if(w+=S.join(`
1376`),b.textContent=w,document.head.appendChild(b),i.current){const B=`brand-${e}`,L=`content-type-${r}`;i.current.classList.add(B,L)}console.log(`Scoped styles applied for brand ${e} (${r})`);const{primary:C,secondary:E,accent:T}=h(m);return i.current&&(i.current.style.setProperty("--current-brand-primary",C||"#3b82f6"),i.current.style.setProperty("--current-brand-secondary",E||"#10b981"),i.current.style.setProperty("--current-brand-accent",T||"#f97316")),b},[e,r]),h=m=>{const f={primary:"",secondary:"",accent:""},p=m.match(/--brand-primary\s*:\s*([^;!]+)/),A=m.match(/--brand-secondary\s*:\s*([^;!]+)/),v=m.match(/--brand-accent\s*:\s*([^;!]+)/);return p&&(f.primary=p[1].trim()),A&&(f.secondary=A[1].trim()),v&&(f.accent=v[1].trim()),f};return g.useEffect(()=>{if(!(s!=null&&s.brand_css))return;const m=u(s.brand_css);return l(!0),()=>{m&&m.parentNode&&m.parentNode.removeChild(m),l(!1)}},[s,u]),g.useEffect(()=>{const m=f=>{var A;((A=f.detail)==null?void 0:A.brandId)===e&&(console.log("Received refresh event for brand ID:",e),s!=null&&s.brand_css&&(u(s.brand_css),l(!0)))};return window.addEventListener("refreshBrandTheme",m),()=>{window.removeEventListener("refreshBrandTheme",m)}},[e,s,u]),g.useEffect(()=>{o&&typeof window<"u"&&(console.log("Current CSS variables:"),["--brand-primary","--brand-secondary","--brand-accent","--font-heading","--font-body","--border-radius-md"].forEach(m=>{console.log(`${m}:`,getComputedStyle(document.documentElement).getPropertyValue(m.replace("--","")))}))},[o]),n.jsxs("div",{ref:i,className:`brand-wrapper content-type-${r}`,"data-brand-id":e,"data-styles-applied":o?"true":"false",children:[c&&n.jsx(cet,{brandId:e}),t]})},vE=[{name:"System UI",value:'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif',category:"Sans Serif"},{name:"Inter",value:'"Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',category:"Sans Serif"},{name:"Roboto",value:'"Roboto", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',category:"Sans Serif"},{name:"Open Sans",value:'"Open Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',category:"Sans Serif"},{name:"Lato",value:'"Lato", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',category:"Sans Serif"},{name:"Poppins",value:'"Poppins", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',category:"Sans Serif"},{name:"Montserrat",value:'"Montserrat", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',category:"Sans Serif"},{name:"Source Sans Pro",value:'"Source Sans Pro", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',category:"Sans Serif"},{name:"Georgia",value:'Georgia, "Times New Roman", serif',category:"Serif"},{name:"Times New Roman",value:'"Times New Roman", Georgia, serif',category:"Serif"},{name:"Playfair Display",value:'"Playfair Display", Georgia, "Times New Roman", serif',category:"Serif"},{name:"Merriweather",value:'"Merriweather", Georgia, "Times New Roman", serif',category:"Serif"},{name:"Crimson Text",value:'"Crimson Text", Georgia, "Times New Roman", serif',category:"Serif"},{name:"Lora",value:'"Lora", Georgia, "Times New Roman", serif',category:"Serif"},{name:"Monaco",value:'Monaco, "Cascadia Code", "Roboto Mono", Consolas, "Courier New", monospace',category:"Monospace"},{name:"Fira Code",value:'"Fira Code", Monaco, "Cascadia Code", "Roboto Mono", Consolas, monospace',category:"Monospace"},{name:"Source Code Pro",value:'"Source Code Pro", Monaco, "Cascadia Code", "Roboto Mono", Consolas, monospace',category:"Monospace"},{name:"JetBrains Mono",value:'"JetBrains Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, monospace',category:"Monospace"},{name:"Roboto Mono",value:'"Roboto Mono", Monaco, "Cascadia Code", Consolas, monospace',category:"Monospace"},{name:"Custom",value:"",category:"Custom"}],$p=`:root {
1377  /* Primary colors */
1378  --brand-primary: #3b82f6;
1379  --brand-primary-dark: #1d4ed8;
1380  --brand-primary-light: #93c5fd;
1381  
1382  /* Secondary colors */
1383  --brand-secondary: #10b981;
1384  --brand-secondary-dark: #059669;
1385  --brand-secondary-light: #6ee7b7;
1386  
1387  /* Accent colors */
1388  --brand-accent: #f97316;
1389  --brand-accent-dark: #ea580c;
1390  --brand-accent-light: #fdba74;
1391  
1392  /* Neutrals */
1393  --brand-neutral-100: #f3f4f6;
1394  --brand-neutral-200: #e5e7eb;
1395  --brand-neutral-300: #d1d5db;
1396  --brand-neutral-400: #9ca3af;
1397  --brand-neutral-500: #6b7280;
1398  --brand-neutral-600: #4b5563;
1399  --brand-neutral-700: #374151;
1400  --brand-neutral-800: #1f2937;
1401  --brand-neutral-900: #111827;
1402  
1403  /* Typography */
1404  --brand-font-primary: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
1405  --brand-font-secondary: Georgia, 'Times New Roman', serif;
1406  --brand-font-monospace: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
1407  
1408  /* Spacing */
1409  --brand-spacing-xs: 0.25rem;
1410  --brand-spacing-sm: 0.5rem;
1411  --brand-spacing-md: 1rem;
1412  --brand-spacing-lg: 1.5rem;
1413  --brand-spacing-xl: 2rem;
1414  --brand-spacing-2xl: 3rem;
1415  
1416  /* Border radius */
1417  --brand-radius-sm: 0.125rem;
1418  --brand-radius-md: 0.25rem;
1419  --brand-radius-lg: 0.5rem;
1420  --brand-radius-xl: 1rem;
1421  --brand-radius-full: 9999px;
1422}
1423
1424/* Dark mode overrides */
1425.dark {
1426  --brand-neutral-100: #1f2937;
1427  --brand-neutral-200: #374151;
1428  --brand-neutral-300: #4b5563;
1429  --brand-neutral-400: #6b7280;
1430  --brand-neutral-500: #9ca3af;
1431  --brand-neutral-600: #d1d5db;
1432  --brand-neutral-700: #e5e7eb;
1433  --brand-neutral-800: #f3f4f6;
1434  --brand-neutral-900: #f9fafb;
1435}`,kx=e=>{const t=/--brand-([a-zA-Z0-9-]+):\s*([^;]+);/g,r=[];let s;for(;(s=t.exec(e))!==null;){const a=`--brand-${s[1]}`,i=s[2].trim();let o=s[1].replace(/-/g," ").replace(/\b\w/g,c=>c.toUpperCase()),l="";a.includes("primary")?l="Main brand color, used for key elements":a.includes("secondary")?l="Complementary color for secondary elements":a.includes("accent")?l="Highlight color for call-to-action elements":a.includes("neutral")?l="Neutral shade for text and backgrounds":a.includes("font")?l="Typography settings for brand consistency":a.includes("spacing")?l="Consistent spacing measurements":a.includes("radius")&&(l="Border radius for roun
1435ded corners"),r.push({name:a,label:o,value:i,description:l})}return r},det=(e,t,r)=>{const s=new RegExp(`(${t}):\\s*[^;]+;`,"g");return e.replace(s,`$1: ${r};`)},uet=({variable:e,idx:t,onChange:r})=>{const[s,a]=g.useState(""),[i,o]=g.useState(""),[l,c]=g.useState(!1),d=`${e.name}-${t}`;g.useEffect(()=>{const f=vE.find(p=>p.value===e.value&&p.value!=="");f?(a(f.name),c(!1)):(a("Custom"),o(e.value),c(!0))},[e.value]);const u=f=>{if(a(f),f==="Custom")c(!0);else{c(!1);const p=vE.find(A=>A.name===f);p&&r(e.name,p.value)}},h=f=>{o(f),r(e.name,f)},m=vE.reduce((f,p)=>(f[p.category]||(f[p.category]=[]),f[p.category].push(p),f),{});return n.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[n.jsxs("div",{className:"space-y-1 flex-grow",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(tbe,{className:"w-4 h-4 text-muted-foreground"}),n.jsx(ze,{htmlFor:d,className:"font-medium text-sm",children:e.label})]}),e.description&&n.jsx("p",{className:"text-xs text-muted-foreground",children:e.description}),n.jsx("div",{className:"text-sm px-2 py-1 bg-muted rounded text-muted-foreground",style:{fontFamily:e.value||"inherit"},children:"The quick brown fox jumps over the lazy dog"})]}),n.jsxs("div",{className:"flex flex-col gap-2 w-64",children:[n.jsxs(ur,{value:s,onValueChange:u,children:[n.jsx(or,{children:n.jsx(hr,{placeholder:"Select a font"})}),n.jsx(lr,{className:"max-h-80",children:Object.entries(m).map(([f,p])=>n.jsxs("div",{children:[n.jsx("div",{className:"px-2 py-1 text-xs font-medium text-muted-foreground",children:f}),p.map(A=>n.jsx(Fe,{value:A.name,children:n.jsx("span",{style:{fontFamily:A.value||"inherit"},children:A.name})},A.name))]},f))})]}),l&&n.jsx(qe,{placeholder:"Enter custom font stack...",value:i,onChange:f=>h(f.target.value),className:"text-xs"})]})]})},K3=()=>{const{selectedBrand:e}=mn(),[t,r]=g.useState(!0),[s,a]=g.useState(""),[i,o]=g.useState([]),[l,c]=g.useState("visual"),[d,u]=g.useState(!1),[h,m]=g.useState(!1),[f,p]=g.useState(!1);g.useEffect(()=>{(async()=>{if(e)try{r(!0);const{data:_,error:S}=await de.from("brands").select("brand_css").eq("id",e.id).single();if(S)throw S;_&&_.brand_css?(a(_.brand_css),o(kx(_.brand_css))):(a($p),o(kx($p)))}catch(_){console.error("Error loading brand CSS:",_),He({title:"Error",description:"Failed to load brand theme CSS",variant:"destructive"})}finally{r(!1)}})()},[e]),g.useEffect(()=>{o(kx(s))},[s]);const A=(N,_)=>{const S=det(s,N,_);a(S),o(C=>C.map(E=>E.name===N?{...E,value:_}:E))},v=async()=>{if(e){u(!0);try{const{error:N}=await de.from("brands").update({brand_css:s}).eq("id",e.id);if(N)throw N;He({title:"Theme Saved",description:"Brand theme CSS has been updated successfully",variant:"default",className:"bg-green-50 dark:bg-green-900/10 border-green-200 dark:border-green-900/50"})}catch(N){console.error("Error saving brand CSS:",N),He({title:"Error",description:"Failed to save brand theme CSS",variant:"destructive"})}finally{u(!1)}}},x=async()=>{if(e){p(!0);try{const N=`
1436        Create CSS custom properties (variables) for a brand theme.
1437        
1438        Brand Name: ${e.brand_name}
1439        
1440        ${e.brand_values?`Brand Values: ${e.brand_values}`:""}
1441        ${e.brand_voice?`Brand Voice: ${e.brand_voice}`:""}
1442        
1443        Generate CSS variables for:
1444        - Primary colors (main brand color)
1445        - Secondary colors
1446        - Accent/tertiary colors
1447        - Neutral colors (grayscale)
1448        - Typography (font families)
1449        - Spacing values
1450        - Border radius values
1451        
1452        Format it as CSS custom properties with :root {} and include comments.
1453      `;console.log("Prompt:",N),setTimeout(()=>{a($p),o(kx($p)),He({title:"CSS Generated",description:"Brand theme CSS has been generated with AI",variant:"default",className:"bg-green-50 dark:bg-green-900/10 border-green-200 dark:border-green-900/50"}),p(!1)},1500)}catch(N){console.error("Error generating CSS with AI:",N),He({title:"Generation Failed",description:N instanceof Error?N.message:"Failed to generate CSS with AI",variant:"destructive"}),p(!1)}}},b=()=>{a($p),o(kx($p)),He({title:"Reset Complete",description:"Brand theme has been reset to default template",variant:"default"})},y=i.reduce((N,_)=>{let S="Other";return _.name.includes("primary")?S="Primary Colors":_.name.includes("secondary")?S="Secondary Colors":_.name.includes("accent")?S="Accent Colors":_.name.includes("neutral")?S="Neutral Colors":_.name.includes("font")?S="Typography":_.name.includes("spacing")?S="Spacing":_.name.includes("radius")&&(S="Border Radius"),N[S]||(N[S]=[]),N[S].push(_),N},{}),w=(N,_=0)=>{const C=["primary","secondary","accent","neutral","success","error","warning"].some(B=>N.name.includes(B))&&!N.name.includes("font")&&!N.name.includes("spacing")&&!N.name.includes("radius"),E=N.name.includes("font"),T=`${N.name}-${_}`;return E?n.jsx(uet,{variable:N,idx:_,onChange:A},`${N.name}-${_}`):C&&N.value.trim().startsWith("#")?n.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[n.jsxs("div",{className:"space-y-1 flex-grow",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("div",{className:"w-5 h-5 rounded-full border",style:{backgroundColor:N.value}}),n.jsx(ze,{htmlFor:T,className:"font-medium text-sm",children:N.label})]}),N.description&&n.jsx("p",{className:"text-xs text-muted-foreground",children:N.description})]}),n.jsx(qe,{id:T,type:"color",value:N.value,onChange:B=>A(N.name,B.target.value),className:"w-14 h-8 p-1"}),n.jsx(qe,{type:"text",value:N.value,onChange:B=>A(N.name,B.target.value),className:"w-24 h-8"})]}):n.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[n.jsxs("div",{className:"space-y-1 flex-grow",children:[n.jsx(ze,{htmlFor:T,className:"font-medium text-sm",children:N.label}),N.description&&n.jsx("p",{className:"text-xs text-muted-foreground",children:N.description})]}),n.jsx(qe,{id:T,type:"text",value:N.value,onChange:B=>A(N.name,B.target.value),className:"w-48 h-8"})]})},j=()=>n.jsx("div",{className:"mt-6",children:n.jsxs(Te,{children:[n.jsxs(st,{children:[n.jsx(ot,{children:"Theme Preview"}
1453),n.jsx(Wr,{children:"Preview how your theme variables will look in the UI"})]}),n.jsxs(Re,{children:[n.jsx("style",{children:s}),n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx("h3",{className:"text-sm font-medium",children:"Primary Colors"}),n.jsxs("div",{className:"flex space-x-2",children:[n.jsx("div",{className:"w-10 h-10 rounded",style:{backgroundColor:"var(--brand-primary)"}},"primary"),n.jsx("div",{className:"w-10 h-10 rounded",style:{backgroundColor:"var(--brand-primary-dark)"}},"primary-dark"),n.jsx("div",{className:"w-10 h-10 rounded",style:{backgroundColor:"var(--brand-primary-light)"}},"primary-light")]})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("h3",{className:"text-sm font-medium",children:"Secondary Colors"}),n.jsxs("div",{className:"flex space-x-2",children:[n.jsx("div",{className:"w-10 h-10 rounded",style:{backgroundColor:"var(--brand-secondary)"}},"secondary"),n.jsx("div",{className:"w-10 h-10 rounded",style:{backgroundColor:"var(--brand-secondary-dark)"}},"secondary-dark"),n.jsx("div",{className:"w-10 h-10 rounded",style:{backgroundColor:"var(--brand-secondary-light)"}},"secondary-light")]})]})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("h3",{className:"text-sm font-medium",children:"Accent Colors"}),n.jsxs("div",{className:"flex space-x-2",children:[n.jsx("div",{className:"w-10 h-10 rounded",style:{backgroundColor:"var(--brand-accent)"}},"accent"),n.jsx("div",{className:"w-10 h-10 rounded",style:{backgroundColor:"var(--brand-accent-dark)"}},"accent-dark"),n.jsx("div",{className:"w-10 h-10 rounded",style:{backgroundColor:"var(--brand-accent-light)"}},"accent-light")]})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("h3",{className:"text-sm font-medium",children:"Neutral Colors"}),n.jsxs("div",{className:"flex space-x-2 overflow-x-auto pb-2",children:[n.jsx("div",{className:"w-10 h-10 rounded",style:{backgroundColor:"var(--brand-neutral-100)"}},"neutral-100"),n.jsx("div",{className:"w-10 h-10 rounded",style:{backgroundColor:"var(--brand-neutral-200)"}},"neutral-200"),n.jsx("div",{className:"w-10 h-10 rounded",style:{backgroundColor:"var(--brand-neutral-300)"}},"neutral-300"),n.jsx("div",{className:"w-10 h-10 rounded",style:{backgroundColor:"var(--brand-neutral-400)"}},"neutral-400"),n.jsx("div",{className:"w-10 h-10 rounded",style:{backgroundColor:"var(--brand-neutral-500)"}},"neutral-500"),n.jsx("div",{className:"w-10 h-10 rounded",style:{backgroundColor:"var(--brand-neutral-600)"}},"neutral-600"),n.jsx("div",{className:"w-10 h-10 rounded",style:{backgroundColor:"var(--brand-neutral-700)"}},"neutral-700"),n.jsx("div",{className:"w-10 h-10 rounded",style:{backgroundColor:"var(--brand-neutral-800)"}},"neutral-800"),n.jsx("div",{className:"w-10 h-10 rounded",style:{backgroundColor:"var(--brand-neutral-900)"}},"neutral-900")]})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsx("h3",{className:"text-sm font-medium",children:"UI Components with Theme"}),n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[n.jsxs("div",{children:[n.jsx("h4",{className:"text-xs font-medium mb-2",children:"Buttons"}),n.jsxs("div",{className:"flex flex-wrap gap-2",children:[n.jsx("button",{className:"px-4 py-2 rounded",style:{backgroundColor:"var(--brand-primary)",color:"white",borderRadius:"var(--brand-radius-md)"},children:"Primary Button"}),n.jsx("button",{className:"px-4 py-2 rounded",style:{backgroundColor:"var(--brand-secondary)",color:"white",borderRadius:"var(--brand-radius-md)"},children:"Secondary Button"}),n.jsx("button",{className:"px-4 py-2 rounded",style:{backgroundColor:"var(--brand-accent)",color:"white",borderRadius:"var(--brand-radius-md)"},children:"Accent Button"})]})]}),n.jsxs("div",{children:[n.jsx("h4",{className:"text-xs font-medium mb-2",children:"Cards"}),n.jsxs("div",{className:"p-4 rounded",style:{backgroundColor:"var(--brand-neutral-100)",borderRadius:"var(--brand-radius-lg)",border:"1px solid var(--brand-neutral-200)"},children:[n.jsx("div",{className:"text-sm font-medium",style:{color:"var(--brand-neutral-900)"},children:"Card Title"}),n.jsx("p",{className:"text-xs mt-1",style:{color:"var(--brand-neutral-600)"},children:"This is a card component styled with your theme variables."})]})]})]})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("h3",{className:"text-sm font-medium",children:"Typography"}),n.jsxs("div",{className:"space-y-2 p-4 rounded",style:{backgroundColor:"var(--brand-neutral-100)"},children:[n.jsx("h1",{className:"text-2xl font-bold",style:{fontFamily:"var(--brand-font-primary)"},children:"Primary Heading"}),n.jsx("h2",{className:"text-xl",style:{fontFamily:"var(--brand-font-secondary)"},children:"Secondary Heading"}),n.jsx("p",{className:"text-sm",style:{fontFamily:"var(--brand-font-primary)",color:"var(--brand-neutral-700)"},children:"This is a paragraph with primary font. The quick brown fox jumps over the lazy dog."}),n.jsx("code",{className:"text-sm p-1 rounded",style:{fontFamily:"var(--brand-font-monospace)",backgroundColor:"var(--brand-neutral-200)"},children:"Code example in monospace font"})]})]})]})]})]})});return n.jsxs("div",{className:"container mx-auto p-6 space-y-6",children:[n.jsx("div",{className:"flex justify-between items-center",children:n.jsxs(Cs,{value:l,onValueChange:c,className:"w-full",children:[n.jsxs("div",{className:"flex justify-between items-center mb-4",children:[n.jsxs(ps,{children:[n.jsxs(pt,{value:"visual",children:[n.jsx(W_,{className:"h-4 w-4 mr-2"}),"Visual Editor"]}),n.jsxs(pt,{value:"code",children:[n.jsx(ng,{className:"h-4 w-4 mr-2"}),"Code Editor"]})]}),n.jsxs("div",{className:"flex gap-2",children:[n.jsxs(te,{variant:"outline",size:"sm",onClick:()=>m(!h),children:[n.jsx(gd,{className:"h-4 w-4 mr-2"}),h?"Hide Preview":"Show Preview"]}),n.jsx(te,{variant:"outline",size:"sm",onClick:b,children:"Reset to Default"}),n.jsx(te,{variant:"outline",size:"sm",onClick:x,disabled:f,children:f?n.jsxs(n.Fragment,{children:[n.jsx(kt,{className:"h-4 w-4 mr-2 animate-spin"}),"Generating..."]}):n.jsxs(n.Fragment,{children:[n.jsx(mr,{className:"h-4 w-4 mr-2"}),"Generate with AI"]})}),n.jsx(te,{onClick:v,disabled:d,size:"sm",children:d?n.jsxs(n.Fragment,{children:[n.jsx(kt,{className:"h-4 w-4 mr-2 animate-spin"}),"Saving..."]}):n.jsxs(n.Fragment,{children:[n.jsx(ld,{className:"h-4 w-4 mr-2"}),"Save Theme"]})})]})]}),n.jsx(Ct,{value:"visual",className:"space-y-6",children:n.jsxs(Te,{children:[n.jsxs(st,{children:[n.jsx(ot,{children:"Visual Theme Editor"}),n.jsx(Wr,{children:"Customize your brand's CSS variables using this visual editor"})]}),n.jsx(Re,{children:t?n.jsx("div",{className:"flex items-center justify-center h-64",children:n.jsx(kt,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):n.jsx("div",{children:Object.entries(y).map(([N,_])=>n.jsxs("div",{className:"mb-6",children:[n.jsx("h3",{className:"text-lg font-medium mb-3",children:N}),n.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-x-8",children:_.map((S,C)=>n.jsx(oe.Fragment,{children:w(S,C)},`${S.name}-${C}`))}),n.jsx(xn,{className:"mt-4"})]},N))})}),n.jsxs(uo,{className:"justify-between flex-col sm:flex-row items-start sm:items-center gap-2",children:[n.jsx("p",{className:"text-sm text-muted-foreground",children:'Changes are applied immediately in the preview, but you must click "Save Theme" to persist them.'}),n.jsx(te,{onClick:v,disabled:d,children:d?n.jsxs(n.Fragment,{children:[n.jsx(kt,{className:"h-4 w-4 mr-2 animate-spin"}),"Saving..."]}):n.jsxs(n.Fragment,{children:[n.jsx(ld,{className:"h-4 w-4 mr-2"}),"Save Theme"]})})]})]})}),n.jsx(Ct,{value:"code",className:"space-y-6",children:n.jsxs(Te,{children:[n.jsxs(st,{children:[n.jsx(ot,{children:"CSS Code Editor"}),n.jsx(Wr,{children:"Edit the raw CSS for your brand theme"})]}),n.jsx(Re,{children:t?n.jsx("div",{className:"flex items-center justify-center h-64",children:n.jsx(kt,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):n.jsx(Zr,{value:s,onChange:N=>a(N.target.value),className:"font-mono text-sm min-h-[350px]"})}),n.jsxs(uo,{className:"justify-between flex-col sm:flex-row items-start sm:items-center gap-2",children:[n.jsx("p",{className:"text-sm text-muted-foreground",children:"Use CSS custom properties (variables) with the --brand- prefix for best results."}),n.jsx(te,{onClick:v,disabled:d,children:d?n.jsxs(n.Fragment,{children:[n.jsx(kt,{className:"h-4 w-4 mr-2 animate-spin"}),"Saving..."]}):n.jsxs(n.Fragment,{children:[n.jsx(ld,{className:"h-4 w-4 mr-2"}),"Save Theme"]})})]})]})})]})}),h&&j()]})};/*!
1454 * html2canvas 1.4.1 <https://html2canvas.hertzen.com>
1455 * Copyright (c) 2022 Niklas von Hertzen <https://hertzen.com>
1456 * Released under MIT License
1457 *//*! *****************************************************************************
1458Copyright (c) Microsoft Corporation.
1459
1460Permission to use, copy, modify, and/or distribute this software for any
1461purpose with or without fee is hereby granted.
1462
1463THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
1464REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
1465AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
1466INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
1467LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
1468OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
1469PERFORMANCE OF THIS SOFTWARE.
1470***************************************************************************** */var W3=function(e,t){return W3=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,s){r.__proto__=s}||function(r,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(r[a]=s[a])},W3(e,t)};function Tc(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");W3(e,t);function r(){this.constructor=e}
vendor: 5,734 bytes, line 1470
1470e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}var Y3=function(){return Y3=Object.assign||function(t){for(var r,s=1,a=arguments.length;s<a;s++){r=arguments[s];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t},Y3.apply(this,arguments)};function Ui(e,t,r,s){function a(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function l(u){try{d(s.next(u))}catch(h){o(h)}}function c(u){try{d(s.throw(u))}catch(h){o(h)}}function d(u){u.done?i(u.value):a(u.value).then(l,c)}d((s=s.apply(e,[])).next())})}function yi(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},s,a,i,o;return o={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function l(d){return function(u){return c([d,u])}}function c(d){if(s)throw new TypeError("Generator is already executing.");for(;r;)try{if(s=1,a&&(i=d[0]&2?a.return:d[0]?a.throw||((i=a.return)&&i.call(a),0):a.next)&&!(i=i.call(a,d[1])).done)return i;switch(a=0,i&&(d=[d[0]&2,i.value]),d[0]){case 0:case 1:i=d;break;case 4:return r.label++,{value:d[1],done:!1};case 5:r.label++,a=d[1],d=[0];continue;case 7:d=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(d[0]===6||d[0]===2)){r=0;continue}if(d[0]===3&&(!i||d[1]>i[0]&&d[1]<i[3])){r.label=d[1];break}if(d[0]===6&&r.label<i[1]){r.label=i[1],i=d;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(d);break}i[2]&&r.ops.pop(),r.trys.pop();continue}d=t.call(e,r)}catch(u){d=[6,u],a=0}finally{s=i=0}if(d[0]&5)throw d[1];return{value:d[0]?d[1]:void 0,done:!0}}}function j1(e,t,r){if(arguments.length===2)for(var s=0,a=t.length,i;s<a;s++)(i||!(s in t))&&(i||(i=Array.prototype.slice.call(t,0,s)),i[s]=t[s]);return e.concat(i||t)}var Iu=function(){function e(t,r,s,a){this.left=t,this.top=r,this.width=s,this.height=a}return e.prototype.add=function(t,r,s,a){return new e(this.left+t,this.top+r,this.width+s,this.height+a)},e.fromClientRect=function(t,r){return new e(r.left+t.windowBounds.left,r.top+t.windowBounds.top,r.width,r.height)},e.fromDOMRectList=function(t,r){var s=Array.from(r).find(function(a){return a.width!==0});return s?new e(s.left+t.windowBounds.left,s.top+t.windowBounds.top,s.width,s.height):e.EMPTY},e.EMPTY=new e(0,0,0,0),e}(),HS=function(e,t){return Iu.fromClientRect(e,t.getBoundingClientRect())},het=function(e){var t=e.body,r=e.documentElement;if(!t||!r)throw new Error("Unable to get document size");var s=Math.max(Math.max(t.scrollWidth,r.scrollWidth),Math.max(t.offsetWidth,r.offsetWidth),Math.max(t.clientWidth,r.clientWidth)),a=Math.max(Math.max(t.scrollHeight,r.scrollHeight),Math.max(t.offsetHeight,r.offsetHeight),Math.max(t.clientHeight,r.clientHeight));return new Iu(0,0,s,a)},zS=function(e){for(var t=[],r=0,s=e.length;r<s;){var a=e.charCodeAt(r++);if(a>=55296&&a<=56319&&r<s){var i=e.charCodeAt(r++);(i&64512)===56320?t.push(((a&1023)<<10)+(i&1023)+65536):(t.push(a),r--)}else t.push(a)}return t},Zs=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(String.fromCodePoint)return String.fromCodePoint.apply(String,e);var r=e.length;if(!r)return"";for(var s=[],a=-1,i="";++a<r;){var o=e[a];o<=65535?s.push(o):(o-=65536,s.push((o>>10)+55296,o%1024+56320)),(a+1===r||s.length>16384)&&(i+=String.fromCharCode.apply(String,s),s.length=0)}return i},dH="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",fet=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var N1=0;N1<dH.length;N1++)fet[dH.charCodeAt(N1)]=N1;var uH="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ev=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var _1=0;_1<uH.length;_1++)ev[uH.charCodeAt(_1)]=_1;var met=function(e){var t=e.length*.75,r=e.length,s,a=0,i,o,l,c;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);var d=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(t):new Array(t),u=Array.isArray(d)?d:new Uint8Array(d);for(s=0;s<r;s+=4)i=ev[e.charCodeAt(s)],o=ev[e.charCodeAt(s+1)],l=ev[e.charCodeAt(s+2)],c=ev[e.charCodeAt(s+3)],u[a++]=i<<2|o>>4,u[a++]=(o&15)<<4|l>>2,u[a++]=(l&3)<<6|c&63;return d},pet=function(e){for(var t=e.length,r=[],s=0;s<t;s+=2)r.push(e[s+1]<<8|e[s]);return r},Aet=function(e){for(var t=e.length,r=[],s=0;s<t;s+=4)r.push(e[s+3]<<24|e[s+2]<<16|e[s+1]<<8|e[s]);return r},_m=5,h6=11,bE=2,get=h6-_m,une=65536>>_m,xet=1<<_m,yE=xet-1,vet=1024>>_m,bet=une+vet,yet=bet,wet=32,jet=yet+wet,Net=65536>>h6,_et=1<<get,Cet=_et-1,hH=function(e,t,r){return e.slice?e.slice(t,r):new Uint16Array(Array.prototype.slice.call(e,t,r))},ket=function(e,t,r){return e.slice?e.slice(t,r):new Uint32Array(Array.prototype.slice.call(e,t,r))},Eet=function(e,t){var r=met(e),s=Array.isArray(r)?Aet(r):new Uint32Array(r),a=Array.isArray(r)?pet(r):new Uint16Array(r),i=24,o=hH(a,i/2,s[4]/2),l=s[5]===2?hH(a,(i+s[4])/2):ket(s,Math.ceil((i+s[4])/4));return new Bet(s[0],s[1],s[2],s[3],o,l)},Bet=function(){function e(t,r,s,a,i,o){this.initialValue=t,this.errorValue=r,this.highStart=s,this.highValueIndex=a,this.index=i,this.data=o}return e.prototype.get=function(t){var r;if(t>=0){if(t<55296||t>56319&&t<=65535)return r=this.index[t>>_m],r=(r<<bE)+(t&yE),this.data[r];if(t<=65535)return r=this.index[une+(t-55296>>_m)],r=(r<<bE)+(t&yE),this.data[r];if(t<this.highStart)return r=jet-Net+(t>>h6),r=this.index[r],r+=t>>_m&Cet,r=this.index[r],r=(r<<bE)+(t&yE),this.data[r];if(t<=1114111)return this.data[this.highValueIndex]}return this.errorValue},e}(),fH="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Tet=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var C1=0;C1<fH.length;C1++)Tet[fH.charCodeAt(C1)]=C1;var Pet=
vendor: 52,891 bytes, line 1470
1470"KwAAAAAAAAAACA4AUD0AADAgAAACAAAAAAAIABAAGABAAEgAUABYAGAAaABgAGgAYgBqAF8AZwBgAGgAcQB5AHUAfQCFAI0AlQCdAKIAqgCyALoAYABoAGAAaABgAGgAwgDKAGAAaADGAM4A0wDbAOEA6QDxAPkAAQEJAQ8BFwF1AH0AHAEkASwBNAE6AUIBQQFJAVEBWQFhAWgBcAF4ATAAgAGGAY4BlQGXAZ8BpwGvAbUBvQHFAc0B0wHbAeMB6wHxAfkBAQIJAvEBEQIZAiECKQIxAjgCQAJGAk4CVgJeAmQCbAJ0AnwCgQKJApECmQKgAqgCsAK4ArwCxAIwAMwC0wLbAjAA4wLrAvMC+AIAAwcDDwMwABcDHQMlAy0DNQN1AD0DQQNJA0kDSQNRA1EDVwNZA1kDdQB1AGEDdQBpA20DdQN1AHsDdQCBA4kDkQN1AHUAmQOhA3UAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AKYDrgN1AHUAtgO+A8YDzgPWAxcD3gPjA+sD8wN1AHUA+wMDBAkEdQANBBUEHQQlBCoEFwMyBDgEYABABBcDSARQBFgEYARoBDAAcAQzAXgEgASIBJAEdQCXBHUAnwSnBK4EtgS6BMIEyAR1AHUAdQB1AHUAdQCVANAEYABgAGAAYABgAGAAYABgANgEYADcBOQEYADsBPQE/AQEBQwFFAUcBSQFLAU0BWQEPAVEBUsFUwVbBWAAYgVgAGoFcgV6BYIFigWRBWAAmQWfBaYFYABgAGAAYABgAKoFYACxBbAFuQW6BcEFwQXHBcEFwQXPBdMF2wXjBeoF8gX6BQIGCgYSBhoGIgYqBjIGOgZgAD4GRgZMBmAAUwZaBmAAYABgAGAAYABgAGAAYABgAGAAYABgAGIGYABpBnAGYABgAGAAYABgAGAAYABgAGAAYAB4Bn8GhQZgAGAAYAB1AHcDFQSLBmAAYABgAJMGdQA9A3UAmwajBqsGqwaVALMGuwbDBjAAywbSBtIG1QbSBtIG0gbSBtIG0gbdBuMG6wbzBvsGAwcLBxMHAwcbByMHJwcsBywHMQcsB9IGOAdAB0gHTgfSBkgHVgfSBtIG0gbSBtIG0gbSBtIG0gbSBiwHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAdgAGAALAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAdbB2MHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsB2kH0gZwB64EdQB1AHUAdQB1AHUAdQB1AHUHfQdgAIUHjQd1AHUAlQedB2AAYAClB6sHYACzB7YHvgfGB3UAzgfWBzMB3gfmB1EB7gf1B/0HlQENAQUIDQh1ABUIHQglCBcDLQg1CD0IRQhNCEEDUwh1AHUAdQBbCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIcAh3CHoIMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIgggwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAALAcsBywHLAcsBywHLAcsBywHLAcsB4oILAcsB44I0gaWCJ4Ipgh1AHUAqgiyCHUAdQB1AHUAdQB1AHUAdQB1AHUAtwh8AXUAvwh1AMUIyQjRCNkI4AjoCHUAdQB1AO4I9gj+CAYJDgkTCS0HGwkjCYIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiAAIAAAAFAAYABgAGIAXwBgAHEAdQBFAJUAogCyAKAAYABgAEIA4ABGANMA4QDxAMEBDwE1AFwBLAE6AQEBUQF4QkhCmEKoQrhCgAHIQsAB0MLAAcABwAHAAeDC6ABoAHDCwMMAAcABwAHAAdDDGMMAAcAB6MM4wwjDWMNow3jDaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAEjDqABWw6bDqABpg6gAaABoAHcDvwOPA+gAaABfA/8DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DpcPAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcAB9cPKwkyCToJMAB1AHUAdQBCCUoJTQl1AFUJXAljCWcJawkwADAAMAAwAHMJdQB2CX4JdQCECYoJjgmWCXUAngkwAGAAYABxAHUApgn3A64JtAl1ALkJdQDACTAAMAAwADAAdQB1AHUAdQB1AHUAdQB1AHUAowYNBMUIMAAwADAAMADICcsJ0wnZCRUE4QkwAOkJ8An4CTAAMAB1AAAKvwh1AAgKDwoXCh8KdQAwACcKLgp1ADYKqAmICT4KRgowADAAdQB1AE4KMAB1AFYKdQBeCnUAZQowADAAMAAwADAAMAAwADAAMAAVBHUAbQowADAAdQC5CXUKMAAwAHwBxAijBogEMgF9CoQKiASMCpQKmgqIBKIKqgquCogEDQG2Cr4KxgrLCjAAMADTCtsKCgHjCusK8Qr5CgELMAAwADAAMAB1AIsECQsRC3UANAEZCzAAMAAwADAAMAB1ACELKQswAHUANAExCzkLdQBBC0kLMABRC1kLMAAwADAAMAAwADAAdQBhCzAAMAAwAGAAYABpC3ELdwt/CzAAMACHC4sLkwubC58Lpwt1AK4Ltgt1APsDMAAwADAAMAAwADAAMAAwAL4LwwvLC9IL1wvdCzAAMADlC+kL8Qv5C/8LSQswADAAMAAwADAAMAAwADAAMAAHDDAAMAAwADAAMAAODBYMHgx1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1ACYMMAAwADAAdQB1AHUALgx1AHUAdQB1AHUAdQA2DDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AD4MdQBGDHUAdQB1AHUAdQB1AEkMdQB1AHUAdQB1AFAMMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQBYDHUAdQB1AF8MMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUA+wMVBGcMMAAwAHwBbwx1AHcMfwyHDI8MMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAYABgAJcMMAAwADAAdQB1AJ8MlQClDDAAMACtDCwHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsB7UMLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AA0EMAC9DDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAsBywHLAcsBywHLAcsBywHLQcwAMEMyAwsBywHLAcsBywHLAcsBywHLAcsBywHzAwwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1ANQM2QzhDDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMABgAGAAYABgAGAAYABgAOkMYADxDGAA+AwADQYNYABhCWAAYAAODTAAMAAwADAAFg1gAGAAHg37AzAAMAAwADAAYABgACYNYAAsDTQNPA1gAEMNPg1LDWAAYABgAGAAYABgAGAAYABgAGAAUg1aDYsGVglhDV0NcQBnDW0NdQ15DWAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAlQCBDZUAiA2PDZcNMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAnw2nDTAAMAAwADAAMAAwAHUArw23DTAAMAAwADAAMAAwADAAMAAwADAAMAB1AL8NMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAB1AHUAdQB1AHUAdQDHDTAAYABgAM8NMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAA1w11ANwNMAAwAD0B5A0wADAAMAAwADAAMADsDfQN/A0EDgwOFA4wABsOMAAwADAAMAAwADAAMAAwANIG0gbSBtIG0gbSBtIG0gYjDigOwQUuDsEFMw7SBjoO0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGQg5KDlIOVg7SBtIGXg5lDm0OdQ7SBtIGfQ6EDooOjQ6UDtIGmg6hDtIG0gaoDqwO0ga0DrwO0gZgAGAAYADEDmAAYAAkBtIGzA5gANIOYADaDokO0gbSBt8O5w7SBu8O0gb1DvwO0gZgAGAAxA7SBtIG0gbSBtIGYABgAGAAYAAED2AAsAUMD9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGFA8sBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAccD9IGLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHJA8sBywHLAcsBywHLAccDywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywPLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAc0D9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAccD9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGFA8sBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHPA/SBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gYUD0QPlQCVAJUAMAAwADAAMACVAJUAlQCVAJUAlQCVAEwPMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAA//8EAAQABAAEAAQABAAEAAQABAANAAMAAQABAAIABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQACgATABcAHgAbABoAHgAXABYAEgAeABsAGAAPABgAHABLAEsASwBLAEsASwBLAEsASwBLABgAGAAeAB4AHgATAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABYAGwASAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAWAA0AEQAeAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAFAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAJABYAGgAbABsAGwAeAB0AHQAeAE8AFwAeAA0AHgAeABoAGwBPAE8ADgBQAB0AHQAdAE8ATwAXAE8ATwBPABYAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAFAATwBAAE8ATwBPAEAATwBQAFAATwBQAB4AHgAeAB4AHgAeAB0AHQAdAB0AHgAdAB4ADgBQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgBQAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAJAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAkACQAJAAkACQAJAAkABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAFAAHgAeAB4AKwArAFAAUABQAFAAGABQACsAKwArACsAHgAeAFAAHgBQAFAAUAArAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUAAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAYAA0AKwArAB4AHgAbACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQADQAEAB4ABAAEAB4ABAAEABMABAArACsAKwArACsAKwArACsAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAKwArACsAKwBWAFYAVgBWAB4AHgArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AGgAaABoAGAAYAB4AHgAEAAQABAAEAAQABAAEAAQABAAEAAQAEwAEACsAEwATAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABLAEsASwBLAEsASwBLAEsASwBLABoAGQAZAB4AUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABMAUAAEAAQABAAEAAQABAAEAB4AHgAEAAQABAAEAAQABABQAFAABAAEAB4ABAAEAAQABABQAFAASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUAAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAFAABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQAUABQAB4AHgAYABMAUAArACsABAAbABsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAFAABAAEAAQABAAEAFAABAAEAAQAUAAEAAQABAAEAAQAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAArACsAHgArAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAUAAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAABAAEAA0ADQBLAEsASwBLAEsASwBLAEsASwBLAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUAArACsAKwBQAFAAUABQACsAKwAEAFAABAAEAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABABQACsAKwArACsAKwArACsAKwAEACsAKwArACsAUABQACsAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUAAaABoAUABQAFAAUABQAEwAHgAbAFAAHgAEACsAKwAEAAQABAArAFAAUABQAFAAUABQACsAKwArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQACsAUABQACsAKwAEACsABAAEAAQABAAEACsAKwArACsABAAEACsAKwAEAAQABAArACsAKwAEACsAKwArACsAKwArACsAUABQAFAAUAArAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLAAQABABQAFAAUAAEAB4AKwArACsAKwArACsAKwArACsAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQACsAKwAEAFAABAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAArACsAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAB4AGwArACsAKwArACsAKwArAFAABAAEAAQABAAEAAQAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABAArACsAKwArACsAKwArAAQABAAEACsAKwArACsAUABQACsAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAB4AUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAAQAUAArAFAAUABQAFAAUABQACsAKwArAFAAUABQACsAUABQAFAAUAArACsAKwBQAFAAKwBQACsAUABQACsAKwArAFAAUAArACsAKwBQAFAAUAArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArAAQABAAEAAQABAArACsAKwAEAAQABAArAAQABAAEAAQAKwArAFAAKwArACsAKwArACsABAArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAHgAeAB4AHgAeAB4AGwAeACsAKwArACsAKwAEAAQABAAEAAQAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAUAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAAEACsAKwArACsAKwArACsABAAEACsAUABQAFAAKwArACsAKwArAFAAUAAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKwAOAFAAUABQAFAAUABQAFAAHgBQAAQABAAEAA4AUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAKwArAAQAUAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAAEACsAKwArACsAKwArACsABAAEACsAKwArACsAKwArACsAUAArAFAAUAAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwBQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAFAABAAEAAQABAAEAAQABAArAAQABAAEACsABAAEAAQABABQAB4AKwArACsAKwBQAFAAUAAEAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQABoAUABQAFAAUABQAFAAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQACsAUAArACsAUABQAFAAUABQAFAAUAArACsAKwAEACsAKwArACsABAAEAAQABAAEAAQAKwAEACsABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArAAQABAAeACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAXAAqACoAKgAqACoAKgAqACsAKwArACsAGwBcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAeAEsASwBLAEsASwBLAEsASwBLAEsADQANACsAKwArACsAKwBcAFwAKwBcACsAXABcAFwAXABcACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAXAArAFwAXABcAFwAXABcAFwAXABcAFwAKgBcAFwAKgAqACoAKgAqACoAKgAqACoAXAArACsAXABcAFwAXABcACsAXAArACoAKgAqACoAKgAqACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwBcAFwAXABcAFAADgAOAA4ADgAeAA4ADgAJAA4ADgANAAkAEwATABMAEwATAAkAHgATAB4AHgAeAAQABAAeAB4AHgAeAB4AHgBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQAFAADQAEAB4ABAAeAAQAFgARABYAEQAEAAQAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQADQAEAAQABAAEAAQADQAEAAQAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAA0ADQAeAB4AHgAeAB4AHgAEAB4AHgAeAB4AHgAeACsAHgAeAA4ADgANAA4AHgAeAB4AHgAeAAkACQArACsAKwArACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgBcAEsASwBLAEsASwBLAEsASwBLAEsADQANAB4AHgAeAB4AXABcAFwAXABcAFwAKgAqACoAKgBcAFwAXABcACoAKgAqAFwAKgAqACoAXABcACoAKgAqACoAKgAqACoAXABcAFwAKgAqACoAKgBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKgAqAFwAKgBLAEsASwBLAEsASwBLAEsASwBLACoAKgAqACoAKgAqAFAAUABQAFAAUABQACsAUAArACsAKwArACsAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgBQAFAAUABQAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAKwBQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsABAAEAAQAHgANAB4AHgAeAB4AHgAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUAArACsADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAWABEAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAA0ADQANAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAANAA0AKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUAArAAQABAArACsAKwArACsAKwArACsAKwArACsAKwBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqAA0ADQAVAFwADQAeAA0AGwBcACoAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwAeAB4AEwATAA0ADQAOAB4AEwATAB4ABAAEAAQACQArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUAAEAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAHgArACsAKwATABMASwBLAEsASwBLAEsASwBLAEsASwBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAArACsAXABcAFwAXABcACsAKwArACsAKwArACsAKwArACsAKwBcAFwAXABcAFwAXABcAFwAXABcAFwAXAArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAXAArACsAKwAqACoAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAArACsAHgAeAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKwAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKwArAAQASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArACoAKgAqACoAKgAqACoAXAAqACoAKgAqACoAKgArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABABQAFAAUABQAFAAUABQACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwANAA0AHgANAA0ADQANAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQAHgAeAB4AHgAeAB4AHgAeAB4AKwArACsABAAEAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwAeAB4AHgAeAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArAA0ADQANAA0ADQBLAEsASwBLAEsASwBLAEsASwBLACsAKwArAFAAUABQAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAA0ADQBQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUAAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArAAQABAAEAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAAQAUABQAFAAUABQAFAABABQAFAABAAEAAQAUAArACsAKwArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAKwBQACsAUAArAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAFAAUABQACsAHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQACsAKwAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQACsAHgAeAB4AHgAeAB4AHgAOAB4AKwANAA0ADQANAA0ADQANAAkADQANAA0ACAAEAAsABAAEAA0ACQANAA0ADAAdAB0AHgAXABcAFgAXABcAFwAWABcAHQAdAB4AHgAUABQAFAANAAEAAQAEAAQABAAEAAQACQAaABoAGgAaABoAGgAaABoAHgAXABcAHQAVABUAHgAeAB4AHgAeAB4AGAAWABEAFQAVABUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ADQAeAA0ADQANAA0AHgANAA0ADQAHAB4AHgAeAB4AKwAEAAQABAAEAAQABAAEAAQABAAEAFAAUAArACsATwBQAFAAUABQAFAAHgAeAB4AFgARAE8AUABPAE8ATwBPAFAAUABQAFAAUAAeAB4AHgAWABEAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArABsAGwAbABsAGwAbABsAGgAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGgAbABsAGwAbABoAGwAbABoAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAHgAeAFAAGgAeAB0AHgBQAB4AGgAeAB4AHgAeAB4AHgAeAB4AHgBPAB4AUAAbAB4AHgBQAFAAUABQAFAAHgAeAB4AHQAdAB4AUAAeAFAAHgBQAB4AUABPAFAAUAAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAHgBQAFAAUABQAE8ATwBQAFAAUABQAFAATwBQAFAATwBQAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAFAAUABQAFAATwBPAE8ATwBPAE8ATwBPAE8ATwBQAFAAUABQAFAAUABQAFAAUAAeAB4AUABQAFAAUABPAB4AHgArACsAKwArAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHQAdAB4AHgAeAB0AHQAeAB4AHQAeAB4AHgAdAB4AHQAbABsAHgAdAB4AHgAeAB4AHQAeAB4AHQAdAB0AHQAeAB4AHQAeAB0AHgAdAB0AHQAdAB0AHQAeAB0AHgAeAB4AHgAeAB0AHQAdAB0AHgAeAB4AHgAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHgAeAB0AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAeAB0AHQAdAB0AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAeAB4AHgAdAB4AHgAeAB4AHgAeAB4AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAWABEAHgAeAB4AHgAeAB4AHQAeAB4AHgAeAB4AHgAeACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAWABEAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAFAAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAeAB4AHQAdAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHQAdAB4AHgAeAB4AHQAdAB0AHgAeAB0AHgAeAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlAB4AHQAdAB4AHgAdAB4AHgAeAB4AHQAdAB4AHgAeAB4AJQAlAB0AHQAlAB4AJQAlACUAIAAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAeAB4AHgAeAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAdAB0AHQAeAB0AJQAdAB0AHgAdAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAdAB0AHQAdACUAHgAlACUAJQAdACUAJQAdAB0AHQAlACUAHQAdACUAHQAdACUAJQAlAB4AHQAeAB4AHgAeAB0AHQAlAB0AHQAdAB0AHQAdACUAJQAlACUAJQAdACUAJQAgACUAHQAdACUAJQAlACUAJQAlACUAJQAeAB4AHgAlACUAIAAgACAAIAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AFwAXABcAFwAXABcAHgATABMAJQAeAB4AHgAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAFgARABYAEQAWABEAFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAEAAQABAAeAB4AKwArACsAKwArABMADQANAA0AUAATAA0AUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUAANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAA0ADQANAA0ADQANAA0ADQAeAA0AFgANAB4AHgAXABcAHgAeABcAFwAWABEAFgARABYAEQAWABEADQANAA0ADQATAFAADQANAB4ADQANAB4AHgAeAB4AHgAMAAwADQANAA0AHgANAA0AFgANAA0ADQANAA0ADQANAA0AHgANAB4ADQANAB4AHgAeACsAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArAA0AEQARACUAJQBHAFcAVwAWABEAFgARABYAEQAWABEAFgARACUAJQAWABEAFgARABYAEQAWABEAFQAWABEAEQAlAFcAVwBXAFcAVwBXAFcAVwBXAAQABAAEAAQABAAEACUAVwBXAFcAVwA2ACUAJQBXAFcAVwBHAEcAJQAlACUAKwBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBRAFcAUQBXAFEAVwBXAFcAVwBXAFcAUQBXAFcAVwBXAFcAVwBRAFEAKwArAAQABAAVABUARwBHAFcAFQBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBRAFcAVwBXAFcAVwBXAFEAUQBXAFcAVwBXABUAUQBHAEcAVwArACsAKwArACsAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwAlACUAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACsAKwArACsAKwArACsAKwArACsAKwArAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBPAE8ATwBPAE8ATwBPAE8AJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADQATAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABLAEsASwBLAEsASwBLAEsASwBLAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAABAAEAAQABAAeAAQABAAEAAQABAAEAAQABAAEAAQAHgBQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUABQAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAeAA0ADQANAA0ADQArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAB4AHgAeAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAAQAUABQAFAABABQAFAAUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAeAB4AHgAeAAQAKwArACsAUABQAFAAUABQAFAAHgAeABoAHgArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADgAOABMAEwArACsAKwArACsAKwArACsABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwANAA0ASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUAAeAB4AHgBQAA4AUABQAAQAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAA0ADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArAB4AWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYACsAKwArAAQAHgAeAB4AHgAeAB4ADQANAA0AHgAeAB4AHgArAFAASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArAB4AHgBcAFwAXABcAFwAKgBcAFwAXABcAFwAXABcAFwAXABcAEsASwBLAEsASwBLAEsASwBLAEsAXABcAFwAXABcACsAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArAFAAUABQAAQAUABQAFAAUABQAFAAUABQAAQABAArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAHgANAA0ADQBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAXAAqACoAKgBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAKgAqACoAXABcACoAKgBcAFwAXABcAFwAKgAqAFwAKgBcACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcACoAKgBQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAA0ADQBQAFAAUAAEAAQAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQADQAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAVABVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBUAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVACsAKwArACsAKwArACsAKwArACsAKwArAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAKwArACsAKwBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAKwArACsAKwAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAKwArACsAKwArAFYABABWAFYAVgBWAFYAVgBWAFYAVgBWAB4AVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgArAFYAVgBWAFYAVgArAFYAKwBWAFYAKwBWAFYAKwBWAFYAVgBWAFYAVgBWAFYAVgBWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAEQAWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAaAB4AKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAGAARABEAGAAYABMAEwAWABEAFAArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACUAJQAlACUAJQAWABEAFgARABYAEQAWABEAFgARABYAEQAlACUAFgARACUAJQAlACUAJQAlACUAEQAlABEAKwAVABUAEwATACUAFgARABYAEQAWABEAJQAlACUAJQAlACUAJQAlACsAJQAbABoAJQArACsAKwArAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAcAKwATACUAJQAbABoAJQAlABYAEQAlACUAEQAlABEAJQBXAFcAVwBXAFcAVwBXAFcAVwBXABUAFQAlACUAJQATACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXABYAJQARACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAWACUAEQAlABYAEQARABYAEQARABUAVwBRAFEAUQBRAFEAUQBRAFEAUQBRAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcARwArACsAVwBXAFcAVwBXAFcAKwArAFcAVwBXAFcAVwBXACsAKwBXAFcAVwBXAFcAVwArACsAVwBXAFcAKwArACsAGgAbACUAJQAlABsAGwArAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwAEAAQABAAQAB0AKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsADQANAA0AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAAQAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAA0AUABQAFAAUAArACsAKwArAFAAUABQAFAAUABQAFAAUAANAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAKwArAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUAArACsAKwBQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAUABQAFAAUABQAAQABAAEACsABAAEACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAKwBQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEACsAKwArACsABABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAA0ADQANAA0ADQANAA0ADQAeACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAArACsAKwArAFAAUABQAFAAUAANAA0ADQANAA0ADQAUACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsADQANAA0ADQANAA0ADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAAQABAAEAAQAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArAAQABAANACsAKwBQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAB4AHgAeAB4AHgArACsAKwArACsAKwAEAAQABAAEAAQABAAEAA0ADQAeAB4AHgAeAB4AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwAeACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsASwBLAEsASwBLAEsASwBLAEsASwANAA0ADQANAFAABAAEAFAAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAeAA4AUAArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAADQANAB4ADQAEAAQABAAEAB4ABAAEAEsASwBLAEsASwBLAEsASwBLAEsAUAAOAFAADQANAA0AKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAANAA0AHgANAA0AHgAEACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAA0AKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsABAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQACsABAAEAFAABAAEAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABAArACsAUAArACsAKwArACsAKwAEACsAKwArACsAKwBQAFAAUABQAFAABAAEACsAKwAEAAQABAAEAAQABAAEACsAKwArAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAAQABABQAFAAUABQAA0ADQANAA0AHgBLAEsASwBLAEsASwBLAEsASwBLAA0ADQArAB4ABABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAFAAUAAeAFAAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAArACsABAAEAAQABAAEAAQABAAEAAQADgANAA0AEwATAB4AHgAeAA0ADQANAA0ADQANAA0ADQANAA0ADQANAA0ADQANAFAAUABQAFAABAAEACsAKwAEAA0ADQAeAFAAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKwArACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBcAFwADQANAA0AKgBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAKwArAFAAKwArAFAAUABQAFAAUABQAFAAUAArAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQAKwAEAAQAKwArAAQABAAEAAQAUAAEAFAABAAEAA0ADQANACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAArACsABAAEAAQABAAEAAQABABQAA4AUAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAFAABAAEAAQABAAOAB4ADQANAA0ADQAOAB4ABAArACsAKwArACsAKwArACsAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAA0ADQANAFAADgAOAA4ADQANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAAQABAAEAFAADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwAOABMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAArACsAKwAEACsABAAEACsABAAEAAQABAAEAAQABABQAAQAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAKwBQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQAKwAEAAQAKwAEAAQABAAEAAQAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAaABoAGgAaAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABIAEgAQwBDAEMAUABQAFAAUABDAFAAUABQAEgAQwBIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABDAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwAJAAkACQAJAAkACQAJABYAEQArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwANAA0AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAANACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAA0ADQANAB4AHgAeAB4AHgAeAFAAUABQAFAADQAeACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAANAA0AHgAeACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwAEAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAARwBHABUARwAJACsAKwArACsAKwArACsAKwArACsAKwAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACsAKwArACsAKwArACsAKwBXAFcAVwBXAFcAVwBXAFcAVwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUQBRAFEAKwArACsAKwArACsAKwArACsAKwArACsAKwBRAFEAUQBRACsAKwArACsAKwArACsAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArACsAHgAEAAQADQAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAAQABAAEAAQABAAeAB4AHgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4AHgAEAAQABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQAHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwBQAFAAKwArAFAAKwArAFAAUAArACsAUABQAFAAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAUAArAFAAUABQAFAAUABQAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAHgAeAFAAUABQAFAAUAArAFAAKwArACsAUABQAFAAUABQAFAAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeACsAKwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4ABAAeAB4AHgAeAB4AHgAeAB4AHgAeAAQAHgAeAA0ADQANAA0AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAAQAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArAAQABAAEAAQABAAEAAQAKwAEAAQAKwAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwBQAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArABsAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArAB4AHgAeAB4ABAAEAAQABAAEAAQABABQACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArABYAFgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAGgBQAFAAUAAaAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAKwBQACsAKwBQACsAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwBQACsAUAArACsAKwArACsAKwBQACsAKwArACsAUAArAFAAKwBQACsAUABQAFAAKwBQAFAAKwBQACsAKwBQACsAUAArAFAAKwBQACsAUAArAFAAUAArAFAAKwArAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUAArAFAAUABQAFAAKwBQACsAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAKwBQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8AJQAlACUAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB4AHgAeACUAJQAlAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAlACUAJQAlACUAHgAlACUAJQAlACUAIAAgACAAJQAlACAAJQAlACAAIAAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACEAIQAhACEAIQAlACUAIAAgACUAJQAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAIAAlACUAJQAlACAAIAAgACUAIAAgACAAJQAlACUAJQAlACUAJQAgACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAlAB4AJQAeACUAJQAlACUAJQAgACUAJQAlACUAHgAlAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACAAIAAgACUAJQAlACAAIAAgACAAIAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABcAFwAXABUAFQAVAB4AHgAeAB4AJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAgACUAJQAgACUAJQAlACUAJQAlACUAJQAgACAAIAAgACAAIAAgACAAJQAlACUAJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAgACAAIAAgACAAIAAgACAAIAAgACUAJQAgACAAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAlACAAIAAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAgACAAIAAlACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACUAVwBXACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAA==",
vendor: 3,591 bytes, line 1470
1470mH=50,Iet=1,hne=2,fne=3,Oet=4,Fet=5,pH=7,mne=8,AH=9,kh=10,J3=11,gH=12,X3=13,Let=14,tv=15,Z3=16,S1=17,Ex=18,Det=19,xH=20,eP=21,Bx=22,wE=23,Qp=24,Oo=25,rv=26,nv=27,Hp=28,Ret=29,rm=30,Uet=31,k1=32,E1=33,tP=34,rP=35,nP=36,ly=37,sP=38,Oj=39,Fj=40,jE=41,pne=42,Met=43,$et=[9001,65288],Ane="!",Jr="×",B1="÷",aP=Eet(Pet),Wd=[rm,nP],iP=[Iet,hne,fne,Fet],gne=[kh,mne],vH=[nv,rv],Qet=iP.concat(gne),bH=[sP,Oj,Fj,tP,rP],Het=[tv,X3],zet=function(e,t){t===void 0&&(t="strict");var r=[],s=[],a=[];return e.forEach(function(i,o){var l=aP.get(i);if(l>mH?(a.push(!0),l-=mH):a.push(!1),["normal","auto","loose"].indexOf(t)!==-1&&[8208,8211,12316,12448].indexOf(i)!==-1)return s.push(o),r.push(Z3);if(l===Oet||l===J3){if(o===0)return s.push(o),r.push(rm);var c=r[o-1];return Qet.indexOf(c)===-1?(s.push(s[o-1]),r.push(c)):(s.push(o),r.push(rm))}if(s.push(o),l===Uet)return r.push(t==="strict"?eP:ly);if(l===pne||l===Ret)return r.push(rm);if(l===Met)return i>=131072&&i<=196605||i>=196608&&i<=262141?r.push(ly):r.push(rm);r.push(l)}),[s,r,a]},NE=function(e,t,r,s){var a=s[r];if(Array.isArray(e)?e.indexOf(a)!==-1:e===a)for(var i=r;i<=s.length;){i++;var o=s[i];if(o===t)return!0;if(o!==kh)break}if(a===kh)for(var i=r;i>0;){i--;var l=s[i];if(Array.isArray(e)?e.indexOf(l)!==-1:e===l)for(var c=r;c<=s.length;){c++;var o=s[c];if(o===t)return!0;if(o!==kh)break}if(l!==kh)break}return!1},yH=function(e,t){for(var r=e;r>=0;){var s=t[r];if(s===kh)r--;else return s}return 0},Vet=function(e,t,r,s,a){if(r[s]===0)return Jr;var i=s-1;if(Array.isArray(a)&&a[i]===!0)return Jr;var o=i-1,l=i+1,c=t[i],d=o>=0?t[o]:0,u=t[l];if(c===hne&&u===fne)return Jr;if(iP.indexOf(c)!==-1)return Ane;if(iP.indexOf(u)!==-1||gne.indexOf(u)!==-1)return Jr;if(yH(i,t)===mne)return B1;if(aP.get(e[i])===J3||(c===k1||c===E1)&&aP.get(e[l])===J3||c===pH||u===pH||c===AH||[kh,X3,tv].indexOf(c)===-1&&u===AH||[S1,Ex,Det,Qp,Hp].indexOf(u)!==-1||yH(i,t)===Bx||NE(wE,Bx,i,t)||NE([S1,Ex],eP,i,t)||NE(gH,gH,i,t))return Jr;if(c===kh)return B1;if(c===wE||u===wE)return Jr;if(u===Z3||c===Z3)return B1;if([X3,tv,eP].indexOf(u)!==-1||c===Let||d===nP&&Het.indexOf(c)!==-1||c===Hp&&u===nP||u===xH||Wd.indexOf(u)!==-1&&c===Oo||Wd.indexOf(c)!==-1&&u===Oo||c===nv&&[ly,k1,E1].indexOf(u)!==-1||[ly,k1,E1].indexOf(c)!==-1&&u===rv||Wd.indexOf(c)!==-1&&vH.indexOf(u)!==-1||vH.indexOf(c)!==-1&&Wd.indexOf(u)!==-1||[nv,rv].indexOf(c)!==-1&&(u===Oo||[Bx,tv].indexOf(u)!==-1&&t[l+1]===Oo)||[Bx,tv].indexOf(c)!==-1&&u===Oo||c===Oo&&[Oo,Hp,Qp].indexOf(u)!==-1)return Jr;if([Oo,Hp,Qp,S1,Ex].indexOf(u)!==-1)for(var h=i;h>=0;){var m=t[h];if(m===Oo)return Jr;if([Hp,Qp].indexOf(m)!==-1)h--;else break}if([nv,rv].indexOf(u)!==-1)for(var h=[S1,Ex].indexOf(c)!==-1?o:i;h>=0;){var m=t[h];if(m===Oo)return Jr;if([Hp,Qp].indexOf(m)!==-1)h--;else break}if(sP===c&&[sP,Oj,tP,rP].indexOf(u)!==-1||[Oj,tP].indexOf(c)!==-1&&[Oj,Fj].indexOf(u)!==-1||[Fj,rP].indexOf(c)!==-1&&u===Fj||bH.indexOf(c)!==-1&&[xH,rv].indexOf(u)!==-1||bH.indexOf(u)!==-1&&c===nv||Wd.indexOf(c)!==-1&&Wd.indexOf(u)!==-1||c===Qp&&Wd.indexOf(u)!==-1||Wd.concat(Oo).indexOf(c)!==-1&&u===Bx&&$et.indexOf(e[l])===-1||Wd.concat(Oo).indexOf(u)!==-1&&c===Ex)return Jr;if(c===jE&&u===jE){for(var f=r[i],p=1;f>0&&(f--,t[f]===jE);)p++;if(p%2!==0)return Jr}return c===k1&&u===E1?Jr:B1},Get=function(e,t){t||(t={lineBreak:"normal",wordBreak:"normal"});var r=zet(e,t.lineBreak),s=r[0],a=r[1],i=r[2];(t.wordBreak==="break-all"||t.wordBreak==="break-word")&&(a=a.map(function(l){return[Oo,rm,pne].indexOf(l)!==-1?ly:l}));var o=t.wordBreak==="keep-all"?i.map(function(l,c){return l&&e[c]>=19968&&e[c]<=40959}):void 0;return[s,a,o]}
vendor: 14,115 bytes, line 1470
1470,qet=function(){function e(t,r,s,a){this.codePoints=t,this.required=r===Ane,this.start=s,this.end=a}return e.prototype.slice=function(){return Zs.apply(void 0,this.codePoints.slice(this.start,this.end))},e}(),Ket=function(e,t){var r=zS(e),s=Get(r,t),a=s[0],i=s[1],o=s[2],l=r.length,c=0,d=0;return{next:function(){if(d>=l)return{done:!0,value:null};for(var u=Jr;d<l&&(u=Vet(r,i,a,++d,o))===Jr;);if(u!==Jr||d===l){var h=new qet(r,u,c,d);return c=d,{value:h,done:!1}}return{done:!0,value:null}}}},Wet=1,Yet=2,Jy=4,wH=8,WN=10,jH=47,Cv=92,Jet=9,Xet=32,T1=34,Tx=61,Zet=35,ett=36,ttt=37,P1=39,I1=40,Px=41,rtt=95,no=45,ntt=33,stt=60,att=62,itt=64,ott=91,ltt=93,ctt=61,dtt=123,O1=63,utt=125,NH=124,htt=126,ftt=128,_H=65533,_E=42,vm=43,mtt=44,ptt=58,Att=59,cy=46,gtt=0,xtt=8,vtt=11,btt=14,ytt=31,wtt=127,Vc=-1,xne=48,vne=97,bne=101,jtt=102,Ntt=117,_tt=122,yne=65,wne=69,jne=70,Ctt=85,Stt=90,Ci=function(e){return e>=xne&&e<=57},ktt=function(e){return e>=55296&&e<=57343},zp=function(e){return Ci(e)||e>=yne&&e<=jne||e>=vne&&e<=jtt},Ett=function(e){return e>=vne&&e<=_tt},Btt=function(e){return e>=yne&&e<=Stt},Ttt=function(e){return Ett(e)||Btt(e)},Ptt=function(e){return e>=ftt},F1=function(e){return e===WN||e===Jet||e===Xet},YN=function(e){return Ttt(e)||Ptt(e)||e===rtt},CH=function(e){return YN(e)||Ci(e)||e===no},Itt=function(e){return e>=gtt&&e<=xtt||e===vtt||e>=btt&&e<=ytt||e===wtt},gh=function(e,t){return e!==Cv?!1:t!==WN},L1=function(e,t,r){return e===no?YN(t)||gh(t,r):YN(e)?!0:!!(e===Cv&&gh(e,t))},CE=function(e,t,r){return e===vm||e===no?Ci(t)?!0:t===cy&&Ci(r):Ci(e===cy?t:e)},Ott=function(e){var t=0,r=1;(e[t]===vm||e[t]===no)&&(e[t]===no&&(r=-1),t++);for(var s=[];Ci(e[t]);)s.push(e[t++]);var a=s.length?parseInt(Zs.apply(void 0,s),10):0;e[t]===cy&&t++;for(var i=[];Ci(e[t]);)i.push(e[t++]);var o=i.length,l=o?parseInt(Zs.apply(void 0,i),10):0;(e[t]===wne||e[t]===bne)&&t++;var c=1;(e[t]===vm||e[t]===no)&&(e[t]===no&&(c=-1),t++);for(var d=[];Ci(e[t]);)d.push(e[t++]);var u=d.length?parseInt(Zs.apply(void 0,d),10):0;return r*(a+l*Math.pow(10,-o))*Math.pow(10,c*u)},Ftt={type:2},Ltt={type:3},Dtt={type:4},Rtt={type:13},Utt={type:8},Mtt={type:21},$tt={type:9},Qtt={type:10},Htt={type:11},ztt={type:12},Vtt={type:14},D1={type:23},Gtt={type:1},qtt={type:25},Ktt={type:24},Wtt={type:26},Ytt={type:27},Jtt={type:28},Xtt={type:29},Ztt={type:31},oP={type:32},Nne=function(){function e(){this._value=[]}return e.prototype.write=function(t){this._value=this._value.concat(zS(t))},e.prototype.read=function(){for(var t=[],r=this.consumeToken();r!==oP;)t.push(r),r=this.consumeToken();return t},e.prototype.consumeToken=function(){var t=this.consumeCodePoint();switch(t){case T1:return this.consumeStringToken(T1);case Zet:var r=this.peekCodePoint(0),s=this.peekCodePoint(1),a=this.peekCodePoint(2);if(CH(r)||gh(s,a)){var i=L1(r,s,a)?Yet:Wet,o=this.consumeName();return{type:5,value:o,flags:i}}break;case ett:if(this.peekCodePoint(0)===Tx)return this.consumeCodePoint(),Rtt;break;case P1:return this.consumeStringToken(P1);case I1:return Ftt;case Px:return Ltt;case _E:if(this.peekCodePoint(0)===Tx)return this.consumeCodePoint(),Vtt;break;case vm:if(CE(t,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(t),this.consumeNumericToken();break;case mtt:return Dtt;case no:var l=t,c=this.peekCodePoint(0),d=this.peekCodePoint(1);if(CE(l,c,d))return this.reconsumeCodePoint(t),this.consumeNumericToken();if(L1(l,c,d))return this.reconsumeCodePoint(t),this.consumeIdentLikeToken();if(c===no&&d===att)return this.consumeCodePoint(),this.consumeCodePoint(),Ktt;break;case cy:if(CE(t,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(t),this.consumeNumericToken();break;case jH:if(this.peekCodePoint(0)===_E)for(this.consumeCodePoint();;){var u=this.consumeCodePoint();if(u===_E&&(u=this.consumeCodePoint(),u===jH))return this.consumeToken();if(u===Vc)return this.consumeToken()}break;case ptt:return Wtt;case Att:return Ytt;case stt:if(this.peekCodePoint(0)===ntt&&this.peekCodePoint(1)===no&&this.peekCodePoint(2)===no)return this.consumeCodePoint(),this.consumeCodePoint(),qtt;break;case itt:var h=this.peekCodePoint(0),m=this.peekCodePoint(1),f=this.peekCodePoint(2);if(L1(h,m,f)){var o=this.consumeName();return{type:7,value:o}}break;case ott:return Jtt;case Cv:if(gh(t,this.peekCodePoint(0)))return this.reconsumeCodePoint(t),this.consumeIdentLikeToken();break;case ltt:return Xtt;case ctt:if(this.peekCodePoint(0)===Tx)return this.consumeCodePoint(),Utt;break;case dtt:return Htt;case utt:return ztt;case Ntt:case Ctt:var p=this.peekCodePoint(0),A=this.peekCodePoint(1);return p===vm&&(zp(A)||A===O1)&&(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(t),this.consumeIdentLikeToken();case NH:if(this.peekCodePoint(0)===Tx)return this.consumeCodePoint(),$tt;if(this.peekCodePoint(0)===NH)return this.consumeCodePoint(),Mtt;break;case htt:if(this.peekCodePoint(0)===Tx)return this.consumeCodePoint(),Qtt;break;case Vc:return oP}return F1(t)?(this.consumeWhiteSpace(),Ztt):Ci(t)?(this.reconsumeCodePoint(t),this.consumeNumericToken()):YN(t)?(this.reconsumeCodePoint(t),this.consumeIdentLikeToken()):{type:6,value:Zs(t)}},e.prototype.consumeCodePoint=function(){var t=this._value.shift();return typeof t>"u"?-1:t},e.prototype.reconsumeCodePoint=function(t){this._value.unshift(t)},e.prototype.peekCodePoint=function(t){return t>=this._value.length?-1:this._value[t]},e.prototype.consumeUnicodeRangeToken=function(){for(var t=[],r=this.consumeCodePoint();zp(r)&&t.length<6;)t.push(r),r=this.consumeCodePoint();for(var s=!1;r===O1&&t.length<6;)t.push(r),r=this.consumeCodePoint(),s=!0;if(s){var a=parseInt(Zs.apply(void 0,t.map(function(c){return c===O1?xne:c})),16),i=parseInt(Zs.apply(void 0,t.map(function(c){return c===O1?jne:c})),16);return{type:30,start:a,end:i}}var o=parseInt(Zs.apply(void 0,t),16);if(this.peekCodePoint(0)===no&&zp(this.peekCodePoint(1))){this.consumeCodePoint(),r=this.consumeCodePoint();for(var l=[];zp(r)&&l.length<6;)l.push(r),r=this.consumeCodePoint();var i=parseInt(Zs.apply(void 0,l),16);return{type:30,start:o,end:i}}else return{type:30,start:o,end:o}},e.prototype.consumeIdentLikeToken=function(){var t=this.consumeName();return t.toLowerCase()==="url"&&this.peekCodePoint(0)===I1?(this.consumeCodePoint(),this.consumeUrlToken()):this.peekCodePoint(0)===I1?(this.consumeCodePoint(),{type:19,value:t}):{type:20,value:t}},e.prototype.consumeUrlToken=function(){var t=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===Vc)return{type:22,value:""};var r=this.peekCodePoint(0);if(r===P1||r===T1){var s=this.consumeStringToken(this.consumeCodePoint());return s.type===0&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===Vc||this.peekCodePoint(0)===Px)?(this.consumeCodePoint(),{type:22,value:s.value}):(this.consumeBadUrlRemnants(),D1)}for(;;){var a=this.consumeCodePoint();if(a===Vc||a===Px)return{type:22,value:Zs.apply(void 0,t)};if(F1(a))return this.consumeWhiteSpace(),this.peekCodePoint(0)===Vc||this.peekCodePoint(0)===Px?(this.consumeCodePoint(),{type:22,value:Zs.apply(void 0,t)}):(this.consumeBadUrlRemnants(),D1);if(a===T1||a===P1||a===I1||Itt(a))return this.consumeBadUrlRemnants(),D1;if(a===Cv)if(gh(a,this.peekCodePoint(0)))t.push(this.consumeEscapedCodePoint());else return this.consumeBadUrlRemnants(),D1;else t.push(a)}},e.prototype.consumeWhiteSpace=function(){for(;F1(this.peekCodePoint(0));)this.consumeCodePoint()},e.prototype.consumeBadUrlRemnants=function(){for(;;){var t=this.consumeCodePoint();if(t===Px||t===Vc)return;gh(t,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},e.prototype.consumeStringSlice=function(t){for(var r=5e4,s="";t>0;){var a=Math.min(r,t);s+=Zs.apply(void 0,this._value.splice(0,a)),t-=a}return this._value.shift(),s},e.prototype.consumeStringToken=function(t){var r="",s=0;do{var a=this._value[s];if(a===Vc||a===void 0||a===t)return r+=this.consumeStringSlice(s),{type:0,value:r};if(a===WN)return this._value.splice(0,s),Gtt;if(a===Cv){var i=this._value[s+1];i!==Vc&&i!==void 0&&(i===WN?(r+=this.consumeStringSlice(s),s=-1,this._value.shift()):gh(a,i)&&(r+=this.consumeStringSlice(s),r+=Zs(this.consumeEscapedCodePoint()),s=-1))}s++}while(!0)},e.prototype.consumeNumber=function(){var t=[],r=Jy,s=this.peekCodePoint(0);for((s===vm||s===no)&&t.push(this.consumeCodePoint());Ci(this.peekCodePoint(0));)t.push(this.consumeCodePoint());s=this.peekCodePoint(0);var a=this.peekCodePoint(1);if(s===cy&&Ci(a))for(t.push(this.consumeCodePoint(),this.consumeCodePoint()),r=wH;Ci(this.peekCodePoint(0));)t.push(this.consumeCodePoint());s=this.peekCodePoint(0),a=this.peekCodePoint(1);var i=this.peekCodePoint(2);if((s===wne||s===bne)&&((a===vm||a===no)&&Ci(i)||Ci(a)))for(t.push(this.consumeCodePoint(),this.consumeCodePoint()),r=wH;Ci(this.peekCodePoint(0));)t.push(this.consumeCodePoint());return[Ott(t),r]},e.prototype.consumeNumericToken=function(){var t=this.consumeNumber(),r=t[0],s=t[1],a=this.peekCodePoint(0),i=this.peekCodePoint(1),o=this.peekCodePoint(2);if(L1(a,i,o)){var l=this.consumeName();return{type:15,number:r,flags:s,unit:l}}return a===ttt?(this.consumeCodePoint(),{type:16,number:r,flags:s}):{type:17,number:r,flags:s}},e.prototype.consumeEscapedCodePoint=function(){var t=this.consumeCodePoint();if(zp(t)){for(var r=Zs(t);zp(this.peekCodePoint(0))&&r.length<6;)r+=Zs(this.consumeCodePoint());F1(this.peekCodePoint(0))&&this.consumeCodePoint();var s=parseInt(r,16);return s===0||ktt(s)||s>1114111?_H:s}return t===Vc?_H:t},e.prototype.consumeName=function(){for(var t="";;){var r=this.consumeCodePoint();if(CH(r))t+=Zs(r);else if(gh(r,this.peekCodePoint(0)))t+=Zs(this.consumeEscapedCodePoint());else return this.reconsumeCodePoint(r),t}},e}(),_ne=function(){function e(t){this._tokens=t}return e.create=function(t){var r=new Nne;return r.write(t),new e(r.read())},e.parseValue=function(t){return e.create(t).parseComponentValue()},e.parseValues=function(t){return e.create(t).parseComponentValues()},e.prototype.parseComponentValue=function(){for(var t=this.consumeToken();t.type===31;)t=this.consumeToken();if(t.type===32)throw new SyntaxError("Error parsing CSS component value, unexpected EOF");this.reconsumeToken(t);var r=this.consumeComponentValue();do t=this.consumeToken();while(t.type===31);if(t.type===32)return r;throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one")},e.prototype.parseComponentValues=function(){for(var t=[];;){var r=this.consumeComponentValue();if(r.type===32)return t;t.push(r),t.push()}},e.prototype.consumeComponentValue=function(){var t=this.consumeToken();switch(t.type){case 11:case 28:case 2:return this.consumeSimpleBlock(t.type);case 19:return this.consumeFunction(t)}return t},e.prototype.consumeSimpleBlock=function(t){for(var r={type:t,values:[]},s=this.consumeToken();;){if(s.type===32||trt(s,t))return r;this.reconsumeToken(s),r.values.push(this.consumeComponentValue()),s=this.consumeToken()}},e.prototype.consumeFunction=function(t){for(var r={name:t.value,values:[],type:18};;){var s=this.consumeToken();if(s.type===32||s.type===3)return r;this.reconsumeToken(s),r.values.push(this.consumeComponentValue())}},e.prototype.consumeToken=function(){var t=this._tokens.shift();return typeof t>"u"?oP:t},e.prototype.reconsumeToken=function(t){this._tokens.unshift(t)},e}(),Xy=function(e){return e.type===15},S0=function(e){return e.type===17},Rn=function(e){return e.type===20},ert=function(e){return e.type===0},lP=function(e,t){return Rn(e)&&e.value===t},Cne=function(e){return e.type!==31},qg=function(e){return e.type!==31&&e.type!==4},Sd=function(e){var t=[],r=[];return e.forEach(function(s){if(s.type===4){if(r.length===0)throw new Error("Error parsing function args, zero tokens for arg");t.push(r),r=[];return}s.type!==31&&r.push(s)}),r.length&&t.push(r),t},trt=function(e,t){return t===11&&e.type===12||t===28&&e.type===29?!0:t===2&&e.type===3},Xh=function(e){return e.type===17||e.type===15},xa=function(e){return e.type===16||Xh(e)},Sne=function(e){return e.length>1?[e[0],e[1]]:[e[0]]},hi={type:17,number:0,flags:Jy},f6={type:16,number:50,flags:Jy},Eh={type:16,number:100,flags:Jy},sv=function(e,t,r){var s=e[0],a=e[1];return[ss(s,t),ss(typeof a<"u"?a:s,r)]},ss=function(e,t){if(e.type===16)return e.number/100*t;if(Xy(e))switch(e.unit){case"rem":case"em":return 16*e.number;case"px":default:return e.number}return e.number},kne="deg",Ene="grad",Bne="rad",Tne="turn",VS={name:"angle",parse:function(e,t){if(t.type===15)switch(t.unit){case kne:return Math.PI*t.number/180;case Ene:return Math.PI/200*t.number;case Bne:return t.number;case Tne:return Math.PI*2*t.number}throw new Error("Unsupported angle type")}},Pne=function(e){return e.type===15&&(e.unit===kne||e.unit===Ene||e.unit===Bne||e.unit===Tne)},Ine=function(e){var t=e.filter(Rn).map(function(r){return r.value}).join(" ");switch(t){case"to bottom right":case"to right bottom":case"left top":case"top left":return[hi,hi];case"to top":case"bottom":return Ll(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[hi,Eh];case"to right":case"left":return Ll(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[Eh,Eh];case"to bottom":case"top":return Ll(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[Eh,hi];case"to left":case"right":return Ll(270)}return 0},Ll=function(e){return Math.PI*e/180},Mh={name:"color",parse:function(e,t){if(t.type===18){var r=rrt[t.name];if(typeof r>"u")throw new Error('Attempting to parse an unsupported color function "'+t.name+'"');return r(e,t.values)}if(t.type===5){if(t.value.length===3){var s=t.value.substring(0,1),a=t.value.substring(1,2),i=t.value.substring(2,3);return Bh(parseInt(s+s,16),parseInt(a+a,16),parseInt(i+i,16),1)}if(t.value.length===4){var s=t.value.substring(0,1),a=t.value.substring(1,2),i=t.value.substring(2,3),o=t.value.substring(3,4);return Bh(parseInt(s+s,16),parseInt(a+a,16),parseInt(i+i,16),parseInt(o+o,16)/255)}if(t.value.length===6){var s=t.value.substring(0,2),a=t.value.substring(2,4),i=t.value.substring(4,6);
vendor: 12,788 bytes, line 1470
1470return Bh(parseInt(s,16),parseInt(a,16),parseInt(i,16),1)}if(t.value.length===8){var s=t.value.substring(0,2),a=t.value.substring(2,4),i=t.value.substring(4,6),o=t.value.substring(6,8);return Bh(parseInt(s,16),parseInt(a,16),parseInt(i,16),parseInt(o,16)/255)}}if(t.type===20){var l=wu[t.value.toUpperCase()];if(typeof l<"u")return l}return wu.TRANSPARENT}},$h=function(e){return(255&e)===0},$a=function(e){var t=255&e,r=255&e>>8,s=255&e>>16,a=255&e>>24;return t<255?"rgba("+a+","+s+","+r+","+t/255+")":"rgb("+a+","+s+","+r+")"},Bh=function(e,t,r,s){return(e<<24|t<<16|r<<8|Math.round(s*255)<<0)>>>0},SH=function(e,t){if(e.type===17)return e.number;if(e.type===16){var r=t===3?1:255;return t===3?e.number/100*r:Math.round(e.number/100*r)}return 0},kH=function(e,t){var r=t.filter(qg);if(r.length===3){var s=r.map(SH),a=s[0],i=s[1],o=s[2];return Bh(a,i,o,1)}if(r.length===4){var l=r.map(SH),a=l[0],i=l[1],o=l[2],c=l[3];return Bh(a,i,o,c)}return 0};function SE(e,t,r){return r<0&&(r+=1),r>=1&&(r-=1),r<1/6?(t-e)*r*6+e:r<1/2?t:r<2/3?(t-e)*6*(2/3-r)+e:e}var EH=function(e,t){var r=t.filter(qg),s=r[0],a=r[1],i=r[2],o=r[3],l=(s.type===17?Ll(s.number):VS.parse(e,s))/(Math.PI*2),c=xa(a)?a.number/100:0,d=xa(i)?i.number/100:0,u=typeof o<"u"&&xa(o)?ss(o,1):1;if(c===0)return Bh(d*255,d*255,d*255,1);var h=d<=.5?d*(c+1):d+c-d*c,m=d*2-h,f=SE(m,h,l+1/3),p=SE(m,h,l),A=SE(m,h,l-1/3);return Bh(f*255,p*255,A*255,u)},rrt={hsl:EH,hsla:EH,rgb:kH,rgba:kH},Sv=function(e,t){return Mh.parse(e,_ne.create(t).parseComponentValue())},wu={ALICEBLUE:4042850303,ANTIQUEWHITE:4209760255,AQUA:16777215,AQUAMARINE:2147472639,AZURE:4043309055,BEIGE:4126530815,BISQUE:4293182719,BLACK:255,BLANCHEDALMOND:4293643775,BLUE:65535,BLUEVIOLET:2318131967,BROWN:2771004159,BURLYWOOD:3736635391,CADETBLUE:1604231423,CHARTREUSE:2147418367,CHOCOLATE:3530104575,CORAL:4286533887,CORNFLOWERBLUE:1687547391,CORNSILK:4294499583,CRIMSON:3692313855,CYAN:16777215,DARKBLUE:35839,DARKCYAN:9145343,DARKGOLDENROD:3095837695,DARKGRAY:2846468607,DARKGREEN:6553855,DARKGREY:2846468607,DARKKHAKI:3182914559,DARKMAGENTA:2332068863,DARKOLIVEGREEN:1433087999,DARKORANGE:4287365375,DARKORCHID:2570243327,DARKRED:2332033279,DARKSALMON:3918953215,DARKSEAGREEN:2411499519,DARKSLATEBLUE:1211993087,DARKSLATEGRAY:793726975,DARKSLATEGREY:793726975,DARKTURQUOISE:13554175,DARKVIOLET:2483082239,DEEPPINK:4279538687,DEEPSKYBLUE:12582911,DIMGRAY:1768516095,DIMGREY:1768516095,DODGERBLUE:512819199,FIREBRICK:2988581631,FLORALWHITE:4294635775,FORESTGREEN:579543807,FUCHSIA:4278255615,GAINSBORO:3705462015,GHOSTWHITE:4177068031,GOLD:4292280575,GOLDENROD:3668254975,GRAY:2155905279,GREEN:8388863,GREENYELLOW:2919182335,GREY:2155905279,HONEYDEW:4043305215,HOTPINK:4285117695,INDIANRED:3445382399,INDIGO:1258324735,IVORY:4294963455,KHAKI:4041641215,LAVENDER:3873897215,LAVENDERBLUSH:4293981695,LAWNGREEN:2096890111,LEMONCHIFFON:4294626815,LIGHTBLUE:2916673279,LIGHTCORAL:4034953471,LIGHTCYAN:3774873599,LIGHTGOLDENRODYELLOW:4210742015,LIGHTGRAY:3553874943,LIGHTGREEN:2431553791,LIGHTGREY:3553874943,LIGHTPINK:4290167295,LIGHTSALMON:4288707327,LIGHTSEAGREEN:548580095,LIGHTSKYBLUE:2278488831,LIGHTSLATEGRAY:2005441023,LIGHTSLATEGREY:2005441023,LIGHTSTEELBLUE:2965692159,LIGHTYELLOW:4294959359,LIME:16711935,LIMEGREEN:852308735,LINEN:4210091775,MAGENTA:4278255615,MAROON:2147483903,MEDIUMAQUAMARINE:1724754687,MEDIUMBLUE:52735,MEDIUMORCHID:3126187007,MEDIUMPURPLE:2473647103,MEDIUMSEAGREEN:1018393087,MEDIUMSLATEBLUE:2070474495,MEDIUMSPRINGGREEN:16423679,MEDIUMTURQUOISE:1221709055,MEDIUMVIOLETRED:3340076543,MIDNIGHTBLUE:421097727,MINTCREAM:4127193855,MISTYROSE:4293190143,MOCCASIN:4293178879,NAVAJOWHITE:4292783615,NAVY:33023,OLDLACE:4260751103,OLIVE:2155872511,OLIVEDRAB:1804477439,ORANGE:4289003775,ORANGERED:4282712319,ORCHID:3664828159,PALEGOLDENROD:4008225535,PALEGREEN:2566625535,PALETURQUOISE:2951671551,PALEVIOLETRED:3681588223,PAPAYAWHIP:4293907967,PEACHPUFF:4292524543,PERU:3448061951,PINK:4290825215,PLUM:3718307327,POWDERBLUE:2967529215,PURPLE:2147516671,REBECCAPURPLE:1714657791,RED:4278190335,ROSYBROWN:3163525119,ROYALBLUE:1097458175,SADDLEBROWN:2336560127,SALMON:4202722047,SANDYBROWN:4104413439,SEAGREEN:780883967,SEASHELL:4294307583,SIENNA:2689740287,SILVER:3233857791,SKYBLUE:2278484991,SLATEBLUE:1784335871,SLATEGRAY:1887473919,SLATEGREY:1887473919,SNOW:4294638335,SPRINGGREEN:16744447,STEELBLUE:1182971135,TAN:3535047935,TEAL:8421631,THISTLE:3636451583,TOMATO:4284696575,TRANSPARENT:0,TURQUOISE:1088475391,VIOLET:4001558271,WHEAT:4125012991,WHITE:4294967295,WHITESMOKE:4126537215,YELLOW:4294902015,YELLOWGREEN:2597139199},nrt={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(e,t){return t.map(function(r){if(Rn(r))switch(r.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},srt={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},GS=function(e,t){var r=Mh.parse(e,t[0]),s=t[1];return s&&xa(s)?{color:r,stop:s}:{color:r,stop:null}},BH=function(e,t){var r=e[0],s=e[e.length-1];r.stop===null&&(r.stop=hi),s.stop===null&&(s.stop=Eh);for(var a=[],i=0,o=0;o<e.length;o++){var l=e[o].stop;if(l!==null){var c=ss(l,t);c>i?a.push(c):a.push(i),i=c}else a.push(null)}for(var d=null,o=0;o<a.length;o++){var u=a[o];if(u===null)d===null&&(d=o);else if(d!==null){for(var h=o-d,m=a[d-1],f=(u-m)/(h+1),p=1;p<=h;p++)a[d+p-1]=f*p;d=null}}return e.map(function(A,v){var x=A.color;return{color:x,stop:Math.max(Math.min(1,a[v]/t),0)}})},art=function(e,t,r){var s=t/2,a=r/2,i=ss(e[0],t)-s,o=a-ss(e[1],r);return(Math.atan2(o,i)+Math.PI*2)%(Math.PI*2)},irt=function(e,t,r){var s=typeof e=="number"?e:art(e,t,r),a=Math.abs(t*Math.sin(s))+Math.abs(r*Math.cos(s)),i=t/2,o=r/2,l=a/2,c=Math.sin(s-Math.PI/2)*l,d=Math.cos(s-Math.PI/2)*l;return[a,i-d,i+d,o-c,o+c]},oc=function(e,t){return Math.sqrt(e*e+t*t)},TH=function(e,t,r,s,a){var i=[[0,0],[0,t],[e,0],[e,t]];return i.reduce(function(o,l){var c=l[0],d=l[1],u=oc(r-c,s-d);return(a?u<o.optimumDistance:u>o.optimumDistance)?{optimumCorner:l,optimumDistance:u}:o},{optimumDistance:a?1/0:-1/0,optimumCorner:null}).optimumCorner},ort=function(e,t,r,s,a){var i=0,o=0;switch(e.size){case 0:e.shape===0?i=o=Math.min(Math.abs(t),Math.abs(t-s),Math.abs(r),Math.abs(r-a)):e.shape===1&&(i=Math.min(Math.abs(t),Math.abs(t-s)),o=Math.min(Math.abs(r),Math.abs(r-a)));break;case 2:if(e.shape===0)i=o=Math.min(oc(t,r),oc(t,r-a),oc(t-s,r),oc(t-s,r-a));else if(e.shape===1){var l=Math.min(Math.abs(r),Math.abs(r-a))/Math.min(Math.abs(t),Math.abs(t-s)),c=TH(s,a,t,r,!0),d=c[0],u=c[1];i=oc(d-t,(u-r)/l),o=l*i}break;case 1:e.shape===0?i=o=Math.max(Math.abs(t),Math.abs(t-s),Math.abs(r),Math.abs(r-a)):e.shape===1&&(i=Math.max(Math.abs(t),Math.abs(t-s)),o=Math.max(Math.abs(r),Math.abs(r-a)));break;case 3:if(e.shape===0)i=o=Math.max(oc(t,r),oc(t,r-a),oc(t-s,r),oc(t-s,r-a));else if(e.shape===1){var l=Math.max(Math.abs(r),Math.abs(r-a))/Math.max(Math.abs(t),Math.abs(t-s)),h=TH(s,a,t,r,!1),d=h[0],u=h[1];i=oc(d-t,(u-r)/l),o=l*i}break}return Array.isArray(e.size)&&(i=ss(e.size[0],s),o=e.size.length===2?ss(e.size[1],a):i),[i,o]},lrt=function(e,t){var r=Ll(180),s=[];return Sd(t).forEach(function(a,i){if(i===0){var o=a[0];if(o.type===20&&o.value==="to"){r=Ine(a);return}else if(Pne(o)){r=VS.parse(e,o);return}}var l=GS(e,a);s.push(l)}),{angle:r,stops:s,type:1}},R1=function(e,t){var r=Ll(180),s=[];return Sd(t).forEach(function(a,i){if(i===0){var o=a[0];if(o.type===20&&["top","left","right","bottom"].indexOf(o.value)!==-1){r=Ine(a);return}else if(Pne(o)){r=(VS.parse(e,o)+Ll(270))%Ll(360);return}}var l=GS(e,a);s.push(l)}),{angle:r,stops:s,type:1}},crt=function(e,t){var r=Ll(180),s=[],a=1,i=0,o=3,l=[];return Sd(t).forEach(function(c,d){var u=c[0];if(d===0){if(Rn(u)&&u.value==="linear"){a=1;return}else if(Rn(u)&&u.value==="radial"){a=2;return}}if(u.type===18){if(u.name==="from"){var h=Mh.parse(e,u.values[0]);s.push({stop:hi,color:h})}else if(u.name==="to"){var h=Mh.parse(e,u.values[0]);s.push({stop:Eh,color:h})}else if(u.name==="color-stop"){var m=u.values.filter(qg);if(m.length===2){var h=Mh.parse(e,m[1]),f=m[0];S0(f)&&s.push({stop:{type:16,number:f.number*100,flags:f.flags},color:h})}}}}),a===1?{angle:(r+Ll(180))%Ll(360),stops:s,type:a}:{size:o,shape:i,stops:s,position:l,type:a}},One="closest-side",Fne="farthest-side",Lne="closest-corner",Dne="farthest-corner",Rne="circle",Une="ellipse",Mne="cover",$ne="contain",drt=function(e,t){var r=0,s=3,a=[],i=[];return Sd(t).forEach(function(o,l){var c=!0;if(l===0){var d=!1;c=o.reduce(function(h,m){if(d)if(Rn(m))switch(m.value){case"center":return i.push(f6),h;case"top":case"left":return i.push(hi),h;case"right":case"bottom":return i.push(Eh),h}else(xa(m)||Xh(m))&&i.push(m);else if(Rn(m))switch(m.value){case Rne:return r=0,!1;case Une:return r=1,!1;case"at":return d=!0,!1;case One:return s=0,!1;case Mne:case Fne:return s=1,!1;case $ne:case Lne:return s=2,!1;case Dne:return s=3,!1}else if(Xh(m)||xa(m))return Array.isArray(s)||(s=[]),s.push(m),!1;return h},c)}if(c){var u=GS(e,o);a.push(u)}}),{size:s,shape:r,stops:a,position:i,type:2}},U1=function(e,t){var r=0,s=3,a=[],i=[];return Sd(t).forEach(function(o,l){var c=!0;if(l===0?c=o.reduce(function(u,h){if(Rn(h))switch(h.value){case"center":return i.push(f6),!1;case"top":case"left":return i.push(hi),!1;case"right":case"bottom":return i.push(Eh),!1}else if(xa(h)||Xh(h))return i.push(h),!1;return u},c):l===1&&(c=o.reduce(function(u,h){if(Rn(h))switch(h.value){case Rne:return r=0,!1;case Une:return r=1,!1;case $ne:case One:return s=0,!1;case Fne:return s=1,!1;case Lne:return s=2,!1;case Mne:case Dne:return s=3,!1}else if(Xh(h)||xa(h))return Array.isArray(s)||(s=[]),s.push(h),!1;return u},c)),c){var d=GS(e,o);a.push(d)}}),{size:s,shape:r,stops:a,position:i,type:2}},urt=function(e){return e.type===1},hrt=function(e){return e.type===2},m6={name:"image",parse:function(e,t){if(t.type===22){var r={url:t.value,type:0};return e.cache.addImage(t.value),r}if(t.type===18){var s=Qne[t.name];if(typeof s>"u")throw new Error('Attempting to parse an unsupported image function "'+t.name+'"');return s(e,t.values)}throw new Error("Unsupported image type "+t.type)}};function frt(e){return!(e.type===20&&e.value==="none")&&(e.type!==18||!!Qne[e.name])}var Qne={"linear-gradient":lrt,"-moz-linear-gradient":R1,"-ms-linear-gradient":R1,"-o-linear-gradient":R1,"-webkit-linear-gradient":R1,"radial-gradient":drt,"-moz-radial-gradient":U1,"-ms-radial-gradient":U1,"-o-radial-gradient":U1,"-webkit-radial-gradient":U1,"-webkit-gradient":crt},mrt={name:"background-image",initialValue:"none",type:1,prefix:!1,parse:function(e,t){if(t.length===0)return[];var r=t[0];return r.type===20&&r.value==="none"?[]:t.filter(function(s){return qg(s)&&frt(s)}).map(function(s){return m6.parse(e,s)})}},prt={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(e,t){return t.map(function(r){if(Rn(r))switch(r.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},Art={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(e,t){return Sd(t).map(function(r){return r.filter(xa)}).map(Sne)}},grt={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(e,t){return Sd(t).map(function(r){return r.filter(Rn).map(function(s){return s.value}).join(" ")}).map(xrt)}},xrt=function(e){switch(e){case"no-repeat":return 1;case"repeat-x":case"repeat no-repeat":return 2;case"repeat-y":case"no-repeat repeat":return 3;case"repeat":default:return 0}},UA;(function(e){e.AUTO="auto",e.CONTAIN="contain",e.COVER="cover"})(UA||(UA={}));var vrt={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(e,t){return Sd(t).map(function(r){return r.filter(brt)})}},brt=function(e){return Rn(e)||xa(e)},qS=function(e){return{name:"border-"+e+"-color",initialValue:"transparent",prefix:!1,type:3,format:"color"}},yrt=qS("top"),wrt=qS("right"),jrt=qS("bottom"),Nrt=qS("left"),KS=function(e){return{name:"border-radius-"+e,initialValue:"0 0",prefix:!1,type:1,parse:function(t,r){return Sne(r.filter(xa))}}},_rt=KS("top-left"),Crt=KS("top-right"),Srt=KS("bottom-right"),krt=KS("bottom-left"),WS=function(e){return{name:"border-"+e+"-style",initialValue:"solid",prefix:!1,type:2,parse:function(t,r){switch(r){case"none":return 0;case"dashed":return 2;case"dotted":return 3;case"double":return 4}return 1}}},Ert=WS("top"),Brt=WS("right"),Trt=WS("bottom"),Prt=WS("left"),YS=function(e){return{name:"border-"+e+"-width",initialValue:"0",type:0,prefix:!1,parse:function(t,r){return Xy(r)?r.number:0}}},Irt=YS("top"),Ort=YS("right"),Frt=YS("bottom"),Lrt=YS("left"),Drt={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},Rrt={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(e,t){switch(t){case"rtl":return 1;case"ltr":default:return 0}}}
vendor: 16,182 bytes, line 1470
1470,Urt={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(e,t){return t.filter(Rn).reduce(function(r,s){return r|Mrt(s.value)},0)}},Mrt=function(e){switch(e){case"block":case"-webkit-box":return 2;case"inline":return 4;case"run-in":return 8;case"flow":return 16;case"flow-root":return 32;case"table":return 64;case"flex":case"-webkit-flex":return 128;case"grid":case"-ms-grid":return 256;case"ruby":return 512;case"subgrid":return 1024;case"list-item":return 2048;case"table-row-group":return 4096;case"table-header-group":return 8192;case"table-footer-group":return 16384;case"table-row":return 32768;case"table-cell":return 65536;case"table-column-group":return 131072;case"table-column":return 262144;case"table-caption":return 524288;case"ruby-base":return 1048576;case"ruby-text":return 2097152;case"ruby-base-container":return 4194304;case"ruby-text-container":return 8388608;case"contents":return 16777216;case"inline-block":return 33554432;case"inline-list-item":return 67108864;case"inline-table":return 134217728;case"inline-flex":return 268435456;case"inline-grid":return 536870912}return 0},$rt={name:"float",initialValue:"none",prefix:!1,type:2,parse:function(e,t){switch(t){case"left":return 1;case"right":return 2;case"inline-start":return 3;case"inline-end":return 4}return 0}},Qrt={name:"letter-spacing",initialValue:"0",prefix:!1,type:0,parse:function(e,t){return t.type===20&&t.value==="normal"?0:t.type===17||t.type===15?t.number:0}},JN;(function(e){e.NORMAL="normal",e.STRICT="strict"})(JN||(JN={}));var Hrt={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(e,t){switch(t){case"strict":return JN.STRICT;case"normal":default:return JN.NORMAL}}},zrt={name:"line-height",initialValue:"normal",prefix:!1,type:4},PH=function(e,t){return Rn(e)&&e.value==="normal"?1.2*t:e.type===17?t*e.number:xa(e)?ss(e,t):t},Vrt={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(e,t){return t.type===20&&t.value==="none"?null:m6.parse(e,t)}},Grt={name:"list-style-position",initialValue:"outside",prefix:!1,type:2,parse:function(e,t){switch(t){case"inside":return 0;case"outside":default:return 1}}},cP={name:"list-style-type",initialValue:"none",prefix:!1,type:2,parse:function(e,t){switch(t){case"disc":return 0;case"circle":return 1;case"square":return 2;case"decimal":return 3;case"cjk-decimal":return 4;case"decimal-leading-zero":return 5;case"lower-roman":return 6;case"upper-roman":return 7;case"lower-greek":return 8;case"lower-alpha":return 9;case"upper-alpha":return 10;case"arabic-indic":return 11;case"armenian":return 12;case"bengali":return 13;case"cambodian":return 14;case"cjk-earthly-branch":return 15;case"cjk-heavenly-stem":return 16;case"cjk-ideographic":return 17;case"devanagari":return 18;case"ethiopic-numeric":return 19;case"georgian":return 20;case"gujarati":return 21;case"gurmukhi":return 22;case"hebrew":return 22;case"hiragana":return 23;case"hiragana-iroha":return 24;case"japanese-formal":return 25;case"japanese-informal":return 26;case"kannada":return 27;case"katakana":return 28;case"katakana-iroha":return 29;case"khmer":return 30;case"korean-hangul-formal":return 31;case"korean-hanja-formal":return 32;case"korean-hanja-informal":return 33;case"lao":return 34;case"lower-armenian":return 35;case"malayalam":return 36;case"mongolian":return 37;case"myanmar":return 38;case"oriya":return 39;case"persian":return 40;case"simp-chinese-formal":return 41;case"simp-chinese-informal":return 42;case"tamil":return 43;case"telugu":return 44;case"thai":return 45;case"tibetan":return 46;case"trad-chinese-formal":return 47;case"trad-chinese-informal":return 48;case"upper-armenian":return 49;case"disclosure-open":return 50;case"disclosure-closed":return 51;case"none":default:return-1}}},JS=function(e){return{name:"margin-"+e,initialValue:"0",prefix:!1,type:4}},qrt=JS("top"),Krt=JS("right"),Wrt=JS("bottom"),Yrt=JS("left"),Jrt={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(e,t){return t.filter(Rn).map(function(r){switch(r.value){case"hidden":return 1;case"scroll":return 2;case"clip":return 3;case"auto":return 4;case"visible":default:return 0}})}},Xrt={name:"overflow-wrap",initialValue:"normal",prefix:!1,type:2,parse:function(e,t){switch(t){case"break-word":return"break-word";case"normal":default:return"normal"}}},XS=function(e){return{name:"padding-"+e,initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},Zrt=XS("top"),ent=XS("right"),tnt=XS("bottom"),rnt=XS("left"),nnt={name:"text-align",initialValue:"left",prefix:!1,type:2,parse:function(e,t){switch(t){case"right":return 2;case"center":case"justify":return 1;case"left":default:return 0}}},snt={name:"position",initialValue:"static",prefix:!1,type:2,parse:function(e,t){switch(t){case"relative":return 1;case"absolute":return 2;case"fixed":return 3;case"sticky":return 4}return 0}},ant={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(e,t){return t.length===1&&lP(t[0],"none")?[]:Sd(t).map(function(r){for(var s={color:wu.TRANSPARENT,offsetX:hi,offsetY:hi,blur:hi},a=0,i=0;i<r.length;i++){var o=r[i];Xh(o)?(a===0?s.offsetX=o:a===1?s.offsetY=o:s.blur=o,a++):s.color=Mh.parse(e,o)}return s})}},int={name:"text-transform",initialValue:"none",prefix:!1,type:2,parse:function(e,t){switch(t){case"uppercase":return 2;case"lowercase":return 1;case"capitalize":return 3}return 0}},ont={name:"transform",initialValue:"none",prefix:!0,type:0,parse:function(e,t){if(t.type===20&&t.value==="none")return null;if(t.type===18){var r=dnt[t.name];if(typeof r>"u")throw new Error('Attempting to parse an unsupported transform function "'+t.name+'"');return r(t.values)}return null}},lnt=function(e){var t=e.filter(function(r){return r.type===17}).map(function(r){return r.number});return t.length===6?t:null},cnt=function(e){var t=e.filter(function(c){return c.type===17}).map(function(c){return c.number}),r=t[0],s=t[1];t[2],t[3];var a=t[4],i=t[5];t[6],t[7],t[8],t[9],t[10],t[11];var o=t[12],l=t[13];return t[14],t[15],t.length===16?[r,s,a,i,o,l]:null},dnt={matrix:lnt,matrix3d:cnt},IH={type:16,number:50,flags:Jy},unt=[IH,IH],hnt={name:"transform-origin",initialValue:"50% 50%",prefix:!0,type:1,parse:function(e,t){var r=t.filter(xa);return r.length!==2?unt:[r[0],r[1]]}},fnt={name:"visible",initialValue:"none",prefix:!1,type:2,parse:function(e,t){switch(t){case"hidden":return 1;case"collapse":return 2;case"visible":default:return 0}}},kv;(function(e){e.NORMAL="normal",e.BREAK_ALL="break-all",e.KEEP_ALL="keep-all"})(kv||(kv={}));var mnt={name:"word-break",initialValue:"normal",prefix:!1,type:2,parse:function(e,t){switch(t){case"break-all":return kv.BREAK_ALL;case"keep-all":return kv.KEEP_ALL;case"normal":default:return kv.NORMAL}}},pnt={name:"z-index",initialValue:"auto",prefix:!1,type:0,parse:function(e,t){if(t.type===20)return{auto:!0,order:0};if(S0(t))return{auto:!1,order:t.number};throw new Error("Invalid z-index number parsed")}},Hne={name:"time",parse:function(e,t){if(t.type===15)switch(t.unit.toLowerCase()){case"s":return 1e3*t.number;case"ms":return t.number}throw new Error("Unsupported time type")}},Ant={name:"opacity",initialValue:"1",type:0,prefix:!1,parse:function(e,t){return S0(t)?t.number:1}},gnt={name:"text-decoration-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},xnt={name:"text-decoration-line",initialValue:"none",prefix:!1,type:1,parse:function(e,t){return t.filter(Rn).map(function(r){switch(r.value){case"underline":return 1;case"overline":return 2;case"line-through":return 3;case"none":return 4}return 0}).filter(function(r){return r!==0})}},vnt={name:"font-family",initialValue:"",prefix:!1,type:1,parse:function(e,t){var r=[],s=[];return t.forEach(function(a){switch(a.type){case 20:case 0:r.push(a.value);break;case 17:r.push(a.number.toString());break;case 4:s.push(r.join(" ")),r.length=0;break}}),r.length&&s.push(r.join(" ")),s.map(function(a){return a.indexOf(" ")===-1?a:"'"+a+"'"})}},bnt={name:"font-size",initialValue:"0",prefix:!1,type:3,format:"length"},ynt={name:"font-weight",initialValue:"normal",type:0,prefix:!1,parse:function(e,t){if(S0(t))return t.number;if(Rn(t))switch(t.value){case"bold":return 700;case"normal":default:return 400}return 400}},wnt={name:"font-variant",initialValue:"none",type:1,prefix:!1,parse:function(e,t){return t.filter(Rn).map(function(r){return r.value})}},jnt={name:"font-style",initialValue:"normal",prefix:!1,type:2,parse:function(e,t){switch(t){case"oblique":return"oblique";case"italic":return"italic";case"normal":default:return"normal"}}},Fa=function(e,t){return(e&t)!==0},Nnt={name:"content",initialValue:"none",type:1,prefix:!1,parse:function(e,t){if(t.length===0)return[];var r=t[0];return r.type===20&&r.value==="none"?[]:t}},_nt={name:"counter-increment",initialValue:"none",prefix:!0,type:1,parse:function(e,t){if(t.length===0)return null;var r=t[0];if(r.type===20&&r.value==="none")return null;for(var s=[],a=t.filter(Cne),i=0;i<a.length;i++){var o=a[i],l=a[i+1];if(o.type===20){var c=l&&S0(l)?l.number:1;s.push({counter:o.value,increment:c})}}return s}},Cnt={name:"counter-reset",initialValue:"none",prefix:!0,type:1,parse:function(e,t){if(t.length===0)return[];for(var r=[],s=t.filter(Cne),a=0;a<s.length;a++){var i=s[a],o=s[a+1];if(Rn(i)&&i.value!=="none"){var l=o&&S0(o)?o.number:0;r.push({counter:i.value,reset:l})}}return r}},Snt={name:"duration",initialValue:"0s",prefix:!1,type:1,parse:function(e,t){return t.filter(Xy).map(function(r){return Hne.parse(e,r)})}},knt={name:"quotes",initialValue:"none",prefix:!0,type:1,parse:function(e,t){if(t.length===0)return null;var r=t[0];if(r.type===20&&r.value==="none")return null;var s=[],a=t.filter(ert);if(a.length%2!==0)return null;for(var i=0;i<a.length;i+=2){var o=a[i].value,l=a[i+1].value;s.push({open:o,close:l})}return s}},OH=function(e,t,r){if(!e)return"";var s=e[Math.min(t,e.length-1)];return s?r?s.open:s.close:""},Ent={name:"box-shadow",initialValue:"none",type:1,prefix:!1,parse:function(e,t){return t.length===1&&lP(t[0],"none")?[]:Sd(t).map(function(r){for(var s={color:255,offsetX:hi,offsetY:hi,blur:hi,spread:hi,inset:!1},a=0,i=0;i<r.length;i++){var o=r[i];lP(o,"inset")?s.inset=!0:Xh(o)?(a===0?s.offsetX=o:a===1?s.offsetY=o:a===2?s.blur=o:s.spread=o,a++):s.color=Mh.parse(e,o)}return s})}},Bnt={name:"paint-order",initialValue:"normal",prefix:!1,type:1,parse:function(e,t){var r=[0,1,2],s=[];return t.filter(Rn).forEach(function(a){switch(a.value){case"stroke":s.push(1);break;case"fill":s.push(0);break;case"markers":s.push(2);break}}),r.forEach(function(a){s.indexOf(a)===-1&&s.push(a)}),s}},Tnt={name:"-webkit-text-stroke-color",initialValue:"currentcolor",prefix:!1,type:3,format:"color"},Pnt={name:"-webkit-text-stroke-width",initialValue:"0",type:0,prefix:!1,parse:function(e,t){return Xy(t)?t.number:0}},Int=function(){function e(t,r){var s,a;this.animationDuration=jt(t,Snt,r.animationDuration),this.backgroundClip=jt(t,nrt,r.backgroundClip),this.backgroundColor=jt(t,srt,r.backgroundColor),this.backgroundImage=jt(t,mrt,r.backgroundImage),this.backgroundOrigin=jt(t,prt,r.backgroundOrigin),this.backgroundPosition=jt(t,Art,r.backgroundPosition),this.backgroundRepeat=jt(t,grt,r.backgroundRepeat),this.backgroundSize=jt(t,vrt,r.backgroundSize),this.borderTopColor=jt(t,yrt,r.borderTopColor),this.borderRightColor=jt(t,wrt,r.borderRightColor),this.borderBottomColor=jt(t,jrt,r.borderBottomColor),this.borderLeftColor=jt(t,Nrt,r.borderLeftColor),this.borderTopLeftRadius=jt(t,_rt,r.borderTopLeftRadius),this.borderTopRightRadius=jt(t,Crt,r.borderTopRightRadius),this.borderBottomRightRadius=jt(t,Srt,r.borderBottomRightRadius),this.borderBottomLeftRadius=jt(t,krt,r.borderBottomLeftRadius),this.borderTopStyle=jt(t,Ert,r.borderTopStyle),this.borderRightStyle=jt(t,Brt,r.borderRightStyle),this.borderBottomStyle=jt(t,Trt,r.borderBottomStyle),this.borderLeftStyle=jt(t,Prt,r.borderLeftStyle),this.borderTopWidth=jt(t,Irt,r.borderTopWidth),this.borderRightWidth=jt(t,Ort,r.borderRightWidth),this.borderBottomWidth=jt(t,Frt,r.borderBottomWidth),this.borderLeftWidth=jt(t,Lrt,r.borderLeftWidth),this.boxShadow=jt(t,Ent,r.boxShadow),this.color=jt(t,Drt,r.color),this.direction=jt(t,Rrt,r.direction),this.display=jt(t,Urt,r.display),this.float=jt(t,$rt,r.cssFloat),this.fontFamily=jt(t,vnt,r.fontFamily),this.fontSize=jt(t,bnt,r.fontSize),this.fontStyle=jt(t,jnt,r.fontStyle),this.fontVariant=jt(t,wnt,r.fontVariant),this.fontWeight=jt(t,ynt,r.fontWeight),this.letterSpacing=jt(t,Qrt,r.letterSpacing),this.lineBreak=jt(t,Hrt,r.lineBreak),this.lineHeight=jt(t,zrt,r.lineHeight),this.listStyleImage=jt(t,Vrt,r.listStyleImage),this.listStylePosition=jt(t,Grt,r.listStylePosition),this.listStyleType=jt(t,cP,r.listStyleType),this.marginTop=jt(t,qrt,r.marginTop),this.marginRight=jt(t,Krt,r.marginRight),this.marginBottom=jt(t,Wrt,r.marginBottom),this.marginLeft=jt(t,Yrt,r.marginLeft),this.opacity=jt(t,Ant,r.opacity);var i=jt(t,Jrt,r.overflow);this.overflowX=i[0],this.overflowY=i[i.length>1?1:0],this.overflowWrap=jt(t,Xrt,r.overflowWrap),this.paddingTop=jt(t,Zrt,r.paddingTop),this.paddingRight=jt(t,ent,r.paddingRight),this.paddingBottom=jt(t,tnt,r.paddingBottom),this.paddingLeft=jt(t,rnt,r.paddingLeft),this.paintOrder=jt(t,Bnt,r.paintOrder),this.position=jt(t,snt,r.position),this.textAlign=jt(t,nnt,r.textAlign),this.textDecorationColor=jt(t,gnt,(s=r.textDecorationColor)!==null&&s!==void 0?s:r.color),this.textDecorationLine=jt(t,xnt,(a=r.textDecorationLine)!==null&&a!==void 0?a:r.textDecoration),this.textShadow=jt(t,ant,r.textShadow),this.textTransform=jt(t,int,r.textTransform),this.transform=jt(t,ont,r.transform),this.transformOrigin=jt(t,hnt,r.transformOrigin),this.visibility=jt(t,fnt,r.visibility),this.webkitTextStrokeColor=jt(t,Tnt,r.webkitTextStrokeColor),this.webkitTextStrokeWidth=jt(t,Pnt,r.webkitTextStrokeWidth),this.wordBreak=jt(t,mnt,r.wordBreak),this.zIndex=jt(t,pnt,r.zIndex)}return e.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&this.visibility===0},e.prototype.isTransparent=function(){return $h(this.backgroundColor)},e.prototype.isTransformed=function(){return this.transform!==null},e.prototype.isPositioned=function(){return this.position!==0},e.prototype.isPositionedWithZIndex=function(){return this.isPositioned()&&!this.zIndex.auto},e.prototype.isFloating=function(){return this.float!==0},e.prototype.isInlineLevel=function(){return Fa(this.display,4)||Fa(this.display,33554432)||Fa(this.display,268435456)||Fa(this.display,536870912)||Fa(this.display,67108864)||Fa(this.display,134217728)},e}(),Ont=function(){function e(t,r){this.content=jt(t,Nnt,r.content),this.quotes=jt(t,knt,r.quotes)}return e}(),FH=function(){function e(t,r){this.counterIncrement=jt(t,_nt,r.counterIncrement),this.counterReset=jt(t,Cnt,r.counterReset)}return e}(),jt=function(e,t,r){var s=new Nne,a=r!==null&&typeof r<"u"?r.toString():t.initialValue;s.write(a);var i=new _ne(s.read());switch(t.type){case 2:var o=i.parseComponentValue();return t.parse(e,Rn(o)?o.value:t.initialValue);case 0:return t.parse(e,i.parseComponentValue());case 1:return t.parse(e,i.parseComponentValues());case 4:return i.parseComponentValue();case 3:switch(t.format){case"angle":return VS.parse(e,i.parseComponentValue());case"color":return Mh.parse(e,i.parseComponentValue());case"image":return m6.parse(e,i.parseComponentValue());case"length":var l=i.parseComponentValue();return Xh(l)?l:hi;case"length-percentage":var c=i.parseComponentValue();return xa(c)?c:hi;case"time":return Hne.parse(e,i.parseComponentValue())}break}},Fnt="data-html2canvas-debug",Lnt=function(e){var t=e.getAttribute(Fnt);switch(t){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}},dP=function(e,t){var r=Lnt(e);return r===1||t===r},kd=function(){function e(t,r){if(this.context=t,this.textNodes=[],this.elements=[],this.flags=0,dP(r,3))debugger;this.styles=new Int(t,window.getComputedStyle(r,null)),fP(r)&&(this.styles.animationDuration.some(function(s){return s>0})&&(r.style.animationDuration="0s"),this.styles.transform!==null&&(r.style.transform="none")),this.bounds=HS(this.context,r),dP(r,4)&&(this.flags|=16)}return e}(),Dnt=
vendor: 26,159 bytes, line 1470
1470"AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=",
1470LH="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
vendor: 15,680 bytes, line 1470
1470+/",av=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var M1=0;M1<LH.length;M1++)av[LH.charCodeAt(M1)]=M1;var Rnt=function(e){var t=e.length*.75,r=e.length,s,a=0,i,o,l,c;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);var d=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(t):new Array(t),u=Array.isArray(d)?d:new Uint8Array(d);for(s=0;s<r;s+=4)i=av[e.charCodeAt(s)],o=av[e.charCodeAt(s+1)],l=av[e.charCodeAt(s+2)],c=av[e.charCodeAt(s+3)],u[a++]=i<<2|o>>4,u[a++]=(o&15)<<4|l>>2,u[a++]=(l&3)<<6|c&63;return d},Unt=function(e){for(var t=e.length,r=[],s=0;s<t;s+=2)r.push(e[s+1]<<8|e[s]);return r},Mnt=function(e){for(var t=e.length,r=[],s=0;s<t;s+=4)r.push(e[s+3]<<24|e[s+2]<<16|e[s+1]<<8|e[s]);return r},Cm=5,p6=11,kE=2,$nt=p6-Cm,zne=65536>>Cm,Qnt=1<<Cm,EE=Qnt-1,Hnt=1024>>Cm,znt=zne+Hnt,Vnt=znt,Gnt=32,qnt=Vnt+Gnt,Knt=65536>>p6,Wnt=1<<$nt,Ynt=Wnt-1,DH=function(e,t,r){return e.slice?e.slice(t,r):new Uint16Array(Array.prototype.slice.call(e,t,r))},Jnt=function(e,t,r){return e.slice?e.slice(t,r):new Uint32Array(Array.prototype.slice.call(e,t,r))},Xnt=function(e,t){var r=Rnt(e),s=Array.isArray(r)?Mnt(r):new Uint32Array(r),a=Array.isArray(r)?Unt(r):new Uint16Array(r),i=24,o=DH(a,i/2,s[4]/2),l=s[5]===2?DH(a,(i+s[4])/2):Jnt(s,Math.ceil((i+s[4])/4));return new Znt(s[0],s[1],s[2],s[3],o,l)},Znt=function(){function e(t,r,s,a,i,o){this.initialValue=t,this.errorValue=r,this.highStart=s,this.highValueIndex=a,this.index=i,this.data=o}return e.prototype.get=function(t){var r;if(t>=0){if(t<55296||t>56319&&t<=65535)return r=this.index[t>>Cm],r=(r<<kE)+(t&EE),this.data[r];if(t<=65535)return r=this.index[zne+(t-55296>>Cm)],r=(r<<kE)+(t&EE),this.data[r];if(t<this.highStart)return r=qnt-Knt+(t>>p6),r=this.index[r],r+=t>>Cm&Ynt,r=this.index[r],r=(r<<kE)+(t&EE),this.data[r];if(t<=1114111)return this.data[this.highValueIndex]}return this.errorValue},e}(),RH="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",est=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var $1=0;$1<RH.length;$1++)est[RH.charCodeAt($1)]=$1;var tst=1,BE=2,TE=3,UH=4,MH=5,rst=7,$H=8,PE=9,IE=10,QH=11,HH=12,zH=13,VH=14,OE=15,nst=function(e){for(var t=[],r=0,s=e.length;r<s;){var a=e.charCodeAt(r++);if(a>=55296&&a<=56319&&r<s){var i=e.charCodeAt(r++);(i&64512)===56320?t.push(((a&1023)<<10)+(i&1023)+65536):(t.push(a),r--)}else t.push(a)}return t},sst=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(String.fromCodePoint)return String.fromCodePoint.apply(String,e);var r=e.length;if(!r)return"";for(var s=[],a=-1,i="";++a<r;){var o=e[a];o<=65535?s.push(o):(o-=65536,s.push((o>>10)+55296,o%1024+56320)),(a+1===r||s.length>16384)&&(i+=String.fromCharCode.apply(String,s),s.length=0)}return i},ast=Xnt(Dnt),_l="×",FE="÷",ist=function(e){return ast.get(e)},ost=function(e,t,r){var s=r-2,a=t[s],i=t[r-1],o=t[r];if(i===BE&&o===TE)return _l;if(i===BE||i===TE||i===UH||o===BE||o===TE||o===UH)return FE;if(i===$H&&[$H,PE,QH,HH].indexOf(o)!==-1||(i===QH||i===PE)&&(o===PE||o===IE)||(i===HH||i===IE)&&o===IE||o===zH||o===MH||o===rst||i===tst)return _l;if(i===zH&&o===VH){for(;a===MH;)a=t[--s];if(a===VH)return _l}if(i===OE&&o===OE){for(var l=0;a===OE;)l++,a=t[--s];if(l%2===0)return _l}return FE},lst=function(e){var t=nst(e),r=t.length,s=0,a=0,i=t.map(ist);return{next:function(){if(s>=r)return{done:!0,value:null};for(var o=_l;s<r&&(o=ost(t,i,++s))===_l;);if(o!==_l||s===r){var l=sst.apply(null,t.slice(a,s));return a=s,{value:l,done:!1}}return{done:!0,value:null}}}},cst=function(e){for(var t=lst(e),r=[],s;!(s=t.next()).done;)s.value&&r.push(s.value.slice());return r},dst=function(e){var t=123;if(e.createRange){var r=e.createRange();if(r.getBoundingClientRect){var s=e.createElement("boundtest");s.style.height=t+"px",s.style.display="block",e.body.appendChild(s),r.selectNode(s);var a=r.getBoundingClientRect(),i=Math.round(a.height);if(e.body.removeChild(s),i===t)return!0}}return!1},ust=function(e){var t=e.createElement("boundtest");t.style.width="50px",t.style.display="block",t.style.fontSize="12px",t.style.letterSpacing="0px",t.style.wordSpacing="0px",e.body.appendChild(t);var r=e.createRange();t.innerHTML=typeof"".repeat=="function"?"&#128104;".repeat(10):"";var s=t.firstChild,a=zS(s.data).map(function(c){return Zs(c)}),i=0,o={},l=a.every(function(c,d){r.setStart(s,i),r.setEnd(s,i+c.length);var u=r.getBoundingClientRect();i+=c.length;var h=u.x>o.x||u.y>o.y;return o=u,d===0?!0:h});return e.body.removeChild(t),l},hst=function(){return typeof new Image().crossOrigin<"u"},fst=function(){return typeof new XMLHttpRequest().responseType=="string"},mst=function(e){var t=new Image,r=e.createElement("canvas"),s=r.getContext("2d");if(!s)return!1;t.src="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'></svg>";try{s.drawImage(t,0,0),r.toDataURL()}catch{return!1}return!0},GH=function(e){return e[0]===0&&e[1]===255&&e[2]===0&&e[3]===255},pst=function(e){var t=e.createElement("canvas"),r=100;t.width=r,t.height=r;var s=t.getContext("2d");if(!s)return Promise.reject(!1);s.fillStyle="rgb(0, 255, 0)",s.fillRect(0,0,r,r);var a=new Image,i=t.toDataURL();a.src=i;var o=uP(r,r,0,0,a);return s.fillStyle="red",s.fillRect(0,0,r,r),qH(o).then(function(l){s.drawImage(l,0,0);var c=s.getImageData(0,0,r,r).data;s.fillStyle="red",s.fillRect(0,0,r,r);var d=e.createElement("div");return d.style.backgroundImage="url("+i+")",d.style.height=r+"px",GH(c)?qH(uP(r,r,0,0,d)):Promise.reject(!1)}).then(function(l){return s.drawImage(l,0,0),GH(s.getImageData(0,0,r,r).data)}).catch(function(){return!1})},uP=function(e,t,r,s,a){var i="http://www.w3.org/2000/svg",o=document.createElementNS(i,"svg"),l=document.createElementNS(i,"foreignObject");return o.setAttributeNS(null,"width",e.toString()),o.setAttributeNS(null,"height",t.toString()),l.setAttributeNS(null,"width","100%"),l.setAttributeNS(null,"height","100%"),l.setAttributeNS(null,"x",r.toString()),l.setAttributeNS(null,"y",s.toString()),l.setAttributeNS(null,"externalResourcesRequired","true"),o.appendChild(l),l.appendChild(a),o},qH=function(e){return new Promise(function(t,r){var s=new Image;s.onload=function(){return t(s)},s.onerror=r,s.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(e))})},oi={get SUPPORT_RANGE_BOUNDS(){var e=dst(document);return Object.defineProperty(oi,"SUPPORT_RANGE_BOUNDS",{value:e}),e},get SUPPORT_WORD_BREAKING(){var e=oi.SUPPORT_RANGE_BOUNDS&&ust(document);return Object.defineProperty(oi,"SUPPORT_WORD_BREAKING",{value:e}),e},get SUPPORT_SVG_DRAWING(){var e=mst(document);return Object.defineProperty(oi,"SUPPORT_SVG_DRAWING",{value:e}),e},get SUPPORT_FOREIGNOBJECT_DRAWING(){var e=typeof Array.from=="function"&&typeof window.fetch=="function"?pst(document):Promise.resolve(!1);return Object.defineProperty(oi,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:e}),e},get SUPPORT_CORS_IMAGES(){var e=hst();return Object.defineProperty(oi,"SUPPORT_CORS_IMAGES",{value:e}),e},get SUPPORT_RESPONSE_TYPE(){var e=fst();return Object.defineProperty(oi,"SUPPORT_RESPONSE_TYPE",{value:e}),e},get SUPPORT_CORS_XHR(){var e="withCredentials"in new XMLHttpRequest;return Object.defineProperty(oi,"SUPPORT_CORS_XHR",{value:e}),e},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var e=!!(typeof Intl<"u"&&Intl.Segmenter);return Object.defineProperty(oi,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:e}),e}},Ev=function(){function e(t,r){this.text=t,this.bounds=r}return e}(),Ast=function(e,t,r,s){var a=vst(t,r),i=[],o=0;return a.forEach(function(l){if(r.textDecorationLine.length||l.trim().length>0)if(oi.SUPPORT_RANGE_BOUNDS){var c=KH(s,o,l.length).getClientRects();if(c.length>1){var d=A6(l),u=0;d.forEach(function(m){i.push(new Ev(m,Iu.fromDOMRectList(e,KH(s,u+o,m.length).getClientRects()))),u+=m.length})}else i.push(new Ev(l,Iu.fromDOMRectList(e,c)))}else{var h=s.splitText(l.length);i.push(new Ev(l,gst(e,s))),s=h}else oi.SUPPORT_RANGE_BOUNDS||(s=s.splitText(l.length));o+=l.length}),i},gst=function(e,t){var r=t.ownerDocument;if(r){var s=r.createElement("html2canvaswrapper");s.appendChild(t.cloneNode(!0));var a=t.parentNode;if(a){a.replaceChild(s,t);var i=HS(e,s);return s.firstChild&&a.replaceChild(s.firstChild,s),i}}return Iu.EMPTY},KH=function(e,t,r){var s=e.ownerDocument;if(!s)throw new Error("Node has no owner document");var a=s.createRange();return a.setStart(e,t),a.setEnd(e,t+r),a},A6=function(e){if(oi.SUPPORT_NATIVE_TEXT_SEGMENTATION){var t=new Intl.Segmenter(void 0,{granularity:"grapheme"});return Array.from(t.segment(e)).map(function(r){return r.segment})}return cst(e)},xst=function(e,t){if(oi.SUPPORT_NATIVE_TEXT_SEGMENTATION){var r=new Intl.Segmenter(void 0,{granularity:"word"});return Array.from(r.segment(e)).map(function(s){return s.segment})}return yst(e,t)},vst=function(e,t){return t.letterSpacing!==0?A6(e):xst(e,t)},bst=[32,160,4961,65792,65793,4153,4241],yst=function(e,t){for(var r=Ket(e,{lineBreak:t.lineBreak,wordBreak:t.overflowWrap==="break-word"?"break-word":t.wordBreak}),s=[],a,i=function(){if(a.value){var o=a.value.slice(),l=zS(o),c="";l.forEach(function(d){bst.indexOf(d)===-1?c+=Zs(d):(c.length&&s.push(c),s.push(Zs(d)),c="")}),c.length&&s.push(c)}};!(a=r.next()).done;)i();return s},wst=function(){function e(t,r,s){this.text=jst(r.data,s.textTransform),this.textBounds=Ast(t,this.text,s,r)}return e}(),jst=function(e,t){switch(t){case 1:return e.toLowerCase();case 3:return e.replace(Nst,_st);case 2:return e.toUpperCase();default:return e}},Nst=/(^|\s|:|-|\(|\))([a-z])/g,_st=function(e,t,r){return e.length>0?t+r.toUpperCase():e},Vne=function(e){Tc(t,e);function t(r,s){var a=e.call(this,r,s)||this;return a.src=s.currentSrc||s.src,a.intrinsicWidth=s.naturalWidth,a.intrinsicHeight=s.naturalHeight,a.context.cache.addImage(a.src),a}return t}(kd),Gne=function(e){Tc(t,e);function t(r,s){var a=e.call(this,r,s)||this;return a.canvas=s,a.intrinsicWidth=s.width,a.intrinsicHeight=s.height,a}return t}(kd),qne=function(e){Tc(t,e);function t(r,s){var a=e.call(this,r,s)||this,i=new XMLSerializer,o=HS(r,s);return s.setAttribute("width",o.width+"px"),s.setAttribute("height",o.height+"px"),a.svg="data:image/svg+xml,"+encodeURIComponent(i.serializeToString(s)),a.intrinsicWidth=s.width.baseVal.value,a.intrinsicHeight=s.height.baseVal.value,a.context.cache.addImage(a.svg),a}return t}(kd),Kne=function(e){Tc(t,e);function t(r,s){var a=e.call(this,r,s)||this;return a.value=s.value,a}return t}(kd),hP=function(e){Tc(t,e);function t(r,s){var a=e.call(this,r,s)||this;return a.start=s.start,a.reversed=typeof s.reversed=="boolean"&&s.reversed===!0,a}return t}(kd),Cst=[{type:15,flags:0,unit:"px",number:3}],Sst=[{type:16,flags:0,number:50}],kst=function(e){return e.width>e.height?new Iu(e.left+(e.width-e.height)/2,e.top,e.height,e.height):e.width<e.height?new Iu(e.left,e.top+(e.height-e.width)/2,e.width,e.width):e},Est=function(e){var t=e.type===Bst?new Array(e.value.length+1).join("•"):e.value;return t.length===0?e.placeholder||"":t},XN="checkbox",ZN="radio",Bst="password",WH=707406591,g6=function(e){Tc(t,e);function t(r,s){var a=e.call(this,r,s)||this;switch(a.type=s.type.toLowerCase(),a.checked=s.checked,a.value=Est(s),(a.type===XN||a.type===ZN)&&(a.styles.backgroundColor=3739148031,a.styles.borderTopColor=a.styles.borderRightColor=a.styles.borderBottomColor=a.styles.borderLeftColor=2779096575,a.styles.borderTopWidth=a.styles.borderRightWidth=a.styles.borderBottomWidth=a.styles.borderLeftWidth=1,a.styles.borderTopStyle=a.styles.borderRightStyle=a.styles.borderBottomStyle=a.styles.borderLeftStyle=1,a.styles.backgroundClip=[0],a.styles.backgroundOrigin=[0],a.bounds=kst(a.bounds)),a.type){case XN:a.styles.borderTopRightRadius=a.styles.borderTopLeftRadius=a.styles.borderBottomRightRadius=a.styles.borderBottomLeftRadius=Cst;break;case ZN:a.styles.borderTopRightRadius=a.styles.borderTopLeftRadius=a.styles.borderBottomRightRadius=a.styles.borderBottomLeftRadius=Sst;break}return a}return t}(kd),Wne=function(e){Tc(t,e);function t(r,s){var a=e.call(this,r,s)||this,i=s.options[s.selectedIndex||0];return a.value=i&&i.text||"",a}return t}(kd),Yne=function(e){Tc(t,e);function t(r,s){var a=e.call(this,r,s)||this;return a.value=s.value,a}return t}(kd),Jne=function(e){Tc(t,e);function t(r,s){var a=e.call(this,r,s)||this;a.src=s.src,a.width=parseInt(s.width,10)||0,a.height=parseInt(s.height,10)||0,a.backgroundColor=a.styles.backgroundColor;try{if(s.contentWindow&&s.contentWindow.document&&s.contentWindow.document.documentElement){a.tree=Zne(r,s.contentWindow.document.documentElement);var i=s.contentWindow.document.documentElement?Sv(r,getComputedStyle(s.contentWindow.document.documentElement).backgroundColor):wu.TRANSPARENT,o=s.contentWindow.document.body?Sv(r,getComputedStyle(s.contentWindow.document.body).backgroundColor):wu.TRANSPARENT;a.backgroundColor=$h(i)?$h(o)?a.styles.backgroundColor:o:i}}catch{}return a}return t}(kd),Tst=["OL","UL","MENU"],Lj=function(e,t,r,s){for(var a=t.firstChild,i=void 0;a;a=i)if(i=a.nextSibling,ese(a)&&a.data.trim().length>0)r.textNodes.push(new wst(e,a,r.styles));else if(NA(a))if(sse(a)&&a.assignedNodes)a.assignedNodes().forEach(function(l){return Lj(e,l,r,s)});else{var o=Xne(e,a);o.styles.isVisible()&&(Pst(a,o,s)?o.flags|=4:Ist(o.styles)&&(o.flags|=2),Tst.indexOf(a.tagName)!==-1&&(o.flags|=8),r.elements.push(o),a.slot,a.shadowRoot?Lj(e,a.shadowRoot,o,s):!e_(a)&&!tse(a)&&!t_(a)&&Lj(e,a,o,s))}},Xne=function(e,t){return mP(t)?new Vne(e,t):rse(t)?new Gne(e,t):tse(t)?new qne(e,t):Ost(t)?new Kne(e,t):Fst(t)?new hP(e,t):Lst(t)?new g6(e,t):t_(t)?new Wne(e,t):e_(t)?new Yne(e,t):nse(t)?new Jne(e,t):new kd(e,t)},Zne=function(e,t){var r=Xne(e,t);return r.flags|=4,Lj(e,t,r,r),r},Pst=function(e,t,r){return t.styles.isPositionedWithZIndex()||t.styles.opacity<1||t.styles.isTransformed()||x6(e)&&r.styles.isTransparent()},Ist=function(e){return e.isPositioned()||e.isFloating()},ese=function(e){return e.nodeType===Node.TEXT_NODE},NA=function(e){return e.nodeType===Node.ELEMENT_NODE},fP=function(e){return NA(e)&&typeof e.style<"u"&&!Dj(e)},Dj=function(e){return typeof e.className=="object"},Ost=function(e){return e.tagName==="LI"},Fst=function(e){return e.tagName==="OL"},Lst=function(e){return e.tagName==="INPUT"},Dst=function(e){return e.tagName==="HTML"},tse=function(e){return e.tagName==="svg"},x6=function(e){return e.tagName==="BODY"},rse=function(e){return e.tagName==="CANVAS"},YH=function(e){return e.tagName==="VIDEO"},mP=function(e){return e.tagName==="IMG"},nse=function(e){return e.tagName==="IFRAME"},JH=function(e){return e.tagName==="STYLE"},Rst=function(e){return e.tagName==="SCRIPT"},e_=function(e){return e.tagName==="TEXTAREA"},t_=function(e){return e.tagName==="SELECT"},sse=function(e){return e.tagName==="SLOT"},XH=function(e){return e.tagName.indexOf("-")>0},Ust=function(){function e(){this.counters={}}return e.prototype.getCounterValue=function(t){var r=this.counters[t];return r&&r.length?r[r.length-1]:1},e.prototype.getCounterValues=function(t){var r=this.counters[t];return r||[]},e.prototype.pop=function(t){var r=this;t.forEach(function(s){return r.counters[s].pop()})},e.prototype.parse=function(t){var r=this,s=t.counterIncrement,a=t.counterReset,i=!0;s!==null&&s.forEach(function(l){var c=r.counters[l.counter];c&&l.increment!==0&&(i=!1,c.length||c.push(1),c[Math.max(0,c.length-1)]+=l.increment)});var o=[];return i&&a.forEach(function(l){var c=r.counters[l.counter];o.push(l.counter),c||(c=r.counters[l.counter]=[]),c.push(l.reset)}),o},e}(),ZH={integers:[1e3,900,500,400,100,90,50,40,10,9,5,4,1],values:["M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"]},e9={integers:[9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,9
vendor: 5,016 bytes, line 1470
14700,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["Ք","Փ","Ւ","Ց","Ր","Տ","Վ","Ս","Ռ","Ջ","Պ","Չ","Ո","Շ","Ն","Յ","Մ","Ճ","Ղ","Ձ","Հ","Կ","Ծ","Խ","Լ","Ի","Ժ","Թ","Ը","Է","Զ","Ե","Դ","Գ","Բ","Ա"]},Mst={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,400,300,200,100,90,80,70,60,50,40,30,20,19,18,17,16,15,10,9,8,7,6,5,4,3,2,1],values:["י׳","ט׳","ח׳","ז׳","ו׳","ה׳","ד׳","ג׳","ב׳","א׳","ת","ש","ר","ק","צ","פ","ע","ס","נ","מ","ל","כ","יט","יח","יז","טז","טו","י","ט","ח","ז","ו","ה","ד","ג","ב","א"]},$st={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["ჵ","ჰ","ჯ","ჴ","ხ","ჭ","წ","ძ","ც","ჩ","შ","ყ","ღ","ქ","ფ","ჳ","ტ","ს","რ","ჟ","პ","ო","ჲ","ნ","მ","ლ","კ","ი","თ","ჱ","ზ","ვ","ე","დ","გ","ბ","ა"]},Vp=function(e,t,r,s,a,i){return e<t||e>r?dy(e,a,i.length>0):s.integers.reduce(function(o,l,c){for(;e>=l;)e-=l,o+=s.values[c];return o},"")+i},ase=function(e,t,r,s){var a="";do r||e--,a=s(e)+a,e/=t;while(e*t>=t);return a},Js=function(e,t,r,s,a){var i=r-t+1;return(e<0?"-":"")+(ase(Math.abs(e),i,s,function(o){return Zs(Math.floor(o%i)+t)})+a)},Uf=function(e,t,r){r===void 0&&(r=". ");var s=t.length;return ase(Math.abs(e),s,!1,function(a){return t[Math.floor(a%s)]})+r},iA=1,hh=2,fh=4,iv=8,Yd=function(e,t,r,s,a,i){if(e<-9999||e>9999)return dy(e,4,a.length>0);var o=Math.abs(e),l=a;if(o===0)return t[0]+l;for(var c=0;o>0&&c<=4;c++){var d=o%10;d===0&&Fa(i,iA)&&l!==""?l=t[d]+l:d>1||d===1&&c===0||d===1&&c===1&&Fa(i,hh)||d===1&&c===1&&Fa(i,fh)&&e>100||d===1&&c>1&&Fa(i,iv)?l=t[d]+(c>0?r[c-1]:"")+l:d===1&&c>0&&(l=r[c-1]+l),o=Math.floor(o/10)}return(e<0?s:"")+l},t9="十百千萬",r9="拾佰仟萬",n9="マイナス",LE="마이너스",dy=function(e,t,r){var s=r?". ":"",a=r?"、":"",i=r?", ":"",o=r?" ":"";switch(t){case 0:return"•"+o;case 1:return"◦"+o;case 2:return"◾"+o;case 5:var l=Js(e,48,57,!0,s);return l.length<4?"0"+l:l;case 4:return Uf(e,"〇一二三四五六七八九",a);case 6:return Vp(e,1,3999,ZH,3,s).toLowerCase();case 7:return Vp(e,1,3999,ZH,3,s);case 8:return Js(e,945,969,!1,s);case 9:return Js(e,97,122,!1,s);case 10:return Js(e,65,90,!1,s);case 11:return Js(e,1632,1641,!0,s);case 12:case 49:return Vp(e,1,9999,e9,3,s);case 35:return Vp(e,1,9999,e9,3,s).toLowerCase();case 13:return Js(e,2534,2543,!0,s);case 14:case 30:return Js(e,6112,6121,!0,s);case 15:return Uf(e,"子丑寅卯辰巳午未申酉戌亥",a);case 16:return Uf(e,"甲乙丙丁戊己庚辛壬癸",a);case 17:case 48:return Yd(e,"零一二三四五六七八九",t9,"負",a,hh|fh|iv);case 47:return Yd(e,"零壹貳參肆伍陸柒捌玖",r9,"負",a,iA|hh|fh|iv);case 42:return Yd(e,"零一二三四五六七八九",t9,"负",a,hh|fh|iv);case 41:return Yd(e,"零壹贰叁肆伍陆柒捌玖",r9,"负",a,iA|hh|fh|iv);case 26:return Yd(e,"〇一二三四五六七八九","十百千万",n9,a,0);case 25:return Yd(e,"零壱弐参四伍六七八九","拾百千万",n9,a,iA|hh|fh);case 31:return Yd(e,"영일이삼사오육칠팔구","십백천만",LE,i,iA|hh|fh);case 33:return Yd(e,"零一二三四五六七八九","十百千萬",LE,i,0);case 32:return Yd(e,"零壹貳參四五六七八九","拾百千",LE,i,iA|hh|fh);case 18:return Js(e,2406,2415,!0,s);case 20:return Vp(e,1,19999,$st,3,s);case 21:return Js(e,2790,2799,!0,s);case 22:return Js(e,2662,2671,!0,s);case 22:return Vp(e,1,10999,Mst,3,s);case 23:return Uf(e,"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");case 24:return Uf(e,"いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");case 27:return Js(e,3302,3311,!0,s);case 28:return Uf(e,"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン",a);case 29:return Uf(e,"イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス",a);case 34:return Js(e,3792,3801,!0,s);case 37:return Js(e,6160,6169,!0,s);case 38:return Js(e,4160,4169,!0,s);case 39:return Js(e,2918,2927,!0,s);case 40:return Js(e,1776,1785,!0,s);case 43:return Js(e,3046,3055,!0,s);case 44:return Js(e,3174,3183,!0,s);case 45:return Js(e,3664,3673,!0,s);case 46:return Js(e,3872,3881,!0,s);case 3:default:return Js(e,48,57,!0,s)}},ise="data-html2canvas-ignore",s9=function(){function e(t,r,s){if(this.context=t,this.options=s,this.scrolledElements=[],this.referenceElement=r,this.counters=new Ust,this.quoteDepth=0,!r.ownerDocument)throw new Error("Cloned element does not have an owner document");this.documentElement=this.cloneNode(r.ownerDocument.documentElement,!1)}return e.prototype.toIFrame=function(t,r){var s=this,a=Qst(t,r);
vendor: 30,997 bytes, lines 1470-1474
1470if(!a.contentWindow)return Promise.reject("Unable to find iframe window");var i=t.defaultView.pageXOffset,o=t.defaultView.pageYOffset,l=a.contentWindow,c=l.document,d=Vst(a).then(function(){return Ui(s,void 0,void 0,function(){var u,h;return yi(this,function(m){switch(m.label){case 0:return this.scrolledElements.forEach(Wst),l&&(l.scrollTo(r.left,r.top),/(iPad|iPhone|iPod)/g.test(navigator.userAgent)&&(l.scrollY!==r.top||l.scrollX!==r.left)&&(this.context.logger.warn("Unable to restore scroll position for cloned document"),this.context.windowBounds=this.context.windowBounds.add(l.scrollX-r.left,l.scrollY-r.top,0,0))),u=this.options.onclone,h=this.clonedReferenceElement,typeof h>"u"?[2,Promise.reject("Error finding the "+this.referenceElement.nodeName+" in the cloned document")]:c.fonts&&c.fonts.ready?[4,c.fonts.ready]:[3,2];case 1:m.sent(),m.label=2;case 2:return/(AppleWebKit)/g.test(navigator.userAgent)?[4,zst(c)]:[3,4];case 3:m.sent(),m.label=4;case 4:return typeof u=="function"?[2,Promise.resolve().then(function(){return u(c,h)}).then(function(){return a})]:[2,a]}})})});return c.open(),c.write(qst(document.doctype)+"<html></html>"),Kst(this.referenceElement.ownerDocument,i,o),c.replaceChild(c.adoptNode(this.documentElement),c.documentElement),c.close(),d},e.prototype.createElementClone=function(t){if(dP(t,2))debugger;if(rse(t))return this.createCanvasClone(t);if(YH(t))return this.createVideoClone(t);if(JH(t))return this.createStyleClone(t);var r=t.cloneNode(!1);return mP(r)&&(mP(t)&&t.currentSrc&&t.currentSrc!==t.src&&(r.src=t.currentSrc,r.srcset=""),r.loading==="lazy"&&(r.loading="eager")),XH(r)?this.createCustomElementClone(r):r},e.prototype.createCustomElementClone=function(t){var r=document.createElement("html2canvascustomelement");return DE(t.style,r),r},e.prototype.createStyleClone=function(t){try{var r=t.sheet;if(r&&r.cssRules){var s=[].slice.call(r.cssRules,0).reduce(function(i,o){return o&&typeof o.cssText=="string"?i+o.cssText:i},""),a=t.cloneNode(!1);return a.textContent=s,a}}catch(i){if(this.context.logger.error("Unable to access cssRules property",i),i.name!=="SecurityError")throw i}return t.cloneNode(!1)},e.prototype.createCanvasClone=function(t){var r;if(this.options.inlineImages&&t.ownerDocument){var s=t.ownerDocument.createElement("img");try{return s.src=t.toDataURL(),s}catch{this.context.logger.info("Unable to inline canvas contents, canvas is tainted",t)}}var a=t.cloneNode(!1);try{a.width=t.width,a.height=t.height;var i=t.getContext("2d"),o=a.getContext("2d");if(o)if(!this.options.allowTaint&&i)o.putImageData(i.getImageData(0,0,t.width,t.height),0,0);else{var l=(r=t.getContext("webgl2"))!==null&&r!==void 0?r:t.getContext("webgl");if(l){var c=l.getContextAttributes();(c==null?void 0:c.preserveDrawingBuffer)===!1&&this.context.logger.warn("Unable to clone WebGL context as it has preserveDrawingBuffer=false",t)}o.drawImage(t,0,0)}return a}catch{this.context.logger.info("Unable to clone canvas as it is tainted",t)}return a},e.prototype.createVideoClone=function(t){var r=t.ownerDocument.createElement("canvas");r.width=t.offsetWidth,r.height=t.offsetHeight;var s=r.getContext("2d");try{return s&&(s.drawImage(t,0,0,r.width,r.height),this.options.allowTaint||s.getImageData(0,0,r.width,r.height)),r}catch{this.context.logger.info("Unable to clone video as it is tainted",t)}var a=t.ownerDocument.createElement("canvas");return a.width=t.offsetWidth,a.height=t.offsetHeight,a},e.prototype.appendChildNode=function(t,r,s){(!NA(r)||!Rst(r)&&!r.hasAttribute(ise)&&(typeof this.options.ignoreElements!="function"||!this.options.ignoreElements(r)))&&(!this.options.copyStyles||!NA(r)||!JH(r))&&t.appendChild(this.cloneNode(r,s))},e.prototype.cloneChildNodes=function(t,r,s){for(var a=this,i=t.shadowRoot?t.shadowRoot.firstChild:t.firstChild;i;i=i.nextSibling)if(NA(i)&&sse(i)&&typeof i.assignedNodes=="function"){var o=i.assignedNodes();o.length&&o.forEach(function(l){return a.appendChildNode(r,l,s)})}else this.appendChildNode(r,i,s)},e.prototype.cloneNode=function(t,r){if(ese(t))return document.createTextNode(t.data);if(!t.ownerDocument)return t.cloneNode(!1);var s=t.ownerDocument.defaultView;if(s&&NA(t)&&(fP(t)||Dj(t))){var a=this.createElementClone(t);a.style.transitionProperty="none";var i=s.getComputedStyle(t),o=s.getComputedStyle(t,":before"),l=s.getComputedStyle(t,":after");this.referenceElement===t&&fP(a)&&(this.clonedReferenceElement=a),x6(a)&&Xst(a);var c=this.counters.parse(new FH(this.context,i)),d=this.resolvePseudoContent(t,a,o,Bv.BEFORE);XH(t)&&(r=!0),YH(t)||this.cloneChildNodes(t,a,r),d&&a.insertBefore(d,a.firstChild);var u=this.resolvePseudoContent(t,a,l,Bv.AFTER);return u&&a.appendChild(u),this.counters.pop(c),(i&&(this.options.copyStyles||Dj(t))&&!nse(t)||r)&&DE(i,a),(t.scrollTop!==0||t.scrollLeft!==0)&&this.scrolledElements.push([a,t.scrollLeft,t.scrollTop]),(e_(t)||t_(t))&&(e_(a)||t_(a))&&(a.value=t.value),a}return t.cloneNode(!1)},e.prototype.resolvePseudoContent=function(t,r,s,a){var i=this;if(s){var o=s.content,l=r.ownerDocument;if(!(!l||!o||o==="none"||o==="-moz-alt-content"||s.display==="none")){this.counters.parse(new FH(this.context,s));var c=new Ont(this.context,s),d=l.createElement("html2canvaspseudoelement");DE(s,d),c.content.forEach(function(h){if(h.type===0)d.appendChild(l.createTextNode(h.value));else if(h.type===22){var m=l.createElement("img");m.src=h.value,m.style.opacity="1",d.appendChild(m)}else if(h.type===18){if(h.name==="attr"){var f=h.values.filter(Rn);f.length&&d.appendChild(l.createTextNode(t.getAttribute(f[0].value)||""))}else if(h.name==="counter"){var p=h.values.filter(qg),A=p[0],v=p[1];if(A&&Rn(A)){var x=i.counters.getCounterValue(A.value),b=v&&Rn(v)?cP.parse(i.context,v.value):3;d.appendChild(l.createTextNode(dy(x,b,!1)))}}else if(h.name==="counters"){var y=h.values.filter(qg),A=y[0],w=y[1],v=y[2];if(A&&Rn(A)){var j=i.counters.getCounterValues(A.value),N=v&&Rn(v)?cP.parse(i.context,v.value):3,_=w&&w.type===0?w.value:"",S=j.map(function(T){return dy(T,N,!1)}).join(_);d.appendChild(l.createTextNode(S))}}}else if(h.type===20)switch(h.value){case"open-quote":d.appendChild(l.createTextNode(OH(c.quotes,i.quoteDepth++,!0)));break;case"close-quote":d.appendChild(l.createTextNode(OH(c.quotes,--i.quoteDepth,!1)));break;default:d.appendChild(l.createTextNode(h.value))}}),d.className=pP+" "+AP;var u=a===Bv.BEFORE?" "+pP:" "+AP;return Dj(r)?r.className.baseValue+=u:r.className+=u,d}}},e.destroy=function(t){return t.parentNode?(t.parentNode.removeChild(t),!0):!1},e}(),Bv;(function(e){e[e.BEFORE=0]="BEFORE",e[e.AFTER=1]="AFTER"})(Bv||(Bv={}));var Qst=function(e,t){var r=e.createElement("iframe");return r.className="html2canvas-container",r.style.visibility="hidden",r.style.position="fixed",r.style.left="-10000px",r.style.top="0px",r.style.border="0",r.width=t.width.toString(),r.height=t.height.toString(),r.scrolling="no",r.setAttribute(ise,"true"),e.body.appendChild(r),r},Hst=function(e){return new Promise(function(t){if(e.complete){t();return}if(!e.src){t();return}e.onload=t,e.onerror=t})},zst=function(e){return Promise.all([].slice.call(e.images,0).map(Hst))},Vst=function(e){return new Promise(function(t,r){var s=e.contentWindow;if(!s)return r("No window assigned for iframe");var a=s.document;s.onload=e.onload=function(){s.onload=e.onload=null;var i=setInterval(function(){a.body.childNodes.length>0&&a.readyState==="complete"&&(clearInterval(i),t(e))},50)}})},Gst=["all","d","content"],DE=function(e,t){for(var r=e.length-1;r>=0;r--){var s=e.item(r);Gst.indexOf(s)===-1&&t.style.setProperty(s,e.getPropertyValue(s))}return t},qst=function(e){var t="";return e&&(t+="<!DOCTYPE ",e.name&&(t+=e.name),e.internalSubset&&(t+=e.internalSubset),e.publicId&&(t+='"'+e.publicId+'"'),e.systemId&&(t+='"'+e.systemId+'"'),t+=">"),t},Kst=function(e,t,r){e&&e.defaultView&&(t!==e.defaultView.pageXOffset||r!==e.defaultView.pageYOffset)&&e.defaultView.scrollTo(t,r)},Wst=function(e){var t=e[0],r=e[1],s=e[2];t.scrollLeft=r,t.scrollTop=s},Yst=":before",Jst=":after",pP="___html2canvas___pseudoelement_before",AP="___html2canvas___pseudoelement_after",a9=`{
1471    content: "" !important;
1472    display: none !important;
1473}`,Xst=function(e){Zst(e,"."+pP+Yst+a9+`
1474         .`+AP+Jst+a9)},Zst=function(e,t){var r=e.ownerDocument;if(r){var s=r.createElement("style");s.textContent=t,e.appendChild(s)}},ose=function(){function e(){}return e.getOrigin=function(t){var r=e._link;return r?(r.href=t,r.href=r.href,r.protocol+r.hostname+r.port):"about:blank"},e.isSameOrigin=function(t){return e.getOrigin(t)===e._origin},e.setContext=function(t){e._link=t.document.createElement("a"),e._origin=e.getOrigin(t.location.href)},e._origin="about:blank",e}(),eat=function(){function e(t,r){this.context=t,this._options=r,this._cache={}}return e.prototype.addImage=function(t){var r=Promise.resolve();return this.has(t)||(UE(t)||sat(t))&&(this._cache[t]=this.loadImage(t)).catch(function(){}),r},e.prototype.match=function(t){return this._cache[t]},e.prototype.loadImage=function(t){return Ui(this,void 0,void 0,function(){var r,s,a,i,o=this;return yi(this,function(l){switch(l.label){case 0:return r=ose.isSameOrigin(t),s=!RE(t)&&this._options.useCORS===!0&&oi.SUPPORT_CORS_IMAGES&&!r,a=!RE(t)&&!r&&!UE(t)&&typeof this._options.proxy=="string"&&oi.SUPPORT_CORS_XHR&&!s,!r&&this._options.allowTaint===!1&&!RE(t)&&!UE(t)&&!a&&!s?[2]:(i=t,a?[4,this.proxy(i)]:[3,2]);case 1:i=l.sent(),l.label=2;case 2:return this.context.logger.debug("Added image "+t.substring(0,256)),[4,new Promise(function(c,d){var u=new Image;u.onload=function(){return c(u)},u.onerror=d,(aat(i)||s)&&(u.crossOrigin="anonymous"),u.src=i,u.complete===!0&&setTimeout(function(){return c(u)},500),o._options.imageTimeout>0&&setTimeout(function(){return d("Timed out ("+o._options.imageTimeout+"ms) loading image")},o._options.imageTimeout)})];case 3:return[2,l.sent()]}})})},e.prototype.has=function(t){return typeof this._cache[t]<"u"},e.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},e.prototype.proxy=function(t){var r=this,s=this._options.proxy;if(!s)throw new Error("No proxy defined");var a=t.substring(0,256);return new Promise(function(i,o){var l=oi.SUPPORT_RESPONSE_TYPE?"blob":"text",c=new XMLHttpRequest;c.onload=function(){if(c.status===200)if(l==="text")i(c.response);else{var h=new FileReader;h.addEventListener("load",function(){return i(h.result)},!1),h.addEventListener("error",function(m){return o(m)},!1),h.readAsDataURL(c.response)}else o("Failed to proxy resource "+a+" with status code "+c.status)},c.onerror=o;var d=s.indexOf("?")>-1?"&":"?";if(c.open("GET",""+s+d+"url="+encodeURIComponent(t)+"&responseType="+l),l!=="text"&&c instanceof XMLHttpRequest&&(c.responseType=l),r._options.imageTimeout){var u=r._options.imageTimeout;c.timeout=u,c.ontimeout=function(){return o("Timed out ("+u+"ms) proxying "+a)}}c.send()})},e}(),tat=/^data:image\/svg\+xml/i,rat=/^data:image\/.*;base64,/i,nat=/^data:image\/.*/i,sat=function(e){return oi.SUPPORT_SVG_DRAWING||!iat(e)},RE=function(e){return nat.test(e)},aat=function(e){return rat.test(e)},UE=function(e){return e.substr(0,4)==="blob"},iat=function(e){return e.substr(-3).toLowerCase()==="svg"||tat.test(e)},bt=function(){function e(t,r){this.type=0,this.x=t,this.y=r}return e.prototype.add=function(t,r){return new e(this.x+t,this.y+r)},e}(),Gp=function(e,t,r){return new bt(e.x+(t.x-e.x)*r,e.y+(t.y-e.y)*r)},Q1=function(){function e(t,r,s,a){this.type=1,this.start=t,this.startControl=r,this.endControl=s,this.end=a}return e.prototype.subdivide=function(t,r){var s=Gp(this.start,this.startControl,t),a=Gp(this.startControl,this.endControl,t),i=Gp(this.endControl,this.end,t),o=Gp(s,a,t),l=Gp(a,i,t),c=Gp(o,l,t);return r?new e(this.start,s,o,c):new e(c,l,i,this.end)},e.prototype.add=function(t,r){return new e(this.start.add(t,r),this.startControl.add(t,r),this.endControl.add(t,r),this.end.add(t,r))},e.prototype.reverse=function(){return new e(this.end,this.endControl,this.startControl,this.start)},e}(),Tl=function(e){return e.type===1},oat=function(){function e(t){var r=t.styles,s=t.bounds,a=sv(r.borderTopLeftRadius,s.width,s.height),i=a[0],o=a[1],l=sv(r.borderTopRightRadius,s.width,s.height),c=l[0],d=l[1],u=sv(r.borderBottomRightRadius,s.width,s.height),h=u[0],m=u[1],f=sv(r.borderBottomLeftRadius,s.width,s.height),p=f[0],A=f[1],v=[];v.push((i+c)/s.width),v.push((p+h)/s.width),v.push((o+A)/s.height),v.push((d+m)/s.height);var x=Math.max.apply(Math,v);x>1&&(i/=x,o/=x,c/=x,d/=x,h/=x,m/=x,p/=x,A/=x);var b=s.width-c,y=s.height-m,w=s.width-h,j=s.height-A,N=r.borderTopWidth,_=r.borderRightWidth,S=r.borderBottomWidth,C=r.borderLeftWidth,E=ss(r.paddingTop,t.bounds.width),T=ss(r.paddingRight,t.bounds.width),B=ss(r.paddingBottom,t.bounds.width),L=ss(r.paddingLeft,t.bounds.width);this.topLeftBorderDoubleOuterBox=i>0||o>0?xs(s.left+C/3,s.top+N/3,i-C/3,o-N/3,_n.TOP_LEFT):new bt(s.left+C/3,s.top+N/3),this.topRightBorderDoubleOuterBox=i>0||o>0?xs(s.left+b,s.top+N/3,c-_/3,d-N/3,_n.TOP_RIGHT):new bt(s.left+s.width-_/3,s.top+N/3),this.bottomRightBorderDoubleOuterBox=h>0||m>0?xs(s.left+w,s.top+y,h-_/3,m-S/3,_n.BOTTOM_RIGHT):new bt(s.left+s.width-_/3,s.top+s.height-S/3),this.bottomLeftBorderDoubleOuterBox=p>0||A>0?xs(s.left+C/3,s.top+j,p-C/3,A-S/3,_n.BOTTOM_LEFT):new bt(s.left+C/3,s.top+s.height-S/3),this.topLeftBorderDoubleInnerBox=i>0||o>0?xs(s.left+C*2/3,s.top+N*2/3,i-C*2/3,o-N*2/3,_n.TOP_LEFT):new bt(s.left+C*2/3,s.top+N*2/3),this.topRightBorderDoubleInnerBox=i>0||o>0?xs(s.left+b,s.top+N*2/3,c-_*2/3,d-N*2/3,_n.TOP_RIGHT):new bt(s.left+s.width-_*2/3,s.top+N*2/3),this.bottomRightBorderDoubleInnerBox=h>0||m>0?xs(s.left+w,s.top+y,h-_*2/3,m-S*2/3,_n.BOTTOM_RIGHT):new bt(s.left+s.width-_*2/3,s.top+s.height-S*2/3),this.bottomLeftBorderDoubleInnerBox=p>0||A>0?xs(s.left+C*2/3,s.top+j,p-C*2/3,A-S*2/3,_n.BOTTOM_LEFT):new bt(s.left+C*2/3,s.top+s.height-S*2/3),this.topLeftBorderStroke=i>0||o>0?xs(s.left+C/2,s.top+N/2,i-C/2,o-N/2,_n.TOP_LEFT):new bt(s.left+C/2,s.top+N/2),this.topRightBorderStroke=i>0||o>0?xs(s.left+b,s.top+N/2,c-_/2,d-N/2,_n.TOP_RIGHT):new bt(s.left+s.width-_/2,s.top+N/2),this.bottomRightBorderStroke=h>0||m>0?xs(s.left+w,s.top+y,h-_/2,m-S/2,_n.BOTTOM_RIGHT):new bt(s.left+s.width-_/2,s.top+s.height-S/2),this.bottomLeftBorderStroke=p>0||A>0?xs(s.left+C/2,s.top+j,p-C/2,A-S/2,_n.BOTTOM_LEFT):new bt(s.left+C/2,s.top+s.height-S/2),this.topLeftBorderBox=i>0||o>0?xs(s.left,s.top,i,o,_n.TOP_LEFT):new bt(s.left,s.top),this.topRightBorderBox=c>0||d>0?xs(s.left+b,s.top,c,d,_n.TOP_RIGHT):new bt(s.left+s.width,s.top),this.bottomRightBorderBox=h>0||m>0?xs(s.left+w,s.top+y,h,m,_n.BOTTOM_RIGHT):new bt(s.left+s.width,s.top+s.height),this.bottomLeftBorderBox=p>0||A>0?xs(s.left,s.top+j,p,A,_n.BOTTOM_LEFT):new bt(s.left,s.top+s.height),this.topLeftPaddingBox=i>0||o>0?xs(s.left+C,s.top+N,Math.max(0,i-C),Math.max(0,o-N),_n.TOP_LEFT):new bt(s.left+C,s.top+N),this.topRightPaddingBox=c>0||d>0?xs(s.left+Math.min(b,s.width-_),s.top+N,b>s.width+_?0:Math.max(0,c-_),Math.max(0,d-N),_n.TOP_RIGHT):new bt(s.left+s.width-_,s.top+N),this.bottomRightPaddingBox=h>0||m>0?xs(s.left+Math.min(w,s.width-C),s.top+Math.min(y,s.height-S),Math.max(0,h-_),Math.max(0,m-S),_n.BOTTOM_RIGHT):new bt(s.left+s.width-_,s.top+s.height-S),this.bottomLeftPaddingBox=p>0||A>0?xs(s.left+C,s.top+Math.min(j,s.height-S),Math.max(0,p-C),Math.max(0,A-S),_n.BOTTOM_LEFT):new bt(s.left+C,s.top+s.height-S),this.topLeftContentBox=i>0||o>0?xs(s.left+C+L,s.top+N+E,Math.max(0,i-(C+L)),Math.max(0,o-(N+E)),_n.TOP_LEFT):new bt(s.left+C+L,s.top+N+E),this.topRightContentBox=c>0||d>0?xs(s.left+Math.min(b,s.width+C+L),s.top+N+E,b>s.width+C+L?0:c-C+L,d-(N+E),_n.TOP_RIGHT):new bt(s.left+s.width-(_+T),s.top+N+E),this.bottomRightContentBox=h>0||m>0?xs(s.left+Math.min(w,s.width-(C+L)),s.top+Math.min(y,s.height+N+E),Math.max(0,h-(_+T)),m-(S+B),_n.BOTTOM_RIGHT):new bt(s.left+s.width-(_+T),s.top+s.height-(S+B)),this.bottomLeftContentBox=p>0||A>0?xs(s.left+C+L,s.top+j,Math.max(0,p-(C+L)),A-(S+B),_n.BOTTOM_LEFT):new bt(s.left+C+L,s.top+s.height-(S+B))}return e}(),_n;(function(e){e[e.TOP_LEFT=0]="TOP_LEFT",e[e.TOP_RIGHT=1]="TOP_RIGHT",e[e.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",e[e.BOTTOM_LEFT=3]="BOTTOM_LEFT"})(_n||(_n={}));var xs=function(e,t,r,s,a){var i=4*((Math.sqrt(2)-1)/3),o=r*i,l=s*i,c=e+r,d=t+s;switch(a){case _n.TOP_LEFT:return new Q1(new bt(e,d),new bt(e,d-l),new bt(c-o,t),new bt(c,t));case _n.TOP_RIGHT:return new Q1(new bt(e,t),new bt(e+o,t),new bt(c,d-l),new bt(c,d));case _n.BOTTOM_RIGHT:return new Q1(new bt(c,t),new bt(c,t+l),new bt(e+o,d),new bt(e,d));case _n.BOTTOM_LEFT:default:return new Q1(new bt(c,d),new bt(c-o,d),new bt(e,t+l),new bt(e,t))}},r_=function(e){return[e.topLeftBorderBox,e.topRightBorderBox,e.bottomRightBorderBox,e.bottomLeftBorderBox]},lat=function(e){return[e.topLeftContentBox,e.topRightContentBox,e.bottomRightContentBox,e.bottomLeftContentBox]},n_=function(e){return[e.topLeftPaddingBox,e.topRightPaddingBox,e.bottomRightPaddingBox,e.bottomLeftPaddingBox]},cat=function(){function e(t,r,s){this.offsetX=t,this.offsetY=r,this.matrix=s,this.type=0,this.target=6}return e}(),H1=function(){function e(t,r){this.path=t,this.target=r,this.type=1}return e}(),dat=function(){function e(t){this.opacity=t,this.type=2,this.target=6}return e}(),uat=function(e){return e.type===0},lse=function(e){return e.type===1},hat=function(e){return e.type===2},i9=function(e,t){return e.length===t.length?e.some(function(r,s){return r===t[s]}):!1},fat=function(e,t,r,s,a){return e.map(function(i,o){switch(o){case 0:return i.add(t,r);case 1:return i.add(t+s,r);case 2:return i.add(t+s,r+a);case 3:return i.add(t,r+a)}return i})},cse=function(){function e(t){this.element=t,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return e}(),dse=function(){function e(t,r){if(this.container=t,this.parent=r,this.effects=[],this.curves=new oat(this.container),this.container.styles.opacity<1&&this.effects.push(new dat(this.container.styles.opacity)),this.container.styles.transform!==null){var s=this.container.bounds.left+this.container.styles.transformOrigin[0].number,a=this.container.bounds.top+this.container.styles.transformOrigin[1].number,i=this.container.styles.transform;this.effects.push(new cat(s,a,i))}if(this.container.styles.overflowX!==0){var o=r_(this.curves),l=n_(this.curves);i9(o,l)?this.effects.push(new H1(o,6)):(this.effects.push(new H1(o,2)),this.effects.push(new H1(l,4)))}}return e.prototype.getEffects=function(t){for(var r=[2,3].indexOf(this.container.styles.position)===-1,s=this.parent,a=this.effects.slice(0);s;){var i=s.effects.filter(function(c){return!lse(c)});if(r||s.container.styles.position!==0||!s.parent){if(a.unshift.apply(a,i),r=[2,3].indexOf(s.container.styles.position)===-1,s.container.styles.overflowX!==0){var o=r_(s.curves),l=n_(s.curves);i9(o,l)||a.unshift(new H1(l,6))}}else a.unshift.apply(a,i);s=s.parent}return a.filter(function(c){return Fa(c.target,t)})},e}(),gP=function(e,t,r,s){e.container.elements.forEach(function(a){var i=Fa(a.flags,4),o=Fa(a.flags,2),l=new dse(a,e);Fa(a.styles.display,2048)&&s.push(l);var c=Fa(a.flags,8)?[]:s;if(i||o){var d=i||a.styles.isPositioned()?r:t,u=new cse(l);if(a.styles.isPositioned()||a.styles.opacity<1||a.styles.isTransformed()){var h=a.styles.zIndex.order;if(h<0){var m=0;d.negativeZIndex.some(function(p,A){return h>p.element.container.styles.zIndex.order?(m=A,!1):m>0}),d.negativeZIndex.splice(m,0,u)}else if(h>0){var f=0;d.positiveZIndex.some(function(p,A){return h>=p.element.container.styles.zIndex.order?(f=A+1,!1):f>0}),d.positiveZIndex.splice(f,0,u)}else d.zeroOrAutoZIndexOrTransformedOrOpacity.push(u)}else a.styles.isFloating()?d.nonPositionedFloats.push(u):d.nonPositionedInlineLevel.push(u);gP(l,u,i?u:r,c)}else a.styles.isInlineLevel()?t.inlineLevel.push(l):t.nonInlineLevel.push(l),gP(l,t,r,c);Fa(a.flags,8)&&use(a,c)})},use=function(e,t){for(var r=e instanceof hP?e.start:1,s=e instanceof hP?e.reversed:!1,a=0;a<t.length;a++){var i=t[a];i.container instanceof Kne&&typeof i.container.value=="number"&&i.container.value!==0&&(r=i.container.value),i.listValue=dy(r,i.container.styles.listStyleType,!0),r+=s?-1:1}},mat=function(e){var t=new dse(e,null),r=new cse(t),s=[];return gP(t,r,r,s),use(t.container,s),r},o9=function(e,t){switch(t){case 0:return Dl(e.topLeftBorderBox,e.topLeftPaddingBox,e.topRightBorderBox,e.topRightPaddingBox);case 1:return Dl(e.topRightBorderBox,e.topRightPaddingBox,e.bottomRightBorderBox,e.bottomRightPaddingBox);case 2:return Dl(e.bottomRightBorderBox,e.bottomRightPaddingBox,e.bottomLeftBorderBox,e.bottomLeftPaddingBox);case 3:default:return Dl(e.bottomLeftBorderBox,e.bottomLeftPaddingBox,e.topLeftBorderBox,e.topLeftPaddingBox)}},pat=function(e,t){switch(t){case 0:return Dl(e.topLeftBorderBox,e.topLeftBorderDoubleOuterBox,e.topRightBorderBox,e.topRightBorderDoubleOuterBox);case 1:return Dl(e.topRightBorderBox,e.topRightBorderDoubleOuterBox,e.bottomRightBorderBox,e.bottomRightBorderDoubleOuterBox);case 2:return Dl(e.bottomRightBorderBox,e.bottomRightBorderDoubleOuterBox,e.bottomLeftBorderBox,e.bottomLeftBorderDoubleOuterBox);case 3:default:return Dl(e.bottomLeftBorderBox,e.bottomLeftBorderDoubleOuterBox,e.topLeftBorderBox,e.topLeftBorderDoubleOuterBox)}},Aat=function(e,t){switch(t){case 0:return Dl(e.topLeftBorderDoubleInnerBox,e.topLeftPaddingBox,e.topRightBorderDoubleInnerBox,e.topRightPaddingBox);case 1:return Dl(e.topRightBorderDoubleInnerBox,e.topRightPaddingBox,e.bottomRightBorderDoubleInnerBox,e.bottomRightPaddingBox);case 2:return Dl(e.bottomRightBorderDoubleInnerBox,e.bottomRightPaddingBox,e.bottomLeftBorderDoubleInnerBox,e.bottomLeftPaddingBox);case 3:default:return Dl(e.bottomLeftBorderDoubleInnerBox,e.bottomLeftPaddingBox,e.topLeftBorderDoubleInnerBox,e.topLeftPaddingBox)}},gat=function(e,t){switch(t){case 0:return z1(e.topLeftBorderStroke,e.topRightBorderStroke);case 1:return z1(e.topRightBorderStroke,e.bottomRightBorderStroke);case 2:return z1(e.bottomRightBorderStroke,e.bottomLeftBorderStroke);case 3:default:return z1(e.bottomLeftBorderStroke,e.topLeftBorderStroke)}},z1=function(e,t){var r=[];return Tl(e)?r.push(e.subdivide(.5,!1)):r.push(e),Tl(t)?r.push(t.subdivide(.5,!0)):r.push(t),r},Dl=function(e,t,r,s){var a=[];return Tl(e)?a.push(e.subdivide(.5,!1)):a.push(e),Tl(r)?a.push(r.subdivide(.5,!0)):a.push(r),Tl(s)?a.push(s.subdivide(.5,!0).reverse()):a.push(s),Tl(t)?a.push(t.subdivide(.5,!1).reverse()):a.push(t),a},hse=function(e){var t=e.bounds,r=e.styles;return t.add(r.borderLeftWidth,r.borderTopWidth,-(r.borderRightWidth+r.borderLeftWidth),-(r.borderTopWidth+r.borderBottomWidth))},s_=function(e){var t=e.styles,r=e.bounds,s=ss(t.paddingLeft,r.width),a=ss(t.paddingRight,r.width),i=ss(t.paddingTop,r.width),o=ss(t.paddingBottom,r.width);return r.add(s+t.borderLeftWidth,i+t.borderTopWidth,-(t.borderRightWidth+t.borderLeftWidth+s+a),-(t.borderTopWidth+t.borderBottomWidth+i+o))},xat=function(e,t){return e===0?t.bounds:e===2?s_(t):hse(t)},vat=function(e,t){return e===0?t.bounds:e===2?s_(t):hse(t)},ME=function(e,t,r){var s=xat(oA(e.styles.backgroundOrigin,t),e),a=vat(oA(e.styles.backgroundClip,t),e),i=bat(oA(e.styles.backgroundSize,t),r,s),o=i[0],l=i[1],c=sv(oA(e.styles.backgroundPosition,t),s.width-o,s.height-l),d=yat(oA(e.styles.backgroundRepeat,t),c,i,s,a),u=Math.round(s.left+c[0]),h=Math.round(s.top+c[1]);return[d,u,h,o,l]},qp=function(e){return Rn(e)&&e.value===UA.AUTO},V1=function(e){return typeof e=="number"},bat=function(e,t,r){var s=t[0],a=t[1],i=t[2],o=e[0],l=e[1];if(!o)return[0,0];if(xa(o)&&l&&xa(l))return[ss(o,r.width),ss(l,r.height)];var c=V1(i);if(Rn(o)&&(o.value===UA.CONTAIN||o.value===UA.COVER)){if(V1(i)){var d=r.width/r.height;return d<i!=(o.value===UA.COVER)?[r.width,r.width/i]:[r.height*i,r.height]}return[r.width,r.height]}var u=V1(s),h=V1(a),m=u||h;if(qp(o)&&(!l||qp(l))){if(u&&h)return[s,a];if(!c&&!m)return[r.width,r.height];if(m&&c){var f=u?s:a*i,p=h?a:s/i;return[f,p]}var A=u?s:r.width,v=h?a:r.height;return[A,v]}if(c){var x=0,b=0;return xa(o)?x=ss(o,r.width):xa(l)&&(b=ss(l,r.height)),qp(o)?x=b*i:(!l||qp(l))&&(b=x/i),[x,b]}var y=null,w=null;if(xa(o)?y=ss(o,r.width):l&&xa(l)&&(w=ss(l,r.height)),y!==null&&(!l||qp(l))&&(w=u&&h?y/s*a:r.height),w!==null&&qp(o)&&(y=u&&h?w/a*s:r.width),y!==null&&w!==null)return[y,w];throw new Error("Unable to calculate background-size for element")},oA=function(e,t){var r=e[t];return typeof r>"u"?e[0]:r},yat=function(e,t,r,s,a){var i=t[0],o=t[1],l=r[0],c=r[1];switch(e){case 2:return[new bt(Math.round(s.left),Math.round(s.top+o)),new bt(Math.round(s.left+s.width),Math.round(s.top+o)),new bt(Math.round(s.left+s.width),Math.round(c+s.top+o)),new bt(Math.round(s.left),Math.round(c+s.top+o))];case 3:return[new bt(Math.round(s.left+i),Math.round(s.top)),new bt(Math.round(s.left+i+l),Math.round(s.top)),new bt(Math.round(s.left+i+l),Math.round(s.height+s.top)),new bt(Math.round(s.left+i),Math.round(s.height+s.top))];case 1:return[new bt(Math.round(s.left+i),Math.round(s.top+o)),new bt(Math.round(s.left+i+l),Math.round(s.top+o)),new bt(Math.round(s.left+i+l),Math.round(s.top+o+c)),new bt(Math.round(s.left+i),Math.round(s.top+o+c))];default:return[new bt(Math.round(a.left),Math.round(a.top)),new bt(Math.round(a.left+a.width),Math.round(a.top)),new bt(Math.round(a.left+a.width),Math.round(a.height+a.top)),new bt(Math.round(a.left),Math.round(a.height+a.top))]}},wat="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",l9="Hidden Text",jat=function(){function e(t){this._data={},this._document=t}return e.prototype.parseMetrics=function(t,r){var s=this._document.createElement("div"),a=this._document.createElement("img"),i=this._document.createElement("span"),o=this._document.body;s.style.visibility="hidden",s.style.fontFamily=t,s.style.fontSize=r,s.style.margin="0",s.style.padding="0",s.style.whiteSpace="nowrap",o.appendChild(s),a.src=wat,a.width=1,a.height=1,a.style.margin="0",a.style.padding="0",a.style.verticalAlign="baseline",i.style.fontFamily=t,i.style.fontSize=r,i.style.margin="0",i.style.padding="0",i.appendChild(this._document.createTextNode(l9)),s.appendChild(i),s.appendChild(a);var l=a.offsetTop-i.offsetTop+2;s.removeChild(i),s.appendChild(this._document.createTextNode(l9)),s.style.lineHeight="normal",a.style.verticalAlign="super";var c=a.offsetTop-s.offsetTop+2;return o.removeChild(s),{baseline:l,middle:c}},e.prototype.getMetrics=function(t,r){var s=t+" "+r;return typeof this._data[s]>"u"&&(this._data[s]=this.parseMetrics(t,r)),this._data[s]},e}(),fse=function(){function e(t,r){this.context=t,this.options=r}return e}(),Nat=1e4,_at=function(e){Tc(t,e);function t(r,s){var a=e.call(this,r,s)||this;return a._activeEffects=[],a.canvas=s.canvas?s.canvas:document.createElement("canvas"),a.ctx=a.canvas.getContext("2d"),s.canvas||(a.canvas.width=Math.floor(s.width*s.scale),a.canvas.height=Math.floor(s.height*s.scale),a.canvas.style.width=s.width+"px",a.canvas.style.height=s.height+"px"),a.fontMetrics=new jat(document),a.ctx.scale(a.options.scale,a.options.scale),a.ctx.translate(-s.x,-s.y),a.ctx.textBaseline="bottom",a._activeEffects=[],a.context.logger.debug("Canvas renderer initialized ("+s.width+"x"+s.height+") with scale "+s.scale),a}return t.prototype.applyEffects=function(r){for(var s=this;this._activeEffects.length;)this.popEffect();r.forEach(function(a){return s.applyEffect(a)})},t.prototype.applyEffect=function(r){this.ctx.save(),hat(r)&&(this.ctx.globalAlpha=r.opacity),uat(r)&&(this.ctx.translate(r.offsetX,r.offsetY),this.ctx.transform(r.matrix[0],r.matrix[1],r.matrix[2],r.matrix[3],r.matrix[4],r.matrix[5]),this.ctx.translate(-r.offsetX,-r.offsetY)),lse(r)&&(this.path(r.path),this.ctx.clip()),this._activeEffects.push(r)},t.prototype.popEffect=function(){this._activeEffects.pop(),this.ctx.restore()},t.prototype.renderStack=function(r){return Ui(this,void 0,void 0,function(){var s;return yi(this,function(a){switch(a.label){case 0:return s=r.element.container.styles,s.isVisible()?[4,this.renderStackContent(r)]:[3,2];case 1:a.sent(),a.label=2;case 2:return[2]}})})},t.prototype.renderNode=function(r){return Ui(this,void 0,void 0,function(){return yi(this,function(s){switch(s.label){case 0:if(Fa(r.container.flags,16))debugger;return r.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(r)]:[3,3];case 1:return s.sent(),[4,this.renderNodeContent(r)];case 2:s.sent(),s.label=3;case 3:return[2]}})})},t.prototype.renderTextWithLetterSpacing=function(r,s,a){var i=this;if(s===0)this.ctx.fillText(r.text,r.bounds.left,r.bounds.top+a);else{var o=A6(r.text);o.reduce(function(l,c){return i.ctx.fillText(c,l,r.bounds.top+a),l+i.ctx.measureText(c).width},r.bounds.left)}},t.prototype.createFontStyle=function(r){var s=r.fontVariant.filter(function(o){return o==="normal"||o==="small-caps"}).join(""),a=Bat(r.fontFamily).join(", "),i=Xy(r.fontSize)?""+r.fontSize.number+r.fontSize.unit:r.fontSize.number+"px";return[[r.fontStyle,s,r.fontWeight,i,a].join(" "),a,i]},t.prototype.renderTextNode=function(r,s){return Ui(this,void 0,void 0,function(){var a,i,o,l,c,d,u,h,m=this;return yi(this,function(f){return a=this.createFontStyle(s),i=a[0],o=a[1],l=a[2],this.ctx.font=i,this.ctx.direction=s.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",c=this.fontMetrics.getMetrics(o,l),d=c.baseline,u=c.middle,h=s.paintOrder,r.textBounds.forEach(function(p){h.forEach(function(A){switch(A){case 0:m.ctx.fillStyle=$a(s.color),m.renderTextWithLetterSpacing(p,s.letterSpacing,d);var v=s.textShadow;v.length&&p.text.trim().length&&(v.slice(0).reverse().forEach(function(x){m.ctx.shadowColor=$a(x.color),m.ctx.shadowOffsetX=x.offsetX.number*m.options.scale,m.ctx.shadowOffsetY=x.offsetY.number*m.options.scale,m.ctx.shadowBlur=x.blur.number,m.renderTextWithLetterSpacing(p,s.letterSpacing,d)}),m.ctx.shadowColor="",m.ctx.shadowOffsetX=0,m.ctx.shadowOffsetY=0,m.ctx.shadowBlur=0),s.textDecorationLine.length&&(m.ctx.fillStyle=$a(s.textDecorationColor||s.color),s.textDecorationLine.forEach(function(x){switch(x){case 1:m.ctx.fillRect(p.bounds.left,Math.round(p.bounds.top+d),p.bounds.width,1);break;case 2:m.ctx.fillRect(p.bounds.left,Math.round(p.bounds.top),p.bounds.width,1);break;case 3:m.ctx.fillRect(p.bounds.left,Math.ceil(p.bounds.top+u),p.bounds.width,1);break}}));break;case 1:s.webkitTextStrokeWidth&&p.text.trim().length&&(m.ctx.strokeStyle=$a(s.webkitTextStrokeColor),m.ctx.lineWidth=s.webkitTextStrokeWidth,m.ctx.lineJoin=window.chrome?"miter":"round",m.ctx.strokeText(p.text,p.bounds.left,p.bounds.top+d)),m.ctx.strokeStyle="",m.ctx.lineWidth=0,m.ctx.lineJoin="miter";break}})}),[2]})})},t.prototype.renderReplacedElement=function(r,s,a){if(a&&r.intrinsicWidth>0&&r.intrinsicHeight>0){var i=s_(r),o=n_(s);this.path(o),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(a,0,0,r.intrinsicWidth,r.intrinsicHeight,i.left,i.top,i.width,i.height),this.ctx.restore(
vendor: 5,031 bytes, line 1474
1474)}},t.prototype.renderNodeContent=function(r){return Ui(this,void 0,void 0,function(){var s,a,i,o,l,c,b,b,d,u,h,m,w,f,p,j,A,v,x,b,y,w,j;return yi(this,function(N){switch(N.label){case 0:this.applyEffects(r.getEffects(4)),s=r.container,a=r.curves,i=s.styles,o=0,l=s.textNodes,N.label=1;case 1:return o<l.length?(c=l[o],[4,this.renderTextNode(c,i)]):[3,4];case 2:N.sent(),N.label=3;case 3:return o++,[3,1];case 4:if(!(s instanceof Vne))return[3,8];N.label=5;case 5:return N.trys.push([5,7,,8]),[4,this.context.cache.match(s.src)];case 6:return b=N.sent(),this.renderReplacedElement(s,a,b),[3,8];case 7:return N.sent(),this.context.logger.error("Error loading image "+s.src),[3,8];case 8:if(s instanceof Gne&&this.renderReplacedElement(s,a,s.canvas),!(s instanceof qne))return[3,12];N.label=9;case 9:return N.trys.push([9,11,,12]),[4,this.context.cache.match(s.svg)];case 10:return b=N.sent(),this.renderReplacedElement(s,a,b),[3,12];case 11:return N.sent(),this.context.logger.error("Error loading svg "+s.svg.substring(0,255)),[3,12];case 12:return s instanceof Jne&&s.tree?(d=new t(this.context,{scale:this.options.scale,backgroundColor:s.backgroundColor,x:0,y:0,width:s.width,height:s.height}),[4,d.render(s.tree)]):[3,14];case 13:u=N.sent(),s.width&&s.height&&this.ctx.drawImage(u,0,0,s.width,s.height,s.bounds.left,s.bounds.top,s.bounds.width,s.bounds.height),N.label=14;case 14:if(s instanceof g6&&(h=Math.min(s.bounds.width,s.bounds.height),s.type===XN?s.checked&&(this.ctx.save(),this.path([new bt(s.bounds.left+h*.39363,s.bounds.top+h*.79),new bt(s.bounds.left+h*.16,s.bounds.top+h*.5549),new bt(s.bounds.left+h*.27347,s.bounds.top+h*.44071),new bt(s.bounds.left+h*.39694,s.bounds.top+h*.5649),new bt(s.bounds.left+h*.72983,s.bounds.top+h*.23),new bt(s.bounds.left+h*.84,s.bounds.top+h*.34085),new bt(s.bounds.left+h*.39363,s.bounds.top+h*.79)]),this.ctx.fillStyle=$a(WH),this.ctx.fill(),this.ctx.restore()):s.type===ZN&&s.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(s.bounds.left+h/2,s.bounds.top+h/2,h/4,0,Math.PI*2,!0),this.ctx.fillStyle=$a(WH),this.ctx.fill(),this.ctx.restore())),Cat(s)&&s.value.length){switch(m=this.createFontStyle(i),w=m[0],f=m[1],p=this.fontMetrics.getMetrics(w,f).baseline,this.ctx.font=w,this.ctx.fillStyle=$a(i.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=kat(s.styles.textAlign),j=s_(s),A=0,s.styles.textAlign){case 1:A+=j.width/2;break;case 2:A+=j.width;break}v=j.add(A,0,0,-j.height/2+1),this.ctx.save(),this.path([new bt(j.left,j.top),new bt(j.left+j.width,j.top),new bt(j.left+j.width,j.top+j.height),new bt(j.left,j.top+j.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new Ev(s.value,v),i.letterSpacing,p),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!Fa(s.styles.display,2048))return[3,20];if(s.styles.listStyleImage===null)return[3,19];if(x=s.styles.listStyleImage,x.type!==0)return[3,18];b=void 0,y=x.url,N.label=15;case 15:return N.trys.push([15,17,,18]),[4,this.context.cache.match(y)];case 16:return b=N.sent(),this.ctx.drawImage(b,s.bounds.left-(b.width+10),s.bounds.top),[3,18];case 17:return N.sent(),this.context.logger.error("Error loading list-style-image "+y),[3,18];case 18:return[3,20];case 19:r.listValue&&s.styles.listStyleType!==-1&&(w=this.createFontStyle(i)[0],this.ctx.font=w,this.ctx.fillStyle=$a(i.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",j=new Iu(s.bounds.left,s.bounds.top+ss(s.styles.paddingTop,s.bounds.width),s.bounds.width,PH(i.lineHeight,i.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new Ev(r.listValue,j),i.letterSpacing,PH(i.lineHeight,i.fontSize.number)/2+2),this.ctx.textBaseline="bottom",this.ctx.textAlign="left"),N.label=20;case 20:return[2]}})})},t.prototype.renderStackContent=function(r){return Ui(this,void 0,void 0,function(){var s,a,x,i,o,x,l,c,x,d,u,x,h,m,x,f,p,x,A,v,x;return yi(this,function(b){switch(b.label){case 0:if(Fa(r.element.container.flags,16))debugger;return[4,this.renderNodeBackgroundAndBorders(r.element)];case 1:b.sent(),s=0,a=r.negativeZIndex,b.label=2;case 2:return s<a.length?(x=a[s],[4,this.renderStack(x)]):[3,5];case 3:b.sent(),b.label=4;case 4:return s++,[3,2];case 5:return[4,this.renderNodeContent(r.element)];case 6:b.sent(),i=0,o=r.nonInlineLevel,b.label=7;case 7:return i<o.length?(x=o[i],[4,this.renderNode(x)]):[3,10];case 8:b.sent(),b.label=9;case 9:return i++,[3,7];case 10:l=0,c=r.nonPositionedFloats,b.label=11;case 11:return l<c.length?(x=c[l],[4,this.renderStack(x)]):[3,14];case 12:b.sent(),b.label=13;case 13:return l++,[3,11];case 14:d=0,u=r.nonPositionedInlineLevel,b.label=15;case 15:return d<u.length?(x=u[d],[4,this.renderStack(x)]):[3,18];case 16:b.sent(),b.label=17;case 17:return d++,[3,15];case 18:h=0,m=r.inlineLevel,b.label=19;case 19:return h<m.length?(x=m[h],[4,this.renderNode(x)]):[3,22];case 20:b.sent(),b.label=21;case 21:return h++,[3,19];case 22:f=0,p=r.zeroOrAutoZIndexOrTransformedOrOpacity,b.label=23;case 23:return f<p.length?(x=p[f],[4,this.renderStack(x)]):[3,26];
vendor: 6,015 bytes, line 1474
1474case 24:b.sent(),b.label=25;case 25:return f++,[3,23];case 26:A=0,v=r.positiveZIndex,b.label=27;case 27:return A<v.length?(x=v[A],[4,this.renderStack(x)]):[3,30];case 28:b.sent(),b.label=29;case 29:return A++,[3,27];case 30:return[2]}})})},t.prototype.mask=function(r){this.ctx.beginPath(),this.ctx.moveTo(0,0),this.ctx.lineTo(this.canvas.width,0),this.ctx.lineTo(this.canvas.width,this.canvas.height),this.ctx.lineTo(0,this.canvas.height),this.ctx.lineTo(0,0),this.formatPath(r.slice(0).reverse()),this.ctx.closePath()},t.prototype.path=function(r){this.ctx.beginPath(),this.formatPath(r),this.ctx.closePath()},t.prototype.formatPath=function(r){var s=this;r.forEach(function(a,i){var o=Tl(a)?a.start:a;i===0?s.ctx.moveTo(o.x,o.y):s.ctx.lineTo(o.x,o.y),Tl(a)&&s.ctx.bezierCurveTo(a.startControl.x,a.startControl.y,a.endControl.x,a.endControl.y,a.end.x,a.end.y)})},t.prototype.renderRepeat=function(r,s,a,i){this.path(r),this.ctx.fillStyle=s,this.ctx.translate(a,i),this.ctx.fill(),this.ctx.translate(-a,-i)},t.prototype.resizeImage=function(r,s,a){var i;if(r.width===s&&r.height===a)return r;var o=(i=this.canvas.ownerDocument)!==null&&i!==void 0?i:document,l=o.createElement("canvas");l.width=Math.max(1,s),l.height=Math.max(1,a);var c=l.getContext("2d");return c.drawImage(r,0,0,r.width,r.height,0,0,s,a),l},t.prototype.renderBackgroundImage=function(r){return Ui(this,void 0,void 0,function(){var s,a,i,o,l,c;return yi(this,function(d){switch(d.label){case 0:s=r.styles.backgroundImage.length-1,a=function(u){var h,m,f,E,M,I,L,P,S,p,E,M,I,L,P,A,v,x,b,y,w,j,N,_,S,C,E,T,B,L,P,F,M,I,$,V,R,Q,U,D,q,G;return yi(this,function(Y){switch(Y.label){case 0:if(u.type!==0)return[3,5];h=void 0,m=u.url,Y.label=1;case 1:return Y.trys.push([1,3,,4]),[4,i.context.cache.match(m)];case 2:return h=Y.sent(),[3,4];case 3:return Y.sent(),i.context.logger.error("Error loading background-image "+m),[3,4];case 4:return h&&(f=ME(r,s,[h.width,h.height,h.width/h.height]),E=f[0],M=f[1],I=f[2],L=f[3],P=f[4],S=i.ctx.createPattern(i.resizeImage(h,L,P),"repeat"),i.renderRepeat(E,S,M,I)),[3,6];case 5:urt(u)?(p=ME(r,s,[null,null,null]),E=p[0],M=p[1],I=p[2],L=p[3],P=p[4],A=irt(u.angle,L,P),v=A[0],x=A[1],b=A[2],y=A[3],w=A[4],j=document.createElement("canvas"),j.width=L,j.height=P,N=j.getContext("2d"),_=N.createLinearGradient(x,y,b,w),BH(u.stops,v).forEach(function(K){return _.addColorStop(K.stop,$a(K.color))}),N.fillStyle=_,N.fillRect(0,0,L,P),L>0&&P>0&&(S=i.ctx.createPattern(j,"repeat"),i.renderRepeat(E,S,M,I))):hrt(u)&&(C=ME(r,s,[null,null,null]),E=C[0],T=C[1],B=C[2],L=C[3],P=C[4],F=u.position.length===0?[f6]:u.position,M=ss(F[0],L),I=ss(F[F.length-1],P),$=ort(u,M,I,L,P),V=$[0],R=$[1],V>0&&R>0&&(Q=i.ctx.createRadialGradient(T+M,B+I,0,T+M,B+I,V),BH(u.stops,V*2).forEach(function(K){return Q.addColorStop(K.stop,$a(K.color))}),i.path(E),i.ctx.fillStyle=Q,V!==R?(U=r.bounds.left+.5*r.bounds.width,D=r.bounds.top+.5*r.bounds.height,q=R/V,G=1/q,i.ctx.save(),i.ctx.translate(U,D),i.ctx.transform(1,0,0,q,0,0),i.ctx.translate(-U,-D),i.ctx.fillRect(T,G*(B-D)+D,L,P*G),i.ctx.restore()):i.ctx.fill())),Y.label=6;case 6:return s--,[2]}})},i=this,o=0,l=r.styles.backgroundImage.slice(0).reverse(),d.label=1;case 1:return o<l.length?(c=l[o],[5,a(c)]):[3,4];case 2:d.sent(),d.label=3;case 3:return o++,[3,1];case 4:return[2]}})})},t.prototype.renderSolidBorder=function(r,s,a){return Ui(this,void 0,void 0,function(){return yi(this,function(i){return this.path(o9(a,s)),this.ctx.fillStyle=$a(r),this.ctx.fill(),[2]})})},t.prototype.renderDoubleBorder=function(r,s,a,i){return Ui(this,void 0,void 0,function(){var o,l;return yi(this,function(c){switch(c.label){case 0:return s<3?[4,this.renderSolidBorder(r,a,i)]:[3,2];case 1:return c.sent(),[2];case 2:return o=pat(i,a),this.path(o),this.ctx.fillStyle=$a(r),this.ctx.fill(),l=Aat(i,a),this.path(l),this.ctx.fill(),[2]}})})},t.prototype.renderNodeBackgroundAndBorders=function(r){return Ui(this,void 0,void 0,function(){var s,a,i,o,l,c,d,u,h=this;return yi(this,function(m){switch(m.label){case 0:return this.applyEffects(r.getEffects(2)),s=r.container.styles,a=!$h(s.backgroundColor)||s.backgroundImage.length,i=[{style:s.borderTopStyle,color:s.borderTopColor,width:s.borderTopWidth},{style:s.borderRightStyle,color:s.borderRightColor,width:s.borderRightWidth},{style:s.borderBottomStyle,color:s.borderBottomColor,width:s.borderBottomWidth},{style:s.borderLeftStyle,color:s.borderLeftColor,width:s.borderLeftWidth}],o=Sat(oA(s.backgroundClip,0),r.curves),a||s.boxShadow.length?(this.ctx.save(),this.path(o),this.ctx.clip(),$h(s.backgroundColor)||(this.ctx.fillStyle=$a(s.backgroundColor),this.ctx.fill()),[4,this.renderBackgroundImage(r.container)]):[3,2];case 1:m.sent(),this.ctx.restore(),s.boxShadow.slice(0).reverse().forEach(function(f){h.ctx.save();var p=r_(r.curves),A=f.inset?0:Nat,v=fat(p,-A+(f.inset?1:-1)*f.spread.number,(f.inset?1:-1)*f.spread.number,f.spread.number*(f.inset?-2:2),f.spread.number*(f.inset?-2:2));f.inset?(h.path(p),h.ctx.clip(),h.mask(v)):(h.mask(p),h.ctx.clip(),h.path(v)),h.ctx.shadowOffsetX=f.offsetX.number+A,h.ctx.shadowOffsetY=f.offsetY.number,h.ctx.shadowColor=$a(f.color),h.ctx.shadowBlur=f.blur.number,h.ctx.fillStyle=f.inset?$a(f.color):"rgba(0,0,0,1)",h.ctx.fill(),h.ctx.restore()}),m.label=2;case 2:l=0,c=0,d=i,m.label=3;case 3:return c<d.length?(u=d[c],u.style!==0&&!$h(u.color)&&u.width>0?u.style!==2?[3,5]:[4,this.renderDashedDottedBorder(u.color,u.width,l,r.curves,2)]:[3,11]):[3,13];case 4:return m.sent(),[3,11];case 5:return u.style!==3?[3,7]:[4,this.renderDashedDottedBorder(u.color,u.width,l,r.curves,3)];case 6:return m.sent(),[3,11];case 7:return u.style!==4?[3,9]:[4,this.renderDoubleBorder(u.color,u.width,l,r.curves)];case 8:return m.sent(),[3,11];case 9:return[4,this.renderSolidBorder(u.color,l,r.curves)];case 10:m.sent(),m.label=11;case 11:l++,m.label=12;case 12:return c++,[3,3];case 13:return[2]}})})},t.prototype.renderDashedDottedBorder=function(r,s,a,i,o){return Ui(this,void 0,void 0,function(){var l,c,d,u,h,m,f,p,A,v,x,b,
vendor: 9,100 bytes, line 1474
1474y,w,j,N,j,N;return yi(this,function(_){return this.ctx.save(),l=gat(i,a),c=o9(i,a),o===2&&(this.path(c),this.ctx.clip()),Tl(c[0])?(d=c[0].start.x,u=c[0].start.y):(d=c[0].x,u=c[0].y),Tl(c[1])?(h=c[1].end.x,m=c[1].end.y):(h=c[1].x,m=c[1].y),a===0||a===2?f=Math.abs(d-h):f=Math.abs(u-m),this.ctx.beginPath(),o===3?this.formatPath(l):this.formatPath(c.slice(0,2)),p=s<3?s*3:s*2,A=s<3?s*2:s,o===3&&(p=s,A=s),v=!0,f<=p*2?v=!1:f<=p*2+A?(x=f/(2*p+A),p*=x,A*=x):(b=Math.floor((f+A)/(p+A)),y=(f-b*p)/(b-1),w=(f-(b+1)*p)/b,A=w<=0||Math.abs(A-y)<Math.abs(A-w)?y:w),v&&(o===3?this.ctx.setLineDash([0,p+A]):this.ctx.setLineDash([p,A])),o===3?(this.ctx.lineCap="round",this.ctx.lineWidth=s):this.ctx.lineWidth=s*2+1.1,this.ctx.strokeStyle=$a(r),this.ctx.stroke(),this.ctx.setLineDash([]),o===2&&(Tl(c[0])&&(j=c[3],N=c[0],this.ctx.beginPath(),this.formatPath([new bt(j.end.x,j.end.y),new bt(N.start.x,N.start.y)]),this.ctx.stroke()),Tl(c[1])&&(j=c[1],N=c[2],this.ctx.beginPath(),this.formatPath([new bt(j.end.x,j.end.y),new bt(N.start.x,N.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},t.prototype.render=function(r){return Ui(this,void 0,void 0,function(){var s;return yi(this,function(a){switch(a.label){case 0:return this.options.backgroundColor&&(this.ctx.fillStyle=$a(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height)),s=mat(r),[4,this.renderStack(s)];case 1:return a.sent(),this.applyEffects([]),[2,this.canvas]}})})},t}(fse),Cat=function(e){return e instanceof Yne||e instanceof Wne?!0:e instanceof g6&&e.type!==ZN&&e.type!==XN},Sat=function(e,t){switch(e){case 0:return r_(t);case 2:return lat(t);case 1:default:return n_(t)}},kat=function(e){switch(e){case 1:return"center";case 2:return"right";case 0:default:return"left"}},Eat=["-apple-system","system-ui"],Bat=function(e){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?e.filter(function(t){return Eat.indexOf(t)===-1}):e},Tat=function(e){Tc(t,e);function t(r,s){var a=e.call(this,r,s)||this;return a.canvas=s.canvas?s.canvas:document.createElement("canvas"),a.ctx=a.canvas.getContext("2d"),a.options=s,a.canvas.width=Math.floor(s.width*s.scale),a.canvas.height=Math.floor(s.height*s.scale),a.canvas.style.width=s.width+"px",a.canvas.style.height=s.height+"px",a.ctx.scale(a.options.scale,a.options.scale),a.ctx.translate(-s.x,-s.y),a.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized ("+s.width+"x"+s.height+" at "+s.x+","+s.y+") with scale "+s.scale),a}return t.prototype.render=function(r){return Ui(this,void 0,void 0,function(){var s,a;return yi(this,function(i){switch(i.label){case 0:return s=uP(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,r),[4,Pat(s)];case 1:return a=i.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=$a(this.options.backgroundColor),this.ctx.fillRect(0,0,this.options.width*this.options.scale,this.options.height*this.options.scale)),this.ctx.drawImage(a,-this.options.x*this.options.scale,-this.options.y*this.options.scale),[2,this.canvas]}})})},t}(fse),Pat=function(e){return new Promise(function(t,r){var s=new Image;s.onload=function(){t(s)},s.onerror=r,s.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(e))})},Iat=function(){function e(t){var r=t.id,s=t.enabled;this.id=r,this.enabled=s,this.start=Date.now()}return e.prototype.debug=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];this.enabled&&(typeof window<"u"&&window.console&&typeof console.debug=="function"?console.debug.apply(console,j1([this.id,this.getTime()+"ms"],t)):this.info.apply(this,t))},e.prototype.getTime=function(){return Date.now()-this.start},e.prototype.info=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];this.enabled&&typeof window<"u"&&window.console&&typeof console.info=="function"&&console.info.apply(console,j1([this.id,this.getTime()+"ms"],t))},e.prototype.warn=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];this.enabled&&(typeof window<"u"&&window.console&&typeof console.warn=="function"?console.warn.apply(console,j1([this.id,this.getTime()+"ms"],t)):this.info.apply(this,t))},e.prototype.error=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];this.enabled&&(typeof window<"u"&&window.console&&typeof console.error=="function"?console.error.apply(console,j1([this.id,this.getTime()+"ms"],t)):this.info.apply(this,t))},e.instances={},e}(),Oat=function(){function e(t,r){var s;this.windowBounds=r,this.instanceName="#"+e.instanceCount++,this.logger=new Iat({id:this.instanceName,enabled:t.logging}),this.cache=(s=t.cache)!==null&&s!==void 0?s:new eat(this,t)}return e.instanceCount=1,e}(),mse=function(e,t){return t===void 0&&(t={}),Fat(e,t)};typeof window<"u"&&ose.setContext(window);var Fat=function(e,t){return Ui(void 0,void 0,void 0,function(){var r,s,a,i,o,l,c,d,u,h,m,f,p,A,v,x,b,y,w,j,_,N,_,S,C,E,T,B,L,P,F,M,I,$,V,R,Q,U,D,q;return yi(this,function(G){switch(G.label){case 0:if(!e||typeof e!="object")return[2,Promise.reject("Invalid element provided as first argument")];if(r=e.ownerDocument,!r)throw new Error("Element is not attached to a Document");if(s=r.defaultView,!s)throw new Error("Document is not attached to a Window");return a={allowTaint:(S=t.allowTaint)!==null&&S!==void 0?S:!1,imageTimeout:(C=t.imageTimeout)!==null&&C!==void 0?C:15e3,proxy:t.proxy,useCORS:(E=t.useCORS)!==null&&E!==void 0?E:!1},i=Y3({logging:(T=t.logging)!==null&&T!==void 0?T:!0,cache:t.cache},a),o={windowWidth:(B=t.windowWidth)!==null&&B!==void 0?B:s.innerWidth,windowHeight:(L=t.windowHeight)!==null&&L!==void 0?L:s.innerHeight,scrollX:(P=t.scrollX)!==null&&P!==void 0?P:s.pageXOffset,scrollY:(F=t.scrollY)!==null&&F!==void 0?F:s.pageYOffset},l=new Iu(o.scrollX,o.scrollY,o.windowWidth,o.windowHeight),c=new Oat(i,l),d=(M=t.foreignObjectRendering)!==null&&M!==void 0?M:!1,u={allowTaint:(I=t.allowTaint)!==null&&I!==void 0?I:!1,onclone:t.onclone,ignoreElements:t.ignoreElements,inlineImages:d,copyStyles:d},c.logger.debug("Starting document clone with size "+l.width+"x"+l.height+" scrolled to "+-l.left+","+-l.top),h=new s9(c,e,u),m=h.clonedReferenceElement,m?[4,h.toIFrame(r,l)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return f=G.sent(),p=x6(m)||Dst(m)?het(m.ownerDocument):HS(c,m),A=p.width,v=p.height,x=p.left,b=p.top,y=Lat(c,m,t.backgroundColor),w={canvas:t.canvas,backgroundColor:y,scale:(V=($=t.scale)!==null&&$!==void 0?$:s.devicePixelRatio)!==null&&V!==void 0?V:1,x:((R=t.x)!==null&&R!==void 0?R:0)+x,y:((Q=t.y)!==null&&Q!==void 0?Q:0)+b,width:(U=t.width)!==null&&U!==void 0?U:Math.ceil(A),height:(D=t.height)!==null&&D!==void 0?D:Math.ceil(v)},d?(c.logger.debug("Document cloned, using foreign object rendering"),_=new Tat(c,w),[4,_.render(m)]):[3,3];case 2:return j=G.sent(),[3,5];case 3:return c.logger.debug("Document cloned, element located at "+x+","+b+" with size "+A+"x"+v+" using computed rendering"),c.logger.debug("Starting DOM parsing"),N=Zne(c,m),y===N.styles.backgroundColor&&(N.styles.backgroundColor=wu.TRANSPARENT),c.logger.debug("Starting renderer for element at "+w.x+","+w.y+" with size "+w.width+"x"+w.height),_=new _at(c,w),[4,_.render(N)];case 4:j=G.sent(),G.label=5;case 5:return(!((q=t.removeContainer)!==null&&q!==void 0)||q)&&(s9.destroy(f)||c.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),c.logger.debug("Finished rendering"),[2,j]}})})},Lat=function(e,t,r){var s=t.ownerDocument,a=s.documentElement?Sv(e,getComputedStyle(s.documentElement).backgroundColor):wu.TRANSPARENT,i=s.body?Sv(e,getComputedStyle(s.body).backgroundColor):wu.TRANSPARENT,o=typeof r=="string"?Sv(e,r):r===null?wu.TRANSPARENT:4294967295;return t===s.documentElement?$h(a)?$h(i)?o:i:a:o};const Dat=Object.freeze(Object.defineProperty({__proto__:null,default:mse},Symbol.toStringTag,{value:"Module"}));function On(e){"@babel/helpers - typeof";return On=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},On(e)}var kc=Uint8Array,qo=Uint16Array,v6=Int32Array,b6=new kc([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),y6=new kc([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),c9=new kc([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),pse=function(e,t){for(var r=new qo(31),s=0;s<31;++s)r[s]=t+=1<<e[s-1];for(var a=new v6(r[30]),s=1;s<30;++s)for(var i=r[s];i<r[s+1];++i)a[i]=i-r[s]<<5|s;return{b:r,r:a}},Ase=pse(b6,2),Rat=Ase.b,xP=Ase.r;Rat[28]=258,xP[258]=28;var Uat=pse(y6,0),d9=Uat.r,vP=new qo(32768);for(var us=0;us<32768;++us){var oh=(us&43690)>>1|(us&21845)<<1;oh=(oh&52428)>>2|(oh&13107)<<2,oh=(oh&61680)>>4|(oh&3855)<<4,vP[us]=((oh&65280)>>8|(oh&255)<<8)>>1}var Tv=function(e,t,r){for(var s=e.length,a=0,i=new qo(t);a<s;++a)e[a]&&++i[e[a]-1];var o=new qo(t);for(a=1;a<t;++a)o[a]=o[a-1]+i[a-1]<<1;var l;if(r){l=new qo(1<<t);var c=15-t;for(a=0;a<s;
vendor: 4,523 bytes, line 1474
1474++a)if(e[a])for(var d=a<<4|e[a],u=t-e[a],h=o[e[a]-1]++<<u,m=h|(1<<u)-1;h<=m;++h)l[vP[h]>>c]=d}else for(l=new qo(s),a=0;a<s;++a)e[a]&&(l[a]=vP[o[e[a]-1]++]>>15-e[a]);return l},qm=new kc(288);for(var us=0;us<144;++us)qm[us]=8;for(var us=144;us<256;++us)qm[us]=9;for(var us=256;us<280;++us)qm[us]=7;for(var us=280;us<288;++us)qm[us]=8;var a_=new kc(32);for(var us=0;us<32;++us)a_[us]=5;var Mat=Tv(qm,9,0),$at=Tv(a_,5,0),gse=function(e){return(e+7)/8|0},Qat=function(e,t,r){return(r==null||r>e.length)&&(r=e.length),new kc(e.subarray(t,r))},Jd=function(e,t,r){r<<=t&7;var s=t/8|0;e[s]|=r,e[s+1]|=r>>8},Ix=function(e,t,r){r<<=t&7;var s=t/8|0;e[s]|=r,e[s+1]|=r>>8,e[s+2]|=r>>16},$E=function(e,t){for(var r=[],s=0;s<e.length;++s)e[s]&&r.push({s,f:e[s]});var a=r.length,i=r.slice();if(!a)return{t:vse,l:0};if(a==1){var o=new kc(r[0].s+1);return o[r[0].s]=1,{t:o,l:1}}r.sort(function(j,N){return j.f-N.f}),r.push({s:-1,f:25001});var l=r[0],c=r[1],d=0,u=1,h=2;for(r[0]={s:-1,f:l.f+c.f,l,r:c};u!=a-1;)l=r[r[d].f<r[h].f?d++:h++],c=r[d!=u&&r[d].f<r[h].f?d++:h++],r[u++]={s:-1,f:l.f+c.f,l,r:c};for(var m=i[0].s,s=1;s<a;++s)i[s].s>m&&(m=i[s].s);var f=new qo(m+1),p=bP(r[u-1],f,0);if(p>t){var s=0,A=0,v=p-t,x=1<<v;for(i.sort(function(N,_){return f[_.s]-f[N.s]||N.f-_.f});s<a;++s){var b=i[s].s;if(f[b]>t)A+=x-(1<<p-f[b]),f[b]=t;else break}for(A>>=v;A>0;){var y=i[s].s;f[y]<t?A-=1<<t-f[y]++-1:++s}for(;s>=0&&A;--s){var w=i[s].s;f[w]==t&&(--f[w],++A)}p=t}return{t:new kc(f),l:p}},bP=function(e,t,r){return e.s==-1?Math.max(bP(e.l,t,r+1),bP(e.r,t,r+1)):t[e.s]=r},u9=function(e){for(var t=e.length;t&&!e[--t];);for(var r=new qo(++t),s=0,a=e[0],i=1,o=function(c){r[s++]=c},l=1;l<=t;++l)if(e[l]==a&&l!=t)++i;else{if(!a&&i>2){for(;i>138;i-=138)o(32754);i>2&&(o(i>10?i-11<<5|28690:i-3<<5|12305),i=0)}else if(i>3){for(o(a),--i;i>6;i-=6)o(8304);i>2&&(o(i-3<<5|8208),i=0)}for(;i--;)o(a);i=1,a=e[l]}return{c:r.subarray(0,s),n:t}},Ox=function(e,t){for(var r=0,s=0;s<t.length;++s)r+=e[s]*t[s];return r},xse=function(e,t,r){var s=r.length,a=gse(t+2);e[a]=s&255,e[a+1]=s>>8,e[a+2]=e[a]^255,e[a+3]=e[a+1]^255;for(var i=0;i<s;++i)e[a+i+4]=r[i];return(a+4+s)*8},h9=function(e,t,r,s,a,i,o,l,c,d,u){Jd(t,u++,r),++a[256];for(var h=$E(a,15),m=h.t,f=h.l,p=$E(i,15),A=p.t,v=p.l,x=u9(m),b=x.c,y=x.n,w=u9(A),j=w.c,N=w.n,_=new qo(19),S=0;S<b.length;++S)++_[b[S]&31];for(var S=0;S<j.length;++S)++_[j[S]&31];for(var C=$E(_,7),E=C.t,T=C.l,B=19;B>4&&!E[c9[B-1]];--B);var L=d+5<<3,P=Ox(a,qm)+Ox(i,a_)+o,F=Ox(a,m)+Ox(i,A)+o+14+3*B+Ox(_,E)+2*_[16]+3*_[17]+7*_[18];if(c>=0&&L<=P&&L<=F)return xse(t,u,e.subarray(c,c+d));var M,I,$,V;if(Jd(t,u,1+(F<P)),u+=2,F<P){M=Tv(m,f,0),I=m,$=Tv(A,v,0),V=A;var R=Tv(E,T,0);Jd(t,u,y-257),Jd(t,u+5,N-1),Jd(t,u+10,B-4),u+=14;for(var S=0;S<B;++S)Jd(t,u+3*S,E[c9[S]]);u+=3*B;for(var Q=[b,j],U=0;U<2;++U)for(var D=Q[U],S=0;S<D.length;++S){var q=D[S]&31;Jd(t,u,R[q]),u+=E[q],q>15&&(Jd(t,u,D[S]>>5&127),u+=D[S]>>12)}}else M=Mat,I=qm,$=$at,V=a_;for(var S=0;S<l;++S){var G=s[S];if(G>255){var q=G>>18&31;Ix(t,u,M[q+257]),u+=I[q+257],q>7&&(Jd(t,u,G>>23&31),u+=b6[q]);var Y=G&31;Ix(t,u,$[Y]),u+=V[Y],Y>3&&(Ix(t,u,G>>5&8191),u+=y6[Y])}else Ix(t,u,M[G]),u+=I[G]}return Ix(t,u,M[256]),u+I[256]},Hat=new v6([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),vse=new kc(0),zat=function(e,t,r,s,a,i){var o=i.z||e.length,l=new kc(s+o+5*(1+Math.ceil(o/7e3))+a),c=l.subarray(s,l.length-a),d=i.l,u=(i.r||0)&7;if(t){u&&(c[0]=i.r>>3);for(var h=Hat[t-1],m=h>>13,f=h&8191,p=(1<<r)-1,A=i.p||new qo(32768),v=i.h||new qo(p+1),x=Math.ceil(r/3),b=2*x,y=function(he){return(e[he]^e[he+1]<<x^e[he+2]<<b)&p},w=new v6(25e3),j=new qo(288),N=new qo(32),_=0,S=0,C=i.i||0,E=0,T=i.w||0,B=0;C+2<o;++C){var L=y(C),P=C&32767,F=v[L];if(A[P]=F,v[L]=P,T<=C){var M=o-C;if((_>7e3||E>24576)&&(M>423||!d)){u=h9(e,c,0,w,j,N,S,E,B,C-B,u),E=_=S=0,B=C;for(var I=0;I<286;++I)j[I]=0;for(var I=0;I<30;++I)N[I]=0}var $=2,V=0,R=f,Q=P-F&32767;if(M>2&&L==y(C-Q))for(var U=Math.min(m,M)-1,D=Math.min(32767,C),q=Math.min(258,M);Q<=D&&--R&&P!=F;){if(e[C+$]==e[C+$-Q]){for(var G=0;G<q&&e[C+G]==e[C+G-Q];++G);if(G>$){if($=G,V=Q,G>U)break;for(var Y=Math.min(Q,G-2),K=0,I=0;I<Y;++I){var X=C-Q+I&32767,ne=A[X],ae=X-ne&32767;ae>K&&(K=ae,F=X)}}}P=F,F=A[P],Q+=P-F&32767}if(V){w[E++]=268435456|xP[$]<<18|d9[V];var J=xP[$]&31,W=d9[V]&31;S+=b6[J]+y6[W],++j[257+J],++N[W],T=C+$,++_}else w[E++]=e[C],++j[e[C]]}}for(C=Math.max(C,T);C<o;++C)w[E++]=e[C],++j[e[C]];u=h9(e,c,d,w,j,N,S,E,B,C-B,u),d||(i.r=u&7|c[u/8|0]<<3,u-=7,i.h=v,i.p=A,i.i=C,i.w=T)}else{for(var C=i.w||0;C<o+d;C+=65535){var ie=C+65535;ie>
vendor: 8,014 bytes, lines 1474-1475
1474=o&&(c[u/8|0]=d,ie=o),u=xse(c,u+1,e.subarray(C,ie))}i.i=o}return Qat(l,0,s+gse(u)+a)},bse=function(){var e=1,t=0;return{p:function(r){for(var s=e,a=t,i=r.length|0,o=0;o!=i;){for(var l=Math.min(o+2655,i);o<l;++o)a+=s+=r[o];s=(s&65535)+15*(s>>16),a=(a&65535)+15*(a>>16)}e=s,t=a},d:function(){return e%=65521,t%=65521,(e&255)<<24|(e&65280)<<8|(t&255)<<8|t>>8}}},Vat=function(e,t,r,s,a){if(!a&&(a={l:1},t.dictionary)){var i=t.dictionary.subarray(-32768),o=new kc(i.length+e.length);o.set(i),o.set(e,i.length),e=o,a.w=i.length}return zat(e,t.level==null?6:t.level,t.mem==null?a.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+t.mem,r,s,a)},yse=function(e,t,r){for(;r;++t)e[t]=r,r>>>=8},Gat=function(e,t){var r=t.level,s=r==0?0:r<6?1:r==9?3:2;if(e[0]=120,e[1]=s<<6|(t.dictionary&&32),e[1]|=31-(e[0]<<8|e[1])%31,t.dictionary){var a=bse();a.p(t.dictionary),yse(e,2,a.d())}};function yP(e,t){t||(t={});var r=bse();r.p(e);var s=Vat(e,t,t.dictionary?6:2,4);return Gat(s,t),yse(s,s.length-4,r.d()),s}var qat=typeof TextDecoder<"u"&&new TextDecoder,Kat=0;try{qat.decode(vse,{stream:!0}),Kat=1}catch{}function Wat(e){if(Array.isArray(e))return e}function Yat(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var s,a,i,o,l=[],c=!0,d=!1;try{if(i=(r=r.call(e)).next,t!==0)for(;!(c=(s=i.call(r)).done)&&(l.push(s.value),l.length!==t);c=!0);}catch(u){d=!0,a=u}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(d)throw a}}return l}}function f9(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,s=Array(t);r<t;r++)s[r]=e[r];return s}function Jat(e,t){if(e){if(typeof e=="string")return f9(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f9(e,t):void 0}}function Xat(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1475In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function m9(e,t){return Wat(e)||Yat(e,t)||Jat(e,t)||Xat()}function p9(e,t="utf8"){return new TextDecoder(t).decode(e)}const Zat=new TextEncoder;function eit(e){return Zat.encode(e)}const tit=1024*8,rit=(()=>{const e=new Uint8Array(4),t=new Uint32Array(e.buffer);return!((t[0]=1)&e[0])})(),QE={int8:globalThis.Int8Array,uint8:globalThis.Uint8Array,int16:globalThis.Int16Array,uint16:globalThis.Uint16Array,int32:globalThis.Int32Array,uint32:globalThis.Uint32Array,uint64:globalThis.BigUint64Array,int64:globalThis.BigInt64Array,float32:globalThis.Float32Array,float64:globalThis.Float64Array};class w6{constructor(t=tit,r={}){Yt(this,"buffer");Yt(this,"byteLength");Yt(this,"byteOffset");Yt(this,"length");Yt(this,"offset");Yt(this,"lastWrittenByte");Yt(this,"littleEndian");Yt(this,"_data");Yt(this,"_mark");Yt(this,"_marks");let s=!1;typeof t=="number"?t=new ArrayBuffer(t):(s=!0,this.lastWrittenByte=t.byteLength);const a=r.offset?r.offset>>>0:0,i=t.byteLength-a;let o=a;(ArrayBuffer.isView(t)||t instanceof w6)&&(t.byteLength!==t.buffer.byteLength&&(o=t.byteOffset+a),t=t.buffer),s?this.lastWrittenByte=i:this.lastWrittenByte=0,this.buffer=t,this.length=i,this.byteLength=i,this.byteOffset=o,this.offset=0,this.littleEndian=!0,this._data=new DataView(this.buffer,o,i),this._mark=0,this._marks=[]}available(t=1){return this.offset+t<=this.length}isLittleEndian(){return this.littleEndian}setLittleEndian(){return this.littleEndian=!0,this}isBigEndian(){return!this.littleEndian}setBigEndian(){return this.littleEndian=!1,this}skip(t=1){return this.offset+=t,this}back(t=1){return this.offset-=t,this}seek(t){return this.offset=t,this}mark(){return this._mark=this.offset,this}reset(){return this.offset=this._mark,this}pushMark(){return this._marks.push(this.offset),this}popMark(){const t=this._marks.pop();if(t===void 0)throw new Error("Mark stack empty");return this.seek(t),this}rewind(){return this.offset=0,this}ensureAvailable(t=1){if(!this.available(t)){const s=(this.offset+t)*2,a=new Uint8Array(s);a.set(new Uint8Array(this.buffer)),this.buffer=a.buffer,this.length=s,this.byteLength=s,this._data=new DataView(this.buffer)}return this}readBoolean(){return this.readUint8()!==0}readInt8(){return this._data.getInt8(this.offset++)}readUint8(){return this._data.getUint8(this.offset++)}readByte(){return this.readUint8()}readBytes(t=1){return this.readArray(t,"uint8")}readArray(t,r){const s=QE[r].BYTES_PER_ELEMENT*t,a=this.byteOffset+this.offset,i=this.buffer.slice(a,a+s);if(this.littleEndian===rit&&r!=="uint8"&&r!=="int8"){const l=new Uint8Array(this.buffer.slice(a,a+s));l.reverse();const c=new QE[r](l.buffer);return this.offset+=s,c.reverse(),c}const o=new QE[r](i);return this.offset+=s,o}readInt16(){const t=this._data.getInt16(this.offset,this.littleEndian);return this.offset+=2,t}readUint16(){const t=this._data.getUint16(this.offset,this.littleEndian);return this.offset+=2,t}readInt32(){const t=this._data.getInt32(this.offset,this.littleEndian);return this.offset+=4,t}readUint32(){const t=this._data.getUint32(this.offset,this.littleEndian);return this.offset+=4,t}readFloat32(){const t=this._data.getFloat32(this.offset,this.littleEndian);return this.offset+=4,t}readFloat64(){const t=this._data.getFloat64(this.offset,this.littleEndian);return this.offset+=8,t}readBigInt64(){const t=this._data.getBigInt64(this.offset,this.littleEndian);return this.offset+=8,t}readBigUint64(){const t=this._data.getBigUint64(this.offset,this.littleEndian);return this.offset+=8,t}readChar(){return String.fromCharCode(this.readInt8())}readChars(t=1){let r="";for(let s=0;s<t;s++)r+=this.readChar();return r}readUtf8(t=1){return p9(this.readBytes(t))}decodeText(t=1,r="utf8"){return p9(this.readBytes(t),r)}writeBoolean(t){return this.writeUint8(t?255:0),this}writeInt8(t){return this.ensureAvailable(1),this._data.setInt8(this.offset++,t),this._updateLastWrittenByte(),this}writeUint8(t){return this.ensureAvailable(1),this._data.setUint8(this.offset++,t),this._updateLastWrittenByte(),this}writeByte(t){return this.writeUint8(t)}writeBytes(t){this.ensureAvailable(t.length);for(let r=0;r<t.length;r++)this._data.setUint8(this.offset++,t[r]);return this._updateLastWrittenByte(),this}writeInt16(t){return this.ensureAvailable(2),this._data.setInt16(this.offset,t,this.littleEndian),this.offset+=2,this._updateLastWrittenByte(),this}writeUint16(t){return this.ensureAvailable(2),this._data.setUint16(this.offset,t,this.littleEndian),this.offset+=2,this._updateLastWrittenByte(),this}writeInt32(t){return this.ensureAvailable(4),this._data.setInt32(this.offset,t,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeUint32(t){return this.ensureAvailable(4),this._data.setUint32(this.offset,t,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeFloat32(t){return this.ensureAvailable(4),this._data.setFloat32(this.offset,t,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeFloat64(t){return this.ensureAvailable(8),this._data.setFloat64(this.offset,t,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeBigInt64(t){return this.ensureAvailable(8),this._data.setBigInt64(this.offset,t,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeBigUint64(t){return this.ensureAvailable(8),this._data.setBigUint64(this.offset,t,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeChar(t){return this.writeUint8(t.charCodeAt(0))}writeChars(t){for(let r=0;r<t.length;r++)this.writeUint8(t.charCodeAt(r));return this}writeUtf8(t){return this.writeBytes(eit(t))}toArray(){return new Uint8Array(this.buffer,this.byteOffset,this.lastWrittenByte)}getWrittenByteLength(){return this.lastWrittenByte-this.byteOffset}_updateLastWrittenByte(){this.offset>this.lastWrittenByte&&(this.lastWrittenByte=this.offset)}}function k0(e){let t=e.length;for(;--t>=0;)e[t]=0}const nit=3,sit=258,wse=29,ait=256,iit=ait+1+wse,jse=30,oit=512,lit=ne
vendor: 20,455 bytes, line 1475
1475w Array((iit+2)*2);k0(lit);const cit=new Array(jse*2);k0(cit);const dit=new Array(oit);k0(dit);const uit=new Array(sit-nit+1);k0(uit);const hit=new Array(wse);k0(hit);const fit=new Array(jse);k0(fit);const mit=(e,t,r,s)=>{let a=e&65535|0,i=e>>>16&65535|0,o=0;for(;r!==0;){o=r>2e3?2e3:r,r-=o;do a=a+t[s++]|0,i=i+a|0;while(--o);a%=65521,i%=65521}return a|i<<16|0};var wP=mit;const pit=()=>{let e,t=[];for(var r=0;r<256;r++){e=r;for(var s=0;s<8;s++)e=e&1?3988292384^e>>>1:e>>>1;t[r]=e}return t},Ait=new Uint32Array(pit()),git=(e,t,r,s)=>{const a=Ait,i=s+r;e^=-1;for(let o=s;o<i;o++)e=e>>>8^a[(e^t[o])&255];return e^-1};var Gc=git,jP={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},Nse={Z_NO_FLUSH:0,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_DEFLATED:8};const xit=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var vit=function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const r=t.shift();if(r){if(typeof r!="object")throw new TypeError(r+"must be non-object");for(const s in r)xit(r,s)&&(e[s]=r[s])}}return e},bit=e=>{let t=0;for(let s=0,a=e.length;s<a;s++)t+=e[s].length;const r=new Uint8Array(t);for(let s=0,a=0,i=e.length;s<i;s++){let o=e[s];r.set(o,a),a+=o.length}return r},_se={assign:vit,flattenChunks:bit};let Cse=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{Cse=!1}const uy=new Uint8Array(256);for(let e=0;e<256;e++)uy[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;uy[254]=uy[254]=1;var yit=e=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(e);let t,r,s,a,i,o=e.length,l=0;for(a=0;a<o;a++)r=e.charCodeAt(a),(r&64512)===55296&&a+1<o&&(s=e.charCodeAt(a+1),(s&64512)===56320&&(r=65536+(r-55296<<10)+(s-56320),a++)),l+=r<128?1:r<2048?2:r<65536?3:4;for(t=new Uint8Array(l),i=0,a=0;i<l;a++)r=e.charCodeAt(a),(r&64512)===55296&&a+1<o&&(s=e.charCodeAt(a+1),(s&64512)===56320&&(r=65536+(r-55296<<10)+(s-56320),a++)),r<128?t[i++]=r:r<2048?(t[i++]=192|r>>>6,t[i++]=128|r&63):r<65536?(t[i++]=224|r>>>12,t[i++]=128|r>>>6&63,t[i++]=128|r&63):(t[i++]=240|r>>>18,t[i++]=128|r>>>12&63,t[i++]=128|r>>>6&63,t[i++]=128|r&63);return t};const wit=(e,t)=>{if(t<65534&&e.subarray&&Cse)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let r="";for(let s=0;s<t;s++)r+=String.fromCharCode(e[s]);return r};var jit=(e,t)=>{const r=t||e.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(e.subarray(0,t));let s,a;const i=new Array(r*2);for(a=0,s=0;s<r;){let o=e[s++];if(o<128){i[a++]=o;continue}let l=uy[o];if(l>4){i[a++]=65533,s+=l-1;continue}for(o&=l===2?31:l===3?15:7;l>1&&s<r;)o=o<<6|e[s++]&63,l--;if(l>1){i[a++]=65533;continue}o<65536?i[a++]=o:(o-=65536,i[a++]=55296|o>>10&1023,i[a++]=56320|o&1023)}return wit(i,a)},Nit=(e,t)=>{t=t||e.length,t>e.length&&(t=e.length);let r=t-1;for(;r>=0&&(e[r]&192)===128;)r--;return r<0||r===0?t:r+uy[e[r]]>t?r:t},NP={string2buf:yit,buf2string:jit,utf8border:Nit};function _it(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var Cit=_it;const G1=16209,Sit=16191;var kit=function(t,r){let s,a,i,o,l,c,d,u,h,m,f,p,A,v,x,b,y,w,j,N,_,S,C,E;const T=t.state;s=t.next_in,C=t.input,a=s+(t.avail_in-5),i=t.next_out,E=t.output,o=i-(r-t.avail_out),l=i+(t.avail_out-257),c=T.dmax,d=T.wsize,u=T.whave,h=T.wnext,m=T.window,f=T.hold,p=T.bits,A=T.lencode,v=T.distcode,x=(1<<T.lenbits)-1,b=(1<<T.distbits)-1;e:do{p<15&&(f+=C[s++]<<p,p+=8,f+=C[s++]<<p,p+=8),y=A[f&x];t:for(;;){if(w=y>>>24,f>>>=w,p-=w,w=y>>>16&255,w===0)E[i++]=y&65535;else if(w&16){j=y&65535,w&=15,w&&(p<w&&(f+=C[s++]<<p,p+=8),j+=f&(1<<w)-1,f>>>=w,p-=w),p<15&&(f+=C[s++]<<p,p+=8,f+=C[s++]<<p,p+=8),y=v[f&b];r:for(;;){if(w=y>>>24,f>>>=w,p-=w,w=y>>>16&255,w&16){if(N=y&65535,w&=15,p<w&&(f+=C[s++]<<p,p+=8,p<w&&(f+=C[s++]<<p,p+=8)),N+=f&(1<<w)-1,N>c){t.msg="invalid distance too far back",T.mode=G1;break e}if(f>>>=w,p-=w,w=i-o,N>w){if(w=N-w,w>u&&T.sane){t.msg="invalid distance too far back",T.mode=G1;break e}if(_=0,S=m,h===0){if(_+=d-w,w<j){j-=w;do E[i++]=m[_++];while(--w);_=i-N,S=E}}else if(h<w){if(_+=d+h-w,w-=h,w<j){j-=w;do E[i++]=m[_++];while(--w);if(_=0,h<j){w=h,j-=w;do E[i++]=m[_++];while(--w);_=i-N,S=E}}}else if(_+=h-w,w<j){j-=w;do E[i++]=m[_++];while(--w);_=i-N,S=E}for(;j>2;)E[i++]=S[_++],E[i++]=S[_++],E[i++]=S[_++],j-=3;j&&(E[i++]=S[_++],j>1&&(E[i++]=S[_++]))}else{_=i-N;do E[i++]=E[_++],E[i++]=E[_++],E[i++]=E[_++],j-=3;while(j>2);j&&(E[i++]=E[_++],j>1&&(E[i++]=E[_++]))}}else if(w&64){t.msg="invalid distance code",T.mode=G1;break e}else{y=v[(y&65535)+(f&(1<<w)-1)];continue r}break}}else if(w&64)if(w&32){T.mode=Sit;break e}else{t.msg="invalid literal/length code",T.mode=G1;break e}else{y=A[(y&65535)+(f&(1<<w)-1)];continue t}break}}while(s<a&&i<l);j=p>>3,s-=j,p-=j<<3,f&=(1<<p)-1,t.next_in=s,t.next_out=i,t.avail_in=s<a?5+(a-s):5-(s-a),t.avail_out=i<l?257+(l-i):257-(i-l),T.hold=f,T.bits=p};const Kp=15,A9=852,g9=592,x9=0,HE=1,v9=2,Eit=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),Bit=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),Tit=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),Pit=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]),Iit=(e,t,r,s,a,i,o,l)=>{const c=l.bits;let d=0,u=0,h=0,m=0,f=0,p=0,A=0,v=0,x=0,b=0,y,w,j,N,_,S=null,C;const E=new Uint16Array(Kp+1),T=new Uint16Array(Kp+1);let B=null,L,P,F;for(d=0;d<=Kp;d++)E[d]=0;for(u=0;u<s;u++)E[t[r+u]]++;for(f=c,m=Kp;m>=1&&E[m]===0;m--);if(f>m&&(f=m),m===0)return a[i++]=1<<24|64<<16|0,a[i++]=1<<24|64<<16|0,l.bits=1,0;for(h=1;h<m&&E[h]===0;h++);for(f<h&&(f=h),v=1,d=1;d<=Kp;d++)if(v<<=1,v-=E[d],v<0)return-1;if(v>0&&(e===x9||m!==1))return-1;for(T[1]=0,d=1;d<Kp;d++)T[d+1]=T[d]+E[d];for(u=0;u<s;u++)t[r+u]!==0&&(o[T[t[r+u]]++]=u);if(e===x9?(S=B=o,C=20):e===HE?(S=Eit,B=Bit,C=257):(S=Tit,B=Pit,C=0),b=0,u=0,d=h,_=i,p=f,A=0,j=-1,x=1<<f,N=x-1,e===HE&&x>A9||e===v9&&x>g9)return 1;for(;;){L=d-A,o[u]+1<C?(P=0,F=o[u]):o[u]>=C?(P=B[o[u]-C],F=S[o[u]-C]):(P=96,F=0),y=1<<d-A,w=1<<p,h=w;do w-=y,a[_+(b>>A)+w]=L<<24|P<<16|F|0;while(w!==0);for(y=1<<d-1;b&y;)y>>=1;if(y!==0?(b&=y-1,b+=y):b=0,u++,--E[d]===0){if(d===m)break;d=t[r+o[u]]}if(d>f&&(b&N)!==j){for(A===0&&(A=f),_+=h,p=d-A,v=1<<p;p+A<m&&(v-=E[p+A],!(v<=0));)p++,v<<=1;if(x+=1<<p,e===HE&&x>A9||e===v9&&x>g9)return 1;j=b&N,a[j]=f<<24|p<<16|_-i|0}}return b!==0&&(a[_+b]=d-A<<24|64<<16|0),l.bits=f,0};var Pv=Iit;const Oit=0,Sse=1,kse=2,{Z_FINISH:b9,Z_BLOCK:Fit,Z_TREES:q1,Z_OK:Km,Z_STREAM_END:Lit,Z_NEED_DICT:Dit,Z_STREAM_ERROR:$l,Z_DATA_ERROR:Ese,Z_MEM_ERROR:Bse,Z_BUF_ERROR:Rit,Z_DEFLATED:y9}=Nse,ZS=16180,w9=16181,j9=16182,N9=16183,_9=16184,C9=16185,S9=16186,k9=16187,E9=16188,B9=16189,i_=16190,Xd=16191,zE=16192,T9=16193,VE=16194,P9=16195,I9=16196,O9=16197,F9=16198,K1=16199,W1=16200,L9=16201,D9=16202,R9=16203,U9=16204,M9=16205,GE=16206,$9=16207,Q9=16208,vs=16209,Tse=16210,Pse=16211,Uit=852,Mit=592,$it=15,Qit=$it,H9=e=>(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24);function Hit(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const lp=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode<ZS||t.mode>Pse?1:0},Ise=e=>{if(lp(e))return $l;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=t.wrap&1),t.mode=ZS,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(Uit),t.distcode=t.distdyn=new Int32Array(Mit),t.sane=1,t.back=-1,Km},Ose=e=>{if(lp(e))return $l;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,Ise(e)},Fse=(e,t)=>{let r;if(lp(e))return $l;const s=e.state;return t<0?(r=0,t=-t):(r=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?$l:(s.window!==null&&s.wbits!==t&&(s.window=null),s.wrap=r,s.wbits=t,Ose(e))},Lse=(e,t)=>{if(!e)return $l;const r=new Hit;e.state=r,r.strm=e,r.window=null,r.mode=ZS;const s=Fse(e,t);return s!==Km&&(e.state=null),s},zit=e=>Lse(e,Qit);let z9=!0,qE,KE;const Vit=e=>{if(z9){qE=new Int32Array(512),KE=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(Pv(Sse,e.lens,0,288,qE,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;Pv(kse,e.lens,0,32,KE,0,e.work,{bits:5}),z9=!1}e.lencode=qE,e.lenbits=9,e.distcode=KE,e.distbits=5},Dse=(e,t,r,s)=>{let a;const i=e.state;return i.window===null&&(i.wsize=1<<i.wbits,i.wnext=0,i.whave=0,i.window=new Uint8Array(i.wsize)),s>=i.wsize?(i.window.set(t.subarray(r-i.wsize,r),0),i.wnext=0,i.whave=i.wsize):(a=i.wsize-i.wnext,a>s&&(a=s),i.window.set(t.subarray(r-s,r-s+a),i.wnext),s-=a,s?(i.window.set(t.subarray(r-s,r),0),i.wnext=s,i.whave=i.wsize):(i.wnext+=a,i.wnext===i.wsize&&(i.wnext=0),i.whave<i.wsize&&(i.whave+=a))),0},Git=(e,t)=>{let r,s,a,i,o,l,c,d,u,h,m,f,p,A,v=0,x,b,y,w,j,N,_,S;const C=new Uint8Array(4);let E,T;const B=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(lp(e)||!e.output||!e.input&&e.avail_in!==0)return $l;r=e.state,r.mode===Xd&&(r.mode=zE),o=e.next_out,a=e.output,c=e.avail_out,i=e.next_in,s=e.input,l=e.avail_in,d=r.hold,u=r.bits,h=l,m=c,S=Km;e:for(;;)switch(r.mode){case ZS:if(r.wrap===0){r.mode=zE;break}for(;u<16;){if(l===0)break e;l--,d+=s[i++]<<u,u+=8}if(r.wrap&2&&d===35615){r.wbits===0&&(r.wbits=15),r.check=0,C[0]=d&255,C[1]=d>>>8&255,r.check=Gc(r.check,C,2,0),d=0,u=0,r.mode=w9;break}if(r.head&&(r.head.done=!1),!(r.wrap&1)||(((d&255)<<8)+(d>>8))%31){e.msg="incorrect header check",r.mode=vs;break}if((d&15)!==y9){e.msg="unknown compression method",r.mode=vs;break}if(d>>>=4,u-=4,_=(d&15)+8,r.wbits===0&&(r.wbits=_),_>15||_>r.wbits){e.msg="invalid window size",r.mode=vs;break}r.dmax=1<<r.wbits,r.flags=0,e.adler=r.check=1,r.mode=d&512?B9:Xd,d=0,u=0;break;case w9:for(;u<16;){if(l===0)break e;l--,d+=s[i++]<<u,u+=8}if(r.flags=d,(r.flags&255)!==y9){e.msg="unknown compression method",r.mode=vs;break}if(r.flags&57344){e.msg="unknown header flags set",r.mode=vs;break}r.head&&(r.head.text=d>>8&1),r.flags&512&&r.wrap&4&&(C[0]=d&255,C[1]=d>>>8&255,r.check=Gc(r.check,C,2,0)),d=0,u=0,r.mode=j9;case j9:for(;u<32;){if(l===0)break e;l--,d+=s[i++]<<u,u+=8}r.head&&(r.head.time=d),r.flags&512&&r.wrap&4&&(C[0]=d&255,C[1]=d>>>8&255,C[2]=d>>>16&255,C[3]=d>>>24&255,r.check=Gc(r.check,C,4,0)),d=0,u=0,r.mode=N9;case N9:for(;u<16;){if(l===0)break e;l--,d+=s[i++]<<u,u+=8}r.head&&(r.head.xflags=d&255,r.head.os=d>>8),r.flags&512&&r.wrap&4&&(C[0]=d&255,C[1]=d>>>8&255,r.check=Gc(r.check,C,2,0)),d=0,u=0,r.mode=_9;case _9:if(r.flags&1024){for(;u<16;){if(l===0)break e;l--,d+=s[i++]<<u,u+=8}r.length=d,r.head&&(r.head.extra_len=d),r.flags&512&&r.wrap&4&&(C[0]=d&255,C[1]=d>>>8&255,r.check=Gc(r.check,C,2,0)),d=0,u=0}else r.head&&(r.head.extra=null);r.mode=C9;case C9:if(r.flags&1024&&(f=r.length,f>l&&(f=l),f&&(r.head&&(_=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Uint8Array(r.head.extra_len)),r.head.extra.set(s.subarray(i,i+f),_)),r.flags&512&&r.wrap&4&&(r.check=Gc(r.check,s,f,i)),l-=f,i+=f,r.length-=f),r.length))break e;r.length=0,r.mode=S9;case S9:if(r.flags&2048){if(l===0)break e;f=0;do _=s[i+f++],r.head&&_&&r.length<65536&&(r.head.name+=String.fromCharCode(_));while(_&&f<l);if(r.flags&512&&r.wrap&4&&(r.check=Gc(r.check,s,f,i)),l-=f,i+=f,_)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=k9;case k9:if(r.flags&4096){if(l===0)break e;f=0;do _=s[i+f++],r.head&&_&&r.length<65536&&(r.head.comment+=String.fromCharCode(_));while(_&&f<l);if(r.flags&512&&r.wrap&4&&(r.check=Gc(r.check,s,f,i)),l-=f,i+=f,_)break e}else r.head&&(r.head.comment=null);r.mode=E9;case E9:if(r.flags&512){for(;u<16;){if(l===0)break e;l--,d+=s[i++]<<u,u+=8}if(r.wrap&4&&d!==(r.check&65535)){e.msg="header crc mismatch",r.mode=vs;break}d=0,u=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=Xd;break;case B9:for(;u<32;){if(l===0)break e;l--,d+=s[i++]<<u,u+=8}e.adler=r.check=H9(d),d=0,u=0,r.mode=i_;case i_:if(r.havedict===0)return e.next_out=o,e.avail_out=c,e.next_in=i,e.avail_in=l,r.hold=d,r.bits=u,Dit;e.adler=r.check=1,r.mode=Xd;case Xd:if(t===Fit||t===q1)break e;case zE:if(r.last){d>>>=u&7,u-=u&7,r.mode=GE;break}for(;u<3;){if(l===0)break e;l--,d+=s[i++]<<u,u+=8}switch(r.last=d&1,d>>>=1,u-=1,d&3){case 0:r.mode=T9;break;case 1:if(Vit(r),r.mode=K1,t===q1){d>>>=2,u-=2;break e}break;case 2:r.mode=I9;break;case 3:e.msg="invalid block type",r.mode=vs}d>>>=2,u-=2;break;case T9:for(d>>>=u&7,u-=u&7;u<32;){if(l===0)break e;l--,d+=s[i++]<<u,u+=8}if((d&65535)!==(d>>>16^65535)){e.msg="invalid stored block lengths",r.mode=vs;break}if(r.length=d&65535,d=0,u=0,r.mode=VE,t===q1)break e;case VE:r.mode=P9;case P9:if(f=r.length,f){if(f>l&&(f=l),f>c&&(f=c),f===0)break e;a.set(s.subarray(i,i+f),o),l-=f,i+=f,c-=f,o+=f,r.length-=f;break}r.mode=Xd;break;case I9:for(;u<14;){if(l===0)break e;l--,d+=s[i++]<<u,u+=8}if(r.nlen=(d&31)+257,d>>>=5,u-=5,r.ndist=(d&31)+1,d>>>=5,u-=5,r.ncode=(d&15)+4,d>>>=4,u-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=vs;break}r.have=0,r.mode=O9;case O9:for(;r.have<r.ncode;){for(;u<3;){if(l===0)break e;l--,d+=s[i++]<<u,u+=8}r.lens[B[r.have++]]=d&7,d>>>=3,u-=3}for(;r.have<19;)r.lens[B[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,E={bits:r.lenbits},S=Pv(Oit,r.lens,0,19,r.lencode,0,r.work,E),r.lenbits=E.bits,S){e.msg="invalid code lengths set",r.mode=vs;break}r.have=0,r.mode=F9;case F9:for(;r.have<r.nlen+r.ndist;){for(;v=r.lencode[d&(1<<r.lenbits)-1],x=v>>>24,b=v>>>16&255,y=v&65535,!(x<=u);){if(l===0)break e;l--,d+=s[i++]<<u,u+=8}if(y<16)d>>>=x,u-=x,r.lens[r.have++]=y;else{if(y===16){for(T=x+2;u<T;){if(l===0)break e;l--,d+=s[i++]<<u,u+=8}if(d>>>=x,u-=x,r.have===0){e.msg="invalid bit length repeat",r.mode=vs;break}_=r.lens[r.have-1],f=3+(d&3),d>>>=2,u-=2}else if(y===17){for(T=x+3;u<T;){if(l===0)break e;l--,d+=s[i++]<<u,u+=8}d>>>=x,u-=x,_=0,f=3+(d&7),d>>>=3,u-=3}else{for(T=x+7;u<T;){if(l===0)break e;l--,d+=s[i++]<<u,u+=8}d>>>=x,u-=x,_=0,f=11+(d&127),d>>>=7,u-=7}if(r.have+f>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=vs;break}for(;f--;)r.lens[r.have++]=_}}if(r.mode===vs)break;if(r.lens[256]===0){e.msg="invalid code -- missing end-of-block",r.mode=vs;break}if(r.lenbits=9,E={bits:r.lenbits},S=Pv(Sse,r.lens,0,r.nlen,r.lencode,0,r.work,E),r.lenbits=E.bits,S){e.msg="invalid literal/lengths set",r.mode=vs;break}if(r.distbits=6,r.distcode=r.distdyn,E={bits:r.distbits},S=Pv(kse,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,E),r.distbits=E.bits,S){e.msg="invalid distances set",r.mode=vs;break}if(r.mode=K1,t===q1)break e;case K1:r.mode=W1;case W1:if(l>=6&&c>=258){e.next_out=o,e.avail_out=c,e.next_in=i,e.avail_in=l,r.hold=d,r.bits=u,kit(e,m),o=e.next_out,a=e.output,c=e.avail_out,i=e.next_in,s=e.input,l=e.avail_in,d=r.hold,u=r.bits,r.mode===Xd&&(r.back=-1);break}for(r.back=0;v=r.lencode[d&(1<<r.lenbits)-1],x=v>>>24,b=v>>>16&255,y=v&65535,!(x<=u);){if(l===0)break e;l--,d+=s[i++]<<u,u+=8}if(b&&!(b&240)){for(w=x,j=b,N=y;v=r.lencode[N+((d&(1<<w+j)-1)>>w)],x=v>>>24,b=v>>>16&255,y=v&65535,!(w+x<=u);){if(l===0)break e;l--,d+=s[i++]<<u,u+=8}d>>>=w,u-=w,r.back+=w}if(d>>>=x,u-=x,r.back+=x,r.length=y,b===0){r.mode=M9;break}if(b&32){r.back=-1,r.mode=Xd;break}if(b&64){e.msg="invalid literal/length code",r.mode=vs;break}r.extra=b&15,r.mode=L9;case L9:if(r.extra){for(T=r.extra;u<T;){if(l===0)break e;l--,d+=s[i++]<<u,u+=8}r.length+=d&(1<<r.extra)-1,d>>>=r.extra,u-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=D9;case D9:for(;v=r.distcode[d&(1<<r.distbits)-1],x=v>>>24,b=v>>>16&255,y=v&65535,!(x<=u);){if(l===0)break e;l--,d+=s[i++]<<u,u+=8}if(!(b&240)){for(w=x,j=b,N=y;v=r.distcode[N+((d&(1<<w+j)-1)>>w)],x=v>>>24,b=v>>>16&255,y=v&65535,!(w+x<=u);){if(l===0)break e;l--,d+=s[i++]<<u,u+=8}d>>>=w,u-=w,r.back+=w}if(d>>>=x,u-=x,r.back+=x,b&64){e.msg="invalid distance code",r.mode=vs;break}r.offset=y,r.extra=b&15,r.mode=R9;case R9:if(r.extra){for(T=r.extra;u<T;){if(l===0)break e;l--,d+=s[i++]<<u,u+=8}r.offset+=d&(1<<r.extra)-1,d>>>=r.extra,u-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=vs;break}r.mode=U9;case U9:if(c===0)break e;if(f=m-c,r.offset>f){if(f=r.offset-f,f>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=vs;break}f>r.wnext?(f-=r.wnext,p=r.wsize-f):p=r.wnext-f,f>r.length&&(f=r.length),A=r.window}else A=a,p=o-r.offset,f=r.length;f>c&&(f=c),c-=f,r.length-=f;do a[o++]=A[p++];while(--f);r.length===0&&(r.mode=W1);break;case M9:if(c===0)break e;a[o++]=r.length,c--,r.mode=W1;break;case GE:if(r.wrap){for(;u<32;){if(l===0)break e;l--,d|=s[i++]<<u,u+=8}if(m-=c,e.total_out+=m,r.total+=m,r.wrap&4&&m&&(e.adler=r.check=r.flags?Gc(r.check,a,m,o-m):wP(r.check,a,m,o-m)),m=c,r.wrap&4&&(r.flags?d:H9(d))!==r.check){e.msg="incorrect data check",r.mode=vs;break}d=0,u=0}r.mode=$9;case $9:if(r.wrap&&r.flags){for(;u<32;){if(l===0)break e;l--,d+=s[i++]<<u,u+=8}if(r.wrap&4&&d!==(r.total&4294967295)){e.msg="incorrect length check",r.mode=vs;break}d=0,u=0}r.mode=Q9;case Q9:S=Lit;break e;case vs:S=Ese;break e;case Tse:return Bse;case Pse:default:return $l}return e.next_out=o,e.avail_out=c,e.next_in=i,e.avail_in=l,r.hold=d,r.bits=u,(r.wsize||m!==e.avail_out&&r.mode<vs&&(r.mode<GE||t!==b9))&&Dse(e,e.output,e.next_out,m-e.avail_out),h-=e.avail_in,m-=e.avail_out,e.total_in+=h,e.total_out+=m,r.total+=m,r.wrap&4&&m&&(e.adler=r.check=r.flags?Gc(r.check,a,m,e.next_out-m):wP(r.check,a,m,e.next_out-m)),e.data_type=r.bits+(r.last?64:0)+(r.mode===Xd?128:0)+(r.mode===K1||r.mode===VE?256:0),(h===0&&m===0||t===b9)&&S===Km&&(S=Rit),S},qit=e=>{if(lp(e))return $l;let t=e.state;return t.window&&(t.window=null),e.state=null,Km},Kit=(e,t)=>{if(lp(e))return $l;const r=e.state;return r.wrap&2?(r.head=t,t.done=!1,Km):$l},Wit=(e,t)=>{const r=t.length;let s,a,i;return lp(e)||(s=e.state,s.wrap!==0&&s.mode!==i_)?$l:s.mode===i_&&(a=1,a=wP(a,t,r,0),a!==s.check)?Ese:(i=Dse(e,t,r,r),i?(s.mode=Tse,Bse):(s.havedict=1,Km))};var Yit=Ose,Jit=Fse,Xit=Ise,Zit=zit,eot=Lse,tot=Git,rot=qit,not=Kit,sot=Wit,aot="pako inflate (from Nodeca project)",ru={inflateReset:Yit,inflateReset2:Jit,inflateResetKeep:Xit,inflateInit:Zit,inflateInit2:eot,inflate:tot,inflateEnd:rot,inflateGetHeader:not,inflateSetDictionary:sot,inflateInfo:aot};function iot(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var oot=iot;const Rse=Object.prototype.toString,{Z_NO_FLUSH:lot,Z_FINISH:cot,Z_OK:hy,Z_STREAM_END:WE,Z_NEED_DICT:YE,Z_STREAM_ERROR:dot,Z_DATA_ERROR:V9,Z_MEM_ERROR:uot}=Nse;function Zy(e){this.options=_se.assign({chunkSize:1024*64,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(e&&e.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15||(t.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Cit,this.strm.avail_out=0;let r=ru.inflateInit2(this.strm,t.windowBits);if(r!==hy)throw new Error(jP[r]);if(this.header=new oot,ru.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=NP.string2buf(t.dictionary):Rse.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=ru.inflateSetDictionary(this.strm,t.dictionary),r!==hy)))throw new Error(jP[r])}Zy.prototype.push=function(e,t){const r=this.strm,s=this.options.chunkSize,a=this.options.dictionary;let i,o,l;if(this.ended)return!1;for(t===~~t?o=t:o=t===!0?cot:lot,Rse.call(e)==="[object ArrayBuffer]"?r.input
vendor: 10,036 bytes, line 1475
1475=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;;){for(r.avail_out===0&&(r.output=new Uint8Array(s),r.next_out=0,r.avail_out=s),i=ru.inflate(r,o),i===YE&&a&&(i=ru.inflateSetDictionary(r,a),i===hy?i=ru.inflate(r,o):i===V9&&(i=YE));r.avail_in>0&&i===WE&&r.state.wrap>0&&e[r.next_in]!==0;)ru.inflateReset(r),i=ru.inflate(r,o);switch(i){case dot:case V9:case YE:case uot:return this.onEnd(i),this.ended=!0,!1}if(l=r.avail_out,r.next_out&&(r.avail_out===0||i===WE))if(this.options.to==="string"){let c=NP.utf8border(r.output,r.next_out),d=r.next_out-c,u=NP.buf2string(r.output,c);r.next_out=d,r.avail_out=s-d,d&&r.output.set(r.output.subarray(c,c+d),0),this.onData(u)}else this.onData(r.output.length===r.next_out?r.output:r.output.subarray(0,r.next_out));if(!(i===hy&&l===0)){if(i===WE)return i=ru.inflateEnd(this.strm),this.onEnd(i),this.ended=!0,!0;if(r.avail_in===0)break}}return!0};Zy.prototype.onData=function(e){this.chunks.push(e)};Zy.prototype.onEnd=function(e){e===hy&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=_se.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function hot(e,t){const r=new Zy(t);if(r.push(e),r.err)throw r.msg||jP[r.err];return r.result}var fot=Zy,mot=hot,pot={Inflate:fot,inflate:mot};const{Inflate:Aot,inflate:got}=pot;var G9=Aot,xot=got;const Use=[];for(let e=0;e<256;e++){let t=e;for(let r=0;r<8;r++)t&1?t=3988292384^t>>>1:t=t>>>1;Use[e]=t}const q9=4294967295;function vot(e,t,r){let s=e;for(let a=0;a<r;a++)s=Use[(s^t[a])&255]^s>>>8;return s}function bot(e,t){return(vot(q9,e,t)^q9)>>>0}function K9(e,t,r){const s=e.readUint32(),a=bot(new Uint8Array(e.buffer,e.byteOffset+e.offset-t-4,t),t);if(a!==s)throw new Error(`CRC mismatch for chunk ${r}. Expected ${s}, found ${a}`)}function Mse(e,t,r){for(let s=0;s<r;s++)t[s]=e[s]}function $se(e,t,r,s){let a=0;for(;a<s;a++)t[a]=e[a];for(;a<r;a++)t[a]=e[a]+t[a-s]&255}function Qse(e,t,r,s){let a=0;if(r.length===0)for(;a<s;a++)t[a]=e[a];else for(;a<s;a++)t[a]=e[a]+r[a]&255}function Hse(e,t,r,s,a){let i=0;if(r.length===0){for(;i<a;i++)t[i]=e[i];for(;i<s;i++)t[i]=e[i]+(t[i-a]>>1)&255}else{for(;i<a;i++)t[i]=e[i]+(r[i]>>1)&255;for(;i<s;i++)t[i]=e[i]+(t[i-a]+r[i]>>1)&255}}function zse(e,t,r,s,a){let i=0;if(r.length===0){for(;i<a;i++)t[i]=e[i];for(;i<s;i++)t[i]=e[i]+t[i-a]&255}else{for(;i<a;i++)t[i]=e[i]+r[i]&255;for(;i<s;i++)t[i]=e[i]+yot(t[i-a],r[i],r[i-a])&255}}function yot(e,t,r){const s=e+t-r,a=Math.abs(s-e),i=Math.abs(s-t),o=Math.abs(s-r);return a<=i&&a<=o?e:i<=o?t:r}function wot(e,t,r,s,a,i){switch(e){case 0:Mse(t,r,a);break;case 1:$se(t,r,a,i);break;case 2:Qse(t,r,s,a);break;case 3:Hse(t,r,s,a,i);break;case 4:zse(t,r,s,a,i);break;default:throw new Error(`Unsupported filter: ${e}`)}}const jot=new Uint16Array([255]),Not=new Uint8Array(jot.buffer),_ot=Not[0]===255;function Cot(e){const{data:t,width:r,height:s,channels:a,depth:i}=e,o=[{x:0,y:0,xStep:8,yStep:8},{x:4,y:0,xStep:8,yStep:8},{x:0,y:4,xStep:4,yStep:8},{x:2,y:0,xStep:4,yStep:4},{x:0,y:2,xStep:2,yStep:4},{x:1,y:0,xStep:2,yStep:2},{x:0,y:1,xStep:1,yStep:2}],l=Math.ceil(i/8)*a,c=new Uint8Array(s*r*l);let d=0;for(let u=0;u<7;u++){const h=o[u],m=Math.ceil((r-h.x)/h.xStep),f=Math.ceil((s-h.y)/h.yStep);if(m<=0||f<=0)continue;const p=m*l,A=new Uint8Array(p);for(let v=0;v<f;v++){const x=t[d++],b=t.subarray(d,d+p);d+=p;const y=new Uint8Array(p);wot(x,b,y,A,p,l),A.set(y);for(let w=0;w<m;w++){const j=h.x+w*h.xStep,N=h.y+v*h.yStep;if(!(j>=r||N>=s))for(let _=0;_<l;_++)c[(N*r+j)*l+_]=y[w*l+_]}}}if(i===16){const u=new Uint16Array(c.buffer);if(_ot)for(let h=0;h<u.length;h++)u[h]=Sot(u[h]);return u}else return c}function Sot(e){return(e&255)<<8|e>>8&255}const kot=new Uint16Array([255]),Eot=new Uint8Array(kot.buffer),Bot=Eot[0]===255,Tot=new Uint8Array(0);function W9(e){const{data:t,width:r,height:s,channels:a,depth:i}=e,o=Math.ceil(i/8)*a,l=Math.ceil(i/8*a*r),c=new Uint8Array(s*l);let d=Tot,u=0,h,m;for(let f=0;f<s;f++){switch(h=t.subarray(u+1,u+1+l),m=c.subarray(f*l,(f+1)*l),t[u]){case 0:Mse(h,m,l);break;case 1:$se(h,m,l,o);break;case 2:Qse(h,m,d,l);break;case 3:Hse(h,m,d,l,o);break;case 4:zse(h,m,d,l,o);break;default:throw new Error(`Unsupported filter: ${t[u]}`)}d=m,u+=l+1}if(i===16){const f=new Uint16Array(c.buffer);if(Bot)for(let p=0;p<f.length;p++)f[p]=Pot(f[p]);return f}else return c}function Pot(e){return(e&255)<<8|e>>8&255}const Rj=Uint8Array.of(137,80,78,71,13,10,26,10);function Y9(e){if(!Iot(e.readBytes(Rj.length)))throw new Error("wrong PNG signature")}function Iot(e){if(e.length<Rj.length)return!1;for(let t=0;t<Rj.length;t++)if(e[t]!==Rj[t])return!1;return!0}const Oot="tEXt",Fot=0,Vse=new TextDecoder("latin1");function Lot(e){if(Rot(e),e.length===0||e.length>79)throw new Error("keyword length must be between 1 and 79")}const Dot=/^[\u0000-\u00FF]*$/;function Rot(e){if(!Dot.test(e))throw new Error("invalid latin1 text")}function Uot(e,t,r){const s=Gse(t);e[s]=Mot(t,r-s.length-1)}function Gse(e){for(e.mark();e.readByte()!==Fot;);const t=e.offset;e.reset();const r=Vse.decode(e.readBytes(t-e.offset-1));return e.skip(1),Lot(r),r}function Mot(e,t){return Vse.decode(e.readBytes(t))}const Po={UNKNOWN:-1,GREYSCALE:0,TRUECOLOUR:2,INDEXED_COLOUR:3,GREYSCALE_ALPHA:4,TRUECOLOUR_ALPHA:6},JE={UNKNOWN:-1,DEFLATE:0},J9={UNKNOWN:-1,ADAPTIVE:0},XE={UNKNOWN:-1,NO_INTERLACE:0,ADAM7:1},Y1={NONE:0,BACKGROUND:1,PREVIOUS:2},ZE={SOURCE:0,OVER:1};class $ot extends w6{constructor(r,s={}){super(r);Yt(this,"_checkCrc");Yt(this,"_inflator");Yt(this,"_png");Yt(this,"_apng");Yt(this,"_end");Yt(this,"_hasPalette");Yt(this,"_palette");Yt(this,"_hasTransparency");Yt(this,"_transparency");Yt(this,"_compressionMethod");Yt(this,"_filterMethod");Yt(this,"_interlaceMethod");Yt(this,"_colorType");Yt(this,"_isAnimated");Yt(this,"_numberOfFrames");Yt(this,"_numberOfPlays");Yt(this,"_frames");Yt(this,"_writingDataChunks");const{checkCrc:a=!1}=s;this._checkCrc=a,this._inflator=new G9,this._png={width:-1,height:-1,channels:-1,data:new Uint8Array(0),depth:1,text:{}},this._apng={width:-1,height:-1,channels:-1,depth:1,numberOfFrames:1,numberOfPlays:0,text:{},frames:[]},this._end=!1,this._hasPalette=!1,this._palette=[],this._hasTransparency=!1,this._transparency=new Uint16Array(0),this._compressionMethod=JE.UNKNOWN,this._filterMethod=J9.UNKNOWN,this._interlaceMethod=XE.UNKNOWN,this._colorType=Po.UNKNOWN,this._isAnimated=!1,this._numberOfFrames=1,this._numberOfPlays=0,this._frames=[],this._writingDataChunks=!1,this.setBigEndian()}decode(){for(Y9(this);!this._end;){const r=this.readUint32(),s=this.readChars(4);this.decodeChunk(r,s)}return this.decodeImage(),this._png}decodeApng(){for(Y9(this);!this._end;){const r=this.readUint32(),s=this.readChars(4);this.decodeApngChunk(r,s)}return this.decodeApngImage(),this._apng}decodeChunk(r,s){const a=this.offset;switch(s){case"IHDR":this.decodeIHDR();break;case"PLTE":this.decodePLTE(r);break;case"IDAT":this.decodeIDAT(r);break;case"IEND":this._end=!0;break;case"tRNS":this.decodetRNS(r);break;case"iCCP":this.decodeiCCP(r);break;case Oot:Uot(this._png.text,this,r);break;case"pHYs":this.decodepHYs();break;default:this.skip(r);break}if(this.offset-a!==r)throw new Error(`Length mismatch while decoding chunk ${s}`);this._checkCrc?K9(this,r+4,s):this.skip(4)}decodeApngChunk(r,s){const a=this.offset;switch(s!=="fdAT"&&s!=="IDAT"&&this._writingDataChunks&&this.pushDataToFrame(),s){case"acTL":this.decodeACTL();break;case"fcTL":this.decodeFCTL();break;case"fdAT":this.decodeFDAT(r);break;default:this.decodeChunk(r,s),this.offset=a+r;break}if(this.offset-a!==r)throw new Error(`Length mismatch while decoding chunk ${s}`);this._checkCrc?K9(this,r+4,s):this.skip(4)}decodeIHDR(){const r=this._png;r.width=this.readUint32(),r.height=this.readUint32(),r.depth=Qot(this.readUint8());const s=this.readUint8();this._colorType=s;let a;switch(s){case Po.GREYSCALE:a=1;break;case Po.TRUECOLOUR:a=3;break;case Po.INDEXED_COLOUR:a=1;break;case Po.GREYSCALE_ALPHA:a=2;break;case Po.TRUECOLOUR_ALPHA:a=4;break;case Po.UNKNOWN:default:throw new Error(`Unknown color type: ${s}`)}if(this._png.channels=a,this._compressionMethod=this.readUint8(),this._compressionMethod!==JE.DEFLATE)throw new Error(`Unsupported compression method: ${this._compressionMethod}`);this._filterMethod=this.readUint8(),this._interlaceMethod=this.readUint8()}decodeACTL(){this._numberOfFrames=this.readUint32(),this._numberOfPlays=this.readUint32(),this._isAnimated=!0}decodeFCTL(){const r={sequenceNumber:this.readUint32(),width:this.readUint32(),height:this.readUint32(),xOffset:this.readUint32(),yOffset:this.readUint32(),delayNumber:this.readUint16(),delayDenominator:this.readUint16(),disposeOp:this.readUint8(),blendOp:this.readUint8(),data:new Uint8Array(0)};this._frames.push(r)}decodePLTE(r){if(r%3!==0)throw new RangeError(`PLTE field length must be a multiple of 3. Got ${r}`);const s=r/3;this._hasPalette=!0;const a=[];this._palette=a;for(let i=0;i<s;i++)a.push([this.readUint8(),this.readUint8(),this.readUint8()])}decodeIDAT(r){this._writingDataChunks=!0;const s=r,a=this.offset+this.byteOffset;if(this._inflator.push(new Uint8Array(this.buffer,a,s)),this._inflator.err)throw new Error(`Error while decompressing the data: ${this._inflator.err}`);this.skip(r)}decodeFDAT(r){this._writingDataChunks=!0;let s=r,a=this.offset+this.byteOffset;if(a+=4,s-=4,this._inflator.push(new Uint8Array(this.buffer,a,s)),this._inflator.err)throw new Error(`Error while decompressing the data: ${this._inflator.err}`);this.skip(r)}decodetRNS(r){switch(this._colorType){case Po.GREYSCALE:case Po.TRUECOLOUR:{if(r%2!==0)throw new RangeError(`tRNS chunk length must be a multiple of 2. Got ${r}`);if(r/2>this._png.width*this._png.height)throw new Error(`tRNS chunk contains more alpha values than there are pixels (${r/2} vs ${this._png.width*this._png.height})`);this._hasTransparency=!0,this._transparency=new Uint16Array(r/2);for(let s=0;s<r/2;s++)this._transparency[s]=this.readUint16();break}case Po.INDEXED_COLOUR:{if(r>this._palette.length)throw new Error(`tRNS chunk contains more alph
1475a values than there are palette colors (${r} vs ${this._palette.length})`);let s=0;for(;s<r;s++){const a=this.readByte();this._palette[s].push(a)}for(;s<this._palette.length;s++)this._palette[s].push(255);break}case Po.UNKNOWN:case Po.GREYSCALE_ALPHA:case Po.TRUECOLOUR_ALPHA:default:throw new Error(`tRNS chunk is not supported for color type ${this._colorType}`)}}decodeiCCP(r){const s=Gse(this),a=this.readUint8();if(a!==JE.DEFLATE)throw new Error(`Unsupported iCCP compression method: ${a}`);const i=this.readBytes(r-s.length-2);this._png.iccEmbeddedProfile={name:s,profile:xot(i)}}decodepHYs(){const r=this.readUint32(),s=this.readUint32(),a=this.readByte();this._png.resolution={x:r,y:s,unit:a}}decodeApngImage(){this._apng.width=this._png.width,this._apng.height=this._png.height,this._apng.channels=this._png.channels,this._apng.depth=this._png.depth,this._apng.numberOfFrames=this._numberOfFrames,this._apng.numberOfPlays=this._numberOfPlays,this._apng.text=this._png.text,this._apng.resolution=this._png.resolution;for(let r=0;r<this._numberOfFrames;r++){const s={sequenceNumber:this._frames[r].sequenceNumber,delayNumber:this._frames[r].delayNumber,delayDenominator:this._frames[r].delayDenominator,data:this._apng.depth===8?new Uint8Array(this._apng.width*this._apng.height*this._apng.channels):new Uint16Array(this._apng.width*this._apng.height*this._apng.channels)},a=this._frames.at(r);if(a){if(a.data=W9({data:a.data,width:a.width,height:a.height,channels:this._apng.channels,depth:this._apng.depth}),this._hasPalette&&(this._apng.palette=this._palette),this._hasTransparency&&(this._apng.transparency=this._transparency),r===0||a.xOffset===0&&a.yOffset===0&&a.width===this._png.width&&a.height===this._png.height)s.data=a.data;else{const i=this._apng.frames.at(r-1);this.disposeFrame(a,i,s),this.addFrameDataToCanvas(s,a)}this._apng.frames.push(s)}}return this._apng}disposeFrame(r,s,a){switch(r.disposeOp){case Y1.NONE:break;case Y1.BACKGROUND:for(let i=0;i<this._png.height;i++)for(let o=0;o<this._png.width;o++){const l=(i*r.width+o)*this._png.channels;for(let c=0;c<this._png.channels;c++)a.data[l+c]=0}break;case Y1.PREVIOUS:a.data.set(s.data);break;default:throw new Error("Unknown disposeOp")}}addFrameDataToCanvas(r,s){const a=1<<this._png.depth,i=(o,l)=>{const c=((o+s.yOffset)*this._png.width+s.xOffset+l)*this._png.channels,d=(o*s.width+l)*this._png.channels;return{index:c,frameIndex:d}};switch(s.blendOp){case ZE.SOURCE:for(let o=0;o<s.height;o++)for(let l=0;l<s.width;l++){const{index:c,frameIndex:d}=i(o,l);for(let u=0;u<this._png.channels;u++)r.data[c+u]=s.data[d+u]}break;case ZE.OVER:for(let o=0;o<s.height;o++)for(let l=0;l<s.width;l++){const{index:c,frameIndex:d}=i(o,l);for(let u=0;u<this._png.channels;u++){const h=s.data[d+this._png.channels-1]/a,m=u%(this._png.channels-1)===0?1:s.data[d+u],f=Math.floor(h*m+(1-h)*r.data[c+u]);r.data[c+u]+=f}}break;default:throw new Error("Unknown blendOp")}}decodeImage(){var s;if(this._inflator.err)throw new Error(`Error while decompressing the data: ${this._inflator.err}`);const r=this._isAnimated?((s=this._frames)==null?void 0:s.at(0)).data:this._inflator.result;if(this._filterMethod!==J9.ADAPTIVE)throw new Error(`Filter method ${this._filterMethod} not supported`);if(this._interlaceMethod===XE.NO_INTERLACE)this._png.data=W9({data:r,width:this._png.width,height:this._png.height,channels:this._png.channels,depth:this._png.depth});else if(this._interlaceMethod===XE.ADAM7)this._png.data=Cot({data:r,width:this._png.width,height:this._png.height,channels:this._png.channels,depth:this._png.depth});else throw new Error(`Interlace method ${this._interlaceMethod} not supported`);this._hasPalette&&(this._png.palette=this._palette),this._hasTransparency&&(this._png.transparency=this._transparency)}pushDataToFrame(){const r=this._inflator.result,s=this._frames.at(-1);s?s.data=r:this._frames.push({sequenceNumber:0,width:this._png.width,height:this._png.height,xOffset:0,yOffset:0,delayNumber:0,delayDenominator:0,disposeOp:Y1.NONE,blendOp:ZE.SOURCE,data:r}),this._inflator=new G9,this._writingDataChunks=!1}}function Qot(e){if(e!==1&&e!==2&&e!==4&&e!==8&&e!==16)throw new Error(`invalid bit depth: ${e}`);return e}var X9;(function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.METRE=1]="METRE"})(X9||(X9={}));function Hot(e,t){return new $ot(e,t).decode()}var jr=function(){return typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:this}();function e4(){jr.console&&typeof jr.console.log=="function"&&jr.console.log.apply(jr.console,arguments)}var zn={log:e4,warn:function(e){jr.console&&(typeof jr.console.warn=="function"?jr.console.warn.apply(jr.console,arguments):e4.call(null,arguments))},error:function(e){jr.console&&(typeof jr.console.error=="function"?jr.console.error.apply(jr.console,arguments):e4(e))}};function t4(e,t,r){var s=new XMLHttpRequest;s.open("GET",e),s.responseType="blob",s.onload=function(){Yf(s.response,t,r)},s.onerror=function(){zn.error("could not download file")},s.send()}function Z9(e){var t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch{}return t.status>=200&&t.status<=299}function J1(e){try{e.dispatchEvent(new MouseEvent("click"))}catch{var t=document.createEvent("MouseEvents");
vendor: 3,408 bytes, lines 1475-1480
1475t.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}var Yf=jr.saveAs||((typeof window>"u"?"undefined":On(window))!=="object"||window!==jr?function(){}:typeof HTMLAnchorElement<"u"&&"download"in HTMLAnchorElement.prototype?function(e,t,r){var s=jr.URL||jr.webkitURL,a=document.createElement("a");t=t||e.name||"download",a.download=t,a.rel="noopener",typeof e=="string"?(a.href=e,a.origin!==location.origin?Z9(a.href)?t4(e,t,r):J1(a,a.target="_blank"):J1(a)):(a.href=s.createObjectURL(e),setTimeout(function(){s.revokeObjectURL(a.href)},4e4),setTimeout(function(){J1(a)},0))}:"msSaveOrOpenBlob"in navigator?function(e,t,r){if(t=t||e.name||"download",typeof e=="string")if(Z9(e))t4(e,t,r);else{var s=document.createElement("a");s.href=e,s.target="_blank",setTimeout(function(){J1(s)})}else navigator.msSaveOrOpenBlob(function(a,i){return i===void 0?i={autoBom:!1}:On(i)!=="object"&&(zn.warn("Deprecated: Expected third argument to be a object"),i={autoBom:!i}),i.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(a.type)?new Blob(["\uFEFF",a],{type:a.type}):a}(e,r),t)}:function(e,t,r,s){if((s=s||open("","_blank"))&&(s.document.title=s.document.body.innerText="downloading..."),typeof e=="string")return t4(e,t,r);var a=e.type==="application/octet-stream",i=/constructor/i.test(jr.HTMLElement)||jr.safari,o=/CriOS\/[\d]+/.test(navigator.userAgent);if((o||a&&i)&&(typeof FileReader>"u"?"undefined":On(FileReader))==="object"){var l=new FileReader;l.onloadend=function(){var u=l.result;u=o?u:u.replace(/^data:[^;]*;/,"data:attachment/file;"),s?s.location.href=u:location=u,s=null},l.readAsDataURL(e)}else{var c=jr.URL||jr.webkitURL,d=c.createObjectURL(e);s?s.location=d:location.href=d,s=null,setTimeout(function(){c.revokeObjectURL(d)},4e4)}});/**
1476 * A class to parse color values
1477 * @author Stoyan Stefanov <[email protected]>
1478 * {@link   http://www.phpied.com/rgb-color-parser-in-javascript/}
1479 * @license Use it if you like it
1480 */function qse(e){var t;e=e||"",this.ok=!1,e.charAt(0)=="#"&&(e=e.substr(1,6)),e={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dodgerblue:"1e90ff",feldspar:"d19275",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgrey:"d3d3d3",lightgreen:"90ee9
14800",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslateblue:"8470ff",lightslategray:"778899",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"00ff00",limegreen:"32cd32",linen:"faf0e6",magenta:"ff00ff",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370d8",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"d87093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",red:"ff0000",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",violetred:"d02090",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"}[e=(e=e.replace(/ /g,"")).toLowerCase()]||e;for(var r=[{re:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,example:["rgb(123, 234, 45)","rgb(255,234,245)"],process:function(l){return[parseInt(l[1]),parseInt(l[2]),parseInt(l[3])]}},{re:/^(\w{2})(\w{2})(\w{2})$/,example:["#00ff00","336699"],process:function(l){return[parseInt(l[1],16),parseInt(l[2],16),parseInt(l[3],16)]}},{re:/^(\w{1})(\w{1})(\w{1})$/,example:["#fb0","f0f"],process:function(l){return[parseInt(l[1]+l[1],16),parseInt(l[2]+l[2],16),parseInt(l[3]+l[3],16)]}}],s=0;s<r.length;s++){var a=r[s].re,i=r[s].process,o=a.exec(e);o&&(t=i(o),this.r=t[0],this.g=t[1],this.b=t[2],this.ok=!0)}this.r=this.r<0||isNaN(this.r)?0:this.r>255?255:this.r,this.g=this.g<0||isNaN(this.g)?0:this.g>255?255:this.g,this.b=this.b<0||isNaN(this.b)?0:this.b>255?255:this.b,this.toRGB=function(){return"rgb("+this.r+", "+this.g+", "+this.b+")"},this.toHex=function(){var l=this.r.toString(16),c=this.g.toString(16),d=this.b.toString(16);return l.length==1&&(l="0"+l),c.length==1&&(c="0"+c),d.length==1&&(d="0"+d),"#"+l+c+d}}var Uj=jr.atob.bind(jr),ez=jr.btoa.bind(jr);/**
1481 * @license
1482 * Joseph Myers does not specify a particular license for his work.
1483 *
1484 * Author: Joseph Myers
1485 * Accessed from: http://www.myersdaily.org/joseph/javascript/md5.js
1486 *
1487 * Modified by: Owen Leong
1488 */function r4(e,t){var r=e[0],s=e[1],a=e[2],i=e[3];r=pi(r,s,a,i,t[0],7,-680876936),i=pi(i,r,s,a,t[1],12,-389564586),a=pi(a,i,r,s,t[2],17,606105819),s=pi(s,a,i,r,t[3],22,-1044525330),r=pi(r,s,a,i,t[4],7,-176418897),i=pi(i,r,s,a,t[5],12,1200080426),a=pi(a,i,r,s,t[6],17,-1473231341),s=pi(s,a,i,r,t[7],22,-45705983),r=pi(r,s,a,i,t[8],7,1770035416),i=pi(i,r,s,a,t[9],12,-1958414417),a=pi(a,i,r,s,t[10],17,-42063),s=pi(s,a,i,r,t[11],22,-1990404162),r=pi(r,s,a,i,t[12],7,1804603682),i=pi(i,r,s,a,t[13],12,-40341101),a=pi(a,i,r,s,t[14],17,-1502002290),r=Ai(r,s=pi(s,a,i,r,t[15],22,1236535329),a,i,t[1],5,-165796510),i=Ai(i,r,s,a,t[6],9,-1069501632),a=Ai(a,i,r,s,t[11],14,643717713),s=Ai(s,a,i,r,t[0],20,-373897302),r=Ai(r,s,a,i,t[5],5,-701558691),i=Ai(i,r,s,a,t[10],9,38016083),a=Ai(a,i,r,s,t[15],14,-660478335),s=Ai(s,a,i,r,t[4],20,-405537848),r=Ai(r,s,a,i,t[9],5,568446438),i=Ai(i,r,s,a,t[14],9,-1019803690),a=Ai(a,i,r,s,t[3],14,-187363961),s=Ai(s,a,i,r,t[8],20,1163531501),r=Ai(r,s,a,i,t[13],5,-1444681467),i=Ai(i,r,s,a,t[2],9,-51403784),a=Ai(a,i,r,s,t[7],14,1735328473),r=gi(r,s=Ai(s,a,i,r,t[12],20,-1926607734),a,i,t[5],4,-378558),i=gi(i,r,s,a,t[8],11,-2022574463),a=gi(a,i,r,s,t[11],16,1839030562),s=gi(s,a,i,r,t[14],23,-35309556),r=gi(r,s,a,i,t[1],4,-1530992060),i=gi(i,r,s,a,t[4],11,1272893353),a=gi(a,i,r,s,t[7],16,-155497632),s=gi(s,a,i,r,t[10],23,-1094730640),r=gi(r,s,a,i,t[13],4,681279174),i=gi(i,r,s,a,t[0],11,-358537222),a=gi(a,i,r,s,t[3],16,-722521979),s=gi(s,a,i,r,t[6],23,76029189),r=gi(r,s,a,i,t[9],4,-640364487),i=gi(i,r,s,a,t[12],11,-421815835),a=gi(a,i,r,s,t[15],16,530742520),r=xi(r,s=gi(s,a,i,r,t[2],23,-995338651),a,i,t[0],6,-198630844),i=xi(i,r,s,a,t[7],10,1126891415),a=xi(a,i,r,s,t[14],15,-1416354905),s=xi(s,a,i,r,t[5],21,-57434055),r
vendor: 8,362 bytes, lines 1488-1505
1488=xi(r,s,a,i,t[12],6,1700485571),i=xi(i,r,s,a,t[3],10,-1894986606),a=xi(a,i,r,s,t[10],15,-1051523),s=xi(s,a,i,r,t[1],21,-2054922799),r=xi(r,s,a,i,t[8],6,1873313359),i=xi(i,r,s,a,t[15],10,-30611744),a=xi(a,i,r,s,t[6],15,-1560198380),s=xi(s,a,i,r,t[13],21,1309151649),r=xi(r,s,a,i,t[4],6,-145523070),i=xi(i,r,s,a,t[11],10,-1120210379),a=xi(a,i,r,s,t[2],15,718787259),s=xi(s,a,i,r,t[9],21,-343485551),e[0]=Th(r,e[0]),e[1]=Th(s,e[1]),e[2]=Th(a,e[2]),e[3]=Th(i,e[3])}function ek(e,t,r,s,a,i){return t=Th(Th(t,e),Th(s,i)),Th(t<<a|t>>>32-a,r)}function pi(e,t,r,s,a,i,o){return ek(t&r|~t&s,e,t,a,i,o)}function Ai(e,t,r,s,a,i,o){return ek(t&s|r&~s,e,t,a,i,o)}function gi(e,t,r,s,a,i,o){return ek(t^r^s,e,t,a,i,o)}function xi(e,t,r,s,a,i,o){return ek(r^(t|~s),e,t,a,i,o)}function Kse(e){var t,r=e.length,s=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=e.length;t+=64)r4(s,zot(e.substring(t-64,t)));e=e.substring(t-64);var a=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t<e.length;t++)a[t>>2]|=e.charCodeAt(t)<<(t%4<<3);if(a[t>>2]|=128<<(t%4<<3),t>55)for(r4(s,a),t=0;t<16;t++)a[t]=0;return a[14]=8*r,r4(s,a),s}function zot(e){var t,r=[];for(t=0;t<64;t+=4)r[t>>2]=e.charCodeAt(t)+(e.charCodeAt(t+1)<<8)+(e.charCodeAt(t+2)<<16)+(e.charCodeAt(t+3)<<24);return r}var tz="0123456789abcdef".split("");function Vot(e){for(var t="",r=0;r<4;r++)t+=tz[e>>8*r+4&15]+tz[e>>8*r&15];return t}function Got(e){return String.fromCharCode(255&e,(65280&e)>>8,(16711680&e)>>16,(4278190080&e)>>24)}function _P(e){return Kse(e).map(Got).join("")}var qot=function(e){for(var t=0;t<e.length;t++)e[t]=Vot(e[t]);return e.join("")}(Kse("hello"))!="5d41402abc4b2a76b9719d911017c592";function Th(e,t){if(qot){var r=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(r>>16)<<16|65535&r}return e+t&4294967295}/**
1489 * @license
1490 * FPDF is released under a permissive license: there is no usage restriction.
1491 * You may embed it freely in your application (commercial or not), with or
1492 * without modifications.
1493 *
1494 * Reference: http://www.fpdf.org/en/script/script37.php
1495 */function CP(e,t){var r,s,a,i;if(e!==r){for(var o=(a=e,i=1+(256/e.length|0),new Array(i+1).join(a)),l=[],c=0;c<256;c++)l[c]=c;var d=0;for(c=0;c<256;c++){var u=l[c];d=(d+u+o.charCodeAt(c))%256,l[c]=l[d],l[d]=u}r=e,s=l}else l=s;var h=t.length,m=0,f=0,p="";for(c=0;c<h;c++)f=(f+(u=l[m=(m+1)%256]))%256,l[m]=l[f],l[f]=u,o=l[(l[m]+l[f])%256],p+=String.fromCharCode(t.charCodeAt(c)^o);return p}/**
1496 * @license
1497 * Licensed under the MIT License.
1498 * http://opensource.org/licenses/mit-license
1499 * Author: Owen Leong (@owenl131)
1500 * Date: 15 Oct 2020
1501 * References:
1502 * https://www.cs.cmu.edu/~dst/Adobe/Gallery/anon21jul01-pdf-encryption.txt
1503 * https://github.com/foliojs/pdfkit/blob/master/lib/security.js
1504 * http://www.fpdf.org/en/script/script37.php
1505 */var rz={print:4,modify:8,copy:16,"annot-forms":32};function lA(e,t,r,s){this.v=1,this.r=2;var a=192;e.forEach(function(l){if(rz.perm!==void 0)throw new Error("Invalid permission: "+l);a+=rz[l]}),this.padding="(¿N^NuŠAd\0NVÿú�\b..\0¶Ðh>€/\f©þdSiz";var i=(t+this.padding).substr(0,32),o=(r+this.padding).substr(0,32);this.O=this.processOwnerPassword(i,o),this.P=-(1+(255^a)),this.encryptionKey=_P(i+this.O+this.lsbFirstWord(this.P)+this.hexToBytes(s)).substr(0,5),this.U=CP(this.encryptionKey,this.padding)}function cA(e){if(/[^\u0000-\u00ff]/.test(e))throw new Error("Invalid PDF Name Object: "+e+", Only accept ASCII characters.");for(var t="",r=e.length,s=0;s<r;s++){var a=e.charCodeAt(s);t+=a<33||a===35||a===37||a===40||a===41||a===47||a===60||a===62||a===91||a===93||a===123||a===125||a>126?"#"+("0"+a.toString(16)).slice(-2):e[s]}return t}function nz(e){if(On(e)!=="object")throw new Error("Invalid Context passed to initialize PubSub (jsPDF-module)");var t={};this.subscribe=function(r,s,a){if(a=a||!1,typeof r!="string"||typeof s!="function"||typeof a!="boolean")throw new Error("Invalid arguments passed to PubSub.subscribe (jsPDF-module)");t.hasOwnProperty(r)||(t[r]={});var i=Math.random().toString(35);return t[r][i]=[s,!!a],i},this.unsubscribe=function(r){for(var s in t)if(t[s][r])return delete t[s][r],Object.keys(t[s]).length===0&&delete t[s],!0;return!1},this.publish=function(r){if(t.hasOwnProperty(r)){var s=Array.prototype.slice.call(arguments,1),a=[];for(var i in t[r]){var o=t[r][i];try{o[0].apply(e,s)}catch(l){jr.console&&zn.error("jsPDF PubSub Error",l.message,l)}o[1]&&a.push(i)}a.length&&a.forEach(this.unsubscribe)}},this.getTopics=function(){return t}}function o_(e){if(!(this instanceof o_))return new o_(e);var t="opacity,stroke-opacity".split(",");for(var r in e)e.hasOwnProperty(r)&&t.indexOf(r)>=0&&(this[r]=e[r]);this.id="",this.objectNumber=-1}function Wse(e,t){this.gState=e,this.matrix=t,this.id="",this.objectNumber=-1}function nm(e,t,r,s,a){if(!(this instanceof nm))return new nm(e,t,r,s,a);this.type=e==="axial"?2:3,this.coords=t,this.colors=r,Wse.call(this,s,a)}function _A(e,t,r,s,a){if(!(this instanceof _A))return new _A(e,t,r,s,a);this.boundingBox=e,this.xStep=t,this.yStep=r,this.stream="",this.cloneIndex=0,Wse.call(this,s,a)}function Wt(e){var t,r=typeof arguments[0]=="string"?arguments[0]:"p",s=arguments[1],a=arguments[2],i=arguments[3],o=[],l=1,c=16,d="S",u=null;On(e=e||{})==="object"&&(r=e.orientation,s=e.unit||s,a=e.format||a,i=e.compress||e.compressPdf||i,(u=e.encryption||null)!==null&&(u.userPassword=u.userPassword||"",u.ownerPassword=u.ownerPassword||"",u.userPermissions=u.userPermissions||[]),l=typeof e.userUnit=="number"?Math.abs(e.userUnit):1,e.precision!==void 0&&(t=e.precision),e.floatPrecision!==void 0&&(c=e.floatPrecision),d=e.defaultPathOperation||"S"),o=e.filters||(i===!0?["FlateEncode"]:o),s=s||"mm",r=(""+(r||"P")).toLowerCase();var h=e.putOnlyUsedFonts||!1,m={},f={internal:{},__private__:{}};f.__private__.PubSub=nz;var p="1.3",A=f.__private__.getPdfVersion=function(){return p};f.__private__.setPdfVersion=function(H){p=H};var v={a0:[2383.94,3370.39],a1:[1683.78,2383.94],a2:[1190.55,1683.78],a3:[841.89,1190.55],a4:[595.28,841.89],a5:[419.53,595.28],a6:[297.64,419.53],a7:[209.76,297.64],a8:[147.4,209.76],a9:[104.88,147.4],a10:[73.7,104.88],b0:[2834.65,4008.19],b1:[2004.09,2834.65],b2:[1417.32,2004.09],b3:[1000.63,1417.32],b4:[708.66,1000.63],b5:[498.9,708.66],b6:[354.33,498.9],b7:[249.45,354.33],b8:[175.75,249.45],b9:[124.72,175.75],b10:[87.87,124.72],c0:[2599.37,3676.54],c1:[1836.85,2599.37],c2:[1298.27,1836.85],c3:[918.43,1298.27],c4:[649.13,918.43],c5:[459.21,649.13],c6:[323.15,459.21],c7:[229.61,323.15],c8:[161.57,229.61],c9:[113.39,161.57],c10:[79.37,113.39],dl:[311.81,623.62],letter:[612,792],"government-letter":[576,756],legal:[612,1008],"junior-legal":[576,360],ledger:[1224,792],tabloid:[792,1224],"credit-card":[153,243]};f.__private__.getPageFormats=function(){return v};var x=f.__private__.getPageFormat=function(H){return v[H]};a=a||"a4";var b="compat",y="advanced",w=b;function j(){this.saveGraphicsState(),ee(new xt(Ge,0,0,-Ge,0,wf()*Ge).toString()+" cm"),this.setFontSize(this.getFontSize()/Ge),d="n",w=y}function N(){this.restoreGraphicsState(),d="S",w=b}var _=f.__private__.combineFontStyleAndFontWeight=function(H,le){if(H=="bold"&&le=="normal"||H=="bold"&&le==400||H=="normal"&&le=="italic"||H=="bold"&&le=="italic")throw new Error("Invalid Combination of fontweight and fontstyle");return le&&(H=le==400||le==="normal"?H==="italic"?"italic":"normal":le!=700&&le!=="bold"||H!=="normal"?(le==700?"bold":le)+""+H:"bold"),H};f.advancedAPI=function(H){var le=w===b;return le&&j.call(this),typeof H!="function"||(H(this),le&&N.call(this)),this},f.compatAPI=function(H){var le=w===y;return le&&N.call(this),typeof H!="function"||(H(this),le&&j.call(this)),this},f.isAdvancedAPI=function(){return w===y};var S,C=function(H){if(w!==y)throw new Error(H+" is only available in 'advanced' API mode. You need to call advancedAPI() first.")},E=f.roundToPrecision=f.__private__.roundToPrecision=function(H,le){var _e=t||le;if(isNaN(H)||isNaN(_e))throw new Error("Invalid argument passed to jsPDF.roundToPrecision");return H.toFixed(_e).replace(/0+$/,"")};S=f.hpf=f.__private__.hpf=typeof c=="number"?function(H){if(isNaN(H))throw new Error("Invalid argument passed to jsPDF.hpf");return E(H,c)}:c==="smart"?function(H){if(isNaN(H))throw new Error("Invalid argument passed to jsPDF.hpf");return E(H,H>-1&&H<1?16:5)}:function(H){if(isNaN(H))throw new Error("Invalid argument passed to 
1505jsPDF.hpf");return E(H,16)};var T=f.f2=f.__private__.f2=function(H){if(isNaN(H))throw new Error("Invalid argument passed to jsPDF.f2");return E(H,2)},B=f.__private__.f3=function(H){if(isNaN(H))throw new Error("Invalid argument passed to jsPDF.f3");return E(H,3)},L=f.scale=f.__private__.scale=function(H){if(isNaN(H))throw new Error("Invalid argument passed to jsPDF.scale");return w===b?H*Ge:w===y?H:void 0},P=function(H){return L(function(le){return w===b?wf()-le:w===y?le:void 0}(H))};f.__private__.setPrecision=f.setPrecision=function(H){typeof parseInt(H,10)=="number"&&(t=parseInt(H,10))};var F,M="00000000000000000000000000000000",I=f.__private__.getFileId=function(){return M},$=f.__private__.setFileId=function(H){return M=H!==void 0&&/^[a-fA-F0-9]{32}$/.test(H)?H.toUpperCase():M.split("").map(function(){return"ABCDEF0123456789".charAt(Math.floor(16*Math.random()))}).join(""),u!==null&&(ja=new lA(u.userPermissions,u.userPassword,u.ownerPassword,M)),M};f.setFileId=function(H){return $(H),this},f.getFileId=function(){return I()};var V=f.__private__.convertDateToPDFDate=function(H){var le=H.getTimezoneOffset(),_e=le<0?"+":"-",ke=Math.floor(Math.abs(le/60)),Ue=Math.abs(le%60),Ze=[_e,q(ke),"'",q(Ue),"'"].join("");return["D:",H.getFullYear(),q(H.getMonth()+1),q(H.getDate()),q(H.getHours()),q(H.getMinutes()),q(H.getSeconds()),Ze].join("")},R=f.__private__.convertPDFDateToDate=function(H){var le=parseInt(H.substr(2,4),10),_e=parseInt(H.substr(6,2),10)-1,ke=parseInt(H.substr(8,2),10),Ue=parseInt(H.substr(10,2),10),Ze=parseInt(H.substr(12,2),10),rt=parseInt(H.substr(14,2),10);return new Date(le,_e,ke,Ue,Ze,rt,0)},Q=f.__private__.setCreationDate=function(H){var le;if(H===void 0&&(H=new Date),H instanceof Date)le=V(H);else{if(!/^D:(20[0-2][0-9]|203[0-7]|19[7-9][0-9])(0[0-9]|1[0-2])([0-2][0-9]|3[0-1])(0[0-9]|1[0-9]|2[0-3])(0[0-9]|[1-5][0-9])(0[0-9]|[1-5][0-9])(\+0[0-9]|\+1[0-4]|-0[0-9]|-1[0-1])'(0[0-9]|[1-5][0-9])'?$/.test(H))throw new Error("Invalid argument passed to jsPDF.setCreationDate");le=H}return F=le},U=f.__private__.getCreationDate=function(H){var le=F;return H==="jsDate"&&(le=R(F)),le};f.setCreationDate=function(H){return Q(H),this},f.getCreationDate=function(H){return U(H)};var D,q=f.__private__.padd2=function(H){return("0"+parseInt(H)).slice(-2)},G=f.__private__.padd2Hex=function(H){return("00"+(H=H.toString())).substr(H.length)},Y=0,K=[],X=[],ne=0,ae=[],J=[],W=!1,ie=X;f.__private__.setCustomOutputDestination=function(H){W=!0,ie=H};var he=function(H){W||(ie=H)};f.__private__.resetCustomOutputDestination=function(){W=!1,ie=X};var ee=f.__private__.out=function(H){return H=H.toString(),ne+=H.length+1,ie.push(H),ie},xe=f.__private__.write=function(H){return ee(arguments.length===1?H.toString():Array.prototype.join.call(arguments," "))},we=f.__private__.getArrayBuffer=function(H){for(var le=H.length,_e=new ArrayBuffer(le),ke=new Uint8Array(_e);le--;)ke[le]=H.charCodeAt(le);return _e},Se=[["Helvetica","helvetica","normal","WinAnsiEncoding"],["Helvetica-Bold","helvetica","bold","WinAnsiEncoding"],["Helvetica-Oblique","helvetica","italic","WinAnsiEncoding"],["Helvetica-BoldOblique","helvetica","bolditalic","WinAnsiEncoding"],["Courier","courier","normal","WinAnsiEncoding"],["Courier-Bold","courier","bold","WinAnsiEncoding"],["Courier-Oblique","courier","italic","WinAnsiEncoding"],["Courier-BoldOblique","courier","bolditalic","WinAnsiEncoding"],["Times-Roman","times","normal","WinAnsiEncoding"],["Times-Bold","times","bold","WinAnsiEncoding"],["Times-Italic","times","italic","WinAnsiEncoding"],["Times-BoldItalic","times","bolditalic","WinAnsiEncoding"],["ZapfDingbats","zapfdingbats","normal",null],["Symbol","symbol","normal",null]];f.__private__.getStandardFonts=function(){return Se};var pe=e.fontSize||16;f.__private__.setFontSize=f.setFontSize=function(H){return pe=w===y?H/Ge:H,this};var Ce,re=f.__private__.getFontSize=f.getFontSize=function(){return w===b?pe:pe*Ge},se=e.R2L||!1;f.__private__.setR2L=f.setR2L=function(H){return se=H,this},f.__private__.getR2L=f.getR2L=function(){return se};var Ae,Pe=f.__private__.setZoomMode=function(H){if(/^(?:\d+\.\d*|\d*\.\d+|\d+)%$/.test(H))Ce=H;else if(isNaN(H)){if([void 0,null,"fullwidth","fullheight","fullpage","original"].indexOf(H)===-1)throw new Error('zoom must be Integer (e.g. 2), a percentage Value (e.g. 300%) or fullwidth, fullheight, fullpage, original. "'+H+'" is not recognized.');Ce=H}else Ce=parseInt(H,10)};f.__private__.getZoomMode=function(){return Ce};var Oe,be=f.__private__.setPageMode=function(H){if([void 0,null,"UseNone","UseOutlines","UseThumbs","FullScreen"].indexOf(H)==-1)throw new Error('Page mode must be one of UseNone, UseOutlines, UseThumbs, or FullScreen. "'+H+'" is not recognized.');Ae=H};f.__private__.getPageMode=function(){return Ae};var ue=f.__private__.setLayoutMode=function(H){if([void 0,null,"continuous","single","twoleft","tworight","two"].indexOf(H)==-1)throw new Error('Layout mode must be one of continuous, single, twoleft, tworight. "'+H+'" is not recognized.');Oe=H};f.__private__.getLayoutMode=function(){return Oe},f.__private__.setDisplayMode=f.setDisplayMode=function(H,le,_e){return Pe(H),ue(le),be(_e),this};var Ee={title:"",subject:"",author:"",keywords:"",creator:""};f.__private__.getDocumentProperty=function(H){if(Object.keys(Ee).indexOf(H)===-1)throw new Error("Invalid argument passed to 
1505jsPDF.getDocumentProperty");return Ee[H]},f.__private__.getDocumentProperties=function(){return Ee},f.__private__.setDocumentProperties=f.setProperties=f.setDocumentProperties=function(H){for(var le in Ee)Ee.hasOwnProperty(le)&&H[le]&&(Ee[le]=H[le]);return this},f.__private__.setDocumentProperty=function(H,le){if(Object.keys(Ee).indexOf(H)===-1)throw new Error("Invalid arguments passed to jsPDF.setDocumentProperty");return Ee[H]=le};var De,Ge,Ye,Tt,Nt,Pt={},_t={},zt=[],vt={},vr={},Rt={},rr={},an=null,It=0,ht=[],ar=new nz(f),tt=e.hotfixes||[],it={},gt={},pr=[],xt=function H(le,_e,ke,Ue,Ze,rt){if(!(this instanceof H))return new H(le,_e,ke,Ue,Ze,rt);isNaN(le)&&(le=1),isNaN(_e)&&(_e=0),isNaN(ke)&&(ke=0),isNaN(Ue)&&(Ue=1),isNaN(Ze)&&(Ze=0),isNaN(rt)&&(rt=0),this._matrix=[le,_e,ke,Ue,Ze,rt]};Object.defineProperty(xt.prototype,"sx",{get:function(){return this._matrix[0]},set:function(H){this._matrix[0]=H}}),Object.defineProperty(xt.prototype,"shy",{get:function(){return this._matrix[1]},set:function(H){this._matrix[1]=H}}),Object.defineProperty(xt.prototype,"shx",{get:function(){return this._matrix[2]},set:function(H){this._matrix[2]=H}}),Object.defineProperty(xt.prototype,"sy",{get:function(){return this._matrix[3]},set:function(H){this._matrix[3]=H}}),Object.defineProperty(xt.prototype,"tx",{get:function(){return this._matrix[4]},set:function(H){this._matrix[4]=H}}),Object.defineProperty(xt.prototype,"ty",{get:function(){return this._matrix[5]},set:function(H){this._matrix[5]=H}}),Object.defineProperty(xt.prototype,"a",{get:function(){return this._matrix[0]},set:function(H){this._matrix[0]=H}}),Object.defineProperty(xt.prototype,"b",{get:function(){return this._matrix[1]},set:function(H){this._matrix[1]=H}}),Object.defineProperty(xt.prototype,"c",{get:function(){return this._matrix[2]},set:function(H){this._matrix[2]=H}}),Object.defineProperty(xt.prototype,"d",{get:function(){return this._matrix[3]},set:function(H){this._matrix[3]=H}}),Object.defineProperty(xt.prototype,"e",{get:function(){return this._matrix[4]},set:function(H){this._matrix[4]=H}}),Object.defineProperty(xt.prototype,"f",{get:function(){return this._matrix[5]},set:function(H){this._matrix[5]=H}}),Object.defineProperty(xt.prototype,"rotation",{get:function(){return Math.atan2(this.shx,this.sx)}}),Object.defineProperty(xt.prototype,"scaleX",{get:function(){return this.decompose().scale.sx}}),Object.defineProperty(xt.prototype,"scaleY",{get:function(){return this.decompose().scale.sy}}),Object.defineProperty(xt.prototype,"isIdentity",{get:function(){return this.sx===1&&this.shy===0&&this.shx===0&&this.sy===1&&this.tx===0&&this.ty===0}}),xt.prototype.join=function(H){return[this.sx,this.shy,this.shx,this.sy,this.tx,this.ty].map(S).join(H)},xt.prototype.multiply=function(H){var le=H.sx*this.sx+H.shy*this.shx,_e=H.sx*this.shy+H.shy*this.sy,ke=H.shx*this.sx+H.sy*this.shx,Ue=H.shx*this.shy+H.sy*this.sy,Ze=H.tx*this.sx+H.ty*this.shx+this.tx,rt=H.tx*this.shy+H.ty*this.sy+this.ty;return new xt(le,_e,ke,Ue,Ze,rt)},xt.prototype.decompose=function(){var H=this.sx,le=this.shy,_e=this.shx,ke=this.sy,Ue=this.tx,Ze=this.ty,rt=Math.sqrt(H*H+le*le),Ut=(H/=rt)*_e+(le/=rt)*ke;_e-=H*Ut,ke-=le*Ut;var Gt=Math.sqrt(_e*_e+ke*ke);return Ut/=Gt,H*(ke/=Gt)<le*(_e/=Gt)&&(H=-H,le=-le,Ut=-Ut,rt=-rt),{scale:new xt(rt,0,0,Gt,0,0),translate:new xt(1,0,0,1,Ue,Ze),rotate:new xt(H,le,-le,H,0,0),skew:new xt(1,0,Ut,1,0,0)}},xt.prototype.toString=function(H){return this.join(" ")},xt.prototype.inversed=function(){var H=this.sx,le=this.shy,_e=this.shx,ke=this.sy,Ue=this.tx,Ze=this.ty,rt=1/(H*ke-le*_e),Ut=ke*rt,Gt=-le*rt,Cr=-_e*rt,Or=H*rt;return new xt(Ut,Gt,Cr,Or,-Ut*Ue-Cr*Ze,-Gt*Ue-Or*Ze)},xt.prototype.applyToPoint=function(H){var le=H.x*this.sx+H.y*this.shx+this.tx,_e=H.x*this.shy+H.y*this.sy+this.ty;return new Od(le,_e)},xt.prototype.applyToRectangle=function(H){var le=this.applyToPoint(H),_e=this.applyToPoint(new Od(H.x+H.w,H.y+H.h));return new H0(le.x,le.y,_e.x-le.x,_e.y-le.y)},xt.prototype.clone=function(){var H=this.sx,le=this.shy,_e=this.shx,ke=this.sy,Ue=this.tx,Ze=this.ty;return new xt(H,le,_e,ke,Ue,Ze)},f.Matrix=xt;var Lr=f.matrixMult=function(H,le){return le.multiply(H)},En=new xt(1,0,0,1,0,0);f.unitMatrix=f.identityMatrix=En;var qr=function(H,le){if(!vr[H]){var _e=(le instanceof nm?"Sh":"P")+(Object.keys(vt).length+1).toString(10);le.id=_e,vr[H]=_e,vt[_e]=le,ar.publish("addPattern",le)}};f.ShadingPattern=nm,f.TilingPattern=_A,f.addShadingPattern=function(H,le){return C("addShadingPattern()"),qr(H,le),this}
vendor: 12,219 bytes, lines 1505-1509
1505,f.beginTilingPattern=function(H){C("beginTilingPattern()"),z0(H.boundingBox[0],H.boundingBox[1],H.boundingBox[2]-H.boundingBox[0],H.boundingBox[3]-H.boundingBox[1],H.matrix)},f.endTilingPattern=function(H,le){C("endTilingPattern()"),le.stream=J[D].join(`
1506`),qr(H,le),ar.publish("endTilingPattern",le),pr.pop().restore()};var pn,Ln=f.__private__.newObject=function(){var H=As();return Yn(H,!0),H},As=f.__private__.newObjectDeferred=function(){return Y++,K[Y]=function(){return ne},Y},Yn=function(H,le){return le=typeof le=="boolean"&&le,K[H]=ne,le&&ee(H+" 0 obj"),H},jo=f.__private__.newAdditionalObject=function(){var H={objId:As(),content:""};return ae.push(H),H},ul=As(),Wl=As(),Lc=f.__private__.decodeColorString=function(H){var le=H.split(" ");if(le.length!==2||le[1]!=="g"&&le[1]!=="G")le.length!==5||le[4]!=="k"&&le[4]!=="K"||(le=[(1-le[0])*(1-le[3]),(1-le[1])*(1-le[3]),(1-le[2])*(1-le[3]),"r"]);else{var _e=parseFloat(le[0]);le=[_e,_e,_e,"r"]}for(var ke="#",Ue=0;Ue<3;Ue++)ke+=("0"+Math.floor(255*parseFloat(le[Ue])).toString(16)).slice(-2);return ke},Yl=f.__private__.encodeColorString=function(H){var le;typeof H=="string"&&(H={ch1:H});var _e=H.ch1,ke=H.ch2,Ue=H.ch3,Ze=H.ch4,rt=H.pdfColorType==="draw"?["G","RG","K"]:["g","rg","k"];if(typeof _e=="string"&&_e.charAt(0)!=="#"){var Ut=new qse(_e);if(Ut.ok)_e=Ut.toHex();else if(!/^\d*\.?\d*$/.test(_e))throw new Error('Invalid color "'+_e+'" passed to jsPDF.encodeColorString.')}if(typeof _e=="string"&&/^#[0-9A-Fa-f]{3}$/.test(_e)&&(_e="#"+_e[1]+_e[1]+_e[2]+_e[2]+_e[3]+_e[3]),typeof _e=="string"&&/^#[0-9A-Fa-f]{6}$/.test(_e)){var Gt=parseInt(_e.substr(1),16);_e=Gt>>16&255,ke=Gt>>8&255,Ue=255&Gt}if(ke===void 0||Ze===void 0&&_e===ke&&ke===Ue)le=typeof _e=="string"?_e+" "+rt[0]:H.precision===2?T(_e/255)+" "+rt[0]:B(_e/255)+" "+rt[0];else if(Ze===void 0||On(Ze)==="object"){if(Ze&&!isNaN(Ze.a)&&Ze.a===0)return["1.","1.","1.",rt[1]].join(" ");le=typeof _e=="string"?[_e,ke,Ue,rt[1]].join(" "):H.precision===2?[T(_e/255),T(ke/255),T(Ue/255),rt[1]].join(" "):[B(_e/255),B(ke/255),B(Ue/255),rt[1]].join(" ")}else le=typeof _e=="string"?[_e,ke,Ue,Ze,rt[2]].join(" "):H.precision===2?[T(_e),T(ke),T(Ue),T(Ze),rt[2]].join(" "):[B(_e),B(ke),B(Ue),B(Ze),rt[2]].join(" ");return le},Jl=f.__private__.getFilters=function(){return o},hl=f.__private__.putStream=function(H){var le=(H=H||{}).data||"",_e=H.filters||Jl(),ke=H.alreadyAppliedFilters||[],Ue=H.addLength1||!1,Ze=le.length,rt=H.objectId,Ut=function(Na){return Na};if(u!==null&&rt===void 0)throw new Error("ObjectId must be passed to putStream for file encryption");u!==null&&(Ut=ja.encryptor(rt,0));var Gt={};_e===!0&&(_e=["FlateEncode"]);var Cr=H.additionalKeyValues||[],Or=(Gt=Wt.API.processDataByFilters!==void 0?Wt.API.processDataByFilters(le,_e):{data:le,reverseChain:[]}).reverseChain+(Array.isArray(ke)?ke.join(" "):ke.toString());if(Gt.data.length!==0&&(Cr.push({key:"Length",value:Gt.data.length}),Ue===!0&&Cr.push({key:"Length1",value:Ze})),Or.length!=0)if(Or.split("/").length-1==1)Cr.push({key:"Filter",value:Or});else{Cr.push({key:"Filter",value:"["+Or+"]"});for(var ln=0;ln<Cr.length;ln+=1)if(Cr[ln].key==="DecodeParms"){for(var Ss=[],oa=0;oa<Gt.reverseChain.split("/").length-1;oa+=1)Ss.push("null");Ss.push(Cr[ln].value),Cr[ln].value="["+Ss.join(" ")+"]"}}ee("<<");for(var Jn=0;Jn<Cr.length;Jn++)ee("/"+Cr[Jn].key+" "+Cr[Jn].value);ee(">>"),Gt.data.length!==0&&(ee("stream"),ee(Ut(Gt.data)),ee("endstream"))},Af=f.__private__.putPage=function(H){var le=H.number,_e=H.data,ke=H.objId,Ue=H.contentsObjId;Yn(ke,!0),ee("<</Type /Page"),ee("/Parent "+H.rootDictionaryObjId+" 0 R"),ee("/Resources "+H.resourceDictionaryObjId+" 0 R"),ee("/MediaBox ["+parseFloat(S(H.mediaBox.bottomLeftX))+" "+parseFloat(S(H.mediaBox.bottomLeftY))+" "+S(H.mediaBox.topRightX)+" "+S(H.mediaBox.topRightY)+"]"),H.cropBox!==null&&ee("/CropBox ["+S(H.cropBox.bottomLeftX)+" "+S(H.cropBox.bottomLeftY)+" "+S(H.cropBox.topRightX)+" "+S(H.cropBox.topRightY)+"]"),H.bleedBox!==null&&ee("/BleedBox ["+S(H.bleedBox.bottomLeftX)+" "+S(H.bleedBox.bottomLeftY)+" "+S(H.bleedBox.topRightX)+" "+S(H.bleedBox.topRightY)+"]"),H.trimBox!==null&&ee("/TrimBox ["+S(H.trimBox.bottomLeftX)+" "+S(H.trimBox.bottomLeftY)+" "+S(H.trimBox.topRightX)+" "+S(H.trimBox.topRightY)+"]"),H.artBox!==null&&ee("/ArtBox ["+S(H.artBox.bottomLeftX)+" "+S(H.artBox.bottomLeftY)+" "+S(H.artBox.topRightX)+" "+S(H.artBox.topRightY)+"]"),typeof H.userUnit=="number"&&H.userUnit!==1&&ee("/UserUnit "+H.userUnit),ar.publish("putPage",{objId:ke,pageContext:ht[le],pageNumber:le,page:_e}),ee("/Contents "+Ue+" 0 R"),ee(">>"),ee("endobj");var Ze=_e.join(`
1507`);return w===y&&(Ze+=`
1508Q`),Yn(Ue,!0),hl({data:Ze,filters:Jl(),objectId:Ue}),ee("endobj"),ke},Dc=f.__private__.putPages=function(){var H,le,_e=[];for(H=1;H<=It;H++)ht[H].objId=As(),ht[H].contentsObjId=As();for(H=1;H<=It;H++)_e.push(Af({number:H,data:J[H],objId:ht[H].objId,contentsObjId:ht[H].contentsObjId,mediaBox:ht[H].mediaBox,cropBox:ht[H].cropBox,bleedBox:ht[H].bleedBox,trimBox:ht[H].trimBox,artBox:ht[H].artBox,userUnit:ht[H].userUnit,rootDictionaryObjId:ul,resourceDictionaryObjId:Wl}));Yn(ul,!0),ee("<</Type /Pages");var ke="/Kids [";for(le=0;le<It;le++)ke+=_e[le]+" 0 R ";ee(ke+"]"),ee("/Count "+It),ee(">>"),ee("endobj"),ar.publish("postPutPages")},gf=function(H){ar.publish("putFont",{font:H,out:ee,newObject:Ln,putStream:hl}),H.isAlreadyPutted!==!0&&(H.objectNumber=Ln(),ee("<<"),ee("/Type /Font"),ee("/BaseFont /"+cA(H.postScriptName)),ee("/Subtype /Type1"),typeof H.encoding=="string"&&ee("/Encoding /"+H.encoding),ee("/FirstChar 32"),ee("/LastChar 255"),ee(">>"),ee("endobj"))},fp=function(H){H.objectNumber=Ln();var le=[];le.push({key:"Type",value:"/XObject"}),le.push({key:"Subtype",value:"/Form"}),le.push({key:"BBox",value:"["+[S(H.x),S(H.y),S(H.x+H.width),S(H.y+H.height)].join(" ")+"]"}),le.push({key:"Matrix",value:"["+H.matrix.toString()+"]"});var _e=H.pages[1].join(`
1509`);hl({data:_e,additionalKeyValues:le,objectId:H.objectNumber}),ee("endobj")},mp=function(H,le){le||(le=21);var _e=Ln(),ke=function(rt,Ut){var Gt,Cr=[],Or=1/(Ut-1);for(Gt=0;Gt<1;Gt+=Or)Cr.push(Gt);if(Cr.push(1),rt[0].offset!=0){var ln={offset:0,color:rt[0].color};rt.unshift(ln)}if(rt[rt.length-1].offset!=1){var Ss={offset:1,color:rt[rt.length-1].color};rt.push(Ss)}for(var oa="",Jn=0,Na=0;Na<Cr.length;Na++){for(Gt=Cr[Na];Gt>rt[Jn+1].offset;)Jn++;var la=rt[Jn].offset,Xa=(Gt-la)/(rt[Jn+1].offset-la),Dd=rt[Jn].color,Zl=rt[Jn+1].color;oa+=G(Math.round((1-Xa)*Dd[0]+Xa*Zl[0]).toString(16))+G(Math.round((1-Xa)*Dd[1]+Xa*Zl[1]).toString(16))+G(Math.round((1-Xa)*Dd[2]+Xa*Zl[2]).toString(16))}return oa.trim()}(H.colors,le),Ue=[];Ue.push({key:"FunctionType",value:"0"}),Ue.push({key:"Domain",value:"[0.0 1.0]"}),Ue.push({key:"Size",value:"["+le+"]"}),Ue.push({key:"BitsPerSample",value:"8"}),Ue.push({key:"Range",value:"[0.0 1.0 0.0 1.0 0.0 1.0]"}),Ue.push({key:"Decode",value:"[0.0 1.0 0.0 1.0 0.0 1.0]"}),hl({data:ke,additionalKeyValues:Ue,alreadyAppliedFilters:["/ASCIIHexDecode"],objectId:_e}),ee("endobj"),H.objectNumber=Ln(),ee("<< /ShadingType "+H.type),ee("/ColorSpace /DeviceRGB");var Ze="/Coords ["+S(parseFloat(H.coords[0]))+" "+S(parseFloat(H.coords[1]))+" ";H.type===2?Ze+=S(parseFloat(H.coords[2]))+" "+S(parseFloat(H.coords[3])):Ze+=S(parseFloat(H.coords[2]))+" "+S(parseFloat(H.coords[3]))+" "+S(parseFloat(H.coords[4]))+" "+S(parseFloat(H.coords[5])),ee(Ze+="]"),H.matrix&&ee("/Matrix ["+H.matrix.toString()+"]"),ee("/Function "+_e+" 0 R"),ee("/Extend [true true]"),ee(">>"),ee("endobj")},pp=function(H,le){var _e=As(),ke=Ln();le.push({resourcesOid:_e,objectOid:ke}),H.objectNumber=ke;var Ue=[];Ue.push({key:"Type",value:"/Pattern"}),Ue.push({key:"PatternType",value:"1"}),Ue.push({key:"PaintType",value:"1"}),Ue.push({key:"TilingType",value:"1"}),Ue.push({key:"BBox",value:"["+H.boundingBox.map(S).join(" ")+"]"}),Ue.push({key:"XStep",value:S(H.xStep)}),Ue.push({key:"YStep",value:S(H.yStep)}),Ue.push({key:"Resources",value:_e+" 0 R"}),H.matrix&&Ue.push({key:"Matrix",value:"["+H.matrix.toString()+"]"}),hl({data:H.stream,additionalKeyValues:Ue,objectId:H.objectNumber}),ee("endobj")},Bk=function(H){for(var le in H.objectNumber=Ln(),ee("<<"),H)switch(le){case"opacity":ee("/ca "+T(H[le]));break;case"stroke-opacity":ee("/CA "+T(H[le]))}ee(">>"),ee("endobj")},F0=function(H){Yn(H.resourcesOid,!0),ee("<<"),ee("/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]"),function(){for(var le in ee("/Font <<"),Pt)Pt.hasOwnProperty(le)&&(h===!1||h===!0&&m.hasOwnProperty(le))&&ee("/"+le+" "+Pt[le].objectNumber+" 0 R");ee(">>")}(),function(){if(Object.keys(vt).length>0){for(var le in ee("/Shading <<"),vt)vt.hasOwnProperty(le)&&vt[le]instanceof nm&&vt[le].objectNumber>=0&&ee("/"+le+" "+vt[le].objectNumber+" 0 R");ar.publish("putShadingPatternDict"),ee(">>")}}(),function(le){if(Object.keys(vt).length>0){for(var _e in ee("/Pattern <<"),vt)vt.hasOwnProperty(_e)&&vt[_e]instanceof f.TilingPattern&&vt[_e].objectNumber>=0&&vt[_e].objectNumber<le&&ee("/"+_e+" "+vt[_e].objectNumber+" 0 R");ar.publish("putTilingPatternDict"),ee(">>")}}(H.objectOid),function(){if(Object.keys(Rt).length>0){var le;for(le in ee("/ExtGState <<"),Rt)Rt.hasOwnProperty(le)&&Rt[le].objectNumber>=0&&ee("/"+le+" "+Rt[le].objectNumber+" 0 R");ar.publish("putGStateDict"),ee(">>")}}(),function(){for(var le in ee("/XObject <<"),it)it.hasOwnProperty(le)&&it[le].objectNumber>=0&&ee("/"+le+" "+it[le].objectNumber+" 0 R");ar.publish("putXobjectDict"),ee(">>")}(),ee(">>"),ee("endobj")},lw=function(H){_t[H.fontName]=_t[H.fontName]||{},_t[H.fontName][H.fontStyle]=H.id},cw=function(H,le,_e,ke,Ue){var Ze={id:"F"+(Object.keys(Pt).length+1).toString(10),postScriptName:H,fontName:le,fontStyle:_e,encoding:ke,isStandardFont:Ue||!1,metadata:{}};return ar.publish("addFont",{font:Ze,instance:this}),Pt[Ze.id]=Ze,lw(Ze),Ze.id},fl=f.__private__.pdfEscape=f.pdfEscape=function(H,le){return function(_e,ke){var Ue,Ze,rt,Ut,Gt,Cr,Or,ln,Ss;if(rt=(ke=ke||{}).sourceEncoding||"Unicode",Gt=ke.outputEncoding,(ke.autoencode||Gt)&&Pt[De].metadata&&Pt[De].metadata[rt]&&Pt[De].metadata[rt].encoding&&(Ut=Pt[De].metadata[rt].encoding,!Gt&&Pt[De].encoding&&(Gt=Pt[De].encoding),!Gt&&Ut.codePages&&(Gt=Ut.codePages[0]),typeof Gt=="string"&&(Gt=Ut[Gt]),Gt)){for(Or=!1,Cr=[],Ue=0,Ze=_e.length;Ue<Ze;Ue++)(ln=Gt[_e.charCodeAt(Ue)])?Cr.push(String.fromCharCode(ln)):Cr.push(_e[Ue]),Cr[Ue].charCodeAt(0)>>8&&(Or=!0);_e=Cr.join("")}for(Ue=_e.length;Or===void 0&&Ue!==0;)_e.charCodeAt(Ue-1)>>8&&(Or=!0),Ue--;if(!Or)return _e;for(Cr=ke.noBOM?[]:[254,255],Ue=0,Ze=_e.length;Ue<Ze;Ue++){if((Ss=(ln=_e.charCodeAt(Ue))>>8)>>8)throw new Error("Character at position "+Ue+" of string '"+_e+"' exceeds 16bits. Cannot be encoded into UCS-2 BE");Cr.push(Ss),Cr.push(ln-(Ss<<8))}return String.fromCharCode.apply(void 0,Cr)}(H,le).replace(/\\/g,"\\\\").replace(/\(/g,"\\(").replace(/\)/g,"\\)")},L0=f.__private__.beginPage=function(H){J[++It]=[],ht[It]={objId:0,contentsObjId:0,userUnit:Number(l),artBox:null,bleedBox:null,cropBox:null,trimBox:null,mediaBox:{bottomLeftX:0,bottomLeftY:0,topRightX:Number(H[0]),topRightY:Number(H[1])}},uw(It),he(J[D])},dw=function(H,le){var _e,ke,Ue;switch(r=le||r,typeof H=="string"&&(_e=x(H.toLowerCase()),Array.isArray(_e)&&(ke=_e[0],Ue=_e[1])),Array.isArray(H)&&(ke=H[0]*Ge,Ue=H[1]*Ge),isNaN(ke)&&(ke=a[0],Ue=a[1]),(ke>14400||Ue>14400)&&(zn.warn("A page in a PDF can not be wider or taller than 14400 userUnit. jsPDF limits the width/height to 14400"),ke=Math.min(14400,ke),Ue=Math.min(14400,Ue)),a=[ke,Ue],r.substr(0,1)){case"l":Ue>ke&&(a=[Ue,ke]);break;case"p":ke>Ue&&(a=[Ue,ke])}L0(a),Sr(U0),ee(vp),$0!==0&&ee($0+" J"),Q0!==0&&ee(Q0+" j"),ar.publish("addPage",{pageNumber:It})},D0=function(H){H>0&&H<=It&&(J.splice(H,1),ht.splice(H,1),It--,D>It&&(D=It),this.setPage(D))},uw=function(H){H>0&&H<=It&&(D=H)},hw=f.__private__.getNumberOfPages=f.getNumberOfPages=function(){return J.length-1},fw=function(H,le,_e){var ke,Ue=void 0;return _e=_e||{},H=H!==void 0?H:Pt[De].fontName,le=le!==void 0?le:Pt[De].fontStyle,ke=H.toLowerCase(),_t[ke]!==void 0&&_t[ke][le]!==void 0?Ue=_t[ke][le]:_t[H]!==void 0&&_t[H][le]!==void 0?Ue=_t[H][le]:_e.disableWarning===!1&&zn.warn("Unable to look up font label for font '"+H+"', '"+le+"'. Refer to getFontList(
1509) for available fonts."),Ue||_e.noFallback||(Ue=_t.times[le])==null&&(Ue=_t.times.normal),Ue},Rc=f.__private__.putInfo=function(){var H=Ln(),le=function(ke){return ke};for(var _e in u!==null&&(le=ja.encryptor(H,0)),ee("<<"),ee("/Producer ("+fl(le("jsPDF "+Wt.version))+")"),Ee)Ee.hasOwnProperty(_e)&&Ee[_e]&&ee("/"+_e.substr(0,1).toUpperCase()+_e.substr(1)+" ("+fl(le(Ee[_e]))+")");ee("/CreationDate ("+fl(le(F))+")"),ee(">>"),ee("endobj")},Ap=f.__private__.putCatalog=function(H){var le=(H=H||{}).rootDictionaryObjId||ul;switch(Ln(),ee("<<"),ee("/Type /Catalog"),ee("/Pages "+le+" 0 R"),Ce||(Ce="fullwidth"),Ce){case"fullwidth":ee("/OpenAction [3 0 R /FitH null]");break;case"fullheight":ee("/OpenAction [3 0 R /FitV null]");break;case"fullpage":ee("/OpenAction [3 0 R /Fit]");break;case"original":ee("/OpenAction [3 0 R /XYZ null null 1]");break;default:var _e=""+Ce;_e.substr(_e.length-1)==="%"&&(Ce=parseInt(Ce)/100),typeof Ce=="number"&&ee("/OpenAction [3 0 R /XYZ null null "+T(Ce)+"]")}switch(Oe||(Oe="continuous"),Oe){case"continuous":ee("/PageLayout /OneColumn");break;case"single":ee("/PageLayout /SinglePage");break;case"two":case"twoleft":ee("/PageLayout /TwoColumnLeft");break;case"tworight":ee("/PageLayout /TwoColumnRight")}Ae&&ee("/PageMode /"+Ae),ar.publish("putCatalog"),ee(">>"),ee("endobj")},Tk=f.__private__.putTrailer=function(){ee("trailer"),ee("<<"),ee("/Size "+(Y+1)),ee("/Root "+Y+" 0 R"),ee("/Info "+(Y-1)+" 0 R"),u!==null&&ee("/Encrypt "+ja.oid+" 0 R"),ee("/ID [ <"+M+"> <"+M+"> ]"),ee(">>")},ia=f.__private__.putHeader=function(){ee("%PDF-"+p),ee("%ºß¬à")},mw=f.__private__.putXRef=function(){var H="0000000000";ee("xref"),ee("0 "+(Y+1)),ee("0000000000 65535 f ");for(var le=1;le<=Y;le++)typeof K[le]=="function"?ee((H+K[le]()).slice(-10)+" 00000 n "):K[le]!==void 0?ee((H+K[le]).slice(-10)+" 00000 n "):ee("0000000000 00000 n ")},Uc=f.__private__.buildDocument=function(){var H;Y=0,ne=0,X=[],K=[],ae=[],ul=As(),Wl=As(),he(X),ar.publish("buildDocument"),ia(),Dc(),function(){ar.publish("putAdditionalObjects");for(var _e=0;_e<ae.length;_e++){var ke=ae[_e];Yn(ke.objId,!0),ee(ke.content),ee("endobj")}ar.publish("postPutAdditionalObjects")}(),H=[],function(){for(var _e in Pt)Pt.hasOwnProperty(_e)&&(h===!1||h===!0&&m.hasOwnProperty(_e))&&gf(Pt[_e])}(),function(){var _e;for(_e in Rt)Rt.hasOwnProperty(_e)&&Bk(Rt[_e])}(),function(){for(var _e in it)it.hasOwnProperty(_e)&&fp(it[_e])}(),function(_e){var ke;for(ke in vt)vt.hasOwnProperty(ke)&&(vt[ke]instanceof nm?mp(vt[ke]):vt[ke]instanceof _A&&pp(vt[ke],_e))}(H),ar.publish("putResources"),H.forEach(F0),F0({resourcesOid:Wl,objectOid:Number.MAX_SAFE_INTEGER}),ar.publish("postPutResources"),u!==null&&(ja.oid=Ln(),ee("<<"),ee("/Filter /Standard"),ee("/V "+ja.v),ee("/R "+ja.r),ee("/U <"+ja.toHexString(ja.U)+">"),ee("/O <"+ja.toHexString(ja.O)+">"),ee("/P "+ja.P),ee(">>"),ee("endobj")),Rc(),Ap();var le=ne;return mw(),Tk(),ee("startxref"),ee(""+le),ee("%%EOF"),he(J[D]),X.join(`
1510`)},gp=f.__private__.getBlob=function(H){return new Blob([we(H)],{type:"application/pdf"})},pw=f.output=f.__private__.output=(pn=function(H,le){switch(typeof(le=le||{})=="string"?le={filename:le}:le.filename=le.filename||"generated.pdf",H){case void 0:return Uc();case"save":f.save(le.filename);break;case"arraybuffer":return we(Uc());case"blob":return gp(Uc());case"bloburi":case"bloburl":if(jr.URL!==void 0&&typeof jr.URL.createObjectURL=="function")return jr.URL&&jr.URL.createObjectURL(gp(Uc()))||void 0;zn.warn("bloburl is not supported by your system, because URL.createObjectURL is not supported by your browser.");break;case"datauristring":case"dataurlstring":var _e="",ke=Uc();try{_e=ez(ke)}catch{_e=ez(unescape(encodeURIComponent(ke)))}return"data:application/pdf;filename="+le.filename+";base64,"+_e;case"pdfobjectnewwindow":if(Object.prototype.toString.call(jr)==="[object Window]"){var Ue="https://cdnjs.cloudflare.com/ajax/libs/pdfobject/2.1.1/pdfobject.min.js",Ze=' integrity="sha512-4ze/a9/4jqu+tX9dfOqJYSvyYd5M6qum/3HpCLr+/Jqf0whc37VUbkpNGHR7/8pSnCFw47T1fmIpwBV7UySh3g==" crossorigin="anonymous"';le.pdfObjectUrl&&(Ue=le.pdfObjectUrl,Ze="");var rt='<html><style>html, body { padding: 0; margin: 0; } iframe { width: 100%; height: 100%; border: 0;}  </style><body><script src="'+Ue+'"'+Ze+'><\/script><script >PDFObject.embed("'+this.output("dataurlstring")+'", '+JSON.stringify(le)+");<\/script></body></html>",Ut=jr.open();return Ut!==null&&Ut.document.write(rt),Ut}throw new Error("The option pdfobjectnewwindow just works in a browser-environment.");case"pdfjsnewwindow":if(Object.prototype.toString.call(jr)==="[object Window]"){var Gt='<html><style>html, body { padding: 0; margin: 0; } iframe { width: 100%; height: 100%; border: 0;}  </style><body><iframe id="pdfViewer" src="'+(le.pdfJsUrl||"examples/PDF.js/web/viewer.html")+"?file=&downloadName="+le.filename+'" width="500px" height="400px" /></body></html>',Cr=jr.open();if(Cr!==null){Cr.document.write(Gt);var Or=this;Cr.document.documentElement.querySelector("#pdfViewer").onload=function(){Cr.document.title=le.filename,Cr.document.documentElement.querySelector("#pdfViewer").contentWindow.PDFViewerApplication.open(Or.output("bloburl"))}}return Cr}throw new Error("The option pdfjsnewwindow just works in a browser-environment.");case"dataurlnewwindow":if(Object.prototype.toString.call(jr)!=="[object Window]")throw new Error("The option dataurlnewwindow just works in a browser-environment.");var ln='<html><style>html, body { padding: 0; margin: 0; } iframe { width: 100%; height: 100%; border: 0;}  </style><body><iframe src="'+this.output("datauristring",le)+'"></iframe></body></html>',Ss=jr.open();if(Ss!==null&&(Ss.document.write(ln),Ss.document.title=le.filename),Ss||typeof safari>"u")return Ss;break;case"datauri":case"dataurl":return jr.document.location.href=this.output("datauristring",le);default:return null}},pn.foo=function(){try{return pn.apply(this,arguments)}catch(_e){var H=_e.stack||"";~H.indexOf(" at ")&&(H=H.split(" at ")[1]);var le="Error in function "+H.split(`
1511`)[0].split("<")[0]+": "+_e.message;if(!jr.console)throw new Error(le);jr.console.error(le,_e),jr.alert&&alert(le)}},pn.foo.bar=pn,pn.foo),ml=function(H){return Array.isArray(tt)===!0&&tt.indexOf(H)>-1};switch(s){case"pt":Ge=1;break;case"mm":Ge=72/25.4;break;case"cm":Ge=72/2.54;break;case"in":Ge=72;break;case"px":Ge=ml("px_scaling")==1?.75:96/72;break;case"pc":case"em":Ge=12;break;case"ex":Ge=6;break;default:if(typeof s!="number")throw new Error("Invalid unit: "+s);Ge=s}var ja=null;Q(),$();var Bd=f.__private__.getPageInfo=f.getPageInfo=function(H){if(isNaN(H)||H%1!=0)throw new Error("Invalid argument passed to 
1511jsPDF.getPageInfo");return{objId:ht[H].objId,pageNumber:H,pageContext:ht[H]}},Aw=f.__private__.getPageInfoByObjId=function(H){if(isNaN(H)||H%1!=0)throw new Error("Invalid argument passed to jsPDF.getPageInfoByObjId");for(var le in ht)if(ht[le].objId===H)break;return Bd(le)},Pk=f.__private__.getCurrentPageInfo=f.getCurrentPageInfo=function(){return{objId:ht[D].objId,pageNumber:D,pageContext:ht[D]}};f.addPage=function(){return dw.apply(this,arguments),this},f.setPage=function(){return uw.apply(this,arguments),he.call(this,J[D]),this},f.insertPage=function(H){return this.addPage(),this.movePage(D,H),this},f.movePage=function(H,le){var _e,ke;if(H>le){_e=J[H],ke=ht[H];for(var Ue=H;Ue>le;Ue--)J[Ue]=J[Ue-1],ht[Ue]=ht[Ue-1];J[le]=_e,ht[le]=ke,this.setPage(le)}else if(H<le){_e=J[H],ke=ht[H];for(var Ze=H;Ze<le;Ze++)J[Ze]=J[Ze+1],ht[Ze]=ht[Ze+1];J[le]=_e,ht[le]=ke,this.setPage(le)}return this},f.deletePage=function(){return D0.apply(this,arguments),this},f.__private__.text=f.text=function(H,le,_e,ke,Ue){var Ze,rt,Ut,Gt,Cr,Or,ln,Ss,oa,Jn=(ke=ke||{}).scope||this;if(typeof H=="number"&&typeof le=="number"&&(typeof _e=="string"||Array.isArray(_e))){var Na=_e;_e=le,le=H,H=Na}if(arguments[3]instanceof xt==0?(Ut=arguments[4],Gt=arguments[5],On(ln=arguments[3])==="object"&&ln!==null||(typeof Ut=="string"&&(Gt=Ut,Ut=null),typeof ln=="string"&&(Gt=ln,ln=null),typeof ln=="number"&&(Ut=ln,ln=null),ke={flags:ln,angle:Ut,align:Gt})):(C("The transform parameter of text() with a Matrix value"),oa=Ue),isNaN(le)||isNaN(_e)||H==null)throw new Error("Invalid arguments passed to jsPDF.text");if(H.length===0)return Jn;var la,Xa="",Dd=typeof ke.lineHeightFactor=="number"?ke.lineHeightFactor:vf,Zl=Jn.internal.scaleFactor;function Rd(jn){return jn=jn.split("	").join(Array(ke.TabLen||9).join(" ")),fl(jn,ln)}function G0(jn){for(var Mn,Ks=jn.concat(),_a=[],$d=Ks.length;$d--;)typeof(Mn=Ks.shift())=="string"?_a.push(Mn):Array.isArray(jn)&&(Mn.length===1||Mn[1]===void 0&&Mn[2]===void 0)?_a.push(Mn[0]):_a.push([Mn[0],Mn[1],Mn[2]]);return _a}function yp(jn,Mn){var Ks;if(typeof jn=="string")Ks=Mn(jn)[0];else if(Array.isArray(jn)){for(var _a,$d,rx=jn.concat(),Np=[],Sw=rx.length;Sw--;)typeof(_a=rx.shift())=="string"?Np.push(Mn(_a)[0]):Array.isArray(_a)&&typeof _a[0]=="string"&&($d=Mn(_a[0],_a[1],_a[2]),Np.push([$d[0],$d[1],$d[2]]));Ks=Np}return Ks}var Qu=!1,jf=!0;if(typeof H=="string")Qu=!0;else if(Array.isArray(H)){var Nf=H.concat();rt=[];for(var Hu,Za=Nf.length;Za--;)(typeof(Hu=Nf.shift())!="string"||Array.isArray(Hu)&&typeof Hu[0]!="string")&&(jf=!1);Qu=jf}if(Qu===!1)throw new Error('Type of text must be string or Array. "'+H+'" is not recognized.');typeof H=="string"&&(H=H.match(/[\r?\n]/)?H.split(/\r\n|\r|\n/g):[H]);var _f=pe/Jn.internal.scaleFactor,Cf=_f*(Dd-1);switch(ke.baseline){case"bottom":_e-=Cf;break;case"top":_e+=_f-Cf;break;case"hanging":_e+=_f-2*Cf;break;case"middle":_e+=_f/2-Cf}if((Or=ke.maxWidth||0)>0&&(typeof H=="string"?H=Jn.splitTextToSize(H,Or):Object.prototype.toString.call(H)==="[object Array]"&&(H=H.reduce(function(jn,Mn){return jn.concat(Jn.splitTextToSize(Mn,Or))},[]))),Ze={text:H,x:le,y:_e,options:ke,mutex:{pdfEscape:fl,activeFontKey:De,fonts:Pt,activeFontSize:pe}},ar.publish("preProcessText",Ze),H=Ze.text,Ut=(ke=Ze.options).angle,oa instanceof xt==0&&Ut&&typeof Ut=="number"){Ut*=Math.PI/180,ke.rotationDirection===0&&(Ut=-Ut),w===y&&(Ut=-Ut);var q0=Math.cos(Ut),K0=Math.sin(Ut);oa=new xt(q0,K0,-K0,q0,0,0)}else Ut&&Ut instanceof xt&&(oa=Ut);w!==y||oa||(oa=En),(Cr=ke.charSpace||Id)!==void 0&&(Xa+=S(L(Cr))+` Tc
1512`,this.setCharSpace(this.getCharSpace()||0)),(Ss=ke.horizontalScale)!==void 0&&(Xa+=S(100*Ss)+` Tz
1513`),ke.lang;var Pi=-1,Ud=ke.renderingMode!==void 0?ke.renderingMode:ke.stroke,wp=Jn.internal.getCurrentPageInfo().pageContext;switch(Ud){case 0:case!1:case"fill":Pi=0;break;case 1:case!0:case"stroke":Pi=1;break;case 2:case"fillThenStroke":Pi=2;break;case 3:case"invisible":Pi=3;break;case 4:case"fillAndAddForClipping":Pi=4;break;case 5:case"strokeAndAddPathForClipping":Pi=5;break;case 6:case"fillThenStrokeAndAddToPathForClipping":Pi=6;break;
vendor: 8,768 bytes, lines 1513-1525
1513case 7:case"addToPathForClipping":Pi=7}var _w=wp.usedRenderingMode!==void 0?wp.usedRenderingMode:-1;Pi!==-1?Xa+=Pi+` Tr
1514`:_w!==-1&&(Xa+=`0 Tr
1515`),Pi!==-1&&(wp.usedRenderingMode=Pi),Gt=ke.align||"left";var pl,Sf=pe*Dd,W0=Jn.internal.pageSize.getWidth(),Y0=Pt[De];Cr=ke.charSpace||Id,Or=ke.maxWidth||0,ln=Object.assign({autoencode:!0,noBOM:!0},ke.flags);var zu=[],kf=function(jn){return Jn.getStringUnitWidth(jn,{font:Y0,charSpace:Cr,fontSize:pe,doKerning:!1})*pe/Zl};if(Object.prototype.toString.call(H)==="[object Array]"){var No;rt=G0(H),Gt!=="left"&&(pl=rt.map(kf));var _o,Vu=0;if(Gt==="right"){le-=pl[0],H=[],Za=rt.length;for(var Md=0;Md<Za;Md++)Md===0?(_o=Td(le),No=Pd(_e)):(_o=L(Vu-pl[Md]),No=-Sf),H.push([rt[Md],_o,No]),Vu=pl[Md]}else if(Gt==="center"){le-=pl[0]/2,H=[],Za=rt.length;for(var Gu=0;Gu<Za;Gu++)Gu===0?(_o=Td(le),No=Pd(_e)):(_o=L((Vu-pl[Gu])/2),No=-Sf),H.push([rt[Gu],_o,No]),Vu=pl[Gu]}else if(Gt==="left"){H=[],Za=rt.length;for(var J0=0;J0<Za;J0++)H.push(rt[J0])}else if(Gt==="justify"&&Y0.encoding==="Identity-H"){H=[],Za=rt.length,Or=Or!==0?Or:W0;for(var jp=0,qs=0;qs<Za;qs++)if(No=qs===0?Pd(_e):-Sf,_o=qs===0?Td(le):jp,qs<Za-1){var Cw=L((Or-pl[qs])/(rt[qs].split(" ").length-1)),$c=rt[qs].split(" ");H.push([$c[0]+" ",_o,No]),jp=0;for(var Qc=1;Qc<$c.length;Qc++){var X0=(kf($c[Qc-1]+" "+$c[Qc])-kf($c[Qc]))*Zl+Cw;Qc==$c.length-1?H.push([$c[Qc],X0,0]):H.push([$c[Qc]+" ",X0,0]),jp-=X0}}else H.push([rt[qs],_o,No]);H.push(["",jp,0])}else{if(Gt!=="justify")throw new Error('Unrecognized alignment option, use "left", "center", "right" or "justify".');for(H=[],Za=rt.length,Or=Or!==0?Or:W0,qs=0;qs<Za;qs++){No=qs===0?Pd(_e):-Sf,_o=qs===0?Td(le):0;var Z0=rt[qs].split(" ").length-1,ex=Z0>0?(Or-pl[qs])/Z0:0;qs<Za-1?zu.push(S(L(ex))):zu.push(0),H.push([rt[qs],_o,No])}}}(typeof ke.R2L=="boolean"?ke.R2L:se)===!0&&(H=yp(H,function(jn,Mn,Ks){return[jn.split("").reverse().join(""),Mn,Ks]})),Ze={text:H,x:le,y:_e,options:ke,mutex:{pdfEscape:fl,activeFontKey:De,fonts:Pt,activeFontSize:pe}},ar.publish("postProcessText",Ze),H=Ze.text,la=Ze.mutex.isHex||!1;var tx=Pt[De].encoding;tx!=="WinAnsiEncoding"&&tx!=="StandardEncoding"||(H=yp(H,function(jn,Mn,Ks){return[Rd(jn),Mn,Ks]})),rt=G0(H),H=[];for(var qu,Ku,Wu,Ef=Array.isArray(rt[0])?1:0,Yu="",Bf=function(jn,Mn,Ks){var _a="";return Ks instanceof xt?(Ks=typeof ke.angle=="number"?Lr(Ks,new xt(1,0,0,1,jn,Mn)):Lr(new xt(1,0,0,1,jn,Mn),Ks),w===y&&(Ks=Lr(new xt(1,0,0,-1,0,0),Ks)),_a=Ks.join(" ")+` Tm
1516`):_a=S(jn)+" "+S(Mn)+` Td
1517`,_a},Al=0;Al<rt.length;Al++){switch(Yu="",Ef){case 1:Wu=(la?"<":"(")+rt[Al][0]+(la?">":")"),qu=parseFloat(rt[Al][1]),Ku=parseFloat(rt[Al][2]);break;case 0:Wu=(la?"<":"(")+rt[Al]+(la?">":")"),qu=Td(le),Ku=Pd(_e)}zu!==void 0&&zu[Al]!==void 0&&(Yu=zu[Al]+` Tw
1518`),Al===0?H.push(Yu+Bf(qu,Ku,oa)+Wu):Ef===0?H.push(Yu+Wu):Ef===1&&H.push(Yu+Bf(qu,Ku,oa)+Wu)}H=Ef===0?H.join(` Tj
1519T* `):H.join(` Tj
1520`),H+=` Tj
1521`;var Hc=`BT
1522/`;return Hc+=De+" "+pe+` Tf
1523`,Hc+=S(pe*Dd)+` TL
1524`,Hc+=bf+`
1525`,Hc+=Xa,Hc+=H,ee(Hc+="ET"),m[De]=!0,Jn};var Ik=f.__private__.clip=f.clip=function(H){return ee(H==="evenodd"?"W*":"W"),this};f.clipEvenOdd=function(){return Ik("evenodd")},f.__private__.discardPath=f.discardPath=function(){return ee("n"),this};var Mc=f.__private__.isValidStyle=function(H){var le=!1;return[void 0,null,"S","D","F","DF","FD","f","f*","B","B*","n"].indexOf(H)!==-1&&(le=!0),le};f.__private__.setDefaultPathOperation=f.setDefaultPathOperation=function(H){return Mc(H)&&(d=H),this};var gw=f.__private__.getStyle=f.getStyle=function(H){var le=d;switch(H){case"D":case"S":le="S";break;case"F":le="f";break;case"FD":case"DF":le="B";break;case"f":case"f*":case"B":case"B*":le=H}return le},xw=f.close=function(){return ee("h"),this};f.stroke=function(){return ee("S"),this},f.fill=function(H){return xp("f",H),this},f.fillEvenOdd=function(H){return xp("f*",H),this},f.fillStroke=function(H){return xp("B",H),this},f.fillStrokeEvenOdd=function(H){return xp("B*",H),this};var xp=function(H,le){On(le)==="object"?Fk(le,H):ee(H)},xf=function(H){H===null||w===y&&H===void 0||(H=gw(H),ee(H))};function Ok(H,le,_e,ke,Ue){var Ze=new _A(le||this.boundingBox,_e||this.xStep,ke||this.yStep,this.gState,Ue||this.matrix);Ze.stream=this.stream;var rt=H+"$$"+this.cloneIndex+++"$$";return qr(rt,Ze),Ze}var Fk=function(H,le){var _e=vr[H.key],ke=vt[_e];if(ke instanceof nm)ee("q"),ee(Lk(le)),ke.gState&&f.setGState(ke.gState),ee(H.matrix.toString()+" cm"),ee("/"+_e+" sh"),ee("Q");else if(ke instanceof _A){var Ue=new xt(1,0,0,-1,0,wf());H.matrix&&(Ue=Ue.multiply(H.matrix||En),_e=Ok.call(ke,H.key,H.boundingBox,H.xStep,H.yStep,Ue).id),ee("q"),ee("/Pattern cs"),ee("/"+_e+" scn"),ke.gState&&f.setGState(ke.gState),ee(le),ee("Q")}},Lk=function(H){switch(H){case"f":case"F":case"n":return"W n";case"f*":return"W* n";case"B":case"S":return"W S";case"B*":return"W* S"}},R0=f.moveTo=function(H,le){return ee(S(L(H))+" "+S(P(le))+" m"),this},vw=f.lineTo=function(H,le){return ee(S(L(H))+" "+S(P(le))+" l"),this},Xl=f.curveTo=function(H,le,_e,ke,Ue,Ze){return ee([S(L(H)),S(P(le)),S(L(_e)),S(P(ke)),S(L(Ue)),S(P(Ze)),"c"].join(" ")),this};f.__private__.line=f.line=function(H,le,_e,ke,Ue){if(isNaN(H)||isNaN(le)||isNaN(_e)||isNaN(ke)||!Mc(Ue))throw new Error("Invalid arguments passed to jsPDF.line");return w===b?this.lines([[_e-H,ke-le]],H,le,[1,1],Ue||"S"):this.lines([[_e-H,ke-le]],H,le,[1,1]).stroke()},f.__private__.lines=f.lines=function(H,le,_e,ke,Ue,Ze){var rt,Ut,Gt,Cr,Or,ln,Ss,oa,Jn,Na,la,Xa;if(typeof H=="number"&&(Xa=_e,_e=le,le=H,H=Xa),ke=ke||[1,1],Ze=Ze||!1,isNaN(le)||isNaN(_e)||!Array.isArray(H)||!Array.isArray(ke)||!Mc(Ue)||typeof Ze!="boolean")throw new Error("Invalid arguments passed to jsPDF.lines");for(R0(le,_e),rt=ke[0],Ut=ke[1],Cr=H.length,Na=le,la=_e,Gt=0;Gt<Cr;Gt++)(Or=H[Gt]).length===2?(Na=Or[0]*rt+Na,la=Or[1]*Ut+la,vw(Na,la)):(ln=Or[0]*rt+Na,Ss=Or[1]*Ut+la,oa=Or[2]*rt+Na,Jn=Or[3]*Ut+la,Na=Or[4]*rt+Na,la=Or[5]*Ut+la,Xl(ln,Ss,oa,Jn,Na,la));return Ze&&xw(),xf(Ue),this},f.path=function(H){for(var le=0;le<H.length;le++){var _e=H[le],ke=_e.c;switch(_e.op){case"m":R0(ke[0],ke[1]);break;case"l":vw(ke[0],ke[1]);break;case"c":Xl.apply(this,ke);break;case"h":xw()}}return this},f.__private__.rect=f.rect=function(H,le,_e,ke,Ue){if(isNaN(H)||isNaN(le)||isNaN(_e)||isNaN(ke)||!Mc(Ue))throw new Error("Invalid arguments passed to jsPDF.rect");return w===b&&(ke=-ke),ee([S(L(H)),S(P(le)),S(L(_e)),S(L(ke)),"re"].join(" ")),xf(Ue),this},f.__private__.triangle=f.triangle=function(H,le,_e,ke,Ue,Ze,rt){if(isNaN(H)||isNaN(le)||isNaN(_e)||isNaN(ke)||isNaN(Ue)||isNaN(Ze)||!Mc(rt))throw new Error("Invalid arguments passed to jsPDF.triangle");return this.lines([[_e-H,ke-le],[Ue-_e,Ze-ke],[H-Ue,le-Ze]],H,le,[1,1],rt,!0),this},f.__private__.roundedRect=f.roundedRect=function(H,le,_e,ke,Ue,Ze,rt){if(isNaN(H)||isNaN(le)||isNaN(_e)||isNaN(ke)||isNaN(Ue)||isNaN(Ze)||!Mc(rt))throw new Error("Invalid arguments passed to jsPDF.roundedRect");var Ut=4/3*(Math.SQRT2-1);return Ue=Math.min(Ue,.5*_e),Ze=Math.min(Ze,.5*ke),this.lines([[_e-2*Ue,0],[Ue*Ut,0,Ue,Ze-Ze*Ut,Ue,Ze],[0,ke-2*Ze],[0,Ze*Ut,-Ue*Ut,Ze,-Ue,Ze],[2*Ue-_e,0],[-Ue*Ut,0,-Ue,-Ze*Ut,-Ue,-Ze],[0,2*Ze-ke],[0,-Ze*Ut,Ue*Ut,-Ze,Ue,-Ze]],H+Ue,le,[1,1],rt,!0),this},f.__private__.ellipse=f.ellipse=function(H,le,_e,ke,Ue){if(isNaN(H)||isNaN(le)||isNaN(_e)||isNaN(ke)||!Mc(Ue))throw new Error("Invalid arguments passed to jsPDF.ellipse");var Ze=4/3*(Math.SQRT2-1)*_e,rt=4/3*(Math.SQRT2-1)*ke;return R0(H+_e,le),Xl(H+_e,le-rt,H+Ze,le-ke,H,le-ke),Xl(H-Ze,le-ke,H-_e,le-rt,H-_e,le),Xl(H-_e,le+rt,H-Ze,le+ke,H,le+ke),Xl(H+Ze,le+ke,H+_e,le+rt,H+_e,le),xf(Ue),this},f.__private__.circle=f.circle=function(H,le,_e,ke){if(isNaN(H)||isNaN(le)||isNaN(_e)||!Mc(ke))throw new Error("Invalid arguments passed to jsPDF.circle");return this.ellipse(H,le,_e,_e,ke)},f.setFont=function(H,le,_e){return _e&&(le=_(le,_e)),De=fw(H,le,{disableWarning:!1}),this};var Dk=f.__private__.getFont=f.getFont=function(){return Pt[fw.apply(f,arguments)]};f.__private__.getFontList=f.getFontList=function(){var H,le,_e={};for(H in _t)if(_t.hasOwnProperty(H))for(le in _e[H]=[],_t[H])_t[H].hasOwnProperty(le)&&_e[H].push(le);return _e},f.addFont=function(H,le,_e,ke,Ue){var Ze=["StandardEncoding","MacRomanEncoding","Identity-H","WinAnsiEncoding"];return arguments[3]&&Ze.indexOf(arguments[3])!==-1?Ue=arguments[3]:arguments[3]&&Ze.indexOf(arguments[3])==-1&&(_e=_(_e,ke)),cw.call(this,H,le,_e,Ue=Ue||"Identity-H")};var vf,U0=e.lineWidth||.200025,Rk=f.__private__.getLineWidth=f.getLineWidth=function(){return U0},Sr=f.__private__.setLineWidth=f.setLineWidth=function(H){return U0=H,ee(S(L(H))+" w"),this};f.__private__.setLineDash=Wt.API.setLineDash=Wt.API.setLineDashPattern=function(H,le){if(H=H||[],le=le||0,isNaN(le)||!Array.isArray(H))throw new Error("Invalid arguments passed to 
1525jsPDF.setLineDash");return H=H.map(function(_e){return S(L(_e))}).join(" "),le=S(L(le)),ee("["+H+"] "+le+" d"),this};var Uk=f.__private__.getLineHeight=f.getLineHeight=function(){return pe*vf};f.__private__.getLineHeight=f.getLineHeight=function(){return pe*vf};var Mk=f.__private__.setLineHeightFactor=f.setLineHeightFactor=function(H){return typeof(H=H||1.15)=="number"&&(vf=H),this},$k=f.__private__.getLineHeightFactor=f.getLineHeightFactor=function(){return vf};Mk(e.lineHeight);var Td=f.__private__.getHorizontalCoordinate=function(H){return L(H)},Pd=f.__private__.getVerticalCoordinate=function(H){return w===y?H:ht[D].mediaBox.topRightY-ht[D].mediaBox.bottomLeftY-L(H)},Qk=f.__private__.getHorizontalCoordinateString=f.getHorizontalCoordinateString=function(H){return S(Td(H))},Hk=f.__private__.getVerticalCoordinateString=f.getVerticalCoordinateString=function(H){return S(Pd(H))},vp=e.strokeColor||"0 G";f.__private__.getStrokeColor=f.getDrawColor=function(){return Lc(vp)},f.__private__.setStrokeColor=f.setDrawColor=function(H,le,_e,ke){return vp=Yl({ch1:H,ch2:le,ch3:_e,ch4:ke,pdfColorType:"draw",precision:2}),ee(vp),this};var M0=e.fillColor||"0 g";f.__private__.getFillColor=f.getFillColor=function(){return Lc(M0)},f.__private__.setFillColor=f.setFillColor=function(H,le,_e,ke){return M0=Yl({ch1:H,ch2:le,ch3:_e,ch4:ke,pdfColorType:"fill",precision:2}),ee(M0),this};var bf=e.textColor||"0 g",zk=f.__private__.getTextColor=f.getTextColor=function(){return Lc(bf)};f.__private__.setTextColor=f.setTextColor=function(H,le,_e,ke){return bf=Yl({ch1:H,ch2:le,ch3:_e,ch4:ke,pdfColorType:"text",precision:3}),this};var Id=e.charSpace,Vk=f.__private__.getCharSpace=f.getCharSpace=function(){return parseFloat(Id||0)};f.__private__.setCharSpace=f.setCharSpace=function(H){if(isNaN(H))throw new Error("Invalid argument passed to jsPDF.setCharSpace");return Id=H,this};var $0=0;f.CapJoinStyles={0:0,butt:0,but:0,miter:0,1:1,round:1,rounded:1,circle:1,2:2,projecting:2,project:2,square:2,bevel:2},f.__private__.setLineCap=f.setLineCap=function(H){var le=f.CapJoinStyles[H];if(le===void 0)throw new Error("Line cap style of '"+H+"' is not recognized. See or extend .CapJoinStyles property for valid styles");return $0=le,ee(le+" J"),this};var Q0=0;f.__private__.setLineJoin=f.setLineJoin=function(H){var le=f.CapJoinStyles[H];if(le===void 0)throw new Error("Line join style of '"+H+"' is not recognized. See or extend .CapJoinStyles property for valid styles");return Q0=le,ee(le+" j"),this},f.__private__.setLineMiterLimit=f.__private__.setMiterLimit=f.setLineMiterLimit=f.setMiterLimit=function(H){if(H=H||0,isNaN(H))throw new Error("Invalid argument passed to jsPDF.setLineMiterLimit");return ee(S(L(H))+" M"),this},f.GState=o_,f.setGState=function(H){(H=typeof H=="string"?Rt[rr[H]]:bw(null,H)).equals(an)||(ee("/"+H.id+" gs"),an=H)};var bw=function(H,le){if(!H||!rr[H]){var _e=!1;for(var ke in Rt)if(Rt.hasOwnProperty(ke)&&Rt[ke].equals(le)){_e=!0;break}if(_e)le=Rt[ke];else{var Ue="GS"+(Object.keys(Rt).length+1).toString(10);Rt[Ue]=le,le.id=Ue}return H&&(rr[H]=le.id),ar.publish("addGState",le),le}};f.addGState=function(H,le){return bw(H,le),this},f.saveGraphicsState=function(){return ee("q"),zt.push({key:De,size:pe,color:bf}),this},f.restoreGraphicsState=function(){ee("Q");var H=zt.pop();return De=H.key,pe=H.size,bf=H.color,an=null,this},f.setCurrentTransformationMatrix=function(H){return ee(H.toString()+" cm"),this},f.comment=function(H){return ee("#"+H),this};var Od=function(H,le){var _e=H||0;Object.defineProperty(this,"x",{enumerable:!0,get:function(){return _e},set:function(Ze){isNaN(Ze)||(_e=parseFloat(Ze))}});var ke=le||0;Object.defineProperty(this,"y",{enumerable:!0,get:function(){return ke},set:function(Ze){isNaN(Ze)||(ke=parseFloat(Ze))}});var Ue="pt";return Object.defineProperty(this,"type",{enumerable:!0,get:function(){return Ue},set:function(Ze){Ue=Ze.toString()}}),this},H0=function(H,le,_e,ke){Od.call(this,H,le),this.type="rect";var Ue=_e||0;Object.defineProperty(this,"w",{enumerable:!0,get:function(){return Ue},set:function(rt){isNaN(rt)||(Ue=parseFloat(rt))}});var Ze=ke||0;return Object.defineProperty(this,"h",{enumerable:!0,get:function(){return Ze},set:function(rt){isNaN(rt)||(Ze=parseFloat(rt))}}),this},bp=function(){this.page=It,this.currentPage=D,this.pages=J.slice(0),this.pagesContext=ht.slice(0),this.x=Ye,this.y=Tt,this.matrix=Nt,this.width=V0(D),this.height=ww(D),this.outputDestination=ie,this.id="",this.objectNumber=-1};bp.prototype.restore=function(){It=this.page,D=this.currentPage,ht=this.pagesContext,J=this.pages,Ye=this.x,Tt=this.y,Nt=this.matrix,yw(D,this.width),Fd(D,this.height),ie=this.outputDestination};var z0=function(H,le,_e,ke,Ue){pr.push(new bp),It=D=0,J=[],Ye=H,Tt=le,Nt=Ue,L0([_e,ke])};for(var yf in f.beginFormObject=function(H,le,_e,ke,Ue){return z0(H,le,_e,ke,Ue),this},f.endFormObject=function(H){return function(le){if(gt[le])pr.pop().restore(
vendor: 4,611 bytes, line 1525
1525);else{var _e=new bp,ke="Xo"+(Object.keys(it).length+1).toString(10);_e.id=ke,gt[le]=ke,it[ke]=_e,ar.publish("addFormObject",_e),pr.pop().restore()}}(H),this},f.doFormObject=function(H,le){var _e=it[gt[H]];return ee("q"),ee(le.toString()+" cm"),ee("/"+_e.id+" Do"),ee("Q"),this},f.getFormObject=function(H){var le=it[gt[H]];return{x:le.x,y:le.y,width:le.width,height:le.height,matrix:le.matrix}},f.save=function(H,le){return H=H||"generated.pdf",(le=le||{}).returnPromise=le.returnPromise||!1,le.returnPromise===!1?(Yf(gp(Uc()),H),typeof Yf.unload=="function"&&jr.setTimeout&&setTimeout(Yf.unload,911),this):new Promise(function(_e,ke){try{var Ue=Yf(gp(Uc()),H);typeof Yf.unload=="function"&&jr.setTimeout&&setTimeout(Yf.unload,911),_e(Ue)}catch(Ze){ke(Ze.message)}})},Wt.API)Wt.API.hasOwnProperty(yf)&&(yf==="events"&&Wt.API.events.length?function(H,le){var _e,ke,Ue;for(Ue=le.length-1;Ue!==-1;Ue--)_e=le[Ue][0],ke=le[Ue][1],H.subscribe.apply(H,[_e].concat(typeof ke=="function"?[ke]:ke))}(ar,Wt.API.events):f[yf]=Wt.API[yf]);function V0(H){return ht[H].mediaBox.topRightX-ht[H].mediaBox.bottomLeftX}function yw(H,le){ht[H].mediaBox.topRightX=le+ht[H].mediaBox.bottomLeftX}function ww(H){return ht[H].mediaBox.topRightY-ht[H].mediaBox.bottomLeftY}function Fd(H,le){ht[H].mediaBox.topRightY=le+ht[H].mediaBox.bottomLeftY}var Ld=f.getPageWidth=function(H){return V0(H=H||D)/Ge},jw=f.setPageWidth=function(H,le){yw(H,le*Ge)},wf=f.getPageHeight=function(H){return ww(H=H||D)/Ge},Nw=f.setPageHeight=function(H,le){Fd(H,le*Ge)};return f.internal={pdfEscape:fl,getStyle:gw,getFont:Dk,getFontSize:re,getCharSpace:Vk,getTextColor:zk,getLineHeight:Uk,getLineHeightFactor:$k,getLineWidth:Rk,write:xe,getHorizontalCoordinate:Td,getVerticalCoordinate:Pd,getCoordinateString:Qk,getVerticalCoordinateString:Hk,collections:{},newObject:Ln,newAdditionalObject:jo,newObjectDeferred:As,newObjectDeferredBegin:Yn,getFilters:Jl,putStream:hl,events:ar,scaleFactor:Ge,pageSize:{getWidth:function(){return Ld(D)},setWidth:function(H){jw(D,H)},getHeight:function(){return wf(D)},setHeight:function(H){Nw(D,H)}},encryptionOptions:u,encryption:ja,getEncryptor:function(H){return u!==null?ja.encryptor(H,0):function(le){return le}},output:pw,getNumberOfPages:hw,get pages(){return J},out:ee,f2:T,f3:B,getPageInfo:Bd,getPageInfoByObjId:Aw,getCurrentPageInfo:Pk,getPDFVersion:A,Point:Od,Rectangle:H0,Matrix:xt,hasHotfix:ml},Object.defineProperty(f.internal.pageSize,"width",{get:function(){return Ld(D)},set:function(H){jw(D,H)},enumerable:!0,configurable:!0}),Object.defineProperty(f.internal.pageSize,"height",{get:function(){return wf(D)},set:function(H){Nw(D,H)},enumerable:!0,configurable:!0}),(function(H){for(var le=0,_e=Se.length;le<_e;le++){var ke=cw.call(this,H[le][0],H[le][1],H[le][2],Se[le][3],!0);h===!1&&(m[ke]=!0);var Ue=H[le][0].split("-");lw({id:ke,fontName:Ue[0],fontStyle:Ue[1]||""})}ar.publish("addFonts",{fonts:Pt,dictionary:_t})}).call(f,Se),De="F1",dw(a,r),ar.publish("initialized"),f}lA.prototype.lsbFirstWord=function(e){return String.fromCharCode(255&e,e>>8&255,e>>16&255,e>>24&255)},lA.prototype.toHexString=function(e){return e.split("").map(function(t){return("0"+(255&t.charCodeAt(0)).toString(16)).slice(-2)}).join("")},lA.prototype.hexToBytes=function(e){for(var t=[],r=0;r<e.length;r+=2)t.push(String.fromCharCode(parseInt(e.substr(r,2),16)));return t.join("")},lA.prototype.processOwnerPassword=function(e,t){return CP(_P(t).substr(0,5),e)},lA.prototype.encryptor=function(e,t){var r=_P(this.encryptionKey+String.fromCharCode(255&e,e>>8&255,e>>16&255,255&t,t>>8&255)).substr(0,10);return function(s){return CP(r,s)}},o_.prototype.equals=function(e){var t,r="id,objectNumber,equals";if(!e||On(e)!==On(this))return!1;var s=0;for(t in this)if(!(r.indexOf(t)>=0)){if(this.hasOwnProperty(t)&&!e.hasOwnProperty(t)||this[t]!==e[t])return!1;s++}for(t in e)e.hasOwnProperty(t)&&r.indexOf(t)<0&&s--;return s===0},Wt.API={events:[]},Wt.version="3.0.4";var Rs=Wt.API,j6=1,cp=function(e){return e.replace(/\\/g,"\\\\").replace(/\(/g,"\\(").replace(/\)/g,"\\)")},Wp=function(e){return e.replace(/\\\\/g,"\\").replace(/\\\(/g,"(").replace(/\\\)/g,")")},Er=function(e){return e.toFixed(2)},lh=function(e){return e.toFixed(5)};Rs.__acroform__={};var bo=function(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e},sz=function(e){return e*j6},Kc=function(e){var t=new Jse,r=Ft.internal.getHeight(e)||0,s=Ft.internal.getWidth(e)||0;return t.BBox=[0,0,Number(Er(s)),Number(Er(r))],t},Kot=Rs.__acroform__.setBit=function(e,t){if(e=e||0,t=t||0,isNaN(e)||isNaN(t))throw new Error("Invalid arguments passed to 
1525jsPDF.API.__acroform__.setBit");return e|1<<t},Wot=Rs.__acroform__.clearBit=function(e,t){if(e=e||0,t=t||0,isNaN(e)||isNaN(t))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.clearBit");return e&~(1<<t)},Yot=Rs.__acroform__.getBit=function(e,t){if(isNaN(e)||isNaN(t))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.getBit");return e&1<<t?1:0},ea=Rs.__acroform__.getBitForPdf=function(e,t){if(isNaN(e)||isNaN(t))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.getBitForPdf");return Yot(e,t-1)},ta=Rs.__acroform__.setBitForPdf=function(e,t){if(isNaN(e)||isNaN(t))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.setBitForPdf");return Kot(e,t-1)},ra=Rs.__acroform__.clearBitForPdf=function(e,t){if(isNaN(e)||isNaN(t))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.clearBitForPdf");return Wot(e,t-1)},Jot=Rs.__acroform__.calculateCoordinates=function(e,t){var r=t.internal.getHorizontalCoordinate,s=t.internal.getVerticalCoordinate,a=e[0],i=e[1],o=e[2],l=e[3],c={};return c.lowerLeft_X=r(a)||0,c.lowerLeft_Y=s(i+l)||0,c.upperRight_X=r(a+o)||0,c.upperRight_Y=s(i)||0,[Number(Er(c.lowerLeft_X)),Number(Er(c.lowerLeft_Y)),Number(Er(c.upperRight_X)),Number(Er(c.upperRight_Y))]},Xot=function(e){if(e.appearanceStreamContent)return e.appearanceStreamContent;if(e.V||e.DV){var t=[],r=e._V||e.DV,s=SP(e,r),a=e.scope.internal.getFont(e.fontName,e.fontStyle).id;t.push("/Tx BMC"),t.push("q"),t.push("BT"),t.push(e.scope.__private__.encodeColorString(e.color)),t.push("/"+a+" "+Er(s.fontSize)+" Tf"),t.push("1 0 0 1 0 0 Tm"),t.push(s.text),t.push("ET"),t.push("Q"),t.push("EMC");var i=Kc(e);return i.scope=e.scope,i.stream=t.join(`
1526`),i}},SP=function(e,t){var r=e.fontSize===0?e.maxFontSize:e.fontSize,s={text:"",fontSize:""},a=(t=(t=t.substr(0,1)=="("?t.substr(1):t).substr(t.length-1)==")"?t.substr(0,t.length-1):t).split(" ");a=e.multiline?a.map(function(T){return T.split(`
1527`)}):a.map(function(T){return[T]});var i=r,o=Ft.internal.getHeight(e)||0;o=o<0?-o:o;var l=Ft.internal.getWidth(e)||0;l=l<0?-l:l;var c=function(T,B,L){if(T+1<a.length){var P=B+" "+a[T+1][0];return X1(P,e,L).width<=l-4}return!1};i++;e:for(;i>0;){t="",i--;var d,u,h=X1("3",e,i).height,m=e.multiline?o-i:(o-h)/2,f=m+=2,p=0,A=0,v=0;if(i<=0){t=`(...) Tj
1528`,t+="% Width of Text: "+X1(t,e,i=12).width+", FieldWidth:"+l+`
1529`;break}for(var x="",b=0,y=0;y<a.length;y++)if(a.hasOwnProperty(y)){var w=!1;if(a[y].length!==1&&v!==a[y].length-1){if((h+2)*(b+2)+2>o)continue e;x+=a[y][v],w=!0,A=y,y--}else{x=(x+=a[y][v]+" ").substr(x.length-1)==" "?x.substr(0,x.length-1):x;var j=parseInt(y),N=c(j,x,i),_=y>=a.length-1;if(N&&!_){x+=" ",v=0;continue}if(N||_){if(_)A=j;else if(e.multiline&&(h+2)*(b+2)+2>o)continue e}else{if(!e.multiline||(h+2)*(b+2)+2>o)continue e;A=j}}for(var S="",C=p;C<=A;C++){var E=a[C];if(e.multiline){if(C===A){S+=E[v]+" ",v=(v+1)%E.length;continue}if(C===p){S+=E[E.length-1]+" ";continue}}S+=E[0]+" "}switch(S=S.substr(S.length-1)==" "?S.substr(0,S.length-1):S,u=X1(S,e,i).width,e.textAlign){case"right":d=l-u-2;break;case"center":d=(l-u)/2;break;default:d=2}t+=Er(d)+" "+Er(f)+` Td
1530`,t+="("+cp(S)+`) Tj
1531`,t+=-Er(d)+` 0 Td
1532`,f=-(i+2),u=0,p=w?A:A+1,b++,x=""}break}return s.text=t,s.fontSize=i,s},X1=function(e,t,r){var s=t.scope.internal.getFont(t.fontName,t.fontStyle),a=t.scope.getStringUnitWidth(e,{font:s,fontSize:parseFloat(r),charSpace:0})*parseFloat(r);return{height:t.scope.getStringUnitWidth("3",{font:s,fontSize:parseFloat(r),charSpace:0})*parseFloat(r)*1.5,width:a}},Zot={fields:[],xForms:[],acroFormDictionaryRoot:null,printedOut:!1,internal:null,isInitialized:!1},elt=function(e,t){var r={type:"reference",object:e};t.internal.getPageInfo(e.page).pageContext.annotations.find(function(s){return s.type===r.type&&s.object===r.object})===void 0&&t.internal.getPageInfo(e.page).pageContext.annotations.push(r)},tlt=function(e,t){if(t.scope=e,e.internal!==void 0&&(e.internal.acroformPlugin===void 0||e.internal.acroformPlugin.isInitialized===!1)){if(Pc.FieldNum=0,e.internal.acroformPlugin=JSON.parse(JSON.stringify(Zot)),e.internal.acroformPlugin.acroFormDictionaryRoot)throw new Error("Exception while creating AcroformDictionary");j6=e.internal.scaleFactor,e.internal.acroformPlugin.acroFormDictionaryRoot=new Xse,e.internal.acroformPlugin.acroFormDictionaryRoot.scope=e,e.internal.acroformPlugin.acroFormDictionaryRoot._eventID=e.internal.events.subscribe("postPutResources",function(){(function(r){r.internal.events.unsubscribe(r.internal.acroformPlugin.acroFormDictionaryRoot._eventID),delete r.internal.acroformPlugin.acroFormDictionaryRoot._eventID,r.internal.acroformPlugin.printedOut=!0})(e)}),e.internal.events.subscribe("buildDocument",function(){(function(r){r.internal.acroformPlugin.acroFormDictionaryRoot.objId=void 0;var s=r.internal.acroformPlugin.acroFormDictionaryRoot.Fields;for(var a in s)if(s.hasOwnProperty(a)){var i=s[a];
vendor: 24,081 bytes, lines 1532-1544
1532i.objId=void 0,i.hasAnnotation&&elt(i,r)}})(e)}),e.internal.events.subscribe("putCatalog",function(){(function(r){if(r.internal.acroformPlugin.acroFormDictionaryRoot===void 0)throw new Error("putCatalogCallback: Root missing.");r.internal.write("/AcroForm "+r.internal.acroformPlugin.acroFormDictionaryRoot.objId+" 0 R")})(e)}),e.internal.events.subscribe("postPutPages",function(r){(function(s,a){var i=!s;for(var o in s||(a.internal.newObjectDeferredBegin(a.internal.acroformPlugin.acroFormDictionaryRoot.objId,!0),a.internal.acroformPlugin.acroFormDictionaryRoot.putStream()),s=s||a.internal.acroformPlugin.acroFormDictionaryRoot.Kids)if(s.hasOwnProperty(o)){var l=s[o],c=[],d=l.Rect;if(l.Rect&&(l.Rect=Jot(l.Rect,a)),a.internal.newObjectDeferredBegin(l.objId,!0),l.DA=Ft.createDefaultAppearanceStream(l),On(l)==="object"&&typeof l.getKeyValueListForStream=="function"&&(c=l.getKeyValueListForStream()),l.Rect=d,l.hasAppearanceStream&&!l.appearanceStreamContent){var u=Xot(l);c.push({key:"AP",value:"<</N "+u+">>"}),a.internal.acroformPlugin.xForms.push(u)}if(l.appearanceStreamContent){var h="";for(var m in l.appearanceStreamContent)if(l.appearanceStreamContent.hasOwnProperty(m)){var f=l.appearanceStreamContent[m];if(h+="/"+m+" ",h+="<<",Object.keys(f).length>=1||Array.isArray(f)){for(var o in f)if(f.hasOwnProperty(o)){var p=f[o];typeof p=="function"&&(p=p.call(a,l)),h+="/"+o+" "+p+" ",a.internal.acroformPlugin.xForms.indexOf(p)>=0||a.internal.acroformPlugin.xForms.push(p)}}else typeof(p=f)=="function"&&(p=p.call(a,l)),h+="/"+o+" "+p,a.internal.acroformPlugin.xForms.indexOf(p)>=0||a.internal.acroformPlugin.xForms.push(p);h+=">>"}c.push({key:"AP",value:`<<
1533`+h+">>"})}a.internal.putStream({additionalKeyValues:c,objectId:l.objId}),a.internal.out("endobj")}i&&function(A,v){for(var x in A)if(A.hasOwnProperty(x)){var b=x,y=A[x];v.internal.newObjectDeferredBegin(y.objId,!0),On(y)==="object"&&typeof y.putStream=="function"&&y.putStream(),delete A[b]}}(a.internal.acroformPlugin.xForms,a)})(r,e)}),e.internal.acroformPlugin.isInitialized=!0}},Yse=Rs.__acroform__.arrayToPdfArray=function(e,t,r){var s=function(o){return o};if(Array.isArray(e)){for(var a="[",i=0;i<e.length;i++)switch(i!==0&&(a+=" "),On(e[i])){case"boolean":case"number":case"object":a+=e[i].toString();break;case"string":e[i].substr(0,1)!=="/"?(t!==void 0&&r&&(s=r.internal.getEncryptor(t)),a+="("+cp(s(e[i].toString()))+")"):a+=e[i].toString()}return a+"]"}throw new Error("Invalid argument passed to jsPDF.__acroform__.arrayToPdfArray")},n4=function(e,t,r){var s=function(a){return a};return t!==void 0&&r&&(s=r.internal.getEncryptor(t)),(e=e||"").toString(),"("+cp(s(e))+")"},ad=function(){this._objId=void 0,this._scope=void 0,Object.defineProperty(this,"objId",{get:function(){if(this._objId===void 0){if(this.scope===void 0)return;this._objId=this.scope.internal.newObjectDeferred()}return this._objId},set:function(e){this._objId=e}}),Object.defineProperty(this,"scope",{value:this._scope,writable:!0})};ad.prototype.toString=function(){return this.objId+" 0 R"},ad.prototype.putStream=function(){var e=this.getKeyValueListForStream();this.scope.internal.putStream({data:this.stream,additionalKeyValues:e,objectId:this.objId}),this.scope.internal.out("endobj")},ad.prototype.getKeyValueListForStream=function(){var e=[],t=Object.getOwnPropertyNames(this).filter(function(i){return i!="content"&&i!="appearanceStreamContent"&&i!="scope"&&i!="objId"&&i.substring(0,1)!="_"});for(var r in t)if(Object.getOwnPropertyDescriptor(this,t[r]).configurable===!1){var s=t[r],a=this[s];a&&(Array.isArray(a)?e.push({key:s,value:Yse(a,this.objId,this.scope)}):a instanceof ad?(a.scope=this.scope,e.push({key:s,value:a.objId+" 0 R"})):typeof a!="function"&&e.push({key:s,value:a}))}return e};var Jse=function(){ad.call(this),Object.defineProperty(this,"Type",{value:"/XObject",configurable:!1,writable:!0}),Object.defineProperty(this,"Subtype",{value:"/Form",configurable:!1,writable:!0}),Object.defineProperty(this,"FormType",{value:1,configurable:!1,writable:!0});var e,t=[];Object.defineProperty(this,"BBox",{configurable:!1,get:function(){return t},set:function(r){t=r}}),Object.defineProperty(this,"Resources",{value:"2 0 R",configurable:!1,writable:!0}),Object.defineProperty(this,"stream",{enumerable:!1,configurable:!0,set:function(r){e=r.trim()},get:function(){return e||null}})};bo(Jse,ad);var Xse=function(){ad.call(this);var e,t=[];Object.defineProperty(this,"Kids",{enumerable:!1,configurable:!0,get:function(){return t.length>0?t:void 0}}),Object.defineProperty(this,"Fields",{enumerable:!1,configurable:!1,get:function(){return t}}),Object.defineProperty(this,"DA",{enumerable:!1,configurable:!1,get:function(){if(e){var r=function(s){return s};return this.scope&&(r=this.scope.internal.getEncryptor(this.objId)),"("+cp(r(e))+")"}},set:function(r){e=r}})};bo(Xse,ad);var Pc=function e(){ad.call(this);var t=4;Object.defineProperty(this,"F",{enumerable:!1,configurable:!1,get:function(){return t},set:function(x){if(isNaN(x))throw new Error('Invalid value "'+x+'" for attribute F supplied.');t=x}}),Object.defineProperty(this,"showWhenPrinted",{enumerable:!0,configurable:!0,get:function(){return!!ea(t,3)},set:function(x){x?this.F=ta(t,3):this.F=ra(t,3)}});var r=0;Object.defineProperty(this,"Ff",{enumerable:!1,configurable:!1,get:function(){return r},set:function(x){if(isNaN(x))throw new Error('Invalid value "'+x+'" for attribute Ff supplied.');r=x}});var s=[];Object.defineProperty(this,"Rect",{enumerable:!1,configurable:!1,get:function(){if(s.length!==0)return s},set:function(x){s=x!==void 0?x:[]}}),Object.defineProperty(this,"x",{enumerable:!0,configurable:!0,get:function(){return!s||isNaN(s[0])?0:s[0]},set:function(x){s[0]=x}}),Object.defineProperty(this,"y",{enumerable:!0,configurable:!0,get:function(){return!s||isNaN(s[1])?0:s[1]},set:function(x){s[1]=x}}),Object.defineProperty(this,"width",{enumerable:!0,configurable:!0,get:function(){return!s||isNaN(s[2])?0:s[2]},set:function(x){s[2]=x}}),Object.defineProperty(this,"height",{enumerable:!0,configurable:!0,get:function(){return!s||isNaN(s[3])?0:s[3]},set:function(x){s[3]=x}});var a="";Object.defineProperty(this,"FT",{enumerable:!0,configurable:!1,get:function(){return a},set:function(x){switch(x){case"/Btn":case"/Tx":case"/Ch":case"/Sig":a=x;break;default:throw new Error('Invalid value "'+x+'" for attribute FT supplied.')}}});var i=null;Object.defineProperty(this,"T",{enumerable:!0,configurable:!1,get:function(){if(!i||i.length<1){if(this instanceof l_)return;i="FieldObject"+e.FieldNum++}var x=function(b){return b};return this.scope&&(x=this.scope.internal.getEncryptor(this.objId)),"("+cp(x(i))+")"},set:function(x){i=x.toString()}}),Object.defineProperty(this,"fieldName",{configurable:!0,enumerable:!0,get:function(){return i},set:function(x){i=x}});var o="helvetica";Object.defineProperty(this,"fontName",{enumerable:!0,configurable:!0,get:function(){return o},set:function(x){o=x}});var l="normal";Object.defineProperty(this,"fontStyle",{enumerable:!0,configurable:!0,get:function(){return l},set:function(x){l=x}});var c=0;Object.defineProperty(this,"fontSize",{enumerable:!0,configurable:!0,get:function(){return c},set:function(x){c=x}});var d=void 0;Object.defineProperty(this,"maxFontSize",{enumerable:!0,configurable:!0,get:function(){return d===void 0?50/j6:d},set:function(x){d=x}});var u="black";Object.defineProperty(this,"color",{enumerable:!0,configurable:!0,get:function(){return u},set:function(x){u=x}});var h="/F1 0 Tf 0 g";Object.defineProperty(this,"DA",{enumerable:!0,configurable:!1,get:function(){if(!(!h||this instanceof l_||this instanceof Sm))return n4(h,this.objId,this.scope)},set:function(x){x=x.toString(),h=x}});var m=null;Object.defineProperty(this,"DV",{enumerable:!1,configurable:!1,get:function(){if(m)return this instanceof Va==0?n4(m,this.objId,this.scope):m},set:function(x){x=x.toString(),m=this instanceof Va==0?x.substr(0,1)==="("?Wp(x.substr(1,x.length-2)):Wp(x):x}}),Object.defineProperty(this,"defaultValue",{enumerable:!0,configurable:!0,get:function(){return this instanceof Va==1?Wp(m.substr(1,m.length-1)):m},set:function(x){x=x.toString(),m=this instanceof Va==1?"/"+x:x}});var f=null;Object.defineProperty(this,"_V",{enumerable:!1,configurable:!1,get:function(){if(f)return f},set:function(x){this.V=x}}),Object.defineProperty(this,"V",{enumerable:!1,configurable:!1,get:function(){if(f)return this instanceof Va==0?n4(f,this.objId,this.scope):f},set:function(x){x=x.toString(),f=this instanceof Va==0?x.substr(0,1)==="("?Wp(x.substr(1,x.length-2)):Wp(x):x}}),Object.defineProperty(this,"value",{enumerable:!0,configurable:!0,get:function(){return this instanceof Va==1?Wp(f.substr(1,f.length-1)):f},set:function(x){x=x.toString(),f=this instanceof Va==1?"/"+x:x}}),Object.defineProperty(this,"hasAnnotation",{enumerable:!0,configurable:!0,get:function(){return this.Rect}}),Object.defineProperty(this,"Type",{enumerable:!0,configurable:!1,get:function(){return this.hasAnnotation?"/Annot":null}}),Object.defineProperty(this,"Subtype",{enumerable:!0,configurable:!1,get:function(){return this.hasAnnotation?"/Widget":null}});var p,A=!1;Object.defineProperty(this,"hasAppearanceStream",{enumerable:!0,configurable:!0,get:function(){return A},set:function(x){x=!!x,A=x}}),Object.defineProperty(this,"page",{enumerable:!0,configurable:!0,get:function(){if(p)return p},set:function(x){p=x}}),Object.defineProperty(this,"readOnly",{enumerable:!0,configurable:!0,get:function(){return!!ea(this.Ff,1)},set:function(x){x?this.Ff=ta(this.Ff,1):this.Ff=ra(this.Ff,1)}}),Object.defineProperty(this,"required",{enumerable:!0,configurable:!0,get:function(){return!!ea(this.Ff,2)},set:function(x){x?this.Ff=ta(this.Ff,2):this.Ff=ra(this.Ff,2)}}),Object.defineProperty(this,"noExport",{enumerable:!0,configurable:!0,get:function(){return!!ea(this.Ff,3)},set:function(x){x?this.Ff=ta(this.Ff,3):this.Ff=ra(this.Ff,3)}});var v=null;Object.defineProperty(this,"Q",{enumerable:!0,configurable:!1,get:function(){if(v!==null)return v},set:function(x){if([0,1,2].indexOf(x)===-1)throw new Error('Invalid value "'+x+'" for attribute Q supplied.');v=x}}),Object.defineProperty(this,"textAlign",{get:function(){var x;switch(v){case 0:default:x="left";break;case 1:x="center";break;case 2:x="right"}return x},configurable:!0,enumerable:!0,set:function(x){switch(x){case"right":case 2:v=2;break;case"center":case 1:v=1;break;default:v=0}}})};bo(Pc,ad);var MA=function(){Pc.call(this),this.FT="/Ch",this.V="()",this.fontName="zapfdingbats";var e=0;Object.defineProperty(this,"TI",{enumerable:!0,configurable:!1,get:function(){return e},set:function(r){e=r}}),Object.defineProperty(this,"topIndex",{enumerable:!0,configurable:!0,get:function(){return e},set:function(r){e=r}});var t=[];Object.defineProperty(this,"Opt",{enumerable:!0,configurable:!1,get:function(){return Yse(t,this.objId,this.scope)},set:function(r){var s,a;a=[],typeof(s=r)=="string"&&(a=function(i,o,l){l||(l=1);for(var c,d=[];c=o.exec(i);)d.push(c[l]);return d}(s,/\((.*?)\)/g)),t=a}}),this.getOptions=function(){return t},this.setOptions=function(r){t=r,this.sort&&t.sort()},this.addOption=function(r){r=(r=r||"").toString(),t.push(r),this.sort&&t.sort()},this.removeOption=function(r,s){for(s=s||!1,r=(r=r||"").toString();t.indexOf(r)!==-1&&(t.splice(t.indexOf(r),1),s!==!1););},Object.defineProperty(this,"combo",{enumerable:!0,configurable:!0,get:function(){return!!ea(this.Ff,18)},set:function(r){r?this.Ff=ta(this.Ff,18):this.Ff=ra(this.Ff,18)}}),Object.defineProperty(this,"edit",{enumerable:!0,configurable:!0,get:function(){return!!ea(this.Ff,19)},set:function(r){this.combo===!0&&(r?this.Ff=ta(this.Ff,19):this.Ff=ra(this.Ff,19))}}),Object.defineProperty(this,"sort",{enumerable:!0,configurable:!0,get:function(){return!!ea(this.Ff,20)},set:function(r){r?(this.Ff=ta(this.Ff,20),t.sort()):this.Ff=ra(this.Ff,20)}}),Object.defineProperty(this,"multiSelect",{enumerable:!0,configurable:!0,get:function(){return!!ea(this.Ff,22)},set:function(r){r?this.Ff=ta(this.Ff,22):this.Ff=ra(this.Ff,22)}}),Object.defineProperty(this,"doNotSpellCheck",{enumerable:!0,configurable:!0,get:function(){return!!ea(this.Ff,23)},set:function(r){r?this.Ff=ta(this.Ff,23):this.Ff=ra(this.Ff,23)}}),Object.defineProperty(this,"commitOnSelChange",{enumerable:!0,configurable:!0,get:function(){return!!ea(this.Ff,27)},set:function(r){r?this.Ff=ta(this.Ff,27):this.Ff=ra(this.Ff,27)}}),this.hasAppearanceStream=!1};bo(MA,Pc);var $A=function(){MA.call(this),this.fontName="helvetica",this.combo=!1};bo($A,MA);var QA=function(){$A.call(this),this.combo=!0};bo(QA,$A);var Mj=function(){QA.call(this),this.edit=!0};bo(Mj,QA);var Va=function(){Pc.call(this),this.FT="/Btn",Object.defineProperty(this,"noToggleToOff",{enumerable:!0,configurable:!0,get:function(){return!!ea(this.Ff,15)},set:function(r){r?this.Ff=ta(this.Ff,15):this.Ff=ra(this.Ff,15)}}),Object.defineProperty(this,"radio",{enumerable:!0,configurable:!0,get:function(){return!!ea(this.Ff,16)},set:function(r){r?this.Ff=ta(this.Ff,16):this.Ff=ra(this.Ff,16)}}),Object.defineProperty(this,"pushButton",{enumerable:!0,configurable:!0,get:function(){return!!ea(this.Ff,17)},set:function(r){r?this.Ff=ta(this.Ff,17):this.Ff=ra(this.Ff,17)}}),Object.defineProperty(this,"radioIsUnison",{enumerable:!0,configurable:!0,get:function(){return!!ea(this.Ff,26)},set:function(r){r?this.Ff=ta(this.Ff,26):this.Ff=ra(this.Ff,26)}});var e,t={};Object.defineProperty(this,"MK",{enumerable:!1,configurable:!1,get:function(){var r=function(i){return i};if(this.scope&&(r=this.scope.internal.getEncryptor(this.objId)),Object.keys(t).length!==0){var s,a=[];for(s in a.push("<<"),t)a.push("/"+s+" ("+cp(r(t[s]))+")");return a.push(">>"),a.join(`
1534`)}},set:function(r){On(r)==="object"&&(t=r)}}),Object.defineProperty(this,"caption",{enumerable:!0,configurable:!0,get:function(){return t.CA||""},set:function(r){typeof r=="string"&&(t.CA=r)}}),Object.defineProperty(this,"AS",{enumerable:!1,configurable:!1,get:function(){return e},set:function(r){e=r}}),Object.defineProperty(this,"appearanceState",{enumerable:!0,configurable:!0,get:function(){return e.substr(1,e.length-1)},set:function(r){e="/"+r}})};bo(Va,Pc);var $j=function(){Va.call(this),this.pushButton=!0};bo($j,Va);var HA=function(){Va.call(this),this.radio=!0,this.pushButton=!1;var e=[];Object.defineProperty(this,"Kids",{enumerable:!0,configurable:!1,get:function(){return e},set:function(t){e=t!==void 0?t:[]}})};bo(HA,Va);var l_=function(){var e,t;Pc.call(this),Object.defineProperty(this,"Parent",{enumerable:!1,configurable:!1,get:function(){return e},set:function(a){e=a}}),Object.defineProperty(this,"optionName",{enumerable:!1,configurable:!0,get:function(){return t},set:function(a){t=a}});var r,s={};Object.defineProperty(this,"MK",{enumerable:!1,configurable:!1,get:function(){var a=function(l){return l};this.scope&&(a=this.scope.internal.getEncryptor(this.objId));var i,o=[];for(i in o.push("<<"),s)o.push("/"+i+" ("+cp(a(s[i]))+")");return o.push(">>"),o.join(`
1535`)},set:function(a){On(a)==="object"&&(s=a)}}),Object.defineProperty(this,"caption",{enumerable:!0,configurable:!0,get:function(){return s.CA||""},set:function(a){typeof a=="string"&&(s.CA=a)}}),Object.defineProperty(this,"AS",{enumerable:!1,configurable:!1,get:function(){return r},set:function(a){r=a}}),Object.defineProperty(this,"appearanceState",{enumerable:!0,configurable:!0,get:function(){return r.substr(1,r.length-1)},set:function(a){r="/"+a}}),this.caption="l",this.appearanceState="Off",this._AppearanceType=Ft.RadioButton.Circle,this.appearanceStreamContent=this._AppearanceType.createAppearanceStream(this.optionName)};bo(l_,Pc),HA.prototype.setAppearance=function(e){if(!("createAppearanceStream"in e)||!("getCA"in e))throw new Error("Couldn't assign Appearance to RadioButton. Appearance was Invalid!");for(var t in this.Kids)if(this.Kids.hasOwnProperty(t)){var r=this.Kids[t];r.appearanceStreamContent=e.createAppearanceStream(r.optionName),r.caption=e.getCA()}},HA.prototype.createOption=function(e){var t=new l_;return t.Parent=this,t.optionName=e,this.Kids.push(t),rlt.call(this.scope,t),t};var Qj=function(){Va.call(this),this.fontName="zapfdingbats",this.caption="3",this.appearanceState="On",this.value="On",this.textAlign="center",this.appearanceStreamContent=Ft.CheckBox.createAppearanceStream()};bo(Qj,Va);var Sm=function(){Pc.call(this),this.FT="/Tx",Object.defineProperty(this,"multiline",{enumerable:!0,configurable:!0,get:function(){return!!ea(this.Ff,13)},set:function(t){t?this.Ff=ta(this.Ff,13):this.Ff=ra(this.Ff,13)}}),Object.defineProperty(this,"fileSelect",{enumerable:!0,configurable:!0,get:function(){return!!ea(this.Ff,21)},set:function(t){t?this.Ff=ta(this.Ff,21):this.Ff=ra(this.Ff,21)}}),Object.defineProperty(this,"doNotSpellCheck",{enumerable:!0,configurable:!0,get:function(){return!!ea(this.Ff,23)},set:function(t){t?this.Ff=ta(this.Ff,23):this.Ff=ra(this.Ff,23)}}),Object.defineProperty(this,"doNotScroll",{enumerable:!0,configurable:!0,get:function(){return!!ea(this.Ff,24)},set:function(t){t?this.Ff=ta(this.Ff,24):this.Ff=ra(this.Ff,24)}}),Object.defineProperty(this,"comb",{enumerable:!0,configurable:!0,get:function(){return!!ea(this.Ff,25)},set:function(t){t?this.Ff=ta(this.Ff,25):this.Ff=ra(this.Ff,25)}}),Object.defineProperty(this,"richText",{enumerable:!0,configurable:!0,get:function(){return!!ea(this.Ff,26)},set:function(t){t?this.Ff=ta(this.Ff,26):this.Ff=ra(this.Ff,26)}});var e=null;Object.defineProperty(this,"MaxLen",{enumerable:!0,configurable:!1,get:function(){return e},set:function(t){e=t}}),Object.defineProperty(this,"maxLength",{enumerable:!0,configurable:!0,get:function(){return e},set:function(t){Number.isInteger(t)&&(e=t)}}),Object.defineProperty(this,"hasAppearanceStream",{enumerable:!0,configurable:!0,get:function(){return this.V||this.DV}})};bo(Sm,Pc);var Hj=function(){Sm.call(this),Object.defineProperty(this,"password",{enumerable:!0,configurable:!0,get:function(){return!!ea(this.Ff,14)},set:function(e){e?this.Ff=ta(this.Ff,14):this.Ff=ra(this.Ff,14)}}),this.password=!0};bo(Hj,Sm);var Ft={CheckBox:{createAppearanceStream:function(){return{N:{On:Ft.CheckBox.YesNormal},D:{On:Ft.CheckBox.YesPushDown,Off:Ft.CheckBox.OffPushDown}}},YesPushDown:function(e){var t=Kc(e);t.scope=e.scope;var r=[],s=e.scope.internal.getFont(e.fontName,e.fontStyle).id,a=e.scope.__private__.encodeColorString(e.color),i=SP(e,e.caption);return r.push("0.749023 g"),r.push("0 0 "+Er(Ft.internal.getWidth(e))+" "+Er(Ft.internal.getHeight(e))+" re"),r.push("f"),r.push("BMC"),r.push("q"),r.push("0 0 1 rg"),r.push("/"+s+" "+Er(i.fontSize)+" Tf "+a),r.push("BT"),r.push(i.text),r.push("ET"),r.push("Q"),r.push("EMC"),t.stream=r.join(`
1536`),t},YesNormal:function(e){var t=Kc(e);t.scope=e.scope;var r=e.scope.internal.getFont(e.fontName,e.fontStyle).id,s=e.scope.__private__.encodeColorString(e.color),a=[],i=Ft.internal.getHeight(e),o=Ft.internal.getWidth(e),l=SP(e,e.caption);return a.push("1 g"),a.push("0 0 "+Er(o)+" "+Er(i)+" re"),a.push("f"),a.push("q"),a.push("0 0 1 rg"),a.push("0 0 "+Er(o-1)+" "+Er(i-1)+" re"),a.push("W"),a.push("n"),a.push("0 g"),a.push("BT"),a.push("/"+r+" "+Er(l.fontSize)+" Tf "+s),a.push(l.text),a.push("ET"),a.push("Q"),t.stream=a.join(`
1537`),t},OffPushDown:function(e){var t=Kc(e);t.scope=e.scope;var r=[];return r.push("0.749023 g"),r.push("0 0 "+Er(Ft.internal.getWidth(e))+" "+Er(Ft.internal.getHeight(e))+" re"),r.push("f"),t.stream=r.join(`
1538`),t}},RadioButton:{Circle:{createAppearanceStream:function(e){var t={D:{Off:Ft.RadioButton.Circle.OffPushDown},N:{}};return t.N[e]=Ft.RadioButton.Circle.YesNormal,t.D[e]=Ft.RadioButton.Circle.YesPushDown,t},getCA:function(){return"l"},YesNormal:function(e){var t=Kc(e);t.scope=e.scope;var r=[],s=Ft.internal.getWidth(e)<=Ft.internal.getHeight(e)?Ft.internal.getWidth(e)/4:Ft.internal.getHeight(e)/4;s=Number((.9*s).toFixed(5));var a=Ft.internal.Bezier_C,i=Number((s*a).toFixed(5));return r.push("q"),r.push("1 0 0 1 "+lh(Ft.internal.getWidth(e)/2)+" "+lh(Ft.internal.getHeight(e)/2)+" cm"),r.push(s+" 0 m"),r.push(s+" "+i+" "+i+" "+s+" 0 "+s+" c"),r.push("-"+i+" "+s+" -"+s+" "+i+" -"+s+" 0 c"),r.push("-"+s+" -"+i+" -"+i+" -"+s+" 0 -"+s+" c"),r.push(i+" -"+s+" "+s+" -"+i+" "+s+" 0 c"),r.push("f"),r.push("Q"),t.stream=r.join(`
1539`),t},YesPushDown:function(e){var t=Kc(e);t.scope=e.scope;var r=[],s=Ft.internal.getWidth(e)<=Ft.internal.getHeight(e)?Ft.internal.getWidth(e)/4:Ft.internal.getHeight(e)/4;s=Number((.9*s).toFixed(5));var a=Number((2*s).toFixed(5)),i=Number((a*Ft.internal.Bezier_C).toFixed(5)),o=Number((s*Ft.internal.Bezier_C).toFixed(5));return r.push("0.749023 g"),r.push("q"),r.push("1 0 0 1 "+lh(Ft.internal.getWidth(e)/2)+" "+lh(Ft.internal.getHeight(e)/2)+" cm"),r.push(a+" 0 m"),r.push(a+" "+i+" "+i+" "+a+" 0 "+a+" c"),r.push("-"+i+" "+a+" -"+a+" "+i+" -"+a+" 0 c"),r.push("-"+a+" -"+i+" -"+i+" -"+a+" 0 -"+a+" c"),r.push(i+" -"+a+" "+a+" -"+i+" "+a+" 0 c"),r.push("f"),r.push("Q"),r.push("0 g"),r.push("q"),r.push("1 0 0 1 "+lh(Ft.internal.getWidth(e)/2)+" "+lh(Ft.internal.getHeight(e)/2)+" cm"),r.push(s+" 0 m"),r.push(s+" "+o+" "+o+" "+s+" 0 "+s+" c"),r.push("-"+o+" "+s+" -"+s+" "+o+" -"+s+" 0 c"),r.push("-"+s+" -"+o+" -"+o+" -"+s+" 0 -"+s+" c"),r.push(o+" -"+s+" "+s+" -"+o+" "+s+" 0 c"),r.push("f"),r.push("Q"),t.stream=r.join(`
1540`),t},OffPushDown:function(e){var t=Kc(e);t.scope=e.scope;var r=[],s=Ft.internal.getWidth(e)<=Ft.internal.getHeight(e)?Ft.internal.getWidth(e)/4:Ft.internal.getHeight(e)/4;s=Number((.9*s).toFixed(5));var a=Number((2*s).toFixed(5)),i=Number((a*Ft.internal.Bezier_C).toFixed(5));return r.push("0.749023 g"),r.push("q"),r.push("1 0 0 1 "+lh(Ft.internal.getWidth(e)/2)+" "+lh(Ft.internal.getHeight(e)/2)+" cm"),r.push(a+" 0 m"),r.push(a+" "+i+" "+i+" "+a+" 0 "+a+" c"),r.push("-"+i+" "+a+" -"+a+" "+i+" -"+a+" 0 c"),r.push("-"+a+" -"+i+" -"+i+" -"+a+" 0 -"+a+" c"),r.push(i+" -"+a+" "+a+" -"+i+" "+a+" 0 c"),r.push("f"),r.push("Q"),t.stream=r.join(`
1541`),t}},Cross:{createAppearanceStream:function(e){var t={D:{Off:Ft.RadioButton.Cross.OffPushDown},N:{}};return t.N[e]=Ft.RadioButton.Cross.YesNormal,t.D[e]=Ft.RadioButton.Cross.YesPushDown,t},getCA:function(){return"8"},YesNormal:function(e){var t=Kc(e);t.scope=e.scope;var r=[],s=Ft.internal.calculateCross(e);return r.push("q"),r.push("1 1 "+Er(Ft.internal.getWidth(e)-2)+" "+Er(Ft.internal.getHeight(e)-2)+" re"),r.push("W"),r.push("n"),r.push(Er(s.x1.x)+" "+Er(s.x1.y)+" m"),r.push(Er(s.x2.x)+" "+Er(s.x2.y)+" l"),r.push(Er(s.x4.x)+" "+Er(s.x4.y)+" m"),r.push(Er(s.x3.x)+" "+Er(s.x3.y)+" l"),r.push("s"),r.push("Q"),t.stream=r.join(`
1542`),t},YesPushDown:function(e){var t=Kc(e);t.scope=e.scope;var r=Ft.internal.calculateCross(e),s=[];return s.push("0.749023 g"),s.push("0 0 "+Er(Ft.internal.getWidth(e))+" "+Er(Ft.internal.getHeight(e))+" re"),s.push("f"),s.push("q"),s.push("1 1 "+Er(Ft.internal.getWidth(e)-2)+" "+Er(Ft.internal.getHeight(e)-2)+" re"),s.push("W"),s.push("n"),s.push(Er(r.x1.x)+" "+Er(r.x1.y)+" m"),s.push(Er(r.x2.x)+" "+Er(r.x2.y)+" l"),s.push(Er(r.x4.x)+" "+Er(r.x4.y)+" m"),s.push(Er(r.x3.x)+" "+Er(r.x3.y)+" l"),s.push("s"),s.push("Q"),t.stream=s.join(`
1543`),t},OffPushDown:function(e){var t=Kc(e);t.scope=e.scope;var r=[];return r.push("0.749023 g"),r.push("0 0 "+Er(Ft.internal.getWidth(e))+" "+Er(Ft.internal.getHeight(e))+" re"),r.push("f"),t.stream=r.join(`
1544`),t}}},createDefaultAppearanceStream:function(e){var t=e.scope.internal.getFont(e.fontName,e.fontStyle).id,r=e.scope.__private__.encodeColorString(e.color);return"/"+t+" "+e.fontSize+" Tf "+r}};Ft.internal={Bezier_C:.551915024494,calculateCross:function(e){var t=Ft.internal.getWidth(e),r=Ft.internal.getHeight(e),s=Math.min(t,r);return{x1:{x:(t-s)/2,y:(r-s)/2+s},x2:{x:(t-s)/2+s,y:(r-s)/2},x3:{x:(t-s)/2,y:(r-s)/2},x4:{x:(t-s)/2+s,y:(r-s)/2+s}}}},Ft.internal.getWidth=function(e){var t=0;return On(e)==="object"&&(t=sz(e.Rect[2])),t},Ft.internal.getHeight=function(e){var t=0;return On(e)==="object"&&(t=sz(e.Rect[3])),t};var rlt=Rs.addField=function(e){if(tlt(this,e),!(e instanceof Pc))throw new Error("Invalid argument passed to 
1544jsPDF.addField.");var t;return(t=e).scope.internal.acroformPlugin.printedOut&&(t.scope.internal.acroformPlugin.printedOut=!1,t.scope.internal.acroformPlugin.acroFormDictionaryRoot=null),t.scope.internal.acroformPlugin.acroFormDictionaryRoot.Fields.push(t),e.page=e.scope.internal.getCurrentPageInfo().pageNumber,this};Rs.AcroFormChoiceField=MA,Rs.AcroFormListBox=$A,Rs.AcroFormComboBox=QA,Rs.AcroFormEditBox=Mj,Rs.AcroFormButton=Va,Rs.AcroFormPushButton=$j,Rs.AcroFormRadioButton=HA,Rs.AcroFormCheckBox=Qj,Rs.AcroFormTextField=Sm,Rs.AcroFormPasswordField=Hj,Rs.AcroFormAppearance=Ft,Rs.AcroForm={ChoiceField:MA,ListBox:$A,ComboBox:QA,EditBox:Mj,Button:Va,PushButton:$j,RadioButton:HA,CheckBox:Qj,TextField:Sm,PasswordField:Hj,Appearance:Ft},Wt.AcroForm={ChoiceField:MA,ListBox:$A,ComboBox:QA,EditBox:Mj,Button:Va,PushButton:$j,RadioButton:HA,CheckBox:Qj,TextField:Sm,PasswordField:Hj,Appearance:Ft};Wt.AcroForm;function Zse(e){return e.reduce(function(t,r,s){return t[r]=s,t},{})}(function(e){var t="addImage_";e.__addimage__={};var r="UNKNOWN",s={PNG:[[137,80,78,71]],TIFF:[[77,77,0,42],[73,73,42,0]],JPEG:[[255,216,255,224,void 0,void 0,74,70,73,70,0],[255,216,255,225,void 0,void 0,69,120,105,102,0,0],[255,216,255,219],[255,216,255,238]],JPEG2000:[[0,0,0,12,106,80,32,32]],GIF87a:[[71,73,70,56,55,97]],GIF89a:[[71,73,70,56,57,97]],WEBP:[[82,73,70,70,void 0,void 0,void 0,void 0,87,69,66,80]],BMP:[[66,77],[66,65],[67,73],[67,80],[73,67],[80,84]]},a=e.__addimage__.getImageFileTypeByImageData=function(T,B){var L,P,F,M,I,$=r;if((B=B||r)==="RGBA"||T.data!==void 0&&T.data instanceof Uint8ClampedArray&&"height"in T&&"width"in T)return"RGBA";if(N(T))for(I in s)for(F=s[I],L=0;L<F.length;L+=1){for(M=!0,P=0;P<F[L].length;P+=1)if(F[L][P]!==void 0&&F[L][P]!==T[P]){M=!1;break}if(M===!0){$=I;break}}else for(I in s)for(F=s[I],L=0;L<F.length;L+=1){for(M=!0,P=0;P<F[L].length;P+=1)if(F[L][P]!==void 0&&F[L][P]!==T.charCodeAt(P)){M=!1;break}if(M===!0){$=I;break}}return $===r&&B!==r&&($=B),$},i=function T(B){for(var L=this.internal.write,P=this.internal.putStream,F=(0,this.internal.getFilters)();F.indexOf("FlateEncode")!==-1;)F.splice(F.indexOf("FlateEncode"),1);B.objectId=this.internal.newObject();var M=[];if(M.push({key:"Type",value:"/XObject"}),M.push({key:"Subtype",value:"/Image"}),M.push({key:"Width",value:B.width}),M.push({key:"Height",value:B.height}),B.colorSpace===x.INDEXED?M.push({key:"ColorSpace",value:"[/Indexed /DeviceRGB "+(B.palette.length/3-1)+" "+("sMask"in B&&B.sMask!==void 0?B.objectId+2:B.objectId+1)+" 0 R]"}):(M.push({key:"ColorSpace",value:"/"+B.colorSpace}),B.colorSpace===x.DEVICE_CMYK&&M.push({key:"Decode",value:"[1 0 1 0 1 0 1 0]"})),M.push({key:"BitsPerComponent",value:B.bitsPerComponent}),"decodeParameters"in B&&B.decodeParameters!==void 0&&M.push({key:"DecodeParms",value:"<<"+B.decodeParameters+">>"}),"transparency"in B&&Array.isArray(B.transparency)&&B.transparency.length>0){for(var I="",$=0,V=B.transparency.length;$<V;$++)I+=B.transparency[$]+" "+B.transparency[$]+" ";M.push({key:"Mask",value:"["+I+"]"})}B.sMask!==void 0&&M.push({key:"SMask",value:B.objectId+1+" 0 R"});var R=B.filter!==void 0?["/"+B.filter]:void 0;if(P({data:B.data,additionalKeyValues:M,alreadyAppliedFilters:R,objectId:B.objectId}),L("endobj"),"sMask"in B&&B.sMask!==void 0){var Q,U=(Q=B.sMaskBitsPerComponent)!==null&&Q!==void 0?Q:B.bitsPerComponent,D={width:B.width,height:B.height,colorSpace:"DeviceGray",bitsPerComponent:U,data:B.sMask};"filter"in B&&(D.decodeParameters="/Predictor ".concat(B.predictor," /Colors 1 /BitsPerComponent ").concat(U," /Columns ").concat(B.width),D.filter=B.filter),T.call(this,D)}
vendor: 5,030 bytes, line 1544
1544if(B.colorSpace===x.INDEXED){var q=this.internal.newObject();P({data:S(new Uint8Array(B.palette)),objectId:q}),L("endobj")}},o=function(){var T=this.internal.collections[t+"images"];for(var B in T)i.call(this,T[B])},l=function(){var T,B=this.internal.collections[t+"images"],L=this.internal.write;for(var P in B)L("/I"+(T=B[P]).index,T.objectId,"0","R")},c=function(){this.internal.collections[t+"images"]||(this.internal.collections[t+"images"]={},this.internal.events.subscribe("putResources",o),this.internal.events.subscribe("putXobjectDict",l))},d=function(){var T=this.internal.collections[t+"images"];return c.call(this),T},u=function(){return Object.keys(this.internal.collections[t+"images"]).length},h=function(T){return typeof e["process"+T.toUpperCase()]=="function"},m=function(T){return On(T)==="object"&&T.nodeType===1},f=function(T,B){if(T.nodeName==="IMG"&&T.hasAttribute("src")){var L=""+T.getAttribute("src");if(L.indexOf("data:image/")===0)return Uj(unescape(L).split("base64,").pop());var P=e.loadFile(L,!0);if(P!==void 0)return P}if(T.nodeName==="CANVAS"){if(T.width===0||T.height===0)throw new Error("Given canvas must have data. Canvas width: "+T.width+", height: "+T.height);var F;switch(B){case"PNG":F="image/png";break;case"WEBP":F="image/webp";break;default:F="image/jpeg"}return Uj(T.toDataURL(F,1).split("base64,").pop())}},p=function(T){var B=this.internal.collections[t+"images"];if(B){for(var L in B)if(T===B[L].alias)return B[L]}},A=function(T,B,L){return T||B||(T=-96,B=-96),T<0&&(T=-1*L.width*72/T/this.internal.scaleFactor),B<0&&(B=-1*L.height*72/B/this.internal.scaleFactor),T===0&&(T=B*L.width/L.height),B===0&&(B=T*L.height/L.width),[T,B]},v=function(T,B,L,P,F,M){var I=A.call(this,L,P,F),$=this.internal.getCoordinateString,V=this.internal.getVerticalCoordinateString,R=d.call(this);if(L=I[0],P=I[1],R[F.index]=F,M){M*=Math.PI/180;var Q=Math.cos(M),U=Math.sin(M),D=function(G){return G.toFixed(4)},q=[D(Q),D(U),D(-1*U),D(Q),0,0,"cm"]}this.internal.write("q"),M?(this.internal.write([1,"0","0",1,$(T),V(B+P),"cm"].join(" ")),this.internal.write(q.join(" ")),this.internal.write([$(L),"0","0",$(P),"0","0","cm"].join(" "))):this.internal.write([$(L),"0","0",$(P),$(T),V(B+P),"cm"].join(" ")),this.isAdvancedAPI()&&this.internal.write([1,0,0,-1,0,0,"cm"].join(" ")),this.internal.write("/I"+F.index+" Do"),this.internal.write("Q")},x=e.color_spaces={DEVICE_RGB:"DeviceRGB",DEVICE_GRAY:"DeviceGray",DEVICE_CMYK:"DeviceCMYK",CAL_GREY:"CalGray",CAL_RGB:"CalRGB",LAB:"Lab",ICC_BASED:"ICCBased",INDEXED:"Indexed",PATTERN:"Pattern",SEPARATION:"Separation",DEVICE_N:"DeviceN"};e.decode={DCT_DECODE:"DCTDecode",FLATE_DECODE:"FlateDecode",LZW_DECODE:"LZWDecode",JPX_DECODE:"JPXDecode",JBIG2_DECODE:"JBIG2Decode",ASCII85_DECODE:"ASCII85Decode",ASCII_HEX_DECODE:"ASCIIHexDecode",RUN_LENGTH_DECODE:"RunLengthDecode",CCITT_FAX_DECODE:"CCITTFaxDecode"};var b=e.image_compression={NONE:"NONE",FAST:"FAST",MEDIUM:"MEDIUM",SLOW:"SLOW"},y=e.__addimage__.sHashCode=function(T){var B,L,P=0;if(typeof T=="string")for(L=T.length,B=0;B<L;B++)P=(P<<5)-P+T.charCodeAt(B),P|=0;else if(N(T))for(L=T.byteLength/2,B=0;B<L;B++)P=(P<<5)-P+T[B],P|=0;return P},w=e.__addimage__.validateStringAsBase64=function(T){(T=T||"").toString().trim();var B=!0;return T.length===0&&(B=!1),T.length%4!=0&&(B=!1),/^[A-Za-z0-9+/]+$/.test(T.substr(0,T.length-2))===!1&&(B=!1),/^[A-Za-z0-9/][A-Za-z0-9+/]|[A-Za-z0-9+/]=|==$/.test(T.substr(-2))===!1&&(B=!1),B},j=e.__addimage__.extractImageFromDataUrl=function(T){if(T==null||!(T=T.trim()).startsWith("data:"))return null;var B=T.indexOf(",");return B<0?null:T.substring(0,B).trim().endsWith("base64")?T.substring(B+1):null};e.__addimage__.isArrayBuffer=function(T){return T instanceof ArrayBuffer};var N=e.__addimage__.isArrayBufferView=function(T){return T instanceof Int8Array||T instanceof Uint8Array||T instanceof Uint8ClampedArray||T instanceof Int16Array||T instanceof Uint16Array||T instanceof Int32Array||T instanceof Uint32Array||T instanceof Float32Array||T instanceof Float64Array},_=e.__addimage__.binaryStringToUint8Array=function(T){for(var B=T.length,L=new Uint8Array(B),P=0;P<B;P++)L[P]=T.charCodeAt(P);return L},S=e.__addimage__.arrayBufferToBinaryString=function(T){for(var B="",L=N(T)?T:new Uint8Array(T),P=0;P<L.length;P+=8192)B+=String.fromCharCode.apply(null,L.subarray(P,P+8192));return B};e.addImage=function(){var T,B,L,P,F,M,I,$,V;if(typeof arguments[1]=="number"?(B=r,L=arguments[1],P=arguments[2],F=arguments[3],M=arguments[4],I=arguments[5],$=arguments[6],V=arguments[7]):(B=arguments[1],L=arguments[2],P=arguments[3],F=arguments[4],M=arguments[5],I=arguments[6],$=arguments[7],V=arguments[8]),On(T=arguments[0])==="object"&&!m(T)&&"imageData"in T){var R=T;T=R.imageData,B=R.format||B||r,L=R.x||L||0,P=R.y||P||0,F=R.w||R.width||F,M=R.h||R.height||M,I=R.alias||I,$=R.compression||$,V=R.rotation||R.angle||V}var Q=this.internal.getFilters();if($===void 0&&Q.indexOf("FlateEncode")!==-1&&($="SLOW"),isNaN(L)||isNaN(P))throw new Error("Invalid coordinates passed to 
1544jsPDF.addImage");c.call(this);var U=C.call(this,T,B,I,$);return v.call(this,L,P,F,M,U,V),this};var C=function(T,B,L,P){var F,M,I;if(typeof T=="string"&&a(T)===r){T=unescape(T);var $=E(T,!1);($!==""||($=e.loadFile(T,!0))!==void 0)&&(T=$)}if(m(T)&&(T=f(T,B)),B=a(T,B),!h(B))throw new Error("addImage does not support files of type '"+B+"', please ensure that a plugin for '"+B+"' support is added.");if(((I=L)==null||I.length===0)&&(L=function(V){return typeof V=="string"||N(V)?y(V):N(V.data)?y(V.data):null}(T)),(F=p.call(this,L))||(T instanceof Uint8Array||B==="RGBA"||(M=T,T=_(T)),F=this["process"+B.toUpperCase()](T,u.call(this),L,function(V){return V&&typeof V=="string"&&(V=V.toUpperCase()),V in e.image_compression?V:b.NONE}(P),M)),!F)throw new Error("An unknown error occurred whilst processing the image.");return F},E=e.__addimage__.convertBase64ToBinaryString=function(T,B){B=typeof B!="boolean"||B;var L,P="";if(typeof T=="string"){var F;L=(F=j(T))!==null&&F!==void 0?F:T;try{P=Uj(L)}catch(M){if(B)throw w(L)?new Error("atob-Error in jsPDF.convertBase64ToBinaryString "+M.message):new Error("Supplied Data is not a valid base64-String jsPDF.convertBase64ToBinaryString ")}}return P};e.getImageProperties=function(T){var B,L,P="";if(m(T)&&(T=f(T)),typeof T=="string"&&a(T)===r&&((P=E(T,!1))===""&&(P=e.loadFile(T)||""),T=P),L=a(T),!h(L))throw new Error("addImage does not support files of type '"+L+"', please ensure that a plugin for '"+L+"' support is added.");if(T instanceof Uint8Array||(T=_(T)),!(B=this["process"+L.toUpperCase()](T)))throw new Error("An unknown error occurred whilst processing the image");return B.fileType=L,B}})(Wt.API),function(e){var t=function(r){if(r!==void 0&&r!="")return!0};Wt.API.events.push(["addPage",function(r){this.internal.getPageInfo(r.pageNumber).pageContext.annotations=[]}]),e.events.push(["putPage",function(r){for(var s,a,i,o=this.internal.getCoordinateString,l=this.internal.getVerticalCoordinateString,c=this.internal.getPageInfoByObjId(r.objId),d=r.pageContext.annotations,u=!1,h=0;h<d.length&&!u;h++)switch((s=d[h]).type){case"link":(t(s.options.url)||t(s.options.pageNumber))&&(u=!0);break;case"reference":case"text":case"freetext":u=!0}if(u!=0){this.internal.write("/Annots [");for(var m=0;m<d.length;m++){s=d[m];var f=this.internal.pdfEscape,p=this.internal.getEncryptor(r.objId);switch(s.type){case"reference":this.internal.write(" "+s.object.objId+" 0 R ");break;case"text":var A=this.internal.newAdditionalObject(),v=this.internal.newAdditionalObject(),x=this.internal.getEncryptor(A.objId),b=s.title||"Note";i="<</Type /Annot /Subtype /Text "+(a="/Rect ["+o(s.bounds.x)+" "+l(s.bounds.y+s.bounds.h)+" "+o(s.bounds.x+s.bounds.w)+" "+l(s.bounds.y)+"] ")+"/Contents ("+f(x(s.contents))+")",i+=" /Popup "+v.objId+" 0 R",i+=" /P "+c.objId+" 0 R",i+=" /T ("+f(x(b))+") >>",A.content=i;var y=A.objId+" 0 R";i="<</Type /Annot /Subtype /Popup "+(a="/Rect ["+o(s.bounds.x+30)+" "+l(s.bounds.y+s.bounds.h)+" "+o(s.bounds.x+s.bounds.w+30)+" "+l(s.bounds.y)+"] ")+" /Parent "+y,s.open&&(i+=" /Open true"),i+=" >>",v.content=i,this.internal.write(A.objId,"0 R",v.objId,"0 R");break;case"freetext":a="/Rect ["+o(s.bounds.x)+" "+l(s.bounds.y)+" "+o(s.bounds.x+s.bounds.w)+" "+l(s.bounds.y+s.bounds.h)+"] ";var w=s.color||"#000000";i="<</Type /Annot /Subtype /FreeText "+a+"/Contents ("+f(p(s.contents))+")",i+=" /DS(font: Helvetica,sans-serif 12.0pt; text-align:left; color:#"+w+")",i+=" /Border [0 0 0]",i+=" >>",this.internal.write(i);break;case"link":if(s.options.name){var j=this.annotations._nameMap[s.options.name];s.options.pageNumber=j.page,s.options.top=j.y}else s.options.top||(s.options.top=0);if(a="/Rect ["+s.finalBounds.x+" "+s.finalBounds.y+" "+s.finalBounds.w+" "+s.finalBounds.h+"] ",i="",s.options.url)i="<</Type /Annot /Subtype /Link "+a+"/Border [0 0 0] /A <</S /URI /URI ("+f(p(s.options.url))+") >>";else if(s.options.pageNumber)switch(i="<</Type /Annot /Subtype /Link "+a+"/Border [0 0 0] /Dest ["+this.internal.getPageInfo(s.options.pageNumber).objId+" 0 R",s.options.magFactor=s.options.magFactor||"XYZ",s.options.magFactor){case"Fit":i+=" /Fit]";break;case"FitH":i+=" /FitH "+s.options.top+"]";break;case"FitV":s.options.left=s.options.left||0,i+=" /FitV "+s.options.left+"]";break;default:var N=l(s.options.top);s.options.left=s.options.left||0,s.options.zoom===void 0&&(s.options.zoom=0),i+=" /XYZ "+s.options.left+" "+N+" "+s.options.zoom+"]"}i!=""&&(i+=" >>",this.internal.write(i))}}this.internal.write("]")}}]),e.createAnnotation=function(r){var s=this.internal.getCurrentPageInfo();
vendor: 55,119 bytes, lines 1544-1581
1544switch(r.type){case"link":this.link(r.bounds.x,r.bounds.y,r.bounds.w,r.bounds.h,r);break;case"text":case"freetext":s.pageContext.annotations.push(r)}},e.link=function(r,s,a,i,o){var l=this.internal.getCurrentPageInfo(),c=this.internal.getCoordinateString,d=this.internal.getVerticalCoordinateString;l.pageContext.annotations.push({finalBounds:{x:c(r),y:d(s),w:c(r+a),h:d(s+i)},options:o,type:"link"})},e.textWithLink=function(r,s,a,i){var o,l,c=this.getTextWidth(r),d=this.internal.getLineHeight()/this.internal.scaleFactor;if(i.maxWidth!==void 0){l=i.maxWidth;var u=this.splitTextToSize(r,l).length;o=Math.ceil(d*u)}else l=c,o=d;return this.text(r,s,a,i),a+=.2*d,i.align==="center"&&(s-=c/2),i.align==="right"&&(s-=c),this.link(s,a-d,l,o,i),c},e.getTextWidth=function(r){var s=this.internal.getFontSize();return this.getStringUnitWidth(r)*s/this.internal.scaleFactor}}(Wt.API),function(e){var t={1569:[65152],1570:[65153,65154],1571:[65155,65156],1572:[65157,65158],1573:[65159,65160],1574:[65161,65162,65163,65164],1575:[65165,65166],1576:[65167,65168,65169,65170],1577:[65171,65172],1578:[65173,65174,65175,65176],1579:[65177,65178,65179,65180],1580:[65181,65182,65183,65184],1581:[65185,65186,65187,65188],1582:[65189,65190,65191,65192],1583:[65193,65194],1584:[65195,65196],1585:[65197,65198],1586:[65199,65200],1587:[65201,65202,65203,65204],1588:[65205,65206,65207,65208],1589:[65209,65210,65211,65212],1590:[65213,65214,65215,65216],1591:[65217,65218,65219,65220],1592:[65221,65222,65223,65224],1593:[65225,65226,65227,65228],1594:[65229,65230,65231,65232],1601:[65233,65234,65235,65236],1602:[65237,65238,65239,65240],1603:[65241,65242,65243,65244],1604:[65245,65246,65247,65248],1605:[65249,65250,65251,65252],1606:[65253,65254,65255,65256],1607:[65257,65258,65259,65260],1608:[65261,65262],1609:[65263,65264,64488,64489],1610:[65265,65266,65267,65268],1649:[64336,64337],1655:[64477],1657:[64358,64359,64360,64361],1658:[64350,64351,64352,64353],1659:[64338,64339,64340,64341],1662:[64342,64343,64344,64345],1663:[64354,64355,64356,64357],1664:[64346,64347,64348,64349],1667:[64374,64375,64376,64377],1668:[64370,64371,64372,64373],1670:[64378,64379,64380,64381],1671:[64382,64383,64384,64385],1672:[64392,64393],1676:[64388,64389],1677:[64386,64387],1678:[64390,64391],1681:[64396,64397],1688:[64394,64395],1700:[64362,64363,64364,64365],1702:[64366,64367,64368,64369],1705:[64398,64399,64400,64401],1709:[64467,64468,64469,64470],1711:[64402,64403,64404,64405],1713:[64410,64411,64412,64413],1715:[64406,64407,64408,64409],1722:[64414,64415],1723:[64416,64417,64418,64419],1726:[64426,64427,64428,64429],1728:[64420,64421],1729:[64422,64423,64424,64425],1733:[64480,64481],1734:[64473,64474],1735:[64471,64472],1736:[64475,64476],1737:[64482,64483],1739:[64478,64479],1740:[64508,64509,64510,64511],1744:[64484,64485,64486,64487],1746:[64430,64431],1747:[64432,64433]},r={65247:{65154:65269,65156:65271,65160:65273,65166:65275},65248:{65154:65270,65156:65272,65160:65274,65166:65276},65165:{65247:{65248:{65258:65010}}},1617:{1612:64606,1613:64607,1614:64608,1615:64609,1616:64610}},s={1612:64606,1613:64607,1614:64608,1615:64609,1616:64610},a=[1570,1571,1573,1575];e.__arabicParser__={};var i=e.__arabicParser__.isInArabicSubstitutionA=function(A){return t[A.charCodeAt(0)]!==void 0},o=e.__arabicParser__.isArabicLetter=function(A){return typeof A=="string"&&/^[\u0600-\u06FF\u0750-\u077F\u08A0-\u08FF\uFB50-\uFDFF\uFE70-\uFEFF]+$/.test(A)},l=e.__arabicParser__.isArabicEndLetter=function(A){return o(A)&&i(A)&&t[A.charCodeAt(0)].length<=2},c=e.__arabicParser__.isArabicAlfLetter=function(A){return o(A)&&a.indexOf(A.charCodeAt(0))>=0};e.__arabicParser__.arabicLetterHasIsolatedForm=function(A){return o(A)&&i(A)&&t[A.charCodeAt(0)].length>=1};var d=e.__arabicParser__.arabicLetterHasFinalForm=function(A){return o(A)&&i(A)&&t[A.charCodeAt(0)].length>=2};e.__arabicParser__.arabicLetterHasInitialForm=function(A){return o(A)&&i(A)&&t[A.charCodeAt(0)].length>=3};var u=e.__arabicParser__.arabicLetterHasMedialForm=function(A){return o(A)&&i(A)&&t[A.charCodeAt(0)].length==4},h=e.__arabicParser__.resolveLigatures=function(A){var v=0,x=r,b="",y=0;for(v=0;v<A.length;v+=1)x[A.charCodeAt(v)]!==void 0?(y++,typeof(x=x[A.charCodeAt(v)])=="number"&&(b+=String.fromCharCode(x),x=r,y=0),v===A.length-1&&(x=r,b+=A.charAt(v-(y-1)),v-=y-1,y=0)):(x=r,b+=A.charAt(v-y),v-=y,y=0);return b};e.__arabicParser__.isArabicDiacritic=function(A){return A!==void 0&&s[A.charCodeAt(0)]!==void 0};var m=e.__arabicParser__.getCorrectForm=function(A,v,x){return o(A)?i(A)===!1?-1:!d(A)||!o(v)&&!o(x)||!o(x)&&l(v)||l(A)&&!o(v)||l(A)&&c(v)||l(A)&&l(v)?0:u(A)&&o(v)&&!l(v)&&o(x)&&d(x)?3:l(A)||!o(x)?1:2:-1},f=function(A){var v=0,x=0,b=0,y="",w="",j="",N=(A=A||"").split("\\s+"),_=[];for(v=0;v<N.length;v+=1){for(_.push(""),x=0;x<N[v].length;x+=1)y=N[v][x],w=N[v][x-1],j=N[v][x+1],o(y)?(b=m(y,w,j),_[v]+=b!==-1?String.fromCharCode(t[y.charCodeAt(0)][b]):y):_[v]+=y;_[v]=h(_[v])}return _.join(" ")},p=e.__arabicParser__.processArabic=e.processArabic=function(){var A,v=typeof arguments[0]=="string"?arguments[0]:arguments[0].text,x=[];if(Array.isArray(v)){var b=0;for(x=[],b=0;b<v.length;b+=1)Array.isArray(v[b])?x.push([f(v[b][0]),v[b][1],v[b][2]]):x.push([f(v[b])]);A=x}else A=f(v);return typeof arguments[0]=="string"?A:(arguments[0].text=A,arguments[0])};e.events.push(["preProcessText",p])}(Wt.API),Wt.API.autoPrint=function(e){var t;return(e=e||{}).variant=e.variant||"non-conform",e.variant==="javascript"?this.addJS("print({});"):(this.internal.events.subscribe("postPutResources",function(){t=this.internal.newObject(),this.internal.out("<<"),this.internal.out("/S /Named"),this.internal.out("/Type /Action"),this.internal.out("/N /Print"),this.internal.out(">>"),this.internal.out("endobj")}),this.internal.events.subscribe("putCatalog",function(){this.internal.out("/OpenAction "+t+" 0 R")})),this},function(e){var t=function(){var r=void 0;Object.defineProperty(this,"pdf",{get:function(){return r},set:function(l){r=l}});var s=150;Object.defineProperty(this,"width",{get:function(){return s},set:function(l){s=isNaN(l)||Number.isInteger(l)===!1||l<0?150:l,this.getContext("2d").pageWrapXEnabled&&(this.getContext("2d").pageWrapX=s+1)}});var a=300;Object.defineProperty(this,"height",{get:function(){return a},set:function(l){a=isNaN(l)||Number.isInteger(l)===!1||l<0?300:l,this.getContext("2d").pageWrapYEnabled&&(this.getContext("2d").pageWrapY=a+1)}});var i=[];Object.defineProperty(this,"childNodes",{get:function(){return i},set:function(l){i=l}});var o={};Object.defineProperty(this,"style",{get:function(){return o},set:function(l){o=l}}),Object.defineProperty(this,"parentNode",{})};t.prototype.getContext=function(r,s){var a;if((r=r||"2d")!=="2d")return null;for(a in s)this.pdf.context2d.hasOwnProperty(a)&&(this.pdf.context2d[a]=s[a]);return this.pdf.context2d._canvas=this,this.pdf.context2d},t.prototype.toDataURL=function(){throw new Error("toDataURL is not implemented.")},e.events.push(["initialized",function(){this.canvas=new t,this.canvas.pdf=this}])}(Wt.API),function(e){var t={left:0,top:0,bottom:0,right:0},r=!1,s=function(){this.internal.__cell__===void 0&&(this.internal.__cell__={},this.internal.__cell__.padding=3,this.internal.__cell__.headerFunction=void 0,this.internal.__cell__.margins=Object.assign({},t),this.internal.__cell__.margins.width=this.getPageWidth(),a.call(this))},a=function(){this.internal.__cell__.lastCell=new i,this.internal.__cell__.pages=1},i=function(){var c=arguments[0];Object.defineProperty(this,"x",{enumerable:!0,get:function(){return c},set:function(A){c=A}});var d=arguments[1];Object.defineProperty(this,"y",{enumerable:!0,get:function(){return d},set:function(A){d=A}});var u=arguments[2];Object.defineProperty(this,"width",{enumerable:!0,get:function(){return u},set:function(A){u=A}});var h=arguments[3];Object.defineProperty(this,"height",{enumerable:!0,get:function(){return h},set:function(A){h=A}});var m=arguments[4];Object.defineProperty(this,"text",{enumerable:!0,get:function(){return m},set:function(A){m=A}});var f=arguments[5];Object.defineProperty(this,"lineNumber",{enumerable:!0,get:function(){return f},set:function(A){f=A}});var p=arguments[6];return Object.defineProperty(this,"align",{enumerable:!0,get:function(){return p},set:function(A){p=A}}),this};i.prototype.clone=function(){return new i(this.x,this.y,this.width,this.height,this.text,this.lineNumber,this.align)},i.prototype.toArray=function(){return[this.x,this.y,this.width,this.height,this.text,this.lineNumber,this.align]},e.setHeaderFunction=function(c){return s.call(this),this.internal.__cell__.headerFunction=typeof c=="function"?c:void 0,this},e.getTextDimensions=function(c,d){s.call(this);var u=(d=d||{}).fontSize||this.getFontSize(),h=d.font||this.getFont(),m=d.scaleFactor||this.internal.scaleFactor,f=0,p=0,A=0,v=this;if(!Array.isArray(c)&&typeof c!="string"){if(typeof c!="number")throw new Error("getTextDimensions expects text-parameter to be of type String or type Number or an Array of Strings.");c=String(c)}var x=d.maxWidth;x>0?typeof c=="string"?c=this.splitTextToSize(c,x):Object.prototype.toString.call(c)==="[object Array]"&&(c=c.reduce(function(y,w){return y.concat(v.splitTextToSize(w,x))},[])):c=Array.isArray(c)?c:[c];for(var b=0;b<c.length;b++)f<(A=this.getStringUnitWidth(c[b],{font:h})*u)&&(f=A);return f!==0&&(p=c.length),{w:f/=m,h:Math.max((p*u*this.getLineHeightFactor()-u*(this.getLineHeightFactor()-1))/m,0)}},e.cellAddPage=function(){s.call(this),this.addPage();var c=this.internal.__cell__.margins||t;return this.internal.__cell__.lastCell=new i(c.left,c.top,void 0,void 0),this.internal.__cell__.pages+=1,this};var o=e.cell=function(){var c;c=arguments[0]instanceof i?arguments[0]:new i(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4],arguments[5],arguments[6]),s.call(this);var d=this.internal.__cell__.lastCell,u=this.internal.__cell__.padding,h=this.internal.__cell__.margins||t,m=this.internal.__cell__.tableHeaderRow,f=this.internal.__cell__.printHeaders;return d.lineNumber!==void 0&&(d.lineNumber===c.lineNumber?(c.x=(d.x||0)+(d.width||0),c.y=d.y||0):d.y+d.height+c.height+h.bottom>this.getPageHeight()?(this.cellAddPage(),c.y=h.top,f&&m&&(this.printHeaderRow(c.lineNumber,!0),c.y+=m[0].height)):c.y=d.y+d.height||c.y),c.text[0]!==void 0&&(this.rect(c.x,c.y,c.width,c.height,r===!0?"FD":void 0),c.align==="right"?this.text(c.text,c.x+c.width-u,c.y+u,{align:"right",baseline:"top"}):c.align==="center"?this.text(c.text,c.x+c.width/2,c.y+u,{align:"center",baseline:"top",maxWidth:c.width-u-u}):this.text(c.text,c.x+u,c.y+u,{align:"left",baseline:"top",maxWidth:c.width-u-u})),this.internal.__cell__.lastCell=c,this};e.table=function(c,d,u,h,m){if(s.call(this),!u)throw new Error("No data for PDF table.");var f,p,A,v,x=[],b=[],y=[],w={},j={},N=[],_=[],S=(m=m||{}).autoSize||!1,C=m.printHeaders!==!1,E=m.css&&m.css["font-size"]!==void 0?16*m.css["font-size"]:m.fontSize||12,T=m.margins||Object.assign({width:this.getPageWidth()},t),B=typeof m.padding=="number"?m.padding:3,L=m.headerBackgroundColor||"#c8c8c8",P=m.headerTextColor||"#000";if(a.call(this),this.internal.__cell__.printHeaders=C,this.internal.__cell__.margins=T,this.internal.__cell__.table_font_size=E,this.internal.__cell__.padding=B,this.internal.__cell__.headerBackgroundColor=L,this.internal.__cell__.headerTextColor=P,this.setFontSize(E),h==null)b=x=Object.keys(u[0]),y=x.map(function(){return"left"});else if(Array.isArray(h)&&On(h[0])==="object")for(x=h.map(function(R){return R.name}),b=h.map(function(R){return R.prompt||R.name||""}),y=h.map(function(R){return R.align||"left"}),f=0;f<h.length;f+=1)j[h[f].name]=.7499990551181103*h[f].width;else Array.isArray(h)&&typeof h[0]=="string"&&(b=x=h,y=x.map(function(){return"left"}));if(S||Array.isArray(h)&&typeof h[0]=="string")for(f=0;f<x.length;f+=1){for(w[v=x[f]]=u.map(function(R){return R[v]}),this.setFont(void 0,"bold"),N.push(this.getTextDimensions(b[f],{fontSize:this.internal.__cell__.table_font_size,scaleFactor:this.internal.scaleFactor}).w),p=w[v],this.setFont(void 0,"normal"),A=0;A<p.length;A+=1)N.push(this.getTextDimensions(p[A],{fontSize:this.internal.__cell__.table_font_size,scaleFactor:this.internal.scaleFactor}).w);j[v]=Math.max.apply(null,N)+B+B,N=[]}if(C){var F={};for(f=0;f<x.length;f+=1)F[x[f]]={},F[x[f]].text=b[f],F[x[f]].align=y[f];var M=l.call(this,F,j);_=x.map(function(R){return new i(c,d,j[R],M,F[R].text,void 0,F[R].align)}),this.setTableHeaderRow(_),this.printHeaderRow(1,!1)}var I=h.reduce(function(R,Q){return R[Q.name]=Q.align,R},{});for(f=0;f<u.length;f+=1){"rowStart"in m&&m.rowStart instanceof Function&&m.rowStart({row:f,data:u[f]},this);var $=l.call(this,u[f],j);for(A=0;A<x.length;A+=1){var V=u[f][x[A]];"cellStart"in m&&m.cellStart instanceof Function&&m.cellStart({row:f,col:A,data:V},this),o.call(this,new i(c,d,j[x[A]],$,V,f+2,I[x[A]]))}}return this.internal.__cell__.table_x=c,this.internal.__cell__.table_y=d,this};var l=function(c,d){var u=this.internal.__cell__.padding,h=this.internal.__cell__.table_font_size,m=this.internal.scaleFactor;return Object.keys(c).map(function(f){var p=c[f];return this.splitTextToSize(p.hasOwnProperty("text")?p.text:p,d[f]-u-u)},this).map(function(f){return this.getLineHeightFactor()*f.length*h/m+u+u},this).reduce(function(f,p){return Math.max(f,p)},0)};e.setTableHeaderRow=function(c){s.call(this),this.internal.__cell__.tableHeaderRow=c},e.printHeaderRow=function(c,d){if(s.call(this),!this.internal.__cell__.tableHeaderRow)throw new Error("Property tableHeaderRow does not exist.");var u;if(r=!0,typeof this.internal.__cell__.headerFunction=="function"){var h=this.internal.__cell__.headerFunction(this,this.internal.__cell__.pages);this.internal.__cell__.lastCell=new i(h[0],h[1],h[2],h[3],void 0,-1)}this.setFont(void 0,"bold");for(var m=[],f=0;f<this.internal.__cell__.tableHeaderRow.length;f+=1){u=this.internal.__cell__.tableHeaderRow[f].clone(),d&&(u.y=this.internal.__cell__.margins.top||0,m.push(u)),u.lineNumber=c;var p=this.getTextColor();this.setTextColor(this.internal.__cell__.headerTextColor),this.setFillColor(this.internal.__cell__.headerBackgroundColor),o.call(this,u),this.setTextColor(p)}m.length>0&&this.setTableHeaderRow(m),this.setFont(void 0,"normal"),r=!1}}(Wt.API);var eae={italic:["italic","oblique","normal"],oblique:["oblique","italic","normal"],normal:["normal","oblique","italic"]},tae=["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded"],kP=Zse(tae),rae=[100,200,300,400,500,600,700,800,900],nlt=Zse(rae);function s4(e){var t=e.family.replace(/"|'/g,"").toLowerCase(),r=function(i){return eae[i=i||"normal"]?i:"normal"}(e.style),s=function(i){return i?typeof i=="number"?i>=100&&i<=900&&i%100==0?i:400:/^\d00$/.test(i)?parseInt(i):i==="bold"?700:400:400}(e.weight),a=function(i){return typeof kP[i=i||"normal"]=="number"?i:"normal"}(e.stretch);return{family:t,style:r,weight:s,stretch:a,src:e.src||[],ref:e.ref||{name:t,style:[a,r,s].join(" ")}}}function az(e,t,r,s){var a;for(a=r;a>=0&&a<t.length;a+=s)if(e[t[a]])return e[t[a]];for(a=r;a>=0&&a<t.length;a-=s)if(e[t[a]])return e[t[a]]}var slt={"sans-serif":"helvetica",fixed:"courier",monospace:"courier",terminal:"courier",cursive:"times",fantasy:"times",serif:"times"},iz={caption:"times",icon:"times",menu:"times","message-box":"times","small-caption":"times","status-bar":"times"};function oz(e){return[e.stretch,e.style,e.weight,e.family].join(" ")}function lz(e){return e.trimLeft()}function alt(e,t){for(var r=0;r<e.length;){if(e.charAt(r)===t)return[e.substring(0,r),e.substring(r+1)];r+=1}return null}function ilt(e){var t=e.match(/^(-[a-z_]|[a-z_])[a-z0-9_-]*/i);return t===null?null:[t[0],e.substring(t[0].length)]}var Z1,cz,dz,Yp,ej,uz,hz,fz,a4=["times"];function mz(e,t,r,s,a){var i=4,o=Az;switch(a){case Wt.API.image_compression.FAST:i=1,o=pz;break;case Wt.API.image_compression.MEDIUM:i=6,o=gz;break;case Wt.API.image_compression.SLOW:i=9,o=xz}e=function(c,d,u,h){for(var m,f=c.length/d,p=new Uint8Array(c.length+f),A=[olt,pz,Az,gz,xz],v=0;v<f;v+=1){var x=v*d,b=c.subarray(x,x+d);if(h)p.set(h(b,u,m),x+v);else{for(var y=A.length,w=[],j=0;j<y;j+=1)w[j]=A[j](b,u,m);var N=clt(w.concat());p.set(w[N],x+v)}m=b}return p}(e,t,Math.ceil(r*s/8),o);var l=yP(e,{level:i});return Wt.API.__addimage__.arrayBufferToBinaryString(l)}function olt(e){var t=Array.apply([],e);return t.unshift(0),t}function pz(e,t){var r=e.length,s=[];s[0]=1;for(var a=0;a<r;a+=1){var i=e[a-t]||0;s[a+1]=e[a]-i+256&255}return s}function Az(e,t,r){var s=e.length,a=[];a[0]=2;for(var i=0;i<s;i+=1){var o=r&&r[i]||0;a[i+1]=e[i]-o+256&255}return a}function gz(e,t,r){var s=e.length,a=[];a[0]=3;for(var i=0;i<s;i+=1){var o=e[i-t]||0,l=r&&r[i]||0;a[i+1]=e[i]+256-(o+l>>>1)&255}return a}function xz(e,t,r){var s=e.length,a=[];a[0]=4;for(var i=0;i<s;i+=1){var o=llt(e[i-t]||0,r&&r[i]||0,r&&r[i-t]||0);a[i+1]=e[i]-o+256&255}return a}function llt(e,t,r){if(e===t&&t===r)return e;var s=Math.abs(t-r),a=Math.abs(e-r),i=Math.abs(e+t-r-r);return s<=a&&s<=i?e:a<=i?t:r}function clt(e){var t=e.map(function(r){return r.reduce(function(s,a){return s+Math.abs(a)},0)});return t.indexOf(Math.min.apply(null,t))}function i4(e,t,r){var s=t*r,a=Math.floor(s/8),i=16-(s-8*a+r),o=(1<<r)-1;return nae(e,a)>>i&o}function vz(e,t,r,s){var a=r*s,i=Math.floor(a/8),o=16-(a-8*i+s),l=(1<<s)-1,c=(t&l)<<o;(function(d,u,h){if(u+1<d.byteLength)d.setUint16(u,h,!1);else{var m=h>>8&255;d.setUint8(u,m)}})(e,i,nae(e,i)&~(l<<o)&65535|c)}function nae(e,t){return t+1<e.byteLength?e.getUint16(t,!1):e.getUint8(t)<<8}function dlt(e){var t=0;if(e[t++]!==71||e[t++]!==73||e[t++]!==70||e[t++]!==56||(e[t++]+1&253)!=56||e[t++]!==97)throw new Error("Invalid GIF 87a/89a header.");var r=e[t++]|e[t++]<<8,s=e[t++]|e[t++]<<8,a=e[t++],i=a>>7,o=1<<1+(7&a);e[t++],e[t++];var l=null,c=null;i&&(l=t,c=o,t+=3*o);var d=!0,u=[],h=0,m=null,f=0,p=null;for(this.width=r,this.height=s;d&&t<e.length;)switch(e[t++]){case 33:switch(e[t++]){case 255:if(e[t]!==11||e[t+1]==78&&e[t+2]==69&&e[t+3]==84&&e[t+4]==83&&e[t+5]==67&&e[t+6]==65&&e[t+7]==80&&e[t+8]==69&&e[t+9]==50&&e[t+10]==46&&e[t+11]==48&&e[t+12]==3&&e[t+13]==1&&e[t+16]==0)t+=14,p=e[t++]|e[t++]<<8,t++;else for(t+=12;;){if(!((T=e[t++])>=0))throw Error("Invalid block size");if(T===0)break;t+=T}break;case 249:if(e[t++]!==4||e[t+4]!==0)throw new Error("Invalid graphics extension block.");var A=e[t++];h=e[t++]|e[t++]<<8,m=e[t++],1&A||(m=null),f=A>>2&7,t++;break;case 254:for(;;){if(!((T=e[t++])>=0))throw Error("Invalid block size");if(T===0)break;t+=T}break;default:throw new Error("Unknown graphic control label: 0x"+e[t-1].toString(16))}break;case 44:var v=e[t++]|e[t++]<<8,x=e[t++]|e[t++]<<8,b=e[t++]|e[t++]<<8,y=e[t++]|e[t++]<<8,w=e[t++],j=w>>6&1,N=1<<1+(7&w),_=l,S=c,C=!1;w>>7&&(C=!0,_=t,S=N,t+=3*N);var E=t;for(t++;;){var T;if(!((T=e[t++])>=0))throw Error("Invalid block size");if(T===0)break;t+=T}u.push({x:v,y:x,width:b,height:y,has_local_palette:C,palette_offset:_,palette_size:S,data_offset:E,data_length:t-E,transparent_index:m,interlaced:!!j,delay:h,disposal:f});break;case 59:d=!1;break;default:throw new Error("Unknown gif block: 0x"+e[t-1].toString(16))}this.numFrames=function(){return u.length},this.loopCount=function(){return p},this.frameInfo=function(B){if(B<0||B>=u.length)throw new Error("Frame index out of range.");return u[B]},this.decodeAndBlitFrameBGRA=function(B,L){var P=this.frameInfo(B),F=P.width*P.height,M=new Uint8Array(F);bz(e,P.data_offset,M,F);var I=P.palette_offset,$=P.transparent_index;$===null&&($=256);var V=P.width,R=r-V,Q=V,U=4*(P.y*r+P.x),D=4*((P.y+P.height)*r+P.x),q=U,G=4*R;P.interlaced===!0&&(G+=4*r*7);for(var Y=8,K=0,X=M.length;K<X;++K){var ne=M[K];if(Q===0&&(Q=V,(q+=G)>=D&&(G=4*R+4*r*(Y-1),q=U+(V+R)*(Y<<1),Y>>=1)),ne===$)q+=4;else{var ae=e[I+3*ne],J=e[I+3*ne+1],W=e[I+3*ne+2];L[q++]=W,L[q++]=J,L[q++]=ae,L[q++]=255}--Q}},this.decodeAndBlitFrameRGBA=function(B,L){var P=this.frameInfo(B),F=P.width*P.height,M=new Uint8Array(F);bz(e,P.data_offset,M,F);var I=P.palette_offset,$=P.transparent_index;$===null&&($=256);var V=P.width,R=r-V,Q=V,U=4*(P.y*r+P.x),D=4*((P.y+P.height)*r+P.x),q=U,G=4*R;P.interlaced===!0&&(G+=4*r*7);for(var Y=8,K=0,X=M.length;K<X;++K){var ne=M[K];if(Q===0&&(Q=V,(q+=G)>=D&&(G=4*R+4*r*(Y-1),q=U+(V+R)*(Y<<1),Y>>=1)),ne===$)q+=4;else{var ae=e[I+3*ne],J=e[I+3*ne+1],W=e[I+3*ne+2];L[q++]=ae,L[q++]=J,L[q++]=W,L[q++]=255}--Q}}}function bz(e,t,r,s){for(var a=e[t++],i=1<<a,o=i+1,l=o+1,c=a+1,d=(1<<c)-1,u=0,h=0,m=0,f=e[t++],p=new Int32Array(4096),A=null;;){for(;u<16&&f!==0;)h|=e[t++]<<u,u+=8,f===1?f=e[t++]:--f;if(u<c)break;var v=h&d;if(h>>=c,u-=c,v!==i){if(v===o)break;for(var x=v<l?v:A,b=0,y=x;y>i;)y=p[y]>>8,++b;var w=y;if(m+b+(x!==v?1:0)>s)return void zn.log("Warning, gif stream longer than expected.");r[m++]=w;var j=m+=b;for(x!==v&&(r[m++]=w),y=x;b--;)y=p[y],r[--j]=255&y,y>>=8;A!==null&&l<4096&&(p[l++]=A<<8|w,l>=d+1&&c<12&&(++c,d=d<<1|1)),A=v}else l=o+1,d=(1<<(c=a+1))-1,A=null}return m!==s&&zn.log("Warning, gif stream shorter than expected."),r}/**
1545 * @license
1546  Copyright (c) 2008, Adobe Systems Incorporated
1547  All rights reserved.
1548
1549  Redistribution and use in source and binary forms, with or without 
1550  modification, are permitted provided that the following conditions are
1551  met:
1552
1553  * Redistributions of source code must retain the above copyright notice, 
1554    this list of conditions and the following disclaimer.
1555  
1556  * Redistributions in binary form must reproduce the above copyright
1557    notice, this list of conditions and the following disclaimer in the 
1558    documentation and/or other materials provided with the distribution.
1559  
1560  * Neither the name of Adobe Systems Incorporated nor the names of its 
1561    contributors may be used to endorse or promote products derived from 
1562    this software without specific prior written permission.
1563
1564  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
1565  IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
1566  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
1567  PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
1568  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
1569  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
1570  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
1571  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
1572  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
1573  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
1574  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1575*/function o4(e){var t,r,s,a,i,o=Math.floor,l=new Array(64),c=new Array(64),d=new Array(64),u=new Array(64),h=new Array(65535),m=new Array(65535),f=new Array(64),p=new Array(64),A=[],v=0,x=7,b=new Array(64),y=new Array(64),w=new Array(64),j=new Array(256),N=new Array(2048),_=[0,1,5,6,14,15,27,28,2,4,7,13,16,26,29,42,3,8,12,17,25,30,41,43,9,11,18,24,31,40,44,53,10,19,23,32,39,45,52,54,20,22,33,38,46,51,55,60,21,34,37,47,50,56,59,61,35,36,48,49,57,58,62,63],S=[0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0],C=[0,1,2,3,4,5,6,7,8,9,10,11],E=[0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125],T=[1,2,3,0,4,17,5,18,33,49,65,6,19,81,97,7,34,113,20,50,129,145,161,8,35,66,177,193,21,82,209,240,36,51,98,114,130,9,10,22,23,24,25,26,37,38,39,40,41,42,52,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,225,226,227,228,229,230,231,232,233,234,241,242,243,244,245,246,247,248,249,250],B=[0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0],L=[0,1,2,3,4,5,6,7,8,9,10,11],P=[0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119],F=[0,1,2,3,17,4,5,33,49,6,18,65,81,7,97,113,19,34,50,129,8,20,66,145,161,177,193,9,35,51,82,240,21,98,114,209,10,22,36,52,225,37,241,23,24,25,26,38,39,40,41,42,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,130,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,226,227,228,229,230,231,232,233,234,242,243,244,245,246,247,248,249,250];function M(U,D){for(var q=0,G=0,Y=new Array,K=1;K<=16;K++){for(var X=1;X<=U[K];X++)Y[D[G]]=[],Y[D[G]][0]=q,Y[D[G]][1]=K,G++,q++;q*=2}return Y}function I(U){for(var D=U[0],q=U[1]-1;q>=0;)D&1<<q&&(v|=1<<x),q--,--x<0&&(v==255?($(255),$(0)):$(v),x=7,v=0)}function $(U){A.push(U)}function V(U){$(U>>8&255),$(255&U)}function R(U,D,q,G,Y){for(var K,X=Y[0],ne=Y[240],ae=function(pe,Ce){var re,se,Ae,Pe,Oe,be,ue,Ee,De,Ge,Ye=0;for(De=0;De<8;++De){re=pe[Ye],se=pe[Ye+1],Ae=pe[Ye+2],Pe=pe[Ye+3],Oe=pe[Ye+4],be=pe[Ye+5],ue=pe[Ye+6];var Tt=re+(Ee=pe[Ye+7]),Nt=re-Ee,Pt=se+ue,_t=se-ue,zt=Ae+be,vt=Ae-be,vr=Pe+Oe,Rt=Pe-Oe,rr=Tt+vr,an=Tt-vr,It=Pt+zt,ht=Pt-zt;pe[Ye]=rr+It,pe[Ye+4]=rr-It;var ar=.707106781*(ht+an);pe[Ye+2]=an+ar,pe[Ye+6]=an-ar;var tt=.382683433*((rr=Rt+vt)-(ht=_t+Nt)),it=.5411961*rr+tt,gt=1.306562965*ht+tt,pr=.707106781*(It=vt+_t),xt=Nt+pr,Lr=Nt-pr;pe[Ye+5]=Lr+it,pe[Ye+3]=Lr-it,pe[Ye+1]=xt+gt,pe[Ye+7]=xt-gt,Ye+=8}for(Ye=0,De=0;De<8;++De){re=pe[Ye],se=pe[Ye+8],Ae=pe[Ye+16],Pe=pe[Ye+24],Oe=pe[Ye+32],be=pe[Ye+40],ue=pe[Ye+48];var En=re+(Ee=pe[Ye+56]),qr=re-Ee,pn=se+ue,Ln=se-ue,As=Ae+be,Yn=Ae-be,jo=Pe+Oe,ul=Pe-Oe,Wl=En+jo,Lc=En-jo,Yl=pn+As,Jl=pn-As;pe[Ye]=Wl+Yl,pe[Ye+32]=Wl-Yl;var hl=.707106781*(Jl+Lc);pe[Ye+16]=Lc+hl,pe[Ye+48]=Lc-hl;var Af=.382683433*((Wl=ul+Yn)-(Jl=Ln+qr)),Dc=.5411961*Wl+Af,gf=1.306562965*Jl+Af,fp=.707106781*(Yl=Yn+Ln),mp=qr+fp,pp=qr-fp;pe[Ye+40]=pp+Dc,pe[Ye+24]=pp-Dc,pe[Ye+8]=mp+gf,pe[Ye+56]=mp-gf,Ye++}for(De=0;De<64;++De)Ge=pe[De]*Ce[De],f[De]=Ge>0?Ge+.5|0:Ge-.5|0;return f}(U,D),J=0;J<64;++J)p[_[J]]=ae[J];var W=p[0]-q;q=p[0],W==0?I(G[0]):(I(G[m[K=32767+W]]),I(h[K]));for(var ie=63;ie>0&&p[ie]==0;)ie--;if(ie==0)return I(X),q;for(var he,ee=1;ee<=ie;){for(var xe=ee;p[ee]==0&&ee<=ie;)++ee;var we=ee-xe;if(we>=16){he=we>>4;for(var Se=1;Se<=he;++Se)I(ne);we&=15}K=32767+p[ee],I(Y[(we<<4)+m[K]]),I(h[K]),ee++}return ie!=63&&I(X),q}function Q(U){U=Math.min(Math.max(U,1),100),i!=U&&(function(D){for(var q=[16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22,37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99],G=0;G<64;G++){var Y=o((q[G]*D+50)/100);Y=Math.min(Math.max(Y,1),255),l[_[G]]=Y}for(var K=[17,18,24,47,99,99,99,99,18,21,26,66,99,99,99,99,24,26,56,99,99,99,99,99,47,66,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99],X=0;X<64;X++){var ne=o((K[X]*D+50)/100);ne=Math.min(Math.max(ne,1),255),c[_[X]]=ne}for(var ae=[1,1.387039845,1.306562965,1.175875602,1,.785694958,.5411961,.275899379],J=0,W=0;W<8;W++)for(var ie=0;ie<8;ie++)d[J]=1/(l[_[J]]*ae[W]*ae[ie]*8),u[J]=1/(c[_[J]]*ae[W]*ae[ie]*8),J++}(U<50?Math.floor(5e3/U):Math.floor(200-2*U)),i=U)}this.encode=function(U,D){D&&Q(D),A=new Array,v=0,x=7,V(65496),V(65504),V(16),$(74),$(70),$(73),$(70),$(0),$(1),$(1),$(0),V(1),V(1),$(0),$(0),function(){V(65499),V(132),$(0);for(var se=0;se<64;se++)$(l[se]);$(1);for(var Ae=0;Ae<64;Ae++)$(c[Ae])}(),function(se,Ae){V(65472),V(17),$(8),V(Ae),V(se),$(3),$(1),$(17),$(0),$(2),$(17),$(1),$(3),$(17),$(1)}(U.width,U.height),function(){V(65476),V(418),$(0);for(var se=0;se<16;se++)$(S[se+1]);for(var Ae=0;Ae<=11;Ae++)$(C[Ae]);$(16);for(var Pe=0;Pe<16;Pe++)$(E[Pe+1]);for(var Oe=0;Oe<=161;Oe++)$(T[Oe]);$(1);for(var be=0;be<16;be++)$(B[be+1]);for(var ue=0;ue<=11;ue++)$(L[ue]);$(17);for(var Ee=0;Ee<16;Ee++)$(P[Ee+1]);for(var De=0;De<=161;De++)$(F[De])}(),V(65498),V(12),$(3),$(1),$(0),$(2),$(17),$(3),$(17),$(0),$(63),$(0);var q=0,G=0,Y=0;v=0,x=7,this.encode.displayName="_encode_";for(var K,X,ne,ae,J,W,ie,he,ee,xe=U.data,we=U.width,Se=U.height,pe=4*we,Ce=0;Ce<Se;){for(K=0;K<pe;){for(J=pe*Ce+K,ie=-1,he=0,ee=0;ee<64;ee++)W=J+(he=ee>>3)*pe+(ie=4*(7&ee)),Ce+he>=Se&&(W-=pe*(Ce+1+he-Se)),K+ie>=pe&&(W-=K+ie-pe+4),X=xe[W++],ne=xe[W++],ae=xe[W++],b[ee]=(N[X]+N[ne+256|0]+N[ae+512|0]>>16)-128,y[ee]=(N[X+768|0]+N[ne+1024|0]+N[ae+1280|0]>>16)-128,w[ee]=(N[X+1280|0]+N[ne+1536|0]+N[ae+1792|0]>>16)-128;q=R(b,d,q,t,s),G=R(y,u,G,r,a),Y=R(w,u,Y,r,a),K+=32}Ce+=8}if(x>=0){var re=[];re[1]=x+1,re[0]=(1<<x+1)-1,I(re)}return V(65497),new Uint8Array(A)},e=e||50,function(){for(var U=String.fromCharCode,D=0;D<256;D++)j[D]=U(D)}(),t=M(S,C),r=M(B,L),s=M(E,T),a=M(P,F),function(){for(var U=1,D=2,q=1;q<=15;q++){for(var G=U;G<D;G++)m[32767+G]=q,h[32767+G]=[],h[32767+G][1]=q,h[32767+G][0]=G;for(var Y=-(D-1);Y<=-U;Y++)m[32767+Y]=q,h[32767+Y]=[],h[32767+Y][1]=q,h[32767+Y][0]=D-1+Y;U<<=1,D<<=1}}(),function(){for(var U=0;U<256;U++)N[U]=19595*U,N[U+256|0]=38470*U,N[U+512|0]=7471*U+32768,N[U+768|0]=-11059*U,N[U+1024|0]=-21709*U,N[U+1280|0]=32768*U+8421375,N[U+1536|0]=-27439*U,N[U+1792|0]=-5329*U}(),Q(e)}/**
1576 * @license
1577 * Copyright (c) 2017 Aras Abbasi
1578 *
1579 * Licensed under the MIT License.
1580 * http://opensource.org/licenses/mit-license
1581 */function sc(e,t){if(this.pos=0,this.buffer=e,this.datav=new DataView(e.buffer),this.is_with_alpha=!!t,this.bottom_up=!0,this.flag=String.fromCharCode(this.buffer[0])+String.fromCharCode(this.buffer[1]),this.pos+=2,["BM","BA","CI","CP","IC","PT"].indexOf(this.flag)===-1)throw new Error("Invalid BMP File");this.parseHeader(),this.parseBGR()}function yz(e){function t(C){if(!C)throw Error("assert :P")}function r(C,E,T){for(var B=0;4>B;B++)if(C[E+B]!=T.charCodeAt(B))return!0;return!1}function s(C,E,T,B,L){for(var P=0;P<L;P++)C[E+P]=T[B+P]}function a(C,E,T,B){for(var L=0;L<B;L++)C[E+L]=T}function i(C){return new Int32Array(C)}function o(C,E){for(var T=[],B=0;B<C;B++)T.push(new E);return T}function l(C,E){var T=[];return function B(L,P,F){for(var M=F[P],I=0;I<M&&(L.push(F.length>P+1?[]:new E),!(F.length<P+1));I++)B(L[I],P+1,F)}(T,0,C),T}var c=function(){var C=this;function E(k,O){for(var z=1<<O-1>>>0;k&z;)z>>>=1;return z?(k&z-1)+z:k}function T(k,O,z,Z,ce){t(!(Z%z));do k[O+(Z-=z)]=ce;while(0<Z)}function B(k,O,z,Z,ce){if(t(2328>=ce),512>=ce)var fe=i(512);else if((fe=i(ce))==null)return 0;return function(me,ge,ve,je,Ie,Ve){var Ne,Le,Me=ge,Ke=1<<ve,Qe=i(16),Xe=i(16);for(t(Ie!=0),t(je!=null),t(me!=null),t(0<ve),Le=0;Le<Ie;++Le){if(15<je[Le])return 0;++Qe[je[Le]]}if(Qe[0]==Ie)return 0;for(Xe[1]=0,Ne=1;15>Ne;++Ne){if(Qe[Ne]>1<<Ne)return 0;Xe[Ne+1]=Xe[Ne]+Qe[Ne]}for(Le=0;Le<Ie;++Le)Ne=je[Le],0<je[Le]&&(Ve[Xe[Ne]++]=Le);if(Xe[15]==1)return(je=new L).g=0,je.value=Ve[0],T(me,Me,1,Ke,je),Ke;var et,at=-1,nt=Ke-1,Kt=0,Ot=1,Dr=1,Qt=1<<ve;for(Le=0,Ne=1,Ie=2;Ne<=ve;++Ne,Ie<<=1){if(Ot+=Dr<<=1,0>(Dr-=Qe[Ne]))return 0;for(;0<Qe[Ne];--Qe[Ne])(je=new L).g=Ne,je.value=Ve[Le++],T(me,Me+Kt,Ie,Qt,je),Kt=E(Kt,Ne)}for(Ne=ve+1,Ie=2;15>=Ne;++Ne,Ie<<=1){if(Ot+=Dr<<=1,0>(Dr-=Qe[Ne]))return 0;for(;0<Qe[Ne];--Qe[Ne]){if(je=new L,(Kt&nt)!=at){for(Me+=Qt,et=1<<(at=Ne)-ve;15>at&&!(0>=(et-=Qe[at]));)++at,et<<=1;Ke+=Qt=1<<(et=at-ve),me[ge+(at=Kt&nt)].g=et+ve,me[ge+at].value=Me-ge-at}je.g=Ne-ve,je.value=Ve[Le++],T(me,Me+(Kt>>ve),Ie,Qt,je),Kt=E(Kt,Ne)}}return Ot!=2*Xe[15]-1?0:Ke}(k,O,z,Z,ce,fe)}function L(){this.value=this.g=0}function P(){this.value=this.g=0}function F(){this.G=o(5,L),this.H=i(5),this.jc=this.Qb=this.qb=this.nd=0,this.pd=o(kf,P)}function M(k,O,z,Z){t(k!=null),t(O!=null),t(2147483648>Z),k.Ca=254,k.I=0,k.b=-8,k.Ka=0,k.oa=O,k.pa=z,k.Jd=O,k.Yc=z+Z,k.Zc=4<=Z?z+Z-4+1:z,X(k)}function I(k,O){for(var z=0;0<O--;)z|=ae(k,128)<<O;return z}function $(k,O){var z=I(k,O);return ne(k)?-z:z}function V(k,O,z,Z){var ce,fe=0;for(t(k!=null),t(O!=null),t(4294967288>Z),k.Sb=Z,k.Ra=0,k.u=0,k.h=0,4<Z&&(Z=4),ce=0;ce<Z;++ce)fe+=O[z+ce]<<8*ce;k.Ra=fe,k.bb=Z,k.oa=O,k.pa=z}function R(k){for(;8<=k.u&&k.bb<k.Sb;)k.Ra>>>=8,k.Ra+=k.oa[k.pa+k.bb]<<Vu-8>>>0,++k.bb,k.u-=8;G(k)&&(k.h=1,k.u=0)}function Q(k,O){if(t(0<=O),!k.h&&O<=_o){var z=q(k)&No[O];return k.u+=O,R(k),z}return k.h=1,k.u=0}function U(){this.b=this.Ca=this.I=0,this.oa=[],this.pa=0,this.Jd=[],this.Yc=0,this.Zc=[],this.Ka=0}function D(){this.Ra=0,this.oa=[],this.h=this.u=this.bb=this.Sb=this.pa=0}function q(k){return k.Ra>>>(k.u&Vu-1)>>>0}function G(k){return t(k.bb<=k.Sb),k.h||k.bb==k.Sb&&k.u>Vu}function Y(k,O){k.u=O,k.h=G(k)}function K(k){k.u>=Md&&(t(k.u>=Md),R(k))}function X(k){t(k!=null&&k.oa!=null),k.pa<k.Zc?(k.I=(k.oa[k.pa++]|k.I<<8)>>>0,k.b+=8):(t(k!=null&&k.oa!=null),k.pa<k.Yc?(k.b+=8,k.I=k.oa[k.pa++]|k.I<<8):k.Ka?k.b=0:(k.I<<=8,k.b+=8,k.Ka=1))}function ne(k){return I(k,1)}function ae(k,O){var z=k.Ca;0>k.b&&X(k);var Z=k.b,ce=z*O>>>8,fe=(k.I>>>Z>ce)+0;for(fe?(z-=ce,k.I-=ce+1<<Z>>>0):z=ce+1,Z=z,ce=0;256<=Z;)ce+=8,Z>>=8;return Z=7^ce+Gu[Z],k.b-=Z,k.Ca=(z<<Z)-1,fe}function J(k,O,z){k[O+0]=z>>24&255,k[O+1]=z>>16&255,k[O+2]=z>>8&255,k[O+3]=255&z}function W(k,O){return k[O+0]|k[O+1]<<8}function ie(k,O){return W(k,O)|k[O+2]<<16}function he(k,O){return W(k,O)|W(k,O+2)<<16}function ee(k,O){var z=1<<O;return t(k!=null),t(0<O),k.X=i(z),k.X==null?0:(k.Mb=32-O,k.Xa=O,1)}function xe(k,O){t(k!=null),t(O!=null),t(k.Xa==O.Xa),s(O.X,0,k.X,0,1<<O.Xa)}function we(){this.X=[],this.Xa=this.Mb=0}function Se(k,O,z,Z){t(z!=null),t(Z!=null);var ce=z[0],fe=Z[0];return ce==0&&(ce=(k*fe+O/2)/O),fe==0&&(fe=(O*ce+k/2)/k),0>=ce||0>=fe?0:(z[0]=ce,Z[0]=fe,1)}function pe(k,O){return k+(1<<O)-1>>>O}function Ce(k,O){return((4278255360&k)+(4278255360&O)>>>0&4278255360)+((16711935&k)+(16711935&O)>>>0&16711935)>>>0}function re(k,O){C[O]=function(z,Z,ce,fe,me,ge,ve){var je;for(je=0;je<me;++je){var Ie=C[k](ge[ve+je-1],ce,fe+je);ge[ve+je]=Ce(z[Z+je],Ie)}}}function se(){this.ud=this.hd=this.jd=0}function Ae(k,O){return((4278124286&(k^O))>>>1)+(k&O)>>>0}function Pe(k){return 0<=k&&256>k?k:0>k?0:255<k?255:void 0}function Oe(k,O){return Pe(k+(k-O+.5>>1))}function be(k,O,z){return Math.abs(O-z)-Math.abs(k-z)}function ue(k,O,z,Z,ce,fe,me){for(Z=fe[me-1],z=0;z<ce;++z)fe[me+z]=Z=Ce(k[O+z],Z)}function Ee(k,O,z,Z,ce){var fe;for(fe=0;fe<z;++fe){var me=k[O+fe],ge=me>>8&255,ve=16711935&(ve=(ve=16711935&me)+((ge<<16)+ge));Z[ce+fe]=(4278255360&me)+ve>>>0}}function De(k,O){O.jd=255&k,O.hd=k>>8&255,O.ud=k>>16&255}function Ge(k,O,z,Z,ce,fe){var me;for(me=0;me<Z;++me){var ge=O[z+me],ve=ge>>>8,je=ge,Ie=255&(Ie=(Ie=ge>>>16)+((k.jd<<24>>24)*(ve<<24>>24)>>>5));je=255&(je=(je+=(k.hd<<24>>24)*(ve<<24>>24)>>>5)+((k.ud<<24>>24)*(Ie<<24>>24)>>>5)),ce[fe+me]=(4278255360&ge)+(Ie<<16)+je}}function Ye(k,O,z,Z,ce){C[O]=function(fe,me,ge,ve,je,Ie,Ve,Ne,Le){for(ve=Ve;ve<Ne;++ve)for(Ve=0;Ve<Le;++Ve)je[Ie++]=ce(ge[Z(fe[me++])])},C[k]=function(fe,me,ge,ve,je,Ie,Ve){var Ne=8>>fe.b,Le=fe.Ea,Me=fe.K[0],Ke=fe.w;if(8>Ne)for(fe=(1<<fe.b)-1,Ke=(1<<Ne)-1;me<ge;++me){var Qe,Xe=0;for(Qe=0;Qe<Le;++Qe)Qe&fe||(Xe=Z(ve[je++])),Ie[Ve++]=ce(Me[Xe&Ke]),Xe>>=Ne}else C["VP8LMapColor"+z](ve,je,Me,Ke,Ie,Ve,me,ge,Le)}}function Tt(k,O,z,Z,ce){for(z=O+z;O<z;){var fe=k[O++];Z[ce++]=fe>>16&255,Z[ce++]=fe>>8&255,Z[ce++]=255&fe}}function Nt(k,O,z,Z,ce){for(z=O+z;O<z;){var fe=k[O++];Z[ce++]=fe>>16&255,Z[ce++]=fe>>8&255,Z[ce++]=255&fe,Z[ce++]=fe>>24&255}}function Pt(k,O,z,Z,ce){for(z=O+z;O<z;){var fe=(me=k[O++])>>16&240|me>>12&15,me=240&me|me>>28&15;Z[ce++]=fe,Z[ce++]=me}}function _t(k,O,z,Z,ce){for(z=O+z;O<z;){var fe=(me=k[O++])>>16&248|me>>13&7,me=me>>5&224|me>>3&31;Z[ce++]=fe,Z[ce++]=me}}function zt(k,O,z,Z,ce){for(z=O+z;O<z;){var fe=k[O++];Z[ce++]=255&fe,Z[ce++]=fe>>8&255,Z[ce++]=fe>>16&255}}function vt(k,O,z,Z,ce,fe){if(fe==0)for(z=O+z;O<z;)J(Z,((fe=k[O++])[0]>>24|fe[1]>>8&65280|fe[2]<<8&16711680|fe[3]<<24)>>>0),ce+=32;else s(Z,ce,k,O,z)}function vr(k,O){C[O][0]=C[k+"0"],C[O][1]=C[k+"1"],C[O][2]=C[k+"2"],C[O][3]=C[k+"3"],C[O][4]=C[k+"4"],C[O][5]=C[k+"5"],C[O][6]=C[k+"6"],C[O][7]=C[k+"7"],C[O][8]=C[k+"8"],C[O][9]=C[k+"9"],C[O][10]=C[k+"10"],C[O][11]=C[k+"11"],C[O][12]=C[k+"12"],C[O][13]=C[k+"13"],C[O][14]=C[k+"0"],C[O][15]=C[k+"0"]}function Rt(k){return k==Kk||k==Wk||k==Iw||k==Yk}function rr(){this.eb=[],this.size=this.A=this.fb=0}function an(){this.y=[],this.f=[],this.ea=[],this.F=[],this.Tc=this.Ed=this.Cd=this.Fd=this.lb=this.Db=this.Ab=this.fa=this.J=this.W=this.N=this.O=0}function It(){this.Rd=this.height=this.width=this.S=0,this.f={},this.f.RGBA=new rr,this.f.kb=new an,this.sd=null}function ht(){this.width=[0],this.height=[0],this.Pd=[0],this.Qd=[0],this.format=[0]}function ar(){this.Id=this.fd=this.Md=this.hb=this.ib=this.da=this.bd=this.cd=this.j=this.v=this.Da=this.Sd=this.ob=0}function tt(k){return alert("todo:WebPSamplerProcessPlane"),k.T}function it(k,O){var z=k.T,Z=O.ba.f.RGBA,ce=Z.eb,fe=Z.fb+k.ka*Z.A,me=xl[O.ba.S],ge=k.y,ve=k.O,je=k.f,Ie=k.N,Ve=k.ea,Ne=k.W,Le=O.cc,Me=O.dc,Ke=O.Mc,Qe=O.Nc,Xe=k.ka,et=k.ka+k.T,at=k.U,nt=at+1>>1;for(Xe==0?me(ge,ve,null,null,je,Ie,Ve,Ne,je,Ie,Ve,Ne,ce,fe,null,null,at):(me(O.ec,O.fc,ge,ve,Le,Me,Ke,Qe,je,Ie,Ve,Ne,ce,fe-Z.A,ce,fe,at),++z);Xe+2<et;Xe+=2)Le=je,Me=Ie,Ke=Ve,Qe=Ne,Ie+=k.Rc,Ne+=k.Rc,fe+=2*Z.A,me(ge,(ve+=2*k.fa)-k.fa,ge,ve,Le,Me,Ke,Qe,je,Ie,Ve,Ne,ce,fe-Z.A,ce,fe,at);return ve+=k.fa,k.j+et<k.o?(s(O.ec,O.fc,ge,ve,at),s(O.cc,O.dc,je,Ie,nt),s(O.Mc,O.Nc,Ve,Ne,nt),z--):1&et||me(ge,ve,null,null,je,Ie,Ve,Ne,je,Ie,Ve,Ne,ce,fe+Z.A,null,null,at),z}function gt(k,O,z){var Z=k.F,ce=[k.J];if(Z!=null){var fe=k.U,me=O.ba.S,ge=me==Pw||me==Iw;O=O.ba.f.RGBA;var ve=[0],je=k.ka;ve[0]=k.T,k.Kb&&(je==0?--ve[0]:(--je,ce[0]-=k.width),k.j+k.ka+k.T==k.o&&(ve[0]=k.o-k.j-je));var Ie=O.eb;je=O.fb+je*O.A,k=tD(Z,ce[0],k.width,fe,ve,Ie,je+(ge?0:3),O.A),t(z==ve),k&&Rt(me)&&nx(Ie,je,ge,fe,ve,O.A)}return 0}function pr(k){var O=k.ma,z=O.ba.S,Z=11>z,ce=z==Bw||z==Tw||z==Pw||z==qk||z==12||Rt(z);if(O.memory=null,O.Ib=null,O.Jb=null,O.Nd=null,!W0(O.Oa,k,ce?11:12))return 0;if(ce&&Rt(z)&&G0(),k.da)alert("todo:use_scaling");else{if(Z){if(O.Ib=tt,k.Kb){if(z=k.U+1>>1,O.memory=i(k.U+2*z),O.memory==null)return 0;O.ec=O.memory,O.fc=0,O.cc=O.ec,O.dc=O.fc+k.U,O.Mc=O.cc,O.Nc=O.dc+z,O.Ib=it,G0()}}else alert("todo:EmitYUV");ce&&(O.Jb=gt,Z&&Zl())}if(Z&&!gD){for(k=0;256>k;++k)Ade[k]=89858*(k-128)+Fw>>Ow,vde[k]=-22014*(k-128)+Fw,xde[k]=-45773*(k-128),gde[k]=113618*(k-128)+Fw>>Ow;for(k=ax;k<Zk;++k)O=76283*(k-16)+Fw>>Ow,bde[k-ax]=Rc(O,255),yde[k-ax]=Rc(O+8>>4,15);gD=1}return 1}function xt(k){var O=k.ma,z=k.U,Z=k.T;return t(!(1&k.ka)),0>=z||0>=Z?0:(z=O.Ib(k,O),O.Jb!=null&&O.Jb(k,O,z),O.Dc+=z,1)}function Lr(k){k.ma.memory=null}function En(k,O,z,Z){return Q(k,8)!=47?0:(O[0]=Q(k,14)+1,z[0]=Q(k,14)+1,Z[0]=Q(k,1),Q(k,3)!=0?0:!k.h)}function qr(k,O){if(4>k)return k+1;var z=k-2>>1;return(2+(1&k)<<z)+Q(O,z)+1}function pn(k,O){return 120<O?O-120:1<=(z=((z=rde[O-1])>>4)*k+(8-(15&z)))?z:1;var z}function Ln(k,O,z){var Z=q(z),ce=k[O+=255&Z].g-8;return 0<ce&&(Y(z,z.u+8),Z=q(z),O+=k[O].value,O+=Z&(1<<ce)-1),Y(z,z.u+k[O].g),k[O].value}function As(k,O,z){return z.g+=k.g,z.value+=k.value<<O>>>0,t(8>=z.g),k.g}function Yn(k,O,z){var Z=k.xc;return t((O=Z==0?0:k.vc[k.md*(z>>Z)+(O>>Z)])<k.Wb),k.Ya[O]}function jo(k,O,z,Z){var ce=k.ab,fe=k.c*O,me=k.C;O=me+O;var ge=z,ve=Z;for(Z=k.Ta,z=k.Ua;0<ce--;){var je=k.gc[ce],Ie=me,Ve=O,Ne=ge,Le=ve,Me=(ve=Z,ge=z,je.Ea);switch(t(Ie<Ve),t(Ve<=je.nc),je.hc){case 2:qs(Ne,Le,(Ve-Ie)*Me,ve,ge);break;case 0:var Ke=Ie,Qe=Ve,Xe=ve,et=ge,at=(Qt=je).Ea;Ke==0&&(J0(Ne,Le,null,null,1,Xe,et),ue(Ne,Le+1,0,0,at-1,Xe,et+1),Le+=at,et+=at,++Ke);for(var nt=1<<Qt.b,Kt=nt-1,Ot=pe(at,Qt.b),Dr=Qt.K,Qt=Qt.w+(Ke>>Qt.b)*Ot;Ke<Qe;){var tn=Dr,Ca=Qt,Rr=1;for(jp(Ne,Le,Xe,et-at,1,Xe,et);Rr<at;){var Ht=(Rr&~Kt)+nt;Ht>at&&(Ht=at),(0,Z0[tn[Ca++]>>8&15])(Ne,Le+ +Rr,Xe,et+Rr-at,Ht-Rr,Xe,et+Rr),Rr=Ht}Le+=at,et+=at,++Ke&Kt||(Qt+=Ot)}Ve!=je.nc&&s(ve,ge-Me,ve,ge+(Ve-Ie-1)*Me,Me);break;case 1:for(Me=Ne,Qe=Le,at=(Ne=je.Ea)-(et=Ne&~(Xe=(Le=1<<je.b)-1)),Ke=pe(Ne,je.b),nt=je.K,je=je.w+(Ie>>je.b)*Ke;Ie<Ve;){for(Kt=nt,Ot=je,Dr=new se,Qt=Qe+et,tn=Qe+Ne;Qe<Qt;)De(Kt[Ot++],Dr),ex(Dr,Me,Qe,Le,ve,ge),Qe+=Le,ge+=Le;Qe<tn&&(De(Kt[Ot++],Dr),ex(Dr,Me,Qe,at,ve,ge),Qe+=at,ge+=at),++Ie&Xe||(je+=Ke)}break;case 3:if(Ne==ve&&Le==ge&&0<je.b){for(Qe=ve,Ne=Me=ge+(Ve-Ie)*Me-(et=(Ve-Ie)*pe(je.Ea,je.b)),Le=ve,Xe=ge,Ke=[],et=(at=et)-1;0<=et;--et)Ke[et]=Le[Xe+et];for(et=at-1;0<=et;--et)Qe[Ne+et]=Ke[et];Cw(je,Ie,Ve,ve,Me,ve,ge)}else Cw(je,Ie,Ve,Ne,Le,ve,ge)}ge=Z,ve=z}ve!=z&&s(Z,z,ge,ve,fe)}function ul(k,O){var z=k.V,Z=k.Ba+k.c*k.C,ce=O-k.C;if(t(O<=k.l.o),t(16>=ce),0<ce){var fe=k.l,me=k.Ta,ge=k.Ua,ve=fe.width;if(jo(k,ce,z,Z),ce=ge=[ge],t((z=k.C)<(Z=O)),t(fe.v<fe.va),Z>fe.o&&(Z=fe.o),z<fe.j){var je=fe.j-z;z=fe.j,ce[0]+=je*ve}if(z>=Z?z=0:(ce[0]+=4*fe.v,fe.ka=z-fe.j,fe.U=fe.va-fe.v,fe.T=Z-z,z=1),z){if(ge=ge[0],11>(z=k.ca).S){var Ie=z.f.RGBA,Ve=(Z=z.S,ce=fe.U,fe=fe.T,je=Ie.eb,Ie.A),Ne=fe;for(Ie=Ie.fb+k.Ma*Ie.A;0<Ne--;){var Le=me,Me=ge,Ke=ce,Qe=je,Xe=Ie;switch(Z){case Ew:tx(Le,Me,Ke,Qe,Xe);break;case Bw:qu(Le,Me,Ke,Qe,Xe);break;case Kk:qu(Le,Me,Ke,Qe,Xe),nx(Qe,Xe,0,Ke,1,0);break;case lD:Ef(Le,Me,Ke,Qe,Xe);break;case Tw:vt(Le,Me,Ke,Qe,Xe,1);break;case Wk:vt(Le,Me,Ke,Qe,Xe,1),nx(Qe,Xe,0,Ke,1,0);break;case Pw:vt(Le,Me,Ke,Qe,Xe,0);break;case Iw:vt(Le,Me,Ke,Qe,Xe,0),nx(Qe,Xe,1,Ke,1,0);break;case qk:Ku(Le,Me,Ke,Qe,Xe);break;case Yk:Ku(Le,Me,Ke,Qe,Xe),eD(Qe,Xe,Ke,1,0);break;case cD:Wu(Le,Me,Ke,Qe,Xe);break;default:t(0)}ge+=ve,Ie+=Ve}k.Ma+=fe}else alert("todo:EmitRescaledRowsYUVA");t(k.Ma<=z.height)}}k.C=O,t(k.C<=k.i)}function Wl(k){var O;if(0<k.ua)return 0;for(O=0;O<k.Wb;++O){var z=k.Ya[O].G,Z=k.Ya[O].H;if(0<z[1][Z[1]+0].g||0<z[2][Z[2]+0].g||0<z[3][Z[3]+0].g)return 0}return 1}function Lc(k,O,z,Z,ce,fe){if(k.Z!=0){var me=k.qd,ge=k.rd;for(t(Xu[k.Z]!=null);O<z;++O)Xu[k.Z](me,ge,Z,ce,Z,ce,fe),me=Z,ge=ce,ce+=fe;k.qd=me,k.rd=ge}}function Yl(k,O){var z=k.l.ma,Z=z.Z==0||z.Z==1?k.l.j:k.C;if(Z=k.C<Z?Z:k.C,t(O<=k.l.o),O>Z){var ce=k.l.width,fe=z.ca,me=z.tb+ce*Z,ge=k.V,ve=k.Ba+k.c*Z,je=k.gc;t(k.ab==1),t(je[0].hc==3),Qc(je[0],Z,O,ge,ve,fe,me),Lc(z,Z,O,fe,me,ce)}k.C=k.Ma=O}function Jl(k,O,z,Z,ce,fe,me){var ge=k.$/Z,ve=k.$%Z,je=k.m,Ie=k.s,Ve=z+k.$,Ne=Ve;ce=z+Z*ce;var Le=z+Z*fe,Me=280+Ie.ua,Ke=k.Pb?ge:16777216,Qe=0<Ie.ua?Ie.Wa:null,Xe=Ie.wc,et=Ve<Le?Yn(Ie,ve,ge):null;t(k.C<fe),t(Le<=ce);var at=!1;e:for(;;){for(;at||Ve<Le;){var nt=0;if(ge>=Ke){var Kt=Ve-z;t((Ke=k).Pb),Ke.wd=Ke.m,Ke.xd=Kt,0<Ke.s.ua&&xe(Ke.s.Wa,Ke.s.vb),Ke=ge+sde}if(ve&Xe||(et=Yn(Ie,ve,ge)),t(et!=null),et.Qb&&(O[Ve]=et.qb,at=!0),!at)if(K(je),et.jc){nt=je,Kt=O;var Ot=Ve,Dr=et.pd[q(nt)&kf-1];t(et.jc),256>Dr.g?(Y(nt,nt.u+Dr.g),Kt[Ot]=Dr.value,nt=0):(Y(nt,nt.u+Dr.g-256),t(256<=Dr.value),nt=Dr.value),nt==0&&(at=!0)}else nt=Ln(et.G[0],et.H[0],je);if(je.h)break;if(at||256>nt){if(!at)if(et.nd)O[Ve]=(et.qb|nt<<8)>>>0;else{if(K(je),at=Ln(et.G[1],et.H[1],je),K(je),Kt=Ln(et.G[2],et.H[2],je),Ot=Ln(et.G[3],et.H[3],je),je.h)break;O[Ve]=(Ot<<24|at<<16|nt<<8|Kt)>>>0}if(at=!1,++Ve,++ve>=Z&&(ve=0,++ge,me!=null&&ge<=fe&&!(ge%16)&&me(k,ge),Qe!=null))for(;Ne<Ve;)nt=O[Ne++],Qe.X[(506832829*nt&4294967295)>>>Qe.Mb]=nt}else if(280>nt){if(nt=qr(nt-256,je),Kt=Ln(et.G[4],et.H[4],je),K(je),Kt=pn(Z,Kt=qr(Kt,je)),je.h)break;if(Ve-z<Kt||ce-Ve<nt)break e;for(Ot=0;Ot<nt;++Ot)O[Ve+Ot]=O[Ve+Ot-Kt];for(Ve+=nt,ve+=nt;ve>=Z;)ve-=Z,++ge,me!=null&&ge<=fe&&!(ge%16)&&me(k,ge);if(t(Ve<=ce),ve&Xe&&(et=Yn(Ie,ve,ge)),Qe!=null)for(;Ne<Ve;)nt=O[Ne++],Qe.X[(506832829*nt&4294967295)>>>Qe.Mb]=nt}else{if(!(nt<Me))break e;for(at=nt-280,t(Qe!=null);Ne<Ve;)nt=O[Ne++],Qe.X[(506832829*nt&4294967295)>>>Qe.Mb]=nt;nt=Ve,t(!(at>>>(Kt=Qe).Xa)),O[nt]=Kt.X[at],at=!0}at||t(je.h==G(je))}if(k.Pb&&je.h&&Ve<ce)t(k.m.h),k.a=5,k.m=k.wd,k.$=k.xd,0<k.s.ua&&xe(k.s.vb,k.s.Wa);else{if(je.h)break e;me!=null&&me(k,ge>fe?fe:ge),k.a=0,k.$=Ve-z}return 1}return k.a=3,0}function hl(k){t(k!=null),k.vc=null,k.yc=null,k.Ya=null;var O=k.Wa;O!=null&&(O.X=null),k.vb=null,t(k!=null)}function Af(){var k=new Cr;return k==null?null:(k.a=0,k.xb=hD,vr("Predictor","VP8LPredictors"),vr("Predictor","VP8LPredictors_C"),vr("PredictorAdd","VP8LPredictorsAdd"),vr("PredictorAdd","VP8LPredictorsAdd_C"),qs=Ee,ex=Ge,tx=Tt,qu=Nt,Ku=Pt,Wu=_t,Ef=zt,C.VP8LMapColor32b=$c,C.VP8LMapColor8b=X0,k)}function Dc(k,O,z,Z,ce){var fe=1,me=[k],ge=[O],ve=Z.m,je=Z.s,Ie=null,Ve=0;e:for(;;){if(z)for(;fe&&Q(ve,1);){var Ne=me,Le=ge,Me=Z,Ke=1,Qe=Me.m,Xe=Me.gc[Me.ab],et=Q(Qe,2);if(Me.Oc&1<<et)fe=0;else{switch(Me.Oc|=1<<et,Xe.hc=et,Xe.Ea=Ne[0],Xe.nc=Le[0],Xe.K=[null],++Me.ab,t(4>=Me.ab),et){case 0:case 1:Xe.b=Q(Qe,3)+2,Ke=Dc(pe(Xe.Ea,Xe.b),pe(Xe.nc,Xe.b),0,Me,Xe.K),Xe.K=Xe.K[0];break;case 3:var at,nt=Q(Qe,8)+1,Kt=16<nt?0:4<nt?1:2<nt?2:3;if(Ne[0]=pe(Xe.Ea,Kt),Xe.b=Kt,at=Ke=Dc(nt,1,0,Me,Xe.K)){var Ot,Dr=nt,Qt=Xe,tn=1<<(8>>Qt.b),Ca=i(tn);if(Ca==null)at=0;else{var Rr=Qt.K[0],Ht=Qt.w;for(Ca[0]=Qt.K[0][0],Ot=1;Ot<1*Dr;++Ot)Ca[Ot]=Ce(Rr[Ht+Ot],Ca[Ot-1]);for(;Ot<4*tn;++Ot)Ca[Ot]=0;Qt.K[0]=null,Qt.K[0]=Ca,at=1}}Ke=at;break;case 2:break;default:t(0)}fe=Ke}}if(me=me[0],ge=ge[0],fe&&Q(ve,1)&&!(fe=1<=(Ve=Q(ve,4))&&11>=Ve)){Z.a=3;break e}var ft;if(ft=fe)t:{var Ws,Pr,on,is=Z,ei=me,Ii=ge,Os=Ve,mi=z,Oi=is.m,Sa=is.s,cn=[null],Bn=1,Fs=0,Tn=nde[Os];r:for(;;){if(mi&&Q(Oi,1)){var ti=Q(Oi,3)+2,tc=pe(ei,ti),Ys=pe(Ii,ti),Wi=tc*Ys;if(!Dc(tc,Ys,0,is,cn))break r;for(cn=cn[0],Sa.xc=ti,Ws=0;Ws<Wi;++Ws){var $n=cn[Ws]>>8&65535;cn[Ws]=$n,$n>=Bn&&(Bn=$n+1)}}if(Oi.h)break r;for(Pr=0;5>Pr;++Pr){var ka=dD[Pr];!Pr&&0<Os&&(ka+=1<<Os),Fs<ka&&(Fs=ka)}var So=o(Bn*Tn,L),Fi=Bn,ko=o(Fi,F);if(ko==null)var Eo=null;else t(65536>=Fi),Eo=ko;var Yi=i(Fs);if(Eo==null||Yi==null||So==null){is.a=1;break r}var Bo=So;for(Ws=on=0;Ws<Bn;++Ws){var Xn=Eo[Ws],To=Xn.G,rc=Xn.H,Tf=0,Hd=1,ri=0;for(Pr=0;5>Pr;++Pr){ka=dD[Pr],To[Pr]=Bo,rc[Pr]=on,!Pr&&0<Os&&(ka+=1<<Os);s:{var Dw,e5=ka,Rw=is,ix=Yi,Nde=Bo,_de=on,t5=0,Zu=Rw.m,Cde=Q(Zu,1);if(a(ix,0,0,e5),Cde){var Sde=Q(Zu,1)+1,kde=Q(Zu,1),bD=Q(Zu,kde==0?1:8);ix[bD]=1,Sde==2&&(ix[bD=Q(Zu,8)]=1);var Uw=1}else{var yD=i(19),wD=Q(Zu,4)+4;if(19<wD){Rw.a=3;var Mw=0;break s}for(Dw=0;Dw<wD;++Dw)yD[tde[Dw]]=Q(Zu,3);var r5=void 0,ox=void 0,jD=Rw,Ede=yD,$w=e5,ND=ix,n5=0,eh=jD.m,_D=8,CD=o(128,L);n:for(;B(CD,0,7,Ede,19);){if(Q(eh,1)){var Bde=2+2*Q(eh,3);if((r5=2+Q(eh,Bde))>$w)break n}else r5=$w;for(ox=0;ox<$w&&r5--;){K(eh);var SD=CD[0+(127&q(eh))];Y(eh,eh.u+SD.g);var _p=SD.value;if(16>_p)ND[ox++]=_p,_p!=0&&(_D=_p);else{var Tde=_p==16,kD=_p-16,Pde=Zce[kD],ED=Q(eh,Xce[kD])+Pde;if(ox+ED>$w)break n;for(var Ide=Tde?_D:0;0<ED--;)ND[ox++]=Ide}}n5=1;break n}n5||(jD.a=3),Uw=n5}(Uw=Uw&&!Zu.h)&&(t5=B(Nde,_de,8,ix,e5)),Uw&&t5!=0?Mw=t5:(Rw.a=3,Mw=0)}if(Mw==0)break r;if(Hd&&ede[Pr]==1&&(Hd=Bo[on].g==0),Tf+=Bo[on].g,on+=Mw,3>=Pr){var lx,s5=Yi[0];for(lx=1;lx<ka;++lx)Yi[lx]>s5&&(s5=Yi[lx]);ri+=s5}}if(Xn.nd=Hd,Xn.Qb=0,Hd&&(Xn.qb=(To[3][rc[3]+0].value<<24|To[1][rc[1]+0].value<<16|To[2][rc[2]+0].value)>>>0,Tf==0&&256>To[0][rc[0]+0].value&&(Xn.Qb=1,Xn.qb+=To[0][rc[0]+0].value<<8)),Xn.jc=!Xn.Qb&&6>ri,Xn.jc){var Qw,zd=Xn;for(Qw=0;Qw<kf;++Qw){var th=Qw,rh=zd.pd[th],Hw=zd.G[0][zd.H[0]+th];256<=Hw.value?(rh.g=Hw.g+256,rh.value=Hw.value):(rh.g=0,rh.value=0,th>>=As(Hw,8,rh),th>>=As(zd.G[1][zd.H[1]+th],16,rh),th>>=As(zd.G[2][zd.H[2]+th],0,rh),As(zd.G[3][zd.H[3]+th],24,rh))}}}Sa.vc=cn,Sa.Wb=Bn,Sa.Ya=Eo,Sa.yc=So,ft=1;break t}ft=0}if(!(fe=ft)){Z.a=3;break e}if(0<Ve){if(je.ua=1<<Ve,!ee(je.Wa,Ve)){Z.a=1,fe=0;break e}}else je.ua=0;var a5=Z,BD=me,Ode=ge,i5=a5.s,o5=i5.xc;if(a5.c=BD,a5.i=Ode,i5.md=pe(BD,o5),i5.wc=o5==0?-1:(1<<o5)-1,z){Z.xb=ude;break e}if((Ie=i(me*ge))==null){Z.a=1,fe=0;break e}fe=(fe=Jl(Z,Ie,0,me,ge,ge,null))&&!ve.h;break e}return fe?(ce!=null?ce[0]=Ie:(t(Ie==null),t(z)),Z.$=0,z||hl(je)):hl(je),fe}function gf(k,O){var z=k.c*k.i,Z=z+O+16*O;return t(k.c<=O),k.V=i(Z),k.V==null?(k.Ta=null,k.Ua=0,k.a=1,0):(k.Ta=k.V,k.Ua=k.Ba+z+O,1)}function fp(k,O){var z=k.C,Z=O-z,ce=k.V,fe=k.Ba+k.c*z;for(t(O<=k.l.o);0<Z;){var me=16<Z?16:Z,ge=k.l.ma,ve=k.l.width,je=ve*me,Ie=ge.ca,Ve=ge.tb+ve*z,Ne=k.Ta,Le=k.Ua;jo(k,me,ce,fe),rD(Ne,Le,Ie,Ve,je),Lc(ge,z,z+me,Ie,Ve,ve),Z-=me,ce+=me*k.c,z+=me}t(z==O),k.C=k.Ma=O}function mp(){this.ub=this.yd=this.td=this.Rb=0}function pp(){this.Kd=this.Ld=this.Ud=this.Td=this.i=this.c=0}function Bk(){this.Fb=this.Bb=this.Cb=0,this.Zb=i(4),this.Lb=i(4)}function F0(){this.Yb=function(){var k=[];return function O(z,Z,ce){for(var fe=ce[Z],me=0;me<fe&&(z.push(ce.length>Z+1?[]:0),!(ce.length<Z+1));me++)O(z[me],Z+1,ce)}(k,0,[3,11]),k}()}function lw(){this.jb=i(3),this.Wc=l([4,8],F0),this.Xc=l([4,17],F0)}function cw(){this.Pc=this.wb=this.Tb=this.zd=0,this.vd=new i(4),this.od=new i(4)}function fl(){this.ld=this.La=this.dd=this.tc=0}function L0(){this.Na=this.la=0}function dw(){this.Sc=[0,0],this.Eb=[0,0],this.Qc=[0,0],this.ia=this.lc=0}function D0(){this.ad=i(384),this.Za=0,this.Ob=i(16),this.$b=this.Ad=this.ia=this.Gc=this.Hc=this.Dd=0}function uw(){this.uc=this.M=this.Nb=0,this.wa=Array(new fl),this.Y=0,this.ya=Array(new D0),this.aa=0,this.l=new Ap}function hw(){this.y=i(16),this.f=i(8),this.ea=i(8)}function fw(){this.cb=this.a=0,this.sc="",this.m=new U,this.Od=new mp,this.Kc=new pp,this.ed=new cw,this.Qa=new Bk,this.Ic=this.$c=this.Aa=0,this.D=new uw,this.Xb=this.Va=this.Hb=this.zb=this.yb=this.Ub=this.za=0,this.Jc=o(8,U),this.ia=0,this.pb=o(4,dw),this.Pa=new lw,this.Bd=this.kc=0,this.Ac=[],this.Bc=0,this.zc=[0,0,0,0],this.Gd=Array(new hw),this.Hd=0,this.rb=Array(new L0),this.sb=0,this.wa=Array(new fl),this.Y=0,this.oc=[],this.pc=0,this.sa=[],this.ta=0,this.qa=[],this.ra=0,this.Ha=[],this.B=this.R=this.Ia=0,this.Ec=[],this.M=this.ja=this.Vb=this.Fc=0,this.ya=Array(new D0),this.L=this.aa=0,this.gd=l([4,2],fl),this.ga=null,this.Fa=[],this.Cc=this.qc=this.P=0,this.Gb=[],this.Uc=0,this.mb=[],this.nb=0,this.rc=[],this.Ga=this.Vc=0}function Rc(k,O){return 0>k?0:k>O?O:k}function Ap(){this.T=this.U=this.ka=this.height=this.width=0,this.y=[],this.f=[],this.ea=[],this.Rc=this.fa=this.W=this.N=this.O=0,this.ma="void",this.put="VP8IoPutHook",this.ac="VP8IoSetupHook",this.bc="VP8IoTeardownHook",this.ha=this.Kb=0,this.data=[],this.hb=this.ib=this.da=this.o=this.j=this.va=this.v=this.Da=this.ob=this.w=0,this.F=[],this.J=0}function Tk(){var k=new fw;return k!=null&&(k.a=0,k.sc="OK",k.cb=0,k.Xb=0,sx||(sx=gp)),k}function ia(k,O,z){return k.a==0&&(k.a=O,k.sc=z,k.cb=0),0}function mw(k,O,z){return 3<=z&&k[O+0]==157&&k[O+1]==1&&k[O+2]==42}function Uc(k,O){if(k==null)return 0;if(k.a=0,k.sc="OK",O==null)return ia(k,2,"null VP8Io passed to VP8GetHeaders()");var z=O.data,Z=O.w,ce=O.ha;if(4>ce)return ia(k,7,"Truncated header.");var fe=z[Z+0]|z[Z+1]<<8|z[Z+2]<<16,me=k.Od;if(me.Rb=!(1&fe),me.td=fe>>1&7,me.yd=fe>>4&1,me.ub=fe>>5,3<me.td)return ia(k,3,"Incorrect keyframe parameters.");if(!me.yd)return ia(k,4,"Frame not displayable.");Z+=3,ce-=3;var ge=k.Kc;if(me.Rb){if(7>ce)return ia(k,7,"cannot parse picture header");if(!mw(z,Z,ce))return ia(k,3,"Bad code word");ge.c=16383&(z[Z+4]<<8|z[Z+3]),ge.Td=z[Z+4]>>6,ge.i=16383&(z[Z+6]<<8|z[Z+5]),ge.Ud=z[Z+6]>>6,Z+=7,ce-=7,k.za=ge.c+15>>4,k.Ub=ge.i+15>>4,O.width=ge.c,O.height=ge.i,O.Da=0,O.j=0,O.v=0,O.va=O.width,O.o=O.height,O.da=0,O.ib=O.width,O.hb=O.height,O.U=O.width,O.T=O.height,a((fe=k.Pa).jb,0,255,fe.jb.length),t((fe=k.Qa)!=null),fe.Cb=0,fe.Bb=0,fe.Fb=1,a(fe.Zb,0,0,fe.Zb.length),a(fe.Lb,0,0,fe.Lb)}if(me.ub>ce)return ia(k,7,"bad partition length");M(fe=k.m,z,Z,me.ub),Z+=me.ub,ce-=me.ub,me.Rb&&(ge.Ld=ne(fe),ge.Kd=ne(fe)),ge=k.Qa;var ve,je=k.Pa;if(t(fe!=null),t(ge!=null),ge.Cb=ne(fe),ge.Cb){if(ge.Bb=ne(fe),ne(fe)){for(ge.Fb=ne(fe),ve=0;4>ve;++ve)ge.Zb[ve]=ne(fe)?$(fe,7):0;for(ve=0;4>ve;++ve)ge.Lb[ve]=ne(fe)?$(fe,6):0}if(ge.Bb)for(ve=0;3>ve;++ve)je.jb[ve]=ne(fe)?I(fe,8):255}else ge.Bb=0;if(fe.Ka)return ia(k,3,"cannot parse segment header");if((ge=k.ed).zd=ne(fe),ge.Tb=I(fe,6),ge.wb=I(fe,3),ge.Pc=ne(fe),ge.Pc&&ne(fe)){for(je=0;4>je;++je)ne(fe)&&(ge.vd[je]=$(fe,6));for(je=0;4>je;++je)ne(fe)&&(ge.od[je]=$(fe,6))}if(k.L=ge.Tb==0?0:ge.zd?1:2,fe.Ka)return ia(k,3,"cannot parse filter header");var Ie=ce;if(ce=ve=Z,Z=ve+Ie,ge=Ie,k.Xb=(1<<I(k.m,2))-1,Ie<3*(je=k.Xb))z=7;else{for(ve+=3*je,ge-=3*je,Ie=0;Ie<je;++Ie){var Ve=z[ce+0]|z[ce+1]<<8|z[ce+2]<<16;Ve>ge&&(Ve=ge),M(k.Jc[+Ie],z,ve,Ve),ve+=Ve,ge-=Ve,ce+=3}M(k.Jc[+je],z,ve,ge),z=ve<Z?0:5}if(z!=0)return ia(k,z,"cannot parse partitions");for(z=I(ve=k.m,7),ce=ne(ve)?$(ve,4):0,Z=ne(ve)?$(ve,4):0,ge=ne(ve)?$(ve,4):0,je=ne(ve)?$(ve,4):0,ve=ne(ve)?$(ve,4):0,Ie=k.Qa,Ve=0;4>Ve;++Ve){if(Ie.Cb){var Ne=Ie.Zb[Ve];Ie.Fb||(Ne+=z)}else{if(0<Ve){k.pb[Ve]=k.pb[0];continue}Ne=z}var Le=k.pb[Ve];Le.Sc[0]=Jk[Rc(Ne+ce,127)],Le.Sc[1]=Xk[Rc(Ne+0,127)],Le.Eb[0]=2*Jk[Rc(Ne+Z,127)],Le.Eb[1]=101581*Xk[Rc(Ne+ge,127)]>>16,8>Le.Eb[1]&&(Le.Eb[1]=8),Le.Qc[0]=Jk[Rc(Ne+je,117)],Le.Qc[1]=Xk[Rc(Ne+ve,127)],Le.lc=Ne+ve}if(!me.Rb)return ia(k,4,"Not a key frame.");for(ne(fe),me=k.Pa,z=0;4>z;++z){for(ce=0;8>ce;++ce)for(Z=0;3>Z;++Z)for(ge=0;11>ge;++ge)je=ae(fe,cde[z][ce][Z][ge])?I(fe,8):ode[z][ce][Z][ge],me.Wc[z][ce].Yb[Z][ge]=je;for(ce=0;17>ce;++ce)me.Xc[z][ce]=me.Wc[z][dde[ce]]}return k.kc=ne(fe),k.kc&&(k.Bd=I(fe,8)),k.cb=1}function gp(k,O,z,Z,ce,fe,me){var ge=O[ce].Yb[z];for(z=0;16>ce;++ce){if(!ae(k,ge[z+0]))return ce;for(;!ae(k,ge[z+1]);)if(ge=O[++ce].Yb[0],z=0,ce==16)return 16;var ve=O[ce+1].Yb;if(ae(k,ge[z+2])){var je=k,Ie=0;if(ae(je,(Ne=ge)[(Ve=z)+3]))if(ae(je,Ne[Ve+6])){for(ge=0,Ve=2*(Ie=ae(je,Ne[Ve+8]))+(Ne=ae(je,Ne[Ve+9+Ie])),Ie=0,Ne=ade[Ve];Ne[ge];++ge)Ie+=Ie+ae(je,Ne[ge]);Ie+=3+(8<<Ve)}else ae(je,Ne[Ve+7])?(Ie=7+2*ae(je,165),Ie+=ae(je,145)):Ie=5+ae(je,159);else Ie=ae(je,Ne[Ve+4])?3+ae(je,Ne[Ve+5]):2;ge=ve[2]}else Ie=1,ge=ve[1];ve=me+ide[ce],0>(je=k).b&&X(je);var Ve,Ne=je.b,Le=(Ve=je.Ca>>1)-(je.I>>Ne)>>31;--je.b,je.Ca+=Le,je.Ca|=1,je.I-=(Ve+1&Le)<<Ne,fe[ve]=((Ie^Le)-Le)*Z[(0<ce)+0]}return 16}function pw(k){var O=k.rb[k.sb-1];O.la=0,O.Na=0,a(k.zc,0,0,k.zc.length),k.ja=0}function ml(k,O,z,Z,ce){ce=k[O+z+32*Z]+(ce>>3),k[O+z+32*Z]=-256&ce?0>ce?0:255:ce}function ja(k,O,z,Z,ce,fe){ml(k,O,0,z,Z+ce),ml(k,O,1,z,Z+fe),ml(k,O,2,z,Z-fe),ml(k,O,3,z,Z-ce)}function Bd(k){return(20091*k>>16)+k}function Aw(k,O,z,Z){var ce,fe=0,me=i(16);for(ce=0;4>ce;++ce){var ge=k[O+0]+k[O+8],ve=k[O+0]-k[O+8],je=(35468*k[O+4]>>16)-Bd(k[O+12]),Ie=Bd(k[O+4])+(35468*k[O+12]>>16);me[fe+0]=ge+Ie,me[fe+1]=ve+je,me[fe+2]=ve-je,me[fe+3]=ge-Ie,fe+=4,O++}for(ce=fe=0;4>ce;++ce)ge=(k=me[fe+0]+4)+me[fe+8],ve=k-me[fe+8],je=(35468*me[fe+4]>>16)-Bd(me[fe+12]),ml(z,Z,0,0,ge+(Ie=Bd(me[fe+4])+(35468*me[fe+12]>>16))),ml(z,Z,1,0,ve+je),ml(z,Z,2,0,ve-je),ml(z,Z,3,0,ge-Ie),fe++,Z+=32}function Pk(k,O,z,Z){var ce=k[O+0]+4,fe=35468*k[O+4]>>16,me=Bd(k[O+4]),ge=35468*k[O+1]>>16;ja(z,Z,0,ce+me,k=Bd(k[O+1]),ge),ja(z,Z,1,ce+fe,k,ge),ja(z,Z,2,ce-fe,k,ge),ja(z,Z,3,ce-me,k,ge)}function Ik(k,O,z,Z,ce){Aw(k,O,z,Z),ce&&Aw(k,O+16,z,Z+4)}function Mc(k,O,z,Z){Bf(k,O+0,z,Z,1),Bf(k,O+32,z,Z+128,1)}function gw(k,O,z,Z){var ce;for(k=k[O+0]+4,ce=0;4>ce;++ce)for(O=0;4>O;++O)ml(z,Z,O,ce,k)}function xw(k,O,z,Z){k[O+0]&&jn(k,O+0,z,Z),k[O+16]&&jn(k,O+16,z,Z+4),k[O+32]&&jn(k,O+32,z,Z+128),k[O+48]&&jn(k,O+48,z,Z+128+4)}function xp(k,O,z,Z){var ce,fe=i(16);for(ce=0;4>ce;++ce){var me=k[O+0+ce]+k[O+12+ce],ge=k[O+4+ce]+k[O+8+ce],ve=k[O+4+ce]-k[O+8+ce],je=k[O+0+ce]-k[O+12+ce];fe[0+ce]=me+ge,fe[8+ce]=me-ge,fe[4+ce]=je+ve,fe[12+ce]=je-ve}for(ce=0;4>ce;++ce)me=(k=fe[0+4*ce]+3)+fe[3+4*ce],ge=fe[1+4*ce]+fe[2+4*ce],ve=fe[1+4*ce]-fe[2+4*ce],je=k-fe[3+4*ce],z[Z+0]=me+ge>>3,z[Z+16]=je+ve>>3,z[Z+32]=me-ge>>3,z[Z+48]=je-ve>>3,Z+=64}
vendor: 5,627 bytes, line 1581
1581function xf(k,O,z){var Z,ce=O-32,fe=Co,me=255-k[ce-1];for(Z=0;Z<z;++Z){var ge,ve=fe,je=me+k[O-1];for(ge=0;ge<z;++ge)k[O+ge]=ve[je+k[ce+ge]];O+=32}}function Ok(k,O){xf(k,O,4)}function Fk(k,O){xf(k,O,8)}function Lk(k,O){xf(k,O,16)}function R0(k,O){var z;for(z=0;16>z;++z)s(k,O+32*z,k,O-32,16)}function vw(k,O){var z;for(z=16;0<z;--z)a(k,O,k[O-1],16),O+=32}function Xl(k,O,z){var Z;for(Z=0;16>Z;++Z)a(O,z+32*Z,k,16)}function Dk(k,O){var z,Z=16;for(z=0;16>z;++z)Z+=k[O-1+32*z]+k[O+z-32];Xl(Z>>5,k,O)}function vf(k,O){var z,Z=8;for(z=0;16>z;++z)Z+=k[O-1+32*z];Xl(Z>>4,k,O)}function U0(k,O){var z,Z=8;for(z=0;16>z;++z)Z+=k[O+z-32];Xl(Z>>4,k,O)}function Rk(k,O){Xl(128,k,O)}function Sr(k,O,z){return k+2*O+z+2>>2}function Uk(k,O){var z,Z=O-32;for(Z=new Uint8Array([Sr(k[Z-1],k[Z+0],k[Z+1]),Sr(k[Z+0],k[Z+1],k[Z+2]),Sr(k[Z+1],k[Z+2],k[Z+3]),Sr(k[Z+2],k[Z+3],k[Z+4])]),z=0;4>z;++z)s(k,O+32*z,Z,0,Z.length)}function Mk(k,O){var z=k[O-1],Z=k[O-1+32],ce=k[O-1+64],fe=k[O-1+96];J(k,O+0,16843009*Sr(k[O-1-32],z,Z)),J(k,O+32,16843009*Sr(z,Z,ce)),J(k,O+64,16843009*Sr(Z,ce,fe)),J(k,O+96,16843009*Sr(ce,fe,fe))}function $k(k,O){var z,Z=4;for(z=0;4>z;++z)Z+=k[O+z-32]+k[O-1+32*z];for(Z>>=3,z=0;4>z;++z)a(k,O+32*z,Z,4)}function Td(k,O){var z=k[O-1+0],Z=k[O-1+32],ce=k[O-1+64],fe=k[O-1-32],me=k[O+0-32],ge=k[O+1-32],ve=k[O+2-32],je=k[O+3-32];k[O+0+96]=Sr(Z,ce,k[O-1+96]),k[O+1+96]=k[O+0+64]=Sr(z,Z,ce),k[O+2+96]=k[O+1+64]=k[O+0+32]=Sr(fe,z,Z),k[O+3+96]=k[O+2+64]=k[O+1+32]=k[O+0+0]=Sr(me,fe,z),k[O+3+64]=k[O+2+32]=k[O+1+0]=Sr(ge,me,fe),k[O+3+32]=k[O+2+0]=Sr(ve,ge,me),k[O+3+0]=Sr(je,ve,ge)}function Pd(k,O){var z=k[O+1-32],Z=k[O+2-32],ce=k[O+3-32],fe=k[O+4-32],me=k[O+5-32],ge=k[O+6-32],ve=k[O+7-32];k[O+0+0]=Sr(k[O+0-32],z,Z),k[O+1+0]=k[O+0+32]=Sr(z,Z,ce),k[O+2+0]=k[O+1+32]=k[O+0+64]=Sr(Z,ce,fe),k[O+3+0]=k[O+2+32]=k[O+1+64]=k[O+0+96]=Sr(ce,fe,me),k[O+3+32]=k[O+2+64]=k[O+1+96]=Sr(fe,me,ge),k[O+3+64]=k[O+2+96]=Sr(me,ge,ve),k[O+3+96]=Sr(ge,ve,ve)}function Qk(k,O){var z=k[O-1+0],Z=k[O-1+32],ce=k[O-1+64],fe=k[O-1-32],me=k[O+0-32],ge=k[O+1-32],ve=k[O+2-32],je=k[O+3-32];k[O+0+0]=k[O+1+64]=fe+me+1>>1,k[O+1+0]=k[O+2+64]=me+ge+1>>1,k[O+2+0]=k[O+3+64]=ge+ve+1>>1,k[O+3+0]=ve+je+1>>1,k[O+0+96]=Sr(ce,Z,z),k[O+0+64]=Sr(Z,z,fe),k[O+0+32]=k[O+1+96]=Sr(z,fe,me),k[O+1+32]=k[O+2+96]=Sr(fe,me,ge),k[O+2+32]=k[O+3+96]=Sr(me,ge,ve),k[O+3+32]=Sr(ge,ve,je)}function Hk(k,O){var z=k[O+0-32],Z=k[O+1-32],ce=k[O+2-32],fe=k[O+3-32],me=k[O+4-32],ge=k[O+5-32],ve=k[O+6-32],je=k[O+7-32];k[O+0+0]=z+Z+1>>1,k[O+1+0]=k[O+0+64]=Z+ce+1>>1,k[O+2+0]=k[O+1+64]=ce+fe+1>>1,k[O+3+0]=k[O+2+64]=fe+me+1>>1,k[O+0+32]=Sr(z,Z,ce),k[O+1+32]=k[O+0+96]=Sr(Z,ce,fe),k[O+2+32]=k[O+1+96]=Sr(ce,fe,me),k[O+3+32]=k[O+2+96]=Sr(fe,me,ge),k[O+3+64]=Sr(me,ge,ve),k[O+3+96]=Sr(ge,ve,je)}function vp(k,O){var z=k[O-1+0],Z=k[O-1+32],ce=k[O-1+64],fe=k[O-1+96];k[O+0+0]=z+Z+1>>1,k[O+2+0]=k[O+0+32]=Z+ce+1>>1,k[O+2+32]=k[O+0+64]=ce+fe+1>>1,k[O+1+0]=Sr(z,Z,ce),k[O+3+0]=k[O+1+32]=Sr(Z,ce,fe),k[O+3+32]=k[O+1+64]=Sr(ce,fe,fe),k[O+3+64]=k[O+2+64]=k[O+0+96]=k[O+1+96]=k[O+2+96]=k[O+3+96]=fe}function M0(k,O){var z=k[O-1+0],Z=k[O-1+32],ce=k[O-1+64],fe=k[O-1+96],me=k[O-1-32],ge=k[O+0-32],ve=k[O+1-32],je=k[O+2-32];k[O+0+0]=k[O+2+32]=z+me+1>>1,k[O+0+32]=k[O+2+64]=Z+z+1>>1,k[O+0+64]=k[O+2+96]=ce+Z+1>>1,k[O+0+96]=fe+ce+1>>1,k[O+3+0]=Sr(ge,ve,je),k[O+2+0]=Sr(me,ge,ve),k[O+1+0]=k[O+3+32]=Sr(z,me,ge),k[O+1+32]=k[O+3+64]=Sr(Z,z,me),k[O+1+64]=k[O+3+96]=Sr(ce,Z,z),k[O+1+96]=Sr(fe,ce,Z)}function bf(k,O){var z;for(z=0;8>z;++z)s(k,O+32*z,k,O-32,8)}function zk(k,O){var z;for(z=0;8>z;++z)a(k,O,k[O-1],8),O+=32}function Id(k,O,z){var Z;for(Z=0;8>Z;++Z)a(O,z+32*Z,k,8)}function Vk(k,O){var z,Z=8;for(z=0;8>z;++z)Z+=k[O+z-32]+k[O-1+32*z];Id(Z>>4,k,O)}function $0(k,O){var z,Z=4;for(z=0;8>z;++z)Z+=k[O+z-32];Id(Z>>3,k,O)}function Q0(k,O){var z,Z=4;for(z=0;8>z;++z)Z+=k[O-1+32*z];Id(Z>>3,k,O)}function bw(k,O){Id(128,k,O)}function Od(k,O,z){var Z=k[O-z],ce=k[O+0],fe=3*(ce-Z)+Gk[1020+k[O-2*z]-k[O+z]],me=kw[112+(fe+4>>3)];k[O-z]=Co[255+Z+kw[112+(fe+3>>3)]],k[O+0]=Co[255+ce-me]}function H0(k,O,z,Z){var ce=k[O+0],fe=k[O+z];return gl[255+k[O-2*z]-k[O-z]]>Z||gl[255+fe-ce]>Z}function bp(k,O,z,Z){return 4*gl[255+k[O-z]-k[O+0]]+gl[255+k[O-2*z]-k[O+z]]<=Z}function z0(k,O,z,Z,ce){var fe=k[O-3*z],me=k[O-2*z],ge=k[O-z],ve=k[O+0],je=k[O+z],Ie=k[O+2*z],Ve=k[O+3*z];return 4*gl[255+ge-ve]+gl[255+me-je]>Z?0:gl[255+k[O-4*z]-fe]<=ce&&gl[255+fe-me]<=ce&&gl[255+me-ge]<=ce&&gl[255+Ve-Ie]<=ce&&gl[255+Ie-je]<=ce&&gl[255+je-ve]<=ce}function yf(k,O,z,Z){var ce=2*Z+1;for(Z=0;16>Z;++Z)bp(k,O+Z,z,ce)&&Od(k,O+Z,z)}function V0(k,O,z,Z){var ce=2*Z+1;for(Z=0;16>Z;++Z)bp(k,O+Z*z,1,ce)&&Od(k,O+Z*z,1)}function yw(k,O,z,Z){var ce;for(ce=3;0<ce;--ce)yf(k,O+=4*z,z,Z)}function ww(k,O,z,Z){var ce;for(ce=3;0<ce;--ce)V0(k,O+=4,z,Z)}function Fd(k,O,z,Z,ce,fe,me,ge){for(fe=2*fe+1;0<ce--;){if(z0(k,O,z,fe,me))if(H0(k,O,z,ge))Od(k,O,z);else{var ve=k,je=O,Ie=z,Ve=ve[je-2*Ie],Ne=ve[je-Ie],Le=ve[je+0],Me=ve[je+Ie],Ke=ve[je+2*Ie],Qe=27*(et=Gk[1020+3*(Le-Ne)+Gk[1020+Ve-Me]])+63>>7,Xe=18*et+63>>7,et=9*et+63>>7;ve[je-3*Ie]=Co[255+ve[je-3*Ie]+et],ve[je-2*Ie]=Co[255+Ve+Xe],ve[je-Ie]=Co[255+Ne+Qe],ve[je+0]=Co[255+Le-Qe],ve[je+Ie]=Co[255+Me-Xe],ve[je+2*Ie]=Co[255+Ke-et]}O+=Z}}function Ld(k,O,z,Z,ce,fe,me,ge){for(fe=2*fe+1;0<ce--;){if(z0(k,O,z,fe,me))if(H0(k,O,z,ge))Od(k,O,z);else{var ve=k,je=O,Ie=z,Ve=ve[je-Ie],Ne=ve[je+0],Le=ve[je+Ie],Me=kw[112+(4+(Ke=3*(Ne-Ve))>>3)],Ke=kw[112+(Ke+3>>3)],Qe=Me+1>>1;ve[je-2*Ie]=Co[255+ve[je-2*Ie]+Qe],ve[je-Ie]=Co[255+Ve+Ke],ve[je+0]=Co[255+Ne-Me],ve[je+Ie]=Co[255+Le-Qe]}O+=Z}}function jw(k,O,z,Z,ce,fe){Fd(k,O,z,1,16,Z,ce,fe)}function wf(k,O,z,Z,ce,fe){Fd(k,O,1,z,16,Z,ce,fe)}function Nw(k,O,z,Z,ce,fe){var me;
vendor: 16,013 bytes, line 1581
1581for(me=3;0<me;--me)Ld(k,O+=4*z,z,1,16,Z,ce,fe)}function H(k,O,z,Z,ce,fe){var me;for(me=3;0<me;--me)Ld(k,O+=4,1,z,16,Z,ce,fe)}function le(k,O,z,Z,ce,fe,me,ge){Fd(k,O,ce,1,8,fe,me,ge),Fd(z,Z,ce,1,8,fe,me,ge)}function _e(k,O,z,Z,ce,fe,me,ge){Fd(k,O,1,ce,8,fe,me,ge),Fd(z,Z,1,ce,8,fe,me,ge)}function ke(k,O,z,Z,ce,fe,me,ge){Ld(k,O+4*ce,ce,1,8,fe,me,ge),Ld(z,Z+4*ce,ce,1,8,fe,me,ge)}function Ue(k,O,z,Z,ce,fe,me,ge){Ld(k,O+4,1,ce,8,fe,me,ge),Ld(z,Z+4,1,ce,8,fe,me,ge)}function Ze(){this.ba=new It,this.ec=[],this.cc=[],this.Mc=[],this.Dc=this.Nc=this.dc=this.fc=0,this.Oa=new ar,this.memory=0,this.Ib="OutputFunc",this.Jb="OutputAlphaFunc",this.Nd="OutputRowFunc"}function rt(){this.data=[],this.offset=this.kd=this.ha=this.w=0,this.na=[],this.xa=this.gb=this.Ja=this.Sa=this.P=0}function Ut(){this.nc=this.Ea=this.b=this.hc=0,this.K=[],this.w=0}function Gt(){this.ua=0,this.Wa=new we,this.vb=new we,this.md=this.xc=this.wc=0,this.vc=[],this.Wb=0,this.Ya=new F,this.yc=new L}function Cr(){this.xb=this.a=0,this.l=new Ap,this.ca=new It,this.V=[],this.Ba=0,this.Ta=[],this.Ua=0,this.m=new D,this.Pb=0,this.wd=new D,this.Ma=this.$=this.C=this.i=this.c=this.xd=0,this.s=new Gt,this.ab=0,this.gc=o(4,Ut),this.Oc=0}function Or(){this.Lc=this.Z=this.$a=this.i=this.c=0,this.l=new Ap,this.ic=0,this.ca=[],this.tb=0,this.qd=null,this.rd=0}function ln(k,O,z,Z,ce,fe,me){for(k=k==null?0:k[O+0],O=0;O<me;++O)ce[fe+O]=k+z[Z+O]&255,k=ce[fe+O]}function Ss(k,O,z,Z,ce,fe,me){var ge;if(k==null)ln(null,null,z,Z,ce,fe,me);else for(ge=0;ge<me;++ge)ce[fe+ge]=k[O+ge]+z[Z+ge]&255}function oa(k,O,z,Z,ce,fe,me){if(k==null)ln(null,null,z,Z,ce,fe,me);else{var ge,ve=k[O+0],je=ve,Ie=ve;for(ge=0;ge<me;++ge)je=Ie+(ve=k[O+ge])-je,Ie=z[Z+ge]+(-256&je?0>je?0:255:je)&255,je=ve,ce[fe+ge]=Ie}}function Jn(k,O,z,Z){var ce=O.width,fe=O.o;if(t(k!=null&&O!=null),0>z||0>=Z||z+Z>fe)return null;if(!k.Cc){if(k.ga==null){var me;if(k.ga=new Or,(me=k.ga==null)||(me=O.width*O.o,t(k.Gb.length==0),k.Gb=i(me),k.Uc=0,k.Gb==null?me=0:(k.mb=k.Gb,k.nb=k.Uc,k.rc=null,me=1),me=!me),!me){me=k.ga;var ge=k.Fa,ve=k.P,je=k.qc,Ie=k.mb,Ve=k.nb,Ne=ve+1,Le=je-1,Me=me.l;if(t(ge!=null&&Ie!=null&&O!=null),Xu[0]=null,Xu[1]=ln,Xu[2]=Ss,Xu[3]=oa,me.ca=Ie,me.tb=Ve,me.c=O.width,me.i=O.height,t(0<me.c&&0<me.i),1>=je)O=0;else if(me.$a=3&ge[ve+0],me.Z=ge[ve+0]>>2&3,me.Lc=ge[ve+0]>>4&3,ve=ge[ve+0]>>6&3,0>me.$a||1<me.$a||4<=me.Z||1<me.Lc||ve)O=0;else if(Me.put=xt,Me.ac=pr,Me.bc=Lr,Me.ma=me,Me.width=O.width,Me.height=O.height,Me.Da=O.Da,Me.v=O.v,Me.va=O.va,Me.j=O.j,Me.o=O.o,me.$a)e:{t(me.$a==1),O=Af();t:for(;;){if(O==null){O=0;break e}if(t(me!=null),me.mc=O,O.c=me.c,O.i=me.i,O.l=me.l,O.l.ma=me,O.l.width=me.c,O.l.height=me.i,O.a=0,V(O.m,ge,Ne,Le),!Dc(me.c,me.i,1,O,null)||(O.ab==1&&O.gc[0].hc==3&&Wl(O.s)?(me.ic=1,ge=O.c*O.i,O.Ta=null,O.Ua=0,O.V=i(ge),O.Ba=0,O.V==null?(O.a=1,O=0):O=1):(me.ic=0,O=gf(O,me.c)),!O))break t;O=1;break e}me.mc=null,O=0}else O=Le>=me.c*me.i;me=!O}if(me)return null;k.ga.Lc!=1?k.Ga=0:Z=fe-z}t(k.ga!=null),t(z+Z<=fe);e:{if(O=(ge=k.ga).c,fe=ge.l.o,ge.$a==0){if(Ne=k.rc,Le=k.Vc,Me=k.Fa,ve=k.P+1+z*O,je=k.mb,Ie=k.nb+z*O,t(ve<=k.P+k.qc),ge.Z!=0)for(t(Xu[ge.Z]!=null),me=0;me<Z;++me)Xu[ge.Z](Ne,Le,Me,ve,je,Ie,O),Ne=je,Le=Ie,Ie+=O,ve+=O;else for(me=0;me<Z;++me)s(je,Ie,Me,ve,O),Ne=je,Le=Ie,Ie+=O,ve+=O;k.rc=Ne,k.Vc=Le}else{if(t(ge.mc!=null),O=z+Z,t((me=ge.mc)!=null),t(O<=me.i),me.C>=O)O=1;else if(ge.ic||Zl(),ge.ic){ge=me.V,Ne=me.Ba,Le=me.c;var Ke=me.i,Qe=(Me=1,ve=me.$/Le,je=me.$%Le,Ie=me.m,Ve=me.s,me.$),Xe=Le*Ke,et=Le*O,at=Ve.wc,nt=Qe<et?Yn(Ve,je,ve):null;t(Qe<=Xe),t(O<=Ke),t(Wl(Ve));t:for(;;){for(;!Ie.h&&Qe<et;){if(je&at||(nt=Yn(Ve,je,ve)),t(nt!=null),K(Ie),256>(Ke=Ln(nt.G[0],nt.H[0],Ie)))ge[Ne+Qe]=Ke,++Qe,++je>=Le&&(je=0,++ve<=O&&!(ve%16)&&Yl(me,ve));else{if(!(280>Ke)){Me=0;break t}Ke=qr(Ke-256,Ie);var Kt,Ot=Ln(nt.G[4],nt.H[4],Ie);if(K(Ie),!(Qe>=(Ot=pn(Le,Ot=qr(Ot,Ie)))&&Xe-Qe>=Ke)){Me=0;break t}for(Kt=0;Kt<Ke;++Kt)ge[Ne+Qe+Kt]=ge[Ne+Qe+Kt-Ot];for(Qe+=Ke,je+=Ke;je>=Le;)je-=Le,++ve<=O&&!(ve%16)&&Yl(me,ve);Qe<et&&je&at&&(nt=Yn(Ve,je,ve))}t(Ie.h==G(Ie))}Yl(me,ve>O?O:ve);break t}!Me||Ie.h&&Qe<Xe?(Me=0,me.a=Ie.h?5:3):me.$=Qe,O=Me}else O=Jl(me,me.V,me.Ba,me.c,me.i,O,fp);if(!O){Z=0;break e}}z+Z>=fe&&(k.Cc=1),Z=1}if(!Z)return null;if(k.Cc&&((Z=k.ga)!=null&&(Z.mc=null),k.ga=null,0<k.Ga))return alert("todo:WebPDequantizeLevels"),null}return k.nb+z*ce}function Na(k,O,z,Z,ce,fe){for(;0<ce--;){var me,ge=k,ve=O+(z?1:0),je=k,Ie=O+(z?0:3);for(me=0;me<Z;++me){var Ve=je[Ie+4*me];Ve!=255&&(Ve*=32897,ge[ve+4*me+0]=ge[ve+4*me+0]*Ve>>23,ge[ve+4*me+1]=ge[ve+4*me+1]*Ve>>23,ge[ve+4*me+2]=ge[ve+4*me+2]*Ve>>23)}O+=fe}}function la(k,O,z,Z,ce){for(;0<Z--;){var fe;for(fe=0;fe<z;++fe){var me=k[O+2*fe+0],ge=15&(je=k[O+2*fe+1]),ve=4369*ge,je=(240&je|je>>4)*ve>>16;k[O+2*fe+0]=(240&me|me>>4)*ve>>16&240|(15&me|me<<4)*ve>>16>>4&15,k[O+2*fe+1]=240&je|ge}O+=ce}}function Xa(k,O,z,Z,ce,fe,me,ge){var ve,je,Ie=255;for(je=0;je<ce;++je){for(ve=0;ve<Z;++ve){var Ve=k[O+ve];fe[me+4*ve]=Ve,Ie&=Ve}O+=z,me+=ge}return Ie!=255}function Dd(k,O,z,Z,ce){var fe;for(fe=0;fe<ce;++fe)z[Z+fe]=k[O+fe]>>8}function Zl(){nx=Na,eD=la,tD=Xa,rD=Dd}function Rd(k,O,z){C[k]=function(Z,ce,fe,me,ge,ve,je,Ie,Ve,Ne,Le,Me,Ke,Qe,Xe,et,at){var nt,Kt=at-1>>1,Ot=ge[ve+0]|je[Ie+0]<<16,Dr=Ve[Ne+0]|Le[Me+0]<<16;t(Z!=null);var Qt=3*Ot+Dr+131074>>2;for(O(Z[ce+0],255&Qt,Qt>>16,Ke,Qe),fe!=null&&(Qt=3*Dr+Ot+131074>>2,O(fe[me+0],255&Qt,Qt>>16,Xe,et)),nt=1;nt<=Kt;++nt){var tn=ge[ve+nt]|je[Ie+nt]<<16,Ca=Ve[Ne+nt]|Le[Me+nt]<<16,Rr=Ot+tn+Dr+Ca+524296,Ht=Rr+2*(tn+Dr)>>3;Qt=Ht+Ot>>1,Ot=(Rr=Rr+2*(Ot+Ca)>>3)+tn>>1,O(Z[ce+2*nt-1],255&Qt,Qt>>16,Ke,Qe+(2*nt-1)*z),O(Z[ce+2*nt-0],255&Ot,Ot>>16,Ke,Qe+(2*nt-0)*z),fe!=null&&(Qt=Rr+Dr>>1,Ot=Ht+Ca>>1,O(fe[me+2*nt-1],255&Qt,Qt>>16,Xe,et+(2*nt-1)*z),O(fe[me+2*nt+0],255&Ot,Ot>>16,Xe,et+(2*nt+0)*z)),Ot=tn,Dr=Ca}1&at||(Qt=3*Ot+Dr+131074>>2,O(Z[ce+at-1],255&Qt,Qt>>16,Ke,Qe+(at-1)*z),fe!=null&&(Qt=3*Dr+Ot+131074>>2,O(fe[me+at-1],255&Qt,Qt>>16,Xe,et+(at-1)*z)))}}function G0(){xl[Ew]=hde,xl[Bw]=fD,xl[lD]=fde,xl[Tw]=mD,xl[Pw]=pD,xl[qk]=AD,xl[cD]=mde,xl[Kk]=fD,xl[Wk]=mD,xl[Iw]=pD,xl[Yk]=AD}function yp(k){return k&-16384?0>k?0:255:k>>pde}function Qu(k,O){return yp((19077*k>>8)+(26149*O>>8)-14234)}function jf(k,O,z){return yp((19077*k>>8)-(6419*O>>8)-(13320*z>>8)+8708)}function Nf(k,O){return yp((19077*k>>8)+(33050*O>>8)-17685)}function Hu(k,O,z,Z,ce){Z[ce+0]=Qu(k,z),Z[ce+1]=jf(k,O,z),Z[ce+2]=Nf(k,O)}function Za(k,O,z,Z,ce){Z[ce+0]=Nf(k,O),Z[ce+1]=jf(k,O,z),Z[ce+2]=Qu(k,z)}function _f(k,O,z,Z,ce){var fe=jf(k,O,z);O=fe<<3&224|Nf(k,O)>>3,Z[ce+0]=248&Qu(k,z)|fe>>5,Z[ce+1]=O}function Cf(k,O,z,Z,ce){var fe=240&Nf(k,O)|15;Z[ce+0]=240&Qu(k,z)|jf(k,O,z)>>4,Z[ce+1]=fe}function q0(k,O,z,Z,ce){Z[ce+0]=255,Hu(k,O,z,Z,ce+1)}function K0(k,O,z,Z,ce){Za(k,O,z,Z,ce),Z[ce+3]=255}function Pi(k,O,z,Z,ce){Hu(k,O,z,Z,ce),Z[ce+3]=255}function Ud(k,O,z){C[k]=function(Z,ce,fe,me,ge,ve,je,Ie,Ve){for(var Ne=Ie+(-2&Ve)*z;Ie!=Ne;)O(Z[ce+0],fe[me+0],ge[ve+0],je,Ie),O(Z[ce+1],fe[me+0],ge[ve+0],je,Ie+z),ce+=2,++me,++ve,Ie+=2*z;1&Ve&&O(Z[ce+0],fe[me+0],ge[ve+0],je,Ie)}}function wp(k,O,z){return z==0?k==0?O==0?6:5:O==0?4:0:z}function _w(k,O,z,Z,ce){switch(k>>>30){case 3:Bf(O,z,Z,ce,0);break;case 2:Al(O,z,Z,ce);break;case 1:jn(O,z,Z,ce)}}function pl(k,O){var z,Z,ce=O.M,fe=O.Nb,me=k.oc,ge=k.pc+40,ve=k.oc,je=k.pc+584,Ie=k.oc,Ve=k.pc+600;for(z=0;16>z;++z)me[ge+32*z-1]=129;for(z=0;8>z;++z)ve[je+32*z-1]=129,Ie[Ve+32*z-1]=129;for(0<ce?me[ge-1-32]=ve[je-1-32]=Ie[Ve-1-32]=129:(a(me,ge-32-1,127,21),a(ve,je-32-1,127,9),a(Ie,Ve-32-1,127,9)),Z=0;Z<k.za;++Z){var Ne=O.ya[O.aa+Z];if(0<Z){for(z=-1;16>z;++z)s(me,ge+32*z-4,me,ge+32*z+12,4);for(z=-1;8>z;++z)s(ve,je+32*z-4,ve,je+32*z+4,4),s(Ie,Ve+32*z-4,Ie,Ve+32*z+4,4)}var Le=k.Gd,Me=k.Hd+Z,Ke=Ne.ad,Qe=Ne.Hc;if(0<ce&&(s(me,ge-32,Le[Me].y,0,16),s(ve,je-32,Le[Me].f,0,8),s(Ie,Ve-32,Le[Me].ea,0,8)),Ne.Za){var Xe=me,et=ge-32+16;for(0<ce&&(Z>=k.za-1?a(Xe,et,Le[Me].y[15],4):s(Xe,et,Le[Me+1].y,0,4)),z=0;4>z;z++)Xe[et+128+z]=Xe[et+256+z]=Xe[et+384+z]=Xe[et+0+z];for(z=0;16>z;++z,Qe<<=2)Xe=me,et=ge+xD[z],ec[Ne.Ob[z]](Xe,et),_w(Qe,Ke,16*+z,Xe,et)}else if(Xe=wp(Z,ce,Ne.Ob[0]),Ju[Xe](me,ge),Qe!=0)for(z=0;16>z;++z,Qe<<=2)_w(Qe,Ke,16*+z,me,ge+xD[z]);for(z=Ne.Gc,Xe=wp(Z,ce,Ne.Dd),Qd[Xe](ve,je),Qd[Xe](Ie,Ve),Qe=Ke,Xe=ve,et=je,255&(Ne=0|z)&&(170&Ne?Hc(Qe,256,Xe,et):Mn(Qe,256,Xe,et)),Ne=Ie,Qe=Ve,255&(z>>=8)&&(170&z?Hc(Ke,320,Ne,Qe):Mn(Ke,320,Ne,Qe)),ce<k.Ub-1&&(s(Le[Me].y,0,me,ge+480,16),s(Le[Me].f,0,ve,je+224,8),s(Le[Me].ea,0,Ie,Ve+224,8)),z=8*fe*k.B,Le=k.sa,Me=k.ta+16*Z+16*fe*k.R,Ke=k.qa,Ne=k.ra+8*Z+z,Qe=k.Ha,Xe=k.Ia+8*Z+z,z=0;16>z;++z)s(Le,Me+z*k.R,me,ge+32*z,16);for(z=0;8>z;++z)s(Ke,Ne+z*k.B,ve,je+32*z,8),s(Qe,Xe+z*k.B,Ie,Ve+32*z,8)}}function Sf(k,O,z,Z,ce,fe,me,ge,ve){var je=[0],Ie=[0],Ve=0,Ne=ve!=null?ve.kd:0,Le=ve??new rt;if(k==null||12>z)return 7;Le.data=k,Le.w=O,Le.ha=z,O=[O],z=[z],Le.gb=[Le.gb];e:{var Me=O,Ke=z,Qe=Le.gb;if(t(k!=null),t(Ke!=null),t(Qe!=null),Qe[0]=0,12<=Ke[0]&&!r(k,Me[0],"RIFF")){if(r(k,Me[0]+8,"WEBP")){Qe=3;break e}var Xe=he(k,Me[0]+4);if(12>Xe||4294967286<Xe){Qe=3;break e}if(Ne&&Xe>Ke[0]-8){Qe=7;break e}Qe[0]=Xe,Me[0]+=12,Ke[0]-=12}Qe=0}if(Qe!=0)return Qe;for(Xe=0<Le.gb[0],z=z[0];;){e:{var et=k;Ke=O,Qe=z;var at=je,nt=Ie,Kt=Me=[0];if((Qt=Ve=[Ve])[0]=0,8>Qe[0])Qe=7;else{if(!r(et,Ke[0],"VP8X")){if(he(et,Ke[0]+4)!=10){Qe=3;break e}if(18>Qe[0]){Qe=7;break e}var Ot=he(et,Ke[0]+8),Dr=1+ie(et,Ke[0]+12);if(2147483648<=Dr*(et=1+ie(et,Ke[0]+15))){Qe=3;break e}Kt!=null&&(Kt[0]=Ot),at!=null&&(at[0]=Dr),nt!=null&&(nt[0]=et),Ke[0]+=18,Qe[0]-=18,Qt[0]=1}Qe=0}}if(Ve=Ve[0],Me=Me[0],Qe!=0)return Qe;if(Ke=!!(2&Me),!Xe&&Ve)return 3;if(fe!=null&&(fe[0]=!!(16&Me)),me!=null&&(me[0]=Ke),ge!=null&&(ge[0]=0),me=je[0],Me=Ie[0],Ve&&Ke&&ve==null){Qe=0;break}if(4>z){Qe=7;break}if(Xe&&Ve||!Xe&&!Ve&&!r(k,O[0],"ALPH")){z=[z],Le.na=[Le.na],Le.P=[Le.P],Le.Sa=[Le.Sa];e:{Ot=k,Qe=O,Xe=z;var Qt=Le.gb;at=Le.na,nt=Le.P,Kt=Le.Sa,Dr=22,t(Ot!=null),t(Xe!=null),et=Qe[0];var tn=Xe[0];for(t(at!=null),t(Kt!=null),at[0]=null,nt[0]=null,Kt[0]=0;;){if(Qe[0]=et,Xe[0]=tn,8>tn){Qe=7;break e}var Ca=he(Ot,et+4);if(4294967286<Ca){Qe=3;break e}var Rr=8+Ca+1&-2;if(Dr+=Rr,0<Qt&&Dr>Qt){Qe=3;break e}if(!r(Ot,et,"VP8 ")||!r(Ot,et,"VP8L")){Qe=0;break e}if(tn[0]<Rr){Qe=7;break e}r(Ot,et,"ALPH")||(at[0]=Ot,nt[0]=et+8,Kt[0]=Ca),et+=Rr,tn-=Rr}}if(z=z[0],Le.na=Le.na[0],Le.P=Le.P[0],Le.Sa=Le.Sa[0],Qe!=0)break}z=[z],Le.Ja=[Le.Ja],Le.xa=[Le.xa];e:if(Qt=k,Qe=O,Xe=z,at=Le.gb[0],nt=Le.Ja,Kt=Le.xa,Ot=Qe[0],et=!r(Qt,Ot,"VP8 "),Dr=!r(Qt,Ot,"VP8L"),t(Qt!=null),t(Xe!=null),t(nt!=null),t(Kt!=null),8>Xe[0])Qe=7;else{if(et||Dr){if(Qt=he(Qt,Ot+4),12<=at&&Qt>at-12){Qe=3;break e}if(Ne&&Qt>Xe[0]-8){Qe=7;break e}nt[0]=Qt,Qe[0]+=8,Xe[0]-=8,Kt[0]=Dr}else Kt[0]=5<=Xe[0]&&Qt[Ot+0]==47&&!(Qt[Ot+4]>>5),nt[0]=Xe[0];Qe=0}if(z=z[0],Le.Ja=Le.Ja[0],Le.xa=Le.xa[0],O=O[0],Qe!=0)break;if(4294967286<Le.Ja)return 3;if(ge==null||Ke||(ge[0]=Le.xa?2:1),me=[me],Me=[Me],Le.xa){if(5>z){Qe=7;break}ge=me,Ne=Me,Ke=fe,k==null||5>z?k=0:5<=z&&k[O+0]==47&&!(k[O+4]>>5)?(Xe=[0],Qt=[0],at=[0],V(nt=new D,k,O,z),En(nt,Xe,Qt,at)?(ge!=null&&(ge[0]=Xe[0]),Ne!=null&&(Ne[0]=Qt[0]),Ke!=null&&(Ke[0]=at[0]),k=1):k=0):k=0}else{if(10>z){Qe=7;break}ge=Me,k==null||10>z||!mw(k,O+3,z-3)?k=0:(Ne=k[O+0]|k[O+1]<<8|k[O+2]<<16,Ke=16383&(k[O+7]<<8|k[O+6]),k=16383&(k[O+9]<<8|k[O+8]),1&Ne||3<(Ne>>1&7)||!(Ne>>4&1)||Ne>>5>=Le.Ja||!Ke||!k?k=0:(me&&(me[0]=Ke),ge&&(ge[0]=k),k=1))}if(!k||(me=me[0],Me=Me[0],Ve&&(je[0]!=me||Ie[0]!=Me)))return 3;ve!=null&&(ve[0]=Le,ve.offset=O-ve.w,t(4294967286>O-ve.w),t(ve.offset==ve.ha-z));break}return Qe==0||Qe==7&&Ve&&ve==null?(fe!=null&&(fe[0]|=Le.na!=null&&0<Le.na.length),Z!=null&&(Z[0]=me),ce!=null&&(ce[0]=Me),0):Qe}function W0(k,O,z){var Z=O.width,ce=O.height,fe=0,me=0,ge=Z,ve=ce;if(O.Da=k!=null&&0<k.Da,O.Da&&(ge=k.cd,ve=k.bd,fe=k.v,me=k.j,11>z||(fe&=-2,me&=-2),0>fe||0>me||0>=ge||0>=ve||fe+ge>Z||me+ve>ce))return 0;if(O.v=fe,O.j=me,O.va=fe+ge,O.o=me+ve,O.U=ge,O.T=ve,O.da=k!=null&&0<k.da,O.da){if(!Se(ge,ve,z=[k.ib],fe=[k.hb]))return 0;O.ib=z[0],O.hb=fe[0]}return O.ob=k!=null&&k.ob,O.Kb=k==null||!k.Sd,O.da&&(O.ob=O.ib<3*Z/4&&O.hb<3*ce/4,O.Kb=0),1}function Y0(k){if(k==null)return 2;if(11>k.S){var O=k.f.RGBA;O.fb+=(k.height-1)*O.A,O.A=-O.A}else O=k.f.kb,k=k.height,O.O+=(k-1)*O.fa,O.fa=-O.fa,O.N+=(k-1>>1)*O.Ab,O.Ab=-O.Ab,O.W+=(k-1>>1)*O.Db,O.Db=-O.Db,O.F!=null&&(O.J+=(k-1)*O.lb,O.lb=-O.lb);return 0}function zu(k,O,z,Z){if(Z==null||0>=k||0>=O)return 2;if(z!=null){if(z.Da){var ce=z.cd,fe=z.bd,me=-2&z.v,ge=-2&z.j;if(0>me||0>ge||0>=ce||0>=fe||me+ce>k||ge+fe>O)return 2;k=ce,O=fe}if(z.da){if(!Se(k,O,ce=[z.ib],fe=[z.hb]))return 2;k=ce[0],O=fe[0]}}Z.width=k,Z.height=O;e:{var ve=Z.width,je=Z.height;if(k=Z.S,0>=ve||0>=je||!(k>=Ew&&13>k))k=2;else{if(0>=Z.Rd&&Z.sd==null){me=fe=ce=O=0;var Ie=(ge=ve*vD[k])*je;if(11>k||(fe=(je+1)/2*(O=(ve+1)/2),k==12&&(me=(ce=ve)*je)),(je=i(Ie+2*fe+me))==null){k=1;break e}Z.sd=je,11>k?((ve=Z.f.RGBA).eb=je,ve.fb=0,ve.A=ge,ve.size=Ie):((ve=Z.f.kb).y=je,ve.O=0,ve.fa=ge,ve.Fd=Ie,ve.f=je,ve.N=0+Ie,ve.Ab=O,ve.Cd=fe,ve.ea=je,ve.W=0+Ie+fe,ve.Db=O,ve.Ed=fe,k==12&&(ve.F=je,ve.J=0+Ie+2*fe),ve.Tc=me,ve.lb=ce)}if(O=1,ce=Z.S,fe=Z.width,me=Z.height,ce>=Ew&&13>ce)if(11>ce)k=Z.f.RGBA,O&=(ge=Math.abs(k.A))*(me-1)+fe<=k.size,O&=ge>=fe*vD[ce],O&=k.eb!=null;else{k=Z.f.kb,ge=(fe+1)/2,Ie=(me+1)/2,ve=Math.abs(k.fa),je=Math.abs(k.Ab);var Ve=Math.abs(k.Db),Ne=Math.abs(k.lb),Le=Ne*(me-1)+fe;O&=ve*(me-1)+fe<=k.Fd,O&=je*(Ie-1)+ge<=k.Cd,O=(O&=Ve*(Ie-1)+ge<=k.Ed)&ve>=fe&je>=ge&Ve>=ge,O&=k.y!=null,O&=k.f!=null,O&=k.ea!=null,ce==12&&(O&=Ne>=fe,O&=Le<=k.Tc,O&=k.F!=null)}else O=0;k=O?0:2}}return k!=0||z!=null&&z.fd&&(k=Y0(Z)),k}var kf=64,No=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535,131071,262143,524287,1048575,2097151,4194303,8388607,16777215],_o=24,Vu=32,Md=8,Gu=[0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7];re("Predictor0","PredictorAdd0"),C.Predictor0=function(){return 4278190080},C.Predictor1=function(k){return k},C.Predictor2=function(k,O,z){return O[z+0]},C.Predictor3=function(k,O,z){return O[z+1]},C.Predictor4=function(k,O,z){return O[z-1]},C.Predictor5=function(k,O,z){return Ae(Ae(k,O[z+1]),O[z+0])},C.Predictor6=function(k,O,z){return Ae(k,O[z-1])},C.Predictor7=function(k,O,z){return Ae(k,O[z+0])},C.Predictor8=function(k,O,z){return Ae(O[z-1],O[z+0])},C.Predictor9=function(k,O,z){return Ae(O[z+0],O[z+1])},C.Predictor10=function(k,O,z){return Ae(Ae(k,O[z-1]),Ae(O[z+0],O[z+1]))},C.Predictor11=function(k,O,z){var Z=O[z+0];return 0>=be(Z>>24&255,k>>24&255,(O=O[z-1])>>24&255)+be(Z>>16&255,k>>16&255,O>>16&255)+be(Z>>8&255,k>>8&255,O>>8&255)+be(255&Z,255&k,255&O)?Z:k},C.Predictor12=function(k,O,z){var Z=O[z+0];return(Pe((k>>24&255)+(Z>>24&255)-((O=O[z-1])>>24&255))<<24|Pe((k>>16&255)+(Z>>16&255)-(O>>16&255))<<16|Pe((k>>8&255)+(Z>>8&255)-(O>>8&255))<<8|Pe((255&k)+(255&Z)-(255&O)))>>>0},C.Predictor13=function(k,O,z){var Z=O[z-1];return(Oe((k=Ae(k,O[z+0]))>>24&255,Z>>24&255)<<24|Oe(k>>16&255,Z>>16&255)<<16|Oe(k>>8&255,Z>>8&255)<<8|Oe(255&k,255&Z))>>>0};var J0=C.PredictorAdd0;C.PredictorAdd1=ue,re("Predictor2","PredictorAdd2"),re("Predictor3","PredictorAdd3"),re("Predictor4","PredictorAdd4"),re("Predictor5","PredictorAdd5"),re("Predictor6","PredictorAdd6"),re("Predictor7","PredictorAdd7"),re("Predictor8","PredictorAdd8"),re("Predictor9","PredictorAdd9"),re("Predictor10","PredictorAdd10"),re("Predictor11","PredictorAdd11"),re("Predictor12","PredictorAdd12"),re("Predictor13","PredictorAdd13");var jp=C.PredictorAdd2;Ye("ColorIndexInverseTransform","MapARGB","32b",function(k){return k>>8&255},function(k){return k}),Ye("VP8LColorIndexInverseTransformAlpha","MapAlpha","8b",function(k){return k},function(k){return k>>8&255});
vendor: 5,070 bytes, line 1581
1581var qs,Cw=C.ColorIndexInverseTransform,$c=C.MapARGB,Qc=C.VP8LColorIndexInverseTransformAlpha,X0=C.MapAlpha,Z0=C.VP8LPredictorsAdd=[];Z0.length=16,(C.VP8LPredictors=[]).length=16,(C.VP8LPredictorsAdd_C=[]).length=16,(C.VP8LPredictors_C=[]).length=16;var ex,tx,qu,Ku,Wu,Ef,Yu,Bf,Al,Hc,jn,Mn,Ks,_a,$d,rx,Np,Sw,KL,WL,YL,JL,XL,ZL,nx,eD,tD,rD,nD=i(511),sD=i(2041),aD=i(225),iD=i(767),oD=0,Gk=sD,kw=aD,Co=iD,gl=nD,Ew=0,Bw=1,lD=2,Tw=3,Pw=4,qk=5,cD=6,Kk=7,Wk=8,Iw=9,Yk=10,Xce=[2,3,7],Zce=[3,3,11],dD=[280,256,256,256,40],ede=[0,1,1,1,0],tde=[17,18,0,1,2,3,4,5,16,6,7,8,9,10,11,12,13,14,15],rde=[24,7,23,25,40,6,39,41,22,26,38,42,56,5,55,57,21,27,54,58,37,43,72,4,71,73,20,28,53,59,70,74,36,44,88,69,75,52,60,3,87,89,19,29,86,90,35,45,68,76,85,91,51,61,104,2,103,105,18,30,102,106,34,46,84,92,67,77,101,107,50,62,120,1,119,121,83,93,17,31,100,108,66,78,118,122,33,47,117,123,49,63,99,109,82,94,0,116,124,65,79,16,32,98,110,48,115,125,81,95,64,114,126,97,111,80,113,127,96,112],nde=[2954,2956,2958,2962,2970,2986,3018,3082,3212,3468,3980,5004],sde=8,Jk=[4,5,6,7,8,9,10,10,11,12,13,14,15,16,17,17,18,19,20,20,21,21,22,22,23,23,24,25,25,26,27,28,29,30,31,32,33,34,35,36,37,37,38,39,40,41,42,43,44,45,46,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,76,77,78,79,80,81,82,83,84,85,86,87,88,89,91,93,95,96,98,100,101,102,104,106,108,110,112,114,116,118,122,124,126,128,130,132,134,136,138,140,143,145,148,151,154,157],Xk=[4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,116,119,122,125,128,131,134,137,140,143,146,149,152,155,158,161,164,167,170,173,177,181,185,189,193,197,201,205,209,213,217,221,225,229,234,239,245,249,254,259,264,269,274,279,284],sx=null,ade=[[173,148,140,0],[176,155,140,135,0],[180,157,141,134,130,0],[254,254,243,230,196,177,153,140,133,130,129,0]],ide=[0,1,4,8,5,2,3,6,9,12,13,10,7,11,14,15],uD=[-0,1,-1,2,-2,3,4,6,-3,5,-4,-5,-6,7,-7,8,-8,-9],ode=[[[[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128]],[[253,136,254,255,228,219,128,128,128,128,128],[189,129,242,255,227,213,255,219,128,128,128],[106,126,227,252,214,209,255,255,128,128,128]],[[1,98,248,255,236,226,255,255,128,128,128],[181,133,238,254,221,234,255,154,128,128,128],[78,134,202,247,198,180,255,219,128,128,128]],[[1,185,249,255,243,255,128,128,128,128,128],[184,150,247,255,236,224,128,128,128,128,128],[77,110,216,255,236,230,128,128,128,128,128]],[[1,101,251,255,241,255,128,128,128,128,128],[170,139,241,252,236,209,255,255,128,128,128],[37,116,196,243,228,255,255,255,128,128,128]],[[1,204,254,255,245,255,128,128,128,128,128],[207,160,250,255,238,128,128,128,128,128,128],[102,103,231,255,211,171,128,128,128,128,128]],[[1,152,252,255,240,255,128,128,128,128,128],[177,135,243,255,234,225,128,128,128,128,128],[80,129,211,255,194,224,128,128,128,128,128]],[[1,1,255,128,128,128,128,128,128,128,128],[246,1,255,128,128,128,128,128,128,128,128],[255,128,128,128,128,128,128,128,128,128,128]]],[[[198,35,237,223,193,187,162,160,145,155,62],[131,45,198,221,172,176,220,157,252,221,1],[68,47,146,208,149,167,221,162,255,223,128]],[[1,149,241,255,221,224,255,255,128,128,128],[184,141,234,253,222,220,255,199,128,128,128],[81,99,181,242,176,190,249,202,255,255,128]],[[1,129,232,253,214,197,242,196,255,255,128],[99,121,210,250,201,198,255,202,128,128,128],[23,91,163,242,170,187,247,210,255,255,128]],[[1,200,246,255,234,255,128,128,128,128,128],[109,178,241,255,231,245,255,255,128,128,128],[44,130,201,253,205,192,255,255,128,128,128]],[[1,132,239,251,219,209,255,165,128,128,128],[94,136,225,251,218,190,255,255,128,128,128],[22,100,174,245,186,161,255,199,128,128,128]],[[1,182,249,255,232,235,128,128,128,128,128],[124,143,241,255,227,234,128,128,128,128,128],[35,77,181,251,193,211,255,205,128,128,128]],[[1,157,247,255,236,231,255,255,128,128,128],[121,141,235,255,225,227,255,255,128,128,128],[45,99,188,251,195,217,255,224,128,128,128]],[[1,1,251,255,213,255,128,128,128,128,128],[203,1,248,255,255,128,128,128,128,128,128],[137,1,177,255,224,255,128,128,128,128,128]]],[[[253,9,248,251,207,208,255,192,128,128,128],[175,13,224,243,193,185,249,198,255,255,128],[73,17,171,221,161,179,236,167,255,234,128]],[[1,95,247,253,212,183,255,255,128,128,128],[239,90,244,250,211,209,255,255,128,128,128],[155,77,195,248,188,195,255,255,128,128,128]],[[1,24,239,251,218,219,255,205,128,128,128],[201,51,219,255,196,186,128,128,128,128,128],[69,46,190,239,201,218,255,228,128,128,128]],[[1,191,251,255,255,128,128,128,128,128,128],[223,165,249,255,213,255,128,128,128,128,128],[141,124,248,255,255,128,128,128,128,128,128]],[[1,16,248,255,255,128,128,128,128,128,128],[190,36,230,255,236,255,128,128,128,128,128],[149,1,255,128,128,128,128,128,128,128,128]],[[1,226,255,128,128,128,128,128,128,128,128],[247,192,255,128,128,128,128,128,128,128,128],[240,128,25
15815,128,128,128,128,128,128,128,128]],[[1,134,252,255,255,128,128,128,128,128,128],[213,62,250,255,255,128,128,128,128,128,128],[55,93,255,128,128,128,128,128,128,128,128]],[[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128]]],[[[202,24,213,235,186,191,220,160,240,175,255],[126,38,182,232,169,184,228,174,255,187,128],[61,46,138,219,151,178,240,170,255,216,128]],[[1,112,230,250,199,191,247,159,255,255,128],[166,109,228,252,211,215,255,174,128,128,128],[39,77,162,232,172,180,245,178,255,255,128]],[[1,52,220,246,198,199,249,220,255,255,128],[124,74,191,243,183,193,250,221,255,255,128],[24,71,130,219,154,170,243,182,255,255,128]],[[1,182,225,249,219,240,255,224,128,128,128],[149,150,226,252,216,205,255,171,128,128,128],[28,108,170,242,183,194,254,223,255,255,128]],[[1,81,230,252,204,203,255,192,128,128,128],[123,102,209,247,188,196,255,233,128,128,128],[20,95,153,243,164,173,255,203,128,128,128]],[[1,222,248,255,216,213,128,128,128,128,128],[168,175,246,252,235,205,255,255,128,128,128],[47,116,215,255,211,212,255,255,128,128,128]],[[1,121,236,253,212,214,255,255,128,128,128],[141,84,213,252,201,202,255,219,128,128,128],[42,80,160,240,162,185,255,205,128,128,128]],[[1,1,255,128,128,128,128,128,128,128,128],[244,1,255,128,128,128,128,128,128,128,128],[238,1,255,128,128,128,128,128,128,128,128]]]],lde=[[[231,120,48,89,115,113,120,152,112],[152,179,64,126,170,118,46,70,95],[175,69,143,80,85,82,72,155,103],[56,58,10,171,218,189,17,13,152],[114,26,17,163,44,195,21,10,173],[121,24,80,195,26,62,44,64,85],[144,71,10,38,171,213,144,34,26],[170,46,55,19,136,160,33,206,71],[63,20,8,114,114,208,12,9,226],[81,40,11,96,182,84,29,16,36]],[[134,183,89,137,98,101,106,165,148],[72,187,100,130,157,111,32,75,80],[66,102,167,99,74,62,40,234,128],[41,53,9,178,241,141,26,8,107],[74,43,26,146,73,166,49,23,157],[65,38,105,160,51,52,31,115,128],[104,79,12,27,217,255,87,17,7],[87,68,71,44,114,51,15,186,23],[47,41,14,110,182,183,21,17,194],[66,45,25,102,197,189,23,18,22]],[[88,88,147,150,42,46,45,196,205],[43,97,183,117,85,38,35,179,61],[39,53,200,87,26,21,43,232,171],[56,34,51,104,114,102,29,93,77],[39,28,85,171,58,165,90,98,64],[34,22,116,206,23,34,43,166,73],[107,54,32,26,51,1,81,43,31],[68,25,106,22,64,171,36,225,114],[34,19,21,102,132,188,16,76,124],[62,18,78,95,85,57,50,48,51]],[[193,101,35,159,215,111,89,46,111],[60,148,31,172,219,228,21,18,111],[112,113,77,85,179,255,38,120,114],[40,42,1,196,245,209,10,25,109],[88,43,29,140,166,213,37,43,154],[61,63,30,155,67,45,68,1,209],[100,80,8,43,154,1,51,26,71],[142,78,78,16,255,128,34,197,171],[41,40,5,102,211,183,4,1,221],[51,50,17,168,209,192,23,25,82]],[[138,31,36,171,27,166,38,44,229],[67,87,58,169,82,115,26,59,179],[63,59,90,180,59,166,93,73,154],[40,40,21,116,143,209,34,39,175],[47,15,16,183,34,223,49,45,183],[46,17,33,183,6,98,15,32,183],[57,46,22,24,128,1,54,17,37],[65,32,73,115,28,128,23,128,205],[40,3,9,115,51,192,18,6,223],[87,37,9,115,59,77,64,21,47]],[[104,55,44,218,9,54,53,130,226],[64,90,70,205,40,41,23,26,57],[54,57,112,184,5,41,38,166,213],[30,34,26,133,152,116,10,32,134],[39,19,53,221,26,114,32,73,255],[31,9,65,234,2,15,1,118,73],[75,32,12,51,192,255,160,43,51],[88,31,35,67,102,85,55,186,85],[56,21,23,111,59,205,45,37,192],[55,38,70,124,73,102,1,34,98]],[[125,98,42,88,104,85,117,175,82],[95,84,53,89,128,100,113,101,45],[75,79,123,47,51,128,81,171,1],[57,17,5,71,102,57,53,41,49],[38,33,13,121,57,73,26,1,85],[41,10,67,138,77,110,90,47,114],[115,21,2,10,102,255,166,23,6],[101,29,16,10,85,128,101,196,26],[57,18,10,102,102,213,34,20,43],[117,20,15,36,163,128,68,1,26]],[[102,61,71,37,34,53,31,243,192],[69,60,71,38,73,119,28,222,37],[68,45,128,34,1,47,11,245,171],[62,17,19,70,146,85,55,62,70],[37,43,37,154,100,163,85,160,1],[63,9,92,136,28,64,32,201,85],[75,15,9,9,64,255,184,119,16],[86,6,28,5,64,255,25,248,1],[56,8,17,132,137,255,55,116,128],[58,15,20,82,135,57,26,121,40]],[[164,50,31,137,154,133,25,35,218],[51,103,44,131,131,123,31,6,158],[86,40,64,135,148,224,45,183,128],[22,26,17,131,240,154,14,1,209],[45,16,21,91,64,222,7,
15811,197],[56,21,39,155,60,138,23,102,213],[83,12,13,54,192,255,68,47,28],[85,26,85,85,128,128,32,146,171],[18,11,7,63,144,171,4,4,246],[35,27,10,146,174,171,12,26,128]],[[190,80,35,99,180,80,126,54,45],[85,126,47,87,176,51,41,20,32],[101,75,128,139,118,146,116,128,85],[56,41,15,176,236,85,37,9,62],[71,30,17,119,118,255,17,18,138],[101,38,60,138,55,70,43,26,142],[146,36,19,30,171,255,97,27,20],[138,45,61,62,219,1,81,188,64],[32,41,20,117,151,142,20,21,163],[112,19,12,61,195,128,48,4,24]]],cde=[[[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[176,246,255,255,255,255,255,255,255,255,255],[223,241,252,255,255,255,255,255,255,255,255],[249,253,253,255,255,255,255,255,255,255,255]],[[255,244,252,255,255,255,255,255,255,255,255],[234,254,254,255,255,255,255,255,255,255,255],[253,255,255,255,255,255,255,255,255,255,255]],[[255,246,254,255,255,255,255,255,255,255,255],[239,253,254,255,255,255,255,255,255,255,255],[254,255,254,255,255,255,255,255,255,255,255]],[[255,248,254,255,255,255,255,255,255,255,255],[251,255,254,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,253,254,255,255,255,255,255,255,255,255],[251,254,254,255,255,255,255,255,255,255,255],[254,255,254,255,255,255,255,255,255,255,255]],[[255,254,253,255,254,255,255,255,255,255,255],[250,255,254,255,254,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]],[[[217,255,255,255,255,255,255,255,255,255,255],[225,252,241,253,255,255,254,255,255,255,255],[234,250,241,250,253,255,253,254,255,255,255]],[[255,254,255,255,255,255,255,255,255,255,255],[223,254,254,255,255,255,255,255,255,255,255],[238,253,254,254,255,255,255,255,255,255,255]],[[255,248,254,255,255,255,255,255,255,255,255],[249,254,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,253,255,255,255,255,255,255,255,255,255],[247,254,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,253,254,255,255,255,255,255,255,255,255],[252,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,254,254,255,255,255,255,255,255,255,255],[253,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,254,253,255,255,255,255,255,255,255,255],[250,255,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]],[[[186,251,250,255,255,255,255,255,255,255,255],[234,251,244,254,255,255,255,255,255,255,255],[251,251,243,253,254,255,254,255,255,255,255]],[[255,253,254,255,255,255,255,255,255,255,255],[236,253,254,255,255,255,255,255,255,255,255],[251,253,253,254,254,255,255,255,255,255,255]],[[255,254,254,255,255,255,255,255,255,255,255],[254,254,254,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,254,255,255,255,255,255,255,255,255,255],[254,254,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]],[[[248,255,255,255,255,255,255,255,255,255,255],[250,254,252,254,255,255,255,255,255,255,255],[248,254,249,253,255,255,255,255,255,255,255]],[[255,253,253,255,255,255,255,255,255,255,255],[246,253,253,255,255,255,255,255,255,255,255],[252,254,251,254,254,255,255,255,255,255,255]],[[255,254,252,25
vendor: 17,604 bytes, line 1581
15815,255,255,255,255,255,255,255],[248,254,253,255,255,255,255,255,255,255,255],[253,255,254,254,255,255,255,255,255,255,255]],[[255,251,254,255,255,255,255,255,255,255,255],[245,251,254,255,255,255,255,255,255,255,255],[253,253,254,255,255,255,255,255,255,255,255]],[[255,251,253,255,255,255,255,255,255,255,255],[252,253,254,255,255,255,255,255,255,255,255],[255,254,255,255,255,255,255,255,255,255,255]],[[255,252,255,255,255,255,255,255,255,255,255],[249,255,254,255,255,255,255,255,255,255,255],[255,255,254,255,255,255,255,255,255,255,255]],[[255,255,253,255,255,255,255,255,255,255,255],[250,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]]],dde=[0,1,2,3,6,4,5,6,6,6,6,6,6,6,6,7,0],Ju=[],ec=[],Qd=[],ude=1,hD=2,Xu=[],xl=[];Rd("UpsampleRgbLinePair",Hu,3),Rd("UpsampleBgrLinePair",Za,3),Rd("UpsampleRgbaLinePair",Pi,4),Rd("UpsampleBgraLinePair",K0,4),Rd("UpsampleArgbLinePair",q0,4),Rd("UpsampleRgba4444LinePair",Cf,2),Rd("UpsampleRgb565LinePair",_f,2);var hde=C.UpsampleRgbLinePair,fde=C.UpsampleBgrLinePair,fD=C.UpsampleRgbaLinePair,mD=C.UpsampleBgraLinePair,pD=C.UpsampleArgbLinePair,AD=C.UpsampleRgba4444LinePair,mde=C.UpsampleRgb565LinePair,Ow=16,Fw=1<<Ow-1,ax=-227,Zk=482,pde=6,gD=0,Ade=i(256),gde=i(256),xde=i(256),vde=i(256),bde=i(Zk-ax),yde=i(Zk-ax);Ud("YuvToRgbRow",Hu,3),Ud("YuvToBgrRow",Za,3),Ud("YuvToRgbaRow",Pi,4),Ud("YuvToBgraRow",K0,4),Ud("YuvToArgbRow",q0,4),Ud("YuvToRgba4444Row",Cf,2),Ud("YuvToRgb565Row",_f,2);var xD=[0,4,8,12,128,132,136,140,256,260,264,268,384,388,392,396],Lw=[0,2,8],wde=[8,7,6,4,4,2,2,2,1,1,1,1],jde=1;this.WebPDecodeRGBA=function(k,O,z,Z,ce){var fe=Bw,me=new Ze,ge=new It;me.ba=ge,ge.S=fe,ge.width=[ge.width],ge.height=[ge.height];var ve=ge.width,je=ge.height,Ie=new ht;if(Ie==null||k==null)var Ve=2;else t(Ie!=null),Ve=Sf(k,O,z,Ie.width,Ie.height,Ie.Pd,Ie.Qd,Ie.format,null);if(Ve!=0?ve=0:(ve!=null&&(ve[0]=Ie.width[0]),je!=null&&(je[0]=Ie.height[0]),ve=1),ve){ge.width=ge.width[0],ge.height=ge.height[0],Z!=null&&(Z[0]=ge.width),ce!=null&&(ce[0]=ge.height);e:{if(Z=new Ap,(ce=new rt).data=k,ce.w=O,ce.ha=z,ce.kd=1,O=[0],t(ce!=null),((k=Sf(ce.data,ce.w,ce.ha,null,null,null,O,null,ce))==0||k==7)&&O[0]&&(k=4),(O=k)==0){if(t(me!=null),Z.data=ce.data,Z.w=ce.w+ce.offset,Z.ha=ce.ha-ce.offset,Z.put=xt,Z.ac=pr,Z.bc=Lr,Z.ma=me,ce.xa){if((k=Af())==null){me=1;break e}if(function(Ne,Le){var Me=[0],Ke=[0],Qe=[0];t:for(;;){if(Ne==null)return 0;if(Le==null)return Ne.a=2,0;if(Ne.l=Le,Ne.a=0,V(Ne.m,Le.data,Le.w,Le.ha),!En(Ne.m,Me,Ke,Qe)){Ne.a=3;break t}if(Ne.xb=hD,Le.width=Me[0],Le.height=Ke[0],!Dc(Me[0],Ke[0],1,Ne,null))break t;return 1}return t(Ne.a!=0),0}(k,Z)){if(Z=(O=zu(Z.width,Z.height,me.Oa,me.ba))==0){t:{Z=k;r:for(;;){if(Z==null){Z=0;break t}if(t(Z.s.yc!=null),t(Z.s.Ya!=null),t(0<Z.s.Wb),t((z=Z.l)!=null),t((ce=z.ma)!=null),Z.xb!=0){if(Z.ca=ce.ba,Z.tb=ce.tb,t(Z.ca!=null),!W0(ce.Oa,z,Tw)){Z.a=2;break r}if(!gf(Z,z.width)||z.da)break r;if((z.da||Rt(Z.ca.S))&&Zl(),11>Z.ca.S||(alert("todo:WebPInitConvertARGBToYUV"),Z.ca.f.kb.F!=null&&Zl()),Z.Pb&&0<Z.s.ua&&Z.s.vb.X==null&&!ee(Z.s.vb,Z.s.Wa.Xa)){Z.a=1;break r}Z.xb=0}if(!Jl(Z,Z.V,Z.Ba,Z.c,Z.i,z.o,ul))break r;ce.Dc=Z.Ma,Z=1;break t}t(Z.a!=0),Z=0}Z=!Z}Z&&(O=k.a)}else O=k.a}else{if((k=new Tk)==null){me=1;break e}if(k.Fa=ce.na,k.P=ce.P,k.qc=ce.Sa,Uc(k,Z)){if((O=zu(Z.width,Z.height,me.Oa,me.ba))==0){if(k.Aa=0,z=me.Oa,t((ce=k)!=null),z!=null){if(0<(ve=0>(ve=z.Md)?0:100<ve?255:255*ve/100)){for(je=Ie=0;4>je;++je)12>(Ve=ce.pb[je]).lc&&(Ve.ia=ve*wde[0>Ve.lc?0:Ve.lc]>>3),Ie|=Ve.ia;Ie&&(alert("todo:VP8InitRandom"),ce.ia=1)}ce.Ga=z.Id,100<ce.Ga?ce.Ga=100:0>ce.Ga&&(ce.Ga=0)}(function(Ne,Le){if(Ne==null)return 0;if(Le==null)return ia(Ne,2,"NULL VP8Io parameter in VP8Decode().");if(!Ne.cb&&!Uc(Ne,Le))return 0;if(t(Ne.cb),Le.ac==null||Le.ac(Le)){Le.ob&&(Ne.L=0);var Me=Lw[Ne.L];if(Ne.L==2?(Ne.yb=0,Ne.zb=0):(Ne.yb=Le.v-Me>>4,Ne.zb=Le.j-Me>>4,0>Ne.yb&&(Ne.yb=0),0>Ne.zb&&(Ne.zb=0)),Ne.Va=Le.o+15+Me>>4,Ne.Hb=Le.va+15+Me>>4,Ne.Hb>Ne.za&&(Ne.Hb=Ne.za),Ne.Va>Ne.Ub&&(Ne.Va=Ne.Ub),0<Ne.L){var Ke=Ne.ed;for(Me=0;4>Me;++Me){var Qe;if(Ne.Qa.Cb){var Xe=Ne.Qa.Lb[Me];Ne.Qa.Fb||(Xe+=Ke.Tb)}else Xe=Ke.Tb;for(Qe=0;1>=Qe;++Qe){var et=Ne.gd[Me][Qe],at=Xe;if(Ke.Pc&&(at+=Ke.vd[0],Qe&&(at+=Ke.od[0])),0<(at=0>at?0:63<at?63:at)){var nt=at;0<Ke.wb&&(nt=4<Ke.wb?nt>>2:nt>>1)>9-Ke.wb&&(nt=9-Ke.wb),1>nt&&(nt=1),et.dd=nt,et.tc=2*at+nt,et.ld=40<=at?2:15<=at?1:0}else et.tc=0;et.La=Qe}}}Me=0}else ia(Ne,6,"Frame setup failed"),Me=Ne.a;if(Me=Me==0){if(Me){Ne.$c=0,0<Ne.Aa||(Ne.Ic=jde);t:{Me=Ne.Ic,Ke=4*(nt=Ne.za);var Kt=32*nt,Ot=nt+1,Dr=0<Ne.L?nt*(0<Ne.Aa?2:1):0,Qt=(Ne.Aa==2?2:1)*nt;if((et=Ke+832+(Qe=3*(16*Me+Lw[Ne.L])/2*Kt)+(Xe=Ne.Fa!=null&&0<Ne.Fa.length?Ne.Kc.c*Ne.Kc.i:0))!=et)Me=0;else{if(et>Ne.Vb){if(Ne.Vb=0,Ne.Ec=i(et),Ne.Fc=0,Ne.Ec==null){Me=ia(Ne,1,"no memory during frame initialization.");break t}Ne.Vb=et}et=Ne.Ec,at=Ne.Fc,Ne.Ac=et,Ne.Bc=at,at+=Ke,Ne.Gd=o(Kt,hw),Ne.Hd=0,Ne.rb=o(Ot+1,L0),Ne.sb=1,Ne.wa=Dr?o(Dr,fl):null,Ne.Y=0,Ne.D.Nb=0,Ne.D.wa=Ne.wa,Ne.D.Y=Ne.Y,0<Ne.Aa&&(Ne.D.Y+=nt),t(!0),Ne.oc=et,Ne.pc=at,at+=832,Ne.ya=o(Qt,D0),Ne.aa=0,Ne.D.ya=Ne.ya,Ne.D.aa=Ne.aa,Ne.Aa==2&&(Ne.D.aa+=nt),Ne.R=16*nt,Ne.B=8*nt,nt=(Kt=Lw[Ne.L])*Ne.R,Kt=Kt/2*Ne.B,Ne.sa=et,Ne.ta=at+nt,Ne.qa=Ne.sa,Ne.ra=Ne.ta+16*Me*Ne.R+Kt,Ne.Ha=Ne.qa,Ne.Ia=Ne.ra+8*Me*Ne.B+Kt,Ne.$c=0,at+=Qe,Ne.mb=Xe?et:null,Ne.nb=Xe?at:null,t(at+Xe<=Ne.Fc+Ne.Vb),pw(Ne),a(Ne.Ac,Ne.Bc,0,Ke),Me=1}}if(Me){if(Le.ka=0,Le.y=Ne.sa,Le.O=Ne.ta,Le.f=Ne.qa,Le.N=Ne.ra,Le.ea=Ne.Ha,Le.Vd=Ne.Ia,Le.fa=Ne.R,Le.Rc=Ne.B,Le.F=null,Le.J=0,!oD){for(Me=-255;255>=Me;++Me)nD[255+Me]=0>Me?-Me:Me;for(Me=-1020;1020>=Me;++Me)sD[1020+Me]=-128>Me?-128:127<Me?127:Me;for(Me=-112;112>=Me;++Me)aD[112+Me]=-16>Me?-16:15<Me?15:Me;for(Me=-255;510>=Me;++Me)iD[255+Me]=0>Me?0:255<Me?255:Me;oD=1}Yu=xp,Bf=Ik,Hc=Mc,jn=gw,Mn=xw,Al=Pk,Ks=jw,_a=wf,$d=le,rx=_e,Np=Nw,Sw=H,KL=ke,WL=Ue,YL=yf,JL=V0,XL=yw,ZL=ww,ec[0]=$k,ec[1]=Ok,ec[2]=Uk,ec[3]=Mk,ec[4]=Td,ec[5]=Qk,ec[6]=Pd,ec[7]=Hk,ec[8]=M0,ec[9]=vp,Ju[0]=Dk,Ju[1]=Lk,Ju[2]=R0,Ju[3]=vw,Ju[4]=vf,Ju[5]=U0,Ju[6]=Rk,Qd[0]=Vk,Qd[1]=Fk,Qd[2]=bf,Qd[3]=zk,Qd[4]=Q0,Qd[5]=$0,Qd[6]=bw,Me=1}else Me=0}Me&&(Me=function(tn,Ca){for(tn.M=0;tn.M<tn.Va;++tn.M){var Rr,Ht=tn.Jc[tn.M&tn.Xb],ft=tn.m,Ws=tn;for(Rr=0;Rr<Ws.za;++Rr){var Pr=ft,on=Ws,is=on.Ac,ei=on.Bc+4*Rr,Ii=on.zc,Os=on.ya[on.aa+Rr];if(on.Qa.Bb?Os.$b=ae(Pr,on.Pa.jb[0])?2+ae(Pr,on.Pa.jb[2]):ae(Pr,on.Pa.jb[1]):Os.$b=0,on.kc&&(Os.Ad=ae(Pr,on.Bd)),Os.Za=!ae(Pr,145)+0,Os.Za){var mi=Os.Ob,Oi=0;for(on=0;4>on;++on){var Sa,cn=Ii[0+on];for(Sa=0;4>Sa;++Sa){cn=lde[is[ei+Sa]][cn];for(var Bn=uD[ae(Pr,cn[0])];0<Bn;)Bn=uD[2*Bn+ae(Pr,cn[Bn])];cn=-Bn,is[ei+Sa]=cn}s(mi,Oi,is,ei,4),Oi+=4,Ii[0+on]=cn}}else cn=ae(Pr,156)?ae(Pr,128)?1:3:ae(Pr,163)?2:0,Os.Ob[0]=cn,a(is,ei,cn,4),a(Ii,0,cn,4);Os.Dd=ae(Pr,142)?ae(Pr,114)?ae(Pr,183)?1:3:2:0}if(Ws.m.Ka)return ia(tn,7,"Premature end-of-partition0 encountered.");for(;tn.ja<tn.za;++tn.ja){if(Ws=Ht,Pr=(ft=tn).rb[ft.sb-1],is=ft.rb[ft.sb+ft.ja],Rr=ft.ya[ft.aa+ft.ja],ei=ft.kc?Rr.Ad:0)Pr.la=is.la=0,Rr.Za||(Pr.Na=is.Na=0),Rr.Hc=0,Rr.Gc=0,Rr.ia=0;else{var Fs,Tn;if(Pr=is,is=Ws,ei=ft.Pa.Xc,Ii=ft.ya[ft.aa+ft.ja],Os=ft.pb[Ii.$b],on=Ii.ad,mi=0,Oi=ft.rb[ft.sb-1],cn=Sa=0,a(on,mi,0,384),Ii.Za)var ti=0,tc=ei[3];else{Bn=i(16);var Ys=Pr.Na+Oi.Na;if(Ys=sx(is,ei[1],Ys,Os.Eb,0,Bn,0),Pr.Na=Oi.Na=(0<Ys)+0,1<Ys)Yu(Bn,0,on,mi);else{var Wi=Bn[0]+3>>3;for(Bn=0;256>Bn;Bn+=16)on[mi+Bn]=Wi}ti=1,tc=ei[0]}var $n=15&Pr.la,ka=15&Oi.la;for(Bn=0;4>Bn;++Bn){var So=1&ka;for(Wi=Tn=0;4>Wi;++Wi)$n=$n>>1|(So=(Ys=sx(is,tc,Ys=So+(1&$n),Os.Sc,ti,on,mi))>ti)<<7,Tn=Tn<<2|(3<Ys?3:1<Ys?2:on[mi+0]!=0),mi+=16;$n>>=4,ka=ka>>1|So<<7,Sa=(Sa<<8|Tn)>>>0}for(tc=$n,ti=ka>>4,Fs=0;4>Fs;Fs+=2){for(Tn=0,$n=Pr.la>>4+Fs,ka=Oi.la>>4+Fs,Bn=0;2>Bn;++Bn){for(So=1&ka,Wi=0;2>Wi;++Wi)Ys=So+(1&$n),$n=$n>>1|(So=0<(Ys=sx(is,ei[2],Ys,Os.Qc,0,on,mi)))<<3,Tn=Tn<<2|(3<Ys?3:1<Ys?2:on[mi+0]!=0),mi+=16;$n>>=2,ka=ka>>1|So<<5}cn|=Tn<<4*Fs,tc|=$n<<4<<Fs,ti|=(240&ka)<<Fs}Pr.la=tc,Oi.la=ti,Ii.Hc=Sa,Ii.Gc=cn,Ii.ia=43690&cn?0:Os.ia,ei=!(Sa|cn)}if(0<ft.L&&(ft.wa[ft.Y+ft.ja]=ft.gd[Rr.$b][Rr.Za],ft.wa[ft.Y+ft.ja].La|=!ei),Ws.Ka)return ia(tn,7,"Premature end-of-file encountered.")}if(pw(tn),ft=Ca,Ws=1,Rr=(Ht=tn).D,Pr=0<Ht.L&&Ht.M>=Ht.zb&&Ht.M<=Ht.Va,Ht.Aa==0)t:{if(Rr.M=Ht.M,Rr.uc=Pr,pl(Ht,Rr),Ws=1,Rr=(Tn=Ht.D).Nb,Pr=(cn=Lw[Ht.L])*Ht.R,is=cn/2*Ht.B,Bn=16*Rr*Ht.R,Wi=8*Rr*Ht.B,ei=Ht.sa,Ii=Ht.ta-Pr+Bn,Os=Ht.qa,on=Ht.ra-is+Wi,mi=Ht.Ha,Oi=Ht.Ia-is+Wi,ka=($n=Tn.M)==0,Sa=$n>=Ht.Va-1,Ht.Aa==2&&pl(Ht,Tn),Tn.uc)for(So=(Ys=Ht).D.M,t(Ys.D.uc),Tn=Ys.yb;Tn<Ys.Hb;++Tn){ti=Tn,tc=So;var Fi=(ko=(ri=Ys).D).Nb;Fs=ri.R;var ko=ko.wa[ko.Y+ti],Eo=ri.sa,Yi=ri.ta+16*Fi*Fs+16*ti,Bo=ko.dd,Xn=ko.tc;if(Xn!=0)if(t(3<=Xn),ri.L==1)0<ti&&JL(Eo,Yi,Fs,Xn+4),ko.La&&ZL(Eo,Yi,Fs,Xn),0<tc&&YL(Eo,Yi,Fs,Xn+4),ko.La&&XL(Eo,Yi,Fs,Xn);else{var To=ri.B,rc=ri.qa,Tf=ri.ra+8*Fi*To+8*ti,Hd=ri.Ha,ri=ri.Ia+8*Fi*To+8*ti;Fi=ko.ld,0<ti&&(_a(Eo,Yi,Fs,Xn+4,Bo,Fi),rx(rc,Tf,Hd,ri,To,Xn+4,Bo,Fi)),ko.La&&(Sw(Eo,Yi,Fs,Xn,Bo,Fi),WL(rc,Tf,Hd,ri,To,Xn,Bo,Fi)),0<tc&&(Ks(Eo,Yi,Fs,Xn+4,Bo,Fi),$d(rc,Tf,Hd,ri,To,Xn+4,Bo,Fi)),ko.La&&(Np(Eo,Yi,Fs,Xn,Bo,Fi),KL(rc,Tf,Hd,ri,To,Xn,Bo,Fi))}}if(Ht.ia&&alert("todo:DitherRow"),ft.put!=null){if(Tn=16*$n,$n=16*($n+1),ka?(ft.y=Ht.sa,ft.O=Ht.ta+Bn,ft.f=Ht.qa,ft.N=Ht.ra+Wi,ft.ea=Ht.Ha,ft.W=Ht.Ia+Wi):(Tn-=cn,ft.y=ei,ft.O=Ii,ft.f=Os,ft.N=on,ft.ea=mi,ft.W=Oi),Sa||($n-=cn),$n>ft.o&&($n=ft.o),ft.F=null,ft.J=null,Ht.Fa!=null&&0<Ht.Fa.length&&Tn<$n&&(ft.J=Jn(Ht,ft,Tn,$n-Tn),ft.F=Ht.mb,ft.F==null&&ft.F.length==0)){Ws=ia(Ht,3,"Could not decode alpha data.");break t}Tn<ft.j&&(cn=ft.j-Tn,Tn=ft.j,t(!(1&cn)),ft.O+=Ht.R*cn,ft.N+=Ht.B*(cn>>1),ft.W+=Ht.B*(cn>>1),ft.F!=null&&(ft.J+=ft.width*cn)),Tn<$n&&(ft.O+=ft.v,ft.N+=ft.v>>1,ft.W+=ft.v>>1,ft.F!=null&&(ft.J+=ft.v),ft.ka=Tn-ft.j,ft.U=ft.va-ft.v,ft.T=$n-Tn,Ws=ft.put(ft))}Rr+1!=Ht.Ic||Sa||(s(Ht.sa,Ht.ta-Pr,ei,Ii+16*Ht.R,Pr),s(Ht.qa,Ht.ra-is,Os,on+8*Ht.B,is),s(Ht.Ha,Ht.Ia-is,mi,Oi+8*Ht.B,is))}if(!Ws)return ia(tn,6,"Output aborted.")}return 1}(Ne,Le)),Le.bc!=null&&Le.bc(Le),Me&=1}return Me?(Ne.cb=0,Me):0})(k,Z)||(O=k.a)}}else O=k.a}O==0&&me.Oa!=null&&me.Oa.fd&&(O=Y0(me.ba))}me=O}fe=me!=0?null:11>fe?ge.f.RGBA.eb:ge.f.kb.y}else fe=null;return fe};var vD=[3,4,3,4,4,2,2,4,4,4,2,1,1]};function d(C,E){for(var T="",B=0;B<4;B++)T+=String.fromCharCode(C[E++]);return T}function u(C,E){return C[E+0]|C[E+1]<<8}function h(C,E){return(C[E+0]|C[E+1]<<8|C[E+2]<<16)>>>0}function m(C,E){return(C[E+0]|C[E+1]<<8|C[E+2]<<16|C[E+3]<<24)>>>0}new c;var f=[0],p=[0],A=[],v=new c,x=e,b=function(C,E){var T={},B=0,L=!1,P=0,F=0;if(T.frames=[],!function(U,D){for(var q=0;q<4;q++)if(U[D+q]!="RIFF".charCodeAt(q))return!0;return!1}(C,E)){for(m(C,E+=4),E+=8;E<C.length;){var M=d(C,E),I=m(C,E+=4);E+=4;var $=I+(1&I);switch(M){case"VP8 ":case"VP8L":T.frames[B]===void 0&&(T.frames[B]={}),(Q=T.frames[B]).src_off=L?F:E-8,Q.src_size=P+I+8,B++,L&&(L=!1,P=0,F=0);break;case"VP8X":(Q=T.header={}).feature_flags=C[E];var V=E+4;Q.canvas_width=1+h(C,V),V+=3,Q.canvas_height=1+h(C,V),V+=3;break;case"ALPH":L=!0,P=$+8,F=E-8;break;case"ANIM":(Q=T.header).bgcolor=m(C,E),V=E+4,Q.loop_count=u(C,V),V+=2;break;case"ANMF":var R,Q;(Q=T.frames[B]={}).offset_x=2*h(C,E),E+=3,Q.offset_y=2*h(C,E),E+=3,Q.width=1+h(C,E),E+=3,Q.height=1+h(C,E),E+=3,Q.duration=h(C,E),E+=3,R=C[E++],Q.dispose=1&R,Q.blend=R>>1&1}M!="ANMF"&&(E+=$)}return T}}(x,0);b.response=x,b.rgbaoutput=!0,b.dataurl=!1;var y=b.header?b.header:null,w=b.frames?b.frames:null;if(y){y.loop_counter=y.loop_count,f=[y.canvas_height],p=[y.canvas_width];for(var j=0;j<w.length&&w[j].blend!=0;j++);}var N=w[0],_=v.WebPDecodeRGBA(x,N.src_off,N.src_size,p,f);N.rgba=_,N.imgwidth=p[0],N.imgheight=f[0];for(var S=0;S<p[0]*f[0]*4;S++)A[S]=_[S];return this.width=p,this.height=f,this.data=A,this}(function(e){var t,r,s,a,i,o,l,c,d,u=function(U){return U=U||{},this.isStrokeTransparent=U.isStrokeTransparent||!1,this.strokeOpacity=U.strokeOpacity||1,this.strokeStyle=U.strokeStyle||"#000000",this.fillStyle=U.fillStyle||"#000000",this.isFillTransparent=U.isFillTransparent||!1,this.fillOpacity=U.fillOpacity||1,this.font=U.font||"10px sans-serif",this.textBaseline=U.textBaseline||"alphabetic",this.textAlign=U.textAlign||"left",this.lineWidth=U.lineWidth||1,this.lineJoin=U.lineJoin||"miter",this.lineCap=U.lineCap||"butt",this.path=U.path||[],this.transform=U.transform!==void 0?U.transform.clone():new c,this.globalCompositeOperation=U.globalCompositeOperation||"normal",this.globalAlpha=U.globalAlpha||1,this.clip_path=U.clip_path||[],this.currentPoint=U.currentPoint||new o,this.miterLimit=U.miterLimit||10,this.lastPoint=U.lastPoint||new o,this.lineDashOffset=U.lineDashOffset||0,this.lineDash=U.lineDash||[],this.margin=U.margin||[0,0,0,0],this.prevPageLastElemOffset=U.prevPageLastElemOffset||0,this.ignoreClearRect=typeof U.ignoreClearRect!="boolean"||U.ignoreClearRect,this};e.events.push(["initialized",function(){this.context2d=new h(this),t=this.internal.f2,r=this.internal.getCoordinateString,s=this.internal.getVerticalCoordinateString,a=this.internal.getHorizontalCoordinate,i=this.internal.getVerticalCoordinate,o=this.internal.Point,l=this.internal.Rectangle,c=this.internal.Matrix,d=new u}]);var h=function(U){Object.defineProperty(this,"canvas",{get:function(){return{parentNode:!1,style:!1}}});var D=U;Object.defineProperty(this,"pdf",{get:function(){return D}});var q=!1;Object.defineProperty(this,"pageWrapXEnabled",{get:function(){return q},set:function(ee){q=!!ee}});var G=!1;Object.defineProperty(this,"pageWrapYEnabled",{get:function(){return G},set:function(ee){G=!!ee}});var Y=0;Object.defineProperty(this,"posX",{get:function(){return Y},set:function(ee){isNaN(ee)||(Y=ee)}});var K=0;Object.defineProperty(this,"posY",{get:function(){return K},set:function(ee){isNaN(ee)||(K=ee)}}),Object.defineProperty(this,"margin",{get:function(){return d.margin},set:function(ee){var xe;typeof ee=="number"?xe=[ee,ee,ee,ee]:((xe=new Array(4))[0]=ee[0],xe[1]=ee.length>=2?ee[1]:xe[0],xe[2]=ee.length>=3?ee[2]:xe[0],xe[3]=ee.length>=4?ee[3]:xe[1]),d.margin=xe}});var X=!1;Object.defineProperty(this,"autoPaging",{get:function(){return X},set:function(ee){X=ee}});var ne=0;Object.defineProperty(this,"lastBreak",{get:function(){return ne},set:function(ee){ne=ee}});var ae=[];Object.defineProperty(this,"pageBreaks",{get:function(){return ae},set:function(ee){ae=ee}}),Object.defineProperty(this,"ctx",{get:function(){return d},set:function(ee){ee instanceof u&&(d=ee)}}),Object.defineProperty(this,"path",{get:function(){return d.path},set:function(ee){d.path=ee}});var J=[];Object.defineProperty(this,"ctxStack",{get:function(){return J},set:function(ee){J=ee}}),Object.defineProperty(this,"fillStyle",{get:function(){return this.ctx.fillStyle},set:function(ee){var xe;xe=m(ee),this.ctx.fillStyle=xe.style,this.ctx.isFillTransparent=xe.a===0,this.ctx.fillOpacity=xe.a,this.pdf.setFillColor(xe.r,xe.g,xe.b,{a:xe.a}),this.pdf.setTextColor(xe.r,xe.g,xe.b,{a:xe.a})}}),Object.defineProperty(this,"strokeStyle",{get:function(){return this.ctx.strokeStyle},set:function(ee){var xe=m(ee);this.ctx.strokeStyle=xe.style,this.ctx.isStrokeTransparent=xe.a===0,this.ctx.strokeOpacity=xe.a,xe.a===0?this.pdf.setDrawColor(255,255,255):(xe.a,this.pdf.setDrawColor(xe.r,xe.g,xe.b))}}),Object.defineProperty(this,"lineCap",{get:function(){return this.ctx.lineCap},set:function(ee){["butt","round","square"].indexOf(ee)!==-1&&(this.ctx.lineCap=ee,this.pdf.setLineCap(ee))}}),Object.defineProperty(this,"lineWidth",{get:function(){return this.ctx.lineWidth},set:function(ee){isNaN(ee)||(this.ctx.lineWidth=ee,this.pdf.setLineWidth(ee))}}),Object.defineProperty(this,"lineJoin",{get:function(){return this.ctx.lineJoin},set:function(ee){["bevel","round","miter"].indexOf(ee)!==-1&&(this.ctx.lineJoin=ee,this.pdf.setLineJoin(ee))}}),Object.defineProperty(this,"miterLimit",{get:function(){return this.ctx.miterLimit},set:function(ee){isNaN(ee)||(this.ctx.miterLimit=ee,this.pdf.setMiterLimit(ee))}}),Object.defineProperty(this,"textBaseline",{get:function(){return this.ctx.textBaseline},set:function(ee){this.ctx.textBaseline=ee}}),Object.defineProperty(this,"textAlign",{get:function(){return this.ctx.textAlign},set:function(ee){["right","end","center","left","start"].indexOf(ee)!==-1&&(this.ctx.textAlign=ee)}});var W=null,ie=null,he=null;Object.defineProperty(this,"fontFaces",{get:function(){return he},set:function(ee){W=null,ie=null,he=ee}}),Object.defineProperty(this,"font",{get:function(){return this.ctx.font},set:function(ee){var xe;if(this.ctx.font=ee,(xe=/^\s*(?=(?:(?:[-a-z]+\s*){0,2}(italic|oblique))?)(?=(?:(?:[-a-z]+\s*){0,2}(small-caps))?)(?=(?:(?:[-a-z]+\s*){0,2}(bold(?:er)?|lighter|[1-9]00))?)(?:(?:normal|\1|\2|\3)\s*){0,3}((?:xx?-)?(?:small|large)|medium|smaller|larger|[.\d]+(?:\%|in|[cem]m|ex|p[ctx]))(?:\s*\/\s*(normal|[.\d]+(?:\%|in|[cem]m|ex|p[ctx])))?\s*([-_,\"\'\sa-z0-9]+?)\s*$/i.exec(ee))!==null){var we=xe[1];xe[2];var Se=xe[3],pe=xe[4];xe[5];var Ce=xe[6],re=/^([.\d]+)((?:%|in|[cem]m|ex|p[ctx]))$/i.exec(pe)[2];pe=Math.floor(re==="px"?parseFloat(pe)*this.pdf.internal.scaleFactor:re==="em"?parseFloat(pe)*this.pdf.getFontSize():parseFloat(pe)*this.pdf.internal.scaleFactor),this.pdf.setFontSize(pe);var se=function(Ye){var Tt,Nt,Pt=[],_t=Ye.trim();if(_t==="")return a4;if(_t in iz)return[iz[_t]];for(;_t!=="";){switch(Nt=null,Tt=(_t=lz(_t)).charAt(0)){case'"':case"'":Nt=alt(_t.substring(1),Tt);break;default:Nt=ilt(_t)}if(Nt===null||(Pt.push(Nt[0]),(_t=lz(Nt[1]))!==""&&_t.charAt(0)!==","))return a4;_t=_t.replace(/^,/,"")}return Pt}(Ce);if(this.fontFaces){var Ae=function(Ye,Tt){var Nt=Ye.getFontList(
vendor: 1,584 bytes, line 1581
1581),Pt=JSON.stringify(Nt);if(W===null||ie!==Pt){var _t=function(zt){var vt=[];return Object.keys(zt).forEach(function(vr){zt[vr].forEach(function(Rt){var rr=null;switch(Rt){case"bold":rr={family:vr,weight:"bold"};break;case"italic":rr={family:vr,style:"italic"};break;case"bolditalic":rr={family:vr,weight:"bold",style:"italic"};break;case"":case"normal":rr={family:vr}}rr!==null&&(rr.ref={name:vr,style:Rt},vt.push(rr))})}),vt}(Nt);W=function(zt){for(var vt={},vr=0;vr<zt.length;++vr){var Rt=s4(zt[vr]),rr=Rt.family,an=Rt.stretch,It=Rt.style,ht=Rt.weight;vt[rr]=vt[rr]||{},vt[rr][an]=vt[rr][an]||{},vt[rr][an][It]=vt[rr][an][It]||{},vt[rr][an][It][ht]=Rt}return vt}(_t.concat(Tt)),ie=Pt}return W}(this.pdf,this.fontFaces),Pe=se.map(function(Ye){return{family:Ye,stretch:"normal",weight:Se,style:we}}),Oe=function(Ye,Tt,Nt){for(var Pt=(Nt=Nt||{}).defaultFontFamily||"times",_t=Object.assign({},slt,Nt.genericFontFamilies||{}),zt=null,vt=null,vr=0;vr<Tt.length;++vr)if(_t[(zt=s4(Tt[vr])).family]&&(zt.family=_t[zt.family]),Ye.hasOwnProperty(zt.family)){vt=Ye[zt.family];break}if(!(vt=vt||Ye[Pt]))throw new Error("Could not find a font-family for the rule '"+oz(zt)+"' and default family '"+Pt+"'.");if(vt=function(Rt,rr){if(rr[Rt])return rr[Rt];var an=kP[Rt],It=an<=kP.normal?-1:1,ht=az(rr,tae,an,It);if(!ht)throw new Error("Could not find a matching font-stretch value for "+Rt);return ht}(zt.stretch,vt),vt=function(Rt,rr){if(rr[Rt])return rr[Rt];for(var an=eae[Rt],It=0;It<an.length;++It)if(rr[an[It]])return rr[an[It]];throw new Error("Could not find a matching font-style for "+Rt)}
vendor: 4,561 bytes, line 1581
1581(zt.style,vt),!(vt=function(Rt,rr){if(rr[Rt])return rr[Rt];if(Rt===400&&rr[500])return rr[500];if(Rt===500&&rr[400])return rr[400];var an=nlt[Rt],It=az(rr,rae,an,Rt<400?-1:1);if(!It)throw new Error("Could not find a matching font-weight for value "+Rt);return It}(zt.weight,vt)))throw new Error("Failed to resolve a font for the rule '"+oz(zt)+"'.");return vt}(Ae,Pe);this.pdf.setFont(Oe.ref.name,Oe.ref.style)}else{var be="";(Se==="bold"||parseInt(Se,10)>=700||we==="bold")&&(be="bold"),we==="italic"&&(be+="italic"),be.length===0&&(be="normal");for(var ue="",Ee={arial:"Helvetica",Arial:"Helvetica",verdana:"Helvetica",Verdana:"Helvetica",helvetica:"Helvetica",Helvetica:"Helvetica","sans-serif":"Helvetica",fixed:"Courier",monospace:"Courier",terminal:"Courier",cursive:"Times",fantasy:"Times",serif:"Times"},De=0;De<se.length;De++){if(this.pdf.internal.getFont(se[De],be,{noFallback:!0,disableWarning:!0})!==void 0){ue=se[De];break}if(be==="bolditalic"&&this.pdf.internal.getFont(se[De],"bold",{noFallback:!0,disableWarning:!0})!==void 0)ue=se[De],be="bold";else if(this.pdf.internal.getFont(se[De],"normal",{noFallback:!0,disableWarning:!0})!==void 0){ue=se[De],be="normal";break}}if(ue===""){for(var Ge=0;Ge<se.length;Ge++)if(Ee[se[Ge]]){ue=Ee[se[Ge]];break}}ue=ue===""?"Times":ue,this.pdf.setFont(ue,be)}}}}),Object.defineProperty(this,"globalCompositeOperation",{get:function(){return this.ctx.globalCompositeOperation},set:function(ee){this.ctx.globalCompositeOperation=ee}}),Object.defineProperty(this,"globalAlpha",{get:function(){return this.ctx.globalAlpha},set:function(ee){this.ctx.globalAlpha=ee}}),Object.defineProperty(this,"lineDashOffset",{get:function(){return this.ctx.lineDashOffset},set:function(ee){this.ctx.lineDashOffset=ee,Q.call(this)}}),Object.defineProperty(this,"lineDash",{get:function(){return this.ctx.lineDash},set:function(ee){this.ctx.lineDash=ee,Q.call(this)}}),Object.defineProperty(this,"ignoreClearRect",{get:function(){return this.ctx.ignoreClearRect},set:function(ee){this.ctx.ignoreClearRect=!!ee}})};h.prototype.setLineDash=function(U){this.lineDash=U},h.prototype.getLineDash=function(){return this.lineDash.length%2?this.lineDash.concat(this.lineDash):this.lineDash.slice()},h.prototype.fill=function(){w.call(this,"fill",!1)},h.prototype.stroke=function(){w.call(this,"stroke",!1)},h.prototype.beginPath=function(){this.path=[{type:"begin"}]},h.prototype.moveTo=function(U,D){if(isNaN(U)||isNaN(D))throw zn.error("jsPDF.context2d.moveTo: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.moveTo");var q=this.ctx.transform.applyToPoint(new o(U,D));this.path.push({type:"mt",x:q.x,y:q.y}),this.ctx.lastPoint=new o(U,D)},h.prototype.closePath=function(){var U=new o(0,0),D=0;for(D=this.path.length-1;D!==-1;D--)if(this.path[D].type==="begin"&&On(this.path[D+1])==="object"&&typeof this.path[D+1].x=="number"){U=new o(this.path[D+1].x,this.path[D+1].y);break}this.path.push({type:"close"}),this.ctx.lastPoint=new o(U.x,U.y)},h.prototype.lineTo=function(U,D){if(isNaN(U)||isNaN(D))throw zn.error("jsPDF.context2d.lineTo: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.lineTo");var q=this.ctx.transform.applyToPoint(new o(U,D));this.path.push({type:"lt",x:q.x,y:q.y}),this.ctx.lastPoint=new o(q.x,q.y)},h.prototype.clip=function(){this.ctx.clip_path=JSON.parse(JSON.stringify(this.path)),w.call(this,null,!0)},h.prototype.quadraticCurveTo=function(U,D,q,G){if(isNaN(q)||isNaN(G)||isNaN(U)||isNaN(D))throw zn.error("jsPDF.context2d.quadraticCurveTo: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.quadraticCurveTo");var Y=this.ctx.transform.applyToPoint(new o(q,G)),K=this.ctx.transform.applyToPoint(new o(U,D));this.path.push({type:"qct",x1:K.x,y1:K.y,x:Y.x,y:Y.y}),this.ctx.lastPoint=new o(Y.x,Y.y)},h.prototype.bezierCurveTo=function(U,D,q,G,Y,K){if(isNaN(Y)||isNaN(K)||isNaN(U)||isNaN(D)||isNaN(q)||isNaN(G))throw zn.error("jsPDF.context2d.bezierCurveTo: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.bezierCurveTo");var X=this.ctx.transform.applyToPoint(new o(Y,K)),ne=this.ctx.transform.applyToPoint(new o(U,D)),ae=this.ctx.transform.applyToPoint(new o(q,G));this.path.push({type:"bct",x1:ne.x,y1:ne.y,x2:ae.x,y2:ae.y,x:X.x,y:X.y}),this.ctx.lastPoint=new o(X.x,X.y)},h.prototype.arc=function(U,D,q,G,Y,K){if(isNaN(U)||isNaN(D)||isNaN(q)||isNaN(G)||isNaN(Y))throw zn.error("jsPDF.context2d.arc: Invalid arguments",arguments),new Error("Invalid arguments passed to 
1581jsPDF.context2d.arc");if(K=!!K,!this.ctx.transform.isIdentity){var X=this.ctx.transform.applyToPoint(new o(U,D));U=X.x,D=X.y;var ne=this.ctx.transform.applyToPoint(new o(0,q)),ae=this.ctx.transform.applyToPoint(new o(0,0));q=Math.sqrt(Math.pow(ne.x-ae.x,2)+Math.pow(ne.y-ae.y,2))}Math.abs(Y-G)>=2*Math.PI&&(G=0,Y=2*Math.PI),this.path.push({type:"arc",x:U,y:D,radius:q,startAngle:G,endAngle:Y,counterclockwise:K})},h.prototype.arcTo=function(U,D,q,G,Y){throw new Error("arcTo not implemented.")},h.prototype.rect=function(U,D,q,G){if(isNaN(U)||isNaN(D)||isNaN(q)||isNaN(G))throw zn.error("jsPDF.context2d.rect: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.rect");this.moveTo(U,D),this.lineTo(U+q,D),this.lineTo(U+q,D+G),this.lineTo(U,D+G),this.lineTo(U,D),this.lineTo(U+q,D),this.lineTo(U,D)},h.prototype.fillRect=function(U,D,q,G){if(isNaN(U)||isNaN(D)||isNaN(q)||isNaN(G))throw zn.error("jsPDF.context2d.fillRect: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.fillRect");if(!f.call(this)){var Y={};this.lineCap!=="butt"&&(Y.lineCap=this.lineCap,this.lineCap="butt"),this.lineJoin!=="miter"&&(Y.lineJoin=this.lineJoin,this.lineJoin="miter"),this.beginPath(),this.rect(U,D,q,G),this.fill(),Y.hasOwnProperty("lineCap")&&(this.lineCap=Y.lineCap),Y.hasOwnProperty("lineJoin")&&(this.lineJoin=Y.lineJoin)}},h.prototype.strokeRect=function(U,D,q,G){if(isNaN(U)||isNaN(D)||isNaN(q)||isNaN(G))throw zn.error("jsPDF.context2d.strokeRect: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.strokeRect");p.call(this)||(this.beginPath(),this.rect(U,D,q,G),this.stroke())},h.prototype.clearRect=function(U,D,q,G){if(isNaN(U)||isNaN(D)||isNaN(q)||isNaN(G))throw zn.error("jsPDF.context2d.clearRect: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.clearRect");this.ignoreClearRect||(this.fillStyle="#ffffff",this.fillRect(U,D,q,G))},h.prototype.save=function(U){U=typeof U!="boolean"||U;for(var D=this.pdf.internal.getCurrentPageInfo().pageNumber,q=0;q<this.pdf.internal.getNumberOfPages();q++)this.pdf.setPage(q+1),this.pdf.internal.out("q");if(this.pdf.setPage(D),U){this.ctx.fontSize=this.pdf.internal.getFontSize();var G=new u(this.ctx);this.ctxStack.push(this.ctx),this.ctx=G}},h.prototype.restore=function(U){U=typeof U!="boolean"||U;for(var D=this.pdf.internal.getCurrentPageInfo().pageNumber,q=0;q<this.pdf.internal.getNumberOfPages();q++)this.pdf.setPage(q+1),this.pdf.internal.out("Q");this.pdf.setPage(D),U&&this.ctxStack.length!==0&&(this.ctx=this.ctxStack.pop(),this.fillStyle=this.ctx.fillStyle,this.strokeStyle=this.ctx.strokeStyle,this.font=this.ctx.font,this.lineCap=this.ctx.lineCap,this.lineWidth=this.ctx.lineWidth,this.lineJoin=this.ctx.lineJoin,this.lineDash=this.ctx.lineDash,this.lineDashOffset=this.ctx.lineDashOffset)},h.prototype.toDataURL=function(){throw new Error("toDataUrl not implemented.")};var m=function(U){var D,q,G,Y;if(U.isCanvasGradient===!0&&(U=U.getColor()),!U)return{r:0,g:0,b:0,a:0,style:U};if(/transparent|rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*0+\s*\)/.test(U))D=0,q=0,G=0,Y=0;else{var K=/rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/.exec(U);if(K!==null)D=parseInt(K[1]),q=parseInt(K[2]),G=parseInt(K[3]),Y=1;else if((K=/rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d.]+)\s*\)/.exec(U))!==null)D=parseInt(K[1]),q=parseInt(K[2]),G=parseInt(K[3]),Y=parseFloat(K[4]);else{if(Y=1,typeof U=="string"&&U.charAt(0)!=="#"){var X=new qse(U);U=X.ok?X.toHex():"#000000"}U.length===4?(D=U.substring(1,2),D+=D,q=U.substring(2,3),q+=q,G=U.substring(3,4),G+=G):(D=U.substring(1,3),q=U.substring(3,5),G=U.substring(5,7)),D=parseInt(D,16),q=parseInt(q,16),G=parseInt(G,16)}}return{r:D,g:q,b:G,a:Y,style:U}},f=function(){return this.ctx.isFillTransparent||this.globalAlpha==0},p=function(){return!!(this.ctx.isStrokeTransparent||this.globalAlpha==0)};h.prototype.fillText=function(U,D,q,G){if(isNaN(D)||isNaN(q)||typeof U!="string")throw zn.error("jsPDF.context2d.fillText: Invalid arguments",arguments),new Error("Invalid arguments passed to 
1581jsPDF.context2d.fillText");if(G=isNaN(G)?void 0:G,!f.call(this)){var Y=$(this.ctx.transform.rotation),K=this.ctx.transform.scaleX;B.call(this,{text:U,x:D,y:q,scale:K,angle:Y,align:this.textAlign,maxWidth:G})}},h.prototype.strokeText=function(U,D,q,G){if(isNaN(D)||isNaN(q)||typeof U!="string")throw zn.error("jsPDF.context2d.strokeText: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.strokeText");if(!p.call(this)){G=isNaN(G)?void 0:G;var Y=$(this.ctx.transform.rotation),K=this.ctx.transform.scaleX;B.call(this,{text:U,x:D,y:q,scale:K,renderingMode:"stroke",angle:Y,align:this.textAlign,maxWidth:G})}},h.prototype.measureText=function(U){if(typeof U!="string")throw zn.error("jsPDF.context2d.measureText: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.measureText");var D=this.pdf,q=this.pdf.internal.scaleFactor,G=D.internal.getFontSize(),Y=D.getStringUnitWidth(U)*G/D.internal.scaleFactor;return new function(K){var X=(K=K||{}).width||0;return Object.defineProperty(this,"width",{get:function(){return X}}),this}({width:Y*=Math.round(96*q/72*1e4)/1e4})},h.prototype.scale=function(U,D){if(isNaN(U)||isNaN(D))throw zn.error("jsPDF.context2d.scale: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.scale");var q=new c(U,0,0,D,0,0);this.ctx.transform=this.ctx.transform.multiply(q)},h.prototype.rotate=function(U){if(isNaN(U))throw zn.error("jsPDF.context2d.rotate: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.rotate");var D=new c(Math.cos(U),Math.sin(U),-Math.sin(U),Math.cos(U),0,0);this.ctx.transform=this.ctx.transform.multiply(D)},h.prototype.translate=function(U,D){if(isNaN(U)||isNaN(D))throw zn.error("jsPDF.context2d.translate: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.translate");var q=new c(1,0,0,1,U,D);this.ctx.transform=this.ctx.transform.multiply(q)},h.prototype.transform=function(U,D,q,G,Y,K){if(isNaN(U)||isNaN(D)||isNaN(q)||isNaN(G)||isNaN(Y)||isNaN(K))throw zn.error("jsPDF.context2d.transform: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.transform");var X=new c(U,D,q,G,Y,K);this.ctx.transform=this.ctx.transform.multiply(X)},h.prototype.setTransform=function(U,D,q,G,Y,K){U=isNaN(U)?1:U,D=isNaN(D)?0:D,q=isNaN(q)?0:q,G=isNaN(G)?1:G,Y=isNaN(Y)?0:Y,K=isNaN(K)?0:K,this.ctx.transform=new c(U,D,q,G,Y,K)};var A=function(){return this.margin[0]>0||this.margin[1]>0||this.margin[2]>0||this.margin[3]>0};h.prototype.drawImage=function(U,D,q,G,Y,K,X,ne,ae){var J=this.pdf.getImageProperties(U),W=1,ie=1,he=1,ee=1;G!==void 0&&ne!==void 0&&(he=ne/G,ee=ae/Y,W=J.width/G*ne/G,ie=J.height/Y*ae/Y),K===void 0&&(K=D,X=q,D=0,q=0),G!==void 0&&ne===void 0&&(ne=G,ae=Y),G===void 0&&ne===void 0&&(ne=J.width,ae=J.height);var xe=this.ctx.transform.decompose(),we=$(xe.rotate.shx),Se=new c,pe=(Se=(Se=(Se=Se.multiply(xe.translate)).multiply(xe.skew)).multiply(xe.scale)).applyToRectangle(new l(K-D*he,X-q*ee,G*W,Y*ie));if(this.autoPaging){for(var Ce,re=v.call(this,pe),se=[],Ae=0;Ae<re.length;Ae+=1)se.indexOf(re[Ae])===-1&&se.push(re[Ae]);y(se);for(var Pe=se[0],Oe=se[se.length-1],be=Pe;be<Oe+1;be++){this.pdf.setPage(be);var ue=this.pdf.internal.pageSize.width-this.margin[3]-this.margin[1],Ee=be===1?this.posY+this.margin[0]:this.margin[0],De=this.pdf.internal.pageSize.height-this.posY-this.margin[0]-this.margin[2],Ge=this.pdf.internal.pageSize.height-this.margin[0]-this.margin[2],Ye=be===1?0:De+(be-2)*Ge;if(this.ctx.clip_path.length!==0){var Tt=this.path;Ce=JSON.parse(JSON.stringify(this.ctx.clip_path)),this.path=b(Ce,this.posX+this.margin[3],-Ye+Ee+this.ctx.prevPageLastElemOffset),j.call(this,"fill",!0),this.path=Tt}var Nt=JSON.parse(JSON.stringify(pe));Nt=b([Nt],this.posX+this.margin[3],-Ye+Ee+this.ctx.prevPageLastElemOffset)[0];var Pt=(be>Pe||be<Oe)&&A.call(this);Pt&&(this.pdf.saveGraphicsState(),this.pdf.rect(this.margin[3],this.margin[0],ue,Ge,null).clip().discardPath()),this.pdf.addImage(U,"JPEG",Nt.x,Nt.y,Nt.w,Nt.h,null,null,we),Pt&&this.pdf.restoreGraphicsState()}}
vendor: 41,437 bytes, lines 1581-1587
1581else this.pdf.addImage(U,"JPEG",pe.x,pe.y,pe.w,pe.h,null,null,we)};var v=function(U,D,q){var G=[];D=D||this.pdf.internal.pageSize.width,q=q||this.pdf.internal.pageSize.height-this.margin[0]-this.margin[2];var Y=this.posY+this.ctx.prevPageLastElemOffset;switch(U.type){default:case"mt":case"lt":G.push(Math.floor((U.y+Y)/q)+1);break;case"arc":G.push(Math.floor((U.y+Y-U.radius)/q)+1),G.push(Math.floor((U.y+Y+U.radius)/q)+1);break;case"qct":var K=V(this.ctx.lastPoint.x,this.ctx.lastPoint.y,U.x1,U.y1,U.x,U.y);G.push(Math.floor((K.y+Y)/q)+1),G.push(Math.floor((K.y+K.h+Y)/q)+1);break;case"bct":var X=R(this.ctx.lastPoint.x,this.ctx.lastPoint.y,U.x1,U.y1,U.x2,U.y2,U.x,U.y);G.push(Math.floor((X.y+Y)/q)+1),G.push(Math.floor((X.y+X.h+Y)/q)+1);break;case"rect":G.push(Math.floor((U.y+Y)/q)+1),G.push(Math.floor((U.y+U.h+Y)/q)+1)}for(var ne=0;ne<G.length;ne+=1)for(;this.pdf.internal.getNumberOfPages()<G[ne];)x.call(this);return G},x=function(){var U=this.fillStyle,D=this.strokeStyle,q=this.font,G=this.lineCap,Y=this.lineWidth,K=this.lineJoin;this.pdf.addPage(),this.fillStyle=U,this.strokeStyle=D,this.font=q,this.lineCap=G,this.lineWidth=Y,this.lineJoin=K},b=function(U,D,q){for(var G=0;G<U.length;G++)switch(U[G].type){case"bct":U[G].x2+=D,U[G].y2+=q;case"qct":U[G].x1+=D,U[G].y1+=q;default:U[G].x+=D,U[G].y+=q}return U},y=function(U){return U.sort(function(D,q){return D-q})},w=function(U,D){var q=this.fillStyle,G=this.strokeStyle,Y=this.lineCap,K=this.lineWidth,X=Math.abs(K*this.ctx.transform.scaleX),ne=this.lineJoin;if(this.autoPaging){for(var ae,J,W=JSON.parse(JSON.stringify(this.path)),ie=JSON.parse(JSON.stringify(this.path)),he=[],ee=0;ee<ie.length;ee++)if(ie[ee].x!==void 0)for(var xe=v.call(this,ie[ee]),we=0;we<xe.length;we+=1)he.indexOf(xe[we])===-1&&he.push(xe[we]);for(var Se=0;Se<he.length;Se++)for(;this.pdf.internal.getNumberOfPages()<he[Se];)x.call(this);y(he);for(var pe=he[0],Ce=he[he.length-1],re=pe;re<Ce+1;re++){this.pdf.setPage(re),this.fillStyle=q,this.strokeStyle=G,this.lineCap=Y,this.lineWidth=X,this.lineJoin=ne;var se=this.pdf.internal.pageSize.width-this.margin[3]-this.margin[1],Ae=re===1?this.posY+this.margin[0]:this.margin[0],Pe=this.pdf.internal.pageSize.height-this.posY-this.margin[0]-this.margin[2],Oe=this.pdf.internal.pageSize.height-this.margin[0]-this.margin[2],be=re===1?0:Pe+(re-2)*Oe;if(this.ctx.clip_path.length!==0){var ue=this.path;ae=JSON.parse(JSON.stringify(this.ctx.clip_path)),this.path=b(ae,this.posX+this.margin[3],-be+Ae+this.ctx.prevPageLastElemOffset),j.call(this,U,!0),this.path=ue}if(J=JSON.parse(JSON.stringify(W)),this.path=b(J,this.posX+this.margin[3],-be+Ae+this.ctx.prevPageLastElemOffset),D===!1||re===0){var Ee=(re>pe||re<Ce)&&A.call(this);Ee&&(this.pdf.saveGraphicsState(),this.pdf.rect(this.margin[3],this.margin[0],se,Oe,null).clip().discardPath()),j.call(this,U,D),Ee&&this.pdf.restoreGraphicsState()}this.lineWidth=K}this.path=W}else this.lineWidth=X,j.call(this,U,D),this.lineWidth=K},j=function(U,D){if((U!=="stroke"||D||!p.call(this))&&(U==="stroke"||D||!f.call(this))){for(var q,G,Y=[],K=this.path,X=0;X<K.length;X++){var ne=K[X];switch(ne.type){case"begin":Y.push({begin:!0});break;case"close":Y.push({close:!0});break;case"mt":Y.push({start:ne,deltas:[],abs:[]});break;case"lt":var ae=Y.length;if(K[X-1]&&!isNaN(K[X-1].x)&&(q=[ne.x-K[X-1].x,ne.y-K[X-1].y],ae>0)){for(;ae>=0;ae--)if(Y[ae-1].close!==!0&&Y[ae-1].begin!==!0){Y[ae-1].deltas.push(q),Y[ae-1].abs.push(ne);break}}break;case"bct":q=[ne.x1-K[X-1].x,ne.y1-K[X-1].y,ne.x2-K[X-1].x,ne.y2-K[X-1].y,ne.x-K[X-1].x,ne.y-K[X-1].y],Y[Y.length-1].deltas.push(q);break;case"qct":var J=K[X-1].x+2/3*(ne.x1-K[X-1].x),W=K[X-1].y+2/3*(ne.y1-K[X-1].y),ie=ne.x+2/3*(ne.x1-ne.x),he=ne.y+2/3*(ne.y1-ne.y),ee=ne.x,xe=ne.y;q=[J-K[X-1].x,W-K[X-1].y,ie-K[X-1].x,he-K[X-1].y,ee-K[X-1].x,xe-K[X-1].y],Y[Y.length-1].deltas.push(q);break;case"arc":Y.push({deltas:[],abs:[],arc:!0}),Array.isArray(Y[Y.length-1].abs)&&Y[Y.length-1].abs.push(ne)}}G=D?null:U==="stroke"?"stroke":"fill";for(var we=!1,Se=0;Se<Y.length;Se++)if(Y[Se].arc)for(var pe=Y[Se].abs,Ce=0;Ce<pe.length;Ce++){var re=pe[Ce];re.type==="arc"?S.call(this,re.x,re.y,re.radius,re.startAngle,re.endAngle,re.counterclockwise,void 0,D,!we):L.call(this,re.x,re.y),we=!0}else if(Y[Se].close===!0)this.pdf.internal.out("h"),we=!1;else if(Y[Se].begin!==!0){var se=Y[Se].start.x,Ae=Y[Se].start.y;P.call(this,Y[Se].deltas,se,Ae),we=!0}G&&C.call(this,G),D&&E.call(this)}},N=function(U){var D=this.pdf.internal.getFontSize()/this.pdf.internal.scaleFactor,q=D*(this.pdf.internal.getLineHeightFactor()-1);switch(this.ctx.textBaseline){case"bottom":return U-q;case"top":return U+D-q;case"hanging":return U+D-2*q;case"middle":return U+D/2-q;default:return U}},_=function(U){return U+this.pdf.internal.getFontSize()/this.pdf.internal.scaleFactor*(this.pdf.internal.getLineHeightFactor()-1)};h.prototype.createLinearGradient=function(){var U=function(){};return U.colorStops=[],U.addColorStop=function(D,q){this.colorStops.push([D,q])},U.getColor=function(){return this.colorStops.length===0?"#000000":this.colorStops[0][1]},U.isCanvasGradient=!0,U},h.prototype.createPattern=function(){return this.createLinearGradient()},h.prototype.createRadialGradient=function(){return this.createLinearGradient()};var S=function(U,D,q,G,Y,K,X,ne,ae){for(var J=M.call(this,q,G,Y,K),W=0;W<J.length;W++){var ie=J[W];W===0&&(ae?T.call(this,ie.x1+U,ie.y1+D):L.call(this,ie.x1+U,ie.y1+D)),F.call(this,U,D,ie.x2,ie.y2,ie.x3,ie.y3,ie.x4,ie.y4)}ne?E.call(this):C.call(this,X)},C=function(U){switch(U){case"stroke":this.pdf.internal.out("S");break;case"fill":this.pdf.internal.out("f")}},E=function(){this.pdf.clip(),this.pdf.discardPath()},T=function(U,D){this.pdf.internal.out(r(U)+" "+s(D)+" m")},B=function(U){var D;switch(U.align){case"right":case"end":D="right";break;case"center":D="center";break;default:D="left"}var q,G,Y,K=this.pdf.getTextDimensions(U.text),X=N.call(this,U.y),ne=_.call(this,X)-K.h,ae=this.ctx.transform.applyToPoint(new o(U.x,X));if(this.autoPaging){var J=this.ctx.transform.decompose(),W=new c;W=(W=(W=W.multiply(J.translate)).multiply(J.skew)).multiply(J.scale);for(var ie=this.ctx.transform.applyToRectangle(new l(U.x,X,K.w,K.h)),he=W.applyToRectangle(new l(U.x,ne,K.w,K.h)),ee=v.call(this,he),xe=[],we=0;we<ee.length;we+=1)xe.indexOf(ee[we])===-1&&xe.push(ee[we]);y(xe);for(var Se=xe[0],pe=xe[xe.length-1],Ce=Se;Ce<pe+1;Ce++){this.pdf.setPage(Ce);var re=Ce===1?this.posY+this.margin[0]:this.margin[0],se=this.pdf.internal.pageSize.height-this.posY-this.margin[0]-this.margin[2],Ae=this.pdf.internal.pageSize.height-this.margin[2],Pe=Ae-this.margin[0],Oe=this.pdf.internal.pageSize.width-this.margin[1],be=Oe-this.margin[3],ue=Ce===1?0:se+(Ce-2)*Pe;if(this.ctx.clip_path.length!==0){var Ee=this.path;q=JSON.parse(JSON.stringify(this.ctx.clip_path)),this.path=b(q,this.posX+this.margin[3],-1*ue+re),j.call(this,"fill",!0),this.path=Ee}var De=b([JSON.parse(JSON.stringify(he))],this.posX+this.margin[3],-ue+re+this.ctx.prevPageLastElemOffset)[0];U.scale>=.01&&(G=this.pdf.internal.getFontSize(),this.pdf.setFontSize(G*U.scale),Y=this.lineWidth,this.lineWidth=Y*U.scale);var Ge=this.autoPaging!=="text";if(Ge||De.y+De.h<=Ae){if(Ge||De.y>=re&&De.x<=Oe){var Ye=Ge?U.text:this.pdf.splitTextToSize(U.text,U.maxWidth||Oe-De.x)[0],Tt=b([JSON.parse(JSON.stringify(ie))],this.posX+this.margin[3],-ue+re+this.ctx.prevPageLastElemOffset)[0],Nt=Ge&&(Ce>Se||Ce<pe)&&A.call(this);Nt&&(this.pdf.saveGraphicsState(),this.pdf.rect(this.margin[3],this.margin[0],be,Pe,null).clip().discardPath()),this.pdf.text(Ye,Tt.x,Tt.y,{angle:U.angle,align:D,renderingMode:U.renderingMode}),Nt&&this.pdf.restoreGraphicsState()}}else De.y<Ae&&(this.ctx.prevPageLastElemOffset+=Ae-De.y);U.scale>=.01&&(this.pdf.setFontSize(G),this.lineWidth=Y)}}else U.scale>=.01&&(G=this.pdf.internal.getFontSize(),this.pdf.setFontSize(G*U.scale),Y=this.lineWidth,this.lineWidth=Y*U.scale),this.pdf.text(U.text,ae.x+this.posX,ae.y+this.posY,{angle:U.angle,align:D,renderingMode:U.renderingMode,maxWidth:U.maxWidth}),U.scale>=.01&&(this.pdf.setFontSize(G),this.lineWidth=Y)},L=function(U,D,q,G){q=q||0,G=G||0,this.pdf.internal.out(r(U+q)+" "+s(D+G)+" l")},P=function(U,D,q){return this.pdf.lines(U,D,q,null,null)},F=function(U,D,q,G,Y,K,X,ne){this.pdf.internal.out([t(a(q+U)),t(i(G+D)),t(a(Y+U)),t(i(K+D)),t(a(X+U)),t(i(ne+D)),"c"].join(" "))},M=function(U,D,q,G){for(var Y=2*Math.PI,K=Math.PI/2;D>q;)D-=Y;var X=Math.abs(q-D);X<Y&&G&&(X=Y-X);for(var ne=[],ae=G?-1:1,J=D;X>1e-5;){var W=J+ae*Math.min(X,K);ne.push(I.call(this,U,J,W)),X-=Math.abs(W-J),J=W}return ne},I=function(U,D,q){var G=(q-D)/2,Y=U*Math.cos(G),K=U*Math.sin(G),X=Y,ne=-K,ae=X*X+ne*ne,J=ae+X*Y+ne*K,W=4/3*(Math.sqrt(2*ae*J)-J)/(X*K-ne*Y),ie=X-W*ne,he=ne+W*X,ee=ie,xe=-he,we=G+D,Se=Math.cos(we),pe=Math.sin(we);return{x1:U*Math.cos(D),y1:U*Math.sin(D),x2:ie*Se-he*pe,y2:ie*pe+he*Se,x3:ee*Se-xe*pe,y3:ee*pe+xe*Se,x4:U*Math.cos(q),y4:U*Math.sin(q)}},$=function(U){return 180*U/Math.PI},V=function(U,D,q,G,Y,K){var X=U+.5*(q-U),ne=D+.5*(G-D),ae=Y+.5*(q-Y),J=K+.5*(G-K),W=Math.min(U,Y,X,ae),ie=Math.max(U,Y,X,ae),he=Math.min(D,K,ne,J),ee=Math.max(D,K,ne,J);return new l(W,he,ie-W,ee-he)},R=function(U,D,q,G,Y,K,X,ne){var ae,J,W,ie,he,ee,xe,we,Se,pe,Ce,re,se,Ae,Pe=q-U,Oe=G-D,be=Y-q,ue=K-G,Ee=X-Y,De=ne-K;for(J=0;J<41;J++)Se=(xe=(W=U+(ae=J/40)*Pe)+ae*((he=q+ae*be)-W))+ae*(he+ae*(Y+ae*Ee-he)-xe),pe=(we=(ie=D+ae*Oe)+ae*((ee=G+ae*ue)-ie))+ae*(ee+ae*(K+ae*De-ee)-we),J==0?(Ce=Se,re=pe,se=Se,Ae=pe):(Ce=Math.min(Ce,Se),re=Math.min(re,pe),se=Math.max(se,Se),Ae=Math.max(Ae,pe));return new l(Math.round(Ce),Math.round(re),Math.round(se-Ce),Math.round(Ae-re))},Q=function(){if(this.prevLineDash||this.ctx.lineDash.length||this.ctx.lineDashOffset){var U,D,q=(U=this.ctx.lineDash,D=this.ctx.lineDashOffset,JSON.stringify({lineDash:U,lineDashOffset:D}));this.prevLineDash!==q&&(this.pdf.setLineDash(this.ctx.lineDash,this.ctx.lineDashOffset),this.prevLineDash=q)}}})(Wt.API),function(e){var t=function(o){var l,c,d,u,h,m,f,p,A,v;for(c=[],d=0,u=(o+=l="\0\0\0\0".slice(o.length%4||4)).length;u>d;d+=4)(h=(o.charCodeAt(d)<<24)+(o.charCodeAt(d+1)<<16)+(o.charCodeAt(d+2)<<8)+o.charCodeAt(d+3))!==0?(m=(h=((h=((h=((h=(h-(v=h%85))/85)-(A=h%85))/85)-(p=h%85))/85)-(f=h%85))/85)%85,c.push(m+33,f+33,p+33,A+33,v+33)):c.push(122);return function(x,b){for(var y=b;y>0;y--)x.pop()}(c,l.length),String.fromCharCode.apply(String,c)+"~>"},r=function(o){var l,c,d,u,h,m=String,f="length",p=255,A="charCodeAt",v="slice",x="replace";for(o[v](-2),o=o[v](0,-2)[x](/\s/g,"")[x]("z","!!!!!"),d=[],u=0,h=(o+=l="uuuuu"[v](o[f]%5||5))[f];h>u;u+=5)c=52200625*(o[A](u)-33)+614125*(o[A](u+1)-33)+7225*(o[A](u+2)-33)+85*(o[A](u+3)-33)+(o[A](u+4)-33),d.push(p&c>>24,p&c>>16,p&c>>8,p&c);return function(b,y){for(var w=y;w>0;w--)b.pop()}(d,l[f]),m.fromCharCode.apply(m,d)},s=function(o){return o.split("").map(function(l){return("0"+l.charCodeAt().toString(16)).slice(-2)}).join("")+">"},a=function(o){var l=new RegExp(/^([0-9A-Fa-f]{2})+$/);if((o=o.replace(/\s/g,"")).indexOf(">")!==-1&&(o=o.substr(0,o.indexOf(">"))),o.length%2&&(o+="0"),l.test(o)===!1)return"";for(var c="",d=0;d<o.length;d+=2)c+=String.fromCharCode("0x"+(o[d]+o[d+1]));return c},i=function(o){for(var l=new Uint8Array(o.length),c=o.length;c--;)l[c]=o.charCodeAt(c);return(l=yP(l)).reduce(function(d,u){return d+String.fromCharCode(u)},"")};e.processDataByFilters=function(o,l){var c=0,d=o||"",u=[];for(typeof(l=l||[])=="string"&&(l=[l]),c=0;c<l.length;c+=1)switch(l[c]){case"ASCII85Decode":case"/ASCII85Decode":d=r(d),u.push("/ASCII85Encode");break;case"ASCII85Encode":case"/ASCII85Encode":d=t(d),u.push("/ASCII85Decode");break;case"ASCIIHexDecode":case"/ASCIIHexDecode":d=a(d),u.push("/ASCIIHexEncode");break;case"ASCIIHexEncode":case"/ASCIIHexEncode":d=s(d),u.push("/ASCIIHexDecode");break;case"FlateEncode":case"/FlateEncode":d=i(d),u.push("/FlateDecode");break;default:throw new Error('The filter: "'+l[c]+'" is not implemented')}return{data:d,reverseChain:u.reverse().join(" ")}}}(Wt.API),function(e){e.loadFile=function(t,r,s){return function(a,i,o){i=i!==!1,o=typeof o=="function"?o:function(){};var l=void 0;try{l=function(c,d,u){var h=new XMLHttpRequest,m=0,f=function(p){var A=p.length,v=[],x=String.fromCharCode;for(m=0;m<A;m+=1)v.push(x(255&p.charCodeAt(m)));return v.join("")};if(h.open("GET",c,!d),h.overrideMimeType("text/plain; charset=x-user-defined"),d===!1&&(h.onload=function(){h.status===200?u(f(this.responseText)):u(void 0)}),h.send(null),d&&h.status===200)return f(h.responseText)}(a,i,o)}catch{}return l}(t,r,s)},e.loadImageFile=e.loadFile}(Wt.API),function(e){function t(){return(jr.html2canvas?Promise.resolve(jr.html2canvas):hs(()=>Promise.resolve().then(()=>Dat),void 0)).catch(function(l){return Promise.reject(new Error("Could not load html2canvas: "+l))}).then(function(l){return l.default?l.default:l})}function r(){return(jr.DOMPurify?Promise.resolve(jr.DOMPurify):hs(()=>import("./purify.es-BgtpMKW3.js"),[])).catch(function(l){return Promise.reject(new Error("Could not load dompurify: "+l))}).then(function(l){return l.default?l.default:l})}var s=function(l){var c=On(l);return c==="undefined"?"undefined":c==="string"||l instanceof String?"string":c==="number"||l instanceof Number?"number":c==="function"||l instanceof Function?"function":l&&l.constructor===Array?"array":l&&l.nodeType===1?"element":c==="object"?"object":"unknown"},a=function(l,c){var d=document.createElement(l);for(var u in c.className&&(d.className=c.className),c.innerHTML&&c.dompurify&&(d.innerHTML=c.dompurify.sanitize(c.innerHTML)),c.style)d.style[u]=c.style[u];return d},i=function l(c,d){for(var u=c.nodeType===3?document.createTextNode(c.nodeValue):c.cloneNode(!1),h=c.firstChild;h;h=h.nextSibling)d!==!0&&h.nodeType===1&&h.nodeName==="SCRIPT"||u.appendChild(l(h,d));return c.nodeType===1&&(c.nodeName==="CANVAS"?(u.width=c.width,u.height=c.height,u.getContext("2d").drawImage(c,0,0)):c.nodeName!=="TEXTAREA"&&c.nodeName!=="SELECT"||(u.value=c.value),u.addEventListener("load",function(){u.scrollTop=c.scrollTop,u.scrollLeft=c.scrollLeft},!0)),u},o=function l(c){var d=Object.assign(l.convert(Promise.resolve()),JSON.parse(JSON.stringify(l.template))),u=l.convert(Promise.resolve(),d);return(u=u.setProgress(1,l,1,[l])).set(c)};(o.prototype=Object.create(Promise.prototype)).constructor=o,o.convert=function(l,c){return l.__proto__=c||o.prototype,l},o.template={prop:{src:null,container:null,overlay:null,canvas:null,img:null,pdf:null,pageSize:null,callback:function(){}},progress:{val:0,state:null,n:0,stack:[]},opt:{filename:"file.pdf",margin:[0,0,0,0],enableLinks:!0,x:0,y:0,html2canvas:{},jsPDF:{},backgroundColor:"transparent"}},o.prototype.from=function(l,c){return this.then(function(){switch(c=c||function(d){switch(s(d)){case"string":return"string";case"element":return d.nodeName.toLowerCase()==="canvas"?"canvas":"element";default:return"unknown"}}(l),c){case"string":return this.then(r).then(function(d){return this.set({src:a("div",{innerHTML:l,dompurify:d})})});case"element":return this.set({src:l});case"canvas":return this.set({canvas:l});case"img":return this.set({img:l});default:return this.error("Unknown source type.")}})},o.prototype.to=function(l){switch(l){case"container":return this.toContainer();case"canvas":return this.toCanvas();case"img":return this.toImg();case"pdf":return this.toPdf();default:return this.error("Invalid target.")}},o.prototype.toContainer=function(){return this.thenList([function(){return this.prop.src||this.error("Cannot duplicate - no source HTML.")},function(){return this.prop.pageSize||this.setPageSize()}]).then(function(){var l={position:"relative",display:"inline-block",width:(typeof this.opt.width!="number"||isNaN(this.opt.width)||typeof this.opt.windowWidth!="number"||isNaN(this.opt.windowWidth)?Math.max(this.prop.src.clientWidth,this.prop.src.scrollWidth,this.prop.src.offsetWidth):this.opt.windowWidth)+"px",left:0,right:0,top:0,margin:"auto",backgroundColor:this.opt.backgroundColor},c=i(this.prop.src,this.opt.html2canvas.javascriptEnabled);c.tagName==="BODY"&&(l.height=Math.max(document.body.scrollHeight,document.body.offsetHeight,document.documentElement.clientHeight,document.documentElement.scrollHeight,document.documentElement.offsetHeight)+"px"),this.prop.overlay=a("div",{className:"html2pdf__overlay",style:{position:"fixed",overflow:"hidden",zIndex:1e3,left:"-100000px",right:0,bottom:0,top:0}}),this.prop.container=a("div",{className:"html2pdf__container",style:l}),this.prop.container.appendChild(c),this.prop.container.firstChild.appendChild(a("div",{style:{clear:"both",border:"0 none transparent",margin:0,padding:0,height:0}})),this.prop.container.style.float="none",this.prop.overlay.appendChild(this.prop.container),document.body.appendChild(this.prop.overlay),this.prop.container.firstChild.style.position="relative",this.prop.container.height=Math.max(this.prop.container.firstChild.clientHeight,this.prop.container.firstChild.scrollHeight,this.prop.container.firstChild.offsetHeight)+"px"})},o.prototype.toCanvas=function(){var l=[function(){return document.body.contains(this.prop.container)||this.toContainer()}];return this.thenList(l).then(t).then(function(c){var d=Object.assign({},this.opt.html2canvas);return delete d.onrendered,c(this.prop.container,d)}).then(function(c){(this.opt.html2canvas.onrendered||function(){})(c),this.prop.canvas=c,document.body.removeChild(this.prop.overlay)})},o.prototype.toContext2d=function(){var l=[function(){return document.body.contains(this.prop.container)||this.toContainer()}];return this.thenList(l).then(t).then(function(c){var d=this.opt.jsPDF,u=this.opt.fontFaces,h=typeof this.opt.width!="number"||isNaN(this.opt.width)||typeof this.opt.windowWidth!="number"||isNaN(this.opt.windowWidth)?1:this.opt.width/this.opt.windowWidth,m=Object.assign({async:!0,allowTaint:!0,scale:h,scrollX:this.opt.scrollX||0,scrollY:this.opt.scrollY||0,backgroundColor:"#ffffff",imageTimeout:15e3,logging:!0,proxy:null,removeContainer:!0,foreignObjectRendering:!1,useCORS:!1},this.opt.html2canvas);if(delete m.onrendered,d.context2d.autoPaging=this.opt.autoPaging===void 0||this.opt.autoPaging,d.context2d.posX=this.opt.x,d.context2d.posY=this.opt.y,d.context2d.margin=this.opt.margin,d.context2d.fontFaces=u,u)for(var f=0;f<u.length;++f){var p=u[f],A=p.src.find(function(v){return v.format==="truetype"});A&&d.addFont(A.url,p.ref.name,p.ref.style)}return m.windowHeight=m.windowHeight||0,m.windowHeight=m.windowHeight==0?Math.max(this.prop.container.clientHeight,this.prop.container.scrollHeight,this.prop.container.offsetHeight):m.windowHeight,d.context2d.save(!0),c(this.prop.container,m)}).then(function(c){this.opt.jsPDF.context2d.restore(!0),(this.opt.html2canvas.onrendered||function(){})(c),this.prop.canvas=c,document.body.removeChild(this.prop.overlay)})},o.prototype.toImg=function(){return this.thenList([function(){return this.prop.canvas||this.toCanvas()}]).then(function(){var l=this.prop.canvas.toDataURL("image/"+this.opt.image.type,this.opt.image.quality);this.prop.img=document.createElement("img"),this.prop.img.src=l})},o.prototype.toPdf=function(){return this.thenList([function(){return this.toContext2d()}]).then(function(){this.prop.pdf=this.prop.pdf||this.opt.jsPDF})},o.prototype.output=function(l,c,d){return(d=d||"pdf").toLowerCase()==="img"||d.toLowerCase()==="image"?this.outputImg(l,c):this.outputPdf(l,c)},o.prototype.outputPdf=function(l,c){return this.thenList([function(){return this.prop.pdf||this.toPdf()}]).then(function(){return this.prop.pdf.output(l,c)})},o.prototype.outputImg=function(l){return this.thenList([function(){return this.prop.img||this.toImg()}]).then(function(){switch(l){case void 0:case"img":return this.prop.img;case"datauristring":case"dataurlstring":return this.prop.img.src;case"datauri":case"dataurl":return document.location.href=this.prop.img.src;default:throw'Image output type "'+l+'" is not supported.'}})},o.prototype.save=function(l){return this.thenList([function(){return this.prop.pdf||this.toPdf()}]).set(l?{filename:l}:null).then(function(){this.prop.pdf.save(this.opt.filename)})},o.prototype.doCallback=function(){return this.thenList([function(){return this.prop.pdf||this.toPdf()}]).then(function(){this.prop.callback(this.prop.pdf)})},o.prototype.set=function(l){if(s(l)!=="object")return this;var c=Object.keys(l||{}).map(function(d){if(d in o.template.prop)return function(){this.prop[d]=l[d]};switch(d){case"margin":return this.setMargin.bind(this,l.margin);case"jsPDF":return function(){return this.opt.jsPDF=l.jsPDF,this.setPageSize()};case"pageSize":return this.setPageSize.bind(this,l.pageSize);default:return function(){this.opt[d]=l[d]}}},this);return this.then(function(){return this.thenList(c)})},o.prototype.get=function(l,c){return this.then(function(){var d=l in o.template.prop?this.prop[l]:this.opt[l];return c?c(d):d})},o.prototype.setMargin=function(l){return this.then(function(){switch(s(l)){case"number":l=[l,l,l,l];case"array":if(l.length===2&&(l=[l[0],l[1],l[0],l[1]]),l.length===4)break;default:return this.error("Invalid margin array.")}this.opt.margin=l}).then(this.setPageSize)},o.prototype.setPageSize=function(l){function c(d,u){return Math.floor(d*u/72*96)}return this.then(function(){(l=l||Wt.getPageSize(this.opt.jsPDF)).hasOwnProperty("inner")||(l.inner={width:l.width-this.opt.margin[1]-this.opt.margin[3],height:l.height-this.opt.margin[0]-this.opt.margin[2]},l.inner.px={width:c(l.inner.width,l.k),height:c(l.inner.height,l.k)},l.inner.ratio=l.inner.height/l.inner.width),this.prop.pageSize=l})},o.prototype.setProgress=function(l,c,d,u){return l!=null&&(this.progress.val=l),c!=null&&(this.progress.state=c),d!=null&&(this.progress.n=d),u!=null&&(this.progress.stack=u),this.progress.ratio=this.progress.val/this.progress.state,this},o.prototype.updateProgress=function(l,c,d,u){return this.setProgress(l?this.progress.val+l:null,c||null,d?this.progress.n+d:null,u?this.progress.stack.concat(u):null)},o.prototype.then=function(l,c){var d=this;return this.thenCore(l,c,function(u,h){return d.updateProgress(null,null,1,[u]),Promise.prototype.then.call(this,function(m){return d.updateProgress(null,u),m}).then(u,h).then(function(m){return d.updateProgress(1),m})})},o.prototype.thenCore=function(l,c,d){d=d||Promise.prototype.then;var u=this;l&&(l=l.bind(u)),c&&(c=c.bind(u));var h=Promise.toString().indexOf("[native code]")!==-1&&Promise.name==="Promise"?u:o.convert(Object.assign({},u),Promise.prototype),m=d.call(h,l,c);return o.convert(m,u.__proto__)},o.prototype.thenExternal=function(l,c){return Promise.prototype.then.call(this,l,c)},o.prototype.thenList=function(l){var c=this;return l.forEach(function(d){c=c.thenCore(d)}),c},o.prototype.catch=function(l){l&&(l=l.bind(this));var c=Promise.prototype.catch.call(this,l);return o.convert(c,this)},o.prototype.catchExternal=function(l){return Promise.prototype.catch.call(this,l)},o.prototype.error=function(l){return this.then(function(){throw new Error(l)})},o.prototype.using=o.prototype.set,o.prototype.saveAs=o.prototype.save,o.prototype.export=o.prototype.output,o.prototype.run=o.prototype.then,Wt.getPageSize=function(l,c,d){if(On(l)==="object"){var u=l;l=u.orientation,c=u.unit||c,d=u.format||d}c=c||"mm",d=d||"a4",l=(""+(l||"P")).toLowerCase();var h,m=(""+d).toLowerCase(),f={a0:[2383.94,3370.39],a1:[1683.78,2383.94],a2:[1190.55,1683.78],a3:[841.89,1190.55],a4:[595.28,841.89],a5:[419.53,595.28],a6:[297.64,419.53],a7:[209.76,297.64],a8:[147.4,209.76],a9:[104.88,147.4],a10:[73.7,104.88],b0:[2834.65,4008.19],b1:[2004.09,2834.65],b2:[1417.32,2004.09],b3:[1000.63,1417.32],b4:[708.66,1000.63],b5:[498.9,708.66],b6:[354.33,498.9],b7:[249.45,354.33],b8:[175.75,249.45],b9:[124.72,175.75],b10:[87.87,124.72],c0:[2599.37,3676.54],c1:[1836.85,2599.37],c2:[1298.27,1836.85],c3:[918.43,1298.27],c4:[649.13,918.43],c5:[459.21,649.13],c6:[323.15,459.21],c7:[229.61,323.15],c8:[161.57,229.61],c9:[113.39,161.57],c10:[79.37,113.39],dl:[311.81,623.62],letter:[612,792],"government-letter":[576,756],legal:[612,1008],"junior-legal":[576,360],ledger:[1224,792],tabloid:[792,1224],"credit-card":[153,243]};switch(c){case"pt":h=1;break;case"mm":h=72/25.4;break;case"cm":h=72/2.54;break;case"in":h=72;break;case"px":h=.75;break;case"pc":case"em":h=12;break;case"ex":h=6;break;default:throw"Invalid unit: "+c}var p,A=0,v=0;if(f.hasOwnProperty(m))A=f[m][1]/h,v=f[m][0]/h;else try{A=d[1],v=d[0]}catch{throw new Error("Invalid format: "+d)}if(l==="p"||l==="portrait")l="p",v>A&&(p=v,v=A,A=p);else{if(l!=="l"&&l!=="landscape")throw"Invalid orientation: "+l;l="l",A>v&&(p=v,v=A,A=p)}return{width:v,height:A,unit:c,k:h,orientation:l}},e.html=function(l,c){(c=c||{}).callback=c.callback||function(){},c.html2canvas=c.html2canvas||{},c.html2canvas.canvas=c.html2canvas.canvas||this.canvas,c.jsPDF=c.jsPDF||this,c.fontFaces=c.fontFaces?c.fontFaces.map(s4):null;var d=new o(c);return c.worker?d:d.from(l).doCallback()}}(Wt.API),Wt.API.addJS=function(e){return dz=e,this.internal.events.subscribe("postPutResources",function(){Z1=this.internal.newObject(),this.internal.out("<<"),this.internal.out("/Names [(EmbeddedJS) "+(Z1+1)+" 0 R]"),this.internal.out(">>"),this.internal.out("endobj"),cz=this.internal.newObject(),this.internal.out("<<"),this.internal.out("/S /JavaScript"),this.internal.out("/JS ("+dz+")"),this.internal.out(">>"),this.internal.out("endobj")}),this.internal.events.subscribe("putCatalog",function(){Z1!==void 0&&cz!==void 0&&this.internal.out("/Names <</JavaScript "+Z1+" 0 R>>")}),this},function(e){var t;e.events.push(["postPutResources",function(){var r=this,s=/^(\d+) 0 obj$/;if(this.outline.root.children.length>0)for(var a=r.outline.render().split(/\r\n/),i=0;i<a.length;i++){var o=a[i],l=s.exec(o);if(l!=null){var c=l[1];r.internal.newObjectDeferredBegin(c,!1)}r.internal.write(o)}if(this.outline.createNamedDestinations){var d=this.internal.pages.length,u=[];for(i=0;i<d;i++){var h=r.internal.newObject();u.push(h);var m=r.internal.getPageInfo(i+1);r.internal.write("<< /D["+m.objId+" 0 R /XYZ null null null]>> endobj")}var f=r.internal.newObject();for(r.internal.write("<< /Names [ "),i=0;i<u.length;i++)r.internal.write("(page_"+(i+1)+")"+u[i]+" 0 R");r.internal.write(" ] >>","endobj"),t=r.internal.newObject(),r.internal.write("<< /Dests "+f+" 0 R"),r.internal.write(">>","endobj")}}]),e.events.push(["putCatalog",function(){var r=this;r.outline.root.children.length>0&&(r.internal.write("/Outlines",this.outline.makeRef(this.outline.root)),this.outline.createNamedDestinations&&r.internal.write("/Names "+t+" 0 R"))}]),e.events.push(["initialized",function(){var r=this;r.outline={createNamedDestinations:!1,root:{children:[]}},r.outline.add=function(s,a,i){var o={title:a,options:i,children:[]};return s==null&&(s=this.root),s.children.push(o),o},r.outline.render=function(){return this.ctx={},this.ctx.val="",this.ctx.pdf=r,this.genIds_r(this.root),this.renderRoot(this.root),this.renderItems(this.root),this.ctx.val},r.outline.genIds_r=function(s){s.id=r.internal.newObjectDeferred();for(var a=0;a<s.children.length;a++)this.genIds_r(s.children[a])},r.outline.renderRoot=function(s){this.objStart(s),this.line("/Type /Outlines"),s.children.length>0&&(this.line("/First "+this.makeRef(s.children[0])),this.line("/Last "+this.makeRef(s.children[s.children.length-1]))),this.line("/Count "+this.count_r({count:0},s)),this.objEnd()},r.outline.renderItems=function(s){for(var a=this.ctx.pdf.internal.getVerticalCoordinateString,i=0;i<s.children.length;i++){var o=s.children[i];this.objStart(o),this.line("/Title "+this.makeString(o.title)),this.line("/Parent "+this.makeRef(s)),i>0&&this.line("/Prev "+this.makeRef(s.children[i-1])),i<s.children.length-1&&this.line("/Next "+this.makeRef(s.children[i+1])),o.children.length>0&&(this.line("/First "+this.makeRef(o.children[0])),this.line("/Last "+this.makeRef(o.children[o.children.length-1])));var l=this.count=this.count_r({count:0},o);if(l>0&&this.line("/Count "+l),o.options&&o.options.pageNumber){var c=r.internal.getPageInfo(o.options.pageNumber);this.line("/Dest ["+c.objId+" 0 R /XYZ 0 "+a(0)+" 0]")}this.objEnd()}for(var d=0;d<s.children.length;d++)this.renderItems(s.children[d])},r.outline.line=function(s){this.ctx.val+=s+`\r
1582`},r.outline.makeRef=function(s){return s.id+" 0 R"},r.outline.makeString=function(s){return"("+r.internal.pdfEscape(s)+")"},r.outline.objStart=function(s){this.ctx.val+=`\r
1583`+s.id+` 0 obj\r
1584<<\r
1585`},r.outline.objEnd=function(){this.ctx.val+=`>> \r
1586endobj\r
1587`},r.outline.count_r=function(s,a){for(var i=0;i<a.children.length;i++)s.count++,this.count_r(s,a.children[i]);return s.count}}])}(Wt.API),function(e){var t=[192,193,194,195,196,197,198,199];e.processJPEG=function(r,s,a,i,o,l){var c,d=this.decode.DCT_DECODE,u=null;if(typeof r=="string"||this.__addimage__.isArrayBuffer(r)||this.__addimage__.isArrayBufferView(r)){switch(r=o||r,r=this.__addimage__.isArrayBuffer(r)?new Uint8Array(r):r,c=function(h){for(var m,f=256*h.charCodeAt(4)+h.charCodeAt(5),p=h.length,A={width:0,height:0,numcomponents:1},v=4;v<p;v+=2){if(v+=f,t.indexOf(h.charCodeAt(v+1))!==-1){m=256*h.charCodeAt(v+5)+h.charCodeAt(v+6),A={width:256*h.charCodeAt(v+7)+h.charCodeAt(v+8),height:m,numcomponents:h.charCodeAt(v+9)};break}f=256*h.charCodeAt(v+2)+h.charCodeAt(v+3)}return A}(r=this.__addimage__.isArrayBufferView(r)?this.__addimage__.arrayBufferToBinaryString(r):r),c.numcomponents){case 1:l=this.color_spaces.DEVICE_GRAY;break;case 4:l=this.color_spaces.DEVICE_CMYK;break;case 3:l=this.color_spaces.DEVICE_RGB}u={data:r,width:c.width,height:c.height,colorSpace:l,bitsPerComponent:8,filter:d,index:s,alias:a}}return u}}(Wt.API),Wt.API.processPNG=function(e,t,r,s){if(this.__addimage__.isArrayBuffer(e)&&(e=new Uint8Array(e)),this.__addimage__.isArrayBufferView(e)){var a,i=Hot(e,{checkCrc:!0}),o=i.width,l=i.height,c=i.channels,d=i.palette,u=i.depth;a=d&&c===1?function(S){for(var C=S.width,E=S.height,T=S.data,B=S.palette,L=S.depth,P=!1,F=[],M=[],I=void 0,$=!1,V=0,R=0;R<B.length;R++){var Q=m9(B[R],4),U=Q[0],D=Q[1],q=Q[2],G=Q[3];F.push(U,D,q),G!=null&&(G===0?(V++,M.length<1&&M.push(R)):G<255&&($=!0))}if($||V>1){P=!0,M=void 0;var Y=C*E;I=new Uint8Array(Y);for(var K=new DataView(T.buffer),X=0;X<Y;X++){var ne=i4(K,X,L),ae=m9(B[ne],4)[3];I[X]=ae}}else V===0&&(M=void 0);return{colorSpace:"Indexed",colorsPerPixel:1,sMaskBitsPerComponent:P?8:void 0,colorBytes:T,alphaBytes:I,needSMask:P,palette:F,mask:M}}(i):c===2||c===4?function(S){for(var C=S.data,E=S.width,T=S.height,B=S.channels,L=S.depth,P=B===2?"DeviceGray":"DeviceRGB",F=B-1,M=E*T,I=F,$=M*I,V=1*M,R=Math.ceil($*L/8),Q=Math.ceil(V*L/8),U=new Uint8Array(R),D=new Uint8Array(Q),q=new DataView(C.buffer),G=new DataView(U.buffer),Y=new DataView(D.buffer),K=!1,X=0;X<M;X++){for(var ne=X*B,ae=0;ae<I;ae++)vz(G,i4(q,ne+ae,L),X*I+ae,L);var J=i4(q,ne+I,L);J<(1<<L)-1&&(K=!0),vz(Y,J,1*X,L)}return{colorSpace:P,colorsPerPixel:F,sMaskBitsPerComponent:K?L:void 0,colorBytes:U,alphaBytes:D,needSMask:K}}(i):function(S){var C=S.data,E=S.channels===1?"DeviceGray":"DeviceRGB";return{colorSpace:E,colorsPerPixel:E==="DeviceGray"?1:3,colorBytes:C instanceof Uint16Array?function(T){for(var B=T.length,L=new Uint8Array(2*B),P=new DataView(L.buffer,L.byteOffset,L.byteLength),F=0;F<B;F++)P.setUint16(2*F,T[F],!1);return L}(C):C,needSMask:!1}}(i);var h,m,f,p=a,A=p.colorSpace,v=p.colorsPerPixel,x=p.sMaskBitsPerComponent,b=p.colorBytes,y=p.alphaBytes,w=p.needSMask,j=p.palette,N=p.mask,_=null;return s!==Wt.API.image_compression.NONE&&typeof yP=="function"?(_=function(S){var C;switch(S){case Wt.API.image_compression.FAST:C=11;break;case Wt.API.image_compression.MEDIUM:C=13;break;case Wt.API.image_compression.SLOW:C=14;break;default:C=12}return C}(s),h=this.decode.FLATE_DECODE,m="/Predictor ".concat(_," /Colors ").concat(v," /BitsPerComponent ").concat(u," /Columns ").concat(o),e=mz(b,Math.ceil(o*v*u/8),v,u,s),w&&(f=mz(y,Math.ceil(o*x/8),1,x,s))):(h=void 0,m=void 0,e=b,w&&(f=y)),(this.__addimage__.isArrayBuffer(e)||this.__addimage__.isArrayBufferView(e))&&(e=this.__addimage__.arrayBufferToBinaryString(e)),(f&&this.__addimage__.isArrayBuffer(f)||this.__addimage__.isArrayBufferView(f))&&(f=this.__addimage__.arrayBufferToBinaryString(f)),{alias:r,data:e,index:t,filter:h,decodeParameters:m,transparency:N,palette:j,sMask:f,predictor:_,width:o,height:l,bitsPerComponent:u,sMaskBitsPerComponent:x,colorSpace:A}}},function(e){e.processGIF89A=function(t,r,s,a){var i=new dlt(t),o=i.width,l=i.height,c=[];i.decodeAndBlitFrameRGBA(0,c);var d={data:c,width:o,height:l},u=new o4(100).encode(d,100);return e.processJPEG.call(this,u,r,s,a)},e.processGIF87A=e.processGIF89A}(Wt.API),sc.prototype.parseHeader=function(){if(this.fileSize=this.datav.getUint32(this.pos,!0),this.pos+=4,this.reserved=this.datav.getUint32(this.pos,!0),this.pos+=4,this.offset=this.datav.getUint32(this.pos,!0),this.pos+=4,this.headerSize=this.datav.getUint32(this.pos,!0),this.pos+=4,this.width=this.datav.getUint32(this.pos,!0),this.pos+=4,this.height=this.datav.getInt32(this.pos,!0),this.pos+=4,this.planes=this.datav.getUint16(this.pos,!0),this.pos+=2,this.bitPP=this.datav.getUint16(this.pos,!0),this.pos+=2,this.compress=this.datav.getUint32(this.pos,!0),this.pos+=4,this.rawSize=this.datav.getUint32(this.pos,!0),this.pos+=4,this.hr=this.datav.getUint32(this.pos,!0),this.pos+=4,this.vr=this.datav.getUint32(this.pos,!0),this.pos+=4,this.colors=this.datav.getUint32(this.pos,!0),this.pos+=4,this.importantColors=this.datav.getUint32(this.pos,!0),this.pos+=4,this.bitPP===16&&this.is_with_alpha&&(this.bitPP=15),this.bitPP<15){var e=this.colors===0?1<<this.bitPP:this.colors;this.palette=new Array(e);for(var t=0;t<e;t++){var r=this.datav.getUint8(this.pos++,!0),s=this.datav.getUint8(this.pos++,!0),a=this.datav.getUint8(this.pos++,!0),i=this.datav.getUint8(this.pos++,!0);this.palette[t]={red:a,green:s,blue:r,quad:i}}}this.height<0&&(this.height*=-1,this.bottom_up=!1)},sc.prototype.parseBGR=function(){this.pos=this.offset;try{var e="bit"+this.bitPP,t=this.width*this.height*4;this.data=new Uint8Array(t),this[e]()}catch(r){zn.log("bit decode error:"+r)}},sc.prototype.bit1=function(){var e,t=Math.ceil(this.width/8),r=t%4;for(e=this.height-1;e>=0;e--){for(var s=this.bottom_up?e:this.height-1-e,a=0;a<t;a++)for(var i=this.datav.getUint8(this.pos++,!0),o=s*this.width*4+8*a*4,l=0;l<8&&8*a+l<this.width;l++){var c=this.palette[i>>7-l&1];this.data[o+4*l]=c.blue,this.data[o+4*l+1]=c.green,this.data[o+4*l+2]=c.red,this.data[o+4*l+3]=255}r!==0&&(this.pos+=4-r)}},sc.prototype.bit4=function(){for(var e=Math.ceil(this.width/2),t=e%4,r=this.height-1;r>=0;r--){for(var s=this.bottom_up?r:this.height-1-r,a=0;a<e;a++){var i=this.datav.getUint8(this.pos++,!0),o=s*this.width*4+2*a*4,l=i>>4,c=15&i,d=this.palette[l];if(this.data[o]=d.blue,this.data[o+1]=d.green,this.data[o+2]=d.red,this.data[o+3]=255,2*a+1>=this.width)break;d=this.palette[c],this.data[o+4]=d.blue,this.data[o+4+1]=d.green,this.data[o+4+2]=d.red,this.data[o+4+3]=255}t!==0&&(this.pos+=4-t)}},sc.prototype.bit8=function(){for(var e=this.width%4,t=this.height-1;t>=0;t--){for(var r=this.bottom_up?t:this.height-1-t,s=0;s<this.width;s++){var a=this.datav.getUint8(this.pos++,!0),i=r*this.width*4+4*s;if(a<this.palette.length){var o=this.palette[a];this.data[i]=o.red,this.data[i+1]=o.green,this.data[i+2]=o.blue,this.data[i+3]=255}else this.data[i]=255,this.data[i+1]=255,this.data[i+2]=255,this.data[i+3]=255}e!==0&&(this.pos+=4-e)}},sc.prototype.bit15=function(){for(var e=this.width%3,t=parseInt("11111",2),r=this.height-1;r>=0;r--){for(var s=this.bottom_up?r:this.height-1-r,a=0;a<this.width;a++){var i=this.datav.getUint16(this.pos,!0);this.pos+=2;var o=(i&t)/t*255|0,l=(i>>5&t)/t*255|0,c=(i>>10&t)/t*255|0,d=i>>15?255:0,u=s*this.width*4+4*a;this.data[u]=c,this.data[u+1]=l,this.data[u+2]=o,this.data[u+3]=d}this.pos+=e}},sc.prototype.bit16=function(){for(var e=this.width%3,t=parseInt("11111",2),r=parseInt("111111",2),s=this.height-1;s>=0;s--){for(var a=this.bottom_up?s:this.height-1-s,i=0;i<this.width;i++){var o=this.datav.getUint16(this.pos,!0);this.pos+=2;var l=(o&t)/t*255|0,c=(o>>5&r)/r*255|0,d=(o>>11)/t*255|0,u=a*this.width*4+4*i;this.data[u]=d,this.data[u+1]=c,this.data[u+2]=l,this.data[u+3]=255}this.pos+=e}},sc.prototype.bit24=function(){for(var e=this.height-1;e>=0;e--){for(var t=this.bottom_up?e:this.height-1-e,r=0;r<this.width;r++){var s=this.datav.getUint8(this.pos++,!0),a=this.datav.getUint8(this.pos++,!0),i=this.datav.getUint8(this.pos++,!0),o=t*this.width*4+4*r;this.data[o]=i,this.data[o+1]=a,this.data[o+2]=s,this.data[o+3]=255}this.pos+=this.width%4}},sc.prototype.bit32=function(){for(var e=this.height-1;e>=0;e--)for(var t=this.bottom_up?e:this.height-1-e,r=0;r<this.width;r++){var s=this.datav.getUint8(this.pos++,!0),a=this.datav.getUint8(this.pos++,!0),i=this.datav.getUint8(this.pos++,!0),o=this.datav.getUint8(this.pos++,!0),l=t*this.width*4+4*r;this.data[l]=i,this.data[l+1]=a,this.data[l+2]=s,this.data[l+3]=o}},sc.prototype.getData=function(){return this.data},function(e){e.processBMP=function(t,r,s,a){var i=new sc(t,!1),o=i.width,l=i.height,c={data:i.getData(),width:o,height:l},d=new o4(100).encode(c,100);return e.processJPEG.call(this,d,r,s,a)}}(Wt.API),yz.prototype.getData=function(){return this.data},function(e){e.processWEBP=function(t,r,s,a){var i=new yz(t),o=i.width,l=i.height,c={data:i.getData(),width:o,height:l},d=new o4(100).encode(c,100);return e.processJPEG.call(this,d,r,s,a)}}(Wt.API),Wt.API.processRGBA=function(e,t,r){for(var s=e.data,a=s.length,i=new Uint8Array(a/4*3),o=new Uint8Array(a/4),l=0,c=0,d=0;d<a;d+=4){var u=s[d],h=s[d+1],m=s[d+2],f=s[d+3];i[l++]=u,i[l++]=h,i[l++]=m,o[c++]=f}var p=this.__addimage__.arrayBufferToBinaryString(i);return{alpha:this.__addimage__.arrayBufferToBinaryString(o),data:p,index:t,alias:r,colorSpace:"DeviceRGB",bitsPerComponent:8,width:e.width,height:e.height}},Wt.API.setLanguage=function(e){return this.internal.languageSettings===void 0&&(this.internal.languageSettings={},this.internal.languageSettings.isSubscribed=!1),{af:"Afrikaans",sq:"Albanian",ar:"Arabic (Standard)","ar-DZ":"Arabic (Algeria)","ar-BH":"Arabic (Bahrain)","ar-EG":"Arabic (Egypt)","ar-IQ":"Arabic (Iraq)","ar-JO":"Arabic (Jordan)","ar-KW":"Arabic (Kuwait)","ar-LB":"Arabic (Lebanon)","ar-LY":"Arabic (Libya)","ar-MA":"Arabic (Morocco)","ar-OM":"Arabic (Oman)","ar-QA":"Arabic (Qatar)","ar-SA":"Arabic (Saudi Arabia)","ar-SY":"Arabic (Syria)","ar-TN":"Arabic (Tunisia)","ar-AE":"Arabic (U.A.E.)","ar-YE":"Arabic (Yemen)",an:"Aragonese",hy:"Armenian",as:"Assamese",ast:"Asturian",az:"Azerbaijani",eu:"Basque",be:"Belarusian",bn:"Bengali",bs:"Bosnian",br:"Breton",bg:"Bulgarian",my:"Burmese",ca:"Catalan",ch:"Chamorro",ce:"Chechen",zh:"Chinese","zh-HK":"Chinese (Hong Kong)","zh-CN":"Chinese (PRC)","zh-SG":"Chinese (Singapore)","zh-TW":"Chinese (Taiwan)",cv:"Chuvash",co:"Corsican",cr:"Cree",hr:"Croatian",cs:"Czech",da:"Danish",nl:"Dutch (Standard)","nl-BE":"Dutch (Belgian)",en:"English","en-AU":"English (Australia)","en-BZ":"English (Belize)","en-CA":"English (Canada)","en-IE":"English (Ireland)","en-JM":"English (Jamaica)","en-NZ":"English (New Zealand)","en-PH":"English (Philippines)","en-ZA":"English (South Africa)","en-TT":"English (Trinidad & Tobago)","en-GB":"English (United Kingdom)","en-US":"English (United States)","en-ZW":"English (Zimbabwe)",eo:"Esperanto",et:"Estonian",fo:"Faeroese",fj:"Fijian",fi:"Finnish",fr:"French (Standard)","fr-BE":"French (Belgium)","fr-CA":"French (Canada)","fr-FR":"French (France)","fr-LU":"French (Luxembourg)","fr-MC":"French (Monaco)","fr-CH":"French (Switzerland)",fy:"Frisian",fur:"Friulian",gd:"Gaelic (Scots)","gd-IE":"Gaelic (Irish)",gl:"Galacian",ka:"Georgian",de:"German (Standard)","de-AT":"German (Austria)","de-DE":"German (Germany)","de-LI":"German (Liechtenstein)","de-LU":"German (Luxembourg)","de-CH":"German (Switzerland)",el:"Greek",gu:"Gujurati",ht:"Haitian",he:"Hebrew",hi:"Hindi",hu:"Hungarian",is:"Icelandic",id:"Indonesian",iu:"Inuktitut",ga:"Irish",it:"Italian (Standard)","it-CH":"Italian (Switzerland)",ja:"Japanese",kn:"Kannada",ks:"Kashmiri",kk:"Kazakh",km:"Khmer",ky:"Kirghiz",tlh:"Klingon",ko:"Korean","ko-KP":"Korean (North Korea)","ko-KR":"Korean (South Korea)",la:"Latin",lv:"Latvian",lt:"Lithuanian",lb:"Luxembourgish",mk:"North Macedonia",ms:"Malay",ml:"Malayalam",mt:"Maltese",mi:"Maori",mr:"Marathi",mo:"Moldavian",nv:"Navajo",ng:"Ndonga",ne:"Nepali",no:"Norwegian",nb:"Norwegian (Bokmal)",nn:"Norwegian (Nynorsk)",oc:"Occitan",or:"Oriya",om:"Oromo",fa:"Persian","fa-IR":"Persian/Iran",pl:"Polish",pt:"Portuguese","pt-BR":"Portuguese (Brazil)",pa:"Punjabi","pa-IN":"Punjabi (India)","pa-PK":"Punjabi (Pakistan)",qu:"Quechua",rm:"Rhaeto-Romanic",ro:"Romanian","ro-MO":"Romanian (Moldavia)",ru:"Russian","ru-MO":"Russian (Moldavia)",sz:"Sami (Lappish)",sg:"Sango",sa:"Sanskrit",sc:"Sardinian",sd:"Sindhi",si:"Singhalese",sr:"Serbian",sk:"Slovak",sl:"Slovenian",so:"Somani",sb:"Sorbian",es:"Spanish","es-AR":"Spanish (Argentina)","es-BO":"Spanish (Bolivia)","es-CL":"Spanish (Chile)","es-CO":"Spanish (Colombia)","es-CR":"Spanish (Costa Rica)","es-DO":"Spanish (Dominican Republic)","es-EC":"Spanish (Ecuador)","es-SV":"Spanish (El Salvador)","es-GT":"Spanish (Guatemala)","es-HN":"Spanish (Honduras)","es-MX":"Spanish (Mexico)","es-NI":"Spanish (Nicaragua)","es-PA":"Spanish (Panama)","es-PY":"Spanish (Paraguay)","es-PE":"Spanish (Peru)","es-PR":"Spanish (Puerto Rico)","es-ES":"Spanish (Sp
1587ain)","es-UY":"Spanish (Uruguay)","es-VE":"Spanish (Venezuela)",sx:"Sutu",sw:"Swahili",sv:"Swedish","sv-FI":"Swedish (Finland)","sv-SV":"Swedish (Sweden)",ta:"Tamil",tt:"Tatar",te:"Teluga",th:"Thai",tig:"Tigre",ts:"Tsonga",tn:"Tswana",tr:"Turkish",tk:"Turkmen",uk:"Ukrainian",hsb:"Upper Sorbian",ur:"Urdu",ve:"Venda",vi:"Vietnamese",vo:"Volapuk",wa:"Walloon",cy:"Welsh",xh:"Xhosa",ji:"Yiddish",zu:"Zulu"}[e]!==void 0&&(this.internal.languageSettings.languageCode=e,this.internal.languageSettings.isSubscribed===!1&&(this.internal.events.subscribe("putCatalog",function(){this.internal.write("/Lang ("+this.internal.languageSettings.languageCode+")")}),this.internal.languageSettings.isSubscribed=!0)),this},Yp=Wt.API,ej=Yp.getCharWidthsArray=function(e,t){var r,s,a=(t=t||{}).font||this.internal.getFont(),i=t.fontSize||this.internal.getFontSize(),o=t.charSpace||this.internal.getCharSpace(),l=t.widths?t.widths:a.metadata.Unicode.widths,c=l.fof?l.fof:1,d=t.kerning?t.kerning:a.metadata.Unicode.kerning,u=d.fof?d.fof:1,h=t.doKerning!==!1,m=0,f=e.length,p=0,A=l[0]||c,v=[];for(r=0;r<f;r++)s=e.charCodeAt(r),typeof a.metadata.widthOfString=="function"?v.push((a.metadata.widthOfGlyph(a.metadata.characterToGlyph(s))+o*(1e3/i)||0)/1e3):(m=h&&On(d[s])==="object"&&!isNaN(parseInt(d[s][p],10))?d[s][p]/u:0,v.push((l[s]||A)/c+m)),p=s;return v},uz=Yp.getStringUnitWidth=function(e,t){var r=(t=t||{}).fontSize||this.internal.getFontSize(),s=t.font||this.internal.getFont(),a=t.charSpace||this.internal.getCharSpace();return Yp.processArabic&&(e=Yp.processArabic(e)),typeof s.metadata.widthOfString=="function"?s.metadata.widthOfString(e,r,a)/r:ej.apply(this,arguments).reduce(function(i,o){return i+o},0)},hz=function(e,t,r,s){for(var a=[],i=0,o=e.length,l=0;i!==o&&l+t[i]<r;)l+=t[i],i++;a.push(e.slice(0,i));var c=i;for(l=0;i!==o;)l+t[i]>s&&(a.push(e.slice(c,i)),l=0,c=i),l+=t[i],i++;return c!==i&&a.push(e.slice(c,i)),a},fz=function(e,t,r){r||(r={});var s,a,i,o,l,c,d,u=[],h=[u],m=r.textIndent||0,f=0,p=0,A=e.split(" "),v=ej.apply(this,[" ",r])[0];if(c=r.lineIndent===-1?A[0].length+2:r.lineIndent||0){var x=Array(c).join(" "),b=[];A.map(function(w){(w=w.split(/\s*\n/)).length>1?b=b.concat(w.map(function(j,N){return(N&&j.length?`
1588`:"")+j})):b.push(w[0])}),A=b,c=uz.apply(this,[x,r])}for(i=0,o=A.length;i<o;i++){var y=0;if(s=A[i],c&&s[0]==`
1589`&&(s=s.substr(1),y=1),m+f+(p=(a=ej.apply(this,[s,r])).reduce(function(w,j){return w+j},0))>t||y){if(p>t){for(l=hz.apply(this,[s,a,t-(m+f),t]),u.push(l.shift()),u=[l.pop()];l.length;)h.push([l.shift()]);p=a.slice(s.length-(u[0]?u[0].length:0)).reduce(function(w,j){return w+j},0)}else u=[s];h.push(u),m=p+c,f=v}else u.push(s),m+=f+p,f=v}return d=c?function(w,j){return(j?x:"")+w.join(" ")}:function(w){return w.join(" ")},h.map(d)},Yp.splitTextToSize=function(e,t,r){var s,a=(r=r||{}).fontSize||this.internal.getFontSize(),i=(function(u){if(u.widths&&u.kerning)return{widths:u.widths,kerning:u.kerning};var h=this.internal.getFont(u.fontName,u.fontStyle),m="Unicode";return h.metadata[m]?{widths:h.metadata[m].widths||{0:1},kerning:h.metadata[m].kerning||{}}:{font:h.metadata,fontSize:this.internal.getFontSize(),charSpace:this.internal.getCharSpace()}}).call(this,r);s=Array.isArray(e)?e:String(e).split(/\r?\n/);var o=1*this.internal.scaleFactor*t/a;i.textIndent=r.textIndent?1*r.textIndent*this.internal.scaleFactor/a:0,i.lineIndent=r.lineIndent;var l,c,d=[];for(l=0,c=s.length;l<c;l++)d=d.concat(fz.apply(this,[s[l],o,i]));return d},function(e){e.__fontmetrics__=e.__fontmetrics__||{};for(var t="0123456789abcdef",r="klmnopqrstuvwxyz",s={},a={},i=0;i<16;i++)s[r[i]]=t[i],a[t[i]]=r[i];var o=function(m){return"0x"+parseInt(m,10).toString(16)},l=e.__fontmetrics__.compress=function(m){var f,p,A,v,x=["{"];for(var b in m){if(f=m[b],isNaN(parseInt(b,10))?p="'"+b+"'":(b=parseInt(b,10),p=(p=o(b).slice(2)).slice(0,-1)+a[p.slice(-1)]),typeof f=="number")f<0?(A=o(f).slice(3),v="-"):(A=o(f).slice(2),v=""),A=v+A.slice(0,-1)+a[A.slice(-1)];else{if(On(f)!=="object")throw new Error("Don't know what to do with value type "+On(f)+".");A=l(f)}x.push(p+A)}return x.push("}"),x.join("")},c=e.__fontmetrics__.uncompress=function(m){if(typeof m!="string")throw new Error("Invalid argument passed to uncompress.");for(var f,p,A,v,x={},b=1,y=x,w=[],j="",N="",_=m.length-1,S=1;S<_;S+=1)(v=m[S])=="'"?f?(A=f.join(""),f=void 0):f=[]:f?f.push(v):v=="{"?(w.push([y,A]),y={},A=void 0):v=="}"?((p=w.pop())[0][p[1]]=y,A=void 0,y=p[0]):v=="-"?b=-1:A===void 0?s.hasOwnProperty(v)?(j+=s[v],A=parseInt(j,16)*b,b=1,j=""):j+=v:s.hasOwnProperty(v)?(N+=s[v],y[A]=parseInt(N,16)*b,b=1,A=void 0,N=""):N+=v;return x},d={codePages:["WinAnsiEncoding"],WinAnsiEncoding:c("{19m8n201n9q201o9r201s9l201t9m201u8m201w9n201x9o201y8o202k8q202l8r202m9p202q8p20aw8k203k8t203t8v203u9v2cq8s212m9t15m8w15n9w2dw9s16k8u16l9u17s9z17x8y17y9y}")},u={Unicode:{Courier:d,"Courier-Bold":d,"Courier-BoldOblique":d,"Courier-Oblique":d,Helvetica:d,"Helvetica-Bold":d,"Helvetica-BoldOblique":d,"Helvetica-Oblique":d,"Times-Roman":d,"Times-Bold":d,"Times-BoldItalic":d,"Times-Italic":d
vendor: 14,731 bytes, line 1589
1589}},h={Unicode:{"Courier-Oblique":c("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-BoldItalic":c("{'widths'{k3o2q4ycx2r201n3m201o6o201s2l201t2l201u2l201w3m201x3m201y3m2k1t2l2r202m2n2n3m2o3m2p5n202q6o2r1w2s2l2t2l2u3m2v3t2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w3t3x3t3y3t3z3m4k5n4l4m4m4m4n4m4o4s4p4m4q4m4r4s4s4y4t2r4u3m4v4m4w3x4x5t4y4s4z4s5k3x5l4s5m4m5n3r5o3x5p4s5q4m5r5t5s4m5t3x5u3x5v2l5w1w5x2l5y3t5z3m6k2l6l3m6m3m6n2w6o3m6p2w6q2l6r3m6s3r6t1w6u1w6v3m6w1w6x4y6y3r6z3m7k3m7l3m7m2r7n2r7o1w7p3r7q2w7r4m7s3m7t2w7u2r7v2n7w1q7x2n7y3t202l3mcl4mal2ram3man3mao3map3mar3mas2lat4uau1uav3maw3way4uaz2lbk2sbl3t'fof'6obo2lbp3tbq3mbr1tbs2lbu1ybv3mbz3mck4m202k3mcm4mcn4mco4mcp4mcq5ycr4mcs4mct4mcu4mcv4mcw2r2m3rcy2rcz2rdl4sdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek3mel3mem3men3meo3mep3meq4ser2wes2wet2weu2wev2wew1wex1wey1wez1wfl3rfm3mfn3mfo3mfp3mfq3mfr3tfs3mft3rfu3rfv3rfw3rfz2w203k6o212m6o2dw2l2cq2l3t3m3u2l17s3x19m3m}'kerning'{cl{4qu5kt5qt5rs17ss5ts}201s{201ss}201t{cks4lscmscnscoscpscls2wu2yu201ts}201x{2wu2yu}2k{201ts}2w{4qx5kx5ou5qx5rs17su5tu}2x{17su5tu5ou}2y{4qx5kx5ou5qx5rs17ss5ts}'fof'-6ofn{17sw5tw5ou5qw5rs}7t{cksclscmscnscoscps4ls}3u{17su5tu5os5qs}3v{17su5tu5os5qs}7p{17su5tu}ck{4qu5kt5qt5rs17ss5ts}4l{4qu5kt5qt5rs17ss5ts}cm{4qu5kt5qt5rs17ss5ts}cn{4qu5kt5qt5rs17ss5ts}co{4qu5kt5qt5rs17ss5ts}cp{4qu5kt5qt5rs17ss5ts}6l{4qu5ou5qw5rt17su5tu}5q{ckuclucmucnucoucpu4lu}5r{ckuclucmucnucoucpu4lu}7q{cksclscmscnscoscps4ls}6p{4qu5ou5qw5rt17sw5tw}ek{4qu5ou5qw5rt17su5tu}el{4qu5ou5qw5rt17su5tu}em{4qu5ou5qw5rt17su5tu}en{4qu5ou5qw5rt17su5tu}eo{4qu5ou5qw5rt17su5tu}ep{4qu5ou5qw5rt17su5tu}es{17ss5ts5qs4qu}et{4qu5ou5qw5rt17sw5tw}eu{4qu5ou5qw5rt17ss5ts}ev{17ss5ts5qs4qu}6z{17sw5tw5ou5qw5rs}fm{17sw5tw5ou5qw5rs}7n{201ts}fo{17sw5tw5ou5qw5rs}fp{17sw5tw5ou5qw5rs}fq{17sw5tw5ou5qw5rs}7r{cksclscmscnscoscps4ls}fs{17sw5tw5ou5qw5rs}ft{17su5tu}fu{17su5tu}fv{17su5tu}fw{17su5tu}fz{cksclscmscnscoscps4ls}}}"),"Helvetica-Bold":c("{'widths'{k3s2q4scx1w201n3r201o6o201s1w201t1w201u1w201w3m201x3m201y3m2k1w2l2l202m2n2n3r2o3r2p5t202q6o2r1s2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v2l3w3u3x3u3y3u3z3x4k6l4l4s4m4s4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3r4v4s4w3x4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v2l5w1w5x2l5y3u5z3r6k2l6l3r6m3x6n3r6o3x6p3r6q2l6r3x6s3x6t1w6u1w6v3r6w1w6x5t6y3x6z3x7k3x7l3x7m2r7n3r7o2l7p3x7q3r7r4y7s3r7t3r7u3m7v2r7w1w7x2r7y3u202l3rcl4sal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3xbq3rbr1wbs2lbu2obv3rbz3xck4s202k3rcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw1w2m2zcy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3res3ret3reu3rev3rew1wex1wey1wez1wfl3xfm3xfn3xfo3xfp3xfq3xfr3ufs3xft3xfu3xfv3xfw3xfz3r203k6o212m6o2dw2l2cq2l3t3r3u2l17s4m19m3r}'kerning'{cl{4qs5ku5ot5qs17sv5tv}201t{2ww4wy2yw}201w{2ks}201x{2ww4wy2yw}2k{201ts201xs}2w{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}2x{5ow5qs}2y{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}'fof'-6o7p{17su5tu5ot}ck{4qs5ku5ot5qs17sv5tv}4l{4qs5ku5ot5qs17sv5tv}cm{4qs5ku5ot5qs17sv5tv}cn{4qs5ku5ot5qs17sv5tv}co{4qs5ku5ot5qs17sv5tv}cp{4qs5ku5ot5qs17sv5tv}6l{17st5tt5os}17s{2kwclvcmvcnvcovcpv4lv4wwckv}5o{2kucltcmtcntcotcpt4lt4wtckt}5q{2ksclscmscnscoscps4ls4wvcks}5r{2ks4ws}5t{2kwclvcmvcnvcovcpv4lv4wwckv}eo{17st5tt5os}fu{17su5tu5ot}6p{17ss5ts}ek{17st5tt5os}el{17st5tt5os}em{17st5tt5os}en{17st5tt5os}6o{201ts}ep{17st5tt5os}es{17ss5ts}et{17ss5ts}eu{17ss5ts}ev{17ss5ts}6z{17su5tu5os5qt}fm{17su5tu5os5qt}fn{17su5tu5os5qt}fo{17su5tu5os5qt}fp{17su5tu5os5qt}fq{17su5tu5os5qt}fs{17su5tu5os5qt}ft{17su5tu5ot}7m{5os}fv{17su5tu5ot}fw{17su5tu5ot}}}"),Courier:c("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Courier-BoldOblique":c("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-Bold":c("{'widths'{k3q2q5ncx2r201n3m201o6o201s2l201t2l201u2l201w3m201x3m201y3m2k1t2l2l202m2n2n3m2o3m2p6o202q6o2r1w2s2l2t2l2u3m2v3t2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w3t3x3t3y3t3z3m4k5x4l4s4m4m4n4s4o4s4p4m4q3x4r4y4s4y4t2r4u3m4v4y4w4m4x5y4y4s4z4y5k3x5l4y5m4s5n3r5o4m5p4s5q4s5r6o5s4s5t4s5u4m5v2l5w1w5x2l5y3u5z3m6k2l6l3m6m3r6n2w6o3r6p2w6q2l6r3m6s3r6t1w6u2l6v3r6w1w6x5n6y3r6z3m7k3r7l3r7m2w7n2r7o2l7p3r7q3m7r4s7s3m7t3m7u2w7v2r7w1q7x2r7y3o202l3mcl4sal2lam3man3mao3map3mar3mas2lat4uau1yav3maw3tay4uaz2lbk2sbl3t'fof'6obo2lbp3rbr1tbs2lbu2lbv3mbz3mck4s202k3mcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw2r2m3rcy2rcz2rdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3rek3mel3mem3men3meo3mep3meq4ser2wes2wet2weu2wev2wew1wex1wey1wez1wfl3rfm3mfn3mfo3mfp3mfq3mfr3tfs3mft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3m3u2l17s4s19m3m}'kerning'{cl{4qt5ks5ot5qy5rw17sv5tv}201t{cks4lscmscnscoscpscls4wv}2k{201ts}2w{4qu5ku7mu5os5qx5ru17su5tu}2x{17su5tu5ou5qs}2y{4qv5kv7mu5ot5qz5ru17su5tu}'fof'-6o7t{cksclscmscnscoscps4ls}3u{17su5tu5os5qu}3v{17su5tu5os5qu}fu{17su5tu5ou5qu}7p{17su5tu5ou5qu}ck{4qt5ks5ot5qy5rw17sv5tv}4l{4qt5ks5ot5qy5rw17sv5tv}cm{4qt5ks5ot5qy5rw17sv5tv}cn{4qt5ks5ot5qy5rw17sv5tv}co{4qt5ks5ot5qy5rw17sv5tv}cp{4qt5ks5ot5qy5rw17sv5tv}6l{17st5tt5ou5qu}17s{ckuclucmucnucoucpu4lu4wu}5o{ckuclucmucnucoucpu4lu4wu}5q{ckzclzcmzcnzcozcpz4lz4wu}5r{ckxclxcmxcnxcoxcpx4lx4wu}5t{ckuclucmucnucoucpu4lu4wu}7q{ckuclucmucnucoucpu4lu}6p{17sw5tw5ou5qu}ek{17st5tt5qu}el{17st5tt5ou5qu}em{17st5tt5qu}en{17st5tt5qu}eo{17st5tt5qu}ep{17st5tt5ou5qu}es{17ss5ts5qu}et{17sw5tw5ou5qu}eu{17sw5tw5ou5qu}ev{17ss5ts5qu}6z{17sw5tw5ou5qu5rs}fm{17sw5tw5ou5qu5rs}fn{17sw5tw5ou5qu5rs}fo{17sw5tw5ou5qu5rs}fp{17sw5tw5ou5qu5rs}fq{17sw5tw5ou5qu5rs}7r{cktcltcmtcntcotcpt4lt5os}fs{17sw5tw5ou5qu5rs}ft{17su5tu5ou5qu}7m{5os}fv{17su5tu5ou5qu}fw{17su5tu5ou5qu}fz{cksclscmscnscoscps4ls}}}"),Symbol:c("{'widths'{k3uaw4r19m3m2k1t2l2l202m2y2n3m2p5n202q6o3k3m2s2l2t2l2v3r2w1t3m3m2y1t2z1wbk2sbl3r'fof'6o3n3m3o3m3p3m3q3m3r3m3s3m3t3m3u1w3v1w3w3r3x3r3y3r3z2wbp3t3l3m5v2l5x2l5z3m2q4yfr3r7v3k7w1o7x3k}'kerning'{'fof'-6o}}"),Helvetica:c("{'widths'{k3p2q4mcx1w201n3r201o6o201s1q201t1q201u1q201w2l201x2l201y2l2k1w2l1w202m2n2n3r2o3r2p5t202q6o2r1n2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v1w3w3u3x3u3y3u3z3r4k6p4l4m4m4m4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3m4v4m4w3r4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v1w5w1w5x1w5y2z5z3r6k2l6l3r6m3r6n3m6o3r6p3r6q1w6r3r6s3r6t1q6u1q6v3m6w1q6x5n6y3r6z3r7k3r7l3r7m2l7n3m7o1w7p3r7q3m7r4s7s3m7t3m7u3m7v2l7w1u7x2l7y3u202l3rcl4mal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3rbr1wbs2lbu2obv3rbz3xck4m202k3rcm4mcn4mco4mcp4mcq6ocr4scs4mct4mcu4mcv4mcw1w2m2ncy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3mes3ret3reu3rev3rew1wex1wey1wez1wfl3rfm3rfn3rfo3rfp3rfq3rfr3ufs3xft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3r3u1w17s4m19m3r}'kerning'{5q{4wv}cl{4qs5kw5ow5qs17sv5tv}201t{2wu4w1k2yu}201x{2wu4wy2yu}17s{2ktclucmucnu4otcpu4lu4wycoucku}2w{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}2x{17sy5ty5oy5qs}2y{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}'fof'-6o7p{17sv5tv5ow}ck{4qs5kw5ow5qs17sv5tv}4l{4qs5kw5ow5qs17sv5tv}cm{4qs5kw5ow5qs17sv5tv}cn{4qs5kw5ow5qs17sv5tv}co{4qs5kw5ow5qs17sv5tv}cp{4qs5kw5ow5qs17sv5tv}6l{17sy5ty5ow}do{17st5tt}4z{17st5tt}7s{fst}dm{17st5tt}dn{17st5tt}5o{ckwclwcmwcnwcowcpw4lw4wv}dp{17st5tt}dq{17st5tt}7t{5ow}ds{17st5tt}5t{2ktclucmucnu4otcpu4lu4wycoucku}fu{17sv5tv5ow}6p{17sy5ty5ow5qs}ek{17sy5ty5ow}el{17sy5ty5ow}em{17sy5ty5ow}en{5ty}eo{17sy5ty5ow}ep{17sy5ty5ow}es{17sy5ty5qs}et{17sy5ty5ow5qs}eu{17sy5ty5ow5qs}ev{17sy5ty5ow5qs}6z{17sy5ty5ow5qs}fm{17sy5ty5ow5qs}fn{17sy5ty5ow5qs}fo{17sy5ty5ow5qs}fp{17sy5ty5qs}fq{17sy5ty5ow5qs}7r{5ow}fs{17sy5ty5ow5qs}ft{17sv5tv5ow}7m{5ow}fv{17sv5tv5ow}fw{17sv5tv5ow}}}"),"Helvetica-BoldOblique":c("{'widths'{k3s2q4scx1w201n3r201o6o201s1w201t1w201u1w201w3m201x3m201y3m2k1w2l2l202m2n2n3r2o3r2p5t202q6o2r1s2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v2l3w3u3x3u3y3u3z3x4k6l4l4s4m4s4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3r4v4s4w3x4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v2l5w1w5x2l5y3u5z3r6k2l6l3r6m3x6n3r6o3x6p3r6q2l6r3x6s3x6t1w6u1w6v3r6w1w6x5t6y3x6z3x7k3x7l3x7m2r7n3r7o2l7p3x7q3r7r4y7s3r7t3r7u3m7v2r7w1w7x2r7y3u202l3rcl4sal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3xbq3rbr1wbs2lbu2obv3rbz3xck4s202k3rcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw1w2m2zcy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3res3ret3reu3rev3rew1wex1wey1wez1wfl3xfm3xfn3xfo3xfp3xfq3xfr3ufs3xft3xfu3xfv3xfw3xfz3r203k6o212m6o2dw2l2cq2l3t3r3u2l17s4m19m3r}'kerning'{cl{4qs5ku5ot5qs17sv5tv}201t{2ww4wy2yw}201w{2ks}201x{2ww4wy2yw}2k{201ts201xs}2w{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}2x{5ow5qs}2y{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}'fof'-6o7p{17su5tu5ot}ck{4qs5ku5ot5qs17sv5tv}4l{4qs5ku5ot5qs17sv5tv}cm{4qs5ku5ot5qs17sv5tv}cn{4qs5ku5ot5qs17sv5tv}co{4qs5ku5ot5qs17sv5tv}cp{4qs5ku5ot5qs17sv5tv}6l{17st5tt5os}17s{2kwclvcmvcnvcovcpv4lv4wwckv}5o{2kucltcmtcntcotcpt4lt4wtckt}5q{2ksclscmscnscoscps4ls4wvcks}5r{2ks4ws}5t{2kwclvcmvcnvcovcpv4lv4wwckv}eo{17st5tt5os}fu{17su5tu5ot}6p{17ss5ts}ek{17st5tt5os}el{17st5tt5os}em{17st5tt5os}en{17st5tt5os}6o{201ts}ep{17st5tt5os}es{17ss5ts}et{17ss5ts}eu{17ss5ts}ev{17ss5ts}6z{17su5tu5os5qt}fm{17su5tu5os5qt}fn{17su5tu5os5qt}fo{17su5tu5os5qt}fp{17su5tu5os5qt}fq{17su5tu5os5qt}fs{17su5tu5os5qt}ft{17su5tu5ot}7m{5os}fv{17su5tu5ot}fw{17su5tu5ot}}}"),ZapfDingbats:c("{'widths'{k4u2k1w'fof'6o}'kerning'{'fof'-6o}}"),"Courier-Bold":c("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-Italic":c("{'widths'{k3n2q4ycx2l201n3m201o5t201s2l201t2l201u2l201w3r201x3r201y3r2k1t2l2l202m2n2n3m2o3m2p5n202q5t2r1p2s2l2t2l2u3m2v4n2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w4n3x4n3y4n3z3m4k5w4l3x4m3x4n4m4o4s4p3x4q3x4r4s4s4s4t2l4u2w4v4m4w3r4x5n4y4m4z4s5k3x5l4s5m3x5n3m5o3r5p4s5q3x5r5n5s3x5t3r5u3r5v2r5w1w5x2r5y2u5z3m6k2l6l3m6m3m6n2w6o3m6p2w6q1w6r3m6s3m6t1w6u1w6v2w6w1w6x4s6y3m6z3m7k3m7l3m7m2r7n2r7o1w7p3m7q2w7r4m7s2w7t2w7u2r7v2s7w1v7x2s7y3q202l3mcl3xal2ram3man3mao3map3mar3mas2lat4wau1vav3maw4nay4waz2lbk2sbl4n'fof'6obo2lbp3mbq3obr1tbs2lbu1zbv3mbz3mck3x202k3mcm3xcn3xco3xcp3xcq5tcr4mcs3xct3xcu3xcv3xcw2l2m2ucy2lcz2ldl4mdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek3mel3mem3men3meo3mep3meq4mer2wes2wet2weu2wev2wew1wex1wey1wez1wfl3mfm3mfn3mfo3mfp3mfq3mfr4nfs3mft3mfu3mfv3mfw3mfz2w203k6o212m6m2dw2l2cq2l3t3m3u2l17s3r19m3m}'kerning'{cl{5kt4qw}201s{201sw}201t{201tw2wy2yy6q-t}201x{2wy2yy}2k{201tw}2w{7qs4qy7rs5ky7mw5os5qx5ru17su5tu}2x{17ss5ts5os}2y{7qs4qy7rs5ky7mw5os5qx5ru17su5tu}'fof'-6o6t{17ss5ts5qs}7t{5os}3v{5qs}7p{17su5tu5qs}ck{5kt4qw}4l{5kt4qw}cm{5kt4qw}cn{5kt4qw}co{5kt4qw}cp{5kt4qw}6l{4qs5ks5ou5qw5ru17su5tu}17s{2ks}5q{ckvclvcmvcnvcovcpv4lv}5r{ckuclucmucnucoucpu4lu}5t{2ks}6p{4qs5ks5ou5qw5ru17su5tu}ek{4qs5ks5ou5qw5ru17su5tu}el{4qs5ks5ou5qw5ru17su5tu}em{4qs5ks5ou5qw5ru17su5tu}en{4qs5ks5ou5qw5ru17su5tu}eo{4qs5ks5ou5qw5ru17su5tu}ep{4qs5ks5ou5qw5ru17su5tu}es{5ks5qs4qs}et{4qs5ks5ou5qw5ru17su5tu}eu{4qs5ks5qw5ru17su5tu}ev{5ks5qs4qs}ex{17ss5ts5qs}6z{4qv5ks5ou5qw5ru17su5tu}fm{4qv5ks5ou5qw5ru17su5tu}fn{4qv5ks5ou5qw5ru17su5tu}fo{4qv5ks5ou5qw5ru17su5tu}fp{4qv5ks5ou5qw5ru17su5tu}fq{4qv5ks5ou5qw5ru17su5tu}7r{5os}fs{4qv5ks5ou5qw5ru17su5tu}ft{17su5tu5qs}fu{17su5tu5qs}fv{17su5tu5qs}fw{17su5tu5qs}}}"),"Times-Roman":c("{'widths'{k3n2q4ycx2l201n3m201o6o201s2l201t2l201u2l201w2w201x2w201y2w2k1t2l2l202m2n2n3m2o3m2p5n202q6o2r1m2s2l2t2l2u3m2v3s2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v1w3w3s3x3s3y3s3z2w4k5w4l4s4m4m4n4m4o4s4p3x4q3r4r4s4s4s4t2l4u2r4v4s4w3x4x5t4y4s4z4s5k3r5l4s5m4m5n3r5o3x5p4s5q4s5r5y5s4s5t4s5u3x5v2l5w1w5x2l5y2z5z3m6k2l6l2w6m3m6n2w6o3m6p2w6q2l6r3m6s3m6t1w6u1w6v3m6w1w6x4y6y3m6z3m7k3m7l3m7m2l7n2r7o1w7p3m7q3m7r4s7s3m7t3m7u2w7v3k7w1o7x3k7y3q202l3mcl4sal2lam3man3mao3map3mar3mas2lat4wau1vav3maw3say4waz2lbk2sbl3s'fof'6obo2lbp3mbq2xbr1tbs2lbu1zbv3mbz2wck4s202k3mcm4scn4sco4scp4scq5tcr4mcs3xct3xcu3xcv3xcw2l2m2tcy2lcz2ldl4sdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek2wel2wem2wen2weo2wep2weq4mer2wes2wet2weu2wev2wew1wex1wey1wez1wfl3mfm3mfn3mfo3mfp3mfq3mfr3sfs3mft3mfu3mfv3mfw3mfz3m203k6o212m6m2dw2l2cq2l3t3m3u1w17s4s19m3m}'kerning'{cl{4qs5ku17sw5ou5qy5rw201ss5tw201ws}201s{201ss}201t{ckw4lwcmwcnwcowcpwclw4wu201ts}2k{201ts}2w{4qs5kw5os5qx5ru17sx5tx}2x{17sw5tw5ou5qu}2y{4qs5kw5os5qx5ru17sx5tx}'fof'-6o7t{ckuclucmucnucoucpu4lu5os5rs}3u{17su5tu5qs}3v{17su5tu5qs}7p{17sw5tw5qs}ck{4qs5ku17sw5ou5qy5rw201ss5tw201ws}4l{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cm{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cn{4qs5ku17sw5ou5qy5rw201ss5tw201ws}co{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cp{4qs5ku17sw5ou5qy5rw201ss5tw201ws}6l{17su5tu5os5qw5rs}17s{2ktclvcmvcnvcovcpv4lv4wuckv}5o{ckwclwcmwcnwcowcpw4lw4wu}5q{ckyclycmycnycoycpy4ly4wu5ms}5r{cktcltcmtcntcotcpt4lt4ws}5t{2ktclvcmvcnvcovcpv4lv4wuckv}7q{cksclscmscnscoscps4ls}6p{17su5tu5qw5rs}ek{5qs5rs}el{17su5tu5os5qw5rs}em{17su5tu5os5qs5rs}en{17su5qs5rs}eo{5qs5rs}ep{17su5tu5os5qw5rs}es{5qs}et{17su5tu5qw5rs}eu{17su5tu5qs5rs}ev{5qs}6z{17sv5tv5os5qx5rs}fm{5os5qt5rs}fn{17sv5tv5os5qx5rs}fo{17sv5tv5os5qx5rs}fp{5os5qt5rs}fq{5os5qt5rs}7r{ckuclucmucnucoucpu4lu5os}fs{17sv5tv5os5qx5rs}ft{17ss5ts5qs}fu{17sw5tw5qs}fv{17sw5tw5qs}fw{17ss5ts5qs}fz{ckuclucmucnucoucpu4lu5os5rs}}}"),"Helvetica-Oblique":c("{'widths'{k3p2q4mcx1w201n3r201o6o201s1q201t1q201u1q201w2l201x2l201y2l2k1w2l1w202m2n2n3r2o3r2p5t202q6o2r1n2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v1w3w3u3x3u3y3u3z3r4k6p4l4m4m4m4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3m4v4m4w3r4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v1w5w1w5x1w5y2z5z3r6k2l6l3r6m3r6n3m6o3r6p3r6q1w6r3r6s3r6t1q6u1q6v3m6w1q6x5n6y3r6z3r7k3r7l3r7m2l7n3m7o1w7p3r7q3m7r4s7s3m7t3m7u3m7v2l7w1u7x2l7y3u202l3rcl4mal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3rbr1wbs2lbu2obv3rbz3xck4m202k3rcm4mcn4mco4mcp4mcq6ocr4scs4mct4mcu4mcv4mcw1w2m2ncy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3mes3ret3reu3rev3rew1wex1wey1wez1wfl3rfm3rfn3rfo3rfp3rfq3rfr3ufs3xft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3r3u1w17s4m19m3r}'kerning'{5q{4wv}cl{4qs5kw5ow5qs17sv5tv}201t{2wu4w1k2yu}201x{2wu4wy2yu}17s{2ktclucmucnu4otcpu4lu4wycoucku}2w{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}2x{17sy5ty5oy5qs}2y{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}'fof'-6o7p{17sv5tv5ow}ck{4qs5kw5ow5qs17sv5tv}4l{4qs5kw5ow5qs17sv5tv}cm{4qs5kw5ow5qs17sv5tv}cn{4qs5kw5ow5qs17sv5tv}co{4qs5kw5ow5qs17sv5tv}cp{4qs5kw5ow5qs17sv5tv}6l{17sy5ty5ow}do{17st5tt}4z{17st5tt}7s{fst}dm{17st5tt}dn{17st5tt}5o{ckwclwcmwcnwcowcpw4lw4wv}dp{17st5tt}dq{17st5tt}7t{5ow}ds{17st5tt}5t{2ktclucmucnu4otcpu4lu4wycoucku}fu{17sv5tv5ow}6p{17sy5ty5ow5qs}ek{17sy5ty5ow}el{17sy5ty5ow}em{17sy5ty5ow}en{5ty}eo{17sy5ty5ow}ep{17sy5ty5ow}es{17sy5ty5qs}et{17sy5ty5ow5qs}eu{17sy5ty5ow5qs}ev{17sy5ty5ow5qs}6z{17sy5ty5ow5qs}fm{17sy5ty5ow5qs}fn{17sy5ty5ow5qs}fo{17sy5ty5ow5qs}fp{17sy5ty5qs}fq{17sy5ty5ow5qs}7r{5ow}fs{17sy5ty5ow5qs}ft{17sv5tv5ow}7m{5ow}fv{17sv5tv5ow}fw{17sv5tv5ow}}}")}};e.events.push(["addFont",function(
vendor: 41,106 bytes, lines 1589-1617
1589m){var f=m.font,p=h.Unicode[f.postScriptName];p&&(f.metadata.Unicode={},f.metadata.Unicode.widths=p.widths,f.metadata.Unicode.kerning=p.kerning);var A=u.Unicode[f.postScriptName];A&&(f.metadata.Unicode.encoding=A,f.encoding=A.codePages[0])}])}(Wt.API),function(e){var t=function(r){for(var s=r.length,a=new Uint8Array(s),i=0;i<s;i++)a[i]=r.charCodeAt(i);return a};e.API.events.push(["addFont",function(r){var s=void 0,a=r.font,i=r.instance;if(!a.isStandardFont){if(i===void 0)throw new Error("Font does not exist in vFS, import fonts or remove declaration doc.addFont('"+a.postScriptName+"').");if(typeof(s=i.existsFileInVFS(a.postScriptName)===!1?i.loadFile(a.postScriptName):i.getFileFromVFS(a.postScriptName))!="string")throw new Error("Font is not stored as string-data in vFS, import fonts or remove declaration doc.addFont('"+a.postScriptName+"').");(function(o,l){l=/^\x00\x01\x00\x00/.test(l)?t(l):t(Uj(l)),o.metadata=e.API.TTFFont.open(l),o.metadata.Unicode=o.metadata.Unicode||{encoding:{},kerning:{},widths:[]},o.metadata.glyIdsUsed=[0]})(a,s)}}])}(Wt),Wt.API.addSvgAsImage=function(e,t,r,s,a,i,o,l){if(isNaN(t)||isNaN(r))throw zn.error("jsPDF.addSvgAsImage: Invalid coordinates",arguments),new Error("Invalid coordinates passed to jsPDF.addSvgAsImage");if(isNaN(s)||isNaN(a))throw zn.error("jsPDF.addSvgAsImage: Invalid measurements",arguments),new Error("Invalid measurements (width and/or height) passed to jsPDF.addSvgAsImage");var c=document.createElement("canvas");c.width=s,c.height=a;var d=c.getContext("2d");d.fillStyle="#fff",d.fillRect(0,0,c.width,c.height);var u={ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0},h=this;return(jr.canvg?Promise.resolve(jr.canvg):hs(()=>import("./index.es-DMoiouQ2.js"),__vite__mapDeps([0,1]))).catch(function(m){return Promise.reject(new Error("Could not load canvg: "+m))}).then(function(m){return m.default?m.default:m}).then(function(m){return m.fromString(d,e,u)},function(){return Promise.reject(new Error("Could not load canvg."))}).then(function(m){return m.render(u)}).then(function(){h.addImage(c.toDataURL("image/jpeg",1),t,r,s,a,o,l)})},Wt.API.putTotalPages=function(e){var t,r=0;parseInt(this.internal.getFont().id.substr(1),10)<15?(t=new RegExp(e,"g"),r=this.internal.getNumberOfPages()):(t=new RegExp(this.pdfEscape16(e,this.internal.getFont()),"g"),r=this.pdfEscape16(this.internal.getNumberOfPages()+"",this.internal.getFont()));for(var s=1;s<=this.internal.getNumberOfPages();s++)for(var a=0;a<this.internal.pages[s].length;a++)this.internal.pages[s][a]=this.internal.pages[s][a].replace(t,r);return this},Wt.API.viewerPreferences=function(e,t){var r;e=e||{},t=t||!1;var s,a,i,o={HideToolbar:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},HideMenubar:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},HideWindowUI:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},FitWindow:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},CenterWindow:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},DisplayDocTitle:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.4},NonFullScreenPageMode:{defaultValue:"UseNone",value:"UseNone",type:"name",explicitSet:!1,valueSet:["UseNone","UseOutlines","UseThumbs","UseOC"],pdfVersion:1.3},Direction:{defaultValue:"L2R",value:"L2R",type:"name",explicitSet:!1,valueSet:["L2R","R2L"],pdfVersion:1.3},ViewArea:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},ViewClip:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintArea:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintClip:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintScaling:{defaultValue:"AppDefault",value:"AppDefault",type:"name",explicitSet:!1,valueSet:["AppDefault","None"],pdfVersion:1.6},Duplex:{defaultValue:"",value:"none",type:"name",explicitSet:!1,valueSet:["Simplex","DuplexFlipShortEdge","DuplexFlipLongEdge","none"],pdfVersion:1.7},PickTrayByPDFSize:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.7},PrintPageRange:{defaultValue:"",value:"",type:"array",explicitSet:!1,valueSet:null,pdfVersion:1.7},NumCopies:{defaultValue:1,value:1,type:"integer",explicitSet:!1,valueSet:null,pdfVersion:1.7}},l=Object.keys(o),c=[],d=0,u=0,h=0;function m(p,A){var v,x=!1;for(v=0;v<p.length;v+=1)p[v]===A&&(x=!0);return x}if(this.internal.viewerpreferences===void 0&&(this.internal.viewerpreferences={},this.internal.viewerpreferences.configuration=JSON.parse(JSON.stringify(o)),this.internal.viewerpreferences.isSubscribed=!1),r=this.internal.viewerpreferences.configuration,e==="reset"||t===!0){var f=l.length;for(h=0;h<f;h+=1)r[l[h]].value=r[l[h]].defaultValue,r[l[h]].explicitSet=!1}if(On(e)==="object"){for(a in e)if(i=e[a],m(l,a)&&i!==void 0){if(r[a].type==="boolean"&&typeof i=="boolean")r[a].value=i;else if(r[a].type==="name"&&m(r[a].valueSet,i))r[a].value=i;else if(r[a].type==="integer"&&Number.isInteger(i))r[a].value=i;else if(r[a].type==="array"){for(d=0;d<i.length;d+=1)if(s=!0,i[d].length===1&&typeof i[d][0]=="number")c.push(String(i[d]-1));else if(i[d].length>1){for(u=0;u<i[d].length;u+=1)typeof i[d][u]!="number"&&(s=!1);s===!0&&c.push([i[d][0]-1,i[d][1]-1].join(" "))}r[a].value="["+c.join(" ")+"]"}else r[a].value=r[a].defaultValue;r[a].explicitSet=!0}}return this.internal.viewerpreferences.isSubscribed===!1&&(this.internal.events.subscribe("putCatalog",function(){var p,A=[];for(p in r)r[p].explicitSet===!0&&(r[p].type==="name"?A.push("/"+p+" /"+r[p].value):A.push("/"+p+" "+r[p].value));A.length!==0&&this.internal.write(`/ViewerPreferences
1590<<
1591`+A.join(`
1592`)+`
1593>>`)}),this.internal.viewerpreferences.isSubscribed=!0),this.internal.viewerpreferences.configuration=r,this},function(e){var t=function(){var s='<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><rdf:Description rdf:about="" xmlns:jspdf="'+this.internal.__metadata__.namespaceuri+'"><jspdf:metadata>',a=unescape(encodeURIComponent('<x:xmpmeta xmlns:x="adobe:ns:meta/">')),i=unescape(encodeURIComponent(s)),o=unescape(encodeURIComponent(this.internal.__metadata__.metadata)),l=unescape(encodeURIComponent("</jspdf:metadata></rdf:Description></rdf:RDF>")),c=unescape(encodeURIComponent("</x:xmpmeta>")),d=i.length+o.length+l.length+a.length+c.length;this.internal.__metadata__.metadata_object_number=this.internal.newObject(),this.internal.write("<< /Type /Metadata /Subtype /XML /Length "+d+" >>"),this.internal.write("stream"),this.internal.write(a+i+o+l+c),this.internal.write("endstream"),this.internal.write("endobj")},r=function(){this.internal.__metadata__.metadata_object_number&&this.internal.write("/Metadata "+this.internal.__metadata__.metadata_object_number+" 0 R")};e.addMetadata=function(s,a){return this.internal.__metadata__===void 0&&(this.internal.__metadata__={metadata:s,namespaceuri:a||"http://jspdf.default.namespaceuri/"},this.internal.events.subscribe("putCatalog",r),this.internal.events.subscribe("postPutResources",t)),this}}(Wt.API),function(e){var t=e.API,r=t.pdfEscape16=function(i,o){for(var l,c=o.metadata.Unicode.widths,d=["","0","00","000","0000"],u=[""],h=0,m=i.length;h<m;++h){if(l=o.metadata.characterToGlyph(i.charCodeAt(h)),o.metadata.glyIdsUsed.push(l),o.metadata.toUnicode[l]=i.charCodeAt(h),c.indexOf(l)==-1&&(c.push(l),c.push([parseInt(o.metadata.widthOfGlyph(l),10)])),l=="0")return u.join("");l=l.toString(16),u.push(d[4-l.length],l)}return u.join("")},s=function(i){var o,l,c,d,u,h,m;for(u=`/CIDInit /ProcSet findresource begin
159412 dict begin
1595begincmap
1596/CIDSystemInfo <<
1597  /Registry (Adobe)
1598  /Ordering (UCS)
1599  /Supplement 0
1600>> def
1601/CMapName /Adobe-Identity-UCS def
1602/CMapType 2 def
16031 begincodespacerange
1604<0000><ffff>
1605endcodespacerange`,c=[],h=0,m=(l=Object.keys(i).sort(function(f,p){return f-p})).length;h<m;h++)o=l[h],c.length>=100&&(u+=`
1606`+c.length+` beginbfchar
1607`+c.join(`
1608`)+`
1609endbfchar`,c=[]),i[o]!==void 0&&i[o]!==null&&typeof i[o].toString=="function"&&(d=("0000"+i[o].toString(16)).slice(-4),o=("0000"+(+o).toString(16)).slice(-4),c.push("<"+o+"><"+d+">"));return c.length&&(u+=`
1610`+c.length+` beginbfchar
1611`+c.join(`
1612`)+`
1613endbfchar
1614`),u+`endcmap
1615CMapName currentdict /CMap defineresource pop
1616end
1617end`};t.events.push(["putFont",function(i){(function(o){var l=o.font,c=o.out,d=o.newObject,u=o.putStream;if(l.metadata instanceof e.API.TTFFont&&l.encoding==="Identity-H"){for(var h=l.metadata.Unicode.widths,m=l.metadata.subset.encode(l.metadata.glyIdsUsed,1),f="",p=0;p<m.length;p++)f+=String.fromCharCode(m[p]);var A=d();u({data:f,addLength1:!0,objectId:A}),c("endobj");var v=d();u({data:s(l.metadata.toUnicode),addLength1:!0,objectId:v}),c("endobj");var x=d();c("<<"),c("/Type /FontDescriptor"),c("/FontName /"+cA(l.fontName)),c("/FontFile2 "+A+" 0 R"),c("/FontBBox "+e.API.PDFObject.convert(l.metadata.bbox)),c("/Flags "+l.metadata.flags),c("/StemV "+l.metadata.stemV),c("/ItalicAngle "+l.metadata.italicAngle),c("/Ascent "+l.metadata.ascender),c("/Descent "+l.metadata.decender),c("/CapHeight "+l.metadata.capHeight),c(">>"),c("endobj");var b=d();c("<<"),c("/Type /Font"),c("/BaseFont /"+cA(l.fontName)),c("/FontDescriptor "+x+" 0 R"),c("/W "+e.API.PDFObject.convert(h)),c("/CIDToGIDMap /Identity"),c("/DW 1000"),c("/Subtype /CIDFontType2"),c("/CIDSystemInfo"),c("<<"),c("/Supplement 0"),c("/Registry (Adobe)"),c("/Ordering ("+l.encoding+")"),c(">>"),c(">>"),c("endobj"),l.objectNumber=d(),c("<<"),c("/Type /Font"),c("/Subtype /Type0"),c("/ToUnicode "+v+" 0 R"),c("/BaseFont /"+cA(l.fontName)),c("/Encoding /"+l.encoding),c("/DescendantFonts ["+b+" 0 R]"),c(">>"),c("endobj"),l.isAlreadyPutted=!0}})(i)}]),t.events.push(["putFont",function(i){(function(o){var l=o.font,c=o.out,d=o.newObject,u=o.putStream;if(l.metadata instanceof e.API.TTFFont&&l.encoding==="WinAnsiEncoding"){for(var h=l.metadata.rawData,m="",f=0;f<h.length;f++)m+=String.fromCharCode(h[f]);var p=d();u({data:m,addLength1:!0,objectId:p}),c("endobj");var A=d();u({data:s(l.metadata.toUnicode),addLength1:!0,objectId:A}),c("endobj");var v=d();c("<<"),c("/Descent "+l.metadata.decender),c("/CapHeight "+l.metadata.capHeight),c("/StemV "+l.metadata.stemV),c("/Type /FontDescriptor"),c("/FontFile2 "+p+" 0 R"),c("/Flags 96"),c("/FontBBox "+e.API.PDFObject.convert(l.metadata.bbox)),c("/FontName /"+cA(l.fontName)),c("/ItalicAngle "+l.metadata.italicAngle),c("/Ascent "+l.metadata.ascender),c(">>"),c("endobj"),l.objectNumber=d();for(var x=0;x<l.metadata.hmtx.widths.length;x++)l.metadata.hmtx.widths[x]=parseInt(l.metadata.hmtx.widths[x]*(1e3/l.metadata.head.unitsPerEm));c("<</Subtype/TrueType/Type/Font/ToUnicode "+A+" 0 R/BaseFont/"+cA(l.fontName)+"/FontDescriptor "+v+" 0 R/Encoding/"+l.encoding+" /FirstChar 29 /LastChar 255 /Widths "+e.API.PDFObject.convert(l.metadata.hmtx.widths)+">>"),c("endobj"),l.isAlreadyPutted=!0}})(i)}]);var a=function(i){var o,l=i.text||"",c=i.x,d=i.y,u=i.options||{},h=i.mutex||{},m=h.pdfEscape,f=h.activeFontKey,p=h.fonts,A=f,v="",x=0,b="",y=p[A].encoding;if(p[A].encoding!=="Identity-H")return{text:l,x:c,y:d,options:u,mutex:h};for(b=l,A=f,Array.isArray(l)&&(b=l[0]),x=0;x<b.length;x+=1)p[A].metadata.hasOwnProperty("cmap")&&(o=p[A].metadata.cmap.unicode.codeMap[b[x].charCodeAt(0)]),o||b[x].charCodeAt(0)<256&&p[A].metadata.hasOwnProperty("Unicode")?v+=b[x]:v+="";var w="";return parseInt(A.slice(1))<14||y==="WinAnsiEncoding"?w=m(v,A).split("").map(function(j){return j.charCodeAt(0).toString(16)}).join(""):y==="Identity-H"&&(w=r(v,p[A])),h.isHex=!0,{text:w,x:c,y:d,options:u,mutex:h}};t.events.push(["postProcessText",function(i){var o=i.text||"",l=[],c={text:o,x:i.x,y:i.y,options:i.options,mutex:i.mutex};if(Array.isArray(o)){var d=0;for(d=0;d<o.length;d+=1)Array.isArray(o[d])&&o[d].length===3?l.push([a(Object.assign({},c,{text:o[d][0]})).text,o[d][1],o[d][2]]):l.push(a(Object.assign({},c,{text:o[d]})).text);i.text=l}else i.text=a(Object.assign({},c,{text:o})).text}])}(Wt),function(e){var t=function(){return this.internal.vFS===void 0&&(this.internal.vFS={}),!0};e.existsFileInVFS=function(r){return t.call(this),this.internal.vFS[r]!==void 0},e.addFileToVFS=function(r,s){return t.call(this),this.internal.vFS[r]=s,this},e.getFileFromVFS=function(r){return t.call(this),this.internal.vFS[r]!==void 0?this.internal.vFS[r]:null}}(Wt.API),function(e){e.__bidiEngine__=e.prototype.__bidiEngine__=function(s){var a,i,o,l,c,d,u,h=t,m=[[0,3,0,1,0,0,0],[0,3,0,1,2,2,0],[0,3,0,17,2,0,1],[0,3,5,5,4,1,0],[0,3,21,21,4,0,1],[0,3,5,5,4,2,0]],f=[[2,0,1,1,0,1,0],[2,0,1,1,0,2,0],[2,0,2,1,3,2,0],[2,0,2,33,3,1,1]],p={L:0,R:1,EN:2,AN:3,N:4,B:5,S:6},A={0:0,5:1,6:2,7:3,32:4,251:5,254:6,255:7},v=["(",")","(","<",">","<","[","]","[","{","}","{","«","»","«","‹","›","‹","⁅","⁆","⁅","⁽","⁾","⁽","₍","₎","₍","≤","≥","≤","〈","〉","〈","﹙","﹚","﹙","﹛","﹜","﹛","﹝","﹞","﹝","﹤","﹥","﹤"],x=new RegExp(/^([1-4|9]|1[0-9]|2[0-9]|3[0168]|4[04589]|5[012]|7[78]|159|16[0-9]|17[0-2]|21[569]|22[03489]|250)$/),b=!1,y=0;this.__bidiEngine__={};var w=function(T){var B=T.charCodeAt(),L=B>>8,P=A[L];return P!==void 0?h[256*P+(255&B)]:L===252||L===253?"AL":x.test(L)?"L":L===8?"R":"N"},j=function(T){for(var B,L=0;L<T.length;L++){if((B=w(T.charAt(L)))==="L")return!1;if(B==="R")return!0}return!1},N=function(T,B,L,P){var F,M,I,$,V=B[P];switch(V){case"L":case"R":case"LRE":case"RLE":case"LRO":case"RLO":case"PDF":b=!1;break;case"N":case"AN":break;case"EN":b&&(V="AN");break;case"AL":b=!0,V="R";break;case"WS":case"BN":V="N";break;case"CS":P<1||P+1>=B.length||(F=L[P-1])!=="EN"&&F!=="AN"||(M=B[P+1])!=="EN"&&M!=="AN"?V="N":b&&(M="AN"),V=M===F?M:"N";break;case"ES":V=(F=P>0?L[P-1]:"B")==="EN"&&P+1<B.length&&B[P+1]==="EN"?"EN":"N";break;case"ET":if(P>0&&L[P-1]==="EN"){V="EN";break}if(b){V="N";break}for(I=P+1,$=B.length;I<$&&B[I]==="ET";)I++;V=I<$&&B[I]==="EN"?"EN":"N";break;case"NSM":if(o&&!l){for($=B.length,I=P+1;I<$&&B[I]==="NSM";)I++;if(I<$){var R=T[P],Q=R>=1425&&R<=2303||R===64286;if(F=B[I],Q&&(F==="R"||F==="AL")){V="R";break}}}V=P<1||(F=B[P-1])==="B"?"N":L[P-1];break;case"B":b=!1,a=!0,V=y;break;case"S":i=!0,V="N"}return V},_=function(T,B,L){var P=T.split("");return L&&S(P,L,{hiLevel:y}),P.reverse(),B&&B.reverse(),P.join("")},S=function(T,B,L){var P,F,M,I,$,V=-1,R=T.length,Q=0,U=[],D=y?f:m,q=[];for(b=!1,a=!1,i=!1,F=0;F<R;F++)q[F]=w(T[F]);for(M=0;M<R;M++){if($=Q,U[M]=N(T,q,U,M),P=240&(Q=D[$][p[U[M]]]),Q&=15,B[M]=I=D[Q][5],P>0)if(P===16){for(F=V;F<M;F++)B[F]=1;V=-1}else V=-1;if(D[Q][6])V===-1&&(V=M);else if(V>-1){for(F=V;F<M;F++)B[F]=I;V=-1}q[M]==="B"&&(B[M]=0),L.hiLevel|=I}i&&function(G,Y,K){for(var X=0;X<K;X++)if(G[X]==="S"){Y[X]=y;for(var ne=X-1;ne>=0&&G[ne]==="WS";ne--)Y[ne]=y}}(q,B,R)},C=function(T,B,L,P,F){if(!(F.hiLevel<T)){if(T===1&&y===1&&!a)return B.reverse(),void(L&&L.reverse());for(var M,I,$,V,R=B.length,Q=0;Q<R;){if(P[Q]>=T){for($=Q+1;$<R&&P[$]>=T;)$++;for(V=Q,I=$-1;V<I;V++,I--)M=B[V],B[V]=B[I],B[I]=M,L&&(M=L[V],L[V]=L[I],L[I]=M);Q=$}Q++}}},E=function(T,B,L){var P=T.split(""),F={hiLevel:y};return L||(L=[]),S(P,L,F),function(M,I,$){if($.hiLevel!==0&&u)for(var V,R=0;R<M.length;R++)I[R]===1&&(V=v.indexOf(M[R]))>=0&&(M[R]=v[V+1])}(P,L,F),C(2,P,B,L,F),C(1,P,B,L,F),P.join("")};return this.__bidiEngine__.doBidiReorder=function(T,B,L){if(function(F,M){if(M)for(var I=0;I<F.length;I++)M[I]=I;l===void 0&&(l=j(F)),d===void 0&&(d=j(F))}(T,B),o||!c||d)if(o&&c&&l^d)y=l?1:0,T=_(T,B,L);else if(!o&&c&&d)y=l?1:0,T=E(T,B,L),T=_(T,B);else if(!o||l||c||d){if(o&&!c&&l^d)T=_(T,B),l?(y=0,T=E(T,B,L)):(y=1,T=E(T,B,L),T=_(T,B));else if(o&&l&&!c&&d)y=1,T=E(T,B,L),T=_(T,B);else if(!o&&!c&&l^d){var P=u;l?(y=1,T=E(T,B,L),y=0,u=!1,T=E(T,B,L),u=P):(y=0,T=E(T,B,L),T=_(T,B),y=1,u=!1,T=E(T,B,L),u=P,T=_(T,B))}}else y=0,T=E(T,B,L);else y=l?1:0,T=E(T,B,L);return T},this.__bidiEngine__.setOptions=function(T){T&&(o=T.isInputVisual,c=T.isOutputVisual,l=T.isInputRtl,d=T.isOutputRtl,u=T.isSymmetricSwapping)},this.__bidiEngine__.setOptions(s),this.__bidiEngine__};var t=["BN","BN","BN","BN","BN","BN","BN","BN","BN","S","B","S","WS","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","B","B","B","S","WS","N","N","ET","ET","ET","N","N","N","N","N","ES","CS","ES","CS","CS","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","CS","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","BN","BN","BN","BN","BN","BN","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","CS","N","ET","ET","ET","ET","N","N","N","N","L","N","N","BN","N","N","ET","ET","EN","EN","N","L","N","N","N","EN","L","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","N","N","N","N","N","ET","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","R","NSM","R","NSM","NSM","R","NSM","NSM","R","NSM","N","N","N","N","N","N","N","N","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","N","N","N","N","N","R","R","R","R","R","N","N","N","N","N","N","N","N","N","N","N","AN","AN","AN","AN","AN","AN","N","N","AL","ET","ET","AL","CS","AL","N","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AL","AL","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AN","AN","AN","AN","AN","AN","AN","AN","AN","AN","ET","AN","AN","AL","AL","AL","NSM","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AN","N","NSM","NSM","NSM","NSM","NSM","NSM","AL","AL","NSM","NSM","N","NSM","NSM","NSM","NSM","AL","AL","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","N","AL","AL","NSM","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AL","N","N","N","N","N","N","N","N","N","N","N","N","N","N","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","R","R","N","N","N","N","R","N","N","N","N","N","WS","WS","WS","WS","WS","WS","WS","WS","WS","WS","WS","BN","BN","BN","L","R","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","WS","B","LRE","RLE","PDF","LRO","RLO","CS","ET","ET","ET","ET","ET","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","CS","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","WS","BN","BN","BN","BN","BN","N","LRI","RLI","FSI","PDI","BN","BN","BN","BN","BN","BN","EN","L","N","N","EN","EN","EN","EN","EN","EN","ES","ES","N","N","N","L","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","ES","ES","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","L","L","L","L","L","L","L","N","N","N","N","N","N","N","N","N","N","N","N","L","L","L","L","L","N","N","N","N","N","R","NSM","R","R","R","R","R","R","R","R","R","R","ES","R","R","R","R","R","R","R","R","R","R","R","R","R","N","R","R","R","R","R","N","R","N","R","R","N","R","R","N","R","R","R","R","R","R","R","R","R","R","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","CS","N","CS","N","N","CS","N","N","N","N","N","N","N","N","N","ET","N","N","ES","ES","N","N","N","N","N","ET","ET","N","N","N","N","N","AL","AL","AL","AL","AL","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","N","N","BN","N","N","N","ET","ET","ET","N","N","N","N","N","ES","CS","ES","CS","CS","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","CS","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","N","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","L","L","L","L","L","L","N","N","L","L","L","L","L","L","N","N","L","L","L","L","L","L","N","N","L","L","L","N","N","N","ET","ET","N","N","N","ET","ET","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N"],r=new e.__bidiEngine__({isInputVisual:!0});e.API.events.push(["postProcessText",function(s){var a=s.text;s.x,s.y;var i=s.options||{};s.mutex,i.lang;var o=[];if(i.isInputVisual=typeof i.isInputVisual!="boolean"||i.isInputVisual,r.setOptions(i),Object.prototype.toString.call(a)==="[object Array]"){var l=0;for(o=[],l=0;l<a.length;l+=1)Object.prototype.toString.call(a[l])==="[object Array]"?o.push([r.doBidiReorder(a[l][0]),a[l][1],a[l][2]]):o.push([r.doBidiReorder(a[l])]);s.text=o}else s.text=r.doBidiReorder(a);r.setOptions({isInputVisual:!0})}])}(Wt),Wt.API.TTFFont=function(){function e(t){var r;if(this.rawData=t,r=this.contents=new Zh(t),this.contents.pos=4,r.readString(4)==="ttcf")throw new Error("TTCF not supported.");r.pos=0,this.parse(),this.subset=new _lt(this),this.registerTTF()}return e.open=function(t){return new e(t)},e.prototype.parse=function(){return this.directory=new ult(this.contents),this.head=new flt(this),this.name=new xlt(this),this.cmap=new sae(this),this.toUnicode={},this.hhea=new mlt(this),this.maxp=new vlt(this),this.hmtx=new blt(this),this.post=new Alt(this),this.os2=new plt(this),this.loca=new Nlt(this),this.glyf=new ylt(this),this.ascender=this.os2.exists&&this.os2.ascender||this.hhea.ascender,this.decender=this.os2.exists&&this.os2.decender||this.hhea.decender,this.lineGap=this.os2.exists&&this.os2.lineGap||this.hhea.lineGap,this.bbox=[this.head.xMin,this.head.yMin,this.head.xMax,this.head.yMax]},e.prototype.registerTTF=function(){var t,r,s,a,i;if(this.scaleFactor=1e3/this.head.unitsPerEm,this.bbox=(function(){var o,l,c,d;for(d=[],o=0,l=(c=this.bbox).length;o<l;o++)t=c[o],d.push(Math.round(t*this.scaleFactor));return d}).call(this),this.stemV=0,this.post.exists?(s=255&(a=this.post.italic_angle),32768&(r=a>>16)&&(r=-(1+(65535^r))),this.italicAngle=+(r+"."+s)):this.italicAngle=0,this.ascender=Math.round(this.ascender*this.scaleFactor),this.decender=Math.round(this.decender*this.scaleFactor),this.lineGap=Math.round(this.lineGap*this.scaleFactor),this.capHeight=this.os2.exists&&this.os2.capHeight||this.ascender,this.xHeight=this.os2.exists&&this.os2.xHeight||0,this.familyClass=(this.os2.exists&&this.os2.familyClass||0)>>8,this.isSerif=(i=this.familyClass)===1||i===2||i===3||i===4||i===5||i===7,this.isScript=this.familyClass===10,this.flags=0,this.post.isFixedPitch&&(this.flags|=1),this.isSerif&&(this.flags|=2),this.isScript&&(this.flags|=8),this.italicAngle!==0&&(this.flags|=64),this.flags|=32,!this.cmap.unicode)throw new Error("No unicode cmap for font")},e.prototype.characterToGlyph=function(t){var r;return((r=this.cmap.unicode)!=null?r.codeMap[t]:void 0)||0},e.prototype.widthOfGlyph=function(t){var r;return r=1e3/this.head.unitsPerEm,this.hmtx.forGlyph(t).advance*r},e.prototype.widthOfString=function(t,r,s){var a,i,o,l;for(o=0,i=0,l=(t=""+t).length;0<=l?i<l:i>l;i=0<=l?++i:--i)a=t.charCodeAt(i),o+=this.widthOfGlyph(this.characterToGlyph(a))+s*(1e3/r)||0;return o*(r/1e3)},e.prototype.lineHeight=function(t,r){var s;return r==null&&(r=!1),s=r?this.lineGap:0,(this.ascender+s-this.decender)/1e3*t},e}();var Ic,Zh=function(){function e(t){this.data=t??[],this.pos=0,this.length=this.data.length}return e.prototype.readByte=function(){return this.data[this.pos++]},e.prototype.writeByte=function(t){return this.data[this.pos++]=t},e.prototype.readUInt32=function(){return 16777216*this.readByte()+(this.readByte()<<16)+(this.readByte()<<8)+this.readByte()},e.prototype.writeUInt32=function(t){return this.writeByte(t>>>24&255),this.writeByte(t>>16&255),this.writeByte(t>>8&255),this.writeByte(255&t)},e.prototype.readInt32=function(){var t;return(t=this.readUInt32())>=2147483648?t-4294967296:t},e.prototype.writeInt32=function(t){return t<0&&(t+=4294967296),this.writeUInt32(t)},e.prototype.readUInt16=function(){return this.readByte()<<8|this.readByte()},e.prototype.writeUInt16=function(t){return this.writeByte(t>>8&255),this.writeByte(255&t)},e.prototype.readInt16=function(){var t;return(t=this.readUInt16())>=32768?t-65536:t},e.prototype.writeInt16=function(t){return t<0&&(t+=65536),this.writeUInt16(t)},e.prototype.readString=function(t){var r,s;for(s=[],r=0;0<=t?r<t:r>t;r=0<=t?++r:--r)s[r]=String.fromCharCode(this.readByte());return s.join("")},e.prototype.writeString=function(t){var r,s,a;for(a=[],r=0,s=t.length;0<=s?r<s:r>s;r=0<=s?++r:--r)a.push(this.writeByte(t.charCodeAt(r)));return a},e.prototype.readShort=function(){return this.readInt16()},e.prototype.writeShort=function(t){return this.writeInt16(t)},e.prototype.readLongLong=function(){var t,r,s,a,i,o,l,c;return t=this.readByte(),r=this.readByte(),s=this.readByte(),a=this.readByte(),i=this.readByte(),o=this.readByte(),l=this.readByte(),c=this.readByte(),128&t?-1*(72057594037927940*(255^t)+281474976710656*(255^r)+1099511627776*(255^s)+4294967296*(255^a)+16777216*(255^i)+65536*(255^o)+256*(255^l)+(255^c)+1):72057594037927940*t+281474976710656*r+1099511627776*s+4294967296*a+16777216*i+65536*o+256*l+c},e.prototype.writeLongLong=function(t){var r,s;return r=Math.floor(t/4294967296),s=4294967295&t,this.writeByte(r>>24&255),this.writeByte(r>>16&255),this.writeByte(r>>8&255),this.writeByte(255&r),this.writeByte(s>>24&255),this.writeByte(s>>16&255),this.writeByte(s>>8&255),this.writeByte(255&s)},e.prototype.readInt=function(){return this.readInt32()},e.prototype.writeInt=function(t){return this.writeInt32(t)},e.prototype.read=function(t){var r,s;for(r=[],s=0;0<=t?s<t:s>t;s=0<=t?++s:--s)r.push(this.readByte());return r},e.prototype.write=function(t){var r,s,a,i;for(i=[],s=0,a=t.length;s<a;s++)r=t[s],i.push(this.writeByte(r));return i},e}(),ult=function(){var e;function t(r){var s,a,i;for(this.scalarType=r.readInt(),this.tableCount=r.readShort(),this.searchRange=r.readShort(),this.entrySelector=r.readShort(),this.rangeShift=r.readShort(),this.tables={},a=0,i=this.tableCount;0<=i?a<i:a>i;a=0<=i?++a:--a)s={tag:r.readString(4),checksum:r.readInt(),offset:r.readInt(),length:r.readInt()},this.tables[s.tag]=s}return t.prototype.encode=function(r){var s,a,i,o,l,c,d,u,h,m,f,p,A;for(A in f=Object.keys(r).length,c=Math.log(2),h=16*Math.floor(Math.log(f)/c),o=Math.floor(h/c),u=16*f-h,(a=new Zh).writeInt(this.scalarType),a.writeShort(f),a.writeShort(h),a.writeShort(o),a.writeShort(u),i=16*f,d=a.pos+i,l=null,p=[],r)for(m=r[A],a.writeString(A),a.writeInt(e(m)),a.writeInt(d),a.writeInt(m.length),p=p.concat(m),A==="head"&&(l=d),d+=m.length;d%4;)p.push(0),d++;return a.write(p),s=2981146554-e(a.data),a.pos=l+8,a.writeUInt32(s),a.data},e=function(r){var s,a,i,o;for(r=aae.call(r);r.length%4;)r.push(0);for(i=new Zh(r),a=0,s=0,o=r.length;s<o;s=s+=4)a+=i.readUInt32();return 4294967295&a},t}(),hlt={}.hasOwnProperty,Ed=function(e,t){for(var r in t)hlt.call(t,r)&&(e[r]=t[r]);function s(){this.constructor=e}return s.prototype=t.prototype,e.prototype=new s,e.__super__=t.prototype,e};Ic=function(){function e(t){var r;this.file=t,r=this.file.directory.tables[this.tag],this.exists=!!r,r&&(this.offset=r.offset,this.length=r.length,this.parse(this.file.contents))}return e.prototype.parse=function(){},e.prototype.encode=function(){},e.prototype.raw=function(){return this.exists?(this.file.contents.pos=this.offset,this.file.contents.read(this.length)):null},e}();var flt=function(){function e(){return e.__super__.constructor.apply(this,arguments)}return Ed(e,Ic),e.prototype.tag="head",e.prototype.parse=function(t){return t.pos=this.offset,this.version=t.readInt(),this.revision=t.readInt(),this.checkSumAdjustment=t.readInt(),this.magicNumber=t.readInt(),this.flags=t.readShort(),this.unitsPerEm=t.readShort(),this.created=t.readLongLong(),this.modified=t.readLongLong(),this.xMin=t.readShort(),this.yMin=t.readShort(),this.xMax=t.readShort(),this.yMax=t.readShort(),this.macStyle=t.readShort(),this.lowestRecPPEM=t.readShort(),this.fontDirectionHint=t.readShort(),this.indexToLocFormat=t.readShort(),this.glyphDataFormat=t.readShort()},e.prototype.encode=function(t){var r;return(r=new Zh).writeInt(this.version),r.writeInt(this.revision),r.writeInt(this.checkSumAdjustment),r.writeInt(this.magicNumber),r.writeShort(this.flags),r.writeShort(this.unitsPerEm),r.writeLongLong(this.created),r.writeLongLong(this.modified),r.writeShort(this.xMin),r.writeShort(this.yMin),r.writeShort(this.xMax),r.writeShort(this.yMax),r.writeShort(this.macStyle),r.writeShort(this.lowestRecPPEM),r.writeShort(this.fontDirectionHint),r.writeShort(t),r.writeShort(this.glyphDataFormat),r.data},e}(),wz=function(){function e(t,r){var s,a,i,o,l,c,d,u,h,m,f,p,A,v,x,b,y;switch(this.platformID=t.readUInt16(),this.encodingID=t.readShort(),this.offset=r+t.readInt(),h=t.pos,t.pos=this.offset,this.format=t.readUInt16(),this.length=t.readUInt16(),this.language=t.readUInt16(),this.isUnicode=this.platformID===3&&this.encodingID===1&&this.format===4||this.platformID===0&&this.format===4,this.codeMap={},this.format){case 0:for(c=0;c<256;++c)this.codeMap[c]=t.readByte();break;case 4:for(f=t.readUInt16(),m=f/2,t.pos+=6,i=function(){var w,j;for(j=[],c=w=0;0<=m?w<m:w>m;c=0<=m?++w:--w)j.push(t.readUInt16());return j}(),t.pos+=2,A=function(){var w,j;for(j=[],c=w=0;0<=m?w<m:w>m;c=0<=m?++w:--w)j.push(t.readUInt16());return j}(),d=function(){var w,j;for(j=[],c=w=0;0<=m?w<m:w>m;c=0<=m?++w:--w)j.push(t.readUInt16());return j}(),u=function(){var w,j;for(j=[],c=w=0;0<=m?w<m:w>m;c=0<=m?++w:--w)j.push(t.readUInt16());return j}(),a=(this.length-t.pos+this.offset)/2,l=function(){var w,j;for(j=[],c=w=0;0<=a?w<a:w>a;c=0<=a?++w:--w)j.push(t.readUInt16());return j}(),c=x=0,y=i.length;x<y;c=++x)for(v=i[c],s=b=p=A[c];p<=v?b<=v:b>=v;s=p<=v?++b:--b)u[c]===0?o=s+d[c]:(o=l[u[c]/2+(s-p)-(m-c)]||0)!==0&&(o+=d[c]),this.codeMap[s]=65535&o}t.pos=h}return e.encode=function(t,r){var s,a,i,o,l,c,d,u,h,m,f,p,A,v,x,b,y,w,j,N,_,S,C,E,T,B,L,P,F,M,I,$,V,R,Q,U,D,q,G,Y,K,X,ne,ae,J,W;switch(P=new Zh,o=Object.keys(t).sort(function(ie,he){return ie-he}),r){case"macroman":for(A=0,v=function(){var ie=[];for(p=0;p<256;++p)ie.push(0);return ie}(),b={0:0},i={},F=0,V=o.length;F<V;F++)b[ne=t[a=o[F]]]==null&&(b[ne]=++A),i[a]={old:t[a],new:b[t[a]]},v[a]=b[t[a]];return P.writeUInt16(1),P.writeUInt16(0),P.writeUInt32(12),P.writeUInt16(0),P.writeUInt16(262),P.writeUInt16(0),P.write(v),{charMap:i,subtable:P.data,maxGlyphID:A+1};case"unicode":for(B=[],h=[],y=0,b={},s={},x=d=null,M=0,R=o.length;M<R;M++)b[j=t[a=o[M]]]==null&&(b[j]=++y),s[a]={old:j,new:b[j]},l=b[j]-a,x!=null&&l===d||(x&&h.push(x),B.push(a),d=l),x=a;for(x&&h.push(x),h.push(65535),B.push(65535),E=2*(C=B.length),S=2*Math.pow(Math.log(C)/Math.LN2,2),m=Math.log(S/2)/Math.LN2,_=2*C-S,c=[],N=[],f=[],p=I=0,Q=B.length;I<Q;p=++I){if(T=B[p],u=h[p],T===65535){c.push(0),N.push(0);break}if(T-(L=s[T].new)>=32768)for(c.push(0),N.push(2*(f.length+C-p)),a=$=T;T<=u?$<=u:$>=u;a=T<=u?++$:--$)f.push(s[a].new);else c.push(L-T),N.push(0)}for(P.writeUInt16(3),P.writeUInt16(1),P.writeUInt32(12),P.writeUInt16(4),P.writeUInt16(16+8*C+2*f.length),P.writeUInt16(0),P.writeUInt16(E),P.writeUInt16(S),P.writeUInt16(m),P.writeUInt16(_),K=0,U=h.length;K<U;K++)a=h[K],P.writeUInt16(a);for(P.writeUInt16(0),X=0,D=B.length;X<D;X++)a=B[X],P.writeUInt16(a);for(ae=0,q=c.length;ae<q;ae++)l=c[ae],P.writeUInt16(l);for(J=0,G=N.length;J<G;J++)w=N[J],P.writeUInt16(w);for(W=0,Y=f.length;W<Y;W++)A=f[W],P.writeUInt16(A);return{charMap:s,subtable:P.data,maxGlyphID:y+1}}},e}(),sae=function(){function e(){return e.__super__.constructor.apply(this,arguments)}return Ed(e,Ic),e.prototype.tag="cmap",e.prototype.parse=function(t){var r,s,a;for(t.pos=this.offset,this.version=t.readUInt16(),a=t.readUInt16(),this.tables=[],this.unicode=null,s=0;0<=a?s<a:s>a;s=0<=a?++s:--s)r=new wz(t,this.offset),this.tables.push(r),r.isUnicode&&this.unicode==null&&(this.unicode=r);return!0},e.encode=function(t,r){var s,a;return r==null&&(r="macroman"),s=wz.encode(t,r),(a=new Zh).writeUInt16(0),a.writeUInt16(1),s.table=a.data.concat(s.subtable),s},e}(),mlt=function(){function e(){return e.__super__.constructor.apply(this,arguments)}return Ed(e,Ic),e.prototype.tag="hhea",e.prototype.parse=function(t){return t.pos=this.offset,this.version=t.readInt(),this.ascender=t.readShort(),this.decender=t.readShort(),this.lineGap=t.readShort(),this.advanceWidthMax=t.readShort(),this.minLeftSideBearing=t.readShort(),this.minRightSideBearing=t.readShort(),this.xMaxExtent=t.readShort(),this.caretSlopeRise=t.readShort(),this.caretSlopeRun=t.readShort(),this.caretOffset=t.readShort(),t.pos+=8,this.metricDataFormat=t.readShort(),this.numberOfMetrics=t.readUInt16()},e}(),plt=function(){function e(){return e.__super__.constructor.apply(this,arguments)}return Ed(e,Ic),e.prototype.tag="OS/2",e.prototype.parse=function(t){if(t.pos=this.offset,this.version=t.readUInt16(),this.averageCharWidth=t.readShort(),this.weightClass=t.readUInt16(),this.widthClass=t.readUInt16(),this.type=t.readShort(),this.ySubscriptXSize=t.readShort(),this.ySubscriptYSize=t.readShort(),this.ySubscriptXOffset=t.readShort(),this.ySubscriptYOffset=t.readShort(),this.ySuperscriptXSize=t.readShort(),this.ySuperscriptYSize=t.readShort(),this.ySuperscriptXOffset=t.readShort(),this.ySuperscriptYOffset=t.readShort(),this.yStrikeoutSize=t.readShort(),this.yStrikeoutPosition=t.readShort(),this.familyClass=t.readShort(),this.panose=function(){var r,s;for(s=[],r=0;r<10;++r)s.push(t.readByte());return s}(),this.charRange=function(){var r,s;for(s=[],r=0;r<4;++r)s.push(t.readInt());return s}(),this.vendorID=t.readString(4),this.selection=t.readShort(),this.firstCharIndex=t.readShort(),this.lastCharIndex=t.readShort(),this.version>0&&(this.ascent=t.readShort(),this.descent=t.readShort(),this.lineGap=t.readShort(),this.winAscent=t.readShort(),this.winDescent=t.readShort(),this.codePageRange=function(){var r,s;for(s=[],r=0;r<2;r=++r)s.push(t.readInt());return s}(),this.version>1))return this.xHeight=t.readShort(),this.capHeight=t.readShort(),this.defaultChar=t.readShort(),this.breakChar=t.readShort(),this.maxContext=t.readShort()},e}(),Alt=function(){function e(){return e.__super__.constructor.apply(this,arguments)}return Ed(e,Ic),e.prototype.tag="post",e.prototype.parse=function(t){var r,s,a;switch(t.pos=this.offset,this.format=t.readInt(),this.italicAngle=t.readInt(),this.underlinePosition=t.readShort(),this.underlineThickness=t.readShort(),this.isFixedPitch=t.readInt(),this.minMemType42=t.readInt(),this.maxMemType42=t.readInt(),this.minMemType1=t.readInt(),this.maxMemType1=t.readInt(),this.format){case 65536:case 196608:break;case 131072:var i;for(s=t.readUInt16(),this.glyphNameIndex=[],i=0;0<=s?i<s:i>s;i=0<=s?++i:--i)this.glyphNameIndex.push(t.readUInt16());for(this.names=[],a=[];t.pos<this.offset+this.length;)r=t.readByte(),a.push(this.names.push(t.readString(r)));return a;case 151552:return s=t.readUInt16(),this.offsets=t.read(s);case 262144:return this.map=(function(){var o,l,c;for(c=[],i=o=0,l=this.file.maxp.numGlyphs;0<=l?o<l:o>l;i=0<=l?++o:--o)c.push(t.readUInt32());return c}).call(this)}},e}(),glt=function(e,t){this.raw=e,this.length=e.length,this.platformID=t.platformID,this.encodingID=t.encodingID,this.languageID=t.languageID},xlt=function(){function e(){return e.__super__.constructor.apply(this,arguments)}return Ed(e,Ic),e.prototype.tag="name",e.prototype.parse=function(t){var r,s,a,i,o,l,c,d,u,h,m;
1617for(t.pos=this.offset,t.readShort(),r=t.readShort(),l=t.readShort(),s=[],i=0;0<=r?i<r:i>r;i=0<=r?++i:--i)s.push({platformID:t.readShort(),encodingID:t.readShort(),languageID:t.readShort(),nameID:t.readShort(),length:t.readShort(),offset:this.offset+l+t.readShort()});for(c={},i=u=0,h=s.length;u<h;i=++u)a=s[i],t.pos=a.offset,d=t.readString(a.length),o=new glt(d,a),c[m=a.nameID]==null&&(c[m]=[]),c[a.nameID].push(o);this.strings=c,this.copyright=c[0],this.fontFamily=c[1],this.fontSubfamily=c[2],this.uniqueSubfamily=c[3],this.fontName=c[4],this.version=c[5];try{this.postscriptName=c[6][0].raw.replace(/[\x00-\x19\x80-\xff]/g,"")}catch{this.postscriptName=c[4][0].raw.replace(/[\x00-\x19\x80-\xff]/g,"")}return this.trademark=c[7],this.manufacturer=c[8],this.designer=c[9],this.description=c[10],this.vendorUrl=c[11],this.designerUrl=c[12],this.license=c[13],this.licenseUrl=c[14],this.preferredFamily=c[15],this.preferredSubfamily=c[17],this.compatibleFull=c[18],this.sampleText=c[19]},e}(),vlt=function(){function e(){return e.__super__.constructor.apply(this,arguments)}return Ed(e,Ic),e.prototype.tag="maxp",e.prototype.parse=function(t){return t.pos=this.offset,this.version=t.readInt(),this.numGlyphs=t.readUInt16(),this.maxPoints=t.readUInt16(),this.maxContours=t.readUInt16(),this.maxCompositePoints=t.readUInt16(),this.maxComponentContours=t.readUInt16(),this.maxZones=t.readUInt16(),this.maxTwilightPoints=t.readUInt16(),this.maxStorage=t.readUInt16(),this.maxFunctionDefs=t.readUInt16(),this.maxInstructionDefs=t.readUInt16(),this.maxStackElements=t.readUInt16(),this.maxSizeOfInstructions=t.readUInt16(),this.maxComponentElements=t.readUInt16(),this.maxComponentDepth=t.readUInt16()},e}(),blt=function(){function e(){return e.__super__.constructor.apply(this,arguments)}return Ed(e,Ic),e.prototype.tag="hmtx",e.prototype.parse=function(t){var r,s,a,i,o,l,c;for(t.pos=this.offset,this.metrics=[],r=0,l=this.file.hhea.numberOfMetrics;0<=l?r<l:r>l;r=0<=l?++r:--r)this.metrics.push({advance:t.readUInt16(),lsb:t.readInt16()});for(a=this.file.maxp.numGlyphs-this.file.hhea.numberOfMetrics,this.leftSideBearings=function(){var d,u;for(u=[],r=d=0;0<=a?d<a:d>a;r=0<=a?++d:--d)u.push(t.readInt16());return u}(),this.widths=(function(){var d,u,h,m;for(m=[],d=0,u=(h=this.metrics).length;d<u;d++)i=h[d],m.push(i.advance);return m}).call(this),s=this.widths[this.widths.length-1],c=[],r=o=0;0<=a?o<a:o>a;r=0<=a?++o:--o)c.push(this.widths.push(s));return c},e.prototype.forGlyph=function(t){return t in this.metrics?this.metrics[t]:{advance:this.metrics[this.metrics.length-1].advance,lsb:this.leftSideBearings[t-this.metrics.length]}},e}(),aae=[].slice,ylt=function(){function e(){return e.__super__.constructor.apply(this,arguments)}return Ed(e,Ic),e.prototype.tag="glyf",e.prototype.parse=function(){return this.cache={}},e.prototype.glyphFor=function(t){var r,s,a,i,o,l,c,d,u,h;return t in this.cache?this.cache[t]:(i=this.file.loca,r=this.file.contents,s=i.indexOf(t),(a=i.lengthOf(t))===0?this.cache[t]=null:(r.pos=this.offset+s,o=(l=new Zh(r.read(a))).readShort(),d=l.readShort(),h=l.readShort(),c=l.readShort(),u=l.readShort(),this.cache[t]=o===-1?new jlt(l,d,h,c,u):new wlt(l,o,d,h,c,u),this.cache[t]))},e.prototype.encode=function(t,r,s){var a,i,o,l,c;for(o=[],i=[],l=0,c=r.length;l<c;l++)a=t[r[l]],i.push(o.length),a&&(o=o.concat(a.encode(s)));return i.push(o.length),{table:o,offsets:i}},e}(),wlt=function(){function e(t,r,s,a,i,o){this.raw=t,this.numberOfContours=r,this.xMin=s,this.yMin=a,this.xMax=i,this.yMax=o,this.compound=!1}return e.prototype.encode=function(){return this.raw.data},e}(),jlt=function(){function e(t,r,s,a,i){var o,l;for(this.raw=t,this.xMin=r,this.yMin=s,this.xMax=a,this.yMax=i,this.compound=!0,this.glyphIDs=[],this.glyphOffsets=[],o=this.raw;l=o.readShort(),this.glyphOffsets.push(o.pos),this.glyphIDs.push(o.readUInt16()),32&l;)o.pos+=1&l?4:2,128&l?o.pos+=8:64&l?o.pos+=4:8&l&&(o.pos+=2)}return e.prototype.encode=function(){var t,r,s;for(r=new Zh(aae.call(this.raw.data)),t=0,s=this.glyphIDs.length;t<s;++t)r.pos=this.glyphOffsets[t];return r.data},e}(),Nlt=function(){function e(){return e.__super__.constructor.apply(this,arguments)}return Ed(e,Ic),e.prototype.tag="loca",e.prototype.parse=function(t){var r,s;return t.pos=this.offset,r=this.file.head.indexToLocFormat,this.offsets=r===0?(function(){var a,i;for(i=[],s=0,a=this.length;s<a;s+=2)i.push(2*t.readUInt16());return i}).call(this):(function(){var a,i;for(i=[],s=0,a=this.length;s<a;s+=4)i.push(t.readUInt32());return i}).call(this)},e.prototype.indexOf=function(t){return this.offsets[t]},e.prototype.lengthOf=function(t){return this.offsets[t+1]-this.offsets[t]},e.prototype.encode=function(t,r){for(var s=new Uint32Array(this.offsets.length),a=0,i=0,o=0;o<s.length;++o)if(s[o]=a,i<r.length&&r[i]==o){++i,s[o]=a;var l=this.offsets[o],c=this.offsets[o+1]-l;c>0&&(a+=c)}for(var d=new Array(4*s.length),u=0;u<s.length;++u)d[4*u+3]=255&s[u],d[4*u+2]=(65280&s[u])>>8,d[4*u+1]=(16711680&s[u])>>16,d[4*u]=(4278190080&s[u])>>24;return d},e}(),_lt=function(){function e(t){this.font=t,this.subset={},this.unicodes={},this.next=33}return e.prototype.generateCmap=function(){var t,r,s,a,i;for(r in a=this.font.cmap.tables[0].codeMap,t={},i=this.subset)s=i[r],t[r]=a[s];return t},e.prototype.glyphsFor=function(t){var r,s,a,i,o,l,c;for(a={},o=0,l=t.length;o<l;o++)a[i=t[o]]=this.font.glyf.glyphFor(i);for(i in r=[],a)(s=a[i])!=null&&s.compound&&r.push.apply(r,s.glyphIDs);if(r.length>0)for(i in c=this.glyphsFor(r))s=c[i],a[i]=s;return a},e.prototype.encode=function(t,r){var s,a,i,o,l,c,d,u,h,m,f,p,A,v,x;for(a in s=sae.encode(this.generateCmap(),"unicode"),o=this.glyphsFor(t),f={0:0},x=s.charMap)f[(c=x[a]).old]=c.new;for(p in m=s.maxGlyphID,o)p in f||(f[p]=m++);return u=function(b){var y,w;for(y in w={},b)w[b[y]]=y;return w}(f),h=Object.keys(u).sort(function(b,y){return b-y}),A=function(){var b,y,w;for(w=[],b=0,y=h.length;b<y;b++)l=h[b],w.push(u[l]);return w}(),i=this.font.glyf.encode(o,A,f),d=this.font.loca.encode(i.offsets,A),v={cmap:this.font.cmap.raw(),glyf:i.table,loca:d,hmtx:this.font.hmtx.raw(),hhea:this.font.hhea.raw(),maxp:this.font.maxp.raw(),post:this.font.post.raw(),name:this.font.name.raw(),head:this.font.head.encode(r)},this.font.os2.exists&&(v["OS/2"]=this.font.os2.raw()),this.font.directory.encode(v)},e}();Wt.API.PDFObject=function(){var e;function t(){}return e=function(r,s){return(Array(s+1).join("0")+r).slice(-s)},t.convert=function(r){var s,a,i,o;if(Array.isArray(r))return"["+function(){var l,c,d;for(d=[],l=0,c=r.length;l<c;l++)s=r[l],d.push(t.convert(s));return d}().join(" ")+"]";if(typeof r=="string")return"/"+r;if(r!=null&&r.isString)return"("+r+")";if(r instanceof Date)return"(D:"+e(r.getUTCFullYear(),4)+e(r.getUTCMonth(),2)+e(r.getUTCDate(),2)+e(r.getUTCHours(),2)+e(r.getUTCMinutes(),2)+e(r.getUTCSeconds(),2)+"Z)";if({}.toString.call(r)==="[object Object]"){for(a in i=["<<"],r)o=r[a],i.push("/"+a+" "+t.convert(o));return i.push(">>"),i.join(`
1618`)}return""+r},t}();function Clt(){const{selectedBrand:e}=mn(),[t]=Bi(),[r,s]=g.useState(null),[a,i]=g.useState(!0),[o,l]=g.useState(!1),[c,d]=g.useState(!1),[u,h]=g.useState(null),[m,f]=g.useState(!1),p=g.useRef(null),A=g.useRef(null);g.useEffect(()=>{async function y(){if(e)try{i(!0);const{data:w,error:j}=await de.from("brands").select("*").eq("id",e.id).single();if(j)throw j;const N=w;s((N==null?void 0:N.brand_kit_json)||null)}catch(w){console.error("Error fetching brand kit:",w),h("Failed to load brand kit. Please try again later.")}finally{i(!1)}}y()},[e]),g.useEffect(()=>{t.get("autoGenerate")==="true"&&!a&&!r&&!m&&e&&(console.log("🔍 DEBUG: Auto-generating brand kit from URL parameter"),f(!0),v())},[t,a,r,m,e]);const v=async()=>
1618{if(e)try{l(!0),h(null);const w="https://worker.rainfactory.ai/rainfactory/brand-genius/generate_brand_kit";console.log("🔍 DEBUG: Calling endpoint:",w);let j;try{const N=await de.auth.getSession();console.log("🔍 DEBUG: Auth session available:",!!N.data.session);const _=await fetch(w,{method:"POST",headers:{"Content-Type":"application/json",Authorization:N.data.session?`Bearer ${N.data.session.access_token}`:""},body:JSON.stringify({brandId:e.id})});if(j=await _.json(),console.log("🔍 DEBUG: Received Brand Kit",j),!_.ok)throw new Error(`Failed to generate brand kit: ${_.statusText}`)}catch(N){throw new Error(`Failed to generate brand kit: ${N}`)}s(j.brand_kit_json),await x()}catch(y){console.error("Error generating brand kit:",y),h("Failed to generate brand kit. Please try again later.")}finally{l(!1)}};async function x(){if(e)try{const{data:y,error:w}=await de.from("brands").select("*").eq("id",e.id).single();if(w)throw w;const j=y;s((j==null?void 0:j.brand_kit_json)||null)}catch(y){console.error("Error refreshing brand kit:",y)}}const b=async()=>{if(e)try{d(!0),h(null);const y=r!=null&&r.html?p.current:A.current;if(!y)throw new Error("Content not found for export");const w=await mse(y,{scale:2,useCORS:!0,logging:!1}),j=w.toDataURL("image/png"),N=new Wt({orientation:"portrait",unit:"mm",format:"a4"}),_=210,S=w.height*_/w.width;let C=S,E=0,T=297;for(N.addImage(j,"PNG",0,E,_,S),C-=T;C>=0;)E=C-S,N.addPage(),N.addImage(j,"PNG",0,E,_,S),C-=T;N.save(`${e.brand_name} Brand Kit.pdf`)}catch(y){console.error("Error exporting PDF:",y),h("Failed to export PDF. Please try again later.")}finally{d(!1)}};return e?a?n.jsx("div",{className:"flex items-center justify-center h-96",children:n.jsx(ed,{size:"lg"})}):n.jsxs("div",{className:"container mx-auto py-8 max-w-6xl",children:[n.jsx("div",{className:"mb-8 flex flex-col md:flex-row md:items-center md:justify-between gap-4",children:n.jsxs("div",{children:[n.jsxs("h1",{className:"text-3xl font-bold tracking-tight",children:[e.brand_name," Brand Kit"]}),n.jsx("p",{className:"text-muted-foreground mt-1",children:"Manage your brand kit and visual theme in one place."})]})}),u&&n.jsxs(Ar,{variant:"destructive",className:"mb-6",children:[n.jsx(nr,{className:"h-4 w-4"}),n.jsx(Wa,{children:"Error"}),n.jsx(gr,{children:u})]}),n.jsxs(Cs,{defaultValue:"brand-kit",className:"space-y-6",children:[n.jsxs(ps,{className:"grid w-full grid-cols-2 md:w-auto md:inline-flex",children:[n.jsxs(pt,{value:"brand-kit",children:[n.jsx(Xr,{className:"mr-2 h-4 w-4"}),"Brand Kit"]}),n.jsxs(pt,{value:"theme",children:[n.jsx(W_,{className:"mr-2 h-4 w-4"}),"Theme Editor"]})]}),n.jsxs(Ct,{value:"brand-kit",className:"space-y-6",children:[n.jsx(ty,{brand:e}),r&&n.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 justify-between items-start sm:items-center",children:[n.jsx("div",{className:"flex flex-col sm:flex-row gap-3",children:n.jsxs(te,{onClick:v,disabled:o||c,variant:"outline",size:"sm",children:[o&&n.jsx(ed,{className:"mr-2",size:"sm"}),"Refresh Brand Kit"]})}),n.jsxs(te,{onClick:b,disabled:o||c,size:"sm",children:[c?n.jsx(ed,{className:"mr-2",size:"sm"}):n.jsx(Ad,{className:"mr-2 h-4 w-4"}),"Export PDF"]})]}),o?n.jsx(Te,{className:"p-8",children:n.jsxs("div",{className:"flex flex-col items-center justify-center text-center space-y-4",children:[n.jsx(ed,{size:"lg"}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Generating Your Brand Kit"}),n.jsx("p",{className:"text-muted-foreground",children:"We're analyzing your brand and creating a comprehensive guide. This may take a moment..."})]})]})}):r?r.html?n.jsx(Te,{className:"p-6",children:n.jsx(QS,{brandId:e.id,contentType:"landing-page",children:n.jsx("div",{ref:p,className:"prose max-w-none",dangerouslySetInnerHTML:{__html:r.html}})})}):n.jsxs(Te,{className:"p-6",children:[n.jsxs("div",{className:"flex justify-between items-center mb-4",children:[n.jsx("h3",{className:"text-lg font-semibold",children:"Brand Kit Data"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"JSON format"})]}),n.jsx("pre",{ref:A,className:"whitespace-pre-wrap overflow-auto max-h-[80vh] text-sm bg-muted/30 p-4 rounded-md",children:JSON.stringify(r,null,2)})]}):n.jsx(Te,{className:"p-8",children:n.jsxs("div",{className:"flex flex-col items-center justify-center text-center space-y-6",children:[n.jsx("div",{className:"w-16 h-16 bg-primary/10 rounded-full flex items-center justify-center",children:n.jsx(Xr,{className:"w-8 h-8 text-primary"})}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("h3",{className:"text-xl font-semibold",children:"Create Your Brand Kit"}),n.jsx("p",{className:"text-muted-foreground max-w-md",children:"Generate a comprehensive brand kit that includes your brand's identity, voice, visual guidelines, and messaging strategy."})]}),n.jsxs(te,{onClick:v,disabled:o,size:"lg",className:"mt-4",children:[o&&n.jsx(ed,{className:"mr-2",size:"sm"}),"Generate Brand Kit"]})]})})]}),n.jsx(Ct,{value:"theme",className:"space-y-4",children:n.jsx(K3,{},e.id)})]})]}):n.jsx("div",{className:"flex items-center justify-center h-96",children:n.jsxs(Ar,{variant:"destructive",className:"max-w-md",children:[n.jsx(nr,{className:"h-4 w-4"}),n.jsx(Wa,{children:"No brand selected"}),n.jsx(gr,{children:"Please select a brand to view its brand kit."})]})})}const Kg="/assets/logo-large-D5zXML43.png",Slt=({aiAnalysis:e,brandName:t="Your Brand",onClaimBrand:r,isAnonymous:s=!1})=>{const[a,i]=g.useState(0),[o,l]=g.useState(!0),[c,d]=g.useState(1),[u,h]=g.useState(!1),[m,f]=g.useState(0),p=oe.useMemo(()=>{const N=[];return N.push({type:"intro",title:`${t} Brand Analysis`,subtitle:"Deep AI-Powered Insights",content:e.summaryInsight,gradient:"from-purple-600 to-pink-600",icon:yK}
1618),e.detailedInsights.forEach((_,S)=>{var T;const C=["from-rose-500 to-pink-600","from-amber-500 to-orange-600","from-blue-500 to-indigo-600","from-emerald-500 to-teal-600","from-violet-600 to-purple-600"],E=[pxe,Fm,Is,Ka,ui];N.push({type:"insight",title:_.title,subtitle:"Brand Analysis Insight",icon:E[S%E.length],gradient:C[S%C.length],quote:_.strengths.quote||_.opportunities.quote||"Transforming your brand's potential into market success.",summary:_.summary,strengths:_.strengths.items,opportunities:_.opportunities.items,weaknesses:((T=_.weaknesses)==null?void 0:T.items)||[],elaboration:_.elaboration})}),e.integratedRecommendations.length>0&&N.push({type:"recommendations",title:"Strategic Recommendations",subtitle:"Your Custom Path Forward",icon:ui,gradient:"from-violet-600 to-purple-600",recommendations:e.integratedRecommendations}),s&&N.push({type:"cta",title:"Rainfactory AI Is Ready To Go!",subtitle:"We have now have a PHD in your brand, and we're to create some amazing content for you.",content:"We've analyzed every aspect of your brand positioning, messaging, and market presence. Our AI has uncovered the hidden patterns and opportunities that will transform your marketing strategy.",gradient:"from-emerald-600 to-blue-600",icon:ui,cta:"Get Started"}),N},[e,t]);g.useEffect(()=>{const S=.15151515151515152;let C,E;const T=B=>{E||(E=B),B-E>=1e3/60&&(f(P=>{const F=P+S;return F>=100?100:F}),E=B),o&&a<p.length-1&&(C=requestAnimationFrame(T))};if(o&&a<p.length-1){f(0),C=requestAnimationFrame(T);const B=setTimeout(()=>{A()},11e3);return()=>{clearTimeout(B),cancelAnimationFrame(C)}}else a===p.length-1&&(l(!1),f(100));return()=>{C&&cancelAnimationFrame(C)}},[a,o,p.length]),g.useEffect(()=>{h(!1);const N=setTimeout(()=>{h(!0)},800);return()=>clearTimeout(N)},[a]);const A=()=>{d(1),i(N=>(N+1)%p.length),f(0)},v=()=>{d(-1),i(N=>(N-1+p.length)%p.length),f(0)},x=N=>{d(N>a?1:-1),i(N),f(0)},b=()=>{l(!o)},y=p[a],w=y.icon,j=()=>{var N;return y.type==="intro"?n.jsxs("div",{className:"text-center space-y-8 max-w-4xl mx-auto",children:[n.jsx("div",{className:`inline-flex p-6 rounded-full bg-gradient-to-r ${y.gradient} text-white shadow-2xl transform hover:scale-110 transition-transform duration-300`,children:n.jsx(w,{className:"w-16 h-16"})}),n.jsx("h1",{className:`text-6xl font-bold bg-gradient-to-r ${y.gradient} bg-clip-text text-transparent leading-tight`,children:y.title}),n.jsx("h2",{className:"text-3xl text-gray-600 font-light",children:y.subtitle}),n.jsx("p",{className:"text-xl text-gray-700 leading-relaxed max-w-3xl mx-auto",children:y.content})]}):y.type==="recommendations"?n.jsxs("div",{className:"max-w-5xl mx-auto space-y-8",children:[n.jsxs("div",{className:"text-center space-y-4",children:[n.jsx("div",{className:`inline-flex p-4 rounded-full bg-gradient-to-r ${y.gradient} text-white shadow-xl`,children:n.jsx(w,{className:"w-12 h-12"})}),n.jsx("h1",{className:`text-5xl font-bold bg-gradient-to-r ${y.gradient} bg-clip-text text-transparent`,children:y.title}),n.jsx("p",{className:"text-xl text-gray-600",children:y.subtitle})]}),n.jsx("div",{className:"grid md:grid-cols-2 gap-6 mt-12",children:(N=y.recommendations)==null?void 0:N.map((_,S)=>n.jsx("div",{className:"group p-6 bg-white rounded-2xl shadow-lg border border-gray-100 hover:shadow-2xl hover:scale-105 transition-all duration-300",style:{animationDelay:`${S*.2}s`},children:n.jsxs("div",{className:"flex items-start gap-4",children:[n.jsx("div",{className:`w-10 h-10 rounded-full bg-gradient-to-r ${y.gradient} text-white flex items-center justify-center font-bold text-lg flex-shrink-0`,children:S+1}),n.jsx("p",{className:"text-gray-700 leading-relaxed group-hover:text-gray-900 transition-colors",children:_})]})},S))})]}):y.type==="cta"?n.jsxs("div",{className:"max-w-4xl mx-auto text-center space-y-12",children:[n.jsxs("div",{className:"space-y-6",children:[n.jsx("div",{className:`inline-flex p-6 rounded-full bg-gradient-to-r ${y.gradient} text-white shadow-2xl transform hover:scale-110 transition-transform duration-300`,children:n.jsx(cxe,{className:"w-16 h-16"})}),n.jsx("h1",{className:`text-6xl font-bold bg-gradient-to-r ${y.gradient} bg-clip-text text-transparent leading-tight`,children:y.title}),n.jsx("p",{className:"text-2xl text-gray-600 font-light max-w-2xl mx-auto",children:y.subtitle}),n.jsx("p",{className:"text-xl text-gray-700 leading-relaxed max-w-3xl mx-auto",children:y.content})]}),n.jsxs("div",{className:"space-y-8",children:[n.jsxs("button",{onClick:r,className:`group relative inline-flex items-center gap-4 px-12 py-6 text-2xl font-bold text-white bg-gradient-to-r ${y.gradient} rounded-full shadow-2xl hover:shadow-3xl transform hover:scale-105 transition-all duration-300 overflow-hidden`,children:[n.jsx("span",{className:"absolute inset-0 bg-white opacity-0 group-hover:opacity-20 transition-opacity duration-300"}),n.jsx("span",{className:"relative z-10",children:y.cta}),n.jsx(io,{className:"w-6 h-6 relative z-10 group-hover:translate-x-1 transition-transform duration-300"})]}),n.jsx("p",{className:"text-sm text-gray-500 mt-4",children:"Free 14-day trial • Keep your analysis forever"})]})]}):n.jsx("div",{className:"max-w-6xl mx-auto",children:n.jsxs("div",{className:"grid lg:grid-cols-2 gap-12 items-center",children:[n.jsxs("div",{className:"space-y-8",children:[n.jsxs("div",{className:"space-y-4",children:[n.jsx("div",{className:`inline-flex p-4 rounded-full bg-gradient-to-r ${y.gradient} text-white shadow-xl transform hover:scale-110 transition-transform duration-300`,children:n.jsx(w,{className:"w-12 h-12"})}),n.jsx("h1",{className:`text-4xl font-bold bg-gradient-to-r ${y.gradient} bg-clip-text text-transparent leading-tight`,children:y.title}),n.jsx("p",{className:"text-xl text-gray-600 font-medium",children:y.subtitle}),n.jsx("p",{className:"text-lg text-gray-700 leading-relaxed",children:y.summary})]}),n.jsx("div",{className:`relative transition-all duration-1200 ease-out transform ${u?"opacity-100 translate-y-0 scale-100":"opacity-0 translate-y-12 scale-95"}`,children:n.jsxs("div",{className:`bg-gradient-to-r ${y.gradient} p-6 rounded-2xl text-white shadow-2xl relative overflow-hidden transform transition-all duration-300 hover:scale-105 hover:shadow-3xl`,children:[n.jsx(VR,{className:"absolute top-4 right-4 w-8 h-8 opacity-30 transition-opacity duration-300"}),n.jsx(VR,{className:"absolute bottom-4 left-4 w-8 h-8 opacity-30 rotate-180 transition-opacity duration-300"}),n.jsxs("blockquote",{className:"text-lg font-medium italic relative z-10",children:['"',y.quote,'"']})]})})]}),n.jsxs("div",{className:"space-y-6",children:[y.strengths&&y.strengths.length>0&&n.jsxs("div",{className:"bg-green-50 border border-green-200 rounded-2xl p-6 hover:shadow-lg transition-all duration-300",children:[n.jsxs("h3",{className:"flex items-center gap-2 text-xl font-bold text-green-800 mb-4",children:[n.jsx(di,{className:"w-6 h-6"}
1618),"Strengths"]}),n.jsx("ul",{className:"space-y-3",children:y.strengths.map((_,S)=>n.jsxs("li",{className:"flex items-start gap-3",children:[n.jsx("div",{className:"w-2 h-2 bg-green-500 rounded-full mt-2 flex-shrink-0"}),n.jsx("span",{className:"text-green-700 leading-relaxed",children:_})]},S))})]}),y.opportunities&&y.opportunities.length>0&&n.jsxs("div",{className:"bg-yellow-50 border border-yellow-200 rounded-2xl p-6 hover:shadow-lg transition-all duration-300",children:[n.jsxs("h3",{className:"flex items-center gap-2 text-xl font-bold text-yellow-800 mb-4",children:[n.jsx(ig,{className:"w-6 h-6"}),"Opportunities"]}),n.jsx("ul",{className:"space-y-3",children:y.opportunities.map((_,S)=>n.jsxs("li",{className:"flex items-start gap-3",children:[n.jsx("div",{className:"w-2 h-2 bg-yellow-500 rounded-full mt-2 flex-shrink-0"}),n.jsx("span",{className:"text-yellow-700 leading-relaxed",children:_})]},S))})]}),y.weaknesses&&y.weaknesses.length>0&&n.jsxs("div",{className:"bg-red-50 border border-red-200 rounded-2xl p-6 hover:shadow-lg transition-all duration-300",children:[n.jsxs("h3",{className:"flex items-center gap-2 text-xl font-bold text-red-800 mb-4",children:[n.jsx(nr,{className:"w-6 h-6"}),"Areas for Improvement"]}),n.jsx("ul",{className:"space-y-3",children:y.weaknesses.map((_,S)=>n.jsxs("li",{className:"flex items-start gap-3",children:[n.jsx("div",{className:"w-2 h-2 bg-red-500 rounded-full mt-2 flex-shrink-0"}),n.jsx("span",{className:"text-red-700 leading-relaxed",children:_})]},S))})]})]})]})})};return n.jsxs("div",{className:"min-h-screen bg-white",children:[n.jsxs("div",{className:"bg-white border-b border-gray-200 sticky top-0 z-50 backdrop-blur-sm bg-white/95",children:[n.jsx("div",{className:"h-1 bg-gray-100 relative overflow-hidden",children:n.jsx(ut.div,{className:`h-full bg-gradient-to-r ${y.gradient}`,initial:{width:"0%"},animate:{width:`${m}%`},transition:{duration:.1,ease:"linear"}})}),n.jsxs("div",{className:"max-w-7xl mx-auto px-4 md:px-6 py-3 md:py-4",children:[n.jsxs("div",{className:"md:hidden space-y-3",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("a",{href:"/",className:"flex-shrink-0",title:"Back to Rainfactory AI",children:n.jsx("img",{src:Kg,alt:"Rainfactory AI",className:"h-7 w-auto hover:opacity-80 transition-opacity duration-200"})}),s&&n.jsxs("button",{onClick:r,className:"group relative inline-flex items-center gap-2 px-3 py-1.5 text-xs font-semibold text-white bg-gradient-to-r from-emerald-600 to-blue-600 rounded-full shadow-lg hover:shadow-xl transform hover:scale-105 transition-all duration-300 overflow-hidden",children:[n.jsx("span",{className:"absolute inset-0 bg-white opacity-0 group-hover:opacity-20 transition-opacity duration-300"}),n.jsx("span",{className:"relative z-10",children:"I've seen enough, sign me up!"}),n.jsx(io,{className:"w-3 h-3 relative z-10 group-hover:translate-x-1 transition-transform duration-300"})]})]}),n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("button",{onClick:v,className:"p-1.5 rounded-full bg-gray-100 hover:bg-gray-200 transition-colors duration-200",children:n.jsx(Nu,{className:"w-4 h-4 text-gray-600"})}),n.jsx("button",{onClick:b,className:"p-1.5 rounded-full bg-gray-100 hover:bg-gray-200 transition-colors duration-200",children:o?n.jsx(A2,{className:"w-4 h-4 text-gray-600"}):n.jsx(ho,{className:"w-4 h-4 text-gray-600"})}),n.jsx("button",{onClick:A,className:"p-1.5 rounded-full bg-gray-100 hover:bg-gray-200 transition-colors duration-200",children:n.jsx(_s,{className:"w-4 h-4 text-gray-600"})})]}),n.jsx("div",{className:"flex items-center gap-1.5",children:p.map((N,_)=>n.jsx("button",{onClick:()=>x(_),className:`w-2.5 h-2.5 rounded-full transition-all duration-300 ${_===a?`bg-gradient-to-r ${N.gradient} scale-125`:"bg-gray-300 hover:bg-gray-400"}`},_))})]})]}),n.jsxs("div",{className:"hidden md:flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-6",children:[n.jsx("a",{href:"/",className:"flex-shrink-0",title:"Back to Rainfactory AI",children:n.jsx("img",{src:Kg,alt:"Rainfactory AI",className:"h-8 w-auto hover:opacity-80 transition-opacity duration-200"})}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("button",{onClick:v,className:"p-2 rounded-full bg-gray-100 hover:bg-gray-200 transition-colors duration-200",children:n.jsx(Nu,{className:"w-5 h-5 text-gray-600"})}),n.jsx("button",{onClick:b,className:"p-2 rounded-full bg-gray-100 hover:bg-gray-200 transition-colors duration-200",children:o?n.jsx(A2,{className:"w-5 h-5 text-gray-600"}):n.jsx(ho,{className:"w-5 h-5 text-gray-600"})}),n.jsx("button",{onClick:A,className:"p-2 rounded-full bg-gray-100 hover:bg-gray-200 transition-colors duration-200",children:n.jsx(_s,{className:"w-5 h-5 text-gray-600"})})]})]}),n.jsx("div",{className:"flex items-center gap-2",children:p.map((N,_)=>n.jsx("button",{onClick:()=>x(_),className:`w-3 h-3 rounded-full transition-all duration-300 ${_===a?`bg-gradient-to-r ${N.gradient} scale-125`:"bg-gray-300 hover:bg-gray-400"}`},_))}),s&&n.jsxs("button",{onClick:r,className:"group relative inline-flex items-center gap-2 px-4 py-2 text-sm font-semibold text-white bg-gradient-to-r from-emerald-600 to-blue-600 rounded-full shadow-lg hover:shadow-xl transform hover:scale-105 transition-all duration-300 overflow-hidden",children:[n.jsx("span",{className:"absolute inset-0 bg-white opacity-0 group-hover:opacity-20 transition-opacity duration-300"}),n.jsx("span",{className:"relative z-10",children:"I've seen enough, sign me up!"}),n.jsx(io,{className:"w-4 h-4 relative z-10 group-hover:translate-x-1 transition-transform duration-300"})]})]})]})]}),n.jsx("div",{className:"relative overflow-hidden",children:n.jsx(qh,{mode:"wait",custom:c,children:n.jsx(ut.div,{custom:c,initial:{x:c>0?"100%":"-100%",opacity:0}
1618,animate:{x:0,opacity:1},exit:{x:c>0?"-100%":"100%",opacity:0},transition:{x:{type:"spring",stiffness:300,damping:30},opacity:{duration:.3}},className:"min-h-screen flex items-center justify-center px-4 md:px-6 py-8 md:py-16",children:j()},a)})}),n.jsx("div",{className:"fixed bottom-0 left-0 right-0 h-1 bg-gray-200",children:n.jsx("div",{className:`h-full bg-gradient-to-r ${y.gradient} transition-all duration-300`,style:{width:`${(a+1)/p.length*100}%`}})})]})};function klt({brandData:e,isAnonymous:t=!1,onClaimBrand:r,onComplete:s,showClaimButton:a=!0}){var T,B,L,P,F,M,I;const[i,o]=g.useState(e.brand_analysis_results||null),[l,c]=g.useState(!1),[d,u]=g.useState(null),[h,m]=g.useState(0),[f,p]=g.useState(!0),[A,v]=g.useState(!1),x=g.useRef(null),y=(()=>{var V,R,Q,U,D,q,G,Y,K,X,ne,ae,J,W,ie,he,ee,xe,we,Se,pe,Ce,re,se,Ae,Pe,Oe,be,ue,Ee;if(!(e!=null&&e.brand_data))return[];const $=[];return $.push({type:"introduction",title:"What We Discovered",content:"We analyzed your brand's web site to learn about you and your business. Here is what we discovered while our AI does a deeper dive.",backgroundImage:(Q=(R=(V=e.metadata)==null?void 0:V.images)==null?void 0:R[0])==null?void 0:Q.url,icon:Ns}),e.brand_data.brand_name&&$.push({type:"hero",title:e.brand_data.brand_name,content:"Welcome to your brand analysis",backgroundImage:(q=(D=(U=e.metadata)==null?void 0:U.images)==null?void 0:D[0])==null?void 0:q.url,icon:Fm}),e.brand_data.elevator_pitch&&$.push({type:"elevator_pitch",title:"Your Brand Story",content:e.brand_data.elevator_pitch,backgroundImage:((K=(Y=(G=e.metadata)==null?void 0:G.images)==null?void 0:Y[1])==null?void 0:K.url)||((ae=(ne=(X=e.metadata)==null?void 0:X.images)==null?void 0:ne[0])==null?void 0:ae.url),icon:Cc}),e.brand_data.target_market&&$.push({type:"target_market",title:"Your Audience",content:e.brand_data.target_market,badges:[e.brand_data.b2b_b2c,e.brand_data.target_geography].filter(Boolean),backgroundImage:((ie=(W=(J=e.metadata)==null?void 0:J.images)==null?void 0:W[2])==null?void 0:ie.url)||((xe=(ee=(he=e.metadata)==null?void 0:he.images)==null?void 0:ee[0])==null?void 0:xe.url),icon:Ka}),(e.brand_data.value_props||e.brand_data.differentiators)&&$.push({type:"value_props",title:"What Makes You Unique",content:e.brand_data.value_props||e.brand_data.differentiators,backgroundImage:((pe=(Se=(we=e.metadata)==null?void 0:we.images)==null?void 0:Se[3])==null?void 0:pe.url)||((se=(re=(Ce=e.metadata)==null?void 0:Ce.images)==null?void 0:re[0])==null?void 0:se.url),icon:en}),e.brand_data.products_overview&&$.push({type:"products",title:"Your Offerings",content:e.brand_data.products_overview,badge:e.brand_data.niche,backgroundImage:((Oe=(Pe=(Ae=e.metadata)==null?void 0:Ae.images)==null?void 0:Pe[4])==null?void 0:Oe.url)||((Ee=(ue=(be=e.metadata)==null?void 0:be.images)==null?void 0:ue[0])==null?void 0:Ee.url),icon:CI}),$})();g.useEffect(()=>(x.current&&(clearInterval(x.current),x.current=null),f&&y.length>1&&(x.current=setInterval(()=>{m($=>($+1)%y.length)},6e3)),()=>{x.current&&(clearInterval(x.current),x.current=null)}),[f,y.length]);const w=async()=>{if(e.brand_analysis_results){console.log("[BrandAnalysis] Using cached AI analysis for brand:",e.id),o(e.brand_analysis_results),c(!1);return}c(!0),u(null);try{const $="https://worker.rainfactory.ai",V=t?"/rainfactory/anonymous-brands/generate_narrative_analysis":"/rainfactory/brand-genius";console.log("[BrandAnalysis] Fetching AI analysis for brand:",e.id);const R=t?{brandIdentifier:e.id,rawData:e.scraping_results||{brand_data:e.brand_data,metadata:e.metadata,url:e.url}}:{action:"generate_narrative_analysis",brandId:e.id,rawData:e.scraping_results||{brand_data:e.brand_data,metadata:e.metadata,url:e.url}},Q={"Content-Type":"application/json"};if(!t){const{data:{session:D}}=await de.auth.getSession();D!=null&&D.access_token&&(Q.Authorization=`Bearer ${D.access_token}`)}const U=await fetch(`${$}${V}`,{method:"POST",headers:Q,body:JSON.stringify(R)});if(U.ok){const D=await U.json();console.log("[BrandAnalysis] AI Analysis result:",D),o(D)}else{const D=await U.json();console.error("[BrandAnalysis] AI Analysis error:",D),u(D.error||"Failed to generate deeper insights")}}catch($){console.error("[BrandAnalysis] Network error fetching AI analysis:",$),u("Failed to generate deeper insights")}finally{c(!1)}};g.useEffect(()=>{e&&!i&&!l&&w()},[e]);const j=()=>{p($=>!$)},N=$=>{x.current&&(clearInterval(x.current),x.current=null),m($),p(!1)},_=()=>{if(y.length===0)return;const $=h===0?y.length-1:h-1;N($)},S=()=>
1618{if(y.length===0)return;const $=(h+1)%y.length;N($)},C=()=>{!l&&i&&(v(!0),p(!1))},E=()=>{r&&r()};return n.jsxs("div",{className:"min-h-screen bg-black overflow-x-hidden",children:[!A&&y.length>0&&n.jsxs("div",{className:"relative min-h-screen w-full",children:[((T=y[h])==null?void 0:T.backgroundImage)&&n.jsx("div",{className:"absolute inset-0 bg-cover bg-center transition-all duration-1000 ease-in-out pointer-events-none",style:{backgroundImage:`url(${y[h].backgroundImage})`},children:n.jsx("div",{className:"absolute inset-0 bg-black bg-opacity-40"})}),n.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-black/60 via-transparent to-black/60 pointer-events-none"}),n.jsxs("div",{className:"relative z-10 h-full flex flex-col items-center justify-center px-4 md:px-6",children:[n.jsx("div",{className:"max-w-4xl mx-auto text-center text-white",children:n.jsxs("div",{className:"animate-fade-in",children:[((B=y[h])==null?void 0:B.icon)&&n.jsx("div",{className:"mb-3 md:mb-6",children:(()=>{const $=y[h].icon;return $?n.jsx($,{className:"h-8 w-8 md:h-16 md:w-16 mx-auto text-white/80 mb-2 md:mb-4"}):null})()}),n.jsx("h1",{className:"text-3xl sm:text-4xl md:text-5xl lg:text-7xl font-bold mb-3 md:mb-6 leading-tight",children:(L=y[h])==null?void 0:L.title}),n.jsx("p",{className:"text-base sm:text-lg md:text-xl lg:text-2xl mb-4 md:mb-8 leading-relaxed max-w-3xl mx-auto",children:(P=y[h])==null?void 0:P.content}),((F=y[h])==null?void 0:F.badges)&&n.jsx("div",{className:"flex flex-wrap justify-center gap-2 md:gap-3 mb-4 md:mb-8",children:y[h].badges.map(($,V)=>n.jsx(Be,{variant:"secondary",className:"text-sm md:text-lg px-3 py-1.5 md:px-4 md:py-2",children:$},V))}),((M=y[h])==null?void 0:M.badge)&&n.jsx("div",{className:"mb-4 md:mb-8",children:n.jsx(Be,{variant:"secondary",className:"text-sm md:text-lg px-3 py-1.5 md:px-4 md:py-2",children:y[h].badge})})]})}),(l||!l&&i)&&n.jsx("div",{className:"mt-6 md:mt-10 w-full max-w-2xl mx-auto",children:n.jsx("div",{className:"relative overflow-hidden rounded-2xl bg-white/10 backdrop-blur-md border border-white/20 px-5 py-4 md:px-6 md:py-5 shadow-2xl",children:l?n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center justify-center gap-3 md:gap-4",children:[n.jsx(kt,{className:"h-6 w-6 md:h-7 md:w-7 text-white animate-spin"}),n.jsxs("div",{className:"text-left",children:[n.jsx("p",{className:"text-base md:text-lg font-semibold",children:"Creating Personalized Insights"}),n.jsx("p",{className:"text-xs md:text-sm text-white/70",children:"Analyzing your brand and preparing recommendations…"})]})]}),n.jsx("div",{className:"mt-4 h-2 w-full bg-white/10 rounded-full overflow-hidden",children:n.jsx("div",{className:"h-full w-1/2 bg-gradient-to-r from-indigo-400 via-blue-400 to-cyan-400 animate-pulse rounded-full"})})]}):n.jsxs("div",{className:"flex flex-col items-center text-center gap-4",children:[n.jsxs("div",{className:"inline-flex items-center gap-2 bg-white/10 backdrop-blur-sm rounded-full px-4 py-2 text-white text-sm",children:[n.jsx(di,{className:"h-4 w-4 text-green-400"}),"Your brand deep dive is ready"]}),n.jsxs(c6,{onClick:C,className:"text-xl px-8 py-4 shadow-2xl hover:scale-105 transition-transform",children:["Continue to Deeper Insights",n.jsx(io,{className:"h-6 w-6 ml-2"})]})]})})})]}),n.jsxs("div",{className:"absolute bottom-6 md:bottom-8 left-1/2 transform -translate-x-1/2 flex items-center gap-3 md:gap-4 z-20",children:[n.jsx("div",{className:"flex gap-1.5 md:gap-2",children:y.map(($,V)=>n.jsx("button",{onClick:R=>{R.preventDefault(),R.stopPropagation(),N(V)},className:`w-2.5 h-2.5 md:w-3 md:h-3 rounded-full transition-all duration-300 hover:scale-110 ${V===h?"bg-white":"bg-white/40 hover:bg-white/60"}`,"aria-label":`Go to slide ${V+1}`},V))}),n.jsx("button",{onClick:$=>{$.preventDefault(),$.stopPropagation(),j()},className:"p-1.5 md:p-2 bg-white/20 rounded-full hover:bg-white/30 transition-colors hover:scale-110","aria-label":f?"Pause slideshow":"Play slideshow",children:f?n.jsx(A2,{className:"h-4 w-4 md:h-5 md:w-5 text-white"}):n.jsx(ho,{className:"h-4 w-4 md:h-5 md:w-5 text-white"})})]}),y.length>1&&n.jsxs(n.Fragment,{children:[n.jsx("button",{onClick:$=>{$.preventDefault(),$.stopPropagation(),_()},className:"absolute left-4 md:left-6 top-1/2 transform -translate-y-1/2 p-2 md:p-3 bg-white/20 rounded-full hover:bg-white/30 transition-all hover:scale-110 z-20","aria-label":"Previous slide",children:n.jsx(Nu,{className:"h-5 w-5 md:h-6 md:w-6 text-white"})}),n.jsx("button",{onClick:$=>{$.preventDefault(),$.stopPropagation(),S()},className:"absolute right-4 md:right-6 top-1/2 transform -translate-y-1/2 p-2 md:p-3 bg-white/20 rounded-full hover:bg-white/30 transition-all hover:scale-110 z-20","aria-label":"Next slide",children:n.jsx(_s,{className:"h-5 w-5 md:h-6 md:w-6 text-white"})})]})]}),A&&i&&n.jsx(Slt,{aiAnalysis:i,brandName:((I=e==null?void 0:e.brand_data)==null?void 0:I.brand_name)||(e==null?void 0:e.brand_name)||"Your Brand",onClaimBrand:a?E:()=>
1618s==null?void 0:s(),isAnonymous:t}),A&&l&&n.jsx("div",{className:"min-h-screen bg-gradient-to-br from-blue-50 to-indigo-100 dark:from-gray-900 dark:to-gray-800 flex items-center justify-center",children:n.jsxs("div",{className:"text-center",children:[n.jsx(kt,{className:"h-12 w-12 animate-spin mx-auto mb-4 text-primary"}),n.jsx("h2",{className:"text-2xl font-bold mb-2",children:"Preparing Your Personalized Insights"}),n.jsx("p",{className:"text-muted-foreground",children:"Our AI is analyzing your brand data to create a comprehensive slideshow presentation..."})]})}),A&&d&&n.jsx("div",{className:"min-h-screen bg-gradient-to-br from-blue-50 to-indigo-100 dark:from-gray-900 dark:to-gray-800 flex items-center justify-center",children:n.jsxs("div",{className:"text-center",children:[n.jsx(nr,{className:"h-12 w-12 text-red-500 mx-auto mb-4"}),n.jsx("h2",{className:"text-2xl font-bold mb-2",children:"Analysis Failed"}),n.jsx("p",{className:"text-muted-foreground mb-6",children:d}),n.jsx(te,{onClick:()=>v(!1),children:"Go Back"})]})})]})}function Elt(){const{id:e}=Ei(),t=xr(),{brand:r,loading:s,fetchBrandDetails:a}=_0(e),[i,o]=g.useState(!0),[l,c]=g.useState(null),[d,u]=g.useState([]),h=async A=>{try{const{data:v,error:x}=await de.from("resource_cache").select("url_to_inject, description, metadata").eq("brand_id",A).eq("type","image").eq("processed",!0).not("url_to_inject","is",null);return x?(console.error("Error fetching resource images:",x),[]):(v==null?void 0:v.map(b=>{var y;return{url:b.url_to_inject,description:b.description||void 0,dimensions:((y=b.metadata)==null?void 0:y.dimensions)||void 0}}))||[]}catch(v){return console.error("Error fetching resource images:",v),[]}};g.useEffect(()=>{(async()=>{if(!e){c("No brand ID provided"),o(!1);return}try{if(!await a(e))c("Brand not found");else{const x=await h(e);u(x)}o(!1)}catch(v){console.error("Error loading brand:",v),c("Failed to load brand"),o(!1)}})()},[e,a]);const m=()=>{var A;return r?{id:r.id,url:r.url||void 0,brand_name:r.brand_name||void 0,brand_data:{brand_name:r.brand_name||void 0,elevator_pitch:r.elevator_pitch||void 0,target_market:r.target_market||void 0,value_props:r.value_props||void 0,differentiators:r.differentiators||void 0,brand_voice:r.brand_voice||void 0,call_to_action:r.cta||void 0,niche:r.niche||void 0,target_geography:r.target_geography||void 0,products_overview:r.products_overview||void 0,b2b_b2c:r.b2b_b2c||void 0},metadata:{...r.metadata,images:d.length>0?d:void 0},scraping_results:r.web_site_scraping_results||void 0,brand_analysis_results:((A=r.metadata)==null?void 0:A.brand_analysis_results)||void 0}:null},f=()=>{t(`/brands/${e}`)};if(i||s)return n.jsx("div",{className:"min-h-screen bg-gradient-to-br from-blue-50 to-indigo-100 dark:from-gray-900 dark:to-gray-800 flex items-center justify-center",children:n.jsx("div",{className:"max-w-md mx-auto text-center",children:n.jsxs("div",{className:"mb-6",children:[n.jsx(kt,{className:"h-12 w-12 animate-spin mx-auto mb-4 text-primary"}),n.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Loading Brand Analysis"}),n.jsx("p",{className:"text-muted-foreground",children:"Fetching your brand data..."})]})})});if(l||!r)return n.jsx("div",{className:"min-h-screen bg-gradient-to-br from-blue-50 to-indigo-100 dark:from-gray-900 dark:to-gray-800 flex items-center justify-center",children:n.jsxs("div",{className:"max-w-md mx-auto text-center",children:[n.jsx(nr,{className:"h-12 w-12 text-red-500 mx-auto mb-4"}),n.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Error Loading Brand"}),n.jsx("p",{className:"text-muted-foreground mb-6",children:l||"Failed to load brand data"}),n.jsx(te,{onClick:()=>t("/brands"),children:"Back to Brands"})]})});const p=m();return p?n.jsx(klt,{brandData:p,isAnonymous:!1,onComplete:f,showClaimButton:!1}):n.jsx("div",{className:"min-h-screen bg-gradient-to-br from-blue-50 to-indigo-100 dark:from-gray-900 dark:to-gray-800 flex items-center justify-center",children:n.jsxs("div",{className:"max-w-md mx-auto text-center",children:[n.jsx(nr,{className:"h-12 w-12 text-yellow-500 mx-auto mb-4"}),n.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Incomplete Brand Data"}),n.jsx("p",{className:"text-muted-foreground mb-6",children:"This brand doesn't have enough data for analysis yet."}),n.jsx(te,{onClick:()=>t(`/brands/${e}`),children:"Complete Brand Setup"})]})})}const N6=e=>{const[t,r]=g.useState([]),[s,a]=g.useState({}),[i,o]=g.useState({}),[l,c]=g.useState(!0),[d,u]=g.useState([]),[h,m]=g.useState(!1);g.useEffect(()=>{if(!e)return;(async()=>{try{const{data:F,error:M}=await de.from("platforms").select("*");
1618if(M)throw M;const I=F||[];r(I);const $={};I.forEach(V=>{$[V.id]="idle"}),o($),await p(I)}catch(F){console.error("Error fetching platforms:",F),He({title:"Error",description:"Failed to load platform data",variant:"destructive"})}})()},[e]);const f=P=>{if(!P||!P.expires_at)return!1;try{const F=new Date(P.expires_at).getTime();return Date.now()>=F}catch(F){return console.error("Error parsing expires_at:",F),!1}},p=async P=>{if(e)try{const{data:F,error:M}=await de.from("platform_brand_settings").select("*, platforms(name, platform_key, type)").eq("brand_id",e);if(M)throw M;console.log("=== fetchPlatformSettings DATA FROM DB ==="),console.log("Raw data from database:",JSON.stringify(F,null,2));const I={},$=[];F==null||F.forEach(V=>{if(!V.error_message&&V.connection_details){const R=V.connection_details;R.error_message&&(V.error_message=R.error_message)}V.status==="CONNECTED"&&f(V.connection_details)&&(console.log(`Platform ${V.platform_id} token has expired`),V.status="AUTHENTICATION_FAILED",V.error_message="OAuth token has expired. Please reconnect your account.",$.push({id:V.id,platformId:V.platform_id})),V.status==="DISCONNECTED"&&V.error_message&&console.log(`Platform ${V.platform_id} is disconnected with error: ${V.error_message}`),I[V.platform_id]=V}),$.length>0&&(console.log(`Updating ${$.length} expired platform(s) in database`),$.forEach(async({id:V})=>{try{await de.from("platform_brand_settings").update({status:"AUTHENTICATION_FAILED",error_message:"OAuth token has expired. Please reconnect your account.",updated_at:new Date().toISOString()}).eq("id",V)}catch(R){console.error(`Failed to update expired platform ${V}:`,R)}})),a(I),await A(P,I),c(!1)}catch(F){console.error("Error fetching platform settings:",F),He({title:"Error",description:"Failed to load platform settings",variant:"destructive"}),c(!1)}},A=async(P,F)=>{var M;if(!(!e||!P||P.length===0))try{const $=(M=(await de.auth.getSession()).data.session)==null?void 0:M.user.id;if(!$){console.warn("User ID not available, skipping default settings creation");return}const V=P.filter(D=>!F[D.id]);if(V.length===0)return;console.log(`Creating default settings for ${V.length} platforms`);const R=V.map(D=>({brand_id:e,platform_id:D.id,autopost_enabled:!1,autogenerate_enabled:!1,posting_frequency:"DAILY",preferred_time:"09:00",preferred_days:[],status:D.platform_key==="rss"?"CONNECTED":"DISCONNECTED",connection_details:{},user_id:$})),{data:Q,error:U}=await de.from("platform_brand_settings").insert(R).select();if(U){console.error("Error creating default platform settings:",U);return}console.log(`Created ${(Q==null?void 0:Q.length)||0} default platform settings`),Q&&Q.length>0&&a(D=>{const q={...D};return Q.forEach(G=>{q[G.platform_id]=G}),q})}catch(I){console.error("Error creating default platform settings:",I)}},v=async(P,F)=>{var M;if(e)try{const $=(M=(await de.auth.getSession()).data.session)==null?void 0:M.user.id;if(!$)throw new Error("User ID not available. Please log in again.");const{data:V,error:R}=await de.from("platform_brand_settings").select("*").eq("platform_id",P).eq("brand_id",e).single();if(R)throw new Error("Failed to fetch brand settings");if(V){const{data:Q,error:U}=await de.from("platform_brand_settings").update({autopost_enabled:F.autopost_enabled!==void 0?F.autopost_enabled:V.autopost_enabled,autogenerate_enabled:F.autogenerate_enabled!==void 0?F.autogenerate_enabled:V.autogenerate_enabled||!1,posting_frequency:F.posting_frequency||V.posting_frequency,preferred_time:F.preferred_time||V.preferred_time,preferred_days:F.preferred_days||V.preferred_days,config:F.config!==void 0?F.config:V.config,updated_at:new Date().toISOString(),connection_details:F.connection_details||V.connection_details,status:F.status||V.status,error_message:F.error_message||V.error_message}).eq("id",V.id).select().single();if(U)throw U;a(D=>{const q={...D};return q[P]=Q,q})}else{const{data:Q,error:U}=await de.from("platform_brand_settings").insert({brand_id:e,platform_id:P,autopost_enabled:F.autopost_enabled||!1,autogenerate_enabled:F.autogenerate_enabled||!1,posting_frequency:F.posting_frequency||"WEEKLY",preferred_time:F.preferred_time||"09:00",preferred_days:F.preferred_days||[],config:F.config||null,status:F.status||"DISCONNECTED",connection_details:F.connection_details||{},user_id:$,error_message:F.error_message||null}).select().single();if(U)throw U;a(D=>{const q={...D};return q[P]=Q,q})}He({title:"Settings Saved",description:"Platform settings have been updated successfully",variant:"default",duration:3e3,className:"bg-green-50 dark:bg-green-900/10 border-green-200 dark:border-green-900/50"})}catch(I){console.error("Error saving platform settings:",I),He({t
1618itle:"Error",description:"Failed to save platform settings",variant:"destructive"})}},x=async(P,F,M)=>{if(e)try{let I=F;["CONNECTED","DISCONNECTED","AUTHENTICATION_FAILED","PENDING"].includes(I)||(console.warn(`Invalid status value: ${F}, defaulting to DISCONNECTED`),I="DISCONNECTED");const $=s[P];if($&&$.status===I){console.log(`Status already set to ${I}, skipping update`),o(R=>({...R,[P]:I==="CONNECTED"?"success":I==="DISCONNECTED"?"idle":I==="AUTHENTICATION_FAILED"?"error":"testing"}));return}const V={status:I,updated_at:new Date().toISOString()};if(M){V.error_message=M;const{data:R}=await de.from("platform_brand_settings").select("connection_details").eq("platform_id",P).eq("brand_id",e).single();R&&R.connection_details?V.connection_details={...R.connection_details,error_message:M}:V.connection_details={error_message:M}}else{V.error_message=null;const{data:R}=await de.from("platform_brand_settings").select("connection_details").eq("platform_id",P).eq("brand_id",e).single();if(R&&R.connection_details){const Q={...R.connection_details};delete Q.error_message,V.connection_details=Q}}try{const{error:R}=await de.from("platform_brand_settings").update(V).eq("platform_id",P).eq("brand_id",e);R&&console.error("Database error updating connection status:",R)}catch(R){console.error("Exception during database update:",R)}a(R=>{const Q={...R};return Q[P]&&(Q[P]={...Q[P],status:I,...M?{error_message:M}:{}}),Q}),o(R=>({...R,[P]:I==="CONNECTED"?"success":I==="DISCONNECTED"?"idle":I==="AUTHENTICATION_FAILED"?"error":"testing"})),(I!=="CONNECTED"||M)&&He(I==="PENDING"?{title:"Connecting...",description:"Setting up your platform connection. This may take a moment.",variant:"default",className:"bg-blue-50 dark:bg-blue-900/10 border-blue-200 dark:border-blue-900/50"}:{title:`Connection ${I==="DISCONNECTED"?"Disabled":I}`,description:M||`Platform status has been set to ${I}`,variant:I==="CONNECTED"?"default":"destructive",className:I==="CONNECTED"?"bg-green-50 dark:bg-green-900/10 border-green-200 dark:border-green-900/50":""})}catch(I){console.error("Error updating connection status:",I),He({title:"Error",description:"Failed to update connection status",variant:"destructive"})}},b=async(P,F)=>{var M,I;if(e)try{const $=await de.auth.getSession(),V=(M=$.data.session)==null?void 0:M.user.id,R=(I=$.data.session)==null?void 0:I.access_token;if(!V)throw new Error("User ID not available. Please log in again.");const Q=t.find(q=>q.platform_key===P);if(!Q)throw new Error(`Platform ${P} not found`);if(await x(Q.id,"PENDING"),P==="linkedin"){await y(Q);return}if(P==="twitter"){await j(Q);return}if(P==="instagram"){await _(Q,F);return}if(P==="facebook"){await C(Q);return}if(P==="rss"){await x(Q.id,"CONNECTED"),He({title:"RSS Feed Ready",description:`Your RSS feed is now available for ${Q.name}`,variant:"default",className:"bg-green-50 dark:bg-green-900/10 border-green-200 dark:border-green-900/50"}),setTimeout(()=>{o(q=>({...q,[Q.id]:"idle"}))},3e3);return}if(P==="wordpress"||P==="medium"){await x(Q.id,"CONNECTED"),He({title:"Connection Successful",description:`Successfully connected to ${Q.name}`,variant:"default",className:"bg-green-50 dark:bg-green-900/10 border-green-200 dark:border-green-900/50"}),setTimeout(()=>{o(q=>({...q,[Q.id]:"idle"}))},3e3);return}const D=await(await fetch(`https://worker.rainfactory.ai/rainfactory/test-connection/${P}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${R}`},body:JSON.stringify({brandId:e,platformId:Q.id})})).json();D.success?(o(q=>({...q,[Q.id]:"success"})),He({title:"Connection Successful",description:D.message||`Successfully connected to ${Q.name}`,variant:"default",className:"bg-green-50 dark:bg-green-900/10 border-green-200 dark:border-green-900/50"}),await x(Q.id,"CONNECTED")):(o(q=>({...q,[Q.id]:"error"})),await x(Q.id,"AUTHENTICATION_FAILED",D.message),He({title:"Connection Failed",description:D.message||`Could not connect to ${Q.name}`,variant:"destructive"}))}catch($){console.error("Error initiating auth flow:",$);const V=t.find(R=>R.platform_key===P);V&&(o(R=>({...R,[V.id]:"error"})),await x(V.id,"AUTHENTICATION_FAILED",$ instanceof Error?$.message:"Failed to start authentication process")),He({t
1618itle:"Authentication Error",description:$ instanceof Error?$.message:"Failed to start authentication process",variant:"destructive"})}},y=async P=>{var F;try{const I=(F=(await de.auth.getSession()).data.session)==null?void 0:F.access_token,$=`${window.location.origin}/auth/linkedin/callback`,R=await(await fetch("https://worker.rainfactory.ai/rainfactory/connections/initiate-auth/linkedin",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${I}`},body:JSON.stringify({brandId:e,platformId:P.id,redirectUri:$})})).json();if(!R.success||!R.authUrl)throw new Error(R.message||"Failed to initiate LinkedIn authentication");localStorage.setItem("linkedin_auth_state",R.state),localStorage.setItem("linkedin_auth_platform_id",P.id),localStorage.setItem("linkedin_auth_brand_id",e||""),window.open(R.authUrl,"linkedin_auth","width=600,height=700"),window.addEventListener("message",w,!1),He({title:"LinkedIn Authentication",description:"Please complete the authentication in the popup window",duration:1e4})}catch(M){console.error("Error initiating LinkedIn auth:",M),o(I=>({...I,[P.id]:"error"})),He({title:"LinkedIn Authentication Failed",description:M instanceof Error?M.message:"Failed to start LinkedIn authentication",variant:"destructive"}),setTimeout(()=>{o(I=>({...I,[P.id]:"idle"}))},3e3)}},w=async P=>{var M;if(P.origin!==window.location.origin)return;const F=P.data;if(F.type==="linkedin_auth_callback")try{window.removeEventListener("message",w);const{code:I,state:$,error:V}=F,R=localStorage.getItem("linkedin_auth_state"),Q=localStorage.getItem("linkedin_auth_platform_id"),U=localStorage.getItem("linkedin_auth_brand_id");if(localStorage.removeItem("linkedin_auth_state"),localStorage.removeItem("linkedin_auth_platform_id"),localStorage.removeItem("linkedin_auth_brand_id"),$!==R)throw new Error("Invalid state parameter. Authentication request may have been tampered with.");if(V)throw V==="user_cancelled_login"||V==="user_cancelled_authorize"?new Error("Authentication was canceled by the user."):new Error(`LinkedIn authentication error: ${V}`);if(!I)throw new Error("No authorization code received");const q=(M=(await de.auth.getSession()).data.session)==null?void 0:M.access_token,G=`${window.location.origin}/auth/linkedin/callback`,K=await(await fetch("https://worker.rainfactory.ai/rainfactory/connections/auth-callback/linkedin",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${q}`},body:JSON.stringify({code:I,state:$,redirectUri:G,brandId:U,platformId:Q})})).json();if(K.success)o(X=>({...X,[Q]:"success"})),He({title:"LinkedIn Connected",description:"Successfully connected to LinkedIn",variant:"default",className:"bg-green-50 dark:bg-green-900/10 border-green-200 dark:border-green-900/50"}),await x(Q,"CONNECTED"),await p(t);else throw new Error(K.message||"Failed to complete LinkedIn authentication")}catch(I){console.error("LinkedIn callback error:",I),He({title:"LinkedIn Connection Failed",description:I instanceof Error?I.message:"Failed to connect to LinkedIn",variant:"destructive"});const $=t.find(V=>V.platform_key==="linkedin");$&&(o(V=>({...V,[$.id]:"error"})),setTimeout(()=>{o(V=>({...V,[$.id]:"idle"}))},3e3))}},j=async P=>{var F,M;try{const I=await de.auth.getSession(),$=(F=I.data.session)==null?void 0:F.user.id,V=(M=I.data.session)==null?void 0:M.access_token;if(!$)throw new Error("User ID not available. Please log in again.");const R=`${window.location.origin}/auth/twitter/callback`,U=await(await fetch("https://worker.rainfactory.ai/rainfactory/connections/initiate-auth/twitter",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${V}`},body:JSON.stringify({brandId:e,platformId:P.id,redirectUri:R})})).json();if(!U.success||!U.authUrl)throw o(D=>({...D,[P.id]:"error"})),await x(P.id,"AUTHENTICATION_FAILED",U.message||"Failed to initiate Twitter authentication"),new Error(U.message||"Failed to initiate Twitter authentication");window.open(U.authUrl,"twitter_auth","width=600,height=700"),He({title:"Twitter Authentication",description:"Please complete the authentication in the popup window",duration:1e4})}catch(I){console.error("Error initiating Twitter auth:",I),o($=>({...$,[P.id]:"error"})),await x(P.id,"AUTHENTICATION_FAILED",I instanceof Error?I.message:"Failed to start Twitter authentication"),He({title:"Twitter Authentication Failed",description:I instanceof Error?I.message:"Failed to start Twitter authentication",variant:"destructive"})}},N=async P=>{var M;if(P.origin!==window.location.origin)return;const F=P.data;if(F.type==="instagram_auth_callback")try{window.removeEventListener("message",N);const{code:I,state:$,error:V}=F,R=localStorage.getItem("instagram_auth_state"),Q=localStorage.getItem("instagram_auth_platform_id"),U=localStorage.getItem("instagram_auth_brand_id");if(localStorage.removeItem("instagram_auth_state"),localStorage.removeItem("instagram_auth_platform_id"),localStorage.removeItem("instagram_auth_brand_id"),$!==R)throw new Error("Invalid state parameter. Authentication request may have been tampered with.");if(V)throw new Error(`Instagram authentication error: ${V}`);if(!I)throw new Error("No authorization code received");const q=(M=(await de.auth.getSession()).data.session)==null?void 0:M.access_token;if(!q||!Q||!U)throw new Error("Missing required authentication data");const Y=await(await fetch("https://worker.rainfactory.ai/rainfactory/auth-callback/instagram",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${q}`},body:JSON.stringify({code:I,state:$,redirectUri:`${window.location.origin}/auth/instagram/callback`,brandId:U,platformId:Q})})).json();if(!Y.success)throw new Error(Y.message||"Failed to complete Instagram authentication");o(K=>({...K,[Q]:"success"})),await x(Q,"CONNECTED"),He({title:"Instagram Connected",description:"Successfully connected to Instagram."}),await p(t)}catch(I){console.error("Error handling Instagram callback:",I);const $=localStorage.getItem("instagram_auth_platform_id");
1618$&&(o(V=>({...V,[$]:"error"})),await x($,"AUTHENTICATION_FAILED",I instanceof Error?I.message:"Failed to complete Instagram authentication")),He({title:"Instagram Authentication Failed",description:I instanceof Error?I.message:"Failed to complete Instagram authentication",variant:"destructive"})}},_=async(P,F)=>{var M;try{o(Y=>({...Y,[P.id]:"testing"})),await x(P.id,"PENDING");const $=(M=(await de.auth.getSession()).data.session)==null?void 0:M.access_token;if(!$)throw new Error("No access token available");const R=await(await fetch("https://worker.rainfactory.ai/rainfactory/connections/initiate-auth/instagram",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${$}`},body:JSON.stringify({brandId:e,platformId:P.id,redirectUri:`${window.location.origin}/auth/instagram/callback`,authType:F||"FACEBOOK_LOGIN"})})).json();if(!R.success||!R.authUrl)throw new Error(R.message||"Failed to initiate Instagram authentication");localStorage.setItem("instagram_auth_state",R.state),localStorage.setItem("instagram_auth_platform_id",P.id),localStorage.setItem("instagram_auth_brand_id",e||""),window.addEventListener("message",N);const Q=600,U=700,D=window.screenX+(window.outerWidth-Q)/2,q=window.screenY+(window.outerHeight-U)/2,G=window.open("about:blank","instagram_auth_popup",`width=${Q},height=${U},left=${D},top=${q}`);if(!G)throw new Error("Failed to open popup window. Please allow popups for this site.");G.location.href=R.authUrl}catch(I){console.error("Error starting Instagram auth:",I),o($=>({...$,[P.id]:"error"})),await x(P.id,"AUTHENTICATION_FAILED",I instanceof Error?I.message:"Failed to start Instagram authentication"),He({title:"Instagram Authentication Failed",description:I instanceof Error?I.message:"Failed to start Instagram authentication",variant:"destructive"})}},S=async P=>{var M;if(P.origin!==window.location.origin)return;const F=P.data;if(F.type==="facebook_auth_callback")try{window.removeEventListener("message",S);const{code:I,state:$,error:V}=F,R=localStorage.getItem("facebook_auth_state"),Q=localStorage.getItem("facebook_auth_platform_id"),U=localStorage.getItem("facebook_auth_brand_id");if(localStorage.removeItem("facebook_auth_state"),localStorage.removeItem("facebook_auth_platform_id"),localStorage.removeItem("facebook_auth_brand_id"),$!==R)throw new Error("Invalid state parameter. Authentication request may have been tampered with.");if(V)throw new Error(`Facebook authentication error: ${V}`);if(!I)throw new Error("No authorization code received");const q=(M=(await de.auth.getSession()).data.session)==null?void 0:M.access_token;if(!q||!Q||!U)throw new Error("Missing required authentication data");const Y=await(await fetch("https://worker.rainfactory.ai/rainfactory/auth-callback/facebook",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${q}`},body:JSON.stringify({code:I,state:$,redirectUri:`${window.location.origin}/auth/facebook/callback`,brandId:U,platformId:Q})})).json();if(!Y.success)throw new Error(Y.message||"Failed to complete Facebook authentication");o(K=>({...K,[Q]:"success"})),await x(Q,"CONNECTED"),He({title:"Facebook Connected",description:"Successfully connected to Facebook."}),await p(t)}catch(I){console.error("Error handling Facebook callback:",I);const $=localStorage.getItem("facebook_auth_platform_id");$&&(o(V=>({...V,[$]:"error"})),await x($,"AUTHENTICATION_FAILED",I instanceof Error?I.message:"Failed to complete Facebook authentication")),He({title:"Facebook Authentication Failed",description:I instanceof Error?I.message:"Failed to complete Facebook authentication",variant:"destructive"})}},C=async P=>{var F;try{o(G=>({...G,[P.id]:"testing"})),await x(P.id,"PENDING");const I=(F=(await de.auth.getSession()).data.session)==null?void 0:F.access_token;if(!I)throw new Error("No access token available");const V=await(await fetch("https://worker.rainfactory.ai/rainfactory/connections/initiate-auth/facebook",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${I}`},body:JSON.stringify({brandId:e,platformId:P.id,redirectUri:`${window.location.origin}/auth/facebook/callback`})})).json();if(!V.success||!V.authUrl)throw new Error(V.message||"Failed to initiate Facebook authentication");localStorage.setItem("facebook_auth_state",V.state),localStorage.setItem("facebook_auth_platform_id",P.id),localStorage.setItem("facebook_auth_brand_id",e||""),window.addEventListener("message",S);const R=600,Q=700,U=window.screenX+(window.outerWidth-R)/2,D=window.screenY+(window.outerHeight-Q)/2,q=window.open("about:blank","facebook_auth_popup",`width=${R},height=${Q},left=${U},top=${D}`);if(!q)throw new Error("Failed to open popup window. Please allow popups for this site.");q.location.href=V.authUrl}catch(M){console.error("Error starting Facebook auth:",M),o(I=>({...I,[P.id]:"error"})),await x(P.id,"AUTHENTICATION_FAILED",M instanceof Error?M.message:"Failed to start Facebook authentication"),He({title:"Facebook Authentication Failed",description:M instanceof Error?M.message:"Failed to start Facebook authentication",variant:"destructive"})}};return{platforms:t,platformSettings:s,platformConnectionStatus:i,loading:l,savePlatformSettings:v,updateConnectionStatus:x,testPlatformConnection:async P=>{if(e)try{o(M=>({...M,[P]:"testing"}));const F=t.find(M=>M.id===P);if(!F)throw new Error("Platform not found");await b(F.platform_key)}catch(F){o(I=>({...I,[P]:"error"})),console.error("Error testing platform connection:",F);const M=F instanceof Error?F.message:"An error occurred while testing the connection";
1618He({title:"Connection Error",description:M,variant:"destructive"}),x(P,"AUTHENTICATION_FAILED",M),setTimeout(()=>{o(I=>({...I,[P]:"idle"}))},3e3)}},initiateAuthFlow:b,fetchLinkedInOrganizations:async P=>{var $,V,R,Q;if(!e)return[];const F=1e4,M=Date.now(),I=parseInt(localStorage.getItem(`linkedin_org_fetch_${P}`)||"0");if(M-I<F)return console.log("Skipping LinkedIn organizations fetch due to debounce",{now:M,lastFetchAttempt:I}),d;localStorage.setItem(`linkedin_org_fetch_${P}`,M.toString());try{m(!0);const U=s[P];if(!U)return console.warn("Platform settings not found for LinkedIn organization fetch"),d;if(U.status!=="CONNECTED")return console.log("LinkedIn not connected, skipping organization fetch"),d;const D=(($=U==null?void 0:U.connection_details)==null?void 0:$.post_as_organization)===!0,q=(V=U==null?void 0:U.connection_details)==null?void 0:V.organization_id;if(D&&q&&d.length===0){const ae=((R=U==null?void 0:U.connection_details)==null?void 0:R.organization_name)||`Organization ${q}`;u([{id:q,name:ae}])}const Y=(Q=(await de.auth.getSession()).data.session)==null?void 0:Q.access_token;if(!Y)throw new Error("No access token available. Please log in again.");const X=await(await fetch("https://worker.rainfactory.ai/rainfactory/connections/list-linkedin-organizations/linkedin",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Y}`},body:JSON.stringify({brandId:e,platformId:P})})).json();if(!X.success)throw new Error(X.message||"Failed to fetch LinkedIn organizations");const ne=X.organizations||[];if(console.log("Fetched LinkedIn organizations:",ne),u(ne),D&&q){const ae=ne.find(J=>J.id===q);ae&&ae.name&&(a(J=>{const W={...J};return W[P]&&W[P].connection_details&&(W[P].connection_details={...W[P].connection_details,organization_name:ae.name}),W}),await de.from("platform_brand_settings").update({connection_details:{...U.connection_details,organization_name:ae.name}}).eq("id",U.id))}return ne}catch(U){return console.error("Error fetching LinkedIn organizations:",U),d.length===0&&U instanceof Error&&U.message.includes("ACCESS_DENIED")&&(console.warn("LinkedIn API access denied - not updating platform status to avoid loop"),localStorage.getItem(`linkedin_org_error_shown_${P}`)||(localStorage.setItem(`linkedin_org_error_shown_${P}`,"true"),He({title:"LinkedIn Organization Access",description:"Could not access your LinkedIn organizations. You may need to reconnect your account with proper permissions.",variant:"destructive"}))),d}finally{m(!1)}},setLinkedInOrganization:async(P,F)=>{var M;if(e){if(F==="personal")try{const I=s[P];if(!I)throw new Error("Platform settings not found");const $={...I.connection_details||{},organization_id:void 0,organization_name:void 0,post_as_organization:!1};return await v(P,{connection_details:$}
1618),He({title:"LinkedIn Profile Set",description:"Posts will be published as your personal LinkedIn profile",variant:"default",className:"bg-green-50 dark:bg-green-900/10 border-green-200 dark:border-green-900/50"}),!0}catch(I){return console.error("Error setting LinkedIn to personal account:",I),He({title:"Error",description:I instanceof Error?I.message:"Failed to update LinkedIn settings",variant:"destructive"}),!1}try{const I=d.find(D=>D.id===F),$=(I==null?void 0:I.name)||`Organization ${F}`,R=(M=(await de.auth.getSession()).data.session)==null?void 0:M.access_token;if(!R)throw new Error("No access token available. Please log in again.");const U=await(await fetch("https://worker.rainfactory.ai/rainfactory/connections/set-linkedin-organization/linkedin",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${R}`},body:JSON.stringify({brandId:e,platformId:P,organizationId:F})})).json();if(!U.success)throw new Error(U.message||"Failed to set LinkedIn organization");return a(D=>{const q={...D};if(q[P]){const G=q[P].connection_details||{};q[P]={...q[P],connection_details:{...G,organization_id:F,organization_name:$,post_as_organization:!0}}}return q}),He({title:"LinkedIn Organization Set",description:"LinkedIn organization has been successfully set",variant:"default",className:"bg-green-50 dark:bg-green-900/10 border-green-200 dark:border-green-900/50"}),await p(t),!0}catch(I){return console.error("Error setting LinkedIn organization:",I),He({title:"Error",description:I instanceof Error?I.message:"Failed to set LinkedIn organization",variant:"destructive"}),!1}}},linkedinOrganizations:d,loadingOrganizations:h,setFacebookPage:async(P,F)=>{var M,I;if(console.log("=== setFacebookPage CALLED ==="),console.log("platformId:",P),console.log("pageId:",F),console.log("brandId:",e),!!e){if(F==="personal")try{const $=s[P];if(!$)throw new Error("Platform settings not found");const V={...$.connection_details||{},selected_page_id:void 0,selected_page_name:void 0};return await v(P,{connection_details:V}),He({title:"Facebook Profile Set",description:"Posts will be published as your personal Facebook profile",variant:"default",className:"bg-green-50 dark:bg-green-900/10 border-green-200 dark:border-green-900/50"}),!0}catch($){return console.error("Error setting Facebook to personal account:",$),He({title:"Error",description:$ instanceof Error?$.message:"Failed to update Facebook settings",variant:"destructive"}),!1}try{const $=s[P];console.log("Current settings:",$);const V=((M=$==null?void 0:$.connection_details)==null?void 0:M.pages)||[];console.log("Facebook pages available:",V);const R=V.find(Y=>Y.id===F);console.log("Selected page object:",R);const Q=(R==null?void 0:R.name)||`Page ${F}`;console.log("Page name to be set:",Q);const D=(I=(await de.auth.getSession()).data.session)==null?void 0:I.access_token;if(!D)throw new Error("No access token available. Please log in again.");console.log("Making API call to set Facebook page...");const G=await(await fetch("https://worker.rainfactory.ai/rainfactory/connections/set-facebook-page/facebook",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${D}`},body:JSON.stringify({brandId:e,platformId:P,pageId:F})})).json();if(console.log("API response:",G),!G.success)throw new Error(G.message||"Failed to set Facebook page");return console.log("Updating local state with page ID:",F,"and page name:",Q),a(Y=>{const K={...Y};if(K[P]){const X=K[P].connection_details||{};K[P]={...K[P],connection_details:{...X,selected_page_id:F,selected_page_name:Q}},console.log("Updated platform settings:",K[P])}return K}),He({title:"Facebook Page Set",description:"Facebook page has been successfully set",variant:"default",className:"bg-green-50 dark:bg-green-900/10 border-green-200 dark:border-green-900/50"}),console.log("Refreshing platform settings from database..."),await p(t),console.log("=== setFacebookPage COMPLETE ==="),!0}catch($){return console.error("Error setting Facebook page:",$),He({title:"Error",description:$ instanceof Error?$.message:"Failed to set Facebook page",variant:"destructive"}),!1}}}}},Blt=({className:e})=>n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e,children:n.jsx("path",{d:"M9 12a4 4 0 1 0 4 4V4a
16185 5 0 0 0 5 5"})}),jz=(e,t="md")=>{const r=t==="sm"?"h-4 w-4":t==="lg"?"h-8 w-8":"h-5 w-5";switch(e==null?void 0:e.toLowerCase()){case"linkedin":case"linkedin_article":return n.jsx(ky,{className:r});case"twitter":return n.jsx(kr,{className:r});case"facebook":return n.jsx(_u,{className:r});case"instagram":return n.jsx(Vh,{className:r});case"youtube":return n.jsx(kI,{className:r});case"tiktok":return n.jsx(Blt,{className:r});case"wordpress":return n.jsx(Is,{className:r});case"medium":return n.jsx(ab,{className:r});case"rss":return n.jsx(Ey,{className:r});case"webhook":return n.jsx(J_,{className:r});default:return n.jsx(Is,{className:r})}},iae=({brandId:e})=>{const t=xr(),{formatTime:r,getAbbreviation:s}=Gl(),{platforms:a,platformSettings:i,loading:o}=N6(e),{autoCreateEnabledPlatforms:l,autoCreateDisabledPlatforms:c}=g.useMemo(()=>{const f=a.filter(v=>i[v.id]&&v.enabled===!0),p=f.filter(v=>{var x;return((x=i[v.id])==null?void 0:x.autogenerate_enabled)===!0}),A=f.filter(v=>{var x;return((x=i[v.id])==null?void 0:x.autogenerate_enabled)===!1});return{autoCreateEnabledPlatforms:p,autoCreateDisabledPlatforms:A}},[a,i]),d=f=>{t(`/brands/${e}/connections/${f.id}/settings`)},u=f=>{if(!f||f.length===0)return"Not set";const p={MONDAY:"Mon",TUESDAY:"Tue",WEDNESDAY:"Wed",THURSDAY:"Thu",FRIDAY:"Fri",SATURDAY:"Sat",SUNDAY:"Sun"};return f.map(A=>p[A]||A).join(", ")},h=f=>{if(!f)return"Not set";try{const[p,A]=f.split(":").map(Number),v=new Date;v.setUTCHours(p,A,0,0);const x=r(v,!1),b=s();return`${x} ${b}`}catch(p){return console.error("Error formatting time:",p),f}},m=(f,p)=>{if(!p)return null;switch(f){case"linkedin":if(p.post_as_organization&&p.organization_id){const v=(p.organizations||[]).find(x=>x.id===p.organization_id);if(v!=null&&v.name)return v.name}return p.name?p.name:p.localizedFirstName&&p.localizedLastName?`${p.localizedFirstName} ${p.localizedLastName}`:p.username?p.username:null;case"twitter":return p.username?`@${p.username}`:p.name?p.name:null;case"facebook":return p.selected_page_name?p.selected_page_name:p.user_name?p.user_name:p.name?p.name:p.username?p.username:null;case"instagram":return p.instagram_username?`@${p.instagram_username}`:p.username?`@${p.username}`:p.name?p.name:null;case"wordpress":return p.site_url?p.site_url:p.username?p.username:null;case"medium":return p.username?`@${p.username}`:p.name?p.name:null;case"linkedin_article":return p.name?p.name:p.localizedFirstName&&p.localizedLastName?`${p.localizedFirstName} ${p.localizedLastName}`:p.username?p.username:null;default:return p.username?p.username:p.name?p.name:null}};return n.jsx("div",{className:"space-y-6",children:n.jsxs("div",{children:[o?n.jsx("div",{className:"space-y-4",children:Array.from({length:4}).map((f,p)=>n.jsxs("div",{className:"relative overflow-hidden bg-gradient-to-r from-blue-50/50 via-indigo-50/30 to-purple-50/20 rounded-xl border border-gray-200/50 p-4 sm:p-6",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent animate-pulse"}),n.jsxs("div",{className:"relative flex flex-col sm:flex-row items-start sm:items-center gap-4 sm:gap-6",children:[n.jsx("div",{className:"h-12 w-12 sm:h-16 sm:w-16 bg-gradient-to-br from-gray-200 to-gray-300 rounded-xl animate-pulse flex-shrink-0"}),n.jsxs("div",{className:"flex-1 space-y-3 w-full sm:w-auto",children:[n.jsx("div",{className:"h-5 sm:h-6 bg-gradient-to-r from-gray-200 to-gray-300 rounded-lg w-full sm:w-48 animate-pulse"}),n.jsx("div",{className:"h-4 bg-gradient-to-r from-gray-200 to-gray-300 rounded w-full animate-pulse"})]}),n.jsx("div",{className:"h-10 w-full sm:w-32 bg-gradient-to-r from-gray-200 to-gray-300 rounded-lg animate-pulse flex-shrink-0"})]})]},p))}):n.jsx("div",{className:"space-y-4",children:(l.length>0||c.length>0)&&n.jsxs("div",{className:"space-y-4",children:[l.map(f=>{const p=f.platform_key==="twitter"?"X":f.platform_key==="linkedin_article"?"LinkedIn Articles":f.name,A=i[f.id]||{},v=A.connection_details||{},x=m(f.platform_key,v),b=u(A.preferred_days),y=h(A.preferred_time);return n.jsxs(Te,{className:"group relative overflow-hidden transition-all duration-300 hover:shadow-lg cursor-pointer border-emerald-200/60 bg-gradient-to-br from-emerald-50/30 to-green-50/20 hover:border-emerald-300/60",onClick:()=>d(f),children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-emerald-50/20 via-trans
1618parent to-green-50/20 opacity-0 group-hover:opacity-100 transition-opacity duration-300"}),n.jsx(Re,{className:"relative p-4 sm:p-6",children:n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4 sm:gap-6",children:[n.jsxs("div",{className:"flex items-start gap-3 sm:gap-4 flex-1 min-w-0",children:[n.jsx("div",{className:"p-2 sm:p-3 rounded-xl bg-gradient-to-br from-white to-gray-100/80 shadow-sm border border-gray-200/50 group-hover:shadow-md group-hover:scale-110 transition-all duration-300 flex-shrink-0",children:jz(f.platform_key,"lg")}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2 sm:gap-3 mb-3",children:[n.jsx("h3",{className:"text-lg sm:text-xl font-semibold text-gray-900 truncate",children:p}),n.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 sm:gap-2",children:[n.jsxs("div",{className:"flex items-center gap-1.5 px-2 sm:px-2.5 py-1 bg-emerald-50/80 text-emerald-700 border border-emerald-200/60 rounded-full text-xs font-medium whitespace-nowrap",children:[n.jsx(gu,{className:"h-3.5 w-3.5 flex-shrink-0"}),"Auto-Create"]}),A.status==="CONNECTED"?n.jsxs("div",{className:"flex items-center gap-1.5 px-2 sm:px-2.5 py-1 bg-blue-50/80 text-blue-700 border border-blue-200/60 rounded-full text-xs font-medium whitespace-nowrap",children:[n.jsx(qt,{className:"h-3.5 w-3.5 flex-shrink-0"}),"Connected"]}):A.status==="PENDING"?n.jsxs("div",{className:"flex items-center gap-1.5 px-2 sm:px-2.5 py-1 bg-amber-50/80 text-amber-700 border border-amber-200/60 rounded-full text-xs font-medium whitespace-nowrap",children:[n.jsx(kt,{className:"h-3.5 w-3.5 animate-spin flex-shrink-0"}),"Connecting..."]}):A.status==="DISCONNECTED"?n.jsxs("div",{className:"flex items-center gap-1.5 px-2 sm:px-2.5 py-1 bg-red-50/80 text-red-700 border border-red-200/60 rounded-full text-xs font-medium whitespace-nowrap",children:[n.jsx(kr,{className:"h-3.5 w-3.5 flex-shrink-0"}),"Disconnected"]}):null,A.autopost_enabled?n.jsxs("div",{className:"flex items-center gap-1.5 px-2 sm:px-2.5 py-1 bg-indigo-50/80 text-indigo-700 border border-indigo-200/60 rounded-full text-xs font-medium whitespace-nowrap",children:[n.jsx(Vr,{className:"h-3.5 w-3.5 flex-shrink-0"}),"Auto-Publish"]}):n.jsxs("div",{className:"flex items-center gap-1.5 px-2 sm:px-2.5 py-1 bg-gray-100 text-gray-600 border border-gray-300 rounded-full text-xs font-medium whitespace-nowrap",children:[n.jsx(Vr,{className:"h-3.5 w-3.5 flex-shrink-0"}),"No Auto-Publish"]})]})]}),n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3 sm:gap-4 mt-4",children:[n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx("div",{className:"p-1.5 sm:p-2 rounded-lg bg-blue-50/80 flex-shrink-0",children:n.jsx(Im,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4 text-blue-600"})}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"text-xs font-medium text-gray-500 uppercase tracking-wide mb-1",children:"Connected Profile"}),n.jsx("div",{className:"text-sm font-semibold text-gray-900 break-words",children:x||"Not connected"})]})]}),n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx("div",{className:"p-1.5 sm:p-2 rounded-lg bg-purple-50/80 flex-shrink-0",children:n.jsx(Kn,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4 text-purple-600"})}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"text-xs font-medium text-gray-500 uppercase tracking-wide mb-1",children:"Auto-Create For"}),n.jsx("div",{className:"text-sm font-semibold text-gray-900 break-words",children:b}),A.autopost_enabled&&n.jsxs("div",{className:"text-xs text-gray-600 mt-1 break-words",children:["Publishes at ",y]})]})]})]})]})]}),n.jsx("div",{className:"flex-shrink-0 w-full sm:w-auto",children:n.jsxs(te,{onClick:w=>{w.stopPropagation(),d(f)},variant:"outline",className:"w-full sm:w-auto gap-2 bg-white hover:bg-gray-50 border-gray-300 hover:border-gray-400",children:[n.jsx(fs,{className:"h-4 w-4"}),"Configure"]})})]})})]},f.id)}),c.map(f=>{const p=f.platform_key==="twitter"?"X":f.platform_key==="linkedin_article"?"LinkedIn Articles":f.name,A=i[f.id]||{},v=A.connection_details||{},x=m(f.platform_key,v);return n.jsxs(Te,{className:"group relative overflow-hidden transition-all duration-300 hover:shadow-lg cursor-pointer border-gray-300 bg-gradient-to-br from-gray-50/30 to-slate-50/20 hover:border-gray-400",onClick:()=>d(f),children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-gray-50/20 via-trans
1618parent to-slate-50/20 opacity-0 group-hover:opacity-100 transition-opacity duration-300"}),n.jsx(Re,{className:"relative p-4 sm:p-6",children:n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4 sm:gap-6",children:[n.jsxs("div",{className:"flex items-start gap-3 sm:gap-4 flex-1 min-w-0",children:[n.jsx("div",{className:"p-2 sm:p-3 rounded-xl bg-gradient-to-br from-white to-gray-100/80 shadow-sm border border-gray-200/50 group-hover:shadow-md group-hover:scale-110 transition-all duration-300 flex-shrink-0",children:jz(f.platform_key,"lg")}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2 sm:gap-3 mb-3",children:[n.jsx("h3",{className:"text-lg sm:text-xl font-semibold text-gray-900 truncate",children:p}),n.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 sm:gap-2",children:[n.jsxs("div",{className:"flex items-center gap-1.5 px-2 sm:px-2.5 py-1 bg-gray-100 text-gray-600 border border-gray-300 rounded-full text-xs font-medium whitespace-nowrap",children:[n.jsx(gu,{className:"h-3.5 w-3.5 flex-shrink-0"}),"Auto-Create Disabled"]}),A.status==="CONNECTED"?n.jsxs("div",{className:"flex items-center gap-1.5 px-2 sm:px-2.5 py-1 bg-blue-50/80 text-blue-700 border border-blue-200/60 rounded-full text-xs font-medium whitespace-nowrap",children:[n.jsx(qt,{className:"h-3.5 w-3.5 flex-shrink-0"}),"Connected"]}):A.status==="PENDING"?n.jsxs("div",{className:"flex items-center gap-1.5 px-2 sm:px-2.5 py-1 bg-amber-50/80 text-amber-700 border border-amber-200/60 rounded-full text-xs font-medium whitespace-nowrap",children:[n.jsx(kt,{className:"h-3.5 w-3.5 animate-spin flex-shrink-0"}),"Connecting..."]}):A.status==="DISCONNECTED"?n.jsxs("div",{className:"flex items-center gap-1.5 px-2 sm:px-2.5 py-1 bg-red-50/80 text-red-700 border border-red-200/60 rounded-full text-xs font-medium whitespace-nowrap",children:[n.jsx(kr,{className:"h-3.5 w-3.5 flex-shrink-0"}),"Disconnected"]}):null,n.jsxs("div",{className:"flex items-center gap-1.5 px-2 sm:px-2.5 py-1 bg-gray-100 text-gray-600 border border-gray-300 rounded-full text-xs font-medium whitespace-nowrap",children:[n.jsx(Vr,{className:"h-3.5 w-3.5 flex-shrink-0"}),"No Auto-Publish"]})]})]}),n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3 sm:gap-4 mt-4 opacity-50",children:[n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx("div",{className:"p-1.5 sm:p-2 rounded-lg bg-gray-100 flex-shrink-0",children:n.jsx(Im,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4 text-gray-500"})}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"text-xs font-medium text-gray-500 uppercase tracking-wide mb-1",children:"Connected Profile"}),n.jsx("div",{className:"text-sm font-semibold text-gray-700 break-words",children:x||"Not connected"})]})]}),n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx("div",{className:"p-1.5 sm:p-2 rounded-lg bg-gray-100 flex-shrink-0",children:n.jsx(Kn,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4 text-gray-500"})}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"text-xs font-medium text-gray-500 uppercase tracking-wide mb-1",children:"Auto-Create For"}),n.jsx("div",{className:"text-sm font-semibold text-gray-700 break-words",children:"Disabled"})]})]}),n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx("div",{className:"p-1.5 sm:p-2 rounded-lg bg-gray-100 flex-shrink-0",children:n.jsx(Vr,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4 text-gray-500"})}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"text-xs font-medium text-gray-500 uppercase tracking-wide mb-1",children:"Auto-Publish"}),n.jsx("div",{className:"text-sm font-semibold text-gray-700 break-words",children:"Disabled"})]})]})]})]})]}),n.jsx("div",{className:"flex-shrink-0 w-full sm:w-auto",children:n.jsxs(te,{onClick:b=>{b.stopPropagation(),d(f)},variant:"outline",className:"w-full sm:w-auto gap-2 bg-white hover:bg-gray-50 border-gray-300 hover:border-gray-400",children:[n.jsx(fs,{className:"h-4 w-4"}),"Configure"]})})]})})]},f.id)})]})}
1618),l.length===0&&c.length===0&&!o&&n.jsxs(Te,{className:"relative overflow-hidden border-dashed border-2 border-gray-300 bg-gradient-to-br from-white via-blue-50/20 to-indigo-50/30",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsxs(Re,{className:"relative flex flex-col items-center justify-center py-16 text-center",children:[n.jsxs("div",{className:"max-w-md",children:[n.jsx("h3",{className:"text-2xl font-bold bg-gradient-to-r from-gray-700 via-blue-700 to-indigo-700 bg-clip-text text-transparent mb-3",children:"No Platforms Connected"}),n.jsx("p",{className:"text-gray-600 mb-6 leading-relaxed",children:"No social media or blog platforms are currently connected to this brand."})]}),n.jsx("div",{className:"absolute top-8 right-8 w-16 h-16 bg-gradient-to-br from-blue-200/30 to-transparent rounded-full"}),n.jsx("div",{className:"absolute bottom-8 left-8 w-12 h-12 bg-gradient-to-br from-indigo-200/30 to-transparent rounded-full"})]})]})]})})},Nz=()=>{const{id:e}=Ei(),{selectedBrand:t}=mn(),[r,s]=Bi();return g.useEffect(()=>{const a=r.get("platform"),i=r.get("action");a&&e&&(console.log(`Detected return from ${a} authentication flow for brand ${e}`),["linkedin","twitter","facebook","instagram","tiktok","wordpress","medium","linkedin_article"].includes(a)&&s(o=>{const l=new URLSearchParams(o);return l.delete("platform"),i!=="add"&&l.delete("action"),l}))},[r,e,s]),n.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 via-white to-blue-50/30 relative",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsxs("div",{className:"relative container mx-auto p-6 max-w-6xl",children:[n.jsxs("div",{className:"relative overflow-hidden bg-gradient-to-br from-white via-blue-50/30 to-indigo-50/40 rounded-xl border border-blue-200/50 shadow-sm mb-6 p-6",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsx("div",{className:"absolute top-0 right-0 w-32 h-32 bg-gradient-to-br from-blue-200/20 to-transparent rounded-full -translate-y-16 translate-x-16 pointer-events-none"}),n.jsx("div",{className:"relative",children:n.jsx("div",{className:"flex items-start justify-between",children:n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"p-2.5 bg-white/80 backdrop-blur-sm rounded-xl shadow-lg",children:n.jsx(gu,{className:"h-6 w-6 text-blue-600"})}),n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-bold bg-gradient-to-r from-blue-700 via-indigo-700 to-purple-700 bg-clip-text text-transparent mb-1",children:"Social Automation Agents"}),n.jsxs("p",{className:"text-gray-600 text-sm leading-relaxed",children:["Connect and manage your ",(t==null?void 0:t.brand_name)||"brand"," social media and blog platform integrations"]})]})]})})})]}),n.jsx("div",{className:"space-y-6",children:e&&n.jsx(iae,{brandId:e},e)}),n.jsx(xS,{})]})]})};function Tlt(e){const[t,r]=g.useState(null),[s,a]=g.useState(!0),[i,o]=g.useState(null);g.useEffect(()=>{if(!e){a(!1);return}async function u(){try{const{data:h,error:m}=await de.rpc("get_brand_role",{brand_id:e});if(m){console.error("Error fetching brand role:",m),o(m);return}r(h)}catch(h){console.error("Error in fetchBrandRole:",h),o(h instanceof Error?h:new Error(String(h)))}finally{a(!1)}}u()},[e]);const l=(t==null?void 0:t.account_role)==="owner",c=!!t,d=(t==null?void 0:t.is_primary_owner)===!0;return{role:t,loading:s,error:i,isOwner:l,isMember:c,isPrimaryOwner:d}}function Plt(e){const{isOwner:t,isMember:r,isPrimaryOwner:s,loading:a,error:i}=Tlt(e);return{canViewBrand:r,canEditBrand:r,canManageTeam:t,canManageBilling:t,canDeleteBrand:s,canTransferOwnership:s,loading:a,error:i}}var tk="Collapsible",[Ilt,oae]=Ki(tk),[Olt,_6]=Ilt(tk),lae=g.forwardRef((e,t)=>{const{__scopeCollapsible:r,open:s,defaultOpen:a,disabled:i,onOpenChange:o,...l}=e,[c,d]=lo({prop:s,defaultProp:a??!1,onChange:o,caller:tk});return n.jsx(Olt,{scope:r,disabled:i,contentId:tf(),open:c,onOpenToggle:g.useCallback(()=>d(u=>!u),[d]),children:n.jsx(sr.div,{"data-state":E6(c),"data-disabled":i?"":void 0,...l,ref:t})})});lae.displayName=tk;var cae="CollapsibleTrigger",C6=g.forwardRef((e,t)=>
1618{const{__scopeCollapsible:r,...s}=e,a=_6(cae,r);return n.jsx(sr.button,{type:"button","aria-controls":a.contentId,"aria-expanded":a.open||!1,"data-state":E6(a.open),"data-disabled":a.disabled?"":void 0,disabled:a.disabled,...s,ref:t,onClick:yt(e.onClick,a.onOpenToggle)})});C6.displayName=cae;var S6="CollapsibleContent",k6=g.forwardRef((e,t)=>{const{forceMount:r,...s}=e,a=_6(S6,e.__scopeCollapsible);return n.jsx(xo,{present:r||a.open,children:({present:i})=>n.jsx(Flt,{...s,ref:t,present:i})})});k6.displayName=S6;var Flt=g.forwardRef((e,t)=>{const{__scopeCollapsible:r,present:s,children:a,...i}=e,o=_6(S6,r),[l,c]=g.useState(s),d=g.useRef(null),u=zr(t,d),h=g.useRef(0),m=h.current,f=g.useRef(0),p=f.current,A=o.open||l,v=g.useRef(A),x=g.useRef(void 0);return g.useEffect(()=>{const b=requestAnimationFrame(()=>v.current=!1);return()=>cancelAnimationFrame(b)},[]),co(()=>{const b=d.current;if(b){x.current=x.current||{transitionDuration:b.style.transitionDuration,animationName:b.style.animationName},b.style.transitionDuration="0s",b.style.animationName="none";const y=b.getBoundingClientRect();h.current=y.height,f.current=y.width,v.current||(b.style.transitionDuration=x.current.transitionDuration,b.style.animationName=x.current.animationName),c(s)}},[o.open,s]),n.jsx(sr.div,{"data-state":E6(o.open),"data-disabled":o.disabled?"":void 0,id:o.contentId,hidden:!A,...i,ref:u,style:{"--radix-collapsible-content-height":m?`${m}px`:void 0,"--radix-collapsible-content-width":p?`${p}px`:void 0,...e.style},children:A&&a})});function E6(e){return e?"open":"closed"}var dae=lae,Llt=C6,Dlt=k6,Oc="Accordion",Rlt=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[B6,Ult,Mlt]=F_(Oc),[rk]=Ki(Oc,[Mlt,oae]),T6=oae(),uae=oe.forwardRef((e,t)=>{const{type:r,...s}=e,a=s,i=s;return n.jsx(B6.Provider,{scope:e.__scopeAccordion,children:r==="multiple"?n.jsx(zlt,{...i,ref:t}):n.jsx(Hlt,{...a,ref:t})})});uae.displayName=Oc;var[hae,$lt]=rk(Oc),[fae,Qlt]=rk(Oc,{collapsible:!1}),Hlt=oe.forwardRef((e,t)=>{const{value:r,defaultValue:s,onValueChange:a=()=>{},collapsible:i=!1,...o}=e,[l,c]=lo({prop:r,defaultProp:s??"",onChange:a,caller:Oc});return n.jsx(hae,{scope:e.__scopeAccordion,value:oe.useMemo(()=>l?[l]:[],[l]),onItemOpen:c,onItemClose:oe.useCallback(()=>i&&c(""),[i,c]),children:n.jsx(fae,{scope:e.__scopeAccordion,collapsible:i,children:n.jsx(mae,{...o,ref:t})})})}),zlt=oe.forwardRef((e,t)=>{const{value:r,defaultValue:s,onValueChange:a=()=>{},...i}=e,[o,l]=lo({prop:r,defaultProp:s??[],onChange:a,caller:Oc}),c=oe.useCallback(u=>l((h=[])=>[...h,u]),[l]),d=oe.useCallback(u=>l((h=[])=>h.filter(m=>m!==u)),[l]);return n.jsx(hae,{scope:e.__scopeAccordion,value:o,onItemOpen:c,onItemClose:d,children:n.jsx(fae,{scope:e.__scopeAccordion,collapsible:!0,children:n.jsx(mae,{...i,ref:t})})})}),[Vlt,nk]=rk(Oc),mae=oe.forwardRef((e,t)=>{const{__scopeAccordion:r,disabled:s,dir:a,orientation:i="vertical",...o}=e,l=oe.useRef(null),c=zr(l,t),d=Ult(r),h=Xg(a)==="ltr",m=yt(e.onKeyDown,f=>{var S;if(!Rlt.includes(f.key))return;const p=f.target,A=d().filter(C=>{var E;return!((E=C.ref.current)!=null&&E.disabled)}),v=A.findIndex(C=>C.ref.current===p),x=A.length;if(v===-1)return;f.preventDefault();let b=v;const y=0,w=x-1,j=()=>{b=v+1,b>w&&(b=y)},N=()=>{b=v-1,b<y&&(b=w)};switch(f.key){case"Home":b=y;break;case"End":b=w;break;case"ArrowRight":i==="horizontal"&&(h?j():N());break;case"ArrowDown":i==="vertical"&&j();break;case"ArrowLeft":i==="horizontal"&&(h?N():j());break;case"ArrowUp":i==="vertical"&&N();break}const _=b%x;(S=A[_].ref.current)==null||S.focus()});return n.jsx(Vlt,{scope:r,disabled:s,direction:a,orientation:i,children:n.jsx(B6.Slot,{scope:r,children:n.jsx(sr.div,{...o,"data-orientation":i,ref:c,onKeyDown:s?void 0:m})})})}),c_="AccordionItem",[Glt,P6]=rk(c_),pae=oe.forwardRef((e,t)=>{const{__scopeAccordion:r,value:s,...a}=e,i=nk(c_,r),o=$lt(c_,r),l=T6(r),c=tf(),d=s&&o.value.includes(s)||!1,u=i.disabled||e.disabled;return n.jsx(Glt,{scope:r,open:d,disabled:u,triggerId:c,children:n.jsx(dae,{"data-orientation":i.orientation,"data-state":yae(d),...l,...a,ref:t,disabled:u,open:d,onOpenChange:h=>{h?o.onItemOpen(s):o.onItemClose(s)}})})});pae.displayName=c_;var Aae="AccordionHeader",gae=oe.forwardRef((e,t)=>
1618{const{__scopeAccordion:r,...s}=e,a=nk(Oc,r),i=P6(Aae,r);return n.jsx(sr.h3,{"data-orientation":a.orientation,"data-state":yae(i.open),"data-disabled":i.disabled?"":void 0,...s,ref:t})});gae.displayName=Aae;var EP="AccordionTrigger",xae=oe.forwardRef((e,t)=>{const{__scopeAccordion:r,...s}=e,a=nk(Oc,r),i=P6(EP,r),o=Qlt(EP,r),l=T6(r);return n.jsx(B6.ItemSlot,{scope:r,children:n.jsx(Llt,{"aria-disabled":i.open&&!o.collapsible||void 0,"data-orientation":a.orientation,id:i.triggerId,...l,...s,ref:t})})});xae.displayName=EP;var vae="AccordionContent",bae=oe.forwardRef((e,t)=>{const{__scopeAccordion:r,...s}=e,a=nk(Oc,r),i=P6(vae,r),o=T6(r);return n.jsx(Dlt,{role:"region","aria-labelledby":i.triggerId,"data-orientation":a.orientation,...o,...s,ref:t,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style}})});bae.displayName=vae;function yae(e){return e?"open":"closed"}var qlt=uae,Klt=pae,Wlt=gae,wae=xae,jae=bae;const Nae=qlt,I6=g.forwardRef(({className:e,...t},r)=>n.jsx(Klt,{ref:r,className:ye("border-b",e),...t}));I6.displayName="AccordionItem";const O6=g.forwardRef(({className:e,children:t,...r},s)=>n.jsx(Wlt,{className:"flex",children:n.jsxs(wae,{ref:s,className:ye("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",e),...r,children:[t,n.jsx(Un,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));O6.displayName=wae.displayName;const F6=g.forwardRef(({className:e,children:t,...r},s)=>n.jsx(jae,{ref:s,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...r,children:n.jsx("div",{className:ye("pb-4 pt-0",e),children:t})}));F6.displayName=jae.displayName;const Ylt=({connectionDetails:e,onSave:t,onTest:r,isTesting:s=!1})=>{var x;const[a,i]=g.useState({webhook_url:e.webhook_url||"",auth_type:e.auth_type||"none",auth_token:e.auth_token||"",auth_header:e.auth_header||"X-API-Key",custom_headers:e.custom_headers||{},timeout_seconds:e.timeout_seconds||30,retry_count:e.retry_count||3,verify_ssl:e.verify_ssl!==!1,last_tested:e.last_tested,test_result:e.test_result}),[o,l]=g.useState(!1),[c,d]=g.useState(!1);g.useEffect(()=>{const b=a.webhook_url!==(e.webhook_url||"")||a.auth_type!==(e.auth_type||"none")||a.auth_token!==(e.auth_token||"")||a.auth_header!==(e.auth_header||"X-API-Key")||a.timeout_seconds!==(e.timeout_seconds||30)||a.retry_count!==(e.retry_count||3)||a.verify_ssl!==(e.verify_ssl!==!1);d(b)},[a,e]);const u=async()=>{l(!0);try{await t(a),d(!1)}finally{l(!1)}},h=async()=>{c&&await u(),await r()},m=(x=a.webhook_url)==null?void 0:x.startsWith("https://"),f=a.webhook_url&&!m,[p,A]=(a.auth_token||":").split(":"),v=b=>{if(!b)return null;const y=new Date(b),j=(new Date().getTime()-y.getTime())/(1e3*60*60);if(j<1)return"just now";if(j<24){const N=Math.floor(j);return`${N} ${N===1?"hour":"hours"} ago`}else if(j<168){const N=Math.floor(j/24);return`${N} ${N===1?"day":"days"} ago`}else return y.toLocaleDateString()};return n.jsxs("div",{className:"space-y-4",children:[n.jsx(Te,{children:n.jsxs(Re,{className:"p-6 space-y-6",children:[n.jsxs("div",{className:"flex items-center gap-3 pb-4 border-b",children:[n.jsx("div",{className:"p-2 bg-indigo-100 rounded-lg",children:n.jsx(J_,{className:"h-5 w-5 text-indigo-600"})}),n.jsxs("div",{children:[n.jsx("h3",{className:"font-semibold text-lg",children:"Webhook Configuration"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Configure your HTTP endpoint to receive content notifications"})]})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs(ze,{htmlFor:"webhook_url",className:"text-base font-medium",children:["Webhook URL ",n.jsx("span",{className:"text-red-500",children:"*"})]}),n.jsx(qe,{id:"webhook_url",type:"url",placeholder:"https://example.com/webhook",value:a.webhook_url,onChange:b=>i({...a,webhook_url:b.target.value}),className:"font-mono text-sm"}),f&&n.jsxs(Ar,{className:"bg-amber-50 border-amber-200",children:[n.jsx(hn,{className:"h-4 w-4 text-amber-600"}),n.jsx(gr,{className:"text-amber-800 text-sm",children:"HTTPS is strongly recommended for production use to ensure secure data transmission"})]})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"auth_type",className:"text-base font-medium",children:"Authentication"}),n.jsxs(ur,{value:a.auth_type,onValueChange:b=>i({...a,auth_type:b}),children:[n.jsx(or,{id:"auth_type",children:n.jsx(hr,{})}),n.jsxs(lr,{children:[n.jsx(Fe,{value:"none",children:"None"}),n.jsx(Fe,{value:"bearer",children:"Bearer Token"}),n.jsx(Fe,{value:"api_key",children:"API Key (Custom Header)"}),n.jsx(Fe,{value:"basic",children:"Basic Auth"})]})]})]}),a.auth_type==="bearer"&&n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"bearer_token",className:"text-base font-medium",children:"Bearer Token"}),n.jsx(qe,{id:"bearer_token",type:"password",placeholder:"Enter bearer token",value:a.auth_token,onChange:b=>i({...a,auth_token:b.target.value}),className:"font-mono text-sm"}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"Will be sent as: Authorization: Bearer [token]"})]}),a.auth_type==="api_key"&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"header_name",className:"text-base font-medium",children:"Header Name"}),n.jsx(qe,{id:"header_name",type:"text",placeholder:"X-API-Key",value:a.auth_header,onCh
1618ange:b=>i({...a,auth_header:b.target.value}),className:"font-mono text-sm"})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"api_key",className:"text-base font-medium",children:"API Key"}),n.jsx(qe,{id:"api_key",type:"password",placeholder:"Enter API key",value:a.auth_token,onChange:b=>i({...a,auth_token:b.target.value}),className:"font-mono text-sm"})]})]}),a.auth_type==="basic"&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"basic_username",className:"text-base font-medium",children:"Username"}),n.jsx(qe,{id:"basic_username",type:"text",placeholder:"username",value:p,onChange:b=>i({...a,auth_token:`${b.target.value}:${A}`})})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"basic_password",className:"text-base font-medium",children:"Password"}),n.jsx(qe,{id:"basic_password",type:"password",placeholder:"password",value:A,onChange:b=>i({...a,auth_token:`${p}:${b.target.value}`})})]})]}),n.jsx(Nae,{type:"single",collapsible:!0,className:"w-full",children:n.jsxs(I6,{value:"advanced",className:"border-none",children:[n.jsx(O6,{className:"hover:no-underline py-3",children:n.jsxs("div",{className:"flex items-center gap-2 text-base font-medium",children:[n.jsx(fs,{className:"h-4 w-4"}),"Advanced Settings"]})}),n.jsxs(F6,{className:"space-y-4 pt-2",children:[n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"timeout",className:"text-sm font-medium",children:"Timeout (seconds)"}),n.jsx(qe,{id:"timeout",type:"number",min:"1",max:"300",value:a.timeout_seconds,onChange:b=>i({...a,timeout_seconds:parseInt(b.target.value)||30})})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"retry_count",className:"text-sm font-medium",children:"Retry Count"}),n.jsx(qe,{id:"retry_count",type:"number",min:"0",max:"10",value:a.retry_count,onChange:b=>i({...a,retry_count:parseInt(b.target.value)||3})})]})]}),n.jsxs("div",{className:"flex items-center space-x-2",children:[n.jsx(Xo,{id:"verify_ssl",checked:a.verify_ssl,onCheckedChange:b=>i({...a,verify_ssl:b===!0})}),n.jsx(ze,{htmlFor:"verify_ssl",className:"text-sm font-medium cursor-pointer",children:"Verify SSL certificates"})]}),!a.verify_ssl&&n.jsxs(Ar,{className:"bg-amber-50 border-amber-200",children:[n.jsx(hn,{className:"h-4 w-4 text-amber-600"}),n.jsx(gr,{className:"text-amber-800 text-sm",children:"Disabling SSL verification is not recommended for production environments"})]})]})]})}),n.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 pt-4 border-t",children:[n.jsx(te,{variant:"outline",onClick:h,disabled:s||!a.webhook_url,className:"flex-1 sm:flex-none",children:s?n.jsxs(n.Fragment,{children:[n.jsx(kt,{className:"mr-2 h-4 w-4 animate-spin"}),"Testing..."]}):"Test Webhook"}),n.jsx("a",{href:"/help#webhook-guide",target:"_blank",rel:"noopener noreferrer",className:"flex-1 sm:flex-none",children:n.jsxs(te,{variant:"outline",className:"w-full",children:["View Documentation",n.jsx(Vs,{className:"ml-2 h-4 w-4"})]})}),n.jsx(te,{onClick:u,disabled:o||!c,className:"flex-1 bg-gradient-to-r from-indigo-600 to-purple-600 hover:from-indigo-700 hover:to-purple-700",children:o?n.jsxs(n.Fragment,{children:[n.jsx(kt,{className:"mr-2 h-4 w-4 animate-spin"}),"Saving..."]}):"Save Configuration"})]})]})}),a.last_tested&&a.test_result&&n.jsx(Te,{className:ye("border-l-4",a.test_result.status==="success"?"border-l-green-500 bg-green-50/50":"border-l-red-500 bg-red-50/50"),children:n.jsx(Re,{className:"p-4",children:n.jsxs("div",{className:"flex items-start gap-3",children:[a.test_result.status==="success"?n.jsx(di,{className:"h-5 w-5 text-green-600 flex-shrink-0 mt-0.5"}):n.jsx(Rl,{className:"h-5 w-5 text-red-600 flex-shrink-0 mt-0.5"}),n.jsxs("div",{className:"flex-1 space-y-1",children:[n.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[n.jsx("span",{className:ye("font-semibold",a.test_result.status==="success"?"text-green-900":"text-red-900"),children:a.test_result.status==="success"?"Success":"Failed"}),a.test_result.response_code&&n.jsxs("span",{className:"text-sm text-muted-foreground",children:["HTTP ",a.test_result.response_code]}),a.test_result.response_time_ms&&n.jsxs("span",{className:"text-sm text-muted-foreground flex items-center gap-1",children:[n.jsx(Vr,{className:"h-3 w-3"}),a.test_result.response_time_ms,"ms"]})]}),n.jsxs("p",{className:"text-sm text-muted-foreground",children:["Last tested ",v(a.last_tested)]}),a.test_result.error_message&&n.jsx("p",{className:"text-sm text-red-700 mt-2",children:a.test_result.error_message})]})]})})})]})},Jlt=({brandId:e})=>{const t=xr(),s=`https://worker.rainfactory.ai/blog-rss/${e}`,a=async i=>
1618{try{await navigator.clipboard.writeText(i),He({title:"Copied!",description:"RSS feed URL copied to clipboard"})}catch{He({title:"Error",description:"Failed to copy URL",variant:"destructive"})}};return n.jsxs("div",{className:"space-y-4",children:[n.jsx(Te,{children:n.jsxs(Re,{className:"p-4",children:[n.jsx("h3",{className:"font-medium mb-2",children:"Your RSS Feed URL"}),n.jsxs("div",{className:"flex items-center gap-2 p-2 bg-muted rounded",children:[n.jsx("code",{className:"flex-1 text-sm",children:s}),n.jsx(te,{size:"sm",variant:"outline",onClick:()=>a(s),children:n.jsx(Cn,{className:"h-4 w-4"})}),n.jsx(te,{size:"sm",variant:"outline",onClick:()=>window.open(s,"_blank"),children:n.jsx(Vs,{className:"h-4 w-4"})})]})]})}),n.jsx(Te,{children:n.jsxs(Re,{className:"p-4",children:[n.jsx("h3",{className:"font-medium mb-2",children:"How to use your RSS feed"}),n.jsxs("div",{className:"space-y-2 text-sm text-muted-foreground",children:[n.jsx("p",{children:"Your RSS feed automatically includes all published blog posts from your brand."}),n.jsx("p",{children:"Share the feed URL above with your audience so they can:"}),n.jsxs("ul",{className:"list-disc list-inside ml-2 space-y-1",children:[n.jsx("li",{children:"Subscribe to your content in RSS readers like Feedly, Inoreader, or NewsBlur"}),n.jsx("li",{children:"Add your feed to their browser's RSS extensions"}),n.jsx("li",{children:"Import your feed into their preferred news aggregator"})]})]})]})}),n.jsx(Te,{children:n.jsx(Re,{className:"p-4",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"font-medium",children:"Preview Your Feed"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"View your RSS feed content and recent posts"})]}),n.jsxs(te,{variant:"outline",onClick:()=>t(`/brands/${e}/rss-feed`),children:[n.jsx(Ey,{className:"mr-2 h-4 w-4"}),"View RSS Feed"]})]})})})]})},Xlt=({platform:e,icon:t,platformSettings:r,platformConnectionStatus:s,savePlatformSettings:a,testPlatformConnection:i,updateConnectionStatus:o,initiateAuthFlow:l,fetchLinkedInOrganizations:c,setLinkedInOrganization:d,linkedinOrganizations:u=[],loadingOrganizations:h=!1,setFacebookPage:m,brandId:f})=>{var Se;if(!e)return null;const{canViewBrand:p}=Plt(f),A=xr(),{timezone:v,isLoading:x}=Gl(),b=r[e.id]||{autopost_enabled:!1,autogenerate_enabled:!1,posting_frequency:"DAILY",preferred_time:"09:00",preferred_days:["MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY","SUNDAY"],status:"DISCONNECTED",connection_details:null},y=g.useMemo(()=>{if(!b.preferred_time)return"09:00";if(x)return console.log("=== TIMEZONE DEBUG: LOADING STATE ==="),console.log("Timezone is loading, showing raw preferred_time:",b.preferred_time),console.log("isLoading:",x),console.log("Current timezone (default):",v),console.log("=== END LOADING STATE DEBUG ==="),b.preferred_time;console.log("=== TIMEZONE DEBUG START ==="),console.log("Raw settings.preferred_time from database:",b.preferred_time),console.log("User timezone from useTimezone hook:",v),console.log("Browser timezone:",Intl.DateTimeFormat().resolvedOptions().timeZone),console.log("isLoading:",x);try{const[pe,Ce]=b.preferred_time.split(":").map(Number);console.log("Parsed UTC hours:",pe,"minutes:",Ce);const re=new Date;console.log("Today date:",re.toString());const se=new Date(Date.UTC(re.getUTCFullYear(),re.getUTCMonth(),re.getUTCDate(),pe,Ce,0,0));console.log("Created UTC date:",se.toISOString()),console.log("UTC date toString():",se.toString()),console.log("utcDate.getHours() (local):",se.getHours()),console.log("utcDate.getUTCHours() (UTC):",se.getUTCHours());const Ae=se.toLocaleTimeString("en-US",{timeZone:v,hour12:!1,hour:"2-digit",minute:"2-digit"});console.log("Converted local time result:",Ae),console.log("Timezone used for conversion:",v);const Pe=new Intl.DateTimeFormat("en-US",{timeZone:v,hour:"2-digit",minute:"2-digit",hour12:!1}).format(se);console.log("Alternative method 1:",Pe);const Oe=se.toLocaleString("en-US",{timeZone:v,hour:"2-digit",minute:"2-digit",hour12:!1});return console.log("Alternative method 2:",Oe),console.log("=== TIMEZONE DEBUG END ==="),Ae}catch(pe){return console.error("Error converting display time:",pe),"09:00"}}
1618,[b.preferred_time,v,x]),[w,j]=g.useState({autopost_enabled:b.autopost_enabled||!1,autogenerate_enabled:b.autogenerate_enabled||!1,posting_frequency:b.posting_frequency||"WEEKLY",preferred_time:y,preferred_days:b.preferred_days||["MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY","SUNDAY"],config:b.config||{image:{enabled:!0,steps:["SEARCH_EXISTING","AI_GENERATE","STOCK_SEARCH","STOP_AND_UPLOAD"]},video:{enabled:!1,steps:["SEARCH_EXISTING","STOP_AND_UPLOAD","AI_GENERATE","STOCK_SEARCH"]}}});g.useEffect(()=>{console.log("[PlatformConnectionCard] Syncing formState with displayPreferredTime:",{displayPreferredTime:y,currentFormStateTime:w.preferred_time,shouldUpdate:y!==w.preferred_time}),j(pe=>({...pe,preferred_time:y}))},[y]),g.useEffect(()=>{const pe=b.preferred_days||["MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY","SUNDAY"];console.log("[PlatformConnectionCard] Settings preferred_days changed:",{settingsPreferredDays:pe,currentFormStatePreferredDays:w.preferred_days}),j(Ce=>({...Ce,preferred_days:pe}))},[b.preferred_days]);const[N,_]=g.useState(!1),[S,C]=g.useState(((Se=b.connection_details)==null?void 0:Se.auth_type)||"FACEBOOK_LOGIN"),[E,T]=g.useState(!1),[B,L]=g.useState(!1);g.useEffect(()=>{const pe=e.platform_key==="linkedin",Ce=b.status==="CONNECTED";if(pe&&Ce&&c)return!localStorage.getItem(`org_fetch_attempted_${e.id}`)&&u.length===0&&(localStorage.setItem(`org_fetch_attempted_${e.id}`,"true"),c(e.id).then(()=>{setTimeout(()=>{localStorage.removeItem(`org_fetch_attempted_${e.id}`)},3e5)}
1618)),()=>{localStorage.removeItem(`org_fetch_attempted_${e.id}`)}},[e.platform_key,e.id,b.status,c,u.length]);const P=b.connection_details||{},F=D(e.platform_key,P),M=P.organization_id,I=P.post_as_organization===!0,$=P.selected_page_id,V=!!$,R=P.pages||[],Q=R.find(pe=>pe.id===$);g.useEffect(()=>{e.platform_key==="facebook"&&(console.log("=== FACEBOOK PAGE DEBUG ==="),console.log("Platform ID:",e.id),console.log("Settings object:",b),console.log("Connection Details:",P),console.log("Selected Page ID:",$),console.log("Is Posting As Page:",V),console.log("Facebook Pages:",R),console.log("Selected Page Object:",Q),console.log("User Profile Info from getUserProfileInfo:",F),console.log("=== END FACEBOOK PAGE DEBUG ==="))},[e.platform_key,e.id,b,P,$,V,R,Q,F]);const U=u.find(pe=>pe.id===M);function D(pe,Ce){if(!Ce)return null;switch(pe){case"linkedin":return Ce.name?Ce.name:Ce.localizedFirstName&&Ce.localizedLastName?`${Ce.localizedFirstName} ${Ce.localizedLastName}`:Ce.username?Ce.username:null;case"twitter":return Ce.username?`@${Ce.username}`:Ce.name?Ce.name:null;case"facebook":return Ce.selected_page_name?Ce.selected_page_name:Ce.user_name?Ce.user_name:Ce.name?Ce.name:Ce.username?Ce.username:null;case"instagram":return Ce.instagram_username?`@${Ce.instagram_username}`:Ce.username?`@${Ce.username}`:Ce.name?Ce.name:null;default:return Ce.username?Ce.username:Ce.name?Ce.name:Ce.display_name?Ce.display_name:Ce.email?Ce.email:null}}const q=async()=>{try{await a(e.id,{autopost_enabled:w.autopost_enabled,autogenerate_enabled:b.autogenerate_enabled,posting_frequency:b.posting_frequency,preferred_time:b.preferred_time,preferred_days:b.preferred_days,config:b.config}),A("/automation")}catch(pe){console.error("Error saving platform settings:",pe)}},G=b.status==="CONNECTED",Y=b.status==="AUTHENTICATION_FAILED",K=b.status==="PENDING",X=s[e.id]||"idle",ne=()=>{o(e.id,"DISCONNECTED")},ae=()=>{if(G)i(e.id);else if(l)if(e.platform_key==="instagram"){T(!0);return}else e.platform_key==="facebook"?L(!0):l(e.platform_key);else He({title:"Authentication Error",description:"Authentication flow not available for this platform.",variant:"destructive"})},J=()=>{T(!1),l&&l(e.platform_key,S)},W=()=>{L(!1),l&&l(e.platform_key)},ie=()=>{o(e.id,"DISCONNECTED","Authentication canceled by user"),He({title:"Authentication Canceled",description:`${e.name} authentication has been canceled.`})},he=async pe=>{d&&await d(e.id,pe)},ee=async pe=>{m&&await m(e.id,pe)},xe=pe=>{const Ce=new Date(pe),se=(new Date().getTime()-Ce.getTime())/(1e3*60*60);if(se<1)return"Updated just now";if(se<24){const Ae=Math.floor(se);return`Updated ${Ae} ${Ae===1?"hour":"hours"} ago`}else if(se<168){const Ae=Math.floor(se/24);return`Updated ${Ae} ${Ae===1?"day":"days"} ago`}else return`Updated on ${Ce.toLocaleDateString()}`},we=async()=>{_(!0);try{const pe=await de.auth.getSession();if(!pe.data.session)throw new Error("No session found");const Ce=await fetch("https://worker.rainfactory.ai/rainfactory/test-platform-content",{method:"POST",headers:{Authorization:`Bearer ${pe.data.session.access_token}`,"Content-Type":"application/json"},body:JSON.stringify({brandId:f,platformId:e.id,markConvergenceAsUsed:!1})}),re=await Ce.json();if(!Ce.ok)throw new Error(re.error||"Failed to generate test content");re.scheduledTime?He({title:"Test Content Created",description:n.jsxs("div",{className:"space-y-2",children:[n.jsxs("p",{children:["Content will be published to ",e.name," in 2 minutes"]}),re.contentId&&n.jsx("a",{href:`/content/${re.contentId}`,className:"inline-flex items-center text-blue-600 hover:text-blue-700 font-medium",onClick:se=>{se.stopPropagation()},children:"View Content →"})]}),duration:1/0}):He({title:"Test Content Created",description:n.jsxs("div",{className:"space-y-2",children:[n.jsxs("p",{children:["Content created for ",e.name,". Manual publishing required."]}),re.contentId&&n.jsx("a",{href:`/content/${re.contentId}`,className:"inline-flex items-center text-blue-600 hover:text-blue-700 font-medium",onClick:se=>{se.stopPropagation()},children:"View Content →"})]}),duration:1/0})}catch(pe){console.error("Error generating test content:",pe),He({title:"Test Failed",description:pe instanceof Error?pe.message:"Failed to generate test content",variant:"destructive"})}finally{_(!1)}};return n.jsxs("div",{className:"relative overflow-hidden bg-gradient-to-br from-slate-50 via-white to-blue-50/30",children:[n.jsx(Zt,{open:B,onOpenChange:L,children:n.jsxs(QB,{children:[n.jsx(B2,{className:"fixed inset-0 bg-black/40 backdrop-blur-sm"}),n.jsxs(Jt,{className:"fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 z-50 w-full sm:max-w-lg overflow-hidden bg-gradient-to-br from-white via-blue-50/30 to-white border border-blue-200/50 shadow-2xl backdrop-blur-sm",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-blue-50/20 via-trans
1618parent to-indigo-50/20"}),n.jsx("div",{className:"absolute top-0 right-0 w-24 h-24 bg-gradient-to-br from-blue-200/20 to-transparent rounded-full -translate-y-12 translate-x-12"}),n.jsxs(_r,{className:"relative text-center pb-4",children:[n.jsx("div",{className:"mx-auto mb-3 flex h-12 w-12 items-center justify-center rounded-full bg-gradient-to-br from-blue-600 to-indigo-700 shadow-lg shadow-blue-200/50 transition-transform duration-300 hover:scale-110",children:n.jsx(_u,{className:"h-6 w-6 text-white"})}),n.jsx(tr,{className:"text-xl font-bold bg-gradient-to-r from-blue-700 to-indigo-700 bg-clip-text text-transparent",children:"Connect Facebook Business Account"})]}),n.jsxs(Ar,{className:"relative overflow-hidden bg-gradient-to-r from-amber-50 to-yellow-50 border border-amber-200/60 shadow-lg backdrop-blur-sm",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-amber-50/30 to-yellow-50/30"}),n.jsx(hn,{className:"relative h-5 w-5 text-amber-600"}),n.jsxs(gr,{className:"relative text-amber-800",children:[n.jsx("div",{className:"font-bold mb-2 text-amber-900 text-base",children:"Important note"}),n.jsx("p",{className:"text-sm leading-relaxed",children:"To setup Meta to Enable Facebook Business Scheduling, make sure:"}),n.jsxs("ul",{className:"text-sm mt-1 space-y-1 list-disc list-inside",children:[n.jsx("li",{children:"You are the admin of a Facebook Business Page."}),n.jsx("li",{children:"Your Facebook Page is part of a Business Portfolio."}),n.jsx("li",{children:"Your personal Facebook account has admin rights to the Business Portfolio that the Page is a part of."})]}),n.jsx("p",{className:"text-sm mt-2",children:"If you are not sure if you have the right setup, review our guide:"}),n.jsxs(te,{variant:"outline",size:"sm",className:"mt-1 h-8 text-xs",onClick:()=>{window.open("/help#facebook-guide","_blank")},children:[n.jsx(vB,{className:"mr-1 h-3 w-3"}),"See Connection Guide"]})]})]}),n.jsx("div",{className:"text-center text-sm text-muted-foreground py-2",children:"We're sending you to Facebook (Meta) real quick to sign in and link your account to Rainfactory."}),n.jsxs("div",{className:"flex justify-between gap-3",children:[n.jsxs(te,{variant:"outline",onClick:()=>L(!1),className:"group relative overflow-hidden flex-1 border-gray-300 text-gray-600 hover:bg-gradient-to-r hover:from-gray-50 hover:to-slate-50 transition-all duration-300 transform hover:scale-105 shadow-sm hover:shadow-md font-medium",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-gray-50/20 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-300"}),n.jsx("span",{className:"relative",children:"Back"})]}),n.jsxs(te,{onClick:W,className:"group relative overflow-hidden flex-1 bg-gradient-to-r from-blue-600 to-blue-700 border-0 text-white shadow-lg hover:shadow-xl transition-all duration-300 transform hover:scale-105 hover:from-blue-700 hover:to-blue-800 font-medium",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-white/10 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-300"}),n.jsxs("span",{className:"relative flex items-center",children:["Go to Facebook Business",n.jsx(Vs,{className:"ml-2 h-4 w-4"})]})]})]})]})]})}),n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsx("div",{className:"absolute top-0 right-0 w-32 h-32 bg-gradient-to-br from-blue-200/20 to-transparent rounded-full -translate-y-16 translate-x-16"}),n.jsx("div",{className:"absolute bottom-0 left-0 w-24 h-24 bg-gradient-to-tr from-indigo-100/40 to-transparent rounded-full translate-y-12 -translate-x-12"}),n.jsx("div",{className:"relative mb-6",children:n.jsxs("div",{className:"flex items-center gap-3 pb-4 border-b border-gray-100",children:[n.jsx("div",{className:"p-2 bg-gradient-to-br from-blue-500/10 to-indigo-600/10 rounded-lg",children:t}),n.jsxs("div",{children:[n.jsxs("h2",{className:"font-semibold text-gray-900",children:[e==null?void 0:e.name," Connection"]}),n.jsx("p",{className:"text-sm text-gray-600",children:"Configure platform connection and automation settings"})]})]})}),n.jsx(Te,{className:ye("relative mb-4 border-none rounded-t-none pt-0 bg-white/60 backdrop-blur-sm ",(e==null?void 0:e.platform_key)!=="rss"&&Y&&"border-l-4 border-red-500",(e==null?void 0:e.platform_key)!=="rss"&&K&&"border-l-4 border-yellow-500"),children:n.jsx(Re,{className:"space-y-6 pt-6",children:(e==null?void 0:e.platform_key)==="rss"?n.jsxs(n.Fragment,{children:[n.jsx(Jlt,{platform:e,brandId:f}),n.jsxs("div",{className:"flex justify-end mt-4 gap-2",children:[p&&G&&n.jsx(Ya,{children:n.jsxs(Hs,{children:[n.jsx(zs,{asChild:!0,children:n.jsx(te,{type:"button",variant:"outline",onClick:we,disabled:N||!w.autogenerate_enabled,className:"border-purple-300 text-purple-600 hover:bg-purple-50 disabled:opacity-50 disabled:cursor-not-allowed",children:N?n.jsxs(n.Fragment,{children:[n.jsx(Es,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating..."]}):n.jsxs(n.Fragment,{children:[n.jsx(v2,{className:"mr-2 h-4 w-4"}),"Test Auto-Create"]})})}),w.autogenerate_enabled?w.autopost_enabled?n.jsx(Vn,{children:n.jsx("p",{children:"This will create test content and automatically publish it to RSS feed"})}):n.jsx(Vn,{children:n.jsx("p",{children:"This will create test content (manual publishing required)"})}):n.jsx(Vn,{children:n.jsx("p",{children:"Auto-create must be enabled to test c
1618ontent generation"})})]})}),n.jsxs(te,{type:"button",onClick:q,className:"group relative overflow-hidden h-12 px-6 min-w-[200px] bg-gradient-to-r from-blue-500 to-indigo-600 border-0 text-white shadow-lg hover:shadow-xl transition-all duration-300 transform hover:scale-105 hover:from-blue-600 hover:to-indigo-700 font-medium",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-white/10 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-300"}),n.jsx("span",{className:"relative",children:"Save RSS Settings"})]})]})]}):(e==null?void 0:e.platform_key)==="webhook"?n.jsx(n.Fragment,{children:n.jsx(Ylt,{platform:e,brandId:f,connectionDetails:b.connection_details||{},onSave:async pe=>{await a(e.id,{connection_details:pe})},onTest:async()=>{await i(e.id)},isConnected:G,isTesting:X==="testing"})}):n.jsxs("div",{className:"space-y-6",children:[n.jsxs(Te,{className:ye("group relative overflow-hidden border-l-4 transition-all duration-500",G&&"border-green-500 bg-gradient-to-br from-emerald-50/80 via-green-50/60 to-white",Y&&"border-red-500 bg-gradient-to-br from-red-50/80 via-rose-50/60 to-white",K&&"border-yellow-500 bg-gradient-to-br from-amber-50/80 via-yellow-50/60 to-white",!G&&!Y&&!K&&"border-gray-300 bg-gradient-to-br from-gray-50/80 via-slate-50/60 to-white"),children:[n.jsx("div",{className:ye("absolute inset-0 transition-opacity duration-300",G&&"bg-gradient-to-br from-emerald-50/30 via-transparent to-green-50/20",Y&&"bg-gradient-to-br from-red-50/30 via-transparent to-rose-50/20",K&&"bg-gradient-to-br from-amber-50/30 via-transparent to-yellow-50/20",!G&&!Y&&!K&&"bg-gradient-to-br from-gray-50/30 via-transparent to-slate-50/20")}),n.jsx("div",{className:ye("absolute top-0 right-0 w-24 h-24 rounded-full -translate-y-12 translate-x-12 transition-colors duration-300",G&&"bg-gradient-to-br from-emerald-200/30 to-transparent",Y&&"bg-gradient-to-br from-red-200/30 to-transparent",K&&"bg-gradient-to-br from-amber-200/30 to-transparent",!G&&!Y&&!K&&"bg-gradient-to-br from-gray-200/30 to-transparent")}),n.jsx(Re,{className:"relative p-6 backdrop-blur-sm",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:ye("flex items-center justify-center w-10 h-10 rounded-full shadow-sm transition-all duration-300 group-hover:scale-110",G&&"bg-gradient-to-br from-emerald-100 to-green-200 text-emerald-700",Y&&"bg-gradient-to-br from-red-100 to-rose-200 text-red-700",K&&"bg-gradient-to-br from-amber-100 to-yellow-200 text-amber-700",!G&&!Y&&!K&&"bg-gradient-to-br from-gray-100 to-slate-200 text-gray-700"),children:K?n.jsx(kt,{className:"h-5 w-5 animate-spin"}):Y?n.jsx(nr,{className:"h-5 w-5"}):G?n.jsx(Gn,{className:"h-5 w-5"}):n.jsx(Rl,{className:"h-5 w-5"})}),n.jsxs("div",{children:[n.jsxs("div",{className:ye("font-bold text-lg transition-all duration-300",G&&"bg-gradient-to-r from-emerald-800 to-green-700 bg-clip-text text-transparent",Y&&"bg-gradient-to-r from-red-800 to-rose-700 bg-clip-text text-transparent",K&&"bg-gradient-to-r from-amber-800 to-yellow-700 bg-clip-text text-transparent",!G&&!Y&&!K&&"bg-gradient-to-r from-gray-800 to-slate-700 bg-clip-text text-transparent"),children:[K&&"Connecting...",Y&&"Connection Failed",G&&"Connected",!G&&!Y&&!K&&"Not Connected"]}),G&&F&&!I&&!V&&n.jsxs("div",{className:"flex items-center gap-1 mt-1",children:[n.jsx(li,{className:"h-3 w-3 text-muted-foreground"}),n.jsx("span",{className:"text-sm text-muted-foreground",children:F})]}),G&&I&&U&&n.jsxs("div",{className:"flex items-center gap-1 mt-1",children:[n.jsx(ih,{className:"h-3 w-3 text-muted-foreground"}),n.jsx("span",{className:"text-sm text-muted-foreground",children:U.name})]}),G&&V&&F&&n.jsxs("div",{className:"flex items-center gap-1 mt-1",children:[n.jsx(ih,{className:"h-3 w-3 text-muted-foreground"}),n.jsx("span",{className:"text-sm text-muted-foreground",children:F})]}),G&&b.updated_at&&n.jsx("div",{className:"text-xs text-muted-foreground mt-1",children:xe(b.updated_at)}),Y&&b.error_message&&n.jsx("div",{className:"text-xs text-red-600 mt-1",children:b.error_message}),K&&n.jsx("div",{className:"text-xs text-yellow-600 mt-1",children:"Complete authentication in the popup window"})]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[!G&&!K&&n.jsxs(te,{type:"button",variant:"default",onClick:ae,disabled:X==="testing",size:"sm",className:"group relative overflow-hidden bg-gradient-to-r from-blue-500 to-indigo-600 border-0 text-white shadow-lg hover:shadow-xl transition-all duration-300 transform hover:scale-105 hover:from-blue-600 hover:to-indigo-700 disabled:opacity-50 disabled:cursor-not-allowed disabled:transform-none",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-white/10 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-300"}),X==="testing"?n.jsx(Es,{className:"relative h-4 w-4 animate-spin mr-2"}):n.jsx("span",{className:"relative mr-2",children:t}),n.jsxs("span",{className:"relative",children:[X==="testing"?"Testing...":"Connect",e.platform_key==="instagram"&&X!=="testing"&&n.jsxs("span",{className:"ml-1",children:["via ",S==="FACEBOOK_LOGIN"?"Facebook":"Instagram"]})]})]}),K&&n.jsxs(te,{type:"button",variant:"outline",onClick:ie,size:"sm",className:"group relative overflow-hidden border-red-300 text-red-600 hover:bg-gradient-to-r hover:from-red-50 hover:to-rose-50 transition-all duration-300 transform hover:scale-105 shadow-sm hover:shadow-md",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-red-50/20 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-300"}),n.jsx(Rl,{className:"relative h-4 w-4 group-hover:scale-110 transition-transform duration-200 mr-2"}),n.jsx("span",{className:"relative",children:"Cancel"})]}),G&&n.jsxs(n.Fragment,{children:[n.jsxs(te,{type:"button",variant:"outline",onClick:ae,disabled:X==="testing",size:"sm",className:"group relative overflow-hidden border-blue-300 text-blue-600 hover:bg-gradient-to-r hover:from-blue-50 hover:to-indigo-50 transition-all duration-300 transform hover:scale-105 shadow-sm hover:shadow-md disabled:opacity-50 disabled:cursor-not-allowed disabled:transform-none",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-blue-50/20 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-300"}),X==="testing"?n.jsx(Es,{className:"relative h-4 w-4 animate-spin"}):n.jsx(di,{className:"relative h-4 w-4 group-hover:scale-110 transition-transform duration-200"}),n.jsx("span",{className:"sr-only",children:"Test connection"})]}),p&&n.jsx(Ya,{children:n.jsxs(Hs,{children:[n.jsx(zs,{asChild:!0,children:n.jsxs(te,{type:"button",variant:"outline",onClick:we,disabled:N||!w.autogenerate_enabled,size:"sm",className:"border-purple-300 text-purple-600 hover:bg-purple-50 disabled:opacity-50 disabled:cursor-not-allowed",children:[N?n.jsx(Es,{className:"h-4 w-4 animate-spin"}):n.jsx(v2,{className:"h-4 w-4"}),n.jsx("span",{className:"sr-only",children:"Test auto-create"})]})}),w.autogenerate_enabled?w.autopost_enabled?n.jsx(Vn,{children:n.jsxs("p",{children:["This will create test content and automatically publish it to ",e.name]})}):n.jsx(Vn,{children:n.jsx("p",{children:"This will create test content (manual publishing required)"})}):n.jsx(Vn,{children:n.jsx("p",{children:"Auto-create must be enabled to test c
1618ontent generation"})})]})}),n.jsxs(te,{type:"button",variant:"outline",onClick:ne,size:"sm",className:"group relative overflow-hidden border-red-300 text-red-600 hover:bg-gradient-to-r hover:from-red-50 hover:to-rose-50 transition-all duration-300 transform hover:scale-105 shadow-sm hover:shadow-md",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-red-50/20 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-300"}),n.jsx(Rl,{className:"relative h-4 w-4 group-hover:scale-110 transition-transform duration-200"}),n.jsx("span",{className:"sr-only",children:"Disconnect"})]})]})]})]})})]}),n.jsxs("div",{className:"space-y-4",children:[e.platform_key==="instagram"&&!G&&n.jsx(Te,{children:n.jsxs(Re,{className:"p-4",children:[n.jsx("label",{className:"text-base font-medium mb-2 block",children:"Instagram Login Method"}),n.jsxs(Cs,{defaultValue:S,className:"w-full",onValueChange:pe=>C(pe),children:[n.jsxs(ps,{className:"grid w-full grid-cols-2",children:[n.jsxs(pt,{value:"FACEBOOK_LOGIN",className:"flex items-center justify-center gap-2",children:[n.jsx(_u,{className:"h-4 w-4"}),n.jsx("span",{children:"Facebook Login"})]}),n.jsxs(pt,{value:"INSTAGRAM_LOGIN",className:"flex items-center justify-center gap-2",children:[n.jsx(Vh,{className:"h-4 w-4"}),n.jsx("span",{children:"Instagram Login"})]})]}),n.jsx(Ct,{value:"FACEBOOK_LOGIN",className:"mt-2 text-sm text-muted-foreground",children:"Use this option if your Instagram professional account is linked to a Facebook Page. This provides full access to business features including content publishing, insights, and comment moderation."}),n.jsx(Ct,{value:"INSTAGRAM_LOGIN",className:"mt-2 text-sm text-muted-foreground",children:"Use this option to connect directly with your Instagram professional account (business or creator). Note that your account must be a professional account to use this option."})]}),n.jsx("p",{className:"text-xs text-muted-foreground mt-4",children:"Note: To use Instagram's API, you must have a professional account (business or creator). Personal accounts are not supported."})]})}),e.platform_key==="linkedin"&&G&&n.jsx(Te,{children:n.jsxs(Re,{className:"p-4",children:[n.jsx("label",{className:"relative text-lg font-bold bg-gradient-to-r from-gray-800 to-gray-700 bg-clip-text text-transparent group-hover:from-blue-800 group-hover:to-indigo-700 transition-all duration-300",children:"LinkedIn Organization"}),n.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"Select the LinkedIn organization to post as (optional)"}),n.jsxs(ur,{value:M||"personal",onValueChange:he,disabled:h,children:[n.jsx(or,{className:"w-full",children:n.jsx(hr,{children:n.jsx("div",{className:"flex items-center gap-2",children:M==="personal"||!M?n.jsxs(n.Fragment,{children:[n.jsx(li,{className:"h-4 w-4 text-slate-600 flex-shrink-0"}),n.jsx("span",{className:"truncate",children:"Post as personal account"})]}):U?n.jsxs(n.Fragment,{children:[n.jsx(ih,{className:"h-4 w-4 text-blue-600 flex-shrink-0"}),n.jsx("span",{className:"truncate",children:U.name})]}):n.jsx("span",{children:"Select an organization"})})})}),n.jsxs(lr,{children:[n.jsx(Fe,{value:"personal",children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(li,{className:"h-4 w-4 text-slate-600 flex-shrink-0"}),n.jsx("span",{className:"truncate",children:"Post as personal account"})]})}),u.length>0&&n.jsx("div",{className:"my-1 h-px bg-slate-100"}),u.map(pe=>n.jsx(Fe,{value:pe.id,children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(ih,{className:"h-4 w-4 text-blue-600 flex-shrink-0"}),n.jsx("span",{className:"truncate",children:pe.name||`Organization ${pe.id}`})]})},pe.id)),u.length===0&&!h&&n.jsx("div",{className:"py-2 px-2 text-sm text-slate-500 italic",children:"No organizations found"}),h&&n.jsxs("div",{className:"py-2 px-2 text-sm text-slate-500 flex items-center gap-2",children:[n.jsx(Es,{className:"h-3 w-3 animate-spin flex-shrink-0"}),n.jsx("span",{className:"truncate",children:"Loading organizations..."})]})]})]}),I&&U&&n.jsxs("p",{className:"text-sm text-blue-600 mt-2 flex items-center gap-1.5",children:[n.jsx(ih,{className:"h-3.5 w-3.5"}),n.jsxs("span",{children:["Posts will be published as ",U.name]})]}),!I&&F&&n.jsxs("p",{className:"text-sm text-green-600 mt-2 flex items-center gap-1.5",children:[n.jsx(li,{className:"h-3.5 w-3.5"}),n.jsxs("span",{children:["Posts will be published as your personal profile (",F,")"]})]})]})}),e.platform_key==="facebook"&&G&&R.length>0&&n.jsx(Te,{children:n.jsxs(Re,{className:"p-4",children:[n.jsx("label",{className:"relative text-lg font-bold bg-gradient-to-r from-gray-800 to-gray-700 bg-clip-text text-transparent group-hover:from-blue-800 group-hover:to-indigo-700 transition-all duration-300",children:"Facebook Page"}),n.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"Select the Facebook page to post as (optional)"}),n.jsxs(ur,{value:$||"personal",onValueChange:ee,children:[n.jsx(or,{className:"w-full",children:n.jsx(hr,{children:n.jsx("div",{className:"flex items-center gap-2",children:$==="personal"||!$?n.jsxs(n.Fragment,{children:[n.jsx(li,{className:"h-4 w-4 text-slate-600 flex-shrink-0"}),n.jsx("span",{className:"truncate",children:"Post as personal profile"})]}):Q?n.jsxs(n.Fragment,{children:[n.jsx(ih,{className:"h-4 w-4 text-blue-600 flex-shrink-0"}),n.jsx("span",{className:"truncate",children:Q.name})]}):n.jsx("span",{children:"Select a page"})})})}),n.jsxs(lr,{children:[n.jsx(Fe,{value:"personal",children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(li,{className:"h-4 w-4 text-slate-600 flex-shrink-0"}),n.jsx("span",{className:"truncate",children:"Post as personal profile"})]})}),R.length>0&&n.jsx("div",{className:"my-1 h-px bg-slate-100"}),R.map(pe=>n.jsx(Fe,{value:pe.id,children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(ih,{className:"h-4 w-4 text-blue-600 flex-shrink-0"}),n.jsx("span",{className:"truncate",children:pe.name||`Page ${pe.id}`})]})},pe.id)),R.length===0&&n.jsx("div",{className:"py-2 px-2 text-sm text-slate-500 italic",children:"No pages found"})]})]}),V&&Q&&n.jsxs("p",{className:"text-sm text-blue-600 mt-2 flex items-center gap-1.5",children:[n.jsx(ih,{className:"h-3.5 w-3.5"}),n.jsxs("span",{children:["Posts will be published as ",Q.name]})]}),!V&&P.user_name&&n.jsxs("p",{className:"text-sm text-green-600 mt-2 flex items-center gap-1.5",children:[n.jsx(li,{className:"h-3.5 w-3.5"}),n.jsxs("span",{children:["Posts will be published as your personal profile (",P.user_name,")"]})]})]})})]})]})})}),(e==null?void 0:e.platform_key)!=="rss"&&(e==null?void 0:e.platform_key)!=="webhook"&&n.jsx(n.Fragment,{children:n.jsx(Zt,{open:E,onOpenChange:T,children:n.jsxs(QB,{children:[n.jsx(B2,{className:"fixed inset-0 bg-black/40 backdrop-blur-sm"}),n.jsxs(Jt,{className:"fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 z-50 w-full sm:max-w-md overflow-hidden bg-gradient-to-br from-white via-pink-50/30 to-white border border-pink-200/50 shadow-2xl backdrop-blur-sm",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-pink-50/20 via-trans
1618parent to-rose-50/20"}),n.jsx("div",{className:"absolute top-0 right-0 w-24 h-24 bg-gradient-to-br from-pink-200/20 to-transparent rounded-full -translate-y-12 translate-x-12"}),n.jsxs(_r,{className:"relative text-center pb-4",children:[n.jsx("div",{className:"mx-auto mb-3 flex h-12 w-12 items-center justify-center rounded-full bg-gradient-to-br from-pink-500 via-red-500 to-yellow-500 shadow-lg shadow-pink-200/50 transition-transform duration-300 hover:scale-110",children:n.jsx(Vh,{className:"h-6 w-6 text-white"})}),n.jsx(tr,{className:"text-xl font-bold bg-gradient-to-r from-pink-700 via-red-700 to-yellow-700 bg-clip-text text-transparent",children:"Connect Instagram Business Account"})]}),n.jsxs(Ar,{className:"relative overflow-hidden bg-gradient-to-r from-amber-50 to-yellow-50 border border-amber-200/60 shadow-lg backdrop-blur-sm",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-amber-50/30 to-yellow-50/30"}),n.jsx(hn,{className:"relative h-5 w-5 text-amber-600"}),n.jsxs(gr,{className:"relative text-amber-800",children:[n.jsx("div",{className:"font-bold mb-3 text-amber-900 text-lg",children:"Important note"}),n.jsx("p",{className:"text-sm leading-relaxed",children:"Meta only allows Instagram Business Accounts that are connected to a Facebook Business Page to schedule posts. Because of this, we need to authenticate through Facebook."}),n.jsx("p",{className:"text-sm mt-3",children:"If you are not sure if you have the right setup, review our guide:"}),n.jsxs(te,{variant:"outline",size:"sm",className:"mt-2 h-8 text-xs",onClick:()=>{window.open("/help#instagram-guide","_blank")},children:[n.jsx(vB,{className:"mr-1 h-3 w-3"}),"See Connection Guide"]})]})]}),n.jsx("div",{className:"text-center text-sm text-muted-foreground py-2",children:"We're sending you to Facebook (Meta) real quick to sign in and link your account to Rainfactory."}),n.jsxs("div",{className:"flex justify-between gap-3",children:[n.jsxs(te,{variant:"outline",onClick:()=>T(!1),className:"group relative overflow-hidden flex-1 border-gray-300 text-gray-600 hover:bg-gradient-to-r hover:from-gray-50 hover:to-slate-50 transition-all duration-300 transform hover:scale-105 shadow-sm hover:shadow-md font-medium",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-gray-50/20 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-300"}),n.jsx("span",{className:"relative",children:"Back"})]}),n.jsxs(te,{onClick:J,className:"group relative overflow-hidden flex-1 bg-gradient-to-r from-blue-600 to-blue-700 border-0 text-white shadow-lg hover:shadow-xl transition-all duration-300 transform hover:scale-105 hover:from-blue-700 hover:to-blue-800 font-medium",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-white/10 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-300"}),n.jsxs("span",{className:"relative flex items-center",children:["Go to Facebook Business",n.jsx(Vs,{className:"ml-2 h-4 w-4"})]})]})]})]})]})})})]})};function Zlt(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return g.useMemo(()=>s=>{t.forEach(a=>a(s))},t)}const sk=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function E0(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function L6(e){return"nodeType"in e}function yo(e){var t,r;return e?E0(e)?e:L6(e)&&(t=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?t:window:window}function D6(e){const{Document:t}=yo(e);return e instanceof t}function ew(e){return E0(e)?!1:e instanceof yo(e).HTMLElement}function _ae(e){return e instanceof yo(e).SVGElement}function B0(e){return e?E0(e)?e.document:L6(e)?D6(e)?e:ew(e)||_ae(e)?e.ownerDocument:document:document:document}const vd=sk?g.useLayoutEffect:g.useEffect;function R6(e){const t=g.useRef(e);return vd(()=>{t.current=e}),g.useCallback(function(){for(var r=arguments.length,s=new Array(r),a=0;a<r;a++)s[a]=arguments[a];return t.current==null?void 0:t.current(...s)},[])}function ect(){const e=g.useRef(null),t=g.useCallback((s,a)=>{e.current=setInterval(s,a)},[]),r=g.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,r]}
1618function fy(e,t){t===void 0&&(t=[e]);const r=g.useRef(e);return vd(()=>{r.current!==e&&(r.current=e)},t),r}function tw(e,t){const r=g.useRef();return g.useMemo(()=>{const s=e(r.current);return r.current=s,s},[...t])}function d_(e){const t=R6(e),r=g.useRef(null),s=g.useCallback(a=>{a!==r.current&&(t==null||t(a,r.current)),r.current=a},[]);return[r,s]}function BP(e){const t=g.useRef();return g.useEffect(()=>{t.current=e},[e]),t.current}let l4={};function rw(e,t){return g.useMemo(()=>{if(t)return t;const r=l4[e]==null?0:l4[e]+1;return l4[e]=r,e+"-"+r},[e,t])}function Cae(e){return function(t){for(var r=arguments.length,s=new Array(r>1?r-1:0),a=1;a<r;a++)s[a-1]=arguments[a];return s.reduce((i,o)=>{const l=Object.entries(o);for(const[c,d]of l){const u=i[c];u!=null&&(i[c]=u+e*d)}return i},{...t})}}const zA=Cae(1),my=Cae(-1);function tct(e){return"clientX"in e&&"clientY"in e}function U6(e){if(!e)return!1;const{KeyboardEvent:t}=yo(e.target);return t&&e instanceof t}function rct(e){if(!e)return!1;const{TouchEvent:t}=yo(e.target);return t&&e instanceof t}function TP(e){if(rct(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:r}=e.touches[0];return{x:t,y:r}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:r}=e.changedTouches[0];return{x:t,y:r}}}return tct(e)?{x:e.clientX,y:e.clientY}:null}const py=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:r}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:r}=e;return"scaleX("+t+") scaleY("+r+")"}},Transform:{toString(e){if(e)return[py.Translate.toString(e),py.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:s}=e;return t+" "+r+"ms "+s}}}),_z="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function nct(e){return e.matches(_z)?e:e.querySelector(_z)}const sct={display:"none"};function act(e){let{id:t,value:r}=e;return oe.createElement("div",{id:t,style:sct},r)}function ict(e){let{id:t,announcement:r,ariaLiveType:s="assertive"}=e;const a={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return oe.createElement("div",{id:t,style:a,role:"status","aria-live":s,"aria-atomic":!0},r)}function oct(){const[e,t]=g.useState("");return{announce:g.useCallback(s=>{s!=null&&t(s)},[]),announcement:e}}const Sae=g.createContext(null);function lct(e){const t=g.useContext(Sae);g.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function cct(){const[e]=g.useState(()=>new Set),t=g.useCallback(s=>(e.add(s),()=>e.delete(s)),[e]);return[g.useCallback(s=>{let{type:a,event:i}=s;e.forEach(o=>{var l;return(l=o[a])==null?void 0:l.call(o,i)})},[e]),t]}const dct={draggable:`
1619    To pick up a draggable item, press the space bar.
1620    While dragging, use the arrow keys to move the item.
1621    Press space again to drop the item in its new position, or press escape to cancel.
1622  `},uct={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was moved over droppable area "+r.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was dropped over droppable area "+r.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function hct(e){let{announcements:t=uct,container:r,hiddenTextDescribedById:s,screenReaderInstructions:a=dct}=e;const{announce:i,announcement:o}=oct(),l=rw("DndLiveRegion"),[c,d]=g.useState(!1);if(g.useEffect(()=>{d(!0)},[]),lct(g.useMemo(()=>({onDragStart(h){let{active:m}=h;i(t.onDragStart({active:m}))},onDragMove(h){let{active:m,over:f}=h;t.onDragMove&&i(t.onDragMove({active:m,over:f}))},onDragOver(h){let{active:m,over:f}=h;i(t.onDragOver({active:m,over:f}))},onDragEnd(h){let{active:m,over:f}=h;i(t.onDragEnd({active:m,over:f}))},onDragCancel(h){let{active:m,over:f}=h;
1622i(t.onDragCancel({active:m,over:f}))}}),[i,t])),!c)return null;const u=oe.createElement(oe.Fragment,null,oe.createElement(act,{id:s,value:a.draggable}),oe.createElement(ict,{id:l,announcement:o}));return r?rd.createPortal(u,r):u}var Oa;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Oa||(Oa={}));function u_(){}function Cz(e,t){return g.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function fct(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return g.useMemo(()=>[...t].filter(s=>s!=null),[...t])}const Ec=Object.freeze({x:0,y:0});function kae(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Eae(e,t){let{data:{value:r}}=e,{data:{value:s}}=t;return r-s}function mct(e,t){let{data:{value:r}}=e,{data:{value:s}}=t;return s-r}function Sz(e){let{left:t,top:r,height:s,width:a}=e;return[{x:t,y:r},{x:t+a,y:r},{x:t,y:r+s},{x:t+a,y:r+s}]}function Bae(e,t){if(!e||e.length===0)return null;const[r]=e;return r[t]}function kz(e,t,r){return t===void 0&&(t=e.left),r===void 0&&(r=e.top),{x:t+e.width*.5,y:r+e.height*.5}}const Ez=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:s}=e;const a=kz(t,t.left,t.top),i=[];for(const o of s){const{id:l}=o,c=r.get(l);if(c){const d=kae(kz(c),a);i.push({id:l,data:{droppableContainer:o,value:d}})}}return i.sort(Eae)},pct=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:s}=e;const a=Sz(t),i=[];for(const o of s){const{id:l}=o,c=r.get(l);if(c){const d=Sz(c),u=a.reduce((m,f,p)=>m+kae(d[p],f),0),h=Number((u/4).toFixed(4));i.push({id:l,data:{droppableContainer:o,value:h}})}}return i.sort(Eae)};function Act(e,t){const r=Math.max(t.top,e.top),s=Math.max(t.left,e.left),a=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),o=a-s,l=i-r;if(s<a&&r<i){const c=t.width*t.height,d=e.width*e.height,u=o*l,h=u/(c+d-u);return Number(h.toFixed(4))}return 0}const gct=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:s}=e;const a=[];for(const i of s){const{id:o}=i,l=r.get(o);if(l){const c=Act(l,t);c>0&&a.push({id:o,data:{droppableContainer:i,value:c}})}}return a.sort(mct)};function xct(e,t,r){return{...e,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function Tae(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Ec}function vct(e){return function(r){for(var s=arguments.length,a=new Array(s>1?s-1:0),i=1;i<s;i++)a[i-1]=arguments[i];return a.reduce((o,l)=>({...o,top:o.top+e*l.y,bottom:o.bottom+e*l.y,left:o.left+e*l.x,right:o.right+e*l.x}),{...r})}}const bct=vct(1);function yct(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function wct(e,t,r){const s=yct(t);if(!s)return e;const{scaleX:a,scaleY:i,x:o,y:l}=s,c=e.left-o-(1-a)*parseFloat(r),d=e.top-l-(1-i)*parseFloat(r.slice(r.indexOf(" ")+1)),u=a?e.width/a:e.width,h=i?e.height/i:e.height;return{width:u,height:h,top:d,right:c+u,bottom:d+h,left:c}}const jct={ignoreTransform:!1};function T0(e,t){t===void 0&&(t=jct);let r=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:d,transformOrigin:u}=yo(e).getComputedStyle(e);d&&(r=wct(r,d,u))}const{top:s,left:a,width:i,height:o,bottom:l,right:c}=r;return{top:s,left:a,width:i,height:o,bottom:l,right:c}}function Bz(e){return T0(e,{ignoreTransform:!0})}function Nct(e){const t=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function _ct(e,t){return t===void 0&&(t=yo(e).getComputedStyle(e)),t.position==="fixed"}function Cct(e,t){t===void 0&&(t=yo(e).getComputedStyle(e));const r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(a=>{const i=t[a];return typeof i=="string"?r.test(i):!1})}function ak(e,t){const r=[];function s(a){if(t!=null&&r.length>=t||!a)return r;if(D6(a)&&a.scrollingElement!=null&&!r.includes(a.scrollingElement))return r.push(a.scrollingElement),r;if(!ew(a)||_ae(a)||r.includes(a))return r;const i=yo(e).getComputedStyle(a);return a!==e&&Cct(a,i)&&r.push(a),_ct(a,i)?r:s(a.parentNode)}return e?s(e):r}function Pae(e){const[t]=ak(e,1);return t??null}function c4(e){return!sk||!e?null:E0(e)?e:L6(e)?D6(e)||e===B0(e).scrollingElement?window:ew(e)?e:null:null}function Iae(e){return E0(e)?e.scrollX:e.scrollLeft}function Oae(e){return E0(e)?e.scrollY:e.scrollTop}function PP(e){return{x:Iae(e),y:Oae(e)}}var Ga;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Ga||(Ga={}));function Fae(e){return!sk||!e?!1:e===document.scrollingElement}function Lae(e){const t={x:0,y:0},r=Fae(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},s={x:e.scrollWidth-r.width,y:e.scrollHeight-r.height},a=e.scrollTop<=t.y,i=e.scrollLeft<=t.x,o=e.scrollTop>=s.y,l=e.scrollLeft>=s.x;return{isTop:a,isLeft:i,isBottom:o,isRight:l,maxScroll:s,minScroll:t}}const Sct={x:.2,y:.2};function kct(e,t,r,s,a){let{top:i,left:o,right:l,bottom:c}=r;s===void 0&&(s=10),a===void 0&&(a=Sct);const{isTop:d,isBottom:u,isLeft:h,isRight:m}=Lae(e),f={x:0,y:0},p={x:0,y:0},A={height:t.height*a.y,width:t.width*a.x};return!d&&i<=t.top+A.height?(f.y=Ga.Backward,p.y=s*Math.abs((t.top+A.height-i)/A.height)):!u&&c>=t.bottom-A.height&&(f.y=Ga.Forward,p.y=s*Math.abs((t.bottom-A.height-c)/A.height)),!m&&l>=t.right-A.width?(f.x=Ga.Forward,p.x=s*Math.abs((t.right-A.width-l)/A.width)):!h&&o<=t.left+A.width&&(f.x=Ga.Backward,p.x=s*Math.abs((t.left+A.width-o)/A.width)),{direction:f,speed:p}}function Ect(e){if(e===document.scrollingElement){const{innerWidth:i,innerHeight:o}=window;return{top:0,left:0,right:i,bottom:o,width:i,height:o}}const{top:t,left:r,right:s,bottom:a}=e.getBoundingClientRect();return{top:t,left:r,right:s,bottom:a,width:e.clientWidth,height:e.clientHeight}}function Dae(e){return e.reduce((t,r)=>zA(t,PP(r)),Ec)}function Bct(e){return e.reduce((t,r)=>t+Iae(r),0)}function Tct(e){return e.reduce((t,r)=>t+Oae(r),0)}function Pct(e,t){if(t===void 0&&(t=T0),!e)return;const{top:r,left:s,bottom:a,right:i}=t(e);Pae(e)&&(a<=0||i<=0||r>=window.innerHeight||s>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Ict=[["x",["left","right"],Bct],["y",["top","bottom"],Tct]];class M6{constructor(t,r){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const s=ak(r),a=Dae(s);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,o,l]of Ict)for(const c of o)Object.defineProperty(this,c,{get:()=>{const d=l(s),u=a[i]-d;return this.rect[c]+u},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Iv{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>
1622{this.listeners.forEach(r=>{var s;return(s=this.target)==null?void 0:s.removeEventListener(...r)})},this.target=t}add(t,r,s){var a;(a=this.target)==null||a.addEventListener(t,r,s),this.listeners.push([t,r,s])}}function Oct(e){const{EventTarget:t}=yo(e);return e instanceof t?e:B0(e)}function d4(e,t){const r=Math.abs(e.x),s=Math.abs(e.y);return typeof t=="number"?Math.sqrt(r**2+s**2)>t:"x"in t&&"y"in t?r>t.x&&s>t.y:"x"in t?r>t.x:"y"in t?s>t.y:!1}var kl;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(kl||(kl={}));function Tz(e){e.preventDefault()}function Fct(e){e.stopPropagation()}var rn;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(rn||(rn={}));const Rae={start:[rn.Space,rn.Enter],cancel:[rn.Esc],end:[rn.Space,rn.Enter,rn.Tab]},Lct=(e,t)=>{let{currentCoordinates:r}=t;switch(e.code){case rn.Right:return{...r,x:r.x+25};case rn.Left:return{...r,x:r.x-25};case rn.Down:return{...r,y:r.y+25};case rn.Up:return{...r,y:r.y-25}}};class $6{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:r}}=t;this.props=t,this.listeners=new Iv(B0(r)),this.windowListeners=new Iv(yo(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(kl.Resize,this.handleCancel),this.windowListeners.add(kl.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(kl.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:r}=this.props,s=t.node.current;s&&Pct(s),r(Ec)}handleKeyDown(t){if(U6(t)){const{active:r,context:s,options:a}=this.props,{keyboardCodes:i=Rae,coordinateGetter:o=Lct,scrollBehavior:l="smooth"}=a,{code:c}=t;if(i.end.includes(c)){this.handleEnd(t);return}if(i.cancel.includes(c)){this.handleCancel(t);return}const{collisionRect:d}=s.current,u=d?{x:d.left,y:d.top}:Ec;this.referenceCoordinates||(this.referenceCoordinates=u);const h=o(t,{active:r,context:s.current,currentCoordinates:u});if(h){const m=my(h,u),f={x:0,y:0},{scrollableAncestors:p}=s.current;for(const A of p){const v=t.code,{isTop:x,isRight:b,isLeft:y,isBottom:w,maxScroll:j,minScroll:N}
1622=Lae(A),_=Ect(A),S={x:Math.min(v===rn.Right?_.right-_.width/2:_.right,Math.max(v===rn.Right?_.left:_.left+_.width/2,h.x)),y:Math.min(v===rn.Down?_.bottom-_.height/2:_.bottom,Math.max(v===rn.Down?_.top:_.top+_.height/2,h.y))},C=v===rn.Right&&!b||v===rn.Left&&!y,E=v===rn.Down&&!w||v===rn.Up&&!x;if(C&&S.x!==h.x){const T=A.scrollLeft+m.x,B=v===rn.Right&&T<=j.x||v===rn.Left&&T>=N.x;if(B&&!m.y){A.scrollTo({left:T,behavior:l});return}B?f.x=A.scrollLeft-T:f.x=v===rn.Right?A.scrollLeft-j.x:A.scrollLeft-N.x,f.x&&A.scrollBy({left:-f.x,behavior:l});break}else if(E&&S.y!==h.y){const T=A.scrollTop+m.y,B=v===rn.Down&&T<=j.y||v===rn.Up&&T>=N.y;if(B&&!m.x){A.scrollTo({top:T,behavior:l});return}B?f.y=A.scrollTop-T:f.y=v===rn.Down?A.scrollTop-j.y:A.scrollTop-N.y,f.y&&A.scrollBy({top:-f.y,behavior:l});break}}this.handleMove(t,zA(my(h,this.referenceCoordinates),f))}}}handleMove(t,r){const{onMove:s}=this.props;t.preventDefault(),s(r)}handleEnd(t){const{onEnd:r}=this.props;t.preventDefault(),this.detach(),r()}handleCancel(t){const{onCancel:r}=this.props;t.preventDefault(),this.detach(),r()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}$6.activators=[{eventName:"onKeyDown",handler:(e,t,r)=>{let{keyboardCodes:s=Rae,onActivation:a}=t,{active:i}=r;const{code:o}=e.nativeEvent;if(s.start.includes(o)){const l=i.activatorNode.current;return l&&e.target!==l?!1:(e.preventDefault(),a==null||a({event:e.nativeEvent}),!0)}return!1}}];function Pz(e){return!!(e&&"distance"in e)}function Iz(e){return!!(e&&"delay"in e)}class Q6{constructor(t,r,s){var a;s===void 0&&(s=Oct(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=r;const{event:i}=t,{target:o}=i;this.props=t,this.events=r,this.document=B0(o),this.documentListeners=new Iv(this.document),this.listeners=new Iv(s),this.windowListeners=new Iv(yo(o)
1622),this.initialCoordinates=(a=TP(i))!=null?a:Ec,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:r,bypassActivationConstraint:s}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(kl.Resize,this.handleCancel),this.windowListeners.add(kl.DragStart,Tz),this.windowListeners.add(kl.VisibilityChange,this.handleCancel),this.windowListeners.add(kl.ContextMenu,Tz),this.documentListeners.add(kl.Keydown,this.handleKeydown),r){if(s!=null&&s({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Iz(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(Pz(r)){this.handlePending(r);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,r){const{active:s,onPending:a}=this.props;a(s,t,this.initialCoordinates,r)}handleStart(){const{initialCoordinates:t}=this,{onStart:r}=this.props;t&&(this.activated=!0,this.documentListeners.add(kl.Click,Fct,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(kl.SelectionChange,this.removeTextSelection),r(t))}handleMove(t){var r;const{activated:s,initialCoordinates:a,props:i}=this,{onMove:o,options:{activationConstraint:l}}=i;if(!a)return;const c=(r=TP(t))!=null?r:Ec,d=my(a,c);if(!s&&l){if(Pz(l)){if(l.tolerance!=null&&d4(d,l.tolerance))return this.handleCancel();if(d4(d,l.distance))return this.handleStart()}if(Iz(l)&&d4(d,l.tolerance))return this.handleCancel();this.handlePending(l,d);return}t.cancelable&&t.preventDefault(),o(c)}handleEnd(){const{onAbort:t,onEnd:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleCancel(){const{onAbort:t,onCancel:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleKeydown(t){t.code===rn.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Dct={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class H6 extends Q6{constructor(t){const{event:r}=t,s=B0(r.target);super(t,Dct,s)}}H6.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:s}=t;return!r.isPrimary||r.button!==0?!1:(s==null||s({event:r}),!0)}}];const Rct={move:{name:"mousemove"},end:{name:"mouseup"}};var IP;(function(e){e[e.RightClick=2]="RightClick"})(IP||(IP={}));class Uct extends Q6{constructor(t){super(t,Rct,B0(t.event.target))}}Uct.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:s}=t;return r.button===IP.RightClick?!1:(s==null||s({event:r}),!0)}}];const u4={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Mct extends Q6{constructor(t){super(t,u4)}static setup(){return window.addEventListener(u4.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(u4.move.name,t)};function t(){}}}Mct.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:s}=t;const{touches:a}=r;return a.length>1?!1:(s==null||s({event:r}),!0)}}];var Ov;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Ov||(Ov={}));var h_;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(h_||(h_={}));function $ct(e){let{acceleration:t,activator:r=Ov.Pointer,canScroll:s,draggingRect:a,enabled:i,interval:o=5,order:l=h_.TreeOrder,pointerCoordinates:c,scrollableAncestors:d,scrollableAncestorRects:u,delta:h,threshold:m}=e;const f=Hct({delta:h,disabled:!i}),[p,A]=ect(),v=g.useRef({x:0,y:0}),x=g.useRef({x:0,y:0}),b=g.useMemo(()=>{switch(r){case Ov.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case Ov.DraggableRect:return a}},[r,a,c]),y=g.useRef(null),w=g.useCallback(()=>{const N=y.current;if(!N)return;const _=v.current.x*x.current.x,S=v.current.y*x.current.y;N.scrollBy(_,S)},[]),j=g.useMemo(()=>l===h_.TreeOrder?[...d].reverse():d,[l,d]);g.useEffect(()=>{if(!i||!d.length||!b){A();return}for(const N of j){if((s==null?void 0:s(N))===!1)continue;const _=d.indexOf(N),S=u[_];
1622if(!S)continue;const{direction:C,speed:E}=kct(N,S,b,t,m);for(const T of["x","y"])f[T][C[T]]||(E[T]=0,C[T]=0);if(E.x>0||E.y>0){A(),y.current=N,p(w,o),v.current=E,x.current=C;return}}v.current={x:0,y:0},x.current={x:0,y:0},A()},[t,w,s,A,i,o,JSON.stringify(b),JSON.stringify(f),p,d,j,u,JSON.stringify(m)])}const Qct={x:{[Ga.Backward]:!1,[Ga.Forward]:!1},y:{[Ga.Backward]:!1,[Ga.Forward]:!1}};function Hct(e){let{delta:t,disabled:r}=e;const s=BP(t);return tw(a=>{if(r||!s||!a)return Qct;const i={x:Math.sign(t.x-s.x),y:Math.sign(t.y-s.y)};return{x:{[Ga.Backward]:a.x[Ga.Backward]||i.x===-1,[Ga.Forward]:a.x[Ga.Forward]||i.x===1},y:{[Ga.Backward]:a.y[Ga.Backward]||i.y===-1,[Ga.Forward]:a.y[Ga.Forward]||i.y===1}}},[r,t,s])}function zct(e,t){const r=t!=null?e.get(t):void 0,s=r?r.node.current:null;return tw(a=>{var i;return t==null?null:(i=s??a)!=null?i:null},[s,t])}function Vct(e,t){return g.useMemo(()=>e.reduce((r,s)=>{const{sensor:a}=s,i=a.activators.map(o=>({eventName:o.eventName,handler:t(o.handler,s)}));return[...r,...i]},[]),[e,t])}var Ay;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Ay||(Ay={}));var OP;(function(e){e.Optimized="optimized"})(OP||(OP={}));const Oz=new Map;function Gct(e,t){let{dragging:r,dependencies:s,config:a}=t;const[i,o]=g.useState(null),{frequency:l,measure:c,strategy:d}=a,u=g.useRef(e),h=v(),m=fy(h),f=g.useCallback(function(x){x===void 0&&(x=[]),!m.current&&o(b=>b===null?x:b.concat(x.filter(y=>!b.includes(y))))},[m]),p=g.useRef(null),A=tw(x=>{if(h&&!r)return Oz;if(!x||x===Oz||u.current!==e||i!=null){const b=new Map;for(let y of e){if(!y)continue;if(i&&i.length>0&&!i.includes(y.id)&&y.rect.current){b.set(y.id,y.rect.current);continue}const w=y.node.current,j=w?new M6(c(w),w):null;y.rect.current=j,j&&b.set(y.id,j)}return b}return x},[e,i,r,h,c]);return g.useEffect(()=>{u.current=e},[e]),g.useEffect(()=>{h||f()},[r,h]),g.useEffect(()=>{i&&i.length>0&&o(null)},[JSON.stringify(i)]),g.useEffect(()=>{h||typeof l!="number"||p.current!==null||(p.current=setTimeout(()=>{f(),p.current=null},l))},[l,h,f,...s]),{droppableRects:A,measureDroppableContainers:f,measuringScheduled:i!=null};function v(){switch(d){case Ay.Always:return!1;case Ay.BeforeDragging:return r;default:return!r}}}function Uae(e,t){return tw(r=>e?r||(typeof t=="function"?t(e):e):null,[t,e])}function qct(e,t){return Uae(e,t)}function Kct(e){let{callback:t,disabled:r}=e;const s=R6(t),a=g.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(s)},[s,r]);return g.useEffect(()=>()=>a==null?void 0:a.disconnect(),[a]),a}function ik(e){let{callback:t,disabled:r}=e;const s=R6(t),a=g.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(s)},[r]);return g.useEffect(()=>()=>a==null?void 0:a.disconnect(),[a]),a}function Wct(e){return new M6(T0(e),e)}function Fz(e,t,r){t===void 0&&(t=Wct);const[s,a]=g.useState(null);function i(){a(c=>{if(!e)return null;if(e.isConnected===!1){var d;return(d=c??r)!=null?d:null}const u=t(e);return JSON.stringify(c)===JSON.stringify(u)?c:u})}const o=Kct({callback(c){if(e)for(const d of c){const{type:u,target:h}=d;if(u==="childList"&&h instanceof HTMLElement&&h.contains(e)){i();break}}}}),l=ik({callback:i});return vd(()=>{i(),e?(l==null||l.observe(e),o==null||o.observe(document.body,{childList:!0,subtree:!0})):(l==null||l.disconnect(),o==null||o.disconnect())},[e]),s}function Yct(e){const t=Uae(e);return Tae(e,t)}const Lz=[];function Jct(e){const t=g.useRef(e),r=tw(s=>e?s&&s!==Lz&&e&&t.current&&e.parentNode===t.current.parentNode?s:ak(e):Lz,[e]);return g.useEffect(()=>{t.current=e},[e]),r}function Xct(e){const[t,r]=g.useState(null),s=g.useRef(e),a=g.useCallback(i=>{const o=c4(i.target);o&&r(l=>l?(l.set(o,PP(o)),new Map(l)):null)},[]);return g.useEffect(()=>{const i=s.current;if(e!==i){o(i);const l=e.map(c=>{const d=c4(c);return d?(d.addEventListener("scroll",a,{passive:!0}),[d,PP(d)]):null}).filter(c=>c!=null);r(l.length?new Map(l):null),s.current=e}return()=>{o(e),o(i)};function o(l){l.forEach(c=>{const d=c4(c);d==null||d.removeEventListener("scroll",a)})}},[a,e]),g.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,o)=>zA(i,o),Ec):Dae(e):Ec,[e,t])}function Dz(e,t){t===void 0&&(t=[]);const r=g.useRef(null);return g.useEffect(()=>{r.current=null},t),g.useEffect(()=>{const s=e!==Ec;s&&!r.current&&(r.current=e),!s&&r.current&&(r.current=null)},[e]),r.current?my(e,r.current):Ec}function Zct(e){g.useEffect(()=>{if(!sk)return;const t=e.map(r=>{let{sensor:s}=r;return s.setup==null?void 0:s.setup()});return()=>{for(const r of t)r==null||r()}},e.map(t=>{let{sensor:r}=t;return r}))}function edt(e,t){return g.useMemo(()=>e.reduce((r,s)=>{let{eventName:a,handler:i}=s;return r[a]=o=>{i(o,t)},r},{}),[e,t])}function Mae(e){return g.useMemo(()=>e?Nct(e):null,[e])}const Rz=[];function tdt(e,t){t===void 0&&(t=T0);const[r]=e,s=Mae(r?yo(r):null),[a,i]=g.useState(Rz);function o(){i(()=>e.length?e.map(c=>Fae(c)?s:new M6(t(c),c)):Rz)}const l=ik({callback:o});return vd(()=>{l==null||l.disconnect(),o(),e.forEach(c=>l==null?void 0:l.observe(c))},[e]),a}function rdt(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return ew(t)?t:e}
1622function ndt(e){let{measure:t}=e;const[r,s]=g.useState(null),a=g.useCallback(d=>{for(const{target:u}of d)if(ew(u)){s(h=>{const m=t(u);return h?{...h,width:m.width,height:m.height}:m});break}},[t]),i=ik({callback:a}),o=g.useCallback(d=>{const u=rdt(d);i==null||i.disconnect(),u&&(i==null||i.observe(u)),s(u?t(u):null)},[t,i]),[l,c]=d_(o);return g.useMemo(()=>({nodeRef:l,rect:r,setRef:c}),[r,l,c])}const sdt=[{sensor:H6,options:{}},{sensor:$6,options:{}}],adt={current:{}},zj={draggable:{measure:Bz},droppable:{measure:Bz,strategy:Ay.WhileDragging,frequency:OP.Optimized},dragOverlay:{measure:T0}};class Fv extends Map{get(t){var r;return t!=null&&(r=super.get(t))!=null?r:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:r}=t;return!r})}getNodeFor(t){var r,s;return(r=(s=this.get(t))==null?void 0:s.node.current)!=null?r:void 0}}const idt={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Fv,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:u_},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:zj,measureDroppableContainers:u_,windowRect:null,measuringScheduled:!1},odt={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:u_,draggableNodes:new Map,over:null,measureDroppableContainers:u_},ok=g.createContext(odt),$ae=g.createContext(idt);function ldt(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Fv}}}function cdt(e,t){switch(t.type){case Oa.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Oa.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case Oa.DragEnd:case Oa.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Oa.RegisterDroppable:{const{element:r}=t,{id:s}=r,a=new Fv(e.droppable.containers);return a.set(s,r),{...e,droppable:{...e.droppable,containers:a}}}case Oa.SetDroppableDisabled:{const{id:r,key:s,disabled:a}=t,i=e.droppable.containers.get(r);if(!i||s!==i.key)return e;const o=new Fv(e.droppable.containers);return o.set(r,{...i,disabled:a}),{...e,droppable:{...e.droppable,containers:o}}}case Oa.UnregisterDroppable:{const{id:r,key:s}=t,a=e.droppable.containers.get(r);if(!a||s!==a.key)return e;const i=new Fv(e.droppable.containers);return i.delete(r),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function ddt(e){let{disabled:t}=e;const{active:r,activatorEvent:s,draggableNodes:a}=g.useContext(ok),i=BP(s),o=BP(r==null?void 0:r.id);return g.useEffect(()=>{if(!t&&!s&&i&&o!=null){if(!U6(i)||document.activeElement===i.target)return;const l=a.get(o);if(!l)return;const{activatorNode:c,node:d}=l;if(!c.current&&!d.current)return;requestAnimationFrame(()=>{for(const u of[c.current,d.current]){if(!u)continue;const h=nct(u);if(h){h.focus();break}}})}},[s,t,a,o,i]),null}function udt(e,t){let{transform:r,...s}=t;return e!=null&&e.length?e.reduce((a,i)=>i({transform:a,...s}),r):r}function hdt(e){return g.useMemo(()=>({draggable:{...zj.draggable,...e==null?void 0:e.draggable},droppable:{...zj.droppable,...e==null?void 0:e.droppable},dragOverlay:{...zj.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function fdt(e){let{activeNode:t,measure:r,initialRect:s,config:a=!0}=e;const i=g.useRef(!1),{x:o,y:l}=typeof a=="boolean"?{x:a,y:a}:a;vd(()=>{if(!o&&!l||!t){i.current=!1;return}if(i.current||!s)return;const d=t==null?void 0:t.node.current;if(!d||d.isConnected===!1)return;const u=r(d),h=Tae(u,s);if(o||(h.x=0),l||(h.y=0),i.current=!0,Math.abs(h.x)>0||Math.abs(h.y)>0){const m=Pae(d);m&&m.scrollBy({top:h.y,left:h.x})}},[t,o,l,s,r])}const Qae=g.createContext({...Ec,scaleX:1,scaleY:1}
1622);var xh;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(xh||(xh={}));const Uz=g.memo(function(t){var r,s,a,i;let{id:o,accessibility:l,autoScroll:c=!0,children:d,sensors:u=sdt,collisionDetection:h=gct,measuring:m,modifiers:f,...p}=t;const A=g.useReducer(cdt,void 0,ldt),[v,x]=A,[b,y]=cct(),[w,j]=g.useState(xh.Uninitialized),N=w===xh.Initialized,{draggable:{active:_,nodes:S,translate:C},droppable:{containers:E}}=v,T=_!=null?S.get(_):null,B=g.useRef({initial:null,translated:null}),L=g.useMemo(()=>{var It;return _!=null?{id:_,data:(It=T==null?void 0:T.data)!=null?It:adt,rect:B}:null},[_,T]),P=g.useRef(null),[F,M]=g.useState(null),[I,$]=g.useState(null),V=fy(p,Object.values(p)),R=rw("DndDescribedBy",o),Q=g.useMemo(()=>E.getEnabled(),[E]),U=hdt(m),{droppableRects:D,measureDroppableContainers:q,measuringScheduled:G}=Gct(Q,{dragging:N,dependencies:[C.x,C.y],config:U.droppable}),Y=zct(S,_),K=g.useMemo(()=>I?TP(I):null,[I]),X=an(),ne=qct(Y,U.draggable.measure);fdt({activeNode:_!=null?S.get(_):null,config:X.layoutShiftCompensation,initialRect:ne,measure:U.draggable.measure});const ae=Fz(Y,U.draggable.measure,ne),J=Fz(Y?Y.parentElement:null),W=g.useRef({activatorEvent:null,active:null,activeNode:Y,collisionRect:null,collisions:null,droppableRects:D,draggableNodes:S,draggingNode:null,draggingNodeRect:null,droppableContainers:E,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ie=E.getNodeFor((r=W.current.over)==null?void 0:r.id),he=ndt({measure:U.dragOverlay.measure}),ee=(s=he.nodeRef.current)!=null?s:Y,xe=N?(a=he.rect)!=null?a:ae:null,we=!!(he.nodeRef.current&&he.rect),Se=Yct(we?null:ae),pe=Mae(ee?yo(ee):null),Ce=Jct(N?ie??Y:null),re=tdt(Ce),se=udt(f,{transform:{x:C.x-Se.x,y:C.y-Se.y,scaleX:1,scaleY:1},activatorEvent:I,active:L,activeNodeRect:ae,containerNodeRect:J,draggingNodeRect:xe,over:W.current.over,overlayNodeRect:he.rect,scrollableAncestors:Ce,scrollableAncestorRects:re,windowRect:pe}),Ae=K?zA(K,C):null,Pe=Xct(Ce),Oe=Dz(Pe),be=Dz(Pe,[ae]),ue=zA(se,Oe),Ee=xe?bct(xe,se):null,De=L&&Ee?h({active:L,collisionRect:Ee,droppableRects:D,droppableContainers:Q,pointerCoordinates:Ae}):null,Ge=Bae(De,"id"),[Ye,Tt]=g.useState(null),Nt=we?se:zA(se,be),Pt=xct(Nt,(i=Ye==null?void 0:Ye.re
1622ct)!=null?i:null,ae),_t=g.useRef(null),zt=g.useCallback((It,ht)=>{let{sensor:ar,options:tt}=ht;if(P.current==null)return;const it=S.get(P.current);if(!it)return;const gt=It.nativeEvent,pr=new ar({active:P.current,activeNode:it,event:gt,options:tt,context:W,onAbort(Lr){if(!S.get(Lr))return;const{onDragAbort:qr}=V.current,pn={id:Lr};qr==null||qr(pn),b({type:"onDragAbort",event:pn})},onPending(Lr,En,qr,pn){if(!S.get(Lr))return;const{onDragPending:As}=V.current,Yn={id:Lr,constraint:En,initialCoordinates:qr,offset:pn};As==null||As(Yn),b({type:"onDragPending",event:Yn})},onStart(Lr){const En=P.current;if(En==null)return;const qr=S.get(En);if(!qr)return;const{onDragStart:pn}=V.current,Ln={activatorEvent:gt,active:{id:En,data:qr.data,rect:B}};rd.unstable_batchedUpdates(()=>{pn==null||pn(Ln),j(xh.Initializing),x({type:Oa.DragStart,initialCoordinates:Lr,active:En}),b({type:"onDragStart",event:Ln}),M(_t.current),$(gt)})},onMove(Lr){x({type:Oa.DragMove,coordinates:Lr})},onEnd:xt(Oa.DragEnd),onCancel:xt(Oa.DragCancel)});_t.current=pr;function xt(Lr){return async function(){const{active:qr,collisions:pn,over:Ln,scrollAdjustedTranslate:As}=W.current;let Yn=null;if(qr&&As){const{cancelDrop:jo}=V.current;Yn={activatorEvent:gt,active:qr,collisions:pn,delta:As,over:Ln},Lr===Oa.DragEnd&&typeof jo=="function"&&await Promise.resolve(jo(Yn))&&(Lr=Oa.DragCancel)}P.current=null,rd.unstable_batchedUpdates(()=>{x({type:Lr}),j(xh.Uninitialized),Tt(null),M(null),$(null),_t.current=null;const jo=Lr===Oa.DragEnd?"onDragEnd":"onDragCancel";if(Yn){const ul=V.current[jo];ul==null||ul(Yn),b({type:jo,event:Yn})}})}}},[S]),vt=g.useCallback((It,ht)=>(ar,tt)=>{const it=ar.nativeEvent,gt=S.get(tt);if(P.current!==null||!gt||it.dndKit||it.defaultPrevented)return;const pr={active:gt};It(ar,ht.options,pr)===!0&&(it.dndKit={capturedBy:ht.sensor},P.current=tt,zt(ar,ht))},[S,zt]),vr=Vct(u,vt);Zct(u),vd(()=>{ae&&w===xh.Initializing&&j(xh.Initialized)},[ae,w]),g.useEffect(()=>{const{onDragMove:It}=V.current,{active:ht,activatorEvent:ar,collisions:tt,over:it}=W.current;if(!ht||!ar)return;const gt={active:ht,activatorEvent:ar,collisions:tt,delta:{x:ue.x,y:ue.y},over:it};rd.unstable_batchedUpdates(()=>{It==null||It(gt),b({type:"onDragMove",event:gt})})},[ue.x,ue.y]),g.useEffect(()=>{const{active:It,activatorEvent:ht,collisions:ar,droppableContainers:tt,scrollAdjustedTranslate:it}=W.current;if(!It||P.current==null||!ht||!it)return;const{onDragOver:gt}=V.current,pr=tt.get(Ge),xt=pr&&pr.rect.current?{id:pr.id,rect:pr.rect.current,data:pr.data,disabled:pr.disabled}:null,Lr={active:It,activatorEvent:ht,collisions:ar,delta:{x:it.x,y:it.y},over:xt};rd.unstable_batchedUpdates(()=>{Tt(xt),gt==null||gt(Lr),b({type:"onDragOver",event:Lr})})},[Ge]),vd(()=>{W.current={activatorEvent:I,active:L,activeNode:Y,collisionRect:Ee,collisions:De,droppableRects:D,draggableNodes:S,draggingNode:ee,draggingNodeRect:xe,droppableContainers:E,over:Ye,scrollableAncestors:Ce,scrollAdjustedTranslate:ue},B.current={initial:xe,translated:Ee}},[L,Y,De,Ee,S,ee,xe,D,E,Ye,Ce,ue]),$ct({...X,delta:C,draggingRect:Ee,pointerCoordinates:Ae,scrollableAncestors:Ce,scrollableAncestorRects:re});const Rt=g.useMemo(()=>({active:L,activeNode:Y,activeNodeRect:ae,activatorEvent:I,collisions:De,containerNodeRect:J,dragOverlay:he,draggableNodes:S,droppableContainers:E,droppableRects:D,over:Ye,measureDroppableContainers:q,scrollableAncestors:Ce,scrollableAncestorRects:re,measuringConfiguration:U,measuringScheduled:G,windowRect:pe}),[L,Y,ae,I,De,J,he,S,E,D,Ye,q,Ce,re,U,G,pe]),rr=g.useMemo(()=>({activatorEvent:I,activators:vr,active:L,activeNodeRect:ae,ariaDescribedById:{draggable:R},dispatch:x,draggableNodes:S,over:Ye,measureDroppableContainers:q}),[I,vr,L,ae,x,R,S,Ye,q]);return oe.createElement(Sae.Provider,{value:y},oe.createElement(ok.Provider,{value:rr},oe.createElement($ae.Provider,{value:Rt},oe.createElement(Qae.Provider,{value:Pt},d)),oe.createElement(ddt,{disabled:(l==null?void 0:l.restoreFocus)===!1})),oe.createElement(hct,{...l,hiddenTextDescribedById:R}));function an(){const It=(F==null?void 0:F.autoScrollEnabled)===!1,ht=typeof c=="object"?c.enabled===!1:c===!1,ar=N&&!It&&!ht;return typeof c=="object"?{...c,enabled:ar}:{enabled:ar}}}),mdt=g.createContext(null),Mz="button",pdt="Draggable";function Adt(e){let{id:t,data:r,disabled:s=!1,attributes:a}=e;const i=rw(pdt),{activators:o,activatorEvent:l,active:c,activeNodeRect:d,ariaDescribedById:u,draggableNodes:h,over:m}=g.useContext(ok),{role:f=Mz,roleDescription:p="draggable",tabIndex:A=0}=a??{},v=(c==null?void 0:c.id)===t,x=g.useContext(v?Qae:mdt),[b,y]=d_(),[w,j]=d_(),N=edt(o,t),_=fy(r);vd(()=>(h.set(t,{id:t,key:i,node:b,activatorNode:w,data:_}),()=>{const C=h.get(t);C&&C.key===i&&h.delete(t)}),[h,t]);const S=g.useMemo(()=>({role:f,tabIndex:A,"aria-disabled":s,"aria-pressed":v&&f===Mz?!0:void 0,"aria-roledescription":p,"aria-describedby":u.draggable}),[s,f,A,v,p,u.draggable]);return{active:c,activatorEvent:l,activeNodeRect:d,attributes:S,isDragging:v,listeners:s?void 0:N,node:b,over:m,setNodeRef:y,setActivatorNodeRef:j,transform:x}}function gdt(){return g.useContext($ae)}const xdt="Droppable",vdt={timeout:25};function bdt(e){let{data:t,disabled:r=!1,id:s,resizeObserverConfig:a}=e;const i=rw(xdt),{active:o,dispatch:l,over:c,measureDroppableContainers:d}=g.useContext(ok),u=g.useRef({disabled:r}),h=g.useRef(!1),m=g.useRef(null),f=g.useRef(null),{disabled:p,updateMeasurementsFor:A,timeout:v}={...vdt,...a},x=fy(A??s),b=g.useCallback(()=>
1622{if(!h.current){h.current=!0;return}f.current!=null&&clearTimeout(f.current),f.current=setTimeout(()=>{d(Array.isArray(x.current)?x.current:[x.current]),f.current=null},v)},[v]),y=ik({callback:b,disabled:p||!o}),w=g.useCallback((S,C)=>{y&&(C&&(y.unobserve(C),h.current=!1),S&&y.observe(S))},[y]),[j,N]=d_(w),_=fy(t);return g.useEffect(()=>{!y||!j.current||(y.disconnect(),h.current=!1,y.observe(j.current))},[j,y]),g.useEffect(()=>(l({type:Oa.RegisterDroppable,element:{id:s,key:i,disabled:r,node:j,rect:m,data:_}}),()=>l({type:Oa.UnregisterDroppable,key:i,id:s})),[s]),g.useEffect(()=>{r!==u.current.disabled&&(l({type:Oa.SetDroppableDisabled,id:s,key:i,disabled:r}),u.current.disabled=r)},[s,i,r,l]),{active:o,rect:m,isOver:(c==null?void 0:c.id)===s,node:j,over:c,setNodeRef:N}}function f_(e,t,r){const s=e.slice();return s.splice(r<0?s.length+r:r,0,s.splice(t,1)[0]),s}function ydt(e,t){return e.reduce((r,s,a)=>{const i=t.get(s);return i&&(r[a]=i),r},Array(e.length))}function tj(e){return e!==null&&e>=0}function wdt(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}function jdt(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const Hae=e=>{let{rects:t,activeIndex:r,overIndex:s,index:a}=e;const i=f_(t,s,r),o=t[a],l=i[a];return!l||!o?null:{x:l.left-o.left,y:l.top-o.top,scaleX:l.width/o.width,scaleY:l.height/o.height}},rj={scaleX:1,scaleY:1},$z=e=>{var t;let{activeIndex:r,activeNodeRect:s,index:a,rects:i,overIndex:o}=e;const l=(t=i[r])!=null?t:s;if(!l)return null;if(a===r){const d=i[o];return d?{x:0,y:r<o?d.top+d.height-(l.top+l.height):d.top-l.top,...rj}:null}const c=Ndt(i,a,r);return a>r&&a<=o?{x:0,y:-l.height-c,...rj}:a<r&&a>=o?{x:0,y:l.height+c,...rj}:{x:0,y:0,...rj}};function Ndt(e,t,r){const s=e[t],a=e[t-1],i=e[t+1];return s?r<t?a?s.top-(a.top+a.height):i?i.top-(s.top+s.height):0:i?i.top-(s.top+s.height):a?s.top-(a.top+a.height):0:0}const zae="Sortable",Vae=oe.createContext({activeIndex:-1,containerId:zae,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Hae,disabled:{draggable:!1,droppable:!1}});function Qz(e){let{children:t,id:r,items:s,strategy:a=Hae,disabled:i=!1}=e;const{active:o,dragOverlay:l,droppableRects:c,over:d,measureDroppableContainers:u}=gdt(),h=rw(zae,r),m=l.rect!==null,f=g.useMemo(()=>s.map(N=>typeof N=="object"&&"id"in N?N.id:N),[s]),p=o!=null,A=o?f.indexOf(o.id):-1,v=d?f.indexOf(d.id):-1,x=g.useRef(f),b=!wdt(f,x.current),y=v!==-1&&A===-1||b,w=jdt(i);vd(()=>{b&&p&&u(f)},[b,f,p,u]),g.useEffect(()=>{x.current=f},[f]);const j=g.useMemo(()=>({activeIndex:A,containerId:h,disabled:w,disableTransforms:y,items:f,overIndex:v,useDragOverlay:m,sortedRects:ydt(f,c),strategy:a}),[A,h,w.draggable,w.droppable,y,f,v,c,m,a]);return oe.createElement(Vae.Provider,{value:j},t)}const _dt=e=>{let{id:t,items:r,activeIndex:s,overIndex:a}=e;return f_(r,s,a).indexOf(t)},Cdt=e=>{let{containerId:t,isSorting:r,wasDragging:s,index:a,items:i,newIndex:o,previousItems:l,previousContainerId:c,transition:d}=e;return!d||!s||l!==i&&a===o?!1:r?!0:o!==a&&t===c},Sdt={duration:200,easing:"ease"},Gae="transform",kdt=py.Transition.toString({property:Gae,duration:0,easing:"linear"}),Edt={roleDescription:"sortable"};function Bdt(e){let{disabled:t,index:r,node:s,rect:a}=e;const[i,o]=g.useState(null),l=g.useRef(r);return vd(()=>{if(!t&&r!==l.current&&s.current){const c=a.current;if(c){const d=T0(s.current,{ignoreTransform:!0}),u={x:c.left-d.left,y:c.top-d.top,scaleX:c.width/d.width,scaleY:c.height/d.height};(u.x||u.y)&&o(u)}}r!==l.current&&(l.current=r)},[t,r,s,a]),g.useEffect(()=>{i&&o(null)},[i]),i}function Tdt(e){let{animateLayoutChanges:t=Cdt,attributes:r,disabled:s,data:a,getNewIndex:i=_dt,id:o,strategy:l,resizeObserverConfig:c,transition:d=Sdt}=e;const{items:u,containerId:h,activeIndex:m,disabled:f,disableTransforms:p,sortedRects:A,overIndex:v,useDragOverlay:x,strategy:b}=g.useContext(Vae),y=Pdt(s,f),w=u.indexOf(o),j=g.useMemo(()=>({sortable:{containerId:h,index:w,items:u},...a}),[h,a,w,u]),N=g.useMemo(()=>u.slice(u.indexOf(o)),[u,o]),{rect:_,node:S,isOver:C,setNodeRef:E}=bdt({id:o,data:j,disabled:y.droppable,resizeObserverConfig:{updateMeasurementsFor:N,...c}}),{active:T,activatorEvent:B,activeNodeRect:L,attributes:P,setNodeRef:F,listeners:M,isDragging:I,over:$,setActivatorNodeRef:V,transform:R}=Adt({id:o,data:j,attributes:{...Edt,...r},disabled:y.draggable}),Q=Zlt(E,F),U=!!T,D=U&&!p&&tj(m)&&tj(v),q=!x&&I,G=q&&D?R:null,K=D?G??(l??b)({rects:A,activeNodeRect:L,activeIndex:m,overIndex:v,index:w}):null,X=tj(m)&&tj(v)?i({id:o,items:u,activeIndex:m,overIndex:v}):w,ne=T==null?void 0:T.id,ae=g.useRef({activeId:ne,items:u,newIndex:X,containerId:h}),J=u!==ae.current.items,W=t({active:T,containerId:h,isDragging:I,isSorting:U,id:o,index:w,items:u,newIndex:ae.current.newIndex,previousItems:ae.current.items,previousContainerId:ae.current.containerId,transition:d,wasDragging:ae.current.activeId!=null}),ie=Bdt({disabled:!W,index:w,node:S,rect:_});return g.useEffect(()=>{U&&ae.current.newIndex!==X&&(ae.current.newIndex=X),h!==ae.current.containerId&&(ae.current.containerId=h),u!==ae.current.items&&(ae.current.items=u)},[U,X,h,u]),g.useEffect(()=>{if(ne===ae.current.activeId)return;if(ne!=null&&ae.current.activeId==null){ae.current.activeId=ne;return}const ee=setTimeout(()=>{ae.current.activeId=ne},50);return()=>clearTimeout(ee)}
1622,[ne]),{active:T,activeIndex:m,attributes:P,data:j,rect:_,index:w,newIndex:X,items:u,isOver:C,isSorting:U,isDragging:I,listeners:M,node:S,overIndex:v,over:$,setNodeRef:Q,setActivatorNodeRef:V,setDroppableNodeRef:E,setDraggableNodeRef:F,transform:ie??K,transition:he()};function he(){if(ie||J&&ae.current.newIndex===w)return kdt;if(!(q&&!U6(B)||!d)&&(U||W))return py.Transition.toString({...d,property:Gae})}}function Pdt(e,t){var r,s;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(r=e==null?void 0:e.draggable)!=null?r:t.draggable,droppable:(s=e==null?void 0:e.droppable)!=null?s:t.droppable}}function m_(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const Idt=[rn.Down,rn.Right,rn.Up,rn.Left],Odt=(e,t)=>{let{context:{active:r,collisionRect:s,droppableRects:a,droppableContainers:i,over:o,scrollableAncestors:l}}=t;if(Idt.includes(e.code)){if(e.preventDefault(),!r||!s)return;const c=[];i.getEnabled().forEach(h=>{if(!h||h!=null&&h.disabled)return;const m=a.get(h.id);if(m)switch(e.code){case rn.Down:s.top<m.top&&c.push(h);break;case rn.Up:s.top>m.top&&c.push(h);break;case rn.Left:s.left>m.left&&c.push(h);break;case rn.Right:s.left<m.left&&c.push(h);break}});const d=pct({collisionRect:s,droppableRects:a,droppableContainers:c});let u=Bae(d,"id");if(u===(o==null?void 0:o.id)&&d.length>1&&(u=d[1].id),u!=null){const h=i.get(r.id),m=i.get(u),f=m?a.get(m.id):null,p=m==null?void 0:m.node.current;if(p&&f&&h&&m){const v=ak(p).some((N,_)=>l[_]!==N),x=qae(h,m),b=Fdt(h,m),y=v||!x?{x:0,y:0}:{x:b?s.width-f.width:0,y:b?s.height-f.height:0},w={x:f.left,y:f.top};return y.x&&y.y?w:my(w,y)}}}};function qae(e,t){return!m_(e)||!m_(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function Fdt(e,t){return!m_(e)||!m_(t)||!qae(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}const Hz=({id:e,step:t,enabled:r,onToggle:s,disabled:a=!1,type:i})=>{const{attributes:o,listeners:l,setNodeRef:c,transform:d,transition:u,isDragging:h}=Tdt({id:e}),m={transform:py.Transform.toString(d),transition:u},f=v=>{switch(v){case"SEARCH_EXISTING":return n.jsx(Ns,{className:"h-4 w-4"});case"AI_GENERATE":return n.jsx(gu,{className:"h-4 w-4"});case"STOCK_SEARCH":return n.jsx(gd,{className:"h-4 w-4"});case"STOP_AND_UPLOAD":return n.jsx(Y_,{className:"h-4 w-4"});default:return n.jsx("div",{className:"h-4 w-4 rounded bg-gray-300"})}},p=v=>v.replace(/_/g," ").toLowerCase().replace(/\b\w/g,x=>x.toUpperCase()),A=(v,x)=>{const b={image:{SEARCH_EXISTING:1,STOCK_SEARCH:10,AI_GENERATE:100,STOP_AND_UPLOAD:0},video:{SEARCH_EXISTING:1,STOCK_SEARCH:100,AI_GENERATE:900,STOP_AND_UPLOAD:0}};switch(v){case"SEARCH_EXISTING":return n.jsxs("div",{className:"flex flex-col",children:[n.jsx("span",{children:"Search through existing brand assets"}),n.jsxs("span",{className:"text-purple-600 font-medium",children:[b[x][v]," credits"]})]});case"AI_GENERATE":return n.jsxs("div",{className:"flex flex-col",children:[n.jsx("span",{children:"Generate new content using AI"}),n.jsxs("span",{className:"text-purple-600 font-medium",children:[b[x][v]," credits"]})]});case"STOCK_SEARCH":return n.jsxs("div",{className:"flex flex-col",children:[n.jsx("span",{children:"Search stock photo/video libraries"}),n.jsxs("span",{className:"text-purple-600 font-medium",children:[b[x][v]," credits"]})]});case"STOP_AND_UPLOAD":return n.jsxs("div",{className:"flex flex-col",children:[n.jsx("span",{children:"Stop and prompt user to upload manually"}),n.jsxs("span",{className:"text-purple-600 font-medium",children:[b[x][v]," credits"]})]});default:return""}};return n.jsxs("div",{ref:c,style:m,className:ye("group relative overflow-hidden flex items-center justify-between p-4 bg-gradient-to-br from-white via-blue-50/20 to-white border border-blue-200/50 rounded-xl shadow-lg hover:shadow-xl transition-all duration-300 transform hover:-translate-y-1 hover:scale-[1.02] backdrop-blur-sm",h&&"shadow-2xl ring-2 ring-gradient-to-r ring-from-blue-400 ring-to-indigo-500 ring-opacity-60 scale-105 bg-gradient-to-br from-blue-50 to-indigo-50",!r&&"opacity-60 grayscale",a&&"cursor-not-allowed",r&&"hover:from-blue-50/60 hover:to-indigo-50/40"),children:[n.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[n.jsx("div",{className:"absolute top-0 right-0 w-16 h-16 bg-gradient-to-br from-blue-200/20 to-transparent roun
1622ded-full -translate-y-8 translate-x-8"}),n.jsx("button",{type:"button",className:ye("relative touch-none p-2 text-gray-400 hover:text-blue-600 cursor-grab active:cursor-grabbing rounded-lg hover:bg-blue-50/50 transition-all duration-200 group-hover:scale-110",a&&"cursor-not-allowed opacity-50"),...o,...l,disabled:a,children:n.jsx(jK,{className:"h-5 w-5"})}),n.jsx("div",{className:"relative p-2 rounded-lg bg-gradient-to-br from-blue-100/60 to-indigo-100/60 text-blue-700 group-hover:from-blue-200/60 group-hover:to-indigo-200/60 transition-all duration-300",children:f(t)}),n.jsxs("div",{className:"relative flex-1",children:[n.jsx("div",{className:"font-bold text-base bg-gradient-to-r from-gray-800 to-gray-700 bg-clip-text text-transparent group-hover:from-blue-800 group-hover:to-indigo-700 transition-all duration-300",children:p(t)}),n.jsx("div",{className:"text-sm text-gray-600 mt-1 group-hover:text-gray-700 transition-colors duration-200",children:A(t,i)})]})]}),n.jsx("div",{className:"flex items-center gap-2",children:n.jsx("div",{className:"relative",children:n.jsx("input",{type:"checkbox",checked:r,onChange:v=>s(t,v.target.checked),disabled:a,className:"relative w-5 h-5 rounded-md border-2 border-blue-300 text-blue-600 focus:ring-2 focus:ring-blue-500 focus:ring-offset-1 transition-all duration-200 hover:border-blue-400 checked:bg-gradient-to-r checked:from-blue-500 checked:to-indigo-600 checked:border-transparent checked:shadow-lg checked:shadow-blue-200/50"})})})]})},Ldt=({platform:e,platformSettings:t,savePlatformSettings:r,isConnected:s,brandId:a})=>{var I,$,V,R;const{timezone:i,formatTime:o,isLoading:l}=Gl(),c=xr(),d=t[e.id]||{autopost_enabled:!1,autogenerate_enabled:!1,posting_frequency:"WEEKLY",preferred_time:"09:00",preferred_days:["MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY","SUNDAY"],status:"DISCONNECTED",connection_details:null,config:{image:{enabled:!0,steps:["SEARCH_EXISTING","AI_GENERATE","STOCK_SEARCH","STOP_AND_UPLOAD"]},video:{enabled:!1,steps:["SEARCH_EXISTING","STOP_AND_UPLOAD","AI_GENERATE","STOCK_SEARCH"]}}},u=g.useMemo(()=>{if(!d.preferred_time)return"09:00";if(l)return d.preferred_time;try{const[Q,U]=d.preferred_time.split(":").map(Number),D=new Date;return new Date(Date.UTC(D.getUTCFullYear(),D.getUTCMonth(),D.getUTCDate(),Q,U,0,0)).toLocaleTimeString("en-US",{timeZone:i,hour12:!1,hour:"2-digit",minute:"2-digit"})}catch(Q){return console.error("Error converting display time:",Q),"09:00"}},[d.preferred_time,i,l]),[h,m]=g.useState({autopost_enabled:d.autopost_enabled||!1,autogenerate_enabled:d.autogenerate_enabled||!1,posting_frequency:d.posting_frequency||"WEEKLY",preferred_time:u,preferred_days:d.preferred_days||["MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY","SUNDAY"],config:d.config||{image:{enabled:!0,steps:["SEARCH_EXISTING","AI_GENERATE","STOCK_SEARCH","STOP_AND_UPLOAD"]},video:{enabled:!1,steps:["SEARCH_EXISTING","STOP_AND_UPLOAD","AI_GENERATE","STOCK_SEARCH"]}}});g.useEffect(()=>{m(Q=>({...Q,preferred_time:u}))},[u]),g.useEffect(()=>{const Q=d.preferred_days||["MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY","SUNDAY"];m(U=>({...U,autopost_enabled:d.autopost_enabled||!1,autogenerate_enabled:d.autogenerate_enabled||!1,posting_frequency:d.posting_frequency||"WEEKLY",preferred_days:Q,config:d.config||{image:{enabled:!0,steps:["SEARCH_EXISTING","AI_GENERATE","STOCK_SEARCH","STOP_AND_UPLOAD"]},video:{enabled:!1,steps:["SEARCH_EXISTING","STOP_AND_UPLOAD","AI_GENERATE","STOCK_SEARCH"]}}}))},[d]);const[f,p]=g.useState(!1),A=["SEARCH_EXISTING","AI_GENERATE","STOCK_SEARCH","STOP_AND_UPLOAD"],v=["SEARCH_EXISTING","STOP_AND_UPLOAD","AI_GENERATE","STOCK_SEARCH"],[x,b]=g.useState(A),[y,w]=g.useState(v),j=fct(Cz(H6),Cz($6,{coordinateGetter:Odt})),N=(Q,U)=>{m(Q==="autopost_enabled"&&U===!0?D=>({...D,[Q]:U,autogenerate_enabled:!0}):Q==="autogenerate_enabled"&&U===!1?D=>({...D,[Q]:U,autopost_enabled:!1,config:{...D.config,image:{...D.config.image,enabled:!1},video:{...D.config.video,enabled:!1}}}):D=>({...D,[Q]:U}))},_=Q=>{m(U=>({...U,preferred_days:U.preferred_days.includes(Q)?U.preferred_days.filter(D=>D!==Q):[...U.preferred_days,Q]}))},S=Q=>{var Y;const{active:U,over:D}=Q;if(!D||U.id===D.id)return;const q=x.indexOf(U.id),G=x.indexOf(D.id);if(q!==-1&&G!==-1){const K=f_(x,q,G);b(K);const X=((Y=h.config.image)==null?void 0:Y.steps)||[],ne=K.filter(ae=>X.includes(ae));m(ae=>{var J;return{...ae,config:{...ae.config,image:{enabled:((J=ae.config.image)==null?void 0:J.enabled)||!1,steps:ne}}}})}},C=Q=>{var Y;const{active:U,over:D}=Q;if(!D||U.id===D.id)return;const q=y.indexOf(U.id),G=y.indexOf(D.id);if(q!==-1&&G!==-1){const K=f_(y,q,G);w(K);const X=((Y=h.config.video)==null?void 0:Y.steps)||[],ne=K.filter(ae=>X.includes(ae));m(ae=>{var J;return{...ae,config:{...ae.config,video:{enabled:((J=ae.config.video)==null?void 0:J.enabled)||!1,steps:ne}}}})}},E=(Q,U)=>{var G;const D=((G=h.config.image)==null?void 0:G.steps)||[],q=U?[...D,Q]:D.filter(Y=>Y!==Q);m(Y=>{var K;return{...Y,config:{...Y.config,image:{enabled:((K=Y.config.image)==null?void 0:K.enabled)||!1,steps:q}}}})},T=(Q,U)=>{var G;const D=((G=h.config.video)==null?void 0:G.steps)||[],q=U?[...D,Q]:D.filter(Y=>Y!==Q);m(Y=>{var K;return{...Y,config:{...Y.config,video:{enabled:((K=Y.config.video)==null?void 0:K.enabled)||!1,steps:q}}}})},B=async()=>{p(!0);try{const[Q,U]=h.preferred_time.split(":").map(Number),D=new Date,q=D.getFullYear(),G=D.getMonth(),Y=D.getDate();let K=h.preferred_time;e:for(let X=0;X<24;X++)for(let ne=0;ne<60;ne+=5){const J=new Date(Date.UTC(q,G,Y,X,ne,0)).toLocaleTimeString("en-US",{timeZone:i,hour12:!1,hour:"2-digit",minute:"2-digit"}),[W,ie]=J.split(":").map(Number);if(W===Q&&Math.abs(ie-U)<=5){for(let he=Math.max(0,ne-5);he<=Math.min(59,ne+5);he++){const xe=new Date(Date.UTC(q,G,Y,X,he,0)).toLocaleTimeString("en-US",{timeZone:i,hour12:!1,hour:"2-digit",minute:"2-digit"}),[we,Se]=xe.split(":").map(Number);if(we===Q&&Se===U){K=`${String(X).padStart(2,"0")}
1622:${String(he).padStart(2,"0")}`;break e}}K=`${String(X).padStart(2,"0")}:${String(ne).padStart(2,"0")}`;break e}}await r(e.id,{autopost_enabled:h.autopost_enabled,autogenerate_enabled:h.autogenerate_enabled,posting_frequency:h.posting_frequency,preferred_time:K,preferred_days:h.preferred_days,config:h.config}),c(`/brands/${a}/connections`)}catch(Q){console.error("Error saving automation settings:",Q)}finally{p(!1)}},L=()=>{if(l)return"Loading...";try{return o(new Date,!1)}catch{return new Date().toLocaleTimeString()}},P=[{value:"MONDAY",label:"Mon"},{value:"TUESDAY",label:"Tue"},{value:"WEDNESDAY",label:"Wed"},{value:"THURSDAY",label:"Thu"},{value:"FRIDAY",label:"Fri"},{value:"SATURDAY",label:"Sat"},{value:"SUNDAY",label:"Sun"}],F=()=>h.preferred_days.length===0?"no days":h.preferred_days.length===7?"daily":h.preferred_days.map(U=>{var D;return(D=P.find(q=>q.value===U))==null?void 0:D.label}).filter(Boolean).join(", "),M=()=>{var J,W,ie,he,ee,xe,we,Se,pe,Ce;const Q=e.name,U=F(),D=(J=h.config.image)==null?void 0:J.enabled,q=(W=h.config.video)==null?void 0:W.enabled,G=h.autopost_enabled,Y=h.preferred_time,K=h.autogenerate_enabled,X=[];if(!K)return X.push(`Automated content generation is disabled for ${Q}.`),X.push("Content must be created manually through the dashboard."),X;X.push(`Auto-create will create ${Q} content ${U} and send to your inbox.`);const ne=[],ae=[];if(D||q){ne.push("automatically search existing"),(D&&((he=(ie=h.config.image)==null?void 0:ie.steps)==null?void 0:he.includes("STOCK_SEARCH"))||q&&((xe=(ee=h.config.video)==null?void 0:ee.steps)==null?void 0:xe.includes("STOCK_SEARCH")))&&ne.push("search stock");const se=D&&((Se=(we=h.config.image)==null?void 0:we.steps)==null?void 0:Se.includes("AI_GENERATE")),Ae=q&&((Ce=(pe=h.config.video)==null?void 0:pe.steps)==null?void 0:Ce.includes("AI_GENERATE"));se&&Ae?ae.push("images and videos"):se?ae.push("images"):Ae&&ae.push("videos"),ae.length>0&&ne.push(`generate ${ae.join(" and ")}`)}return ne.length>0?X.push(`It will ${ne.join(", ")}.`):X.push("It will not automatically search existing, search stock, or generate media."),G?X.push(`It will automatically publish content to ${Q} on specified days at ${Y}.`):X.push(`It will not automatically publish content to ${Q}.`),X};return n.jsxs("div",{className:"space-y-6",children:[h.autogenerate_enabled&&n.jsxs(Ar,{className:"relative overflow-hidden bg-gradient-to-r from-blue-50 to-indigo-50 border border-blue-200/60 shadow-lg backdrop-blur-sm",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-blue-50/30 to-indigo-50/30"}),n.jsx(hn,{className:"relative h-5 w-5 text-blue-600"}),n.jsxs(gr,{className:"relative text-blue-800",children:[n.jsx("div",{className:"font-bold text-blue-900 text-base mb-2",children:"Auto-Create Content Behavior"}),n.jsx("div",{className:"text-sm space-y-1",children:M().map((Q,U)=>n.jsx("p",{children:Q},U))})]})]}),n.jsxs(Te,{className:"group relative overflow-hidden border border-emerald-200/50 bg-gradient-to-br from-white via-emerald-50/20 to-white shadow-lg hover:shadow-xl transition-all duration-300",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-emerald-50/20 via-transparent to-green-50/20 opacity-0 group-hover:opacity-100 transition-opacity duration-300"}),n.jsx("div",{className:"absolute top-0 right-0 w-20 h-20 bg-gradient-to-br from-emerald-200/20 to-transparent rounded-full -translate-y-10 translate-x-10"}),n.jsxs(Re,{className:"relative p-6 space-y-4",children:[n.jsxs("div",{className:"flex flex-row items-center justify-between",children:[n.jsxs("div",{className:"space-y-0.5",children:[n.jsx("label",{className:"text-lg font-bold bg-gradient-to-r from-emerald-800 to-green-700 bg-clip-text text-transparent",children:"Auto-create Content"}),n.jsxs("p",{className:"text-sm text-gray-600",children:["Automatically create content for ",e.name]})]}),n.jsx(ns,{checked:h.autogenerate_enabled,onCheckedChange:Q=>N("autogenerate_enabled",Q),"aria-label":"Auto-create content",className:"data-[state=checked]:bg-gradient-to-r data-[state=checked]:from-emerald-500 data-[state=checked]:to-green-600"})]}),h.autogenerate_enabled&&n.jsxs("div",{className:"space-y-3 pt-4 border-t border-emerald-100",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Kn,{className:"h-5 w-5 text-emerald-600"}),n.jsx("label",{className:"text-base font-semibold text-emerald-800",children:"Posting Days"})]}),n.jsx("div",{className:"grid grid-cols-7 gap-2",children:P.map(Q=>n.jsx(te,{variant:h.preferred_days.includes(Q.value)?"default":"outline",size:"sm",onClick:()=>
1622_(Q.value),className:ye("transition-all duration-300",h.preferred_days.includes(Q.value)?"bg-gradient-to-r from-emerald-500 to-green-600 text-white shadow-md hover:from-emerald-600 hover:to-green-700":"hover:bg-emerald-50"),children:Q.label},Q.value))}),n.jsx("p",{className:"text-sm text-gray-600",children:"Select the days when you want content to be published"})]})]})]}),n.jsxs(Te,{className:"group relative overflow-hidden border border-blue-200/50 bg-gradient-to-br from-white via-blue-50/20 to-white shadow-lg hover:shadow-xl transition-all duration-300",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-blue-50/20 via-transparent to-indigo-50/20 opacity-0 group-hover:opacity-100 transition-opacity duration-300"}),n.jsxs(Re,{className:"relative p-6 space-y-4",children:[n.jsxs("div",{className:"flex flex-row items-center justify-between",children:[n.jsxs("div",{className:"space-y-0.5",children:[n.jsx("label",{className:"text-lg font-bold bg-gradient-to-r from-blue-800 to-indigo-700 bg-clip-text text-transparent",children:"Auto-Publish Content"}),n.jsxs("p",{className:"text-sm text-gray-600",children:["Automatically publish content to ",e.name," when ready"]})]}),n.jsx(ns,{checked:h.autopost_enabled,onCheckedChange:Q=>N("autopost_enabled",Q),disabled:!h.autogenerate_enabled,"aria-label":"Auto-publish content",className:"data-[state=checked]:bg-gradient-to-r data-[state=checked]:from-blue-500 data-[state=checked]:to-indigo-600"})]}),h.autopost_enabled&&n.jsxs("div",{className:"space-y-3 pt-4 border-t border-blue-100",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Vr,{className:"h-5 w-5 text-blue-600"}),n.jsx("label",{className:"text-base font-semibold text-blue-800",children:"Preferred Publishing Time"})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(qe,{type:"time",value:h.preferred_time,onChange:Q=>N("preferred_time",Q.target.value),className:"w-full"}),n.jsxs("div",{className:"text-sm text-muted-foreground flex items-center gap-1",children:[n.jsx(Vr,{className:"h-4 w-4"}),"Your timezone: ",i?i.replace("_"," "):"Loading...",!l&&n.jsxs("span",{className:"ml-2",children:["Current time: ",L()]})]})]})]})]})]}),n.jsxs(Te,{className:"group relative overflow-hidden border border-purple-200/50 bg-gradient-to-br from-white via-purple-50/20 to-white shadow-lg hover:shadow-xl transition-all duration-300",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-purple-50/20 via-transparent to-indigo-50/20 opacity-0 group-hover:opacity-100 transition-opacity duration-300"}),n.jsx("div",{className:"absolute top-0 right-0 w-20 h-20 bg-gradient-to-br from-purple-200/20 to-transparent rounded-full -translate-y-10 translate-x-10"}),n.jsx(st,{className:"relative",children:n.jsxs(ot,{className:"flex items-center gap-2 text-xl font-bold bg-gradient-to-r from-purple-800 to-indigo-700 bg-clip-text text-transparent",children:[n.jsx(bK,{className:"h-5 w-5 text-purple-600"}),"Automated Media Processing"]})}),n.jsxs(Re,{className:"relative space-y-6",children:[n.jsxs("p",{className:"text-base text-gray-600",children:["Configure how images and videos are handled when creating content for ",e.name]}),n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsx("label",{className:"relative text-base font-bold bg-gradient-to-r from-blue-800 to-indigo-700 bg-clip-text text-transparent",children:"Use Images"}),n.jsx("p",{className:"relative text-sm text-gray-600 mt-1",children:"Enable automatic image processing"})]}),n.jsx(ns,{checked:((I=h.config.image)==null?void 0:I.enabled)||!1,onCheckedChange:Q=>{m(U=>{var D;return{...U,config:{...U.config,image:{enabled:Q,steps:((D=U.config.image)==null?void 0:D.steps)||["SEARCH_EXISTING","AI_GENERATE","STOCK_SEARCH","STOP_AND_UPLOAD"]}}}})},disabled:!h.autogenerate_enabled,className:ye("data-[state=checked]:bg-green-500 data-[state=checked]:hover:bg-green-600")})]}),(($=h.config.image)==null?void 0:$.enabled)&&n.jsxs("div",{className:"ml-4 pl-4 border-l-2 border-gray-200 space-y-3",children:[n.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide block",children:"Image Processing Steps (In Order)"}),n.jsx(Uz,{sensors:j,collisionDetection:Ez,onDragEnd:S,children:n.jsx(Qz,{items:x,strategy:$z,children:n.jsx("div",{className:"space-y-2",children:x.map(Q=>{var U,D;return n.jsx(Hz,{id:Q,step:Q,enabled:((D=(U=h.config.image)==null?void 0:U.steps)==null?void 0:D.includes(Q))||!1,onToggle:E,disabled:!h.autogenerate_enabled,type:"image"},Q)})})})}),n.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"Drag cards to reorder • Uncheck to disable a step • Steps run in order from top to bottom"})]})]}),n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsx("label",{className:"relative text-base font-bold bg-gradient-to-r from-purple-800 to-pink-700 bg-clip-text text-transparent",children:"Use Videos"}),n.jsx("p",{className:"relative text-sm text-gray-600 mt-1",children:"Enable automatic video processing"})]}),n.jsx(ns,{checked:((V=h.config.video)==null?void 0:V.enabled)||!1,onCheckedChange:Q=>{m(U=>{var D;return{...U,config:{...U.config,video:{enabled:Q,steps:((D=U.config.video)==null?void 0:D.steps)||["SEARCH_EXISTING","STOP_AND_UPLOAD","AI_GENERATE","STOCK_SEARCH"]}}}})},disabled:!h.autogenerate_enabled,className:ye("data-[state=checked]:bg-green-500 data-[state=checked]:hover:bg-green-600")})]}),((R=h.config.video)==null?void 0:R.enabled)&&n.jsxs("div",{className:"ml-4 pl-4 border-l-2 border-gray-200 space-y-3",children:[n.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide block",children:"Video Processing Steps (In Order)"}),n.jsx(Uz,{sensors:j,collisionDetection:Ez,onDragEnd:C,children:n.jsx(Qz,{items:y,strategy:$z,children:n.jsx("div",{className:"space-y-2",children:y.map(Q=>{var U,D;return n.jsx(Hz,{id:Q,step:Q,enabled:((D=(U=h.config.video)==null?void 0:U.steps)==null?void 0:D.includes(Q))||!1,onToggle:T,disabled:!h.autogenerate_enabled,type:"video"},Q)})})})}),n.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"Drag cards to reorder • Uncheck to disable a step • Steps run in order from top to bottom"})]})]})]})]}),n.jsx("div",{className:"flex justify-end pt-4",children:n.jsxs(te,{onClick:B,disabled:f,className:"group relative overflow-hidden min-w-[180px] h-12 bg-gradient-to-r from-purple-500 to-pink-600 border-0 text-white shadow-lg hover:shadow-xl transition-all duration-300 transform hover:scale-105 hover:from-purple-600 hover:to-pink-700 disabled:opacity-50 disabled:cursor-not-allowed disabled:transform-none font-medium",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-white/10 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-300"}),f?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"relative animate-spin rounded-full h-4 w-4 border-t-2 border-b-2 border-white mr-2"}),n.jsx("span",{className:"relative",children:"Saving..."})]}):n.jsxs(n.Fragment,{children:[n.jsx(ld,{className:"relative h-4 w-4 mr-2"}),n.jsx("span",{className:"relative",children:"Save Automation Settings"})]})]})})]})},Ddt=({className:e})=>n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e,children:n.jsx("path",{d:"M9 12a4 4 0 1 0 4 4V4a
16225 5 0 0 0 5 5"})}),zz=(e,t="md")=>{const r=t==="sm"?"h-4 w-4":t==="lg"?"h-8 w-8":"h-5 w-5";switch(e==null?void 0:e.toLowerCase()){case"linkedin":case"linkedin_article":return n.jsx(ky,{className:r});case"twitter":return n.jsx(kr,{className:r});case"facebook":return n.jsx(_u,{className:r});case"instagram":return n.jsx(Vh,{className:r});case"youtube":return n.jsx(kI,{className:r});case"tiktok":return n.jsx(Ddt,{className:r});case"wordpress":return n.jsx(Is,{className:r});case"medium":return n.jsx(ab,{className:r});default:return n.jsx(Is,{className:r})}},Rdt=()=>{const{id:e,platformId:t}=Ei(),[r,s]=g.useState("automation"),{platforms:a,platformSettings:i,platformConnectionStatus:o,loading:l,savePlatformSettings:c,updateConnectionStatus:d,testPlatformConnection:u,initiateAuthFlow:h,fetchLinkedInOrganizations:m,setLinkedInOrganization:f,linkedinOrganizations:p,loadingOrganizations:A,setFacebookPage:v}=N6(e),x=a.find(w=>w.id===t),b=async(w,j)=>{await c(w,j)};if(l)return n.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 via-white to-blue-50/30 relative overflow-hidden",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsx("div",{className:"relative container mx-auto p-6 max-w-6xl",children:n.jsx("div",{className:"flex items-center justify-center h-64",children:n.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-t-2 border-b-2 border-blue-600"})})})]});if(!x)return n.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 via-white to-blue-50/30 relative overflow-hidden",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsx("div",{className:"relative container mx-auto p-6 max-w-6xl",children:n.jsxs("div",{className:"relative overflow-hidden bg-gradient-to-br from-white via-red-50/30 to-orange-50/40 rounded-2xl border border-red-200/50 shadow-sm p-8",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsxs("div",{className:"relative",children:[n.jsxs("div",{className:"flex items-center gap-4",children:[n.jsx("div",{className:"p-3 bg-white/80 backdrop-blur-sm rounded-2xl shadow-lg",children:n.jsx(fs,{className:"h-8 w-8 text-red-600"})}),n.jsxs("div",{children:[n.jsx("h1",{className:"text-4xl font-bold bg-gradient-to-r from-red-700 via-orange-700 to-yellow-700 bg-clip-text text-transparent mb-2",children:"Platform Not Found"}),n.jsx("p",{className:"text-gray-600 text-lg leading-relaxed",children:"The requested platform could not be found"})]})]}),n.jsx("div",{className:"mt-6",children:n.jsx("p",{className:"text-gray-600",children:"Use the sidebar navigation to return to connections."})})]})]})})]});const y=x.platform_key==="twitter"?"X":x.platform_key==="linkedin_article"?"LinkedIn Articles":x.name;return n.jsxs("div",{className:"container mx-auto p-6 space-y-6",children:[n.jsx(i0,{title:`${y} Agent Settings`,description:`Configure your ${y} connection and automation settings`,icon:zz(x.platform_key)}),n.jsx("div",{className:"max-w-6xl",children:n.jsxs(Cs,{value:r,onValueChange:s,className:"space-y-8",defaultValue:"automation",children:[n.jsxs("div",{className:"relative overflow-hidden bg-white/60 backdrop-blur-sm rounded-xl border border-white/50 shadow-sm p-1 sm:p-2 mx-auto max-w-2xl",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-blue-50/30 via-transparent to-indigo-50/30"}),n.jsxs(ps,{className:"relative flex w-full flex-col items-stretch gap-1 rounded-lg bg-white/30 px-1 py-1 sm:w-auto sm:flex-row sm:items-center sm:justify-center sm:gap-2",children:[n.jsxs(pt,{value:"automation",className:"relative flex items-center justify-center gap-2 rounded-lg bg-white/50 px-4 py-2 text-sm font-medium text-slate-600 transition-all duration-200 hover:bg-white data-[state=active]:bg-gradient-to-r data-[state=active]:from-purple-500 data-[state=active]:to-pink-600 data-[state=active]:text-white data-[state=active]:shadow-md sm:px-6",children:[n.jsx(bK,{className:"h-4 w-4"}),"Agent Configuration"]}),n.jsxs(pt,{value:"connection",className:"relative flex items-center justify-center gap-2 rounded-lg bg-white/50 px-4 py-2 text-sm font-medium text-slate-600 transition-all duration-200 hover:bg-white data-[state=active]:bg-gradient-to-r data-[state=active]:from-blue-500 data-[state=active]:to-indigo-600 data-[state=active]:text-white data-[state=active]:shadow-md sm:px-6",children:[n.jsx(Im,{className:"h-4 w-4"}),"Connection"]})]})]}),n.jsx(Ct,{value:"automation",className:"space-y-6",children:n.jsxs("div",{className:"relative overflow-hidden bg-gradient-to-br from-white via-purple-50/30 to-pink-50/30 rounded-2xl border border-purple-200/50 shadow-lg",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsx("div",{className:"relative p-6",children:n.jsx(Ldt,{platform:x,platformSettings:i,savePlatformSettings:b,isConnected:!0,brandId:e})})]})}),n.jsx(Ct,{value:"connection",className:"space-y-6",children:n.jsxs("div",{className:"relative overflow-hidden bg-gradient-to-br from-white via-blue-50/30 to-indigo-50/30 rounded-2xl border border-blue-200/50 shadow-lg",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsx("div",{className:"relative p-1",children:n.jsx(Xlt,{platform:x,icon:zz(x.platform_key),platformSettings:i,platformConnectionStatus:o,savePlatformSettings:b,testPlatformConnection:u,updateConnectionStatus:d,initiateAuthFlow:h,fetchLinkedInOrganizations:m,setLinkedInOrganization:f,linkedinOrganizations:p,loadingOrganizations:A,setFacebookPage:v,brandId:e})})]})})]})}),n.jsx(xS,{})]})};function Udt(){const{id:e}=Ei(),[t,r]=g.useState(null),[s,a]=g.useState(!0),[i,o]=g.useState(null),{toast:l}=sn(),d=`https://worker.rainfactory.ai/blog-rss/${e}`,u=async()=>{var p,A,v;if(e){a(!0),o(null);try{const x=await fetch(d);if(!x.ok)throw new Error("Failed to fetch RSS feed");const b=await x.text(),w=new DOMParser().parseFromString(b,"text/xml");if(w.querySelector("parsererror"))throw new Error("Invalid RSS feed format");const N=w.querySelector("channel");
1622if(!N)throw new Error("No channel found in RSS feed");const _=((p=N.querySelector("title"))==null?void 0:p.textContent)||"",S=((A=N.querySelector("description"))==null?void 0:A.textContent)||"",C=((v=N.querySelector("link"))==null?void 0:v.textContent)||"",E=[];N.querySelectorAll("item").forEach(B=>{var V,R,Q,U,D,q,G;const L=((V=B.querySelector("guid"))==null?void 0:V.textContent)||"",P=((R=B.querySelector("title"))==null?void 0:R.textContent)||"",F=((Q=B.querySelector("link"))==null?void 0:Q.textContent)||"",M=((U=B.querySelector("pubDate"))==null?void 0:U.textContent)||"",I=((D=B.querySelector("description"))==null?void 0:D.textContent)||"",$=((q=B.querySelector("content\\:encoded"))==null?void 0:q.textContent)||((G=B.querySelector("encoded"))==null?void 0:G.textContent)||"";E.push({guid:L,title:P,link:F,pubDate:M,description:I,content:$})}),r({title:_,description:S,link:C,items:E})}catch(x){console.error("Error fetching RSS feed:",x),o(x instanceof Error?x.message:"Failed to load RSS feed")}finally{a(!1)}}};g.useEffect(()=>{u()},[e]);const h=async()=>{try{await navigator.clipboard.writeText(d),l({title:"Copied!",description:"RSS feed URL copied to clipboard"})}catch{l({title:"Error",description:"Failed to copy URL",variant:"destructive"})}},m=p=>{try{return nn(new Date(p),"PPP")}catch{return p}},f=p=>new DOMParser().parseFromString(p,"text/html").body.textContent||"";return n.jsxs("div",{className:"container mx-auto p-6 space-y-6",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4",children:[n.jsxs("div",{children:[n.jsxs("h2",{className:"text-2xl font-bold flex items-center gap-2",children:[n.jsx(Ey,{className:"h-6 w-6"}),"RSS Feed"]}),n.jsx("p",{className:"text-muted-foreground mt-1",children:"View and manage your brand's RSS feed"})]}),n.jsxs("div",{className:"flex gap-2",children:[n.jsxs(te,{variant:"outline",size:"sm",onClick:h,children:[n.jsx(Cn,{className:"h-4 w-4 mr-2"}),"Copy Feed URL"]}),n.jsxs(te,{variant:"outline",size:"sm",onClick:()=>window.open(d,"_blank"),children:[n.jsx(Vs,{className:"h-4 w-4 mr-2"}),"View Raw XML"]}),n.jsxs(te,{variant:"outline",size:"sm",onClick:u,disabled:s,children:[n.jsx(Es,{className:`h-4 w-4 mr-2 ${s?"animate-spin":""}`}),"Refresh"]})]})]}),n.jsx(Te,{children:n.jsx(Re,{className:"p-6",children:n.jsxs("div",{className:"space-y-3",children:[n.jsx("div",{className:"flex items-center gap-2",children:n.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Feed URL:"})}),n.jsx("code",{className:"block text-sm bg-muted px-3 py-2 rounded break-all",children:d})]})})}),s?n.jsxs("div",{className:"space-y-4",children:[n.jsx(Lt,{className:"h-20 w-full"}),n.jsx(Lt,{className:"h-32 w-full"}),n.jsx(Lt,{className:"h-32 w-full"})]}):i?n.jsx(Te,{className:"border-destructive",children:n.jsx(Re,{className:"p-6 pt-6",children:n.jsx("p",{className:"text-destructive text-center",children:i})})}):t?n.jsxs("div",{className:"space-y-6",children:[n.jsxs(Te,{children:[n.jsxs(st,{children:[n.jsx(ot,{children:t.title}),n.jsx(Wr,{children:t.description})]}),n.jsx(Re,{children:n.jsxs("p",{className:"text-sm text-muted-foreground",children:[t.items.length," ",t.items.length===1?"item":"items"," in feed"]})})]}),n.jsxs("div",{className:"space-y-6",children:[n.jsx("h3",{className:"text-lg font-semibold",children:"Feed Preview"}),t.items.length===0?n.jsx(Te,{children:n.jsx(Re,{className:"p-6 pt-6",children:n.jsx("p",{className:"text-center text-muted-foreground",children:"No items published to RSS feed yet"})})}):t.items.map(p=>n.jsxs(Te,{children:[n.jsxs(st,{children:[n.jsxs("div",{className:"flex justify-between items-start gap-2",children:[n.jsx(ot,{className:"text-lg",children:p.title}),p.guid&&n.jsx(te,{variant:"ghost",size:"sm",onClick:()=>window.open(`/blog/${p.guid}`,"_blank"),children:n.jsx(Vs,{className:"h-4 w-4"})})]}),n.jsx(Wr,{children:m(p.pubDate)})]}),n.jsx(Re,{children:n.jsx("p",{className:"text-sm line-clamp-3",children:f(p.description||p.content||"")})})]},p.guid))]})]}):null]})}function Mdt(){const{brandId:e}=Ei(),{selectedBrand:t}=mn(),[r,s]=g.useState([]),[a,i]=g.useState(!0),[o,l]=g.useState(null),c=e||(t==null?void 0:t.id);g.useEffect(()=>{async function u(){if(!c){l("No brand selected"),i(!1);return}try{i(!0),l(null);const{data:h,error:m}=await de.from("current_content_versions").select("*").eq("brand_id",c).eq("content_type","blog_post").eq("content_status","PUBLISHED").order("created_at",{ascending:!1});if(m)throw m;s(h||[])}catch(h){console.error("Error fetching blog posts:",h),l(h instanceof Error?h.message:"An unknown error occurred")}finally{i(!1)}}u()},[c]);const d=u=>
1622{try{return new Date(u).toLocaleString("en-US",{year:"numeric",month:"long",day:"numeric",hour:"numeric",minute:"2-digit",hour12:!0})}catch{return u}};return c?n.jsxs("div",{className:"container mx-auto py-6 space-y-6",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx("h1",{className:"text-2xl font-bold",children:"Blog Posts"}),n.jsxs("p",{className:"text-muted-foreground",children:["Published blog posts for ",(t==null?void 0:t.brand_name)||"this brand"]})]}),a?n.jsx("div",{className:"flex justify-center items-center py-16",children:n.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})}):o?n.jsx(Te,{children:n.jsx(Re,{className:"pt-6",children:n.jsxs("p",{className:"text-red-500 text-center",children:["Error loading blog posts: ",o]})})}):r.length===0?n.jsx(Te,{children:n.jsx(Re,{className:"pt-6",children:n.jsxs("div",{className:"text-center py-8",children:[n.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-full bg-muted flex items-center justify-center",children:n.jsx("span",{className:"text-2xl",children:"📝"})}),n.jsx("h3",{className:"text-lg font-medium mb-2",children:"No blog posts yet"}),n.jsx("p",{className:"text-muted-foreground",children:"Create and publish your first blog post to see it here."})]})})}):n.jsx("div",{className:"grid gap-6",children:r.map(u=>
1622{var h,m,f,p,A,v,x,b,y,w,j,N,_,S,C,E,T,B,L,P,F,M,I,$;return n.jsxs(Te,{className:"overflow-hidden hover:shadow-lg transition-all duration-300 hover:border-primary/20 group",children:[(h=u.content_json)!=null&&h.featured_image||(m=u.content_json)!=null&&m.image_url?n.jsx("div",{className:"aspect-video overflow-hidden bg-gradient-to-br from-muted/50 to-muted/30",children:n.jsx("img",{src:((f=u.content_json)==null?void 0:f.featured_image)||((p=u.content_json)==null?void 0:p.image_url),alt:((A=u.content_json)==null?void 0:A.title)||u.name||"Blog post",className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-500",loading:"lazy",onError:V=>{const R=V.target;R.style.display="none"}})}):n.jsx("div",{className:"aspect-video bg-gradient-to-br from-primary/10 via-primary/5 to-transparent flex items-center justify-center",children:n.jsxs("div",{className:"text-center p-6",children:[n.jsx("div",{className:"w-16 h-16 mx-auto mb-3 rounded-full bg-primary/10 flex items-center justify-center",children:n.jsx("span",{className:"text-2xl",children:"📝"})}),n.jsx("h3",{className:"text-lg font-medium text-primary/80 line-clamp-2",children:((v=u.content_json)==null?void 0:v.title)||u.name})]})}),n.jsx(st,{children:n.jsxs("div",{className:"space-y-3",children:[((b=(x=u.content_json)==null?void 0:x.bonus_metadata)==null?void 0:b.categories)&&u.content_json.bonus_metadata.categories.length>0&&n.jsxs("div",{className:"flex flex-wrap gap-2",children:[u.content_json.bonus_metadata.categories.slice(0,3).map((V,R)=>n.jsx("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-primary/10 text-primary hover:bg-primary/20 transition-colors",children:V},R)),((w=(y=u.content_json)==null?void 0:y.bonus_metadata)==null?void 0:w.categories)&&u.content_json.bonus_metadata.categories.length>3&&n.jsxs("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-muted text-muted-foreground",children:["+",u.content_json.bonus_metadata.categories.length-3," more"]})]}),n.jsx(ot,{className:"text-xl md:text-2xl leading-tight font-bold",children:n.jsx(Ir,{to:`/brands/${c}/blog/${u.id}`,className:"hover:text-primary transition-colors group-hover:text-primary/90",children:((j=u.content_json)==null?void 0:j.title)||u.name})})]})}),n.jsx(Re,{className:"pb-4",children:(_=(N=u.content_json)==null?void 0:N.bonus_metadata)!=null&&_.excerpt?n.jsx("p",{className:"text-muted-foreground text-base leading-relaxed line-clamp-3",children:u.content_json.bonus_metadata.excerpt}):(S=u.content_json)!=null&&S.primary_content?n.jsxs("div",{className:"text-muted-foreground text-base leading-relaxed line-clamp-3",style:{display:"-webkit-box",WebkitLineClamp:3,WebkitBoxOrient:"vertical",overflow:"hidden"},children:[(E=(C=u.content_json)==null?void 0:C.primary_content)==null?void 0:E.substring(0,200),"..."]}):n.jsx("p",{className:"text-muted-foreground text-base leading-relaxed",children:"No preview available"})}),n.jsx(uo,{className:"pt-4",children:n.jsxs("div",{className:"flex flex-col gap-3 w-full",children:[(((B=(T=u.content_json)==null?void 0:T.bonus_metadata)==null?void 0:B.author)||((P=(L=u.content_json)==null?void 0:L.bonus_metadata)==null?void 0:P.reading_time))&&n.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[((M=(F=u.content_json)==null?void 0:F.bonus_metadata)==null?void 0:M.author)&&n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("span",{className:"font-medium",children:"By"}),n.jsx("span",{children:u.content_json.bonus_metadata.author})]}),(($=(I=u.content_json)==null?void 0:I.bonus_metadata)==null?void 0:$.reading_time)&&n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("span",{children:"📖"}),n.jsx("span",{children:u.content_json.bonus_metadata.reading_time})]})]}),n.jsxs("div",{className:"flex justify-between items-center",children:[n.jsx("span",{className:"text-sm text-muted-foreground",children:d(u.created_at||"")}),n.jsxs(Ir,{to:`/brands/${c}/blog/${u.id}`,className:"inline-flex items-center text-primary hover:text-primary/80 transition-colors text-sm font-medium group",children:["Read more",n.jsx("span",{className:"ml-1 group-hover:translate-x-0.5 transition-transform",children:"→"})]})]})]})})]},u.id)})})]}):n.jsx("div",{className:"container mx-auto py-6",children:n.jsx(Te,{children:n.jsx(Re,{className:"pt-6",children:n.jsx("p",{className:"text-muted-foreground text-center",children:"Please select a brand to view blog posts."})})})})}function z6(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var dp=z6();function Kae(e){dp=e}var Lv={exec:()=>null};function kn(e,t=""){let r=typeof e=="string"?e:e.source;const s={replace:(a,i)=>{let o=typeof i=="string"?i:i.source;return o=o.replace(Vi.caret,"$1"),r=r.replace(a,o),s},getRegex:()=>new RegExp(r,t)};return s}var Vi={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine
vendor: 34,882 bytes, lines 1622-1676
1622:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[	 ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ 	][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},$dt=/^(?:[ \t]*(?:\n|$))+/,Qdt=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Hdt=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,nw=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,zdt=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,V6=/(?:[*+-]|\d{1,9}[.)])/,Wae=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Yae=kn(Wae).replace(/bull/g,V6).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Vdt=kn(Wae).replace(/bull/g,V6).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),G6=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Gdt=/^[^\n]+/,q6=/(?!\s*\])(?:\\.|[^\[\]\\])+/,qdt=kn(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",q6).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Kdt=kn(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,V6).getRegex(),lk="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",K6=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Wdt=kn("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ 	]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ 	]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ 	]*)+\\n|$))","i").replace("comment",K6).replace("tag",lk).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Jae=kn(G6).replace("hr",nw).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",lk).getRegex(),Ydt=kn(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Jae).getRegex(),W6={blockquote:Ydt,code:Qdt,def:qdt,fences:Hdt,heading:zdt,hr:nw,html:Wdt,lheading:Yae,list:Kdt,newline:$dt,paragraph:Jae,table:Lv,text:Gdt},Vz=kn("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",nw).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3}	)[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",lk).getRegex(),Jdt={...W6,lheading:Vdt,table:Vz,paragraph:kn(G6).replace("hr",nw).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Vz).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",lk).getRegex()},Xdt={...W6,html:kn(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",K6).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Lv,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:kn(G6).replace("hr",nw).replace("heading",` *#{1,6} *[^
1623]`).replace("lheading",Yae).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Zdt=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,eut=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Xae=/^( {2,}|\\)\n(?!\s*$)/,tut=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,ck=/[\p{P}\p{S}]/u,Y6=/[\s\p{P}\p{S}]/u,Zae=/[^\s\p{P}\p{S}]/u,rut=kn(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Y6).getRegex(),eie=/(?!~)[\p{P}\p{S}]/u,nut=/(?!~)[\s\p{P}\p{S}]/u,sut=/(?:[^\s\p{P}\p{S}]|~)/u,aut=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,tie=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,iut=kn(tie,"u").replace(/punct/g,ck).getRegex(),out=kn(tie,"u").replace(/punct/g,eie).getRegex(),rie="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",lut=kn(rie,"gu").replace(/notPunctSpace/g,Zae).replace(/punctSpace/g,Y6).replace(/punct/g,ck).getRegex(),cut=kn(rie,"gu").replace(/notPunctSpace/g,sut).replace(/punctSpace/g,nut).replace(/punct/g,eie).getRegex(),dut=kn("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Zae).replace(/punctSpace/g,Y6).replace(/punct/g,ck).getRegex(),uut=kn(/\\(punct)/,"gu").replace(/punct/g,ck).getRegex(),hut=kn(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),fut=kn(K6).replace("(?:-->|$)","-->").getRegex(),mut=kn("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",fut).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),p_=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,put=kn(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",p_).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),nie=kn(/^!?\[(label)\]\[(ref)\]/).replace("label",p_).replace("ref",q6).getRegex(),sie=kn(/^!?\[(ref)\](?:\[\])?/).replace("ref",q6).getRegex(),Aut=kn("reflink|nolink(?!\\()","g").replace("reflink",nie).replace("nolink",sie).getRegex(),J6={_backpedal:Lv,anyPunctuation:uut,autolink:hut,blockSkip:aut,br:Xae,code:eut,del:Lv,emStrongLDelim:iut,emStrongRDelimAst:lut,emStrongRDelimUnd:dut,escape:Zdt,link:put,nolink:sie,punctuation:rut,reflink:nie,reflinkSearch:Aut,tag:mut,text:tut,url:Lv},gut={...J6,link:kn(/^!?\[(label)\]\((.*?)\)/).replace("label",p_).getRegex(),reflink:kn(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",p_).getRegex()},FP={...J6,emStrongRDelimAst:cut,emStrongLDelim:out,url:kn(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},xut={...FP,br:kn(Xae).replace("{2,}","*").getRegex(),text:kn(FP.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},nj={normal:W6,gfm:Jdt,pedantic:Xdt},Fx={normal:J6,gfm:FP,breaks:xut,pedantic:gut},vut={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Gz=e=>vut[e];function Wc(e,t){if(t){if(Vi.escapeTest.test(e))return e.replace(Vi.escapeReplace,Gz)}else if(Vi.escapeTestNoEncode.test(e))return e.replace(Vi.escapeReplaceNoEncode,Gz);return e}function qz(e){try{e=encodeURI(e).replace(Vi.percentDecode,"%")}catch{return null}return e}function Kz(e,t){var i;const r=e.replace(Vi.findPipe,(o,l,c)=>{let d=!1,u=l;for(;--u>=0&&c[u]==="\\";)d=!d;return d?"|":" |"}),s=r.split(Vi.splitPipe);let a=0;if(s[0].trim()||s.shift(),s.length>0&&!((i=s.at(-1))!=null&&i.trim())&&s.pop(),t)if(s.length>t)s.splice(t);else for(;s.length<t;)s.push("");for(;a<s.length;a++)s[a]=s[a].trim().replace(Vi.slashPipe,"|");return s}function Lx(e,t,r){const s=e.length;if(s===0)return"";let a=0;for(;a<s&&e.charAt(s-a-1)===t;)a++;return e.slice(0,s-a)}function but(e,t){if(e.indexOf(t[1])===-1)return-1;let r=0;for(let s=0;s<e.length;s++)if(e[s]==="\\")s++;else if(e[s]===t[0])r++;else if(e[s]===t[1]&&(r--,r<0))return s;return r>0?-2:-1}function Wz(e,t,r,s,a){const i=t.href,o=t.title||null,l=e[1].replace(a.other.outputLinkReplace,"$1");s.state.inLink=!0;const c={type:e[0].charAt(0)==="!"?"image":"link",raw:r,href:i,title:o,text:l,tokens:s.inlineTokens(l)};return s.state.inLink=!1,c}function yut(e,t,r){const s=e.match(r.other.indentCodeCompensation);if(s===null)return t;const a=s[1];return t.split(`
1624`).map(i=>{const o=i.match(r.other.beginningSpace);if(o===null)return i;const[l]=o;return l.length>=a.length?i.slice(a.length):i}).join(`
1625`)}var A_=class{constructor(e){Yt(this,"options");Yt(this,"rules");Yt(this,"lexer");this.options=e||dp}space(e){const t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const r=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?r:Lx(r,`
1626`)}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const r=t[0],s=yut(r,t[3]||"",this.rules);return{type:"code",raw:r,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:s}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let r=t[2].trim();if(this.rules.other.endingHash.test(r)){const s=Lx(r,"#");(this.options.pedantic||!s||this.rules.other.endingSpaceChar.test(s))&&(r=s.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:r,tokens:this.lexer.inline(r)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:Lx(t[0],`
1627`)}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){let r=Lx(t[0],`
1628`).split(`
1629`),s="",a="";const i=[];for(;r.length>0;){let o=!1;const l=[];let c;for(c=0;c<r.length;c++)if(this.rules.other.blockquoteStart.test(r[c]))l.push(r[c]),o=!0;else if(!o)l.push(r[c]);else break;r=r.slice(c);const d=l.join(`
1630`),u=d.replace(this.rules.other.blockquoteSetextReplace,`
1631    $1`).replace(this.rules.other.blockquoteSetextReplace2,"");s=s?`${s}
1632${d}`:d,a=a?`${a}
1633${u}`:u;const h=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(u,i,!0),this.lexer.state.top=h,r.length===0)break;const m=i.at(-1);if((m==null?void 0:m.type)==="code")break;if((m==null?void 0:m.type)==="blockquote"){const f=m,p=f.raw+`
1634`+r.join(`
1635`),A=this.blockquote(p);i[i.length-1]=A,s=s.substring(0,s.length-f.raw.length)+A.raw,a=a.substring(0,a.length-f.text.length)+A.text;break}else if((m==null?void 0:m.type)==="list"){const f=m,p=f.raw+`
1636`+r.join(`
1637`),A=this.list(p);i[i.length-1]=A,s=s.substring(0,s.length-m.raw.length)+A.raw,a=a.substring(0,a.length-f.raw.length)+A.raw,r=p.substring(i.at(-1).raw.length).split(`
1638`);continue}}return{type:"blockquote",raw:s,tokens:i,text:a}}}list(e){let t=this.rules.block.list.exec(e);if(t){let r=t[1].trim();const s=r.length>1,a={type:"list",raw:"",ordered:s,start:s?+r.slice(0,-1):"",loose:!1,items:[]};r=s?`\\d{1,9}\\${r.slice(-1)}`:`\\${r}`,this.options.pedantic&&(r=s?r:"[*+-]");const i=this.rules.other.listItemRegex(r);let o=!1;for(;e;){let c=!1,d="",u="";if(!(t=i.exec(e))||this.rules.block.hr.test(e))break;d=t[0],e=e.substring(d.length);let h=t[2].split(`
1639`,1)[0].replace(this.rules.other.listReplaceTabs,x=>" ".repeat(3*x.length)),m=e.split(`
1640`,1)[0],f=!h.trim(),p=0;if(this.options.pedantic?(p=2,u=h.trimStart()):f?p=t[1].length+1:(p=t[2].search(this.rules.other.nonSpaceChar),p=p>4?1:p,u=h.slice(p),p+=t[1].length),f&&this.rules.other.blankLine.test(m)&&(d+=m+`
1641`,e=e.substring(m.length+1),c=!0),!c){const x=this.rules.other.nextBulletRegex(p),b=this.rules.other.hrRegex(p),y=this.rules.other.fencesBeginRegex(p),w=this.rules.other.headingBeginRegex(p),j=this.rules.other.htmlBeginRegex(p);for(;e;){const N=e.split(`
1642`,1)[0];let _;if(m=N,this.options.pedantic?(m=m.replace(this.rules.other.listReplaceNesting,"  "),_=m):_=m.replace(this.rules.other.tabCharGlobal,"    "),y.test(m)||w.test(m)||j.test(m)||x.test(m)||b.test(m))break;if(_.search(this.rules.other.nonSpaceChar)>=p||!m.trim())u+=`
1643`+_.slice(p);else{if(f||h.replace(this.rules.other.tabCharGlobal,"    ").search(this.rules.other.nonSpaceChar)>=4||y.test(h)||w.test(h)||b.test(h))break;u+=`
1644`+m}!f&&!m.trim()&&(f=!0),d+=N+`
1645`,e=e.substring(N.length+1),h=_.slice(p)}}a.loose||(o?a.loose=!0:this.rules.other.doubleBlankLine.test(d)&&(o=!0));let A=null,v;this.options.gfm&&(A=this.rules.other.listIsTask.exec(u),A&&(v=A[0]!=="[ ] ",u=u.replace(this.rules.other.listReplaceTask,""))),a.items.push({type:"list_item",raw:d,task:!!A,checked:v,loose:!1,text:u,tokens:[]}),a.raw+=d}const l=a.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;a.raw=a.raw.trimEnd();for(let c=0;c<a.items.length;c++)if(this.lexer.state.top=!1,a.items[c].tokens=this.lexer.blockTokens(a.items[c].text,[]),!a.loose){const d=a.items[c].tokens.filter(h=>h.type==="space"),u=d.length>0&&d.some(h=>this.rules.other.anyLine.test(h.raw));a.loose=u}if(a.loose)for(let c=0;c<a.items.length;c++)a.items[c].loose=!0;return a}}html(e){const t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(e){const t=this.rules.block.def.exec(e);if(t){const r=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),s=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",a=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:r,raw:t[0],href:s,title:a}}}table(e){var o;const t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;const r=Kz(t[1]),s=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),a=(o=t[3])!=null&&o.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
1646`):[],i={type:"table",raw:t[0],header:[],align:[],rows:[]};if(r.length===s.length){for(const l of s)this.rules.other.tableAlignRight.test(l)?i.align.push("right"):this.rules.other.tableAlignCenter.test(l)?i.align.push("center"):this.rules.other.tableAlignLeft.test(l)?i.align.push("left"):i.align.push(null);for(let l=0;l<r.length;l++)i.header.push({text:r[l],tokens:this.lexer.inline(r[l]),header:!0,align:i.align[l]});for(const l of a)i.rows.push(Kz(l,i.header.length).map((c,d)=>({text:c,tokens:this.lexer.inline(c),header:!1,align:i.align[d]})));return i}}lheading(e){const t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){const t=this.rules.block.paragraph.exec(e);if(t){const r=t[1].charAt(t[1].length-1)===`
1647`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:r,tokens:this.lexer.inline(r)}}}text(e){const t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){const t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){const t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const r=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;const i=Lx(r.slice(0,-1),"\\");if((r.length-i.length)%2===0)return}else{const i=but(t[2],"()");if(i===-2)return;if(i>-1){const l=(t[0].indexOf("!")===0?5:4)+t[1].length+i;t[2]=t[2].substring(0,i),t[0]=t[0].substring(0,l).trim(),t[3]=""}}let s=t[2],a="";if(this.options.pedantic){const i=this.rules.other.pedanticHrefTitle.exec(s);i&&(s=i[1],a=i[3])}else a=t[3]?t[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?s=s.slice(1):s=s.slice(1,-1)),Wz(t,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:a&&a.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let r;if((r=this.rules.inline.reflink.exec(e))||(r=this.rules.inline.nolink.exec(e))){const s=(r[2]||r[1]).replace(this.rules.other.multipleSpaceGlobal," "),a=t[s.toLowerCase()];if(!a){const i=r[0].charAt(0);return{type:"text",raw:i,text:i}}return Wz(r,a,r[0],this.lexer,this.rules)}}emStrong(e,t,r=""){let s=this.rules.inline.emStrongLDelim.exec(e);if(!s||s[3]&&r.match(this.rules.other.unicodeAlphaNumeric))return;if(!(s[1]||s[2]||"")||!r||this.rules.inline.punctuation.exec(r)){const i=[...s[0]].length-1;let o,l,c=i,d=0;const u=s[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,t=t.slice(-1*e.length+i);(s=u.exec(t))!=null;){if(o=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!o)continue;if(l=[...o].length,s[3]||s[4]){c+=l;continue}else if((s[5]||s[6])&&i%3&&!((i+l)%3)){d+=l;continue}if(c-=l,c>0)continue;l=Math.min(l,l+c+d);const h=[...s[0]][0].length,m=e.slice(0,i+s.index+h+l);if(Math.min(i,l)%2){const p=m.slice(1,-1);return{type:"em",raw:m,text:p,tokens:this.lexer.inlineTokens(p)}}const f=m.slice(2,-2);return{type:"strong",raw:m,text:f,tokens:this.lexer.inlineTokens(f)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let r=t[2].replace(this.rules.other.newLineCharGlobal," ");const s=this.rules.other.nonSpaceChar.test(r),a=this.rules.other.startingSpaceChar.test(r)&&this.rules.other.endingSpaceChar.test(r);return s&&a&&(r=r.substring(1,r.length-1)),{type:"codespan",raw:t[0],text:r}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){const t=this.rules.inline.autolink.exec(e);if(t){let r,s;return t[2]==="@"?(r=t[1],s="mailto:"+r):(r=t[1],s=r),{type:"link",raw:t[0],text:r,href:s,tokens:[{type:"text",raw:r,text:r}]}}}url(e){var r;let t;if(t=this.rules.inline.url.exec(e)){let s,a;if(t[2]==="@")s=t[0],a="mailto:"+s;else{let i;do i=t[0],t[0]=((r=this.rules.inline._backpedal.exec(t[0]))==null?void 0:r[0])??"";while(i!==t[0]);s=t[0],t[1]==="www."?a="http://"+t[0]:a=t[0]}return{type:"link",raw:t[0],text:s,href:a,tokens:[{type:"text",raw:s,text:s}]}}}inlineText(e){const t=this.rules.inline.text.exec(e);if(t){const r=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:r}}}},fu=class LP{constructor(t){Yt(this,"tokens");Yt(this,"options");Yt(this,"state");Yt(this,"tokenizer");Yt(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=t||dp,this.options.tokenizer=this.options.tokenizer||new A_,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const r={other:Vi,block:nj.normal,inline:Fx.normal};this.options.pedantic?(r.block=nj.pedantic,r.inline=Fx.pedantic):this.options.gfm&&(r.block=nj.gfm,this.options.breaks?r.inline=Fx.breaks:r.inline=Fx.gfm),this.tokenizer.rules=r}static get rules(){return{block:nj,inline:Fx}}static lex(t,r){return new LP(r).lex(t)}static lexInline(t,r){return new LP(r).inlineTokens(t)}lex(t){t=t.replace(Vi.carriageReturn,`
1648`),this.blockTokens(t,this.tokens);for(let r=0;r<this.inlineQueue.length;r++){const s=this.inlineQueue[r];this.inlineTokens(s.src,s.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,r=[],s=!1){var a,i,o;for(this.options.pedantic&&(t=t.replace(Vi.tabCharGlobal,"    ").replace(Vi.spaceLine,""));t;){let l;if((i=(a=this.options.extensions)==null?void 0:a.block)!=null&&i.some(d=>(l=d.call({lexer:this},t,r))?(t=t.substring(l.raw.length),r.push(l),!0):!1))continue;if(l=this.tokenizer.space(t)){t=t.substring(l.raw.length);const d=r.at(-1);l.raw.length===1&&d!==void 0?d.raw+=`
1649`:r.push(l);continue}if(l=this.tokenizer.code(t)){t=t.substring(l.raw.length);const d=r.at(-1);(d==null?void 0:d.type)==="paragraph"||(d==null?void 0:d.type)==="text"?(d.raw+=`
1650`+l.raw,d.text+=`
1651`+l.text,this.inlineQueue.at(-1).src=d.text):r.push(l);continue}if(l=this.tokenizer.fences(t)){t=t.substring(l.raw.length),r.push(l);continue}if(l=this.tokenizer.heading(t)){t=t.substring(l.raw.length),r.push(l);continue}if(l=this.tokenizer.hr(t)){t=t.substring(l.raw.length),r.push(l);continue}if(l=this.tokenizer.blockquote(t)){t=t.substring(l.raw.length),r.push(l);continue}if(l=this.tokenizer.list(t)){t=t.substring(l.raw.length),r.push(l);continue}if(l=this.tokenizer.html(t)){t=t.substring(l.raw.length),r.push(l);continue}if(l=this.tokenizer.def(t)){t=t.substring(l.raw.length);const d=r.at(-1);(d==null?void 0:d.type)==="paragraph"||(d==null?void 0:d.type)==="text"?(d.raw+=`
1652`+l.raw,d.text+=`
1653`+l.raw,this.inlineQueue.at(-1).src=d.text):this.tokens.links[l.tag]||(this.tokens.links[l.tag]={href:l.href,title:l.title});continue}if(l=this.tokenizer.table(t)){t=t.substring(l.raw.length),r.push(l);continue}if(l=this.tokenizer.lheading(t)){t=t.substring(l.raw.length),r.push(l);continue}let c=t;if((o=this.options.extensions)!=null&&o.startBlock){let d=1/0;const u=t.slice(1);let h;this.options.extensions.startBlock.forEach(m=>{h=m.call({lexer:this},u),typeof h=="number"&&h>=0&&(d=Math.min(d,h))}),d<1/0&&d>=0&&(c=t.substring(0,d+1))}if(this.state.top&&(l=this.tokenizer.paragraph(c))){const d=r.at(-1);s&&(d==null?void 0:d.type)==="paragraph"?(d.raw+=`
1654`+l.raw,d.text+=`
1655`+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=d.text):r.push(l),s=c.length!==t.length,t=t.substring(l.raw.length);continue}if(l=this.tokenizer.text(t)){t=t.substring(l.raw.length);const d=r.at(-1);(d==null?void 0:d.type)==="text"?(d.raw+=`
1656`+l.raw,d.text+=`
1657`+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=d.text):r.push(l);continue}if(t){const d="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(d);break}else throw new Error(d)}}return this.state.top=!0,r}inline(t,r=[]){return this.inlineQueue.push({src:t,tokens:r}),r}inlineTokens(t,r=[]){var l,c,d;let s=t,a=null;if(this.tokens.links){const u=Object.keys(this.tokens.links);if(u.length>0)for(;(a=this.tokenizer.rules.inline.reflinkSearch.exec(s))!=null;)u.includes(a[0].slice(a[0].lastIndexOf("[")+1,-1))&&(s=s.slice(0,a.index)+"["+"a".repeat(a[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(a=this.tokenizer.rules.inline.anyPunctuation.exec(s))!=null;)s=s.slice(0,a.index)+"++"+s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(a=this.tokenizer.rules.inline.blockSkip.exec(s))!=null;)s=s.slice(0,a.index)+"["+"a".repeat(a[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let i=!1,o="";for(;t;){i||(o=""),i=!1;let u;if((c=(l=this.options.extensions)==null?void 0:l.inline)!=null&&c.some(m=>(u=m.call({lexer:this},t,r))?(t=t.substring(u.raw.length),r.push(u),!0):!1))continue;if(u=this.tokenizer.escape(t)){t=t.substring(u.raw.length),r.push(u);continue}if(u=this.tokenizer.tag(t)){t=t.substring(u.raw.length),r.push(u);continue}if(u=this.tokenizer.link(t)){t=t.substring(u.raw.length),r.push(u);continue}if(u=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(u.raw.length);const m=r.at(-1);u.type==="text"&&(m==null?void 0:m.type)==="text"?(m.raw+=u.raw,m.text+=u.text):r.push(u);continue}if(u=this.tokenizer.emStrong(t,s,o)){t=t.substring(u.raw.length),r.push(u);continue}if(u=this.tokenizer.codespan(t)){t=t.substring(u.raw.length),r.push(u);continue}if(u=this.tokenizer.br(t)){t=t.substring(u.raw.length),r.push(u);continue}if(u=this.tokenizer.del(t)){t=t.substring(u.raw.length),r.push(u);continue}if(u=this.tokenizer.autolink(t)){t=t.substring(u.raw.length),r.push(u);continue}if(!this.state.inLink&&(u=this.tokenizer.url(t))){t=t.substring(u.raw.length),r.push(u);continue}let h=t;if((d=this.options.extensions)!=null&&d.startInline){let m=1/0;const f=t.slice(1);let p;this.options.extensions.startInline.forEach(A=>{p=A.call({lexer:this},f),typeof p=="number"&&p>=0&&(m=Math.min(m,p))}),m<1/0&&m>=0&&(h=t.substring(0,m+1))}if(u=this.tokenizer.inlineText(h)){t=t.substring(u.raw.length),u.raw.slice(-1)!=="_"&&(o=u.raw.slice(-1)),i=!0;const m=r.at(-1);(m==null?void 0:m.type)==="text"?(m.raw+=u.raw,m.text+=u.text):r.push(u);continue}if(t){const m="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(m);break}else throw new Error(m)}}return r}},g_=class{constructor(e){Yt(this,"options");Yt(this,"parser");this.options=e||dp}space(e){return""}code({text:e,lang:t,escaped:r}){var i;const s=(i=(t||"").match(Vi.notSpaceStart))==null?void 0:i[0],a=e.replace(Vi.endingNewline,"")+`
1658`;return s?'<pre><code class="language-'+Wc(s)+'">'+(r?a:Wc(a,!0))+`</code></pre>
1659`:"<pre><code>"+(r?a:Wc(a,!0))+`</code></pre>
1660`}blockquote({tokens:e}){return`<blockquote>
1661${this.parser.parse(e)}</blockquote>
1662`}html({text:e}){return e}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
1663`}hr(e){return`<hr>
1664`}list(e){const t=e.ordered,r=e.start;let s="";for(let o=0;o<e.items.length;o++){const l=e.items[o];s+=this.listitem(l)}const a=t?"ol":"ul",i=t&&r!==1?' start="'+r+'"':"";return"<"+a+i+`>
1665`+s+"</"+a+`>
1666`}listitem(e){var r;let t="";if(e.task){const s=this.checkbox({checked:!!e.checked});e.loose?((r=e.tokens[0])==null?void 0:r.type)==="paragraph"?(e.tokens[0].text=s+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type==="text"&&(e.tokens[0].tokens[0].text=s+" "+Wc(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:"text",raw:s+" ",text:s+" ",escaped:!0}):t+=s+" "}return t+=this.parser.parse(e.tokens,!!e.loose),`<li>${t}</li>
1667`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
1668`}table(e){let t="",r="";for(let a=0;a<e.header.length;a++)r+=this.tablecell(e.header[a]);t+=this.tablerow({text:r});let s="";for(let a=0;a<e.rows.length;a++){const i=e.rows[a];r="";for(let o=0;o<i.length;o++)r+=this.tablecell(i[o]);s+=this.tablerow({text:r})}return s&&(s=`<tbody>${s}</tbody>`),`<table>
1669<thead>
1670`+t+`</thead>
1671`+s+`</table>
1672`}tablerow({text:e}){return`<tr>
1673${e}</tr>
1674`}tablecell(e){const t=this.parser.parseInline(e.tokens),r=e.header?"th":"td";return(e.align?`<${r} align="${e.align}">`:`<${r}>`)+t+`</${r}>
1675`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${Wc(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:r}){const s=this.parser.parseInline(r),a=qz(e);if(a===null)return s;e=a;let i='<a href="'+e+'"';return t&&(i+=' title="'+Wc(t)+'"'),i+=">"+s+"</a>",i}image({href:e,title:t,text:r,tokens:s}){s&&(r=this.parser.parseInline(s,this.parser.textRenderer));const a=qz(e);if(a===null)return Wc(r);e=a;let i=`<img src="${e}" alt="${r}"`;return t&&(i+=` title="${Wc(t)}"`),i+=">",i}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:Wc(e.text)}},X6=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}},mu=class DP{constructor(t){Yt(this,"options");Yt(this,"renderer");Yt(this,"textRenderer");this.options=t||dp,this.options.renderer=this.options.renderer||new g_,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new X6}static parse(t,r){return new DP(r).parse(t)}static parseInline(t,r){return new DP(r).parseInline(t)}parse(t,r=!0){var a,i;let s="";for(let o=0;o<t.length;o++){const l=t[o];if((i=(a=this.options.extensions)==null?void 0:a.renderers)!=null&&i[l.type]){const d=l,u=this.options.extensions.renderers[d.type].call({parser:this},d);if(u!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(d.type)){s+=u||"";continue}}const c=l;switch(c.type){case"space":{s+=this.renderer.space(c);continue}case"hr":{s+=this.renderer.hr(c);continue}case"heading":{s+=this.renderer.heading(c);continue}case"code":{s+=this.renderer.code(c);continue}case"table":{s+=this.renderer.table(c);continue}case"blockquote":{s+=this.renderer.blockquote(c);continue}case"list":{s+=this.renderer.list(c);continue}case"html":{s+=this.renderer.html(c);continue}case"paragraph":{s+=this.renderer.paragraph(c);continue}case"text":{let d=c,u=this.renderer.text(d);for(;o+1<t.length&&t[o+1].type==="text";)d=t[++o],u+=`
1676`+this.renderer.text(d);r?s+=this.renderer.paragraph({type:"paragraph",raw:u,text:u,tokens:[{type:"text",raw:u,text:u,escaped:!0}]}):s+=u;continue}default:{const d='Token with "'+c.type+'" type was not found.';if(this.options.silent)return console.error(d),"";throw new Error(d)}}}return s}parseInline(t,r=this.renderer){var a,i;let s="";for(let o=0;o<t.length;o++){const l=t[o];if((i=(a=this.options.extensions)==null?void 0:a.renderers)!=null&&i[l.type]){const d=this.options.extensions.renderers[l.type].call({parser:this},l);if(d!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(l.type)){s+=d||"";continue}}const c=l;switch(c.type){case"escape":{s+=r.text(c);break}case"html":{s+=r.html(c);break}case"link":{s+=r.link(c);break}case"image":{s+=r.image(c);break}case"strong":{s+=r.strong(c);break}case"em":{s+=r.em(c);break}case"codespan":{s+=r.codespan(c);break}case"br":{s+=r.br(c);break}case"del":{s+=r.del(c);break}case"text":{s+=r.text(c);break}default:{const d='Token with "'+c.type+'" type was not found.';if(this.options.silent)return console.error(d),"";throw new Error(d)}}}return s}},V4,Vj=(V4=class{constructor(e){Yt(this,"options");Yt(this,"block");this.options=e||dp}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}provideLexer(){return this.block?fu.lex:fu.lexInline}provideParser(){return this.block?mu.parse:mu.parseInline}},Yt(V4,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"])),V4),wut=class{constructor(...e){Yt(this,"defaults",z6());Yt(this,"options",this.setOptions);Yt(this,"parse",this.parseMarkdown(!0));Yt(this,"parseInline",this.parseMarkdown(!1));Yt(this,"Parser",mu);Yt(this,"Renderer",g_);Yt(this,"TextRenderer",X6);Yt(this,"Lexer",fu);Yt(this,"Tokenizer",A_);Yt(this,"Hooks",Vj);this.use(...e)}walkTokens(e,t){var s,a;let r=[];for(const i of e)switch(r=r.concat(t.call(this,i)),i.type){case"table":{const o=i;for(const l of o.header)r=r.concat(this.walkTokens(l.tokens,t));for(const l of o.rows)for(const c of l)r=r.concat(this.walkTokens(c.tokens,t));break}case"list":{const o=i;r=r.concat(this.walkTokens(o.items,t));break}default:{const o=i;(a=(s=this.defaults.extensions)==null?void 0:s.childTokens)!=null&&a[o.type]?this.defaults.extensions.childTokens[o.type].forEach(l=>{const c=o[l].flat(1/0);r=r.concat(this.walkTokens(c,t))}):o.tokens&&(r=r.concat(this.walkTokens(o.tokens,t)))}}return r}use(...e){const t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(r=>{const s={...r};if(s.async=this.defaults.async||s.async||!1,r.extensions&&(r.extensions.forEach(a=>{if(!a.name)throw new Error("extension name required");if("renderer"in a){const i=t.renderers[a.name];i?t.renderers[a.name]=function(...o){let l=a.renderer.apply(this,o);return l===!1&&(l=i.apply(this,o)),l}:t.renderers[a.name]=a.renderer}
vendor: 4,073 bytes, lines 1676-1677
1676if("tokenizer"in a){if(!a.level||a.level!=="block"&&a.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const i=t[a.level];i?i.unshift(a.tokenizer):t[a.level]=[a.tokenizer],a.start&&(a.level==="block"?t.startBlock?t.startBlock.push(a.start):t.startBlock=[a.start]:a.level==="inline"&&(t.startInline?t.startInline.push(a.start):t.startInline=[a.start]))}"childTokens"in a&&a.childTokens&&(t.childTokens[a.name]=a.childTokens)}),s.extensions=t),r.renderer){const a=this.defaults.renderer||new g_(this.defaults);for(const i in r.renderer){if(!(i in a))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;const o=i,l=r.renderer[o],c=a[o];a[o]=(...d)=>{let u=l.apply(a,d);return u===!1&&(u=c.apply(a,d)),u||""}}s.renderer=a}if(r.tokenizer){const a=this.defaults.tokenizer||new A_(this.defaults);for(const i in r.tokenizer){if(!(i in a))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;const o=i,l=r.tokenizer[o],c=a[o];a[o]=(...d)=>{let u=l.apply(a,d);return u===!1&&(u=c.apply(a,d)),u}}s.tokenizer=a}if(r.hooks){const a=this.defaults.hooks||new Vj;for(const i in r.hooks){if(!(i in a))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;const o=i,l=r.hooks[o],c=a[o];Vj.passThroughHooks.has(i)?a[o]=d=>{if(this.defaults.async)return Promise.resolve(l.call(a,d)).then(h=>c.call(a,h));const u=l.call(a,d);return c.call(a,u)}:a[o]=(...d)=>{let u=l.apply(a,d);return u===!1&&(u=c.apply(a,d)),u}}s.hooks=a}if(r.walkTokens){const a=this.defaults.walkTokens,i=r.walkTokens;s.walkTokens=function(o){let l=[];return l.push(i.call(this,o)),a&&(l=l.concat(a.call(this,o))),l}}this.defaults={...this.defaults,...s}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return fu.lex(e,t??this.defaults)}parser(e,t){return mu.parse(e,t??this.defaults)}parseMarkdown(e){return(r,s)=>{const a={...s},i={...this.defaults,...a},o=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&a.async===!1)return o(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof r>"u"||r===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof r!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(r)+", string expected"));i.hooks&&(i.hooks.options=i,i.hooks.block=e);const l=i.hooks?i.hooks.provideLexer():e?fu.lex:fu.lexInline,c=i.hooks?i.hooks.provideParser():e?mu.parse:mu.parseInline;if(i.async)return Promise.resolve(i.hooks?i.hooks.preprocess(r):r).then(d=>l(d,i)).then(d=>i.hooks?i.hooks.processAllTokens(d):d).then(d=>i.walkTokens?Promise.all(this.walkTokens(d,i.walkTokens)).then(()=>d):d).then(d=>c(d,i)).then(d=>i.hooks?i.hooks.postprocess(d):d).catch(o);try{i.hooks&&(r=i.hooks.preprocess(r));let d=l(r,i);i.hooks&&(d=i.hooks.processAllTokens(d)),i.walkTokens&&this.walkTokens(d,i.walkTokens);let u=c(d,i);return i.hooks&&(u=i.hooks.postprocess(u)),u}catch(d){return o(d)}}}onError(e,t){return r=>{if(r.message+=`
1677Please report this to https://github.com/markedjs/marked.`,e){const s="<p>An error occurred:</p><pre>"+Wc(r.message+"",!0)+"</pre>";return t?Promise.resolve(s):s}if(t)return Promise.reject(r);throw r}}},Wm=new wut;function bn(e,t){return Wm.parse(e,t)}bn.options=bn.setOptions=function(e){return Wm.setOptions(e),bn.defaults=Wm.defaults,Kae(bn.defaults),bn};bn.getDefaults=z6;bn.defaults=dp;bn.use=function(...e){return Wm.use(...e),bn.defaults=Wm.defaults,Kae(bn.defaults),bn};bn.walkTokens=function(e,t){return Wm.walkTokens(e,t)};bn.parseInline=Wm.parseInline;bn.Parser=mu;bn.parser=mu.parse;bn.Renderer=g_;bn.TextRenderer=X6;bn.Lexer=fu;bn.lexer=fu.lex;bn.Tokenizer=A_;bn.Hooks=Vj;bn.parse=bn;bn.options;bn.setOptions;bn.use;bn.walkTokens;bn.parseInline;mu.parse;fu.lex;function Dv({text:e,className:t,variant:r="default",labelText:s,children:a}){const[i,o]=g.useState(!1),{toast:l}=sn(),c=async()=>
1677{await navigator.clipboard.writeText(e),o(!0),l({description:"Copied to clipboard",duration:2e3}),setTimeout(()=>o(!1),2e3)};return r==="inline"?n.jsxs("div",{className:ye("flex items-center justify-between p-2 rounded-md group","bg-slate-50 dark:bg-slate-800 border border-slate-200 dark:border-slate-700","hover:bg-slate-100 dark:hover:bg-slate-700 transition-colors cursor-pointer",t),onClick:c,children:[n.jsx("span",{className:"text-sm text-slate-700 dark:text-slate-100",children:a||e}),n.jsx("span",{className:"text-slate-500 dark:text-slate-400",children:i?n.jsx(di,{className:"h-4 w-4"}):n.jsx(Cn,{className:"h-4 w-4"})})]}):r==="ghost"?n.jsx(te,{variant:"ghost",size:"sm",onClick:c,className:ye("opacity-0 group-hover:opacity-100 bg-white/80 hover:bg-white dark:bg-slate-800/80 dark:hover:bg-slate-800",t),children:i?n.jsx(di,{className:"h-4 w-4 text-green-600 dark:text-green-400"}):n.jsx(Cn,{className:"h-4 w-4 text-slate-600 dark:text-slate-300"})}):r==="button"?n.jsxs(te,{variant:"outline",size:"sm",onClick:c,className:ye("flex items-center gap-2 bg-white dark:bg-slate-900",t),children:[i?n.jsx(di,{className:"h-4 w-4 text-green-600 dark:text-green-400"}):n.jsx(Cn,{className:"h-4 w-4 text-slate-600 dark:text-slate-300"}),s||(i?"Copied!":"Copy")]}):n.jsxs("div",{className:ye("group cursor-pointer",t),onClick:c,children:[n.jsx("div",{className:"absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity",children:n.jsx(te,{variant:"ghost",size:"sm",className:"bg-white/80 hover:bg-white dark:bg-slate-800/80 dark:hover:bg-slate-700 text-slate-700 dark:text-slate-200",children:i?n.jsx(di,{className:"h-4 w-4 text-green-600 dark:text-green-400"}):n.jsx(Cn,{className:"h-4 w-4"})})}),a||e]})}const aie=({content:e})=>{console.log("BlogPostRenderer - Rendering blog post:",e.name);const{title:t,content_sections:r=[],bonus_metadata:s={},image_url:a,ideal_media_description:i}=e.content_json,{excerpt:o,tags:l=[],author:c,call_to_action:d,reading_time:u="5 min read",published_date:h=new Date().toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}=s,m=p=>p?bn.parse(p):"",f=()=>r.map(p=>(p.heading?`${p.heading}
1678
1679`:"")+(p.content||"")).join(`
1680
1681`);return n.jsx(QS,{brandId:e.brand_id,contentType:"blog-post",children:n.jsxs("div",{className:"w-full h-full overflow-auto bg-white dark:bg-gray-900",children:[n.jsx("div",{style:{background:"linear-gradient(to bottom right, var(--brand-primary, #3b82f6), var(--brand-secondary, #10b981))",paddingTop:"var(--spacing-lg, var(--brand-spacing-lg, 3rem))",paddingBottom:"var(--spacing-lg, var(--brand-spacing-lg, 3rem))",paddingLeft:"var(--spacing-md, var(--brand-spacing-md, 1rem))",paddingRight:"var(--spacing-md, var(--brand-spacing-md, 1rem))"},className:"text-white",children:n.jsxs("div",{className:"max-w-4xl mx-auto",children:[n.jsxs("div",{className:"group relative mb-4",children:[n.jsx("h1",{style:{fontFamily:"var(--font-heading, var(--brand-font-heading, var(--brand-font-primary, inherit)))",fontSize:"var(--text-4xl, 2.25rem)",fontWeight:"var(--font-weight-bold, 700)"},children:t}),n.jsx("div",{className:"absolute top-0 right-0",children:n.jsx(Dv,{text:t,variant:"ghost",className:"opacity-0 group-hover:opacity-100 transition-opacity"})})]}),o&&n.jsxs("div",{className:"group relative mb-6",children:[n.jsx("p",{style:{fontSize:"var(--text-xl, 1.25rem)",fontFamily:"var(--font-body, var(--brand-font-primary, inherit))"},children:o}),n.jsx("div",{className:"absolute top-0 right-0",children:n.jsx(Dv,{text:o,variant:"ghost",className:"opacity-0 group-hover:opacity-100 transition-opacity"})})]}),n.jsxs("div",{className:"flex flex-wrap items-center gap-4 text-sm opacity-90",children:[c&&n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx(li,{className:"h-4 w-4"}),n.jsx("span",{children:c})]}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx(gK,{className:"h-4 w-4"}),n.jsx("span",{children:h})]}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx(Vr,{className:"h-4 w-4"}),n.jsx("span",{children:u})]})]})]})}),a&&n.jsx("div",{className:"w-full",children:n.jsx("img",{src:a,alt:t||"Blog post header image",className:"w-full max-h-96 object-cover",title:i||void 0})}),n.jsxs("article",{style:{fontFamily:"var(--font-body, var(--brand-font-primary, inherit))"},className:"max-w-4xl mx-auto p-6",children:[l&&l.length>0&&n.jsxs("div",{className:"flex flex-wrap gap-2 mb-8 mt-2",children:[n.jsx(jB,{className:"h-5 w-5 text-gray-500 mr-1"}),l.map((p,A)=>n.jsx("span",{style:{backgroundColor:"color-mix(in srgb, var(--brand-primary, #3b82f6) 10%, white)",color:"var(--brand-primary, #3b82f6)",borderRadius:"var(--border-radius-md, var(--brand-radius-md, 0.25rem))"},className:"px-3 py-1 text-sm",children:p},A))]}),n.jsxs("div",{className:"group relative",children:[n.jsx("div",{className:"absolute top-0 right-0 z-10",children:n.jsx(Dv,{text:f(),variant:"ghost",className:"opacity-0 group-hover:opacity-100 transition-opacity"})}),n.jsxs("div",{style:{color:"var(--text-primary-light, #212121)"},className:"prose prose-lg max-w-none dark:prose-invert",children:[r.map((p,A)=>n.jsxs("div",{className:"mb-8",children:[p.heading&&n.jsx("h2",{style:{fontFamily:"var(--font-heading, var(--brand-font-heading, var(--brand-font-primary, inherit)))",color:"var(--text-primary-light, #212121)"},className:"text-2xl font-bold mt-8 mb-4",children:p.heading}),n.jsx("div",{dangerouslySetInnerHTML:{__html:m(p.content||"")}})]},A)),d&&n.jsx("div",{style:{backgroundColor:"color-mix(in srgb, var(--brand-primary, #3b82f6) 10%, white)",borderRadius:"var(--border-radius-lg, var(--brand-radius-lg, 0.5rem))",padding:"var(--spacing-md, var(--brand-spacing-md, 1rem))"},className:"mt-12",children:n.jsx("p",{style:{color:"var(--brand-primary, #3b82f6)"},className:"font-medium",children:d})})]})]})]})]})})};function jut(){const{brandId:e,postId:t}=Ei(),{selectedBrand:r}=mn(),[s,a]=g.useState(null),[i,o]=g.useState(!0),[l,c]=g.useState(null),d=e||(r==null?void 0:r.id);return g.useEffect(()=>{async function u(){if(!d||!t){c("Missing brand ID or post ID"),o(!1);return}try{o(!0),c(null);const{data:h,error:m}=await de.from("content_management_view").select("*").eq("id",t).eq("brand_id",d).eq("content_type","blog_post").eq("display_status","PUBLISHED").single();if(m)throw m;if(!h){c("Blog post not found");return}const f={id:h.id,campaign_id:h.campaign_id,brand_id:h.brand_id,content_type:h.content_type,current_version:h.current_version,content_json:h.content_json||{},name:h.name,status:h.content_status,created_at:h.created_at,updated_at:h.updated_at,campaigns:null,convergence:null};a(f)}catch(h){console.error("Error fetching blog post:",h),c(h instanceof Error?h.message:"An unknown error occurred")}finally{o(!1)}}u()},[d,t]),d?n.jsxs("div",{className:"min-h-screen",children:[n.jsx("div",{className:"container mx-auto py-4",children:n.jsxs(Ir,{to:`/brands/${d}/blog`,className:"inline-flex items-center text-sm text-primary hover:text-primary/80 transition-colors",children:[n.jsx(Yo,{className:"mr-2 h-4 w-4"}),"Back to Blog Posts"]})}),i?n.jsx("div",{className:"flex justify-center items-center py-16",children:n.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})}):l?n.jsx("div",{className:"container mx-auto py-6",children:n.jsx(Te,{children:n.jsx(Re,{className:"pt-6",children:n.jsxs("p",{className:"text-red-500 text-center",children:["Error loading blog post: ",l]})})})}):s?n.jsx(aie,{content:s}):n.jsx("div",{className:"container mx-auto py-6",children:n.jsx(Te,{children:n.jsx(Re,{className:"pt-6",children:n.jsx("p",{className:"text-muted-foreground text-center",children:"Blog post not found."})})})})]}):n.jsx("div",{className:"container mx-auto py-6",children:n.jsx(Te,{children:n.jsx(Re,{className:"pt-6",children:n.jsx("p",{className:"text-muted-foreground text-center",children:"Please select a brand to view this blog post."})})})})}function Fc(){const e=wa(),{session:t,loading:r}=e,{status:s}=o0(),[a,i]=g.useState(null),[o,l]=g.useState(null),[c,d]=g.useState(!0),[u,h]=g.useState(null),[m,f]=g.useState(null);g.useEffect(()=>{var y,w;console.log("[useCredits] Auth context changed:",{authLoading:r,hasSession:!!t,sessionId:(y=t==null?void 0:t.user)==null?void 0:y.id,hasAccountStatus:!!s,accountId:(w=s==null?void 0:s.personalAccount)==null?void 0:w.id,contextKeys:Object.keys(e)})},[e,r,t,s]);const p=g.useCallback(async()=>{try{const{data:{session:y}}=await de.auth.getSession();if(!y){console.log("[useCredits] No session found"),d(!1);return}const{data:w}=await de.rpc("get_personal_account");if(!(w!=null&&w.account_id)){console.log("[useCredits] No account found"),d(!1);return}console.log("[useCredits] Fetching balance with session:",y.user.id,"account:",w.account_id);const j=Xf(),N=await fetch(`${j}/api/credits/balance`,{method:"GET",headers:{Authorization:`Bearer ${y.access_token}`}});if(!N.ok)throw new Error("Failed to fetch credit balance");const _=await N.json();console.log("[useCredits] Balance fetched:",_),i(_.balance),l(_.usage),h(null)}catch(y){console.error("Error fetching credit balance:",y),h(y)}finally{d(!1)}},[]),A=g.useCallback(async()=>{try{const{data:{session:y}}=await de.auth.getSession();if(!y){console.log("[useCredits] No session found for costs");return}console.log("[useCredits] Fetching costs with session:",y.user.id);const w=Xf(),j=await fetch(`${w}/api/credits/costs`,{method:"GET",headers:{Authorization:`Bearer ${y.access_token}`}});if(!j.ok)throw new Error("Failed to fetch credit costs");const N=await j.json();f(N)}catch(y){console.error("Error fetching credit costs:",y)}},[]),v=g.useCallback(async y=>{try{const{data:{session:w}}=await de.auth.getSession();if(!w)return{transactions:[],total:0};const j=new URLSearchParams;y!=null&&y.limit&&j.append("limit",y.limit.toString()),y!=null&&y.offset&&j.append("offset",y.offset.toString()),y!=null&&y.type&&j.append("type",y.type),y!=null&&y.category&&j.append("category",y.category),y!=null&&y.startDate&&j.append("startDate",y.startDate),y!=null&&y.endDate&&j.append("endDate",y.endDate);const N=Xf(),_=await fetch(`${N}/api/credits/transactions?${j}`,{headers:{Authorization:`Bearer ${w.access_token}`}});if(!_.ok)throw new Error("Failed to fetch transactions");return await _.json()}catch(w){return console.error("Error fetching transactions:",w),{transactions:[],total:0}}},[]),x=g.useCallback(async y=>{const{data:{session:w}}=await de.auth.getSession();if(!w)throw new Error("Not authenticated");const j=Xf(),N=await fetch(`${j}/api/credits/purchase`,{method:"POST",headers:{Authorization:`Bearer ${w.access_token}`,"Content-Type":"application/json"},body:JSON.stringify({credits:y})});if(!N.ok){const S=await N.json();throw new Error(S.error||"Failed to create purchase")}return(await N.json()).checkout_url},[]),b=g.useCallback(async(y="month")=>{try{const{data:{session:w}}=await de.auth.getSession();if(!w)return null;const j=Xf(),N=await fetch(`${j}/api/credits/usage?period=${y}`,{headers:{Authorization:`Bearer ${w.access_token}`}});if(!N.ok)throw new Error("Failed to fetch usage summary");return(await N.json()).summary}catch(w){return console.error("Error fetching usage summary:",w),null}},[]);return g.useEffect(()=>{console.log("[useCredits] Hook initialized, attempting to fetch data..."),A(),p()},[]),g.useEffect(()=>{let y=null;return(async()=>{try{const{data:j}=await de.rpc("get_personal_account");if(!(j!=null&&j.account_id)){console.log("[useCredits] No account ID for real-time subscription");return}console.log("[useCredits] Setting up real-time subscription for account:",j.account_id),y=de.channel(`credit-balance-${j.account_id}`).on("postgres_changes",{event:"*",schema:"basejump",table:"credit_balances",filter:`account_id=eq.${j.account_id}`},()=>{p()}).on("postgres_changes",{event:"INSERT",schema:"basejump",table:"credit_transactions",filter:`account_id=eq.${j.account_id}`},()=>{p()}).subscribe()}catch(j){console.error("[useCredits] Error setting up real-time subscription:",j)}})(),()=>{y&&de.removeChannel(y)}},[p]),{balance:a,usage:o,loading:c,error:u,costs:m,fetchBalance:p,fetchTransactions:v,purchaseCredits:x,getUsageSummary:b}}const iie=["respond_to_user"];function Nut({invocation:e,className:t}){var d,u;const[r,s]=g.useState(!1),a=h=>{switch(h){case"get_recent_posts":return"📝";case"get_convergences":return"🔄";case"get_brand_analytics":return"📊";case"update_brand_info":return"✏️";default:return"🔧"}},i=h=>{switch(h){case"get_recent_posts":return"Retrieving recent posts";case"get_convergences":return"Fetching convergences";case"get_brand_analytics":return"Loading analytics data";case"update_brand_info":return"Updating brand information";default:return`Running ${h}`}},o=()=>
1681{switch(e.status){case"pending":return n.jsx(kt,{className:"h-4 w-4 animate-spin text-blue-500"});case"success":return n.jsx(qt,{className:"h-4 w-4 text-green-500"});case"error":return n.jsx(Rl,{className:"h-4 w-4 text-red-500"});default:return n.jsx(kt,{className:"h-4 w-4 animate-spin text-blue-500"})}},l=()=>{switch(e.status){case"pending":return"Running...";case"success":return"Complete";case"error":return"Failed";default:return"Processing..."}},c=e.result&&Object.keys(e.result).length>0;return n.jsxs(ut.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:ye("bg-muted/50 rounded-lg p-3 my-2 border transition-colors",e.status==="error"&&"border-destructive/50 bg-destructive/10",e.status==="success"&&"border-green-500/20 bg-green-50/50 dark:bg-green-900/10",e.status==="pending"&&"border-blue-500/20 bg-blue-50/50 dark:bg-blue-900/10",t),children:[n.jsxs("div",{className:"flex items-center gap-3 cursor-pointer hover:bg-muted/30 rounded p-1 -m-1 transition-colors",onClick:()=>s(!r),children:[n.jsxs("div",{className:"flex items-center gap-2",children:[o(),n.jsx("span",{className:"text-lg","aria-label":`Tool: ${e.toolName}`,children:a(e.toolName)})]}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-sm font-medium text-foreground",children:i(e.toolName)}),n.jsx("span",{className:ye("text-xs px-2 py-0.5 rounded-full",e.status==="success"&&"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400",e.status==="error"&&"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400",e.status==="pending"&&"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400"),children:l()})]}),e.status==="error"&&((d=e.result)==null?void 0:d.error)&&n.jsx("div",{className:"text-xs text-destructive mt-1",children:e.result.error})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[c&&n.jsx("span",{className:"text-xs text-muted-foreground",children:"View details"}),c?r?n.jsx(Un,{className:"h-4 w-4"}):n.jsx(_s,{className:"h-4 w-4"}):n.jsx("div",{className:"w-4 h-4"})]})]}),n.jsx(qh,{children:r&&c&&n.jsx(ut.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:"overflow-hidden",children:n.jsx("div",{className:"mt-3 pl-9",children:n.jsxs("div",{className:"space-y-3",children:[e.parameters&&Object.keys(e.parameters).length>0&&n.jsxs("div",{children:[n.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-1",children:"Parameters:"}),n.jsx("div",{className:"text-xs font-mono bg-background rounded p-2 border",children:n.jsx("pre",{className:"overflow-x-auto whitespace-pre-wrap",children:JSON.stringify(e.parameters,null,2)})})]}),e.status==="success"&&e.result&&n.jsxs("div",{children:[n.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-1",children:"Result:"}),n.jsx("div",{className:"text-xs bg-background rounded p-2 border",children:typeof e.result=="string"?n.jsx("span",{className:"whitespace-pre-wrap",children:e.result}):n.jsx("pre",{className:"overflow-x-auto whitespace-pre-wrap font-mono",children:JSON.stringify(e.result,null,2)})})]}),e.status==="error"&&((u=e.result)==null?void 0:u.error)&&n.jsxs("div",{children:[n.jsx("div",{className:"text-xs font-medium text-destructive mb-1",children:"Error Details:"}),n.jsx("div",{className:"text-xs bg-destructive/10 rounded p-2 border border-destructive/20",children:e.result.error})]})]})})})})]})}bn.setOptions({breaks:!0,gfm:!0});function _ut({messages:e,isLoading:t=!1,className:r}){const s=g.useRef(null),a=g.useRef(null);g.useEffect(()=>{const d=document.createElement("style");return d.textContent=`
1682      .markdown-content h1, .markdown-content h2, .markdown-content h3, 
1683      .markdown-content h4, .markdown-content h5, .markdown-content h6 {
1684        font-weight: 600;
1685        margin-top: 1rem;
1686        margin-bottom: 0.5rem;
1687        line-height: 1.25;
1688      }
1689      .markdown-content h1 { font-size: 1.125rem; }
1690      .markdown-content h2 { font-size: 1rem; }
1691      .markdown-content h3, .markdown-content h4, .markdown-content h5, .markdown-content h6 { font-size: 0.875rem; }
1692      
1693      .markdown-content p {
1694        margin-bottom: 0.75rem;
1695        line-height: 1.6;
1696      }
1697      
1698      .markdown-content ul, .markdown-content ol {
1699        margin-bottom: 0.75rem;
1700        padding-left: 1.5rem;
1701      }
1702      
1703      .markdown-content li {
1704        margin-bottom: 0.25rem;
1705        line-height: 1.5;
1706      }
1707      
1708      .markdown-content code {
1709        background-color: hsl(var(--muted));
1710        padding: 0.125rem 0.25rem;
1711        border-radius: 0.25rem;
1712        font-size: 0.75rem;
1713        font-family: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
1714      }
1715      
1716      .markdown-content pre {
1717        background-color: hsl(var(--muted));
1718        padding: 0.5rem;
1719        border-radius: 0.25rem;
1720        overflow-x: auto;
1721        margin-bottom: 0.75rem;
1722      }
1723      
1724      .markdown-content pre code {
1725        background: none;
1726        padding: 0;
1727        border-radius: 0;
1728        font-size: 0.75rem;
1729      }
1730      
1731      .markdown-content blockquote {
1732        border-left: 4px solid hsl(var(--muted));
1733        padding-left: 1rem;
1734        font-style: italic;
1735        color: hsl(var(--muted-foreground));
1736        margin-bottom: 0.75rem;
1737      }
1738      
1739      .markdown-content strong {
1740        font-weight: 600;
1741      }
1742      
1743      .markdown-content em {
1744        font-style: italic;
1745      }
1746      
1747      .markdown-content a {
1748        color: hsl(var(--primary));
1749        text-decoration: underline;
1750        text-decoration-color: hsl(var(--primary) / 0.3);
1751      }
1752      
1753      .markdown-content a:hover {
1754        text-decoration-color: hsl(var(--primary);
1755      }
1756      
1757      .dark .markdown-content code {
1758        background-color: hsl(var(--muted));
1759      }
1760      
1761      .dark .markdown-content pre {
1762        background-color: hsl(var(--muted));
1763      }
1764    `,document.head.appendChild(d),()=>{document.head.removeChild(d)}},[]),g.useEffect(()=>{s.current&&s.current.scrollIntoView({behavior:"smooth"})},[e,t]);const i=d=>{switch(d){case"user":return n.jsx(li,{className:"h-4 w-4"});case"assistant":return n.jsx(gu,{className:"h-4 w-4"});case"tool":return n.jsx(SI,{className:"h-4 w-4"});default:return n.jsx(gu,{className:"h-4 w-4"})}},o=d=>d==="user"?"justify-end":"justify-start",l=d=>{switch(d){case"user":return"bg-primary text-primary-foreground ml-12";case"assistant":return"bg-white dark:bg-slate-800 border border-slate-200 dark:border-slate-700 mr-12";case"tool":return"bg-muted/50 border border-border/50 mx-8";default:return"bg-white dark:bg-slate-800 border border-slate-200 dark:border-slate-700 mr-12"}},c=d=>{try{return{__html:bn(d)}}catch(u){return console.error("Error parsing markdown:",u),d.split(`
1765`).map((h,m,f)=>n.jsxs("span",{children:[h,m!==f.length-1&&n.jsx("br",{})]},m))}};return n.jsx(ol,{ref:a,className:ye("flex-1 bg-gradient-to-br from-slate-50 to-white dark:from-slate-900 dark:to-slate-800",r),children:n.jsxs("div",{className:"p-4 space-y-4",children:[e.map(d=>n.jsx(ut.div,{initial:{opacity:0,y:20}
1765,animate:{opacity:1,y:0},transition:{duration:.3,ease:"easeOut"},className:ye("flex",o(d.role)),children:n.jsxs("div",{className:ye("max-w-[85%] rounded-lg shadow-sm",l(d.role)),children:[d.role!=="user"&&n.jsxs("div",{className:"flex items-center gap-2 px-4 pt-3 pb-1",children:[n.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[i(d.role),n.jsx("span",{className:"font-medium",children:d.role==="assistant"?"Brand Consultant":d.role==="tool"?"Tool Execution":"System"}),n.jsx("span",{className:"text-xs",children:new Date(d.timestamp).toLocaleTimeString()})]}),d.creditsUsed&&n.jsx("div",{className:"ml-auto",children:n.jsxs("span",{className:"text-xs bg-primary/10 text-primary px-2 py-0.5 rounded-full",children:[d.creditsUsed," credits"]})})]}),n.jsxs("div",{className:ye("px-4 py-3",d.role!=="user"&&"pt-1"),children:[(()=>{var h;const u=((h=d.toolInvocations)==null?void 0:h.filter(m=>!iie.includes(m.toolName)))||[];return u.length>0&&n.jsx("div",{className:ye("space-y-2",d.content&&"mb-3"),children:u.map((m,f)=>n.jsx(Nut,{invocation:m},`${d.id}-tool-${f}`))})})(),d.content&&n.jsx("div",{className:ye("text-sm leading-relaxed prose prose-sm max-w-none dark:prose-invert",d.role==="user"?"text-primary-foreground":"text-foreground"),children:(()=>{const u=c(d.content);return"__html"in u?n.jsx("div",{dangerouslySetInnerHTML:u,className:"markdown-content"}):u})()})]}),d.role==="user"&&n.jsx("div",{className:"px-4 pb-2",children:n.jsx("div",{className:"text-xs text-primary-foreground/70 text-right",children:new Date(d.timestamp).toLocaleTimeString()})})]})},d.id)),t&&n.jsx(ut.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"flex justify-start",children:n.jsxs("div",{className:"bg-white dark:bg-slate-800 border border-slate-200 dark:border-slate-700 rounded-lg shadow-sm mr-12",children:[n.jsxs("div",{className:"flex items-center gap-2 px-4 pt-3 pb-1",children:[n.jsx(gu,{className:"h-4 w-4 text-muted-foreground"}),n.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Brand Consultant"})]}),n.jsx("div",{className:"px-4 py-3 pt-1",children:n.jsxs(ut.div,{className:"flex items-center gap-2",initial:{opacity:0}
1765,animate:{opacity:1},children:[n.jsx(ut.div,{animate:{y:[0,-4,0]},transition:{duration:1.5,repeat:1/0,ease:"easeInOut"},className:"w-2 h-2 bg-primary rounded-full"}),n.jsx(ut.div,{animate:{y:[0,-4,0]},transition:{duration:1.5,repeat:1/0,ease:"easeInOut",delay:.2},className:"w-2 h-2 bg-primary rounded-full"}),n.jsx(ut.div,{animate:{y:[0,-4,0]},transition:{duration:1.5,repeat:1/0,ease:"easeInOut",delay:.4},className:"w-2 h-2 bg-primary rounded-full"}),n.jsx("span",{className:"text-sm text-muted-foreground ml-2",children:"Thinking..."})]})})]})}),n.jsx("div",{ref:s})]})})}function Cut({onSendMessage:e,isLoading:t,hasAvailableCredits:r,messageCost:s,creditBalance:a,disabled:i=!1,placeholder:o="Ask me anything about your brand strategy, content performance, or marketing insights...",className:l}){const[c,d]=g.useState(""),u=g.useRef(null),h=g.useCallback(async A=>{if(A.preventDefault(),!c.trim()||t||i)return;const v=c.trim();d(""),u.current&&(u.current.style.height="auto"),await e(v)||d(v)},[c,t,i,e]),m=g.useCallback(A=>{A.key==="Enter"&&!A.shiftKey&&(A.preventDefault(),c.trim()&&!t&&!i&&r&&h(A))},[c,t,i,r,h]),f=g.useCallback(A=>{d(A.target.value);const v=A.target;v.style.height="auto",v.style.height=Math.min(v.scrollHeight,120)+"px"},[]),p=!c.trim()||t||i||!r;return n.jsxs("form",{onSubmit:h,className:ye("space-y-3",l),children:[n.jsxs("div",{className:"relative",children:[n.jsx(Zr,{ref:u,value:c,onChange:f,onKeyDown:m,placeholder:o,disabled:t||i,className:ye("min-h-[60
1765px] max-h-[120px] resize-none pr-12","border-slate-200 dark:border-slate-700","focus:border-primary focus:ring-1 focus:ring-primary",!r&&"border-destructive/50 bg-destructive/5"),rows:2}),n.jsx(te,{type:"submit",size:"sm",disabled:p,className:ye("absolute bottom-2 right-2 h-8 w-8 p-0","shadow-sm hover:shadow-md transition-shadow"),children:t?n.jsx(kt,{className:"h-4 w-4 animate-spin"}):n.jsx(Om,{className:"h-4 w-4"})})]}),n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 text-xs text-muted-foreground",children:[n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx(nr,{className:"h-3 w-3"}),n.jsx("span",{className:"hidden sm:inline",children:"Press Enter to send, Shift+Enter for new line"}),n.jsx("span",{className:"sm:hidden",children:"Enter to send"})]}),n.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[n.jsxs("span",{className:ye("px-2 py-1 rounded-full text-xs font-medium whitespace-nowrap",r?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400"),children:[s," credits per message"]}),n.jsxs("span",{className:"text-muted-foreground whitespace-nowrap",children:["Balance: ",a]})]})]}),!r&&n.jsxs("div",{className:"flex items-center gap-2 p-3 bg-destructive/10 border border-destructive/20 rounded-md",children:[n.jsx(nr,{className:"h-4 w-4 text-destructive flex-shrink-0"}),n.jsxs("div",{className:"text-sm text-destructive",children:[n.jsx("span",{className:"font-medium",children:"Insufficient credits."})," ","You need ",s," credits to send a message. Please purchase more credits to continue."]})]})]})}function Sut({messages:e,onSendMessage:t,isLoading:r,hasAvailableCredits:s,messageCost:a,creditBalance:i,brand:o,className:l}){return n.jsxs("div",{className:ye("flex flex-col h-full",l),children:[n.jsx(_ut,{messages:e,isLoading:r,className:"flex-1"}),n.jsx("div",{className:"border-t bg-background p-4",children:n.jsx(Cut,{onSendMessage:t,isLoading:r,hasAvailableCredits:s,messageCost:a,creditBalance:i,placeholder:o?`Ask me anything about ${o.brand_name}'s strategy, performance, or marketing insights...`:"Ask me anything about your brand strategy, content performance, or marketing insights..."})})]})}const sj=5;function kut(e){const[t,r]=g.useState([]),[s,a]=g.useState(!1),[i,o]=g.useState(null),{session:l}=wa(),{balance:c,fetchBalance:d}=Fc(),u=g.useCallback(async x=>{if(l)try{const y=await fetch(`https://worker.rainfactory.ai/rainfactory/brand-consultant/messages/${x}`,{headers:{Authorization:`Bearer ${l.access_token}`,apikey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im9sZ25uZW5jY3F3d2JhaGNwc2duIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MjQxNjUyMDksImV4cCI6MjAzOTc0MTIwOX0.qUa9W4vEYLC7LaUPczpqHA9tp8NSiWB7POqOWEvJpYQ"}});if(y.ok){const j=(await y.json()).messages||[];j.length>0?r(j):h()}else h()}catch(b){console.error("Error loading session messages:",b),h()}},[l]),h=g.useCallback(()=>{r([{id:crypto.randomUUID(),role:"assistant",content:"Hello! I'm your Brand Consultant. I can help you with strategic insights, analyze your brand performance, review your content, and answer questions about your marketing efforts. What would you like to explore today?",timestamp:new Date().toISOString()}])},[]),m=g.useCallback(x=>{r(b=>[...b,x])},[]),f=g.useCallback(()=>{o(null)},[]),p=g.useCallback(async(x,b)=>{if(!l)return o("Authentication required"),He({title:"Authentication Required",description:"Please log in to use the Brand Consultant.",variant:"destructive"}),!1;if(!e)return o("Brand ID required"),He({title:"Brand Required",description:"Please select a brand to use the Brand Consultant.",variant:"destructive"}),!1;if(!c||c.total_credits<sj)return o("Insufficient credits"),He({title:"Insufficient Credits",description:`You need ${sj} credits to send a message. Please purchase more credits.`,variant:"destructive"}),!1;a(!0),o(null);const y={id:crypto.randomUUID(),role:"user",content:x,timestamp:new Date().toISOString()};m(y);try{const j=await fetch("https://worker.rainfactory.ai/rainfactory/brand-consultant/chat",{method:"POST",headers:{Authorization:`Bearer ${l.access_token}`,"Content-Type":"application/json",apikey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im9sZ25uZW5jY3F3d2JhaGNwc2duIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MjQxNjUyMDksImV4cCI6MjAzOTc0MTIwOX0.qUa9W4vEYLC7LaUPczpqHA9tp8NSiWB7POqOWEvJpYQ"},body:JSON.stringify({brandId:e,messages:[...t,y],sessionId:b})});if(!j.ok){let S="Failed to get response from Brand Consultant";try{const C=await j.json();if(S=C.error||S,C.isProviderOutage)return He({title:"Service Temporarily Unavailable",description:"AI service is temporarily unavailable. Please try again later.",variant:"destructive"}),o(S),!1}catch{}throw new Error(S)}const N=await j.json();N.toolInvocations&&N.toolInvocations.length>0&&N.toolInvocations.filter(C=>
1765!iie.includes(C.toolName)).forEach(C=>{const E={id:crypto.randomUUID(),role:"tool",content:`Using tool: ${C.toolName}`,toolInvocations:[C],timestamp:C.timestamp};m(E)});const _={id:crypto.randomUUID(),role:"assistant",content:N.response,timestamp:new Date().toISOString(),creditsUsed:N.creditsUsed};return m(_),await d(),!0}catch(w){const j=w instanceof Error?w.message:"Failed to send message";console.error("Error sending message to Brand Consultant:",w),o(j);const N={id:crypto.randomUUID(),role:"assistant",content:`⚠️ ${j}. Please try again or contact support if the issue persists.`,timestamp:new Date().toISOString()};return m(N),He({title:"Error",description:j,variant:"destructive"}),!1}finally{a(!1)}},[l,e,c,t,m,d]),A=g.useCallback(()=>{r([{id:crypto.randomUUID(),role:"assistant",content:"Hello! I'm your Brand Consultant. I can help you with strategic insights, analyze your brand performance, review your content, and answer questions about your marketing efforts. What would you like to explore today?",timestamp:new Date().toISOString()}]),o(null)},[]),v=c?c.total_credits>=sj:!1;return{messages:t,isLoading:s,error:i,sendMessage:p,addMessage:m,clearError:f,resetConversation:A,loadMessagesFromSession:u,initializeWithWelcomeMessage:h,hasAvailableCredits:v,messageCost:sj,creditBalance:(c==null?void 0:c.total_credits)||0}}function Eut(){const[e,t]=g.useState(null),[r,s]=g.useState(!1),[a,i]=g.useState(null),{session:o}=wa(),l=g.useCallback(async(f,p,A="general")=>{if(!o)return i(new Error("Authentication required")),null;s(!0),i(null);try{const x=await fetch("https://worker.rainfactory.ai/rainfactory/brand-consultant/sessions",{method:"POST",headers:{Authorization:`Bearer ${o.access_token}`,"Content-Type":"application/json",apikey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im9sZ25uZW5jY3F3d2JhaGNwc2duIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MjQxNjUyMDksImV4cCI6MjAzOTc0MTIwOX0.qUa9W4vEYLC7LaUPczpqHA9tp8NSiWB7POqOWEvJpYQ"},body:JSON.stringify({brandId:f,sessionName:p||`Session ${new Date().toLocaleDateString()}`,sessionType:A})});if(!x.ok)throw new Error("Failed to create session");const y=(await x.json()).session;return t(y),localStorage.setItem(`brand-consultant-session-${f}`,y.id),y}catch(v){return console.error("Error creating consultant session:",v),i(v),He({title:"Error",description:"Failed to create consultant session. Please try again.",variant:"destructive"}),null}finally{s(!1)}},[o]),c=g.useCallback(async f=>{if(!o)return i(new Error("Authentication required")),null;s(!0),i(null);try{const p=localStorage.getItem(`brand-consultant-session-${f}`);if(p){const v=await fetch(`https://worker.rainfactory.ai/rainfactory/brand-consultant/sessions/${f}`,{headers:{Authorization:`Bearer ${o.access_token}`,apikey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im9sZ25uZW5jY3F3d2JhaGNwc2duIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MjQxNjUyMDksImV4cCI6MjAzOTc0MTIwOX0.qUa9W4vEYLC7LaUPczpqHA9tp8NSiWB7POqOWEvJpYQ"}});if(v.ok){const y=(await v.json()).sessions.find(w=>w.id===p&&w.status==="active");if(y)return t(y),y}}return await l(f)}catch(p){return console.error("Error loading consultant session:",p),i(p),await l(f)}finally{s(!1)}},[o,l]),d=g.useCallback(async f=>{if(!o)return[];try{const A=await fetch(`https://worker.rainfactory.ai/rainfactory/brand-consultant/messages/${f}`,{headers:{Authorization:`Bearer ${o.access_token}`,apikey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im9sZ25uZW5jY3F3d2JhaGNwc2duIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MjQxNjUyMDksImV4cCI6MjAzOTc0MTIwOX0.qUa9W4vEYLC7LaUPczpqHA9tp8NSiWB7POqOWEvJpYQ"}});if(!A.ok)throw new Error("Failed to load messages");return(await A.json()).messages||[]}catch(p){return console.error("Error loading messages:",p),[]}},[o]),u=g.useCallback(async f=>{if(!o)return[];try{const A=await fetch(`https://worker.rainfactory.ai/rainfactory/brand-consultant/sessions/${f}`,{headers:{Authorization:`Bearer ${o.access_token}`,apikey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im9sZ25uZW5jY3F3d2JhaGNwc2duIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MjQxNjUyMDksImV4cCI6MjAzOTc0MTIwOX0.qUa9W4vEYLC7LaUPczpqHA9tp8NSiWB7POqOWEvJpYQ"}});return A.ok?(await A.json()).sessions||[]:[]}catch(p){return console.error("Error loading sessions:",p),[]}}
1765,[o]),h=g.useCallback(async(f,p)=>{const v=(await u(p)).find(x=>x.id===f);return v?(t(v),localStorage.setItem(`brand-consultant-session-${p}`,f),v):null},[u]),m=g.useCallback(f=>{t(null),localStorage.removeItem(`brand-consultant-session-${f}`)},[]);return{session:e,loading:r,error:a,createSession:l,loadSession:c,loadMessages:d,getAllSessions:u,switchToSession:h,clearSession:m}}function But(){const{id:e}=Ei(),{selectedBrand:t,brands:r,loading:s}=mn();Fc();const[a,i]=g.useState(!1),[o,l]=g.useState([]),c=e&&r.find(P=>P.id===e)||t,{messages:d,isLoading:u,error:h,sendMessage:m,clearError:f,resetConversation:p,loadMessagesFromSession:A,initializeWithWelcomeMessage:v,hasAvailableCredits:x,messageCost:b,creditBalance:y}=kut(c==null?void 0:c.id),{session:w,loading:j,loadSession:N,getAllSessions:_,switchToSession:S,clearSession:C}=Eut();g.useEffect(()=>{c!=null&&c.id&&_(c.id).then(P=>{l(P)})},[c==null?void 0:c.id,_]),g.useEffect(()=>{c!=null&&c.id&&!w&&!j&&(i(!0),N(c.id).then(P=>{P!=null&&P.id?A(P.id):v()}).catch(P=>{console.error("Error loading session:",P),v()}).finally(()=>{i(!1)}))},[c==null?void 0:c.id,w,j,N,A,v]);const E=async P=>c!=null&&c.id?(f(),await m(P,w==null?void 0:w.id)):(He({title:"Brand Required",description:"Please select a brand to use the Brand Consultant.",variant:"destructive"}),!1),T=()=>{p(),c!=null&&c.id&&(C(c.id),N(c.id).then(P=>{P!=null&&P.id&&(v(),_(c.id).then(F=>{l(F)}))})),He({title:"✨ New Session Started",description:"Started a new conversation with your Brand Consultant."})},B=async P=>{if(c!=null&&c.id){i(!0);try{const F=await S(P,c.id);F!=null&&F.id&&(await A(F.id),He({title:"🔄 Session Switched",description:`Switched to session from ${L(F.created_at)}`}))}catch(F){console.error("Error switching session:",F),He({title:"Error",description:"Failed to switch session. Please try again.",variant:"destructive"})}finally{i(!1)}}},L=P=>{const F=new Date(P);return F.toLocaleDateString()+" "+F.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})};return s||a?n.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 via-white to-blue-50/30 relative overflow-hidden",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsx("div",{className:"relative flex items-center justify-center h-full",children:n.jsxs("div",{className:"relative overflow-hidden bg-white/60 backdrop-blur-sm rounded-2xl border border-white/50 shadow-lg p-8",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-blue-50/30 via-transparent to-indigo-50/20"}),n.jsxs("div",{className:"relative text-center space-y-6",children:[n.jsx("div",{className:"p-4 bg-gradient-to-br from-blue-100 to-indigo-200 rounded-2xl inline-block",children:n.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600 mx-auto"})}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-xl font-bold bg-gradient-to-r from-blue-700 to-indigo-700 bg-clip-text text-transparent mb-2",children:"Loading Brand Consultant"}),n.jsx("p",{className:"text-gray-600",children:"Preparing your personalized AI assistant..."})]})]})]})})]}):c?n.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 via-white to-blue-50/30 relative overflow-hidden",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsxs("div",{className:"relative flex flex-col h-full",children:[n.jsxs("div",{className:"relative overflow-hidden bg-gradient-to-br from-white via-blue-50/30 to-indigo-50/40 rounded-2xl border border-blue-200/50 shadow-sm m-6 p-6",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsx("div",{className:"absolute top-0 right-0 w-32 h-32 bg-gradient-to-br from-blue-200/20 to-transparent rounded-full -translate-y-16 translate-x-16"}),n.jsx("div",{className:"relative",children:n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[n.jsxs("div",{className:"flex items-center gap-4",children:[n.jsx("div",{className:"p-3 bg-white/80 backdrop-blur-sm rounded-2xl shadow-lg",children:n.jsx(HR,{className:"h-6 w-6 text-blue-600"})}),n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-bold bg-gradient-to-r from-blue-700 via-indigo-700 to-purple-700 bg-clip-text text-transparent mb-1",children:"Brand Consultant"}),n.jsxs("p",{className:"text-gray-600 leading-relaxed",children:["Strategic insights for ",c.brand_name]})]})]}),n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-4",children:[n.jsxs("div",{className:"relative overflow-hidden bg-white/60 backdrop-blur-sm rounded-xl border border-white/50 shadow-sm p-3",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-yellow-50/30 via-trans
1765parent to-amber-50/20"}),n.jsxs("div",{className:"relative flex items-center gap-3",children:[n.jsx("div",{className:"p-2 bg-gradient-to-br from-yellow-100 to-amber-200 rounded-lg shadow-sm",children:n.jsx(en,{className:"h-4 w-4 text-yellow-600"})}),n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2",children:[n.jsxs("span",{className:"text-sm text-gray-600 hidden sm:inline",children:[b," credits per message"]}),n.jsxs("span",{className:"text-sm text-gray-600 sm:hidden",children:[b," credits/msg"]}),n.jsxs("div",{className:ye("px-3 py-1 rounded-full text-xs font-medium whitespace-nowrap shadow-sm",x?"bg-gradient-to-r from-emerald-100 to-green-200 text-emerald-700 border border-emerald-200/50":"bg-gradient-to-r from-red-100 to-pink-200 text-red-700 border border-red-200/50"),children:["Balance: ",y]})]})]})]}),n.jsxs(ll,{children:[n.jsx(cl,{asChild:!0,children:n.jsxs("div",{className:"group relative overflow-hidden bg-white/60 backdrop-blur-sm rounded-xl border border-white/50 shadow-sm hover:shadow-md transition-all duration-300 hover:scale-105",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-indigo-50/20 via-transparent to-purple-50/20 opacity-0 group-hover:opacity-100 transition-opacity duration-300"}),n.jsxs(te,{variant:"ghost",size:"sm",disabled:u,className:"relative gap-2 w-fit bg-transparent hover:bg-transparent border-0 text-inherit shadow-none p-3",children:[n.jsx("div",{className:"p-1.5 bg-gradient-to-br from-indigo-100 to-purple-200 rounded-lg group-hover:from-indigo-200 group-hover:to-purple-300 transition-all duration-300",children:n.jsx(Vr,{className:"h-4 w-4 text-indigo-600 group-hover:text-indigo-700"})}),n.jsx("span",{className:"hidden sm:inline text-gray-700 group-hover:text-gray-800 font-medium transition-colors duration-300",children:w?L(w.created_at):"Session"}),n.jsx("span",{className:"sm:hidden text-gray-700 group-hover:text-gray-800 font-medium transition-colors duration-300",children:"Session"}),n.jsx(Un,{className:"h-3 w-3 text-gray-500 group-hover:text-gray-600 transition-colors duration-300"})]})]})}),n.jsxs(fo,{align:"end",className:"w-64 bg-white/95 backdrop-blur-sm border border-white/50 shadow-xl",children:[n.jsxs(Fr,{onClick:T,className:"gap-2 hover:bg-gradient-to-r hover:from-blue-50 hover:to-indigo-50 transition-all duration-200",children:[n.jsx(al,{className:"h-4 w-4"}),"New Session"]}),o.length>0&&n.jsxs(n.Fragment,{children:[n.jsx(Mo,{}),o.sort((P,F)=>new Date(F.created_at).getTime()-new Date(P.created_at).getTime()).slice(0,10).map(P=>n.jsxs(Fr,{onClick:()=>B(P.id),className:ye("gap-2 text-sm hover:bg-gradient-to-r hover:from-indigo-50 hover:to-purple-50 transition-all duration-200",(w==null?void 0:w.id)===P.id&&"bg-gradient-to-r from-blue-100 to-indigo-100 text-blue-800"),children:[n.jsx(Vr,{className:"h-3 w-3"}),n.jsxs("div",{className:"flex flex-col gap-1",children:[n.jsx("div",{className:"font-medium",children:L(P.created_at)}),n.jsx("div",{className:"text-xs text-muted-foreground",children:P.status==="active"?"Active":"Archived"})]}),(w==null?void 0:w.id)===P.id&&n.jsx("div",{className:"ml-auto w-2 h-2 bg-gradient-to-br from-blue-500 to-indigo-600 rounded-full shadow-sm"})]},P.id))]}),o.length===0&&n.jsxs(n.Fragment,{children:[n.jsx(Mo,{}),n.jsx("div",{className:"px-2 py-1 text-sm text-muted-foreground text-center",children:"No previous sessions"})]})]})]})]})]})})]}),h&&n.jsx("div",{className:"mx-6 mb-4",children:n.jsxs("div",{className:"group relative overflow-hidden bg-gradient-to-br from-red-50/80 via-pink-50/60 to-white rounded-2xl border border-red-200/60 shadow-lg hover:shadow-xl transition-all duration-300",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-red-50/30 via-transparent to-pink-50/20"}),n.jsxs("div",{className:"relative flex items-center gap-4 p-4",children:[n.jsx("div",{className:"p-2 bg-gradient-to-br from-red-100 to-pink-200 rounded-xl shadow-sm",children:n.jsx(nr,{className:"h-5 w-5 text-red-600"})}),n.jsxs("div",{className:"flex-1",children:[n.jsx("p",{className:"text-sm font-bold bg-gradient-to-r from-red-800 to-pink-700 bg-clip-text text-transparent",children:"Error"}),n.jsx("p",{className:"text-sm text-red-700/90 leading-relaxed",children:h})]}),n.jsxs("div",{className:"relative overflow-hidden bg-white/60 backdrop-blur-sm rounded-lg border border-white/50 shadow-sm hover:shadow-md transition-all duration-300 hover:scale-105",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-red-50/20 via-trans
1765parent to-pink-50/20 opacity-0 group-hover:opacity-100 transition-opacity duration-300"}),n.jsx(te,{variant:"ghost",size:"sm",onClick:f,className:"relative bg-transparent hover:bg-transparent border-0 text-red-600 hover:text-red-700 shadow-none p-2",children:"Dismiss"})]})]})]})}),n.jsx(Sut,{messages:d,onSendMessage:E,isLoading:u,hasAvailableCredits:x,messageCost:b,creditBalance:y,brand:c,className:"flex-1"})]})]}):n.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 via-white to-blue-50/30 relative overflow-hidden",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsx("div",{className:"relative flex items-center justify-center h-full p-6",children:n.jsxs("div",{className:"group relative overflow-hidden bg-gradient-to-br from-white via-blue-50/30 to-indigo-50/40 rounded-2xl border border-blue-200/50 shadow-lg hover:shadow-xl transition-all duration-500 transform hover:-translate-y-2 hover:scale-105 max-w-lg w-full",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsx("div",{className:"absolute top-0 right-0 w-32 h-32 bg-gradient-to-br from-blue-200/30 to-transparent rounded-full -translate-y-16 translate-x-16"}),n.jsx("div",{className:"absolute bottom-0 left-0 w-24 h-24 bg-gradient-to-tr from-indigo-100/40 to-transparent rounded-full translate-y-12 -translate-x-12"}),n.jsxs("div",{className:"relative p-8 text-center space-y-6",children:[n.jsx("div",{className:"p-4 bg-gradient-to-br from-blue-100 to-indigo-200 rounded-2xl inline-block group-hover:from-blue-200 group-hover:to-indigo-300 transition-all duration-300",children:n.jsx(HR,{className:"h-12 w-12 text-blue-600 group-hover:text-blue-700 group-hover:scale-110 transition-all duration-300"})}),n.jsxs("div",{children:[n.jsx("h2",{className:"text-2xl font-bold bg-gradient-to-r from-blue-700 to-indigo-700 bg-clip-text text-transparent mb-3 group-hover:from-blue-600 group-hover:to-indigo-600 transition-all duration-300",children:"Brand Required"}),n.jsx("p",{className:"text-gray-600 mb-4 leading-relaxed",children:"Please select a brand to start using the Brand Consultant."}),n.jsx("p",{className:"text-sm text-gray-500 leading-relaxed",children:"The Brand Consultant provides personalized insights and strategic guid
1765ance based on your specific brand context."})]})]})]})})]})}function Tut({isOpen:e,onClose:t,isPrimaryBrandCampaign:r=!1}){const s=xr(),{selectedBrand:a}=mn(),i=o=>{a&&(s("/campaigns/new",{state:{campaignType:o,brandId:a.id,isPrimaryBrandCampaign:r}}),t())};return n.jsx(Zt,{open:e,onOpenChange:t,children:n.jsxs(Jt,{className:"sm:max-w-[800px] p-8 max-h-[90vh] overflow-y-auto",children:[n.jsxs(_r,{className:"mb-6",children:[n.jsx(tr,{children:"Create New Campaign"}),n.jsx(Hr,{children:"Choose the type of campaign you want to create."})]}),n.jsxs("div",{className:"flex flex-col gap-6",children:[n.jsxs(te,{variant:"outline",className:"w-full flex flex-col items-center justify-center p-8 h-auto gap-4 hover:bg-muted/50",onClick:()=>i("BASE"),children:[n.jsx("div",{className:"bg-muted rounded-full p-6",children:n.jsx(CK,{className:"h-8 w-8"})}),n.jsxs("div",{className:"space-y-3 text-center w-full max-w-lg",children:[n.jsx("h3",{className:"font-semibold text-lg",children:"Brand Campaign"}),n.jsx("p",{className:"text-sm text-muted-foreground whitespace-normal",children:"A campaign based on your brand. Typically used for broad market campaigns and collateral like Websites."})]})]}),n.jsxs(te,{variant:"outline",className:"w-full flex flex-col items-center justify-center p-8 h-auto gap-4 hover:bg-muted/50",onClick:()=>i("CUSTOM"),children:[n.jsx("div",{className:"bg-muted rounded-full p-6",children:n.jsx(en,{className:"h-8 w-8"})}),n.jsxs("div",{className:"space-y-3 text-center w-full max-w-lg",children:[n.jsx("h3",{className:"font-semibold text-lg",children:"Custom Campaign"}),n.jsx("p",{className:"text-sm text-muted-foreground whitespace-normal",children:"Start with your own idea or strategy. Craft a custom campaign tailored to your specific needs."})]})]}),n.jsxs(te,{variant:"outline",className:"w-full flex flex-col items-center justify-center p-8 h-auto gap-4 hover:bg-muted/50",onClick:()=>i("CONVERGENCE_BASED"),children:[n.jsx("div",{className:"bg-muted rounded-full p-6",children:n.jsx(mr,{className:"h-8 w-8"})}),n.jsxs("div",{className:"space-y-3 text-center w-full max-w-lg",children:[n.jsx("h3",{className:"font-semibold text-lg",children:"From Convergence"}),n.jsx("p",{className:"text-sm text-muted-foreground whitespace-normal",children:"Transform an AI-discovered convergence opportunity into a targeted marketing campaign."})]})]})]}),n.jsx(Sn,{className:"mt-6",children:n.jsx(te,{variant:"outline",onClick:t,children:"Cancel"})})]})})}const po=g.forwardRef(({className:e,...t},r)=>n.jsx("div",{className:"relative w-full overflow-auto",children:n.jsx("table",{ref:r,className:ye("w-full caption-bottom text-sm",e),...t})}));po.displayName="Table";const Ao=g.forwardRef(({className:e,...t},r)=>n.jsx("thead",{ref:r,className:ye("[&_tr]:border-b",e),...t}));Ao.displayName="TableHeader";const go=g.forwardRef(({className:e,...t},r)=>n.jsx("tbody",{ref:r,className:ye("[&_tr:last-child]:border-0",e),...t}));go.displayName="TableBody";const Put=g.forwardRef(({className:e,...t},r)=>n.jsx("tfoot",{ref:r,className:ye("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));Put.displayName="TableFooter";const Yr=g.forwardRef(({className:e,...t},r)=>n.jsx("tr",{ref:r,className:ye("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));Yr.displayName="TableRow";const $t=g.forwardRef(({className:e,...t},r)=>n.jsx("th",{ref:r,className:ye("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",e),...t}));$t.displayName="TableHead";const mt=g.forwardRef(({className:e,...t},r)=>n.jsx("td",{ref:r,className:ye("p-4 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));mt.displayName="TableCell";const Iut=g.forwardRef(({className:e,...t},r)=>n.jsx("caption",{ref:r,className:ye("mt-4 text-sm text-muted-foreground",e),...t}));Iut.displayName="TableCaption";const Out={ad_group:"Ad Group",blog:"Blog Post",email:"Email",landing_page:"Landing Page",quiz:"Quiz",tool:"Tool",video:"Video"},Fut={ad_group:"bg-blue-100 text-blue-800",blog:"bg-green-100 text-green-800",email:"bg-purple-100 text-purple-800",landing_page:"bg-orange-100 text-orange-800",quiz:"bg-pink-100 text-pink-800",tool:"bg-yellow-100 text-yellow-800",video:"bg-red-100 text-red-800"},Lut=e=>Out[e]||e;function Dut({campaignId:e}){const[t,r]=g.useState([]),[s,a]=g.useState(!0);return g.useEffect(()=>{async function i(){try{const{data:l,error:c}=await de.from("contents").select("*").eq("status","READY").eq("campaign_id",e);if(c)throw c;r(l||[])}catch(l){console.error("Error fetching contents:",l)}finally{a(!1)}}i();const o=de.channel(`contents_${e}`).on("postgres_changes",{event:"*",schema:"public",table:"contents",filter:`campaign_id=eq.${e}`},l=>{l.eventType==="INSERT"?r(c=>[...c,l.new]):l.eventType==="DELETE"&&r(c=>c.filter(d=>
1765d.id!==l.old.id))}).subscribe();return()=>{o.unsubscribe()}},[e]),s?n.jsx("div",{children:"Loading contents..."}):n.jsx("div",{className:"space-y-4",children:n.jsxs(po,{children:[n.jsx(Ao,{children:n.jsxs(Yr,{children:[n.jsx($t,{children:"Name"}),n.jsx($t,{children:"Type"}),n.jsx($t,{children:"Created"}),n.jsx($t,{children:"Actions"})]})}),n.jsx(go,{children:t.length===0?n.jsx(Yr,{children:n.jsx(mt,{colSpan:4,className:"text-center py-8",children:"No content pieces yet"})}):t.map(i=>n.jsxs(Yr,{children:[n.jsx(mt,{children:n.jsx(Ir,{to:`/content/${i.id}`,className:"text-primary hover:underline font-medium",children:i.name})}),n.jsx(mt,{children:n.jsx(Be,{className:`${Fut[i.content_type]} text-xs text-center flex justify-center items-center`,children:Lut(i.content_type)})}),n.jsx(mt,{children:new Date(i.created_at).toLocaleDateString()}),n.jsx(mt,{children:n.jsx(Ir,{to:`/content/${i.id}`,children:n.jsx(te,{variant:"ghost",size:"sm",children:"View"})})})]},i.id))})]})})}const oie="/assets/campaign_background-DTs8OYkR.png";function Rut(){const e=xr(),{selectedBrand:t}=mn(),[r,s]=g.useState([]),[a,i]=g.useState(!0),[o,l]=g.useState(null),[c,d]=g.useState(!1),[u,h]=g.useState(new Set),[m,f]=g.useState(""),[p,A]=g.useState("date_desc"),[v,x]=g.useState({}),[b,y]=g.useState({}),[w,j]=g.useState({}),[N,_]=g.useState(!1),[S,C]=g.useState(null),[E,T]=g.useState(""),[B,L]=g.useState(!1),[P,F]=g.useState(null),[M,I]=g.useState(!1),[$,V]=g.useState(null),{trackEvent:R,events:Q}=Lu(),U=se=>{h(Ae=>{const Pe=new Set(Ae);if(Pe.has(se))Pe.delete(se);else{Pe.clear(),Pe.add(se),q(se);const Oe=r.find(be=>be.id===se);Oe!=null&&Oe.originating_convergence_id&&!w[Oe.originating_convergence_id]&&Y(Oe.originating_convergence_id)}return Pe})},D=async(se=!1)=>{R(Q.FEATURE_USED,{feature:"campaign_creation_attempted",is_primary_brand_campaign:se,brand_id:t==null?void 0:t.id}),R(Q.FEATURE_USED,{feature:"campaign_type_selection_opened",is_primary_brand_campaign:se,brand_id:t==null?void 0:t.id}),d(!0)},q=async se=>{try{const{data:Ae,error:Pe}=await de.from("contents").select("*").eq("status","READY").eq("campaign_id",se);if(Pe)throw Pe;x(Oe=>({...Oe,[se]:Ae||[]}))}catch(Ae){console.error("Error fetching campaign content:",Ae)}},G=async se=>{try{const Ae={},{data:Pe,error:Oe}=await de.from("contents").select("campaign_id").eq("status","READY").in("campaign_id",se);if(Oe)throw Oe;se.forEach(be=>{Ae[be]=(Pe==null?void 0:Pe.filter(ue=>ue.campaign_id===be).length)||0}),y(Ae)}catch(Ae){console.error("Error fetching campaign content counts:",Ae)}},Y=async se=>{try{const{data:Ae,error:Pe}=await de.from("convergences").select("id, trend, name").eq("id",se).single();if(Pe)throw Pe;Ae&&j(Oe=>({...Oe,[se]:Ae}))}catch(Ae){console.error("Error fetching convergence:",Ae)}},K=se=>{e("/content/create",{state:{campaignId:se}})},X=se=>{V(se),I(!0)},ne=async()=>{if($){I(!1),F($.id);try{const{data:{session:se}}=await de.auth.getSession();if(!(se!=null&&se.access_token))throw new Error("No authentication session found");const Pe=await fetch("https://worker.rainfactory.ai/rainfactory/manual-autoposter/generate-autopost-content",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${se.access_token}`},body:JSON.stringify({campaignId:$.id,convergenceId:$.originating_convergence_id})}),Oe=await Pe.json();if(!Pe.ok)throw new Error(Oe.error||`HTTP ${Pe.status}: ${Pe.statusText}`);if(Oe.success)He({title:"Content Generated Successfully!",description:Oe.message}),q($.id);else throw new Error(Oe.error||"Content generation failed")}catch(se){console.error("Error generating auto content:",se),He({title:"Generation Failed",description:se instanceof Error?se.message:"Failed to generate content",variant:"destructive"})}finally{F(null),V(null)}}},ae=se=>{var Ae;C(se.id),T(((Ae=se.metadata)==null?void 0:Ae.central_theme)||se.custom_idea||""),_(!0)},J=async()=>{if(!S)return;const se=r.find(Ae=>Ae.id===S);if(se){L(!0);try{const Ae={...se.metadata,central_theme:E},{error:Pe}=await de.from("campaigns").update({metadata:Ae}).eq("id",S);if(Pe)throw Pe;s(Oe=>Oe.map(be=>be.id===S?{...be,metadata:Ae}
1765:be)),He({title:"Theme updated",description:"The campaign theme has been updated successfully."}),_(!1),C(null)}catch(Ae){console.error("Error updating theme:",Ae),He({title:"Update failed",description:"There was a problem updating the campaign theme.",variant:"destructive"})}finally{L(!1)}}};g.useEffect(()=>{async function se(){if(t)try{i(!0),R(Q.PAGE_VIEWED,{page:"campaigns",brand_id:t.id});const{data:Ae,error:Pe}=await de.from("campaigns").select("*, image_url").eq("brand_id",t.id).order("created_at",{ascending:!1});if(Pe)throw Pe;R(Q.FEATURE_USED,{feature:"campaigns_list",count:(Ae==null?void 0:Ae.length)||0,has_primary_campaign:(Ae==null?void 0:Ae.some(be=>be.is_primary_brand_campaign))||!1,brand_id:t.id});const Oe=Ae||[];if(s(Oe),Oe.length>0){const be=Oe.map(ue=>ue.id);G(be)}}catch(Ae){const Pe=Ae instanceof Error?Ae.message:"Failed to fetch campaigns";l(Pe),R("error_occurred",{error_type:"campaign_fetch_error",error_message:Pe,brand_id:t.id})}finally{i(!1)}}se()},[t,R,Q]);const W=r.some(se=>se.is_primary_brand_campaign||se.campaign_type==="BASE"),he=[...r.filter(se=>se.name.toLowerCase().includes(m.toLowerCase()))].sort((se,Ae)=>{switch(p){case"date_desc":return new Date(Ae.created_at).getTime()-new Date(se.created_at).getTime();case"date_asc":return new Date(se.created_at).getTime()-new Date(Ae.created_at).getTime();case"name_asc":return se.name.localeCompare(Ae.name);case"name_desc":return Ae.name.localeCompare(se.name);default:return 0}}),ee=se=>{switch(se.campaign_type){case"CONVERGENCE_BASED":return n.jsx(mr,{className:"h-5 w-5"});case"CUSTOM":return n.jsx(en,{className:"h-5 w-5"});case"BASE":return n.jsx(Gi,{className:"h-5 w-5"});default:return n.jsx(p2,{className:"h-5 w-5"})}},xe=se=>({CONVERGENCE_BASED:"Convergence Campaign",BASE:"Brand Campaign",CUSTOM:"Custom Campaign"})[se]||se,we=se=>{switch(se.campaign_type){case"CONVERGENCE_BASED":return"from-purple-50 to-violet-50 dark:from-purple-950/20 dark:to-violet-950/20";case"CUSTOM":return"from-orange-50 to-red-50 dark:from-orange-950/20 dark:to-red-950/20";case"BASE":return"from-blue-50 to-indigo-50 dark:from-blue-950/20 dark:to-indigo-950/20";default:return"from-gray-50 to-slate-50 dark:from-gray-950/20 dark:to-slate-950/20"}},Se=se=>{switch(se.campaign_type){case"CONVERGENCE_BASED":return"from-purple-500 to-violet-600";case"CUSTOM":return"from-orange-500 to-red-600";case"BASE":return"from-blue-500 to-indigo-600";default:return"from-gray-500 to-slate-600"}},pe=se=>{switch(se.campaign_type){case"CONVERGENCE_BASED":return"text-purple-900 dark:text-purple-100";case"CUSTOM":return"text-orange-900 dark:text-orange-100";case"BASE":return"text-blue-900 dark:text-blue-100";default:return"text-gray-900 dark:text-gray-100"}},Ce=se=>{switch(se.campaign_type){case"CONVERGENCE_BASED":return"text-purple-700 dark:text-purple-200";case"CUSTOM":return"text-orange-700 dark:text-orange-200";case"BASE":return"text-blue-700 dark:text-blue-200";default:return"text-gray-700 dark:text-gray-200"}},re=se=>{switch(se.campaign_type){case"CONVERGENCE_BASED":return"from-purple-200 via-violet-200 to-indigo-200 dark:from-purple-800 dark:via-violet-800 dark:to-indigo-800";case"CUSTOM":return"from-orange-200 via-red-200 to-pink-200 dark:from-orange-800 dark:via-red-800 dark:to-pink-800";case"BASE":return"from-blue-200 via-indigo-200 to-purple-200 dark:from-blue-800 dark:via-indigo-800 dark:to-purple-800";default:return"from-gray-200 via-slate-200 to-zinc-200 dark:from-gray-800 dark:via-slate-800 dark:to-zinc-800"}};return t?o?n.jsxs("div",{className:"p-6",children:[n.jsx(i0,{title:"Campaigns",description:"Campaigns are designed to make different types of content work together seamlessly to align all of the content within the campaign.",actions:n.jsxs(te,{variant:"default",onClick:()=>D(!W),children:[n.jsx(La,{className:"mr-2 h-4 w-4"}),"New Campaign"]})}),n.jsxs("div",{className:"mt-4 flex items-center gap-2 text-destructive",children:[n.jsx(nr,{className:"h-4 w-4"}),n.jsxs("span",{children:["Error loading campaigns: ",o]})]})]}):n.jsxs("div",{className:"p-6 space-y-6",children:[n.jsxs("div",{className:"relative overflow-hidden bg-gradient-to-br from-white via-blue-50/30 to-indigo-50/40 rounded-2xl border border-blue-200/50 shadow-sm p-8",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsx("div",{className:"absolute top-0 right-0 w-40 h-40 bg-gradient-to-br from-blue-200/20 to-transparent roun
1765ded-full -translate-y-20 translate-x-20"}),n.jsx("div",{className:"relative",children:n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start justify-between gap-6",children:[n.jsxs("div",{className:"flex items-center gap-4",children:[n.jsx("div",{className:"p-3 bg-white/80 backdrop-blur-sm rounded-2xl shadow-lg",children:n.jsx(p2,{className:"h-8 w-8 text-blue-600"})}),n.jsxs("div",{children:[n.jsx("h1",{className:"text-4xl font-bold bg-gradient-to-r from-blue-700 via-indigo-700 to-purple-700 bg-clip-text text-transparent mb-2",children:"Campaigns"}),n.jsx("p",{className:"text-gray-600 text-lg leading-relaxed",children:"Campaigns are designed to make different types of content work together seamlessly to align all of the content within the campaign."})]})]}),n.jsxs(te,{onClick:()=>D(!W),className:"bg-gradient-to-r from-blue-600 to-indigo-600 hover:from-blue-700 hover:to-indigo-700 text-white shadow-sm hover:shadow-lg transition-all duration-300 transform hover:scale-105 border-0",children:[n.jsx(La,{className:"h-4 w-4 mr-2"}),W?"New Campaign":"Create Brand Campaign"]})]})})]}),n.jsx(ey,{placement:"inline",compact:!0,className:"mb-4"}),n.jsx("div",{className:"bg-white rounded-lg border shadow-sm p-4 mb-6",children:n.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[n.jsxs("div",{className:"relative flex-1 max-w-sm",children:[n.jsx(Ns,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground"}),n.jsx(qe,{placeholder:"Search campaigns...",value:m,onChange:se=>f(se.target.value),className:"pl-10"})]}),n.jsxs(ur,{value:p,onValueChange:se=>A(se),children:[n.jsxs(or,{className:"w-full sm:w-[200px]",children:[n.jsx(ju,{className:"h-4 w-4 mr-2"}),n.jsx(hr,{placeholder:"Sort by"})]}),n.jsxs(lr,{children:[n.jsx(Fe,{value:"date_desc",children:"Newest First"}),n.jsx(Fe,{value:"date_asc",children:"Oldest First"}),n.jsx(Fe,{value:"name_asc",children:"Name (A-Z)"}),n.jsx(Fe,{value:"name_desc",children:"Name (Z-A)"})]})]})]})}),n.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:a?n.jsx("div",{className:"flex items-center justify-center py-12",children:n.jsx(ed,{size:"lg"})}):he.length>0?he.map(se=>{var be,ue;const Ae=u.has(se.id),Pe=((be=v[se.id])==null?void 0:be.length)||b[se.id]||0,Oe=se.originating_convergence_id?w[se.originating_convergence_id]:null;return n.jsxs(Te,{className:"bg-white rounded-lg border shadow-sm overflow-hidden transition-all duration-300 hover:shadow-md",children:[n.jsx("div",{className:"aspect-video w-full relative overflow-hidden",children:se.image_url?n.jsx("img",{src:se.image_url,alt:`${se.name} campaign`,className:"w-full h-full object-cover",loading:"lazy"}):n.jsx("img",{src:oie,alt:`${se.name} campaign background`,className:"w-full h-full object-cover",loading:"lazy"})}),n.jsx("div",{className:`p-3 sm:p-5 border-b bg-gradient-to-r ${we(se)} cursor-pointer hover:bg-opacity-80 transition-all duration-200`,onClick:()=>U(se.id),children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[n.jsx("div",{className:`hidden sm:flex w-12 h-12 bg-gradient-to-br ${Se(se)} rounded-xl items-center justify-center shadow-lg flex-shrink-0 ring-2 ring-white/20`,children:n.jsx("div",{className:"w-6 h-6 text-white",children:ee(se)})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2 sm:gap-2.5 mb-2",children:[n.jsx("h3",{className:`text-lg sm:text-xl font-bold ${pe(se)} leading-tight`,children:se.name}),se.is_primary_brand_campaign&&n.jsx(Be,{variant:"secondary",className:"text-xs font-semibold flex-shrink-0 px-2 py-1 w-fit",children:"Primary"})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[n.jsx(Be,{variant:"outline",className:"text-xs font-medium px-2 py-1 
1765w-fit",children:xe(se.campaign_type)}),n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("div",{className:`w-2 h-2 rounded-full ${se.status==="Active"?"bg-green-500":"bg-yellow-500"}`}),n.jsx("span",{className:`text-xs font-medium capitalize ${se.status==="Active"?"text-green-700 dark:text-green-300":"text-yellow-700 dark:text-yellow-300"}`,children:se.status})]})]}),n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0 text-xs",children:[n.jsxs("div",{className:`${Ce(se)} flex items-center gap-1.5 font-medium`,children:[n.jsx(Xr,{className:"h-3.5 w-3.5"}),n.jsxs("span",{children:[Pe," content",""]})]}),n.jsxs("div",{className:`${Ce(se)} flex items-center gap-1.5`,children:[n.jsx(Kn,{className:"h-3.5 w-3.5"}),n.jsx(Uh,{date:se.created_at,dateOnly:!1,size:"xs",showTimezone:!1,showTooltip:!0,showRelative:!0,relativeMode:"contextual",relativeContext:"compact",preferRelative:!0})]})]})]})]})]}),n.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[n.jsxs(te,{variant:"outline",size:"sm",className:"hidden sm:flex",onClick:Ee=>{Ee.stopPropagation(),R(Q.CAMPAIGN_EDITED,{action:"navigate_to_edit",campaign_id:se.id,campaign_name:se.name,campaign_type:se.campaign_type}),e(`/campaigns/${se.id}/edit`)},children:[n.jsx(ab,{className:"h-4 w-4 mr-1"}),"Edit"]}),n.jsx(te,{variant:"outline",size:"sm",className:"sm:hidden p-2",onClick:Ee=>{Ee.stopPropagation(),R(Q.CAMPAIGN_EDITED,{action:"navigate_to_edit",campaign_id:se.id,campaign_name:se.name,campaign_type:se.campaign_type}),e(`/campaigns/${se.id}/edit`)},children:n.jsx(ab,{className:"h-4 w-4"})}),Ae?n.jsx(Un,{className:"h-5 w-5 text-muted-foreground transition-transform"}):n.jsx(_s,{className:"h-5 w-5 text-muted-foreground transition-transform"})]})]})}),Ae&&n.jsxs("div",{className:"p-6 space-y-6 animate-in slide-in-from-top-2 duration-300",children:[n.jsxs("div",{className:"bg-muted/30 rounded-lg p-4",children:[n.jsx("div",{className:"flex items-center justify-between mb-3",children:n.jsxs("h4",{className:"font-semibold text-base flex items-center gap-2",children:[ee(se),"Campaign Details"]})}),se.campaign_type==="CUSTOM"&&n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsx("h5",{className:"text-sm font-medium text-muted-foreground",children:"Central Theme"}),n.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>ae(se),children:[n.jsx(cm,{className:"h-4 w-4 mr-1"})," Edit"]})]}),n.jsx("p",{className:"text-sm",children:((ue=se.metadata)==null?void 0:ue.central_theme)||se.custom_idea||"No theme specified"})]}),se.campaign_type==="CONVERGENCE_BASED"&&Oe&&n.jsxs("div",{children:[n.jsx("h5",{className:"text-sm font-medium text-muted-foreground mb-2",children:"Based on Convergence"}),n.jsxs(Ir,{to:`/convergences/${Oe.id}`,className:"text-sm text-primary hover:underline flex items-center",children:[n.jsx(mr,{className:"h-4 w-4 mr-1"}),Oe.trend]})]}),se.campaign_type==="BASE"&&n.jsxs("div",{children:[n.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"This is a base brand campaign built on your brand's strategy and positioning. You can use the Brand Genius tool to help control the content."}),n.jsxs(Ir,{to:"/brand-genius",className:"text-sm text-primary hover:underline flex items-center",children:[n.jsx(Gi,{className:"h-4 w-4 mr-1"}),"Visit Brand Genius"]})]})]}),n.jsxs("div",{className:"flex justify-center gap-4",children:[n.jsxs(te,{onClick:()=>K(se.id),size:"lg",children:[n.jsx(La,{className:"h-4 w-4 mr-2"}),"Create Content"]}),se.campaign_type==="CONVERGENCE_BASED"&&se.originating_convergence_id&&n.jsxs(te,{onClick:()=>X(se),size:"lg",variant:"outline",disabled:P===se.id,children:[P===se.id?n.jsx(kt,{className:"h-4 w-4 mr-2 animate-spin"}):n.jsx(mr,{className:"h-4 w-4 mr-2"}),P===se.id?"Generating...":"Generate Content"]})]}),n.jsxs("div",{className:"bg-white rounded-lg border shadow-sm p-4",children:[n.jsxs("h4",{className:"text-lg font-semibold mb-4 flex items-center gap-2",children:[n.jsx(Xr,{className:"h-5 w-5"}),"Content in this campaign"]}),n.jsx(Dut,{campaignId:se.id})]})]}),n.jsx("div",{className:`h-2 bg-gradient-to-r ${re(se)}`})]},se.id)}):n.jsxs("div",{className:"relative overflow-hidden bg-gradient-to-br from-white via-gray-50/30 to-blue-50/20 rounded-2xl border border-gray-200/50 shadow-sm",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsxs("div",{className:"relative flex flex-col items-center justify-center py-20 px-8",children:[n.jsxs("div",{className:"group relative overflow-hidden w-24 h-24 bg-gradient-to-br from-blue-100 to-indigo-200 rounded-full flex items-center justify-center mb-6 cursor-pointer hover:from-blue-200 hover:to-indigo-300 transition-all duration-300 transform hover:scale-110 hover:shadow-lg",onClick:()=>D(!W),children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-white/20 to-transparent roun
1765ded-full"}),n.jsx(La,{className:"relative h-12 w-12 text-blue-600 group-hover:text-blue-700 transition-colors duration-300"})]}),n.jsx("h3",{className:"text-xl font-bold bg-gradient-to-r from-gray-800 to-gray-600 bg-clip-text text-transparent mb-2",children:m?"No campaigns match your search":"No campaigns found"}),n.jsx("p",{className:"text-gray-600 text-center mb-6 max-w-md leading-relaxed",children:m?"Try adjusting your search terms or filters":n.jsx(n.Fragment,{children:W?n.jsxs(n.Fragment,{children:["Get started by creating a new campaign or find a"," ",n.jsx(Ir,{to:"/convergences",className:"text-blue-600 hover:text-blue-700 underline underline-offset-4",children:"convergence"})," ","you like and turn it into a campaign"]}):"Get started by creating your brand's primary campaign - it's complimentary!"})}),!m&&n.jsxs(te,{onClick:()=>D(!W),className:"bg-gradient-to-r from-blue-600 to-indigo-600 hover:from-blue-700 hover:to-indigo-700 text-white shadow-sm hover:shadow-lg transition-all duration-300 transform hover:scale-105 border-0",children:[n.jsx(La,{className:"h-4 w-4 mr-2"}),W?"Create Your First Campaign":"Create Brand Campaign"]})]})]})}),n.jsx(Tut,{isOpen:c,onClose:()=>d(!1),isPrimaryBrandCampaign:!W}),n.jsx(Zt,{open:M,onOpenChange:I,children:n.jsxs(Jt,{children:[n.jsxs(_r,{children:[n.jsx(tr,{children:"Generate Campaign Content"}),n.jsx(Hr,{children:"This will generate content for your convergence-based campaign."})]}),n.jsx("div",{className:"py-4",children:n.jsx("p",{className:"text-sm text-muted-foreground",children:"Content will be generated based on the convergence trend and scheduled for posting according to your platform settings."})}),n.jsxs(Sn,{children:[n.jsx(te,{variant:"outline",onClick:()=>I(!1),children:"Cancel"}),n.jsx(te,{onClick:ne,children:"Generate Content"})]})]})}),n.jsx(Zt,{open:N,onOpenChange:_,children:n.jsxs(Jt,{className:"sm:max-w-md",children:[n.jsxs(_r,{children:[n.jsx(tr,{children:"Edit Campaign Theme"}),n.jsx(Hr,{children:"Update the central theme for this custom campaign."})]}),n.jsx("div",{className:"grid gap-4 py-4",children:n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"centralTheme",children:"Central Theme"}),n.jsx(Zr,{id:"centralTheme",value:E,onChange:se=>T(se.target.value),placeholder:"Describe the central theme or idea for this campaign",className:"min-h-[100px]"})]})}),n.jsxs(Sn,{children:[n.jsx(te,{variant:"outline",onClick:()=>_(!1),children:"Cancel"}),n.jsx(te,{onClick:J,disabled:B,children:B?"Saving...":"Save Changes"})]})]})})]}):n.jsx(ep,{})}function Uut(){var q;const{id:e}=Ei(),t=xr(),[r,s]=g.useState(null),[a,i]=g.useState(null),[o,l]=g.useState(!0),[c,d]=g.useState(null),[u,h]=g.useState(!1),[m,f]=g.useState(""),[p,A]=g.useState(!1),[v,x]=g.useState(!1),[b,y]=g.useState(!1),[w,j]=g.useState([]),[N,_]=g.useState(!1),[S,C]=g.useState([]),[E,T]=g.useState(!0),[B,L]=g.useState(0),P=async G=>{try{T(!0);const{data:Y,error:K,count:X}=await de.from("contents").select(`
1766          *,
1767          campaigns!inner(id, name)
1768        `,{count:"exact"}).eq("campaign_id",G).in("status",["READY","SCHEDULED","PUBLISHED","DRAFT","GENERATING","ARCHIVED"]).order("created_at",{ascending:!1}).limit(12);if(K)throw K;C(Y||[]),L(X||0)}catch(Y){console.error("Error fetching content:",Y),He({title:"Error",description:"Failed to fetch campaign content",variant:"destructive"})}finally{T(!1)}},F=async G=>{_(!0);try{const{data:Y,error:K}=await de.from("platform_brand_settings").select(`
1769          *,
1770          platform:platforms(*)
1771        `).eq("brand_id",G).eq("autopost_enabled",!0).eq("status","CONNECTED");if(K)throw K;const X=(Y||[]).filter(ne=>ne.platform).map(ne=>({platform:{name:ne.platform.name,type:ne.platform.type,id:ne.platform.id},autopost_enabled:ne.autopost_enabled,autogenerate_enabled:ne.autogenerate_enabled,status:ne.status}));j(X)}catch(Y){console.error("Error fetching platforms:",Y),He({title:"Error",description:"Failed to fetch enabled platforms",variant:"destructive"})}finally{_(!1)}};g.useEffect(()=>{async function G(){try{if(!e)return;const{data:X,error:ne}=await de.from("campaigns").select("*, image_url").eq("id",e).single();if(ne)throw ne;if(s(X),await P(e),X.campaign_type==="CONVERGENCE_BASED"&&X.originating_convergence_id){const{data:ae,error:J}=await de.from("convergences").select("id, trend, name").eq("id",X.originating_convergence_id).single();if(J)throw J;i(ae)}}catch(X){d(X instanceof Error?X.message:"Failed to fetch campaign")}finally{l(!1)}}G();const Y=de.channel(`campaign_${e}`).on("postgres_changes",{event:"*",schema:"public",table:"campaigns",filter:`id=eq.${e}`},X=>{s(X.new)}).subscribe(),K=de.channel(`content_${e}`).on("postgres_changes",{event:"*",schema:"public",table:"contents",filter:`campaign_id=eq.${e}`},()=>{e&&P(e)}).subscribe();return()=>{Y.unsubscribe(),K.unsubscribe()}},[e]),g.useEffect(()=>{var G;if(r&&r.campaign_type==="CUSTOM"){const Y=((G=r.metadata)==null?void 0:G.central_theme)||r.custom_idea||"";f(Y)}},[r]);const M=()=>{t("/content/create",{state:{campaignId:e}})},I=async()=>{r!=null&&r.brand_id&&(await F(r.brand_id),y(!0))},$=async()=>
1771{if(!(!r||!e)){y(!1),x(!0);try{const{data:{session:G}}=await de.auth.getSession();if(!(G!=null&&G.access_token))throw new Error("No authentication session found");const K=await fetch("https://worker.rainfactory.ai/rainfactory/manual-autoposter/generate-autopost-content",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${G.access_token}`},body:JSON.stringify({campaignId:e,convergenceId:r.originating_convergence_id})}),X=await K.json();if(!K.ok)throw new Error(X.error||`HTTP ${K.status}: ${K.statusText}`);if(X.success)He({title:"Content Generated Successfully!",description:X.message}),e&&await P(e);else throw new Error(X.error||"Content generation failed")}catch(G){console.error("Error generating auto content:",G),He({title:"Generation Failed",description:G instanceof Error?G.message:"Failed to generate content",variant:"destructive"})}finally{x(!1)}}},V=async()=>{if(r){A(!0);try{const G={...r.metadata,central_theme:m},{error:Y}=await de.from("campaigns").update({metadata:G}).eq("id",r.id);if(Y)throw Y;s({...r,metadata:G}),He({title:"Theme updated",description:"The campaign theme has been updated successfully."}),h(!1)}catch(G){console.error("Error updating theme:",G),He({title:"Update failed",description:"There was a problem updating the campaign theme.",variant:"destructive"})}finally{A(!1)}}};if(o)return n.jsx("div",{className:"min-h-screen bg-gradient-to-br from-gray-50 via-white to-gray-50 dark:from-gray-900 dark:via-gray-900 dark:to-gray-900",children:n.jsxs("div",{className:"container mx-auto p-6 space-y-6",children:[n.jsx(Lt,{className:"h-10 w-32"}),n.jsx(Lt,{className:"h-48 w-full rounded-2xl"}),n.jsx(Lt,{className:"h-32 w-full rounded-xl"}),n.jsx(Lt,{className:"h-96 w-full rounded-xl"})]})});if(c)return n.jsx("div",{className:"min-h-screen bg-gradient-to-br from-gray-50 via-white to-gray-50 dark:from-gray-900 dark:via-gray-900 dark:to-gray-900",children:n.jsxs("div",{className:"container mx-auto p-6",children:[n.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>t("/campaigns"),className:"group mb-6",children:[n.jsx(Yo,{className:"h-4 w-4 mr-2 transition-transform group-hover:-translate-x-1"}),"Back to Campaigns"]}),n.jsx(Te,{className:"bg-white dark:bg-gray-800 shadow-xl border-0",children:n.jsxs(Re,{className:"p-8 text-center",children:[n.jsx("div",{className:"text-red-500 mb-4",children:n.jsx("svg",{className:"w-12 h-12 mx-auto",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),n.jsx("h2",{className:"text-lg font-semibold mb-2",children:"Error Loading Campaign"}),n.jsx("p",{className:"text-muted-foreground",children:c})]})})]})});if(!r)return n.jsx("div",{className:"min-h-screen bg-gradient-to-br from-gray-50 via-white to-gray-50 dark:from-gray-900 dark:via-gray-900 dark:to-gray-900",children:n.jsxs("div",{className:"container mx-auto p-6",children:[n.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>t("/campaigns"),className:"group mb-6",children:[n.jsx(Yo,{className:"h-4 w-4 mr-2 transition-transform group-hover:-translate-x-1"}),"Back to Campaigns"]}),n.jsx(Te,{className:"bg-white dark:bg-gray-800 shadow-xl border-0",children:n.jsxs(Re,{className:"p-8 text-center",children:[n.jsx("div",{className:"text-muted-foreground mb-4",children:n.jsx("svg",{className:"w-12 h-12 mx-auto",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9.172 16.172a4 4 0 015.656 0M9 10h.01M15 10h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),n.jsx("h2",{className:"text-lg font-semibold mb-2",children:"Campaign Not Found"}),n.jsx("p",{className:"text-muted-foreground",children:"The campaign you're looking for doesn't exist."})]})})]})});const R=G=>{switch(G.campaign_type){case"CONVERGENCE_BASED":return"from-purple-500 to-violet-600";case"CUSTOM":return"from-orange-500 to-red-600";case"BASE":return"from-blue-500 to-indigo-600";default:return"from-gray-500 to-slate-600"}},Q=G=>{switch(G.campaign_type){case"CONVERGENCE_BASED":return"from-purple-50 to-violet-50 dark:from-purple-950/20 dark:to-violet-950/20";case"CUSTOM":return"from-orange-50 to-red-50 dark:from-orange-950/20 dark:to-red-950/20";case"BASE":return"from-blue-50 to-indigo-50 dark:from-blue-950/20 dark:to-indigo-950/20";default:return"from-gray-50 to-slate-50 dark:from-gray-950/20 dark:to-slate-950/20"}},U=G=>{switch(G.campaign_type){case"CONVERGENCE_BASED":return n.jsx(mr,{className:"h-5 w-5 text-white"});case"CUSTOM":return n.jsx(en,{className:"h-5 w-5 text-white"});case"BASE":return n.jsx(Gi,{className:"h-5 w-5 text-white"});default:return n.jsx(p2,{className:"h-5 w-5 text-white"})}},D=G=>({CONVERGENCE_BASED:"Convergence Campaign",BASE:"Brand Campaign",CUSTOM:"Custom Campaign"})[G]||G;return n.jsx("div",{className:"min-h-screen bg-gradient-to-br from-gray-50 via-white to-gray-50 dark:from-gray-900 dark:via-gray-900 dark:to-gray-900",children:n.jsxs("div",{className:"container mx-auto p-4 sm:p-6 space-y-4 sm:sp
1771ace-y-6",children:[n.jsx("div",{className:"flex items-center gap-4",children:n.jsxs(te,{variant:"ghost",size:"sm",onClick:()=>t("/campaigns"),className:"group",children:[n.jsx(Yo,{className:"h-4 w-4 mr-2 transition-transform group-hover:-translate-x-1"}),"Back to Campaigns"]})}),n.jsxs("div",{className:`relative overflow-hidden rounded-xl sm:rounded-2xl bg-gradient-to-r ${Q(r)} shadow-lg border`,children:[n.jsxs("div",{className:"absolute inset-0",children:[n.jsx("img",{src:r.image_url||oie,alt:`${r.name} campaign background`,className:"w-full h-full object-cover opacity-20",loading:"lazy"}),n.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-black/40 to-black/20"})]}),n.jsx("div",{className:"absolute top-0 right-0 w-48 sm:w-96 h-48 sm:h-96 bg-gradient-to-br ${getCampaignGradient(campaign)} rounded-full blur-3xl opacity-10"}),n.jsxs("div",{className:"relative z-10 p-4 sm:p-6 lg:p-8",children:[n.jsxs("div",{className:"sm:hidden space-y-4",children:[n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx("div",{className:`w-12 h-12 bg-gradient-to-br ${R(r)} rounded-xl flex items-center justify-center shadow-xl flex-shrink-0`,children:U(r)}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsx("h1",{className:"text-2xl font-bold text-white drop-shadow-lg truncate",children:r.name}),n.jsxs("div",{className:"flex flex-wrap items-center gap-2 mt-2",children:[n.jsx(Be,{variant:"outline",className:"font-medium text-xs",children:D(r.campaign_type)}),n.jsx(Be,{variant:r.status==="Active"?"default":"secondary",className:r.status==="Active"?"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200 text-xs":"text-xs",children:r.status})]})]})]}),n.jsxs(te,{onClick:()=>t(`/campaigns/${e}/edit`),className:"w-full shadow-lg",size:"sm",children:[n.jsx(cm,{className:"h-4 w-4 mr-2"}),"Edit Campaign"]})]}),n.jsxs("div",{className:"hidden sm:flex items-start justify-between mb-6",children:[n.jsxs("div",{className:"flex items-center gap-4",children:[n.jsx("div",{className:`w-14 h-14 bg-gradient-to-br ${R(r)} rounded-xl flex items-center justify-center shadow-xl`,children:U(r)}),n.jsxs("div",{children:[n.jsx("h1",{className:"text-3xl font-bold text-white drop-shadow-lg",children:r.name}),n.jsxs("div",{className:"flex items-center gap-3 mt-2",children:[n.jsx(Be,{variant:"outline",className:"font-medium",children:D(r.campaign_type)}),n.jsx(Be,{variant:r.status==="Active"?"default":"secondary",className:r.status==="Active"?"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200":"",children:r.status})]})]})]}),n.jsxs(te,{onClick:()=>t(`/campaigns/${e}/edit`),className:"shadow-lg",children:[n.jsx(cm,{className:"h-4 w-4 mr-2"}),"Edit Campaign"]})]}),n.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3 sm:gap-4 mt-4 sm:mt-6",children:[n.jsxs("div",{className:"bg-white/50 dark:bg-gray-800/50 backdrop-blur rounded-lg p-3 sm:p-4",children:[n.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[n.jsx(Kn,{className:"h-3.5 sm:h-4 w-3.5 sm:w-4"}),n.jsx("span",{className:"text-xs sm:text-sm font-medium",children:"Created"})]}),n.jsx(Uh,{date:r.created_at,dateOnly:!1,size:"xs",showTimezone:!1,showRelative:!0,preferRelative:!0})]}),n.jsxs("div",{className:"bg-white/50 dark:bg-gray-800/50 backdrop-blur rounded-lg p-3 sm:p-4",children:[n.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[n.jsx(Xr,{className:"h-3.5 sm:h-4 w-3.5 sm:w-4"}),n.jsx("span",{className:"text-xs sm:text-sm font-medium",children:"Content Pieces"})]}),n.jsx("p",{className:"text-base sm:text-lg font-semibold",children:E?"-":B})]}),n.jsxs("div",{className:"bg-white/50 dark:bg-gray-800/50 backdrop-blur rounded-lg p-3 sm:p-4",children:[n.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[n.jsx(fs,{className:"h-3.5 sm:h-4 w-3.5 sm:w-4"}),n.jsx("span",{className:"text-xs sm:text-sm font-medium",children:"Performance"})]}),n.jsxs("div",{className:"flex items-center gap-2 sm:gap-4",children:[n.jsxs("div",{className:"text-xs sm:text-sm",children:[n.jsx("span",{className:"font-semibold",children:r.views||0})," views"]}),n.jsxs("div",{className:"text-xs sm:text-sm",children:[n.jsx("span",{className:"font-semibold",children:r.clicks||0})," clicks"]})]})]})]})]})]}),n.jsxs(Te,{className:"bg-white dark:bg-gray-800 shadow-xl border-0 overflow-hidden",children:[n.jsx("div",{className:`h-2 bg-gradient-to-r ${R(r)}`}),n.jsxs(Re,{className:"p-4 sm:p-6",children:[r.campaign_type==="CUSTOM"&&n.jsxs("div",{className:"bg-gradient-to-r from-orange-50 to-red-50 dark:from-orange-950/20 dark:to-red-950/20 rounded-lg p-3 sm:p-4",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 sm:mb-3",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(en,{className:"h-4 sm:h-5 w-4 sm:w-5 text-orange-600 dar
1771k:text-orange-400"}),n.jsx("h3",{className:"text-sm sm:text-base font-semibold",children:"Central Theme"})]}),n.jsxs(te,{variant:"outline",size:"sm",onClick:()=>h(!0),className:"hover:bg-white/50 w-full sm:w-auto",children:[n.jsx(Y0e,{className:"h-4 w-4 mr-1"})," Edit Theme"]})]}),n.jsx("p",{className:"text-xs sm:text-sm text-gray-700 dark:text-gray-300 leading-relaxed mt-2 sm:mt-0",children:((q=r.metadata)==null?void 0:q.central_theme)||r.custom_idea||"No theme specified"})]}),r.campaign_type==="CONVERGENCE_BASED"&&a&&n.jsxs("div",{className:"bg-gradient-to-r from-purple-50 to-violet-50 dark:from-purple-950/20 dark:to-violet-950/20 rounded-lg p-3 sm:p-4",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-2 sm:mb-3",children:[n.jsx(mr,{className:"h-4 sm:h-5 w-4 sm:w-5 text-purple-600 dark:text-purple-400"}),n.jsx("h3",{className:"text-sm sm:text-base font-semibold",children:"Based on Convergence"})]}),n.jsxs(Ir,{to:`/convergences/${a.id}`,className:"inline-flex items-center gap-2 text-purple-700 dark:text-purple-300 hover:text-purple-900 dark:hover:text-purple-100 transition-colors group",children:[n.jsx("span",{className:"font-medium text-xs sm:text-sm group-hover:underline",children:a.trend}),n.jsx(_s,{className:"h-3 sm:h-4 w-3 sm:w-4 transition-transform group-hover:translate-x-1"})]})]}),r.campaign_type==="BASE"&&n.jsxs("div",{className:"bg-gradient-to-r from-blue-50 to-indigo-50 dark:from-blue-950/20 dark:to-indigo-950/20 rounded-lg p-3 sm:p-4",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-2 sm:mb-3",children:[n.jsx(Gi,{className:"h-4 sm:h-5 w-4 sm:w-5 text-blue-600 dark:text-blue-400"}),n.jsx("h3",{className:"text-sm sm:text-base font-semibold",children:"Brand Campaign"})]}),n.jsx("p",{className:"text-xs sm:text-sm text-gray-700 dark:text-gray-300 mb-2 sm:mb-3",children:"This campaign is built on your brand's strategy and positioning. Use Brand Genius to shape and control the content."}),n.jsxs(Ir,{to:"/brand-genius",className:"inline-flex items-center gap-2 text-blue-700 dark:text-blue-300 hover:text-blue-900 dark:hover:text-blue-100 transition-colors group",children:[n.jsx("span",{className:"font-medium text-xs sm:text-sm group-hover:underline",children:"Visit Brand Genius"}),n.jsx(_s,{className:"h-3 sm:h-4 w-3 sm:w-4 transition-transform group-hover:translate-x-1"})]})]})]})]}),n.jsx("div",{className:"flex justify-center px-4 sm:px-0",children:n.jsxs("div",{className:"w-full sm:w-auto sm:inline-flex flex flex-col sm:flex-row gap-3 sm:gap-4 p-4 sm:p-6 bg-white dark:bg-gray-800 rounded-xl shadow-xl",children:[n.jsxs(te,{onClick:M,size:"default",className:"w-full sm:w-auto bg-gradient-to-r from-blue-600 to-indigo-600 hover:from-blue-700 hover:to-indigo-700 text-white shadow-lg hover:shadow-xl transition-all",children:[n.jsx(La,{className:"h-4 sm:h-5 w-4 sm:w-5 mr-2"}),"Create Content"]}),r.campaign_type==="CONVERGENCE_BASED"&&r.originating_convergence_id&&n.jsxs(te,{onClick:I,size:"default",variant:"outline",disabled:v,className:"w-full sm:w-auto border-2 border-indigo-500 text-indigo-600 hover:bg-gradient-to-r hover:from-indigo-500 hover:to-purple-600 hover:text-white hover:border-transparent shadow-lg hover:shadow-xl transition-all",children:[v?n.jsx(kt,{className:"h-4 sm:h-5 w-4 sm:w-5 mr-2 animate-spin"}):n.jsx(mr,{className:"h-4 sm:h-5 w-4 sm:w-5 mr-2"}),v?"Generating...":"Generate Content"]})]})}),(S.length>0||E)&&n.jsxs(Te,{className:"bg-white dark:bg-gray-800 shadow-xl border-0 overflow-hidden",children:[n.jsx("div",{className:"h-2 bg-gradient-to-r from-blue-500 via-indigo-600 to-purple-600"}),n.jsx(st,{className:"border-b bg-gradient-to-r from-blue-50/30 via-indigo-50/20 to-purple-50/30 dark:from-blue-950/20 dark:via-indigo-950/15 dark:to-purple-950/20",children:n.jsxs(ot,{className:"flex items-center gap-2",children:[n.jsx(Xr,{className:"h-5 w-5 text-blue-600"}),"Campaign Content",B>0&&n.jsx(Be,{variant:"secondary",className:"ml-2",children:B})]})}),n.jsx(Re,{className:"p-6",children:n.jsx(FF,{contents:S,loading:E,onContentClick:G=>t(`/content/${G.id}`),emptyMessage:"Create your first piece of content for this campaign to get started."})})]}),n.jsx(Zt,{open:b,onOpenChange:y,children:n.jsxs(Jt,{children:[n.jsxs(_r,{children:[n.jsx(tr,{children:"Generate Campaign Content"}),n.jsx(Hr,{children:"Review what will happen when you generate content for this campaign."})]}),n.jsx("div",{className:"py-4 space-y-4",children:N?n.jsx("div",{className:"flex items-center justify-center py-4",children:n.jsx(kt,{className:"h-6 w-6 animate-spin"})}):n.jsxs(n.Fragment,{children:[n.jsxs("div",{children:[n.jsx("h3",{className:"font-medium mb-2",children:"1. Content Generation"}),w.length>0?n.jsxs("div",{className:"space-y-2",children:[n.jsx("p",{className:"text-sm text-muted-foreground",children:"Platform status overview:"}
1771),n.jsxs("div",{className:"space-y-4 mt-2",children:[n.jsx("div",{className:"space-y-3",children:w.map(G=>n.jsxs("div",{className:"flex flex-col space-y-1",children:[n.jsx("h4",{className:"text-sm font-medium",children:G.platform.name}),n.jsxs("div",{className:"flex gap-4 text-xs",children:[n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("div",{className:`w-2 h-2 rounded-full ${G.autogenerate_enabled?"bg-green-500":"bg-yellow-500"}`}),n.jsxs("span",{className:"text-muted-foreground",children:["Auto-creation: ",G.autogenerate_enabled?"Enabled":"Disabled"]})]}),n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("div",{className:`w-2 h-2 rounded-full ${G.autopost_enabled?"bg-green-500":"bg-yellow-500"}`}),n.jsxs("span",{className:"text-muted-foreground",children:["Auto-publishing: ",G.autopost_enabled?"Enabled":"Disabled"]})]})]})]},G.platform.id))}),n.jsx("div",{className:"pt-2 border-t",children:n.jsxs(Ir,{to:`/brands/${r.brand_id}/connections`,className:"text-sm text-primary hover:underline inline-flex items-center",children:[n.jsx(cm,{className:"h-4 w-4 mr-1"}),"Adjust platform settings"]})})]})]}):n.jsxs("div",{className:"space-y-3",children:[n.jsx("p",{className:"text-sm text-yellow-600",children:"No platforms are currently enabled for both auto-creation and auto-publishing."}),n.jsxs(Ir,{to:`/brands/${r.brand_id}/connections`,className:"text-sm text-primary hover:underline inline-flex items-center",children:[n.jsx(cm,{className:"h-4 w-4 mr-1"}),"Configure platform settings"]})]})]}),n.jsxs("div",{children:[n.jsx("h3",{className:"font-medium mb-2",children:"2. Content Scheduling"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Generated content will be automatically scheduled based on your platform settings."})]}),n.jsxs("div",{children:[n.jsx("h3",{className:"font-medium mb-2",children:"3. Email Notification"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"You'll receive an email with:"}),n.jsxs("ul",{className:"list-disc list-inside text-sm pl-2 text-muted-foreground",children:[n.jsx("li",{children:"Preview of all generated content"}),n.jsx("li",{children:"Scheduled posting times"}),n.jsx("li",{children:"Instructions for reviewing and editing content"})]})]})]})}),n.jsxs(Sn,{children:[n.jsx(te,{variant:"outline",onClick:()=>y(!1),children:"Cancel"}),n.jsx(te,{onClick:$,disabled:N||w.length===0,children:"Generate Content"})]})]})}),n.jsx(Zt,{open:u,onOpenChange:h,children:n.jsxs(Jt,{className:"sm:max-w-md",children:[n.jsxs(_r,{children:[n.jsx(tr,{children:"Edit Campaign Theme"}),n.jsx(Hr,{children:"Update the central theme for this custom campaign."})]}),n.jsx("div",{className:"grid gap-4 py-4",children:n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"centralTheme",children:"Central Theme"}),n.jsx(Zr,{id:"centralTheme",value:m,onChange:G=>f(G.target.value),placeholder:"Describe the central theme or idea for this campaign",className:"min-h-[100px]"})]})}),n.jsxs(Sn,{children:[n.jsx(te,{variant:"outline",onClick:()=>h(!1),children:"Cancel"}),n.jsx(te,{onClick:V,disabled:p,children:p?"Saving...":"Save Changes"})]})]})})]})})}const Yz=(e,t,r)=>{if(e&&"reportValidity"in e){const s=At(r,t);e.setCustomValidity(s&&s.message||""),e.reportValidity()}},lie=(e,t)=>{for(const r in t.fields){const s=t.fields[r];s&&s.ref&&"reportValidity"in s.ref?Yz(s.ref,r,e):s.refs&&s.refs.forEach(a=>Yz(a,r,e))}},Mut=(e,t)=>{t.shouldUseNativeValidation&&lie(e,t);const r={};for(const s in e){const a=At(t.fields,s),i=Object.assign(e[s]||{},{ref:a&&a.ref});if($ut(t.names||Object.keys(e),s)){const o=Object.assign({},At(r,s));Pn(o,"root",i),Pn(r,s,o)}else Pn(r,s,i)}return r},$ut=(e,t)=>e.some(r=>r.startsWith(t+"."));var Qut=function(e,t){for(var r={};e.length;){var s=e[0],a=s.code,i=s.message,o=s.path.join(".");if(!r[o])if("unionErrors"in s){var l=s.unionErrors[0].errors[0];r[o]={message:l.message,type:l.code}}else r[o]={message:i,type:a};if("unionErrors"in s&&s.unionErrors.forEach(function(u){return u.errors.forEach(function(h){return e.push(h)})}),t){var c=r[o].types,d=c&&c[s.code];r[o]=kre(o,t,r,a,d?[].concat(d,s.message):s.message)}e.shift()}return r},up=function(e,t,r){return r===void 0&&(r={}),function(s,a,i){try{return Promise.resolve(function(o,l){try{var c=Promise.resolve(e[r.mode==="sync"?"parse":"parseAsync"](s,t)).then(function(d){return i.shouldUseNativeValidation&&lie({},i),{errors:{},values:r.raw?s:d}})}catch(d){return l(d)}return c&&c.then?c.then(void 0,l):c}
1771(0,function(o){if(function(l){return Array.isArray(l==null?void 0:l.errors)}(o))return{values:{},errors:Mut(Qut(o.errors,!i.shouldUseNativeValidation&&i.criteriaMode==="all"),i)};throw o}))}catch(o){return Promise.reject(o)}}};const dk=jYe,cie=g.createContext({}),za=({...e})=>n.jsx(cie.Provider,{value:{name:e.name},children:n.jsx(yYe,{...e})}),uk=()=>{const e=g.useContext(cie),t=g.useContext(die),{getFieldState:r,formState:s}=wYe(),a=r(e.name,s);if(!e)throw new Error("useFormField should be used within <FormField>");const{id:i}=t;return{id:i,name:e.name,formItemId:`${i}-form-item`,formDescriptionId:`${i}-form-item-description`,formMessageId:`${i}-form-item-message`,...a}},die=g.createContext({}),Ta=g.forwardRef(({className:e,...t},r)=>{const s=g.useId();return n.jsx(die.Provider,{value:{id:s},children:n.jsx("div",{ref:r,className:ye("space-y-2",e),...t})})});Ta.displayName="FormItem";const Pa=g.forwardRef(({className:e,...t},r)=>{const{error:s,formItemId:a}=uk();return n.jsx(ze,{ref:r,className:ye(s&&"text-destructive",e),htmlFor:a,...t})});Pa.displayName="FormLabel";const Ia=g.forwardRef(({...e},t)=>{const{error:r,formItemId:s,formDescriptionId:a,formMessageId:i}=uk();return n.jsx(tp,{ref:t,id:s,"aria-describedby":r?`${a} ${i}`:`${a}`,"aria-invalid":!!r,...e})});Ia.displayName="FormControl";const RP=g.forwardRef(({className:e,...t},r)=>{const{formDescriptionId:s}=uk();return n.jsx("p",{ref:r,id:s,className:ye("text-sm text-muted-foreground",e),...t})});RP.displayName="FormDescription";const ro=g.forwardRef(({className:e,children:t,...r},s)=>{const{error:a,formMessageId:i}=uk(),o=a?String(a==null?void 0:a.message):t;return o?n.jsx("p",{ref:s,id:i,className:ye("text-sm font-medium text-destructive",e),...r,children:o}):null});ro.displayName="FormMessage";async function Hut(e){const t=crypto.randomUUID();let r=e.image_url||null;if(e.originating_convergence_id&&!r)try{const{data:i}=await de.from("convergences").select("image_url").eq("id",e.originating_convergence_id).single();i!=null&&i.image_url&&(r=i.image_url)}catch(i){console.warn("Failed to fetch convergence image_url:",i)}const{data:s,error:a}=await de.from("campaigns").insert({...e,id:t,clicks:0,views:0,sales:0,status:"Active",image_url:r}).select().single();if(a)throw a;return e.originating_convergence_id&&await de.from("convergences").update({status:"Used"}).eq("id",e.originating_convergence_id),s}const zut=sf({name:ys().min(1,"Name is required"),notes:ys().optional(),customIdea:ys().optional()}),h4={BASE:{label:"Brand Campaign",icon:p2,description:"A campaign based on your brand strategy and positioning"},CUSTOM:{label:"Custom Campaign",icon:en,description:"A custom campaign tailored to your specific needs"},CONVERGENCE_BASED:{label:"Convergence Campaign",icon:mr,description:"A campaign based on an AI-discovered convergence opportunity"}};function Vut(){var h,m;const e=xr(),t=Gs(),{selectedBrand:r}=mn(),[s,a]=g.useState(!1),i=(h=t.state)==null?void 0:h.convergence,o=i?"CONVERGENCE_BASED":((m=t.state)==null?void 0:m.campaignType)||"CUSTOM",l=()=>{if(!r)return"";if(i)return`${i.trend} <> ${r.brand_name}`;switch(o){case"BASE":return`${r.brand_name} brand campaign`;case"CUSTOM":return`${r.brand_name} brilliant new campaign`;default:return""}},c=Cd({resolver:up(zut),defaultValues:{name:l(),notes:"",customIdea:""}});g.useEffect(()=>{r||e("/brands")},[r,e]),g.useEffect(()=>{r&&c.setValue("name",l())},[r,o,i]);const d=async f=>{if(r){a(!0);try{const{customIdea:p,...A}=f,v=await Hut({...A,brand_id:r.id,originating_convergence_id:(i==null?void 0:i.id)||null,campaign_type:o,metadata:o==="CUSTOM"&&p?{central_theme:p}:void 0});e(`/campaigns/${v.id}`)}catch(p){console.error("Error creating campaign:",p)}finally{a(!1)}}};if(!r)return"No brand selected";const u=h4[o].icon;return n.jsxs("div",{className:"flex flex-col h-[calc(100vh-4rem)]",children:[n.jsxs("div",{className:"flex-none p-6 space-y-6",children:[n.jsx("div",{className:"space-y-4",children:n.jsx(i0,{title:"Create New Campaign",description:"Create a new campaign for your brand",action:{label:"Back",icon:Yo,onClick:()=>e(-1)}})}),n.jsx(Te,{className:"mb-6",children:n.jsxs(Re,{className:"pt-6",children:[n.jsxs("div",{className:"flex items-center gap-4",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("div",{className:"p-2 rounded-full bg-primary/10",children:n.jsx(u,{className:"h-5 w-5 text-primary"})}),n.jsx(Be,{variant:"secondary",className:"text-sm",children:h4[o].label})]}),i&&n.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[n.jsx(Im,{className:"w-4 h-4"}),n.jsxs(Ir,{to:`/convergences/${i.id}`,className:"hover:underline text-primary",children:["View Source Convergence: ",i.trend]})]})]}),n.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:h4[o].description}),i&&n.jsx(Ar,{className:"mt-4",children:n.jsxs(gr,{children:['This campaign is based on the convergence "',i.trend,'".']})})]})})]}),n.jsx(ol,{className:"flex-1 px-6 pb-6",children:n.jsx("div",{className:"bg-white rounded-lg border shadow-sm",children:n.jsx("div",{className:"p-6",children:n.jsx(dk,{...c,children:n.jsxs("form",{onSubmit:c.handleSubmit(d),className:"space-y-8 max-w-2xl",children:[n.jsx(za,{control:c.control,name:"name",render:({field:f})=>n.jsxs(Ta,{children:[n.jsx(Pa,{children:"Campaign Name"}),n.jsx(Ia,{children:n.jsx(qe,{...f})}),n.jsx(ro,{})]})}),n.jsx(za,{control:c.control,name:"notes",render:({field:f})=>n.jsxs(Ta,{children:[n.jsx(Pa,{children:"Notes"}),n.jsx(Ia,{children:n.jsx(Zr,{...f,placeholder:"Add any tracking information around this campaign here"})}),n.jsx(ro,{})]})}),o==="CUSTOM"&&n.jsx(za,{control:c.control,name:"customIdea",render:({field:f})=>n.jsxs(Ta,{children:[n.jsx(Pa,{children:"Custom Campaign Idea"}),n.jsx(Ia,{children:n.jsx(Zr,{...f,placeholder:"Describe the custom idea or theme you want to build your campaign around"})}),n.jsx(ro,{})]})}),n.jsx(te,{type:"submit",disabled:s,children:s?n.jsx(ed,{size:"sm"}):n.jsxs(n.Fragment,{children:[n.jsx(ld,{className:"w-4 h-4 mr-2"}),"Create Campaign"]})})]})})})})})]})}function sw(){const[e,t]=g.useState(null),{toast:r}=sn(),s=g.useCallback(async v=>{try{const{data:x,error:b}=await de.from("scheduled_social_posts").select("id, status, scheduled_time, published_at, published_url, error_message, error_details, attempt_count, last_attempt_time").eq("content_id",v).order("created_at",{ascending:!1}).limit(1);return b?(console.error("Error fetching scheduled post status:",b),null):x&&x.length>0?{id:x[0].id,status:x[0].status,published_url:x[0].published_url,scheduled_for:x[0].scheduled_time,published_at:x[0].published_at,error_message:x[0].error_message,error_details:x[0].error_details,attempt_count:x[0].attempt_count,last_attempt_time:x[0].last_attempt_time}:null}catch(x){return console.error("Error fetching scheduled post status:",x),null}},[]),a=g.useCallback(async v=>{console.log(`Fetching content details for ID: ${v}`);const x=v.split("?")[0],{data:b,error:y}=await de.from("content_management_view").select(`
1772                id,
1773                campaign_id,
1774                brand_id,
1775                content_type,
1776                current_version,
1777                content_status,
1778                content_json,
1779                version_metadata,
1780                name,
1781                version_number,
1782                created_at,
1783                updated_at,
1784                platform_key,
1785                scheduled_post_id,
1786                scheduled_post_status,
1787                scheduled_for,
1788                published_at,
1789                published_url,
1790                error_message,
1791                error_details,
1792                attempt_count,
1793                last_attempt_time,
1794                campaign_name,
1795                campaign_image_url,
1796                display_status,
1797                effective_publish_time,
1798                is_published,
1799                is_scheduled,
1800                is_ready,
1801                is_draft,
1802                convergence_id,
1803                convergence_name,
1804                convergence_image_url,
1805                convergence_text,
1806                convergence_power_score
1807            `).eq("id",x).single();if(y)throw console.error("Error fetching content from view:",y),y;if(!b)return console.error("No content data found in view"),null;console.log(`Content data fetched from view. Current version: ${b.current_version}`);const w=b.scheduled_post_id?{id:b.scheduled_post_id,status:b.scheduled_post_status||"",published_url:b.published_url,scheduled_for:b.scheduled_for,published_at:b.published_at,error_message:b.error_message,error_details:b.error_details,attempt_count:b.attempt_count,last_attempt_time:b.last_attempt_time}:null,j={id:b.id,campaign_id:b.campaign_id,brand_id:b.brand_id,content_type:b.content_type,current_version:b.current_version,version_number:b.version_number||void 0,content_json:b.content_json,version_metadata:b.version_metadata,name:b.name,status:b.content_status,created_at:b.created_at,updated_at:b.updated_at,platform_key:b.platform_key,scheduled_time:b.scheduled_for,published_at:b.published_at,publish_status:b.scheduled_post_status,scheduledPostData:w,display_status:b.display_status||void 0,effective_publish_time:b.effective_publish_time,is_published:b.is_published||void 0,is_scheduled:b.is_scheduled||void 0,is_ready:b.is_ready||void 0,is_draft:b.is_draft||void 0,campaigns:b.campaign_name?{id:b.campaign_id,name:b.campaign_name,image_url:b.campaign_image_url,originating_convergence_id:b.convergence_id??void 0}:null,convergence:b.convergence_name?{id:b.convergence_id,name:b.convergence_name,image_url:b.convergence_image_url??null,convergence:b.convergence_text??null,power_score:b.convergence_power_score??null}:null,convergence_id:b.convergence_id??void 0,convergence_name:b.convergence_name??void 0,convergence_image_url:b.convergence_image_url??void 0,convergence_text:b.convergence_text??void 0,convergence_power_score:b.convergence_power_score??void 0};return t(j),j},[]),i=g.useCallback(async v=>{const{data:x,error:b}=await de.from("content_management_view").select(`
1808                id,
1809                campaign_id,
1810                brand_id,
1811                content_type,
1812                current_version,
1813                content_status,
1814                content_json,
1815                version_metadata,
1816                name,
1817                created_at,
1818                updated_at,
1819                platform_key,
1820                scheduled_post_id,
1821                scheduled_post_status,
1822                scheduled_for,
1823                published_at,
1824                published_url,
1825                error_message,
1826                error_details,
1827                attempt_count,
1828                last_attempt_time,
1829                campaign_name,
1830                campaign_image_url,
1831                display_status,
1832                effective_publish_time,
1833                is_published,
1834                is_scheduled,
1835                is_ready,
1836                is_draft,
1837                is_processing,
1838                is_failed,
1839                convergence_id,
1840                convergence_name,
1841                convergence_image_url,
1842                convergence_text,
1843                convergence_power_score,
1844                image_url,
1845                video_url,
1846                text_preview
1847            `).eq("brand_id",v).order("created_at",{ascending:!1});if(b)throw console.error("Error fetching content management view:",b),b;return x?x.map(w=>{const j=w.scheduled_post_id?{id:w.scheduled_post_id,status:w.scheduled_post_status||"",published_url:w.published_url,scheduled_for:w.scheduled_for,published_at:w.published_at,error_message:w.error_message,error_details:w.error_details,attempt_count:w.attempt_count,last_attempt_time:w.last_attempt_time}:null;return{id:w.id,campaign_id:w.campaign_id,brand_id:w.brand_id,content_type:w.content_type,current_version:w.current_version,content_json:w.content_json,version_metadata:w.version_metadata,name:w.name,status:w.
1847content_status,created_at:w.created_at,updated_at:w.updated_at,platform_key:w.platform_key,scheduled_time:w.scheduled_for,published_at:w.published_at,publish_status:w.scheduled_post_status,scheduledPostData:j,display_status:w.display_status||void 0,effective_publish_time:w.effective_publish_time,is_published:w.is_published||void 0,is_scheduled:w.is_scheduled||void 0,is_ready:w.is_ready||void 0,is_draft:w.is_draft||void 0,is_processing:w.is_processing||void 0,is_failed:w.is_failed||void 0,campaigns:w.campaign_name?{id:w.campaign_id,name:w.campaign_name,image_url:w.campaign_image_url,originating_convergence_id:w.convergence_id??void 0}:null,convergence:w.convergence_name?{id:w.convergence_id,name:w.convergence_name,image_url:w.convergence_image_url??null,convergence:w.convergence_text??null,power_score:w.convergence_power_score??null}:null,convergence_id:w.convergence_id??void 0,convergence_name:w.convergence_name??void 0,convergence_image_url:w.convergence_image_url??void 0,convergence_text:w.convergence_text??void 0,convergence_power_score:w.convergence_power_score??void 0}}):[]},[]),o=async(v,x)=>{if(!v)throw new Error("Content ID is required");console.log("Updating content details for ID:",v);const b={};if(x.status&&(b.status=x.status),Object.keys(b).length>0){const{error:y}=await de.from("contents").update(b).eq("id",v);if(y)throw y}if(x.name&&(e!=null&&e.current_version)){const{error:y}=await de.from("content_versions").update({name:x.name}).eq("content_id",v).eq("version_number",e.current_version);if(y)throw y}return await a(v)},l=g.useCallback(async(v,x="image")=>{var b;console.log("Enhancing media for content ID:",v,"with media type:",x);try{const y=await fetch("https://worker.rainfactory.ai/rainfactory/content-functions/enhance-media",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${(b=(await de.auth.getSession()).data.session)==null?void 0:b.access_token}`},body:JSON.stringify({contentId:v,mediaType:x})});if(!y.ok){const j=await y.json().catch(()=>({}));throw new Error(j.error||`Failed to enhance media: ${y.statusText}`)}const w=await y.json();return console.log("Media enhancement result:",w),await a(v),w}catch(y){throw console.error("Error enhancing content media:",y),y}},[a]),c=g.useCallback(async(v,x,b)=>{var y;try{console.log("[createOrUpdateScheduledPost] start",{contentId:v,scheduledFor:x,platformKey:b});const w=await de.auth.getSession();if(console.log("[createOrUpdateScheduledPost] session",{hasSession:!!w.data.session}),!w.data.session)throw new Error("No session found");console.log("[createOrUpdateScheduledPost] fetching content details");const j=await a(v);if(console.log("[createOrUpdateScheduledPost] content loaded",{hasContent:!!j,platform_key:j==null?void 0:j.platform_key}),!j)throw new Error("Content not found");const N=b||j.platform_key||((y=j.content_json)==null?void 0:y.platform);if(console.log("[createOrUpdateScheduledPost] resolved platform",{platform:N}),!N)throw new Error("No platform specified for content");console.log("[createOrUpdateScheduledPost] querying platforms table");const{data:_,error:S}=await de.from("platforms").select("id").eq("platform_key",N).single();if(S||!_)throw new Error("Platform not found");console.log("[createOrUpdateScheduledPost] checking for existing scheduled post");const{data:C}=await de.from("scheduled_social_posts").select("id, status").eq("content_id",v).in("status",["scheduled","SCHEDULED","HOLD","HELD","READY"]).single();if(C){console.log("[createOrUpdateScheduledPost] updating existing scheduled post",C);let E=C.status;(C.status==="READY"||C.status==="scheduled")&&(E="SCHEDULED"),console.log("[createOrUpdateScheduledPost] supabase update scheduled_social_posts",{scheduledFor:x,newStatus:E});const{error:T}=await de.from("scheduled_social_posts").update({scheduled_time:x,status:E,updated_at:new Date().toISOString()}).eq("id",C.id);if(T)throw T;if(E==="SCHEDULED"){console.log("[createOrUpdateScheduledPost] updating contents.status to SCHEDULED");const{error:B}=await de.from("contents").update({status:"SCHEDULED",updated_at:new Date().toISOString()}).eq("id",v);B&&console.error("Error updating content status to SCHEDULED:",B)}}else{console.log("[createOrUpdateScheduledPost] creating scheduled post via worker fetch");const T=await(await fetch("https://worker.rainfactory.ai/rainfactory/content-functions/publish-social",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${w.data.session.access_token}`},body:JSON.stringify({contentId:v,platformKey:N,scheduled_for:x})})).json();if(!T.success)throw new Error(T.error||"Failed to schedule content");console.log("[createOrUpdateScheduledPost] updating contents.status to SCHEDULED (new post)");const{error:B}=await de.from("contents").update({status:"SCHEDULED",updated_at:new Date().toISOString()}).eq("id",v);B&&console.error("Error updating content status to SCHEDULED:",B)}return console.log("[createOrUpdateScheduledPost] success"),{success:!0}}catch(w){return console.error("Error creating/updating scheduled post:",w),{success:!1,error:w instanceof Error?w.message:"Failed to schedule content"}}},[a]),d=g.useCallback(async(v,x)=>{var b;try{const y=await de.auth.getSession();if(!y.data.session)throw new Error("No session found");const w=await a(v);if(!w)throw new Error("Content not found");const j=x||w.platform_key||((b=w.content_json)==null?void 0:b.platform);
1847if(!j)throw new Error("No platform specified for content");const _=await(await fetch("https://worker.rainfactory.ai/rainfactory/content-functions/publish-social",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${y.data.session.access_token}`},body:JSON.stringify({contentId:v,platformKey:j,scheduled_for:new Date().toISOString()})})).json();if(!_.success)throw new Error(_.error||"Failed to publish content");return{success:!0,publishedUrl:_.publishedUrl}}catch(y){return console.error("Error publishing content:",y),{success:!1,error:y instanceof Error?y.message:"Failed to publish content"}}},[a]),u=g.useCallback(async v=>{try{const{data:x,error:b}=await de.from("scheduled_social_posts").select("id").eq("content_id",v).in("status",["scheduled","SCHEDULED"]).single();if(b||!x)throw new Error("No scheduled post found");const{error:y}=await de.from("scheduled_social_posts").update({status:"HOLD",updated_at:new Date().toISOString()}).eq("id",x.id);if(y)throw y;return await de.from("contents").update({status:"READY",updated_at:new Date().toISOString()}).eq("id",v),{success:!0}}catch(x){return console.error("Error canceling scheduled post:",x),{success:!1,error:x instanceof Error?x.message:"Failed to cancel scheduled post"}}},[]),h=g.useCallback(async v=>{try{const x=await de.auth.getSession();if(!x.data.session)throw new Error("No session found");const{data:b,error:y}=await de.from("scheduled_social_posts").select("id").eq("content_id",v).in("status",["published","PUBLISHED"]).single();if(y||!b)throw new Error("No published post found");const w=await fetch("https://worker.rainfactory.ai/rainfactory/content-functions/unpublish-social",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${x.data.session.access_token}`},body:JSON.stringify({scheduledPostId:b.id})}),j=await w.json();if(!w.ok||!j.success)throw new Error(j.error||"Failed to unpublish content");return{success:!0}}catch(x){return console.error("Error unpublishing content:",x),{success:!1,error:x instanceof Error?x.message:"Failed to unpublish content"}}},[]),m=g.useCallback(async(v,x)=>{var w;console.log("Bulk cancel scheduled - selected IDs:",Array.from(x));const b=v.filter(j=>x.has(j.id));console.log("Selected items:",b);const y=b.filter(j=>(j.display_status==="SCHEDULED"||j.is_scheduled===!0)&&j.scheduled_time&&!j.published_at);if(console.log("Scheduled items to cancel:",y),y.length===0)return r({title:"No scheduled content selected",description:"Please select scheduled content to cancel",variant:"destructive"}),{success:!1,error:"No scheduled content selected"};try{const{data:j}=await de.auth.getSession();let N=0;for(const _ of y){const{data:S}=await de.from("scheduled_social_posts").select("id").eq("content_id",_.id).eq("status","SCHEDULED").single();if(S){console.log("Canceling via API for scheduled post:",S.id);const C=await fetch("https://worker.rainfactory.ai/api/autopost/cancel-publishing",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${(w=j==null?void 0:j.session)==null?void 0:w.access_token}`},body:JSON.stringify({scheduledPostId:S.id,force:!0})});if(!C.ok){const E=await C.json();throw console.error("API cancel failed:",E),new Error(E.error||"Failed to cancel scheduled post")}N++}else{console.log("No scheduled_post record, updating content directly for:",_.id);const{error:C}=await de.from("contents").update({scheduled_time:null,publish_status:null,updated_at:new Date().toISOString()}).eq("id",_.id);if(C)throw console.error("Direct update failed:",C),C;N++}}return console.log("Successfully cancelled:",N,"items"),r({title:"Scheduling cancelled",description:`Cancelled scheduling for ${N} items`}),{success:!0,successCount:N}}catch(j){return console.error("Error cancelling scheduled content:",j),r({title:"Error",description:j instanceof Error?j.message:"Failed to cancel scheduled content",variant:"destructive"}),{success:!1,error:j instanceof Error?j.message:"Failed to cancel scheduled content"}}},[r]),f=g.useCallback(async(v,x)=>{var j;console.log("Bulk archive - selected IDs:",Array.from(x));const b=v.filter(N=>
1847x.has(N.id));console.log("Selected items for archive:",b.map(N=>({id:N.id,status:N.status,published_at:N.published_at,scheduled_time:N.scheduled_time})));const y=b.filter(N=>N.status!=="ARCHIVED");if(console.log("Archivable items:",y.map(N=>N.id)),y.length===0)return r({title:"No archivable content selected",description:"Selected content is already archived",variant:"destructive"}),{success:!1,error:"No archivable content selected"};if(y.some(N=>N.is_published===!0||N.is_scheduled===!0||N.display_status==="PUBLISHED"||N.display_status==="SCHEDULED")&&!window.confirm("Some selected content is published or scheduled. Archiving will not remove published posts from platforms. Continue?"))return{success:!1,error:"User cancelled"};try{let N=0;for(const _ of y){if(console.log("Archiving content:",_.id),_.is_scheduled===!0||_.display_status==="SCHEDULED"){const{data:E}=await de.from("scheduled_social_posts").select("id").eq("content_id",_.id).eq("status","SCHEDULED").single();if(E){console.log("Canceling scheduled post before archiving:",E.id);const{data:T}=await de.auth.getSession();(await fetch("https://worker.rainfactory.ai/api/autopost/cancel-publishing",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${(j=T==null?void 0:T.session)==null?void 0:j.access_token}`},body:JSON.stringify({scheduledPostId:E.id,force:!0})})).ok||console.warn("Failed to cancel scheduled post, continuing with archive")}}const{data:S,error:C}=await de.from("contents").update({status:"ARCHIVED",updated_at:new Date().toISOString()}).eq("id",_.id).select().single();if(C)throw console.error("Failed to archive content:",C),C;console.log("Successfully archived content:",S),N++}return console.log("Successfully archived:",N,"items"),r({title:"Content archived",description:`Archived ${N} items`}),{success:!0,successCount:N}}catch(N){return console.error("Error archiving content:",N),r({title:"Error",description:"Failed to archive content",variant:"destructive"}),{success:!1,error:N instanceof Error?N.message:"Failed to archive content"}}},[r]),p=g.useCallback(async(v,x)=>{var _;console.log("Bulk delete - selected IDs:",Array.from(x));const y=v.filter(S=>x.has(S.id)).filter(S=>S.status!=="DELETED");if(y.length===0)return r({title:"No deletable content selected",description:"Only unpublished and unscheduled content can be deleted",variant:"destructive"}),{success:!1,error:"No deletable content selected"};const w=y.some(S=>S.is_published===!0||S.is_scheduled===!0||S.display_status==="PUBLISHED"||S.display_status==="SCHEDULED");let j=`Are you sure you want to delete ${y.length} items? This action cannot be undone.`;if(w&&(j=`Some selected content is published or scheduled. Deleting will not remove published posts from platforms. ${j}`),!window.confirm(j))return{success:!1,error:"User cancelled"};try{let S=0;for(const C of y){if(console.log("Deleting content:",C.id),C.is_scheduled===!0||C.display_status==="SCHEDULED"){const{data:B}=await de.from("scheduled_social_posts").select("id").eq("content_id",C.id).eq("status","SCHEDULED").single();if(B){console.log("Canceling scheduled post before deleting:",B.id);const{data:L}=await de.auth.getSession();(await fetch("https://worker.rainfactory.ai/api/autopost/cancel-publishing",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${(_=L==null?void 0:L.session)==null?void 0:_.access_token}`},body:JSON.stringify({scheduledPostId:B.id,force:!0})})).ok||console.warn("Failed to cancel scheduled post, continuing with delete")}}const{data:E,error:T}=await de.from("contents").update({status:"DELETED",updated_at:new Date().toISOString()}).eq("id",C.id).select().single();if(T)throw console.error("Failed to delete content:",T),T;console.log("Successfully deleted content:",E),S++}return console.log("Successfully deleted:",S,"items"),r({title:"Content deleted",description:`Deleted ${S} items`}),{success:!0,successCount:S}}
1847catch(S){return console.error("Error deleting content:",S),r({title:"Error",description:"Failed to delete content",variant:"destructive"}),{success:!1,error:S instanceof Error?S.message:"Failed to delete content"}}},[r]),A=g.useCallback(async(v,x)=>{try{const{error:b}=await de.from("scheduled_social_posts").update({scheduled_time:x}).eq("content_id",v.id);return b?(console.error("Error updating scheduled time:",b),r({title:"Error",description:"Failed to update schedule",variant:"destructive"}),{success:!1,error:"Failed to update schedule"}):(r({title:"Schedule updated",description:"Content scheduled for new time"}),{success:!0})}catch(b){return console.error("Error updating schedule:",b),r({title:"Error",description:"Failed to update schedule",variant:"destructive"}),{success:!1,error:b instanceof Error?b.message:"Failed to update schedule"}}},[r]);return{currentContent:e,setCurrentContent:t,fetchContentDetails:a,fetchContentsByBrand:i,fetchScheduledPostStatus:s,updateContentDetails:o,enhanceContentMedia:l,createOrUpdateScheduledPost:c,publishContentNow:d,cancelScheduledPost:u,unpublishContent:h,bulkCancelScheduled:m,bulkArchive:f,bulkDelete:p,updateContentSchedule:A}}function hk({isOpen:e,onClose:t,contentId:r,currentScheduledTime:s,onScheduleUpdate:a,isNewSchedule:i=!1}){const[o,l]=g.useState(""),[c,d]=g.useState(""),[u,h]=g.useState(!1),[m,f]=g.useState(!1),[,p]=g.useState(new Date),[A,v]=g.useState(!1),{createOrUpdateScheduledPost:x}=sw(),{formatDate:b,getCurrentTime:y,fromUTC:w,getDisplayName:j,getAbbreviation:N,isLoading:_}=Gl(),{getBusinessSchedulingRecommendations:S}=zKe();g.useEffect(()=>{if(!e)return;const F=()=>{p(y())};F();const M=setInterval(F,1e3);return()=>clearInterval(M)},[e,y]),g.useEffect(()=>{if(e&&!_)if(s){const F=new Date(s),M=w(F),I=M.getFullYear(),$=String(M.getMonth()+1).padStart(2,"0"),V=String(M.getDate()).padStart(2,"0"),R=String(M.getHours()).padStart(2,"0"),Q=String(M.getMinutes()).padStart(2,"0"),U=`${I}-${$}-${V}`,D=`${R}:${Q}`;l(U),d(D)}else{const F=y();F.setDate(F.getDate()+1),F.setHours(9,0,0,0);const M=F.getFullYear(),I=String(F.getMonth()+1).padStart(2,"0"),$=String(F.getDate()).padStart(2,"0"),V=`${M}-${I}-${$}`;l(V),d("09:00")}},[e,s,_,w,y]);const C=async()=>{if(console.log("ChangeScheduleModal.handleSave clicked",{contentId:r,newDate:o,newTime:c,isOpen:e}),!o||!c){He({title:"Validation Error",description:"Please select both date and time",variant:"destructive"});return}const F=new Date(`${o}T${c}`),M=F.getFullYear(),I=F.getMonth(),$=F.getDate(),V=F.getHours(),R=F.getMinutes(),Q=new Date(M,I,$,V,R),U=y(),D=new Date,q=U.getTime()-D.getTime(),G=new Date(Q.getTime()-q),Y=y();if(F<=Y){const K=N();He({title:"Invalid Date",description:`Please select a future date and time in ${K}`,variant:"destructive"});return}h(!0);try{const K=await x(r,G.toISOString());if(!K.success)throw new Error(K.error||"Failed to schedule content");const X=b(F,"MMM dd, yyyy h:mm a"),ne=N(F);He({title:i?"Content Scheduled":"Schedule Updated",description:`Content ${i?"scheduled":"rescheduled"} for ${X} ${ne}`}),a==null||a(),t()}catch(K){console.error("Failed to update schedule:",K),He({title:"Error",description:K instanceof Error?K.message:"Failed to update schedule. Please try again.",variant:"destructive"})}finally{h(!1)}},E=async()=>{if(!s){He({title:"Error",description:"No scheduled post to cancel",variant:"destructive"});return}f(!0);try{const{error:F}=await de.from("scheduled_social_posts").update({status:"HOLD",updated_at:new Date().toISOString()}).eq("content_id",r).eq("status","SCHEDULED");if(F)throw console.error("Error canceling schedule:",F),F;He({title:"Schedule Cancelled",description:"The scheduled post has been cancelled and moved to hold status"}),a==null||a(),t()}catch(F){console.error("Failed to cancel schedule:",F),He({title:"Error",description:"Failed to cancel schedule. Please try again.",variant:"destructive"})}finally{f(!1)}},T=()=>{l(""),d(""),v(!1),f(!1),t()},B=o&&c?new Date(`${o}T${c}`):null,L=B?S(B):null,P=(()=>{if(!o||!c)return!1;try{const F=new Date(`${o}T${c}`),M=y();return F<=M}catch{return!1}})();return n.jsx(Zt,{open:e,onOpenChange:F=>{F||T()}
1847,children:n.jsxs(Jt,{className:"w-[95vw] max-w-[550px] max-h-[85vh] sm:max-h-[90vh] overflow-y-auto mx-2 sm:mx-4 p-4 sm:p-6",children:[n.jsx(_r,{children:n.jsx("div",{className:"flex flex-col sm:flex-row sm:items-start justify-between gap-3 sm:gap-4",children:n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs(tr,{className:"flex items-center gap-2 text-lg leading-tight",children:[n.jsx(Kn,{className:"h-5 w-5 shrink-0"}),i?"Schedule Content":"Change Schedule"]}),n.jsx(Hr,{className:"mt-2 text-sm leading-relaxed",children:i?"Select a date and time to publish this content.":"Select a new date and time for publishing this content."})]})})}),n.jsxs("div",{className:"space-y-4 sm:space-y-6 py-4 sm:py-6",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsxs(ze,{htmlFor:"date",className:"text-sm font-medium flex items-center gap-2",children:[n.jsx(Kn,{className:"h-4 w-4"}),"Date"]}),n.jsx(qe,{id:"date",type:"date",value:o,onChange:F=>l(F.target.value),className:"w-full h-11 text-base",min:y().toISOString().split("T")[0]}),n.jsxs("p",{className:"text-xs text-muted-foreground",children:["Date in your timezone (",N(),")"]})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs(ze,{htmlFor:"time",className:"text-sm font-medium flex items-center gap-2",children:[n.jsx(Vr,{className:"h-4 w-4"}),n.jsxs("span",{className:"flex-1",children:["Time",s&&n.jsxs("span",{className:"block text-xs font-normal text-muted-foreground mt-0.5",children:["Currently: ",b(s,"MMM dd h:mm a")," ",N(new Date(s))]})]})]}),n.jsx("div",{className:"relative",children:n.jsx(qe,{id:"time",type:"time",value:c,onChange:F=>d(F.target.value),className:"w-full h-11 text-base"})}),n.jsxs("p",{className:"text-xs text-muted-foreground",children:["Time will be scheduled in ",j()," (",N(),")"]}),P&&n.jsx("p",{className:"text-xs text-destructive mt-1",children:"Please select a future time."})]}),o&&c&&n.jsx("div",{className:"p-3 sm:p-4 bg-muted/20 rounded-lg border border-muted/40",children:n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 text-sm",children:[n.jsx("span",{className:"text-muted-foreground font-medium text-xs sm:text-sm",children:"Will be scheduled for:"}),n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2",children:[n.jsxs("span",{className:"font-semibold text-sm break-words",children:[b(new Date(`${o}T${c}`),"MMM dd, yyyy h:mm a")," ",N()]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(IF,{date:B,showBusinessHours:!0,trigger:n.jsx(te,{size:"sm",variant:"ghost",onClick:()=>v(!A),className:"h-8 w-8 p-0 hover:bg-muted/50 shrink-0",children:n.jsx(Is,{className:"h-4 w-4"})})}),n.jsx("span",{className:"text-xs text-muted-foreground sm:hidden",children:"Global view"})]})]})]})}),A&&B&&L&&n.jsxs(Te,{className:"border-blue-200 bg-blue-50/30",children:[n.jsx(st,{className:"pb-2 sm:pb-3",children:n.jsxs(ot,{className:"text-sm flex items-center gap-2",children:[n.jsx(Is,{className:"h-4 w-4"}),"Global Team Impact"]})}),n.jsxs(Re,{className:"pt-0 space-y-3 sm:space-y-4",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"BUSINESS HOURS COVERAGE"}),n.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:L.current.slice(0,6).map(F=>n.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[F.isBusinessHours?n.jsx(qt,{className:"h-3 w-3 text-green-500 shrink-0"}):n.jsx(Vr,{className:"h-3 w-3 text-gray-400 shrink-0"}),n.jsxs("span",{className:`break-words ${F.isBusinessHours?"text-green-700":"text-muted-foreground"}`,children:[F.abbreviation,": ",F.time.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit"})]})]},F.timezone))})]}),L.warnings.length>0&&n.jsxs("div",{className:"space-y-2",children:[n.jsx("div",{className:"text-xs font-medium text-amber-700",children:"COORDINATION CHALLENGES"}),n.jsx("div",{className:"space-y-1",children:L.warnings.map((F,M)=>n.jsxs("div",{className:"flex items-start gap-2 text-xs text-amber-700",children:[n.jsx(hn,{className:"h-3 w-3 shrink-0 mt-0.5"}),n.jsx("span",{className:"break-words",children:F})]},M))})]}),L.recommendations.length>0&&n.jsxs("div",{className:"space-y-2",children:[n.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"BETTER ALTERNATIVES"}),n.jsx("div",{className:"space-y-2",children:L.recommendations.slice(0,2).map((F,M)=>n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 p-3 bg-white rounded-md border text-xs",children:[n.jsxs("div",{className:"flex-1",children:[n.jsx("div",{className:"font-medium",children:F.time.toLocaleStr
1847ing("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}),n.jsx("div",{className:"text-muted-foreground mt-1 break-words",children:F.reason})]}),n.jsx(te,{size:"sm",variant:"outline",onClick:()=>{const I=F.time,$=I.getFullYear(),V=String(I.getMonth()+1).padStart(2,"0"),R=String(I.getDate()).padStart(2,"0"),Q=String(I.getHours()).padStart(2,"0"),U=String(I.getMinutes()).padStart(2,"0");l(`${$}-${V}-${R}`),d(`${Q}:${U}`)},className:"text-xs h-8 px-3 w-full sm:w-auto shrink-0",children:"Use This Time"})]},M))})]})]})]})]}),s&&!i&&n.jsx("div",{className:"border-t pt-4",children:n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 p-3 sm:p-4 bg-destructive/5 rounded-lg border border-destructive/20",children:[n.jsxs("div",{className:"flex-1",children:[n.jsx("div",{className:"text-sm font-medium text-destructive",children:"Cancel Scheduled Post"}),n.jsx("div",{className:"text-xs text-muted-foreground mt-1",children:"This will move the content to hold status and prevent it from being published."})]}),n.jsx(te,{variant:"destructive",onClick:E,disabled:u||m,size:"default",className:"w-full sm:w-auto h-11 sm:h-9",children:m?n.jsxs(n.Fragment,{children:[n.jsx(kr,{className:"mr-2 h-4 w-4"}),"Cancelling..."]}):n.jsxs(n.Fragment,{children:[n.jsx(kr,{className:"mr-2 h-4 w-4"}),"Cancel Schedule"]})})]})}),n.jsx(Sn,{className:"pt-4",children:n.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 sm:gap-3 w-full",children:[n.jsx(te,{type:"button",variant:"outline",onClick:T,disabled:u||m,className:"flex-1 h-11 sm:h-10",children:"Close"}),n.jsx(te,{type:"button",onClick:F=>{F.stopPropagation(),C()},disabled:u||m||P||!o||!c,className:"flex-1 h-11 sm:h-10",children:u?i?"Scheduling...":"Updating...":i?"Schedule Content":"Update Schedule"})]})})]})})}const Jz={ad_group:"Ad Group",blog_post:"Blog Post",landing_page:"Landing Page",email_sales_sequence:"Sales Email Sequence",email_educational_sequence:"Educational Email Sequence",email_newsletter:"Email Newsletter",quiz:"Quiz",video:"Video",tool:"Tool",social_post:"Social Post"};function Gut({search:e,onSearchChange:t,contentType:r,onContentTypeChange:s,statusFilter:a,onStatusFilterChange:i,platformFilter:o,onPlatformFilterChange:l,sortConfig:c,onSortConfigChange:d,filtersExpanded:u,onFiltersExpandedChange:h,viewMode:m}){const f=e!==""||r!=="all"||a!=="scheduled_and_ready"||o!=="all",p=()=>{t(""),s("all"),i("scheduled_and_ready"),l("all"),d({key:"created_at",direction:"desc"})};return n.jsxs("div",{className:"relative overflow-hidden bg-white/60 backdrop-blur-sm rounded-xl border border-white/50 shadow-sm",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-blue-50/30 via-transparent to-purple-50/30"}),n.jsxs("div",{className:"relative",children:[n.jsxs("div",{className:"block lg:hidden",children:[n.jsx("div",{className:"p-4 border-b border-white/30",children:n.jsxs("div",{className:"relative",children:[n.jsx(Ns,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),n.jsx(qe,{placeholder:"Search content...",value:e,onChange:A=>t(A.target.value),className:"pl-10 h-10 bg-white/50 border-white/50 focus:bg-white/70 transition-colors text-sm"})]})}),n.jsx("div",{className:"p-4",children:n.jsxs(te,{variant:"ghost",onClick:()=>h(!u),className:"w-full justify-between h-10 text-sm bg-white/30 hover:bg-white/50 transition-colors",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(IA,{className:"h-4 w-4"}),n.jsx("span",{children:"Filters & Sorting"}),(a!=="all"||r!=="all"||o!=="all")&&n.jsx("div",{className:"h-2 w-2 bg-blue-500 rounded-full"})]}),u?n.jsx(Fu,{className:"h-4 w-4"}):n.jsx(Un,{className:"h-4 w-4"})]})}),u&&n.jsxs("div",{className:"px-4 pb-4 space-y-3 border-t border-white/30 pt-4",children:[f&&n.jsxs(te,{variant:"outline",size:"sm",onClick:p,className:"w-full h-9 text-xs bg-white/30 hover:bg-white/50 border-blue-200",children:[n.jsx(kr,{className:"h-3 w-3 mr-1"}),"Reset All Filters"]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-xs text-gray-600 font-medium mb-2 block",children:"Status"}),n.jsxs(ur,{value:a,onValueChange:A=>i(A),children:[n.jsxs(or,{className:"w-full h-10 bg-white/50 border-white/50 focus:bg-white/70 transition-colors text-sm",children:[n.jsx(IA,{className:"h-3 w-3 mr-2"}),n.jsx(hr,{placeholder:"Filter by status"})]}),n.jsxs(lr,{children:[n.jsx(Fe,{value:"all",children:"All Content"}),n.jsx(Fe,{value:"published",children:"Published"}),n.jsx(Fe,{value:"scheduled",children:"Scheduled"}),n.jsx(Fe,{value:"held",children:"Held"}),n.jsx(Fe,{value:"scheduled_and_held",children:"Scheduled & Held"}),n.jsx(Fe,{value:"ready",children:"Ready"}),n.jsx(Fe,{value:"scheduled_and_ready",children:"Scheduled & Ready (Default)"}),n.jsx(Fe,{value:"draft",children:"Draft"}),n.jsx(Fe,{value:"generating",children:"Generating"}),n.jsx(Fe,{value:"processing",children:"Processing"}),n.jsx(Fe,{value:"failed",children:"Failed"}),n.jsx(Fe,{value:"error",children:"Error"}),n.jsx(Fe,{value:"cancelled",children:"Cancelled"}),n.jsx(Fe,{value:"archived",children:"Archived"}),n.jsx(Fe,{value:"deleted",children:"Deleted"})]})]})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-xs text-gray-600 font-medium mb-2 block",children:"Content Type"}),n.jsxs(ur,{value:r,onValueChange:s,children:[n.jsx(or,{className:"w-full h-10 bg-white/50 border-white/50 focus:bg-white/70 transition-colors text-sm",children:n.jsx(hr,{placeholder:"Content Type"})}),n.jsxs(lr,{children:[n.jsx(Fe,{value:"all",children:"All Types"}
1847),Object.entries(Jz).map(([A,v])=>n.jsx(Fe,{value:A,children:v},A))]})]})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-xs text-gray-600 font-medium mb-2 block",children:"Platform"}),n.jsxs(ur,{value:o,onValueChange:l,children:[n.jsx(or,{className:"w-full h-10 bg-white/50 border-white/50 focus:bg-white/70 transition-colors text-sm",children:n.jsx(hr,{placeholder:"Platform"})}),n.jsxs(lr,{children:[n.jsx(Fe,{value:"all",children:"All Platforms"}),n.jsx(Fe,{value:"instagram",children:"Instagram"}),n.jsx(Fe,{value:"facebook",children:"Facebook"}),n.jsx(Fe,{value:"linkedin",children:"LinkedIn"}),n.jsx(Fe,{value:"twitter",children:"Twitter/X"}),n.jsx(Fe,{value:"rss",children:"RSS"})]})]})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-xs text-gray-600 font-medium mb-2 block",children:"Sort By"}),n.jsxs(ur,{value:`${c.key}_${c.direction}`,onValueChange:A=>{const v=A.lastIndexOf("_"),x=A.substring(0,v),b=A.substring(v+1);d({key:x,direction:b})},children:[n.jsxs(or,{className:"w-full h-10 bg-white/50 border-white/50 focus:bg-white/70 transition-colors text-sm",children:[n.jsx(ju,{className:"h-3 w-3 mr-2"}),n.jsx(hr,{placeholder:"Sort by"})]}),n.jsxs(lr,{children:[n.jsx(Fe,{value:"created_at_desc",children:"Newest Created"}),n.jsx(Fe,{value:"created_at_asc",children:"Oldest Created"}),n.jsx(Fe,{value:"published_at_desc",children:"Recently Published"}),n.jsx(Fe,{value:"published_at_asc",children:"Oldest Published"}),n.jsx(Fe,{value:"scheduled_time_desc",children:"Recently Scheduled"}),n.jsx(Fe,{value:"scheduled_time_asc",children:"Oldest Scheduled"}),n.jsx(Fe,{value:"name_asc",children:"Name (A-Z)"}),n.jsx(Fe,{value:"name_desc",children:"Name (Z-A)"})]})]})]})]})]}),n.jsx("div",{className:"hidden lg:block p-6",children:n.jsxs("div",{className:"flex flex-col gap-4",children:[n.jsxs("div",{className:"flex gap-3",children:[n.jsxs("div",{className:"relative flex-grow",children:[n.jsx(Ns,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),n.jsx(qe,{placeholder:"Search content...",value:e,onChange:A=>t(A.target.value),className:"pl-10 h-12 bg-white/50 border-white/50 focus:bg-white/70 transition-colors"})]}),f&&n.jsxs(te,{variant:"outline",onClick:p,className:"h-12 bg-white/30 hover:bg-white/50 border-blue-200 whitespace-nowrap",children:[n.jsx(kr,{className:"h-4 w-4 mr-2"}),"Reset Filters"]})]}),n.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[n.jsxs(ur,{value:a,onValueChange:A=>i(A),children:[n.jsxs(or,{className:"w-full sm:w-[160px] h-12 bg-white/50 border-white/50 focus:bg-white/70 transition-colors",children:[n.jsx(IA,{className:"h-4 w-4 mr-2"}),n.jsx(hr,{placeholder:"Filter by status"})]}),n.jsxs(lr,{children:[n.jsx(Fe,{value:"all",children:"All Content"}),n.jsx(Fe,{value:"published",children:"Published"}),n.jsx(Fe,{value:"scheduled",children:"Scheduled"}),n.jsx(Fe,{value:"held",children:"Held"}),n.jsx(Fe,{value:"scheduled_and_held",children:"Scheduled & Held"}),n.jsx(Fe,{value:"ready",children:"Ready"}),n.jsx(Fe,{value:"scheduled_and_ready",children:"Scheduled & Ready (Default)"}),n.jsx(Fe,{value:"draft",children:"Draft"}),n.jsx(Fe,{value:"generating",children:"Generating"}),n.jsx(Fe,{value:"processing",children:"Processing"}),n.jsx(Fe,{value:"failed",children:"Failed"}),n.jsx(Fe,{value:"error",children:"Error"}),n.jsx(Fe,{value:"cancelled",children:"Cancelled"}),n.jsx(Fe,{value:"archived",children:"Archived"}),n.jsx(Fe,{value:"deleted",children:"Deleted"})]})]}),n.jsxs(ur,{value:r,onValueChange:s,children:[n.jsx(or,{className:"w-full sm:w-[180px] h-12 bg-white/50 border-white/50 focus:bg-white/70 transition-colors",children:n.jsx(hr,{placeholder:"Content Type"})}),n.jsxs(lr,{children:[n.jsx(Fe,{value:"all",children:"All Types"}),Object.entries(Jz).map(([A,v])=>n.jsx(Fe,{value:A,children:v},A))]})]}),n.jsxs(ur,{value:o,onValueChange:l,children:[n.jsx(or,{className:"w-full sm:w-[160px] h-12 bg-white/50 border-white/50 focus:bg-white/70 transition-colors",children:n.jsx(hr,{placeholder:"Platform"})}),n.jsxs(lr,{children:[n.jsx(Fe,{value:"all",children:"All Platforms"}),n.jsx(Fe,{value:"instagram",children:"Instagram"}),n.jsx(Fe,{value:"facebook",children:"Facebook"}),n.jsx(Fe,{value:"linkedin",children:"LinkedIn"}),n.jsx(Fe,{value:"twitter",children:"Twitter/X"}),n.jsx(Fe,{value:"rss",children:"RSS"})]})]}),n.jsxs(ur,{value:`${c.key}_${c.direction}`,onValueChange:A=>{const v=A.lastIndexOf("_"),x=A.substring(0,v),b=A.substring(v+1);d({key:x,direction:b})},children:[n.jsxs(or,{className:"w-full sm:w-[180px] h-12 bg-white/50 border-white/50 focus:bg-white/70 transition-colors",children:[n.jsx(ju,{className:"h-4 w-4 mr-2"}),n.jsx(hr,{placeholder:"Sort by"})]}),n.jsxs(lr,{children:[n.jsx(Fe,{value:"created_at_desc",children:"Newest Created"}),n.jsx(Fe,{value:"created_at_asc",children:"Oldest Created"}),n.jsx(Fe,{value:"published_at_desc",children:"Recently Published"}),n.jsx(Fe,{value:"published_at_asc",children:"Oldest Published"}),n.jsx(Fe,{value:"scheduled_time_desc",children:"Recently Scheduled"}),n.jsx(Fe,{value:"scheduled_time_asc",children:"Oldest Scheduled"}),n.jsx(Fe,{value:"name_asc",children:"Name (A-Z)"}),n.jsx(Fe,{value:"name_desc",children:"Name (Z-A)"})]})]})]})]})})]})]})}function qut({selectedContent:e,isSelectionMode:t,contents:r,paginatedContents:s,onToggleSelectAll:a,onBulkCancelScheduled:i,onBulkArchive:o,onBulkDelete:l}){if(!t||e.size===0)return null;const c=r.filter(m=>e.has(m.id)),d=c.some(m=>m.is_scheduled===!0||m.display_status==="SCHEDULED"),u=c.some(m=>m.status!=="ARCHIVED"),h=c.some(m=>m.status!=="DELETED");return!d&&!u&&!h?null:n.jsx("div",{className:"relative overflow-hidden bg-gradient-to-r from-blue-50 via-indigo-50 to-purple-50 rounded-xl border border-blue-200 shadow-sm animate-in slide-in-from-top-2 duration-300",children:n.jsx("div",{className:"p-3 sm:p-4",children:n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 sm:gap-0",children:[n.jsxs("div",{className:"flex items-center gap-3 sm:gap-4",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("div",{className:"p-2 bg-white/80 backdrop-blur-sm rounded-lg shadow-sm",children:n.jsx(SK,{className:"h-5 w-5 text-blue-600"})}),n.jsxs("div",{children:[n.jsxs("p",{className:"text-sm font-semibold text-gray-900",children:[e.size," ",e.size===1?"item":"items"," selected"]}),n.jsxs("p",{className:"text-xs text-gray-600",children:[r.length," total in current filter"]})]})]}),n.jsx("div",{className:"hidden sm:block h-8 w-px bg-gray-300"}),n.jsx(te,{variant:"ghost",size:"sm",onClick:a,className:"text-blue-600 hover:text-blue-700 hover:bg-blue-50",children:e.size===s.length?"Deselect All":"Select All on Page"})]}),n.jsxs("div",{className:"flex flex-col xs:flex-row items-stretch xs:items-center gap-2 xs:gap-3",children:[d&&n.jsxs(te,{variant:"outline",size:"sm",onClick:i,className:"bg-white hover:bg-gray-50 border-gray-300 transition-colors text-xs sm:text-sm",children:[n.jsx(Rl,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1 sm:mr-2"}),n.jsxs("span",{className:"hidden sm:inline",children:["Cancel Scheduled (",c.filter(m=>m.is_scheduled===!0||m.display_status==="SCHEDULED").length,")"]}),n.jsxs("span",{className:"sm:hidden",children:["Cancel (",c.filter(m=>m.is_scheduled===!0||m.display_status==="SCHEDULED").length,")"]})]}),u&&o&&n.jsxs(te,{variant:"outline",size:"sm",onClick:o,className:"bg-white hover:bg-gray-50 border-gray-300 transition-colors text-xs sm:text-sm",children:[n.jsx(rb,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1 sm:mr-2"}),n.jsxs("span",{className:"hidden sm:inline",children:["Archive (",c.filter(m=>m.status!=="ARCHIVED").length,")"]}),n.jsxs("span",{className:"sm:hidden",children:["Archive (",c.filter(m=>m.status!=="ARCHIVED").length,")"]})]}),h&&l&&n.jsxs(te,{variant:"outline",size:"sm",onClick:l,className:"bg-white hover:bg-red-50 border-red-300 text-red-600 hover:text-red-700 hover:border-red-400 transition-colors text-xs sm:text-sm",children:[n.jsx(va,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1 sm:mr-2"}),n.jsxs("span",{className:"hidden sm:inline",children:["Delete (",c.filter(m=>m.status!=="DELETED").length,")"]}),n.jsxs("span",{className:"sm:hidden",children:["Delete (",c.filter(m=>m.status!=="DELETED").length,")"]})]})]})]})})})}const Kut={ad_group:"Ad Group",blog_post:"Blog Post",landing_page:"Landing Page",email_sales_sequence:"Sales Email Sequence",email_educational_sequence:"Educational Email Sequence",email_newsletter:"Email Newsletter",quiz:"Quiz",video:"Video",tool:"Tool",social_post:"Social Post"},Wut={ad_group:"bg-blue-100 text-blue-800",blog_post:"bg-green-100 text-green-800",email_newsletter:"bg-purple-100 text-purple-800",email_sales_sequence:"bg-purple-100 text-purple-800",email_educational_sequence:"bg-purple-100 text-purple-800",landing_page:"bg-orange-100 text-orange-800",quiz:"bg-pink-100 text-pink-800",social_post:"bg-indigo-100 text-indigo-800",tool:"bg-yellow-100 text-yellow-800",video:"bg-red-100 text-red-800"},Yut=e=>Kut[e]||e;function Jut({paginatedContents:e,filteredContents:t,currentPage:r,totalPages:s,onPageChange:a,selectedContent:i,isSelectionMode:o,onToggleContentSelection:l,onViewEdit:c,onChangeSchedule:d,onCreateContent:u,onPlatformIconClick:h,getContentImage:m,hasVideo:f,getTextPreview:p}){return xr(),t.length===0?n.jsxs("div",{className:"relative overflow-hidden bg-gradient-to-br from-white via-gray-50/30 to-blue-50/20 rounded-2xl border border-gray-200/50 shadow-sm",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsxs("div",{className:"relative flex flex-col items-center justify-center py-20 px-8",children:[n.jsxs("div",{className:"group relative overflow-hidden w-24 h-24 bg-gradient-to-br from-blue-100 to-indigo-200 rounded-full flex items-center justify-center mb-6 cursor-pointer hover:from-blue-200 hover:to-indigo-300 transition-all duration-300 transform hover:scale-110 hover:shadow-lg",onClick:u,children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-white/20 to-transparent roun
1847ded-full"}),n.jsx(al,{className:"relative h-12 w-12 text-blue-600 group-hover:text-blue-700 transition-colors duration-300"})]}),n.jsx("h3",{className:"text-xl font-bold bg-gradient-to-r from-gray-800 to-gray-600 bg-clip-text text-transparent mb-2",children:"No content found"}),n.jsx("p",{className:"text-gray-600 text-center mb-6 max-w-md leading-relaxed",children:"Get started by creating your first content piece and watch your brand come to life"}),n.jsxs(te,{onClick:u,className:"bg-gradient-to-r from-blue-600 to-indigo-600 hover:from-blue-700 hover:to-indigo-700 text-white shadow-sm hover:shadow-lg transition-all duration-300 transform hover:scale-105 border-0",children:[n.jsx(al,{className:"h-4 w-4 mr-2"}),"Create Your First Content"]})]})]}):n.jsxs("div",{className:"space-y-8",children:[n.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4 sm:gap-6",children:e.map(A=>{const v=m(A),x=f(A),b=p(A);return n.jsxs("div",{className:`group relative overflow-hidden bg-gradient-to-br from-white via-blue-50/20 to-indigo-50/30 rounded-2xl border ${i.has(A.id)?"border-blue-400 ring-2 ring-blue-200/50":"border-blue-200/50"} shadow-lg hover:shadow-2xl transition-all duration-500 cursor-pointer ${o?"hover:border-blue-300":"transform hover:-translate-y-2 hover:scale-105"}`,onClick:()=>{o?l(A.id):c(A.id)},children:[o&&n.jsxs("div",{className:"absolute inset-0 z-30 pointer-events-none",children:[n.jsx("div",{className:`absolute inset-0 ${i.has(A.id)?"bg-blue-600/5":""} transition-colors duration-200 rounded-2xl`}),n.jsx("div",{className:"absolute top-3 right-3",children:n.jsx("div",{className:`p-1.5 ${i.has(A.id)?"bg-blue-600":"bg-white/80"} backdrop-blur-sm rounded-lg shadow-md transition-all duration-200 transform ${i.has(A.id)?"scale-110":"scale-100"}`,children:i.has(A.id)?n.jsx(SK,{className:"h-4 w-4 text-white"}):n.jsx(Rve,{className:"h-4 w-4 text-gray-500"})})})]}),n.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-blue-50/30 via-transparent to-purple-50/20 opacity-0 group-hover:opacity-100 transition-opacity duration-300"}),n.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-blue-600/5 via-transparent to-indigo-600/5 opacity-0 group-hover:opacity-100 transition-opacity duration-500"}),v||x?n.jsxs("div",{className:"relative h-48 overflow-hidden rounded-t-2xl bg-gradient-to-br from-gray-100 to-gray-200",children:[v?n.jsxs(n.Fragment,{children:[n.jsx("img",{src:v,alt:A.name,className:"w-full h-full object-cover group-hover:scale-110 transition-transform duration-700",onError:y=>{const w=y.target;w.style.display="none";const j=w.parentElement;j&&(j.innerHTML='<div class="flex items-center justify-center h-full bg-gradient-to-br from-gray-100 to-gray-200"><div class="p-4 bg-white/80 backdrop-blur-sm rounded-xl shadow-sm"><div class="h-8 w-8 text-gray-400">📷</div></div></div>')}}),x&&n.jsx("div",{className:"absolute top-3 right-3 p-2 bg-black/50 backdrop-blur-sm rounded-full",children:n.jsx(fi,{className:"h-4 w-4 text-white"})}),A.platform_key&&n.jsx("div",{className:"absolute bottom-3 right-3 p-2 bg-white/90 backdrop-blur-sm rounded-lg shadow-md hover:bg-white hover:shadow-lg transition-all duration-200 cursor-pointer group",onClick:y=>h(y,A.platform_key||null),title:`View ${em(A.platform_key)} connection settings`,children:hu(A.platform_key,"h-4 w-4 text-gray-600 group-hover:text-blue-600 transition-colors")})]}):x?n.jsxs("div",{className:"flex items-center justify-center h-full bg-gradient-to-br from-purple-100 to-blue-200",children:[n.jsx("div",{className:"p-4 bg-white/80 backdrop-blur-sm rounded-xl shadow-sm",children:n.jsx(fi,{className:"h-8 w-8 text-purple-600"})}),A.platform_key&&n.jsx("div",{className:"absolute bottom-3 right-3 p-2 bg-white/90 backdrop-blur-sm rounded-lg shadow-md hover:bg-white hover:shadow-lg transition-all duration-200 cursor-pointer group",onClick:y=>h(y,A.platform_key||null),title:`View ${em(A.platform_key)} connection settings`,children:hu(A.platform_key,"h-4 w-4 text-gray-600 group-hover:text-blue-600 transition-colors")})]}):null,n.jsx("div",{className:"absolute top-3 left-3 flex gap-2",children:(()=>{switch(A.display_status||A.status){case"ARCHIVED":return n.jsx("div",{className:"px-2 py-1 bg-gray-600/90 backdrop-blur-sm rounded-full",children:n.jsxs("span",{className:"text-white text-xs font-medium flex items-center gap-1",children:[n.jsx(rb,{className:"h-3 w-3"})," Archived"]})});case"DELETED":return n.jsx("div",{className:"px-2 py-1 bg-red-600/90 backdrop-blur-sm rounded-full",children:n.jsxs("span",{className:"text-white text-xs font-medium flex items-center gap-1",children:[n.jsx(va,{className:"h-3 w-3"})," Deleted"]})});case"PUBLISHED":return n.jsx("div",{className:"px-2 py-1 bg-green-500/90 backdrop-blur-sm rounded-full",children:n.jsx("span",{className:"text-white text-xs font-medium flex items-center gap-1",children:"✓ Published"})});case"SCHEDULED":return n.jsx("div",{className:"px-2 py-1 bg-orange-500/90 backdrop-blur-sm rounded-full",children:n.jsx("span",{className:"text-white text-xs font-medium flex items-center gap-1",children:"⏰ Scheduled"})});
1847case"HOLD":case"HELD":return n.jsx("div",{className:"px-2 py-1 bg-yellow-500/90 backdrop-blur-sm rounded-full",children:n.jsx("span",{className:"text-white text-xs font-medium flex items-center gap-1",children:"⏸️ Held"})});case"PROCESSING":return n.jsx("div",{className:"px-2 py-1 bg-blue-500/90 backdrop-blur-sm rounded-full",children:n.jsx("span",{className:"text-white text-xs font-medium flex items-center gap-1",children:"⚙️ Processing"})});case"FAILED":return n.jsx("div",{className:"px-2 py-1 bg-red-500/90 backdrop-blur-sm rounded-full",children:n.jsx("span",{className:"text-white text-xs font-medium flex items-center gap-1",children:"❌ Failed"})});case"DRAFT":return n.jsx("div",{className:"px-2 py-1 bg-blue-500/90 backdrop-blur-sm rounded-full",children:n.jsx("span",{className:"text-white text-xs font-medium",children:"Draft"})});case"READY":return n.jsx("div",{className:"px-2 py-1 bg-gray-500/90 backdrop-blur-sm rounded-full",children:n.jsx("span",{className:"text-white text-xs font-medium",children:"Ready"})});default:return null}})()})]}):n.jsxs("div",{className:"relative h-32 bg-gradient-to-br from-gray-50 to-blue-50 flex items-center justify-center rounded-t-2xl",children:[n.jsx("div",{className:"p-4 bg-white/80 backdrop-blur-sm rounded-xl shadow-sm",children:n.jsx(Xr,{className:"h-8 w-8 text-blue-600"})}),n.jsx("div",{className:"absolute top-3 left-3",children:(()=>{switch(A.display_status||A.status){case"ARCHIVED":return n.jsx("div",{className:"px-2 py-1 bg-gray-600/90 backdrop-blur-sm rounded-full",children:n.jsxs("span",{className:"text-white text-xs font-medium flex items-center gap-1",children:[n.jsx(rb,{className:"h-3 w-3"})," Archived"]})});case"DELETED":return n.jsx("div",{className:"px-2 py-1 bg-red-600/90 backdrop-blur-sm rounded-full",children:n.jsxs("span",{className:"text-white text-xs font-medium flex items-center gap-1",children:[n.jsx(va,{className:"h-3 w-3"})," Deleted"]})});case"PUBLISHED":return n.jsx("div",{className:"px-2 py-1 bg-green-500/90 backdrop-blur-sm rounded-full",children:n.jsx("span",{className:"text-white text-xs font-medium",children:"✓ Published"})});case"SCHEDULED":return n.jsx("div",{className:"px-2 py-1 bg-orange-500/90 backdrop-blur-sm rounded-full",children:n.jsx("span",{className:"text-white text-xs font-medium",children:"⏰ Scheduled"})});case"HOLD":case"HELD":return n.jsx("div",{className:"px-2 py-1 bg-yellow-500/90 backdrop-blur-sm rounded-full",children:n.jsx("span",{className:"text-white text-xs font-medium",children:"⏸️ Held"})});case"PROCESSING":return n.jsx("div",{className:"px-2 py-1 bg-blue-500/90 backdrop-blur-sm rounded-full",children:n.jsx("span",{className:"text-white text-xs font-medium",children:"⚙️ Processing"})});case"FAILED":return n.jsx("div",{className:"px-2 py-1 bg-red-500/90 backdrop-blur-sm rounded-full",children:n.jsx("span",{className:"text-white text-xs font-medium",children:"❌ Failed"})});case"DRAFT":return n.jsx("div",{className:"px-2 py-1 bg-blue-500/90 backdrop-blur-sm rounded-full",children:n.jsx("span",{className:"text-white text-xs font-medium",children:"Draft"})});case"READY":return n.jsx("div",{className:"px-2 py-1 bg-gray-500/90 backdrop-blur-sm rounded-full",children:n.jsx("span",{className:"text-white text-xs font-medium",children:"Ready"})});default:return null}})()}),n.jsx("div",{className:"absolute top-3 right-3",children:A.platform_key&&n.jsx("div",{className:"p-2 bg-white/80 backdrop-blur-sm rounded-lg shadow-sm hover:bg-white hover:shadow-md transition-all duration-200 cursor-pointer group",onClick:y=>h(y,A.platform_key||null),title:`View ${em(A.platform_key)} connection settings`,children:hu(A.platform_key,"h-4 w-4 text-gray-600 group-hover:text-blue-600 transition-colors")})})]}),n.jsxs("div",{className:"relative p-6",children:[n.jsxs("div",{className:"mb-4",children:[n.jsx("h3",{className:"text-lg font-bold text-gray-900 group-hover:text-blue-700 transition-colors duration-300 line-clamp-2 mb-3",children:A.name}),b&&n.jsx("p",{className:"text-sm text-gray-600 line-clamp-3 mb-3 leading-relaxed",children:b}),n.jsxs("div",{className:"flex flex-wrap items-center gap-2 mb-3",children:[n.jsx(Be,{className:`${Wut[A.content_type]} text-xs font-medium shadow-sm`,children:Yut(A.content_type)}),A.platform_key&&n.jsxs("div",{className:"inline-flex items-center gap-1 px-2 py-1 bg-white/60 backdrop-blur-sm rounded-md shadow-sm hover:bg-white hover:shadow-md transition-all duration-200 cursor-pointer group",onClick:y=>h(y,A.platform_key||null),title:`View ${em(A.platform_key)} connection settings`,children:[hu(A.platform_key,"h-3.5 w-3.5 text-gray-600 group-hover:text-blue-600 transition-colors"),n.jsx("span",{className:"text-xs text-gray-600 group-hover:text-blue-600 transition-colors font-medium",children:em(A.platform_key)})]})]})]}),n.jsxs("div",{className:"space-y-3 mb-6",children:[!1,n.jsxs("div",{className:"flex items-center justify-between text-sm",children:[n.jsx("span",{className:"text-gray-600 font-medium",children:"Published"}),A.published_at?n.jsx(Uh,{date:A.published_at,showRelative:!0,showTimezone:!1,size:"sm",showTooltip:!0,relativeMode:"smart",preferRelative:!0,relativeOptions:{shortFormat:!0,absoluteThreshold:7},className:"text-right max-w-[120px] truncate text-green-600 font-medium"}):n.jsx("span",{className:"text-gray-500 text-right",children:"Not Published"})]}),A.scheduled_time&&!A.published_at&&n.jsxs("div",{className:"flex items-center justify-between text-sm",children:[n.jsx("span",{className:"text-gray-600 font-medium",children:"Scheduled"}),n.jsx(Uh,{date:A.scheduled_time,showRelative:!0,showTimezone:!1,size:"sm",showTooltip:!0,relativeMode:"smart",preferRelative:!0,relativeOptions:{shortFormat:!0,absoluteThreshold:7},className:"text-right max-w-[120px] truncate text-orange-600 font-medium"})]}),n.jsxs("div",{className:"flex items-center justify-between text-sm",children:[n.jsx("span",{className:"text-gray-600 font-medium",children:"Created"}
1847),n.jsx(Uh,{date:A.created_at,showTimezone:!1,size:"sm",showTooltip:!0,showRelative:!0,relativeMode:"contextual",relativeContext:"normal",preferRelative:!0,className:"text-right max-w-[120px] truncate"})]})]}),!o&&n.jsxs("div",{className:"flex gap-2 mt-auto",children:[(A.display_status==="SCHEDULED"||A.is_scheduled===!0)&&n.jsxs(te,{size:"sm",variant:"outline",className:"flex-1 bg-white/50 border-white/50 hover:bg-white/70 transition-colors text-xs",onClick:y=>{y.stopPropagation(),d(A)},children:[n.jsx(Vr,{className:"h-3 w-3 mr-1"}),"Reschedule"]}),n.jsx(te,{size:"sm",className:"flex-1 bg-gradient-to-r from-blue-500 to-indigo-600 hover:from-blue-600 hover:to-indigo-700 text-white shadow-sm hover:shadow-md transition-all duration-300 text-xs",onClick:y=>{y.stopPropagation(),c(A.id)},children:"View/Edit"})]})]})]},A.id)})}),s>1&&n.jsx("div",{className:"flex justify-center mt-8",children:n.jsx(xC,{children:n.jsxs(vC,{className:"gap-2",children:[n.jsx(_i,{children:n.jsx(bC,{onClick:()=>r>1&&a(r-1),className:`${r===1?"pointer-events-none opacity-50":"cursor-pointer hover:bg-white/70"} bg-white/50 border-white/50 transition-colors`})}),Array.from({length:Math.min(5,s)},(A,v)=>{let x;return s<=5?x=v+1:x=Math.max(1,Math.min(r-2,s-4))+v,n.jsx(_i,{children:n.jsx(Dh,{isActive:r===x,onClick:()=>a(x),className:`cursor-pointer transition-colors ${r===x?"bg-gradient-to-r from-blue-500 to-indigo-600 text-white border-transparent hover:from-blue-600 hover:to-indigo-700":"bg-white/50 border-white/50 hover:bg-white/70"}`,children:x})},x)}),s>5&&r<s-2&&n.jsx(_i,{children:n.jsx(Ab,{className:"bg-white/30"})}),n.jsx(_i,{children:n.jsx(yC,{onClick:()=>r<s&&a(r+1),className:`${r===s?"pointer-events-none opacity-50":"cursor-pointer hover:bg-white/70"} bg-white/50 border-white/50 transition-colors`})})]})})})]})}const Xut={ad_group:"bg-blue-100 text-blue-800",blog_post:"bg-green-100 text-green-800",email_newsletter:"bg-purple-100 text-purple-800",email_sales_sequence:"bg-purple-100 text-purple-800",email_educational_sequence:"bg-purple-100 text-purple-800",landing_page:"bg-orange-100 text-orange-800",quiz:"bg-pink-100 text-pink-800",social_post:"bg-indigo-100 text-indigo-800",tool:"bg-yellow-100 text-yellow-800",video:"bg-red-100 text-red-800"};function uie({contents:e,currentMonth:t,onCurrentMonthChange:r,dateType:s,onDateTypeChange:a,dragOverDay:i,onDragStart:o,onDragEnd:l,onDragOver:c,onDragLeave:d,onDrop:u,isContentDraggable:h,onViewEdit:m,onPlatformIconClick:f,formatDateInUserTimezone:p}){const{timezone:A,isLoading:v}=Gl(),[x,b]=g.useState(null),y=(M,I,$,V)=>{const R={};return M.forEach(Q=>{let U;switch(V){case"scheduled_published":U=Q.published_at??Q.scheduled_time??void 0;break;case"created":U=Q.created_at;break;case"published_only":U=Q.published_at??void 0;break;case"scheduled_only":U=Q.scheduled_time??void 0;break;case"held_only":U=Q.display_status==="HOLD"||Q.display_status==="HELD"?Q.scheduled_time??void 0:void 0;break}if(U)try{const D=v?new Date(U):(()=>{const q=new Date(U);try{const K=new Intl.DateTimeFormat("en-CA",{timeZone:A||"UTC",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).formatToParts(q).reduce((ne,ae)=>(ne[ae.type]=ae.value,ne),{});if(!K.year||!K.month||!K.day)throw new Error("Missing required date parts from formatter");return new Date(parseInt(K.year),parseInt(K.month)-1,parseInt(K.day),parseInt(K.hour||"0"),parseInt(K.minute||"0"),parseInt(K.second||"0"))}catch(G){return console.error(`Timezone conversion error for content ${Q.name}:`,G),q}})();if(D.getFullYear()===I&&D.getMonth()===$){const q=D.getDate();R[q]||(R[q]=[]),R[q].push(Q)}}catch(D){console.error("Error processing date for calendar:",D);const q=new Date(U);if(q.getFullYear()===I&&q.getMonth()===$){const G=q.getDate();R[G]||(R[G]=[]),R[G].push(Q)}}}),R},w=t.getFullYear(),j=t.getMonth(),N=new Date(w,j+1,0).getDate(),_=new Date(w,j,1).getDay(),S=y(e,w,j,s),C=_,E=[],T=new Date(w,j,0).getDate();for(let M=C-1;M>=0;M--)E.push(T-M);const B=t.toLocaleString("default",{month:"long"}),L=()=>{const M=new Date(t);M.setMonth(M.getMonth()-1),r(M)},P=()=>{const M=new Date(t);M.setMonth(M.getMonth()+1),r(M)},F=()=>{try{if(!v&&A){const M=new Date,V=new Intl.DateTimeFormat("en-CA",{timeZone:A,year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(M).reduce((Q,U)=>(Q[U.type]=U.value,Q),{}),R=new Date(parseInt(V.year),parseInt(V.month)-1,parseInt(V.day));r(R)}else r(new Date)}catch(M){console.error("Error getting today in user timezone:",M),r(new Date)}};return n.jsxs("div",{className:"p-2",children:[n.jsx("div",{className:"mb-4 p-4 bg-white/80 backdrop-blur-sm rounded-xl border border-white/50 shadow-sm",children:n.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-center justify-between gap-4",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-3",children:[n.jsxs("h2",{className:"text-2xl font-bold bg-gradient-to-r from-blue-700 to-indigo-700 bg-clip-text text-transparent",children:[B," ",w]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-sm text-gray-600 font-medium hidden sm:inline",children:"Show:"}),n.jsxs(ur,{value:s,onValueChange:M=>a(M),children:[n.jsx(or,{className:"w-[200px] h-9 bg-white/70 border-gray-200 hover:bg-white transition-colors text-sm",children:n.jsx(hr,{placeholder:"Select date type"})}),n.jsxs(lr,{children:[n.jsx(Fe,{value:"scheduled_published",children:"Scheduled/Published/Held"}),n.jsx(Fe,{value:"created",children:"Created"}),n.jsx(Fe,{value:"published_only",children:"Published Only"}),n.jsx(Fe,{value:"scheduled_only",children:"Scheduled Only"}),n.jsx(Fe,{value:"held_only",children:"Held Only"})]})]})]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs(te,{variant:"outline",size:"sm",onClick:L,className:"bg-white/70 hover:bg-white border-gray-200 transition-colors",children:[n.jsx(Nu,{className:"h-4 w-4 mr-1"}),n.jsx("span",{className:"hidden sm:inline",children:"Previous Month"}),n.jsx("span",{className:"sm:hidden",children:"Prev"})]}),n.jsxs(te,{variant:"outline",size:"sm",onClick:F,className:"bg-blue-50 hover:bg-blue-100 border-blue-200 text-blue-700 transition-colors font-medium",children:[n.jsx(Kn,{className:"h-4 w-4 mr-1"}),"Today"]}),n.jsxs(te,{variant:"outline",size:"sm",onClick:P,className:"bg-white/70 hover:bg-white border-gray-200 transition-colors",children:[n.jsx("span",{className:"hidden sm:inline",children:"Next Month"}),n.jsx("span",{className:"sm:hidden",children:"Next"}),n.jsx(_s,{className:"h-4 w-4 ml-1"})]})]})]})}),n.jsx("div",{className:"flex items-center justify-center mb-4 p-2 bg-gray-50 rounded-lg",children:n.jsx("div",{className:"flex space-x-6 text-xs text-gray-600",children:s==="created"?n.jsxs("div",{className:"flex items-center",children:[n.jsx("div",{className:"w-3 h-3 bg-blue-500 rounded-full mr-2"}),n.jsx("span",{children:"Created content"})]}):s==="published_only"?n.jsxs("div",{className:"flex items-center",children:[n.jsx("span",{className:"text-green-600 mr-1",children:"✓"}),n.jsx("div",{className:"w-3 h-3 border-l-2 border-green-500 mr-2"}),n.jsx("span",{children:"Published"})]}):s==="scheduled_only"?n.jsxs("div",{className:"flex items-center",children:[n.jsx("span",{className:"text-orange-600 mr-1",children:"⏰"}),n.jsx("div",{className:"w-3 h-3 border-l-2 border-orange-500 mr-2"}),n.jsx("span",{children:"Scheduled"})]}):n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center",children:[n.jsx("span",{className:"text-green-600 mr-1",children:"✓"}),n.jsx("div",{className:"w-3 h-3 border-l-2 border-green-500 mr-2"}),n.jsx("span",{children:"Published"})]}),n.jsxs("div",{className:"flex items-center",children:[n.jsx("span",{className:"text-orange-600 mr-1",children:"⏰"}),n.jsx("div",{className:"w-3 h-3 border-l-2 border-orange-500 mr-2"}),n.jsx("span",{children:"Scheduled"})]})]})})}),n.jsxs("div",{className:"grid grid-cols-7 gap-1 overflow-visible relative",children:[["Sun","Mon","Tue","Wed","Thu","Fri","Sat"].map((M,I)=>n.jsx("div",{className:"text-center p-2 font-medium text-xs text-gray-500",children:M},I)),E.map((M,I)=>n.jsx("div",{className:"h-32 p-1 bg-gray-50 text-gray-400 border rounded text-xs",children:n.jsx("div",{className:"text-right",children:M})},`prev-${I}`)),Array.from({length:N}).map((M,I)=>{const $=I+1,V=!v&&A&&(()=>{try{const Q=new Date,q=new Intl.DateTimeFormat("en-CA",{timeZone:A,year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(Q).reduce((Y,K)=>(Y[K.type]=K.value,Y),{}),G={year:parseInt(q.year),month:parseInt(q.month)-1,day:parseInt(q.day)};return G.year===w&&G.month===j&&G.day===$}
1847catch(Q){console.error("Error checking if today:",Q);const U=new Date;return U.getDate()===$&&U.getMonth()===j&&U.getFullYear()===w}})(),R=S[$]||[];return n.jsx("div",{className:`relative h-32 p-1 border rounded overflow-y-auto transition-all duration-300 ease-in-out ${V?"bg-blue-50 border-blue-200":"bg-white"} ${i===$?"bg-green-50 border-green-300 border-2":""} ${x===$?"scale-150 shadow-2xl z-50 border-blue-400":"scale-100"}`,style:{transformOrigin:"center center"},onMouseEnter:()=>b($),onMouseLeave:()=>b(null),onDragOver:Q=>c(Q,$),onDragLeave:d,onDrop:Q=>u(Q,$),children:n.jsxs("div",{className:"transition-transform duration-300 ease-in-out",style:{transform:x===$?"scale(0.6667)":"scale(1)",transformOrigin:"top left"},children:[n.jsx("div",{className:"text-right text-xs",children:$}),n.jsx("div",{className:"mt-1 space-y-1",children:R.map(Q=>{let U,D="",q="",G="";switch(s){case"created":U=Q.created_at,D="📝",q="Created",G="border-blue-500";break;case"published_only":U=Q.published_at??void 0,D="✓",q="Published",G="border-green-500";break;case"scheduled_only":U=Q.scheduled_time??void 0,D="⏰",q="Scheduled",G="border-orange-500";break;case"held_only":Q.display_status==="HOLD"||Q.display_status==="HELD"?(U=Q.scheduled_time??void 0,D="⏸️",q="Held",G="border-yellow-500"):U=void 0;break;case"scheduled_published":default:const ae=!!Q.published_at,J=Q.display_status==="HOLD"||Q.display_status==="HELD";U=Q.published_at??Q.scheduled_time??void 0,J?(D="⏸️",q="Held",G="border-yellow-500"):(D=ae?"✓":"⏰",q=ae?"Published":"Scheduled",G=ae?"border-green-500":"border-orange-500");break}const Y=U?v?new Date(U).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0}):p(U,"h:mm a"):"",K=Xut[Q.content_type],X="",ne=h(Q);return n.jsxs("div",{className:`text-xs p-1 rounded flex flex-col border-l-2 ${G} ${K} ${X} ${ne?"cursor-move hover:shadow-md transition-shadow":"cursor-pointer"}`,draggable:ne,onDragStart:ne?ae=>o(ae,Q):void 0,onDragEnd:ne?l:void 0,onClick:()=>m(Q.id),title:`${Q.name} - ${q}${Y?` at ${Y}`:""}${ne?" (Drag to reschedule)":""}`,children:[n.jsxs("div",{className:"flex items-start",children:[n.jsx("span",{className:"text-[10px] mr-1",title:q,children:D}),Q.platform_key&&n.jsx("div",{className:"inline-flex items-center hover:bg-white/20 rounded transition-colors cursor-pointer",onClick:ae=>{ae.stopPropagation(),f(ae,Q.platform_key||null)},title:`View ${em(Q.platform_key)} connection settings`,children:hu(Q.platform_key,"h-3 w-3")}),n.jsx("span",{className:"ml-1 truncate flex-1",children:Q.name})]}),U&&n.jsx("div",{className:"text-[10px] opacity-75 mt-1",children:Y})]},Q.id)})})]})},`current-${I}`)}),Array.from({length:(7-(_+N)%7)%7}).map((M,I)=>n.jsx("div",{className:"h-32 p-1 bg-gray-50 text-gray-400 border rounded text-xs",children:n.jsx("div",{className:"text-right",children:I+1})},`next-${I}`))]})]})}const Zut="https://worker.rainfactory.ai/rainfactory/content-functions/serve-static";function Xz(e,t,r){const s=`${Zut}?content_id=${e}&resource_type=${t}`,a=r?`&version=${r}`:"";return`${s}${a}`}async function eht(e,t){try{const{error:r}=await de.rpc("revert_content_version",{p_content_id:e,p_version_number:t});if(r)throw r;return!0}catch(r){return console.error("Error reverting version:",r),!1}}const Zz=["GENERATING","READY","SCHEDULED","DRAFT","PUBLISHED","ERROR","ARCHIVED","DELETED"];function tht(e){return{READY:"Unpublished",PUBLISHED:"Published",ARCHIVED:"Archived",SCHEDULED:"Scheduled",DRAFT:"Draft",GENERATING:"Generating",PROCESSING:"Processing",FAILED:"Failed",HOLD:"On Hold",HELD:"Held",CANCELLED:"Cancelled",DELETED:"Deleted",ERROR:"Error"}[e]}const rht=(e,t,r,s,a="all")=>e.filter(o=>{const l=t.toLowerCase().trim(),c=o.name.toLowerCase(),d=t===""||c.includes(l),u=r==="all"||o.content_type===r,h=a==="all"||o.platform_key===a;let m=!0;if(s!=="all"){const f=o.display_status||o.status;switch(s){case"published":m=f==="PUBLISHED"||o.is_published===!0;break;case"scheduled":m=f==="SCHEDULED"||o.is_scheduled===!0;break;case"held":m=f==="HOLD"||f==="HELD";break;case"draft":m=f==="DRAFT";break;case"ready":m=f==="READY"||o.is_ready===!0;break;case"archived":m=f==="ARCHIVED"||o.status==="ARCHIVED";break;case"deleted":m=f==="DELETED"||o.status==="DELETED";break;case"generating":m=f==="GENERATING"||o.status==="GENERATING";break;case"processing":m=f==="PROCESSING"||o.is_processing===!0;break;case"failed":m=f==="FAILED"||o.is_failed===!0;break;case"error":m=f==="ERROR"||o.status==="ERROR";break;case"cancelled":m=f==="CANCELLED";break;case"scheduled_and_ready":m=f==="SCHEDULED"||f==="READY"||o.is_scheduled===!0||o.is_ready===!0;break;case"scheduled_and_held":m=f==="SCHEDULED"||f==="HOLD"||f==="HELD"||o.is_scheduled===!0;break;default:m=!0}}return d&&u&&m&&h}),nht=(e,t)=>
1847[...e].sort((r,s)=>{if(t.key==="published_at"){const o=r.published_at,l=s.published_at;if(!o&&!l){const u=new Date(r.created_at).getTime(),h=new Date(s.created_at).getTime();return t.direction==="asc"?u-h:h-u}if(!o)return t.direction==="asc"?1:-1;if(!l)return t.direction==="asc"?-1:1;const c=new Date(o).getTime(),d=new Date(l).getTime();return t.direction==="asc"?c-d:d-c}if(t.key==="scheduled_time"){const o=r.scheduled_time,l=s.scheduled_time;if(!o&&!l){const u=new Date(r.created_at).getTime(),h=new Date(s.created_at).getTime();return t.direction==="asc"?u-h:h-u}if(!o)return t.direction==="asc"?1:-1;if(!l)return t.direction==="asc"?-1:1;const c=new Date(o).getTime(),d=new Date(l).getTime();return t.direction==="asc"?c-d:d-c}const a=r[t.key],i=s[t.key];return typeof a=="string"&&typeof i=="string"?t.direction==="asc"?a.localeCompare(i):i.localeCompare(a):a instanceof Date&&i instanceof Date?t.direction==="asc"?a.getTime()-i.getTime():i.getTime()-a.getTime():0}),hie="content_management_preferences",f4={viewMode:"cards",search:"",contentType:"all",statusFilter:"scheduled_and_ready",platformFilter:"all",sortConfig:{key:"created_at",direction:"desc"},calendarDateType:"scheduled_published",currentPage:1},Z6=()=>{try{const e=localStorage.getItem(hie);if(!e)return f4;const t=JSON.parse(e);return{...f4,...t}}catch(e){return console.error("Error loading content preferences:",e),f4}},nu=e=>{try{const r={...Z6(),...e};localStorage.setItem(hie,JSON.stringify(r))}catch(t){console.error("Error saving content preferences:",t)}},sht=({contents:e,itemsPerPage:t=12,initialPreferences:r={}})=>{const[s,a]=g.useState(r.search??""),[i,o]=g.useState(r.contentType??"all"),[l,c]=g.useState(r.statusFilter??"all"),[d,u]=g.useState(r.platformFilter??"all"),[h,m]=g.useState(r.sortConfig??{key:"created_at",direction:"desc"}),[f,p]=g.useState(r.currentPage??1);g.useEffect(()=>{nu({search:s})},[s]),g.useEffect(()=>{nu({contentType:i})},[i]),g.useEffect(()=>{nu({statusFilter:l})},[l]),g.useEffect(()=>{nu({platformFilter:d})},[d]),g.useEffect(()=>{nu({sortConfig:h})},[h]),g.useEffect(()=>{nu({currentPage:f})},[f]),g.useEffect(()=>{p(1)},[s,i,l,d]);const A=g.useMemo(()=>rht(e,s,i,l,d),[e,s,i,l,d]),v=g.useMemo(()=>nht(A,h),[A,h]),x=g.useMemo(()=>{const j=(f-1)*t;return v.slice(j,j+t)},[v,f,t]),b=Math.ceil(v.length/t),y=f<b,w=f>1;return{search:s,setSearch:a,contentType:i,setContentType:o,statusFilter:l,setStatusFilter:c,platformFilter:d,setPlatformFilter:u,sortConfig:h,setSortConfig:m,currentPage:f,setCurrentPage:p,filteredContents:A,sortedContents:v,paginatedContents:x,totalPages:b,hasNextPage:y,hasPrevPage:w}},aht=({contents:e,paginatedContents:t,onRefresh:r})=>{const[s,a]=g.useState(new Set),[i,o]=g.useState(!1),l=g.useCallback(()=>{o(!i),i&&a(new Set)},[i]),c=g.useCallback(h=>{const m=new Set(s);m.has(h)?m.delete(h):m.add(h),a(m)},[s]),d=g.useCallback(()=>{s.size===t.length?a(new Set):a(new Set(t.map(h=>h.id)))},[s.size,t]),u=g.useCallback(async()=>{var f;console.log("Bulk cancel scheduled - selected IDs:",Array.from(s));const h=e.filter(p=>s.has(p.id));console.log("Selected items:",h);const m=h.filter(p=>(p.display_status==="SCHEDULED"||p.is_scheduled===!0)&&p.scheduled_time&&!p.published_at);if(console.log("Scheduled items to cancel:",m),m.length===0){He({title:"No scheduled content selected",description:"Please select scheduled content to cancel",variant:"destructive"});return}try{const{data:p}=await de.auth.getSession();let A=0;for(const v of m){const{data:x}=await de.from("scheduled_social_posts").select("id").eq("content_id",v.id).eq("status","SCHEDULED").single();x&&(console.log("Canceling via API for scheduled post:",x.id),(await fetch("https://worker.rainfactory.ai/api/autopost/cancel-publishing",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${(f=p==null?void 0:p.session)==null?void 0:f.access_token}`},body:JSON.stringify({scheduled_post_id:x.id})})).ok?A++:console.error(`Failed to cancel scheduled post ${x.id}`))}A>0?(He({title:"Scheduled posts canceled",description:`Successfully canceled ${A} scheduled post${A>1?"s":""}`}),a(new Set),o(!1),await r()):He({title:"No posts canceled",description:"No scheduled posts were found to cancel",variant:"destructive"})}catch(p){console.error("Error bulk canceling scheduled posts:",p),He({t
1847itle:"Error",description:"Failed to cancel scheduled posts",variant:"destructive"})}},[s,e,r]);return{selectedContent:s,setSelectedContent:a,isSelectionMode:i,setIsSelectionMode:o,toggleSelectionMode:l,toggleContentSelection:c,toggleSelectAll:d,bulkCancelScheduled:u}},fie=({onRefresh:e,currentMonth:t})=>{const[r,s]=g.useState(null),[a,i]=g.useState(null),{timezone:o,formatDate:l}=Gl(),c=g.useCallback(p=>p.display_status==="HOLD"||p.display_status==="HELD"||p.display_status==="SCHEDULED"||p.is_scheduled===!0,[]),d=g.useCallback((p,A)=>{if(!c(A)){p.preventDefault();return}s(A),p.dataTransfer.effectAllowed="move",p.dataTransfer.setData("text/plain",A.id);const v=p.currentTarget;v.style.opacity="0.5"},[c]),u=g.useCallback(p=>{const A=p.currentTarget;A.style.opacity="1",s(null),i(null)},[]),h=g.useCallback((p,A)=>{r&&(p.preventDefault(),p.dataTransfer.dropEffect="move",i(A))},[r]),m=g.useCallback(()=>{i(null)},[]),f=g.useCallback(async(p,A)=>{if(p.preventDefault(),i(null),!r||!o){He({title:"Error",description:"Unable to update schedule - missing timezone information",variant:"destructive"});return}try{const v=r.scheduled_time;if(!v){He({title:"Error",description:"Cannot reschedule content without existing scheduled time",variant:"destructive"});return}const x=new Date(v),b=x.getHours(),y=x.getMinutes(),w=t.getFullYear(),j=t.getMonth(),N=new Date(w,j,A,b,y,0,0),_=new Date(N.toISOString()),{error:S}=await de.from("scheduled_social_posts").update({scheduled_time:_.toISOString()}).eq("content_id",r.id);if(S){console.error("Error updating scheduled time:",S),He({title:"Error",description:"Failed to update schedule",variant:"destructive"});return}await e(),He({title:"Schedule Updated",description:`Content moved to ${N.toLocaleDateString()} at ${l(N.toISOString(),"h:mm a")}`})}catch(v){console.error("Error in drag drop operation:",v),He({title:"Error",description:"Failed to update schedule",variant:"destructive"})}s(null)},[r,o,t,e,l]);return{draggedItem:r,setDraggedItem:s,dragOverDay:a,setDragOverDay:i,isContentDraggable:c,handleDragStart:d,handleDragEnd:u,handleDragOver:h,handleDragLeave:m,handleDrop:f}},iht=12;function oht(){const[e,t]=g.useState([]),[r,s]=g.useState(!0),a=Z6(),[i,o]=g.useState(a.viewMode),[l,c]=g.useState(new Date),[d,u]=g.useState(!1),[h,m]=g.useState(a.calendarDateType),[f,p]=g.useState({isOpen:!1,contentId:"",currentScheduledTime:null}),A=xr(),{fetchContentsByBrand:v}=sw(),{selectedBrand:x}=mn(),{formatDate:b}=Gl(),y=sht({contents:e,itemsPerPage:iht,initialPreferences:a}),w=aht({contents:e,paginatedContents:y.paginatedContents,onRefresh:S}),j=fie({onRefresh:S,currentMonth:l});g.useEffect(()=>{nu({viewMode:i})},[i]),g.useEffect(()=>{nu({calendarDateType:h})},[h]);const N=(I,$)=>{I.stopPropagation(),!(!(x!=null&&x.id)||!$)&&A(`/brands/${x.id}/connections`,{state:{highlightPlatform:$}})};g.useEffect(()=>{x!=null&&x.id&&S();const I=de.channel("content_changes").on("postgres_changes",{event:"*",schema:"public",table:"content_management_view",filter:x!=null&&x.id?`brand_id=eq.${x.id}`:void 0},$=>{if(console.log("Realtime update from content_management_view:",$),$.eventType==="INSERT"){const V=_($.new);V&&t(R=>[...R,V])}else if($.eventType==="DELETE")t(V=>V.filter(R=>R.id!==$.old.id));else if($.eventType==="UPDATE"){const V=_($.new);V&&t(R=>R.map(Q=>Q.id===V.id?V:Q))}}).subscribe();return()=>{I.unsubscribe()}},[x==null?void 0:x.id]);const _=I=>{try{return{...I,campaigns:I.campaign_name?{id:I.campaign_id,name:I.campaign_name}:null}}catch($){return console.error("Error transforming view data:",$),null}};async function S(){if(x!=null&&x.id)try{s(!0),console.log("Loading contents for brand:",x.id);const I=await v(x.id);console.log("Fetched contents:",I==null?void 0:I.length),t(I||[])}catch(I){console.error("Error loading contents:",I)}finally{s(!1)}}const C=I=>{var $,V,R,Q;try{if(I.image_url)return I.image_url;if(($=I.content_json)!=null&&$.image_url)return I.content_json.image_url;if((V=I.content_json)!=null&&V.posts&&Array.isArray(I.content_json.posts)&&I.content_json.posts.length>0){const U=I.content_json.posts[0];if(U.image_url)return U.image_url;if(U.images&&Array.isArray(U.images)&&U.images.length>0)return U.images[0]}if((R=I.content_json)!=null&&R.images&&Array.isArray(I.content_json.images)&&I.content_json.images.length>0)return I.content_json.images[0];if((Q=I.content_json)!=null&&Q.media&&Array.isArray(I.content_json.media)){const U=I.content_json.media.find(D=>D.type==="image");if(U!=null&&U.url)return U.url}}catch(U){console.error("Error extracting image from content:",U)}return null},E=I=>{var $,V,R;try{if(I.video_url||($=I.content_json)!=null&&$.video_url)return!0;
1847if((V=I.content_json)!=null&&V.posts&&Array.isArray(I.content_json.posts)&&I.content_json.posts.length>0){const Q=I.content_json.posts[0];if(Q.video_url||Q.videos&&Array.isArray(Q.videos)&&Q.videos.length>0)return!0}if((R=I.content_json)!=null&&R.media&&Array.isArray(I.content_json.media))return I.content_json.media.some(Q=>Q.type==="video")}catch(Q){console.error("Error checking for video in content:",Q)}return!1},T=I=>{try{if(I.text_preview)return I.text_preview;if(I.content_json){if(I.content_json.content){const $=I.content_json.content.replace(/<[^>]*>/g,"").trim();if($)return $.length>300?$.substring(0,297)+"...":$}if(I.content_json.caption)return I.content_json.caption.length>300?I.content_json.caption.substring(0,297)+"...":I.content_json.caption;if(I.content_json.text)return I.content_json.text.length>300?I.content_json.text.substring(0,297)+"...":I.content_json.text;if(I.content_json.posts&&Array.isArray(I.content_json.posts)&&I.content_json.posts.length>0){const $=I.content_json.posts[0];if($.text)return $.text.length>300?$.text.substring(0,297)+"...":$.text;if($.caption)return $.caption.length>300?$.caption.substring(0,297)+"...":$.caption}}}catch($){console.error("Error extracting text preview from content:",$)}return null};if(!x)return n.jsx(ep,{});const B=()=>{A("/content/create")},L=I=>{A(`/content/${I}`)},P=I=>{p({isOpen:!0,contentId:I.id,currentScheduledTime:I.scheduled_time})},F=()=>{p({isOpen:!1,contentId:"",currentScheduledTime:null})},M=()=>{S()};return r?n.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 via-white to-blue-50/30 relative overflow-hidden",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsxs("div",{className:"relative container mx-auto p-6 max-w-7xl space-y-8",children:[n.jsxs("div",{className:"relative overflow-hidden bg-gradient-to-br from-white via-blue-50/30 to-indigo-50/40 rounded-2xl border border-blue-200/50 shadow-sm p-4 md:p-8",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsxs("div",{className:"relative flex flex-col lg:flex-row lg:items-center justify-between gap-4 md:gap-6",children:[n.jsxs("div",{className:"flex items-center gap-2 md:gap-4 flex-1",children:[n.jsx(Lt,{className:"h-10 w-10 md:h-12 md:w-12 rounded-xl md:rounded-2xl"}),n.jsxs("div",{className:"space-y-2 flex-1",children:[n.jsx(Lt,{className:"h-8 md:h-10 w-48 md:w-64"}),n.jsx(Lt,{className:"h-4 md:h-6 w-full max-w-2xl hidden md:block"})]})]}),n.jsx("div",{className:"flex flex-col sm:flex-row gap-3",children:n.jsx(Lt,{className:"h-12 w-40"})})]})]}),n.jsx("div",{className:"relative overflow-hidden bg-white/60 backdrop-blur-sm rounded-xl border border-white/50 shadow-sm p-6",children:n.jsxs("div",{className:"flex gap-4",children:[n.jsx(Lt,{className:"h-12 flex-grow"}),n.jsx(Lt,{className:"h-12 w-40"}),n.jsx(Lt,{className:"h-12 w-40"}),n.jsx(Lt,{className:"h-12 w-40"})]})}),n.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6",children:Array.from({length:6}).map((I,$)=>n.jsxs("div",{className:"bg-white/60 backdrop-blur-sm rounded-2xl border border-white/50 shadow-sm overflow-hidden",children:[n.jsx(Lt,{className:"h-48 w-full"}),n.jsxs("div",{className:"p-6 space-y-4",children:[n.jsx(Lt,{className:"h-6 w-full"}),n.jsx(Lt,{className:"h-4 w-24"}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(Lt,{className:"h-4 w-full"}),n.jsx(Lt,{className:"h-4 w-full"}),n.jsx(Lt,{className:"h-4 w-3/4"})]}),n.jsx(Lt,{className:"h-10 w-full"})]})]},$))})]})]}):n.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 via-white to-blue-50/30 relative overflow-hidden",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsxs("div",{className:"relative container mx-auto p-6 max-w-7xl space-y-8",children:[n.jsxs("div",{className:"relative overflow-hidden bg-gradient-to-br from-white via-blue-50/30 to-indigo-50/40 rounded-2xl border border-blue-200/50 shadow-sm p-4 md:p-8",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsx("div",{className:"absolute top-0 right-0 w-40 h-40 bg-gradient-to-br from-blue-200/20 to-transparent roun
1847ded-full -translate-y-20 translate-x-20"}),n.jsx("div",{className:"relative",children:n.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-center justify-between gap-4 md:gap-6",children:[n.jsxs("div",{className:"flex items-center gap-2 md:gap-4 flex-1",children:[n.jsx("div",{className:"p-2 md:p-3 bg-white/80 backdrop-blur-sm rounded-xl md:rounded-2xl shadow-lg",children:n.jsx(Xr,{className:"h-5 w-5 md:h-8 md:w-8 text-blue-600"})}),n.jsxs("div",{className:"flex-1",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-1 md:mb-2",children:[n.jsx("h1",{className:"text-2xl md:text-4xl font-bold bg-gradient-to-r from-blue-700 via-indigo-700 to-purple-700 bg-clip-text text-transparent",children:"Content Management"}),n.jsx(Ya,{delayDuration:200,children:n.jsxs(Hs,{children:[n.jsx(zs,{asChild:!0,children:n.jsx("button",{type:"button",className:"p-1.5 rounded-full hover:bg-blue-100/50 transition-colors flex-shrink-0","aria-label":"Content Management information",children:n.jsx(qi,{className:"h-4 w-4 md:h-5 md:w-5 text-blue-600"})})}),n.jsx(Vn,{side:"bottom",className:"max-w-xs p-3",children:n.jsx("p",{className:"text-sm leading-relaxed",children:"Create, schedule, and publish content across all your social platforms. Streamline your content workflow with intelligent scheduling and cross-platform publishing."})})]})})]}),n.jsx("p",{className:"text-gray-600 text-base md:text-lg leading-relaxed max-w-2xl hidden md:block",children:"Create, schedule, and publish content across all your social platforms. Streamline your content workflow with intelligent scheduling and cross-platform publishing."})]})]}),n.jsx("div",{className:"flex flex-col sm:flex-row gap-3",children:n.jsxs(te,{onClick:B,className:"bg-gradient-to-r from-blue-600 to-indigo-600 hover:from-blue-700 hover:to-indigo-700 text-white shadow-sm hover:shadow-lg transition-all duration-300 transform hover:scale-105 border-0",children:[n.jsx(al,{className:"h-4 w-4 mr-2"}),"Create Content"]})})]})})]}),n.jsx("div",{className:"hidden sm:block",children:n.jsx(ey,{placement:"inline",compact:!0,className:"mb-4 bg-white/60 backdrop-blur-sm border border-white/50 shadow-sm"})}),n.jsx(qut,{selectedContent:w.selectedContent,isSelectionMode:w.isSelectionMode,contents:e,paginatedContents:y.paginatedContents,onToggleSelectAll:w.toggleSelectAll,onBulkCancelScheduled:w.bulkCancelScheduled}),n.jsx("div",{className:"mb-4",children:n.jsx("div",{className:"flex justify-center",children:n.jsx("div",{className:"relative overflow-hidden bg-white/60 backdrop-blur-sm rounded-lg border border-white/50 shadow-sm",children:n.jsxs("div",{className:"flex",children:[n.jsxs(te,{variant:i==="c
1847ards"?"default":"ghost",size:"sm",className:`rounded-l-lg rounded-r-none h-10 px-4 text-sm ${i==="cards"?"bg-gradient-to-r from-blue-500 to-indigo-600 text-white shadow-sm":"bg-transparent hover:bg-white/60"} transition-all duration-300`,onClick:()=>o("cards"),children:[n.jsx(_I,{className:"h-4 w-4 mr-2"}),"Cards"]}),n.jsxs(te,{variant:i==="calendar"?"default":"ghost",size:"sm",className:`rounded-r-lg rounded-l-none h-10 px-4 text-sm ${i==="calendar"?"bg-gradient-to-r from-indigo-500 to-purple-600 text-white shadow-sm":"bg-transparent hover:bg-white/60"} transition-all duration-300`,onClick:()=>o("calendar"),children:[n.jsx(Kn,{className:"h-4 w-4 mr-2"}),"Calendar"]})]})})})}),n.jsx(Gut,{search:y.search,onSearchChange:y.setSearch,contentType:y.contentType,onContentTypeChange:y.setContentType,statusFilter:y.statusFilter,onStatusFilterChange:y.setStatusFilter,platformFilter:y.platformFilter,onPlatformFilterChange:y.setPlatformFilter,sortConfig:y.sortConfig,onSortConfigChange:y.setSortConfig,filtersExpanded:d,onFiltersExpandedChange:u,viewMode:i}),i==="cards"?n.jsx(Jut,{paginatedContents:y.paginatedContents,filteredContents:y.filteredContents,currentPage:y.currentPage,totalPages:y.totalPages,onPageChange:y.setCurrentPage,selectedContent:w.selectedContent,isSelectionMode:w.isSelectionMode,onToggleContentSelection:w.toggleContentSelection,onViewEdit:L,onChangeSchedule:P,onCreateContent:B,onPlatformIconClick:N,getContentImage:C,hasVideo:E,getTextPreview:T}):n.jsxs("div",{className:"relative overflow-hidden bg-white/60 backdrop-blur-sm rounded-xl border border-white/50 shadow-sm",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-blue-50/20 via-transparent to-purple-50/20"}),n.jsx("div",{className:"relative",children:n.jsx(uie,{contents:y.sortedContents,currentMonth:l,onCurrentMonthChange:c,dateType:h,onDateTypeChange:m,dragOverDay:j.dragOverDay,onDragStart:j.handleDragStart,onDragEnd:j.handleDragEnd,onDragOver:j.handleDragOver,onDragLeave:j.handleDragLeave,onDrop:j.handleDrop,isContentDraggable:j.isContentDraggable,onViewEdit:L,onPlatformIconClick:N,formatDateInUserTimezone:b})})]})]}),n.jsx(hk,{isOpen:f.isOpen,onClose:F,contentId:f.contentId,currentScheduledTime:f.currentScheduledTime,onScheduleUpdate:M})]})}function eL(e){return e&&typeof e=="object"&&"label"in e&&"value"in e}function aj(e){return eL(e)?e.label:e}function Zd(e){return eL(e)?e.value:e}function eV(e){return eL(e)?e.icon:void 0}let m4=[];function lht(){const{session:e}=wa(),[t,r]=g.useState([]),[s,a]=g.useState(!0),[i,o]=g.useState(null),[l,c]=g.useState("FREE");return g.useEffect(()=>{async function d(){if(!e)return"FREE";try{const{data:h,error:m}=await de.rpc("get_plan_limitations");if(m)return console.error("Error fetching user plan:",m),"FREE";const f=h;return(f==null?void 0:f.plan_id)||"FREE"}catch(h){return console.error("Error in plan fetch:",h),"FREE"}}async function u(){if(!e){a(!1);return}try{a(!0),o(null);const h=await d();c(h);const p=await fetch("https://worker.rainfactory.ai/rainfactory/content-functions/get-content-types",{method:"POST",headers:{Authorization:`Bearer ${e.access_token}`,"Content-Type":"application/json",apikey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im9sZ25uZW5jY3F3d2JhaGNwc2duIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MjQxNjUyMDksImV4cCI6MjAzOTc0MTIwOX0.qUa9W4vEYLC7LaUPczpqHA9tp8NSiWB7POqOWEvJpYQ"}});if(!p.ok)throw new Error(`Failed to fetch content types: ${p.status} ${p.statusText}`);const A=await p.json();if(!A||!Array.isArray(A))throw new Error("Invalid response format from content types API");const v=A.map(x=>{if(x.requiredPlan&&x.status==="NOT_AVAILABLE"){const b={FREE:0,BASIC:1,PRO:2,ENTERPRISE:3},y=b[h]||0,w=b[x.requiredPlan]||0;return y<w?{...x,status:"NOT_AVAILABLE"}:{...x,status:"LIVE"}}return x});r(v),m4=v}catch(h){console.error("Error fetching content types:",h),o(h instanceof Error?h:new Error(String(h))),r([]),m4=[]}finally{a(!1)}}return u(),()=>{m4=[]}},[e]),{contentTypes:t,loading:s,error:i,userPlan:l}}var mie=["PageUp","PageDown"],pie=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Aie={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},P0="Slider",[UP,cht,dht]=F_(P0),[gie]=Ki(P0,[dht]),[uht,fk]=gie(P0),xie=g.forwardRef((e,t)=>
1847{const{name:r,min:s=0,max:a=100,step:i=1,orientation:o="horizontal",disabled:l=!1,minStepsBetweenThumbs:c=0,defaultValue:d=[s],value:u,onValueChange:h=()=>{},onValueCommit:m=()=>{},inverted:f=!1,form:p,...A}=e,v=g.useRef(new Set),x=g.useRef(0),y=o==="horizontal"?hht:fht,[w=[],j]=lo({prop:u,defaultProp:d,onChange:T=>{var L;(L=[...v.current][x.current])==null||L.focus(),h(T)}}),N=g.useRef(w);function _(T){const B=xht(w,T);E(T,B)}function S(T){E(T,x.current)}function C(){const T=N.current[x.current];w[x.current]!==T&&m(w)}function E(T,B,{commit:L}={commit:!1}){const P=wht(i),F=jht(Math.round((T-s)/i)*i+s,P),M=mb(F,[s,a]);j((I=[])=>{const $=Aht(I,M,B);if(yht($,c*i)){x.current=$.indexOf(M);const V=String($)!==String(I);return V&&L&&m($),V?$:I}else return I})}return n.jsx(uht,{scope:e.__scopeSlider,name:r,disabled:l,min:s,max:a,valueIndexToChangeRef:x,thumbs:v.current,values:w,orientation:o,form:p,children:n.jsx(UP.Provider,{scope:e.__scopeSlider,children:n.jsx(UP.Slot,{scope:e.__scopeSlider,children:n.jsx(y,{"aria-disabled":l,"data-disabled":l?"":void 0,...A,ref:t,onPointerDown:yt(A.onPointerDown,()=>{l||(N.current=w)}),min:s,max:a,inverted:f,onSlideStart:l?void 0:_,onSlideMove:l?void 0:S,onSlideEnd:l?void 0:C,onHomeKeyDown:()=>!l&&E(s,0,{commit:!0}),onEndKeyDown:()=>!l&&E(a,w.length-1,{commit:!0}),onStepKeyDown:({event:T,direction:B})=>{if(!l){const F=mie.includes(T.key)||T.shiftKey&&pie.includes(T.key)?10:1,M=x.current,I=w[M],$=i*F*B;E(I+$,M,{commit:!0})}}})})})})});xie.displayName=P0;var[vie,bie]=gie(P0,{startEdge:"left",endEdge:"right",size:"width",direction:1}),hht=g.forwardRef((e,t)=>{const{min:r,max:s,dir:a,inverted:i,onSlideStart:o,onSlideMove:l,onSlideEnd:c,onStepKeyDown:d,...u}=e,[h,m]=g.useState(null),f=zr(t,y=>m(y)),p=g.useRef(void 0),A=Xg(a),v=A==="ltr",x=v&&!i||!v&&i;function b(y){const w=p.current||h.getBoundingClientRect(),j=[0,w.width],_=tL(j,x?[r,s]:[s,r]);return p.current=w,_(y-w.left)}return n.jsx(vie,{scope:e.__scopeSlider,startEdge:x?"left":"right",endEdge:x?"right":"left",direction:x?1:-1,size:"width",children:n.jsx(yie,{dir:A,"data-orientation":"horizontal",...u,ref:f,style:{...u.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:y=>{const w=b(y.clientX);o==null||o(w)},onSlideMove:y=>{const w=b(y.clientX);l==null||l(w)},onSlideEnd:()=>{p.current=void 0,c==null||c()},onStepKeyDown:y=>{const j=Aie[x?"from-left":"from-right"].includes(y.key);d==null||d({event:y,direction:j?-1:1})}})})}),fht=g.forwardRef((e,t)=>{const{min:r,max:s,inverted:a,onSlideStart:i,onSlideMove:o,onSlideEnd:l,onStepKeyDown:c,...d}=e,u=g.useRef(null),h=zr(t,u),m=g.useRef(void 0),f=!a;function p(A){const v=m.current||u.current.getBoundingClientRect(),x=[0,v.height],y=tL(x,f?[s,r]:[r,s]);return m.current=v,y(A-v.top)}return n.jsx(vie,{scope:e.__scopeSlider,startEdge:f?"bottom":"top",endEdge:f?"top":"bottom",size:"height",direction:f?1:-1,children:n.jsx(yie,{"data-orientation":"vertical",...d,ref:h,style:{...d.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:A=>{const v=p(A.clientY);i==null||i(v)},onSlideMove:A=>{const v=p(A.clientY);o==null||o(v)},onSlideEnd:()=>{m.current=void 0,l==null||l()},onStepKeyDown:A=>{const x=Aie[f?"from-bottom":"from-top"].includes(A.key);c==null||c({event:A,direction:x?-1:1})}})})}),yie=g.forwardRef((e,t)=>{const{__scopeSlider:r,onSlideStart:s,onSlideMove:a,onSlideEnd:i,onHomeKeyDown:o,onEndKeyDown:l,onStepKeyDown:c,...d}=e,u=fk(P0,r);return n.jsx(sr.span,{...d,ref:t,onKeyDown:yt(e.onKeyDown,h=>{h.key==="Home"?(o(h),h.preventDefault()):h.key==="End"?(l(h),h.preventDefault()):mie.concat(pie).includes(h.key)&&(c(h),h.preventDefault())}),onPointerDown:yt(e.onPointerDown,h=>{const m=h.target;m.setPointerCapture(h.pointerId),h.preventDefault(),u.thumbs.has(m)?m.focus():s(h)}),onPointerMove:yt(e.onPointerMove,h=>{h.target.hasPointerCapture(h.pointerId)&&a(h)}),onPointerUp:yt(e.onPointerUp,h=>{const m=h.target;m.hasPointerCapture(h.pointerId)&&(m.releasePointerCapture(h.pointerId),i(h))})})}),wie="SliderTrack",jie=g.forwardRef((e,t)=>{const{__scopeSlider:r,...s}=e,a=fk(wie,r);return n.jsx(sr.span,{"data-disabled":a.disabled?"":void 0,"data-orientation":a.orientation,...s,ref:t})});jie.displayName=wie;var MP="SliderRange",Nie=g.forwardRef((e,t)=>
1847{const{__scopeSlider:r,...s}=e,a=fk(MP,r),i=bie(MP,r),o=g.useRef(null),l=zr(t,o),c=a.values.length,d=a.values.map(m=>Sie(m,a.min,a.max)),u=c>1?Math.min(...d):0,h=100-Math.max(...d);return n.jsx(sr.span,{"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,...s,ref:l,style:{...e.style,[i.startEdge]:u+"%",[i.endEdge]:h+"%"}})});Nie.displayName=MP;var $P="SliderThumb",_ie=g.forwardRef((e,t)=>{const r=cht(e.__scopeSlider),[s,a]=g.useState(null),i=zr(t,l=>a(l)),o=g.useMemo(()=>s?r().findIndex(l=>l.ref.current===s):-1,[r,s]);return n.jsx(mht,{...e,ref:i,index:o})}),mht=g.forwardRef((e,t)=>{const{__scopeSlider:r,index:s,name:a,...i}=e,o=fk($P,r),l=bie($P,r),[c,d]=g.useState(null),u=zr(t,b=>d(b)),h=c?o.form||!!c.closest("form"):!0,m=I_(c),f=o.values[s],p=f===void 0?0:Sie(f,o.min,o.max),A=ght(s,o.values.length),v=m==null?void 0:m[l.size],x=v?vht(v,p,l.direction):0;return g.useEffect(()=>{if(c)return o.thumbs.add(c),()=>{o.thumbs.delete(c)}},[c,o.thumbs]),n.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[l.startEdge]:`calc(${p}% + ${x}px)`},children:[n.jsx(UP.ItemSlot,{scope:e.__scopeSlider,children:n.jsx(sr.span,{role:"slider","aria-label":e["aria-label"]||A,"aria-valuemin":o.min,"aria-valuenow":f,"aria-valuemax":o.max,"aria-orientation":o.orientation,"data-orientation":o.orientation,"data-disabled":o.disabled?"":void 0,tabIndex:o.disabled?void 0:0,...i,ref:u,style:f===void 0?{display:"none"}:e.style,onFocus:yt(e.onFocus,()=>{o.valueIndexToChangeRef.current=s})})}),h&&n.jsx(Cie,{name:a??(o.name?o.name+(o.values.length>1?"[]":""):void 0),form:o.form,value:f},s)]})});_ie.displayName=$P;var pht="RadioBubbleInput",Cie=g.forwardRef(({__scopeSlider:e,value:t,...r},s)=>{const a=g.useRef(null),i=zr(a,s),o=Fy(t);return g.useEffect(()=>{const l=a.current;if(!l)return;const c=window.HTMLInputElement.prototype,u=Object.getOwnPropertyDescriptor(c,"value").set;if(o!==t&&u){const h=new Event("input",{bubbles:!0});u.call(l,t),l.dispatchEvent(h)}},[o,t]),n.jsx(sr.input,{style:{display:"none"},...r,ref:i,defaultValue:t})});Cie.displayName=pht;function Aht(e=[],t,r){const s=[...e];return s[r]=t,s.sort((a,i)=>a-i)}function Sie(e,t,r){const i=100/(r-t)*(e-t);return mb(i,[0,100])}function ght(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function xht(e,t){if(e.length===1)return 0;const r=e.map(a=>Math.abs(a-t)),s=Math.min(...r);return r.indexOf(s)}function vht(e,t,r){const s=e/2,i=tL([0,50],[0,s]);return(s-i(t)*r)*r}function bht(e){return e.slice(0,-1).map((t,r)=>e[r+1]-t)}function yht(e,t){if(t>0){const r=bht(e);return Math.min(...r)>=t}return!0}function tL(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const s=(t[1]-t[0])/(e[1]-e[0]);return t[0]+s*(r-e[0])}}function wht(e){return(String(e).split(".")[1]||"").length}function jht(e,t){const r=Math.pow(10,t);return Math.round(e*r)/r}var mk=xie,kie=jie,Eie=Nie,Bie=_ie;const Tie=g.forwardRef(({className:e,showTooltip:t=!1,tooltipContent:r,options:s,showSelectedValue:a=!0,...i},o)=>{const[l,c]=g.useState(!1),[d,u]=g.useState(()=>i.defaultValue!==void 0?i.defaultValue:i.value!==void 0?i.value:[0]);g.useEffect(()=>{i.value!==void 0&&u(i.value)},[i.value]),g.useEffect(()=>{i.defaultValue!==void 0&&i.value===void 0&&u(i.defaultValue)},[i.defaultValue,i.value]);const h=v=>{var x;u(v),(x=i.onValueChange)==null||x.call(i,v)},m=()=>{t&&c(!0)},f=g.useCallback(()=>{t&&c(!1)},[t]);g.useEffect(()=>{if(t)return document.addEventListener("pointerup",f),()=>{document.removeEventListener("pointerup",f)}},[t,f]);const p=v=>{const x=n.jsx(Bie,{className:"block h-5 w-5 rounded-full border-2 border-primary bg-background transition-colors focus-visible:outline focus-visible:outline-[3px] focus-visible:outline-ring/40 data-[disabled]:cursor-not-allowed",onPointerDown:m});return t?n.jsx(Ya,{children:n.jsxs(Hs,{open:l,children:[n.jsx(zs,{asChild:!0,children:x}),n.jsx(Vn,{className:"px-2 py-1 text-xs",sideOffset:8,side:i.orientation==="vertical"?"right":"top",children:n.jsx("p",{children:s?s[Math.min(v,s.length-1)]:r?r(v):v})})]})}):x},A=()=>{if(!s||s.length===0)return null;const v=Math.min(d[0],s.length-1);return s[v]};return n.jsxs("div",{className:"flex flex-col w-full",children:[a&&s&&s.length>0&&n.jsx("div",{className:"mb-2 text-sm font-medium text-center",children:A()}),n.jsxs(mk,{ref:o,className:ye("relative flex w-full touch-none select-none items-center data-[orientation=vertical]:h-full data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col data-[disabled]:opacity-50",e),onValueChange:h,max:s?s.length-1:i.max,step:1,...i,children:[n.jsx(kie,{className:"relative grow overflow-hidden rounded-full bg-secondary data-[orientation=horizontal]:h-2 data-[orientation=vertical]:h-full data-[orientation=horizontal]:w-full data-[orientation=vertical]:w-2",children:n.jsx(Eie,{className:"absolute bg-primary data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full"})}),d==null?void 0:d.map((v,x)=>n.jsx(g.Fragment,{children:p(v)},x))]})]})});Tie.displayName=mk.displayName;function Nht({children:e,className:t,...r}){return n.jsx("span",{className:ye("absolute w-[1px] h-[1px] p-0 -m-[1px] overflow-hidden clip-[rect(0,0,0,0)] border-0",t),...r,children:e})}const _ht={blog_post:{defaultPlatform:"rss",availablePlatforms:["rss","wordpress","medium","linkedin_article"],required:!0},social_post:{defaultPlatform:null,availablePlatforms:["linkedin","facebook","instagram","twitter","tiktok"],required:!1},ad_group:{defaultPlatform:null,availablePlatforms:["bing","facebook","google_ads","instagram","linkedin","twitter"],required:!1},email_newsletter:{defaultPlatform:"email",availablePlatforms:["email"],required:!0},landing_page:{defaultPlatform:null,availablePlatforms:[],required:!1}};function Cht(e){return _ht[e]||null}function Sht(e){const t=Cht(e);return(t==null?void 0:t.defaultPlatform)||null}const QP=["single","thread"],Pie=["single_image","carousel","reel","story","video","live"],Iie=["photo","video","reel","carousel","link","text","story","live","event"],Oie=["document","video","text","poll","newsletter","live","
1847image","article","link"];[...QP,...Pie,...Iie,...Oie];const id={single:{label:"Single Tweet",description:"One standalone tweet",whenToUse:"Use for quick updates, announcements, or standalone thoughts",supportedMediaTypes:["image","video"],status:"available"},thread:{label:"Thread",description:"Multiple connected tweets",whenToUse:"Use when you have multiple related points or need more than 280 characters",supportedMediaTypes:["image","video"],status:"available"},single_image:{label:"Single Post",description:"One image or video",whenToUse:"Use for single impactful images or short videos",supportedMediaTypes:["image","video"],status:"available"},carousel:{label:"Carousel",description:"Multiple images/videos (up to 10)",whenToUse:"Use for step-by-step guides, before/after, or multiple product shots",supportedMediaTypes:["image","video"],status:"available"},reel:{label:"Reel",description:"Short-form vertical video",whenToUse:"Use for trending content, quick tips, or viral-style videos (15-90 seconds)",supportedMediaTypes:["video"],status:"coming_soon"},story:{label:"Story",description:"24-hour ephemeral content",whenToUse:"Use for time-sensitive content, behind-the-scenes, or daily updates",supportedMediaTypes:["image","video"],status:"coming_soon"},video:{label:"Video",description:"Long-form video (up to 60 min)",whenToUse:"Use for tutorials, interviews, or in-depth content",supportedMediaTypes:["video"],status:"coming_soon"},live:{label:"Live Video",description:"Real-time streaming",whenToUse:"Use for Q&As, product launches, or real-time events",supportedMediaTypes:["video"],status:"coming_soon"},photo:{label:"Photo Post",description:"Single photo",whenToUse:"Use for single impactful images or announcements",supportedMediaTypes:["image"],status:"available"},link:{label:"Link Share",description:"Share a link with preview",whenToUse:"Use to share blog posts, articles, or external content",supportedMediaTypes:["image"],status:"available"},text:{label:"Text Post",description:"Text-only status update",whenToUse:"Use for questions, polls, or text-based engagement",supportedMediaTypes:["none"],status:"available"},event:{label:"Event",description:"Event post",whenToUse:"Use to promote upcoming events or gatherings",supportedMediaTypes:["image"],status:"coming_soon"},document:{label:"Document",description:"PDF/document carousel",whenToUse:"Use for reports, whitepapers, or slide decks",supportedMediaTypes:["none"],status:"coming_soon"},poll:{label:"Poll",description:"Interactive poll",whenToUse:"Use to gather opinions or engage your network",supportedMediaTypes:["none"],status:"coming_soon"},newsletter:{label:"Newsletter",description:"Newsletter post",whenToUse:"Use for regular long-form content to subscribers",supportedMediaTypes:["image"],status:"coming_soon"},image:{label:"Image Post",description:"Single image post",whenToUse:"Use for infographics, quotes, or visual content",supportedMediaTypes:["image"],status:"available"},article:{label:"Article",description:"Long-form article",whenToUse:"Use for thought leadership or in-depth professional content",supportedMediaTypes:["image"],status:"coming_soon"}};function Fie(e){if(e.platform_post_type)return e.platform_post_type;if(e.is_series!==void 0){const r=e.platform||"twitter";return kht(e.is_series,r)}const t=e.platform||"twitter";return rL(t)}function kht(e,t){if(!e)return rL(t);switch(t.toLowerCase()){case"twitter":return"thread";case"instagram":return"carousel";case"facebook":return"carousel";case"linkedin":return"document";default:return"thread"}}function rL(e){switch(e.toLowerCase()){case"twitter":return"single";case"instagram":return"single_image";case"facebook":return"photo";case"linkedin":return"image";default:return"single"}}function Lie(e){return["thread","carousel","document"].includes(e)}function Eht(e){switch(e.toLowerCase()){case"twitter":return QP;case"instagram":return Pie;case"facebook":return Iie;case"linkedin":return Oie;default:return QP}}function Bht(e){const t=id[e];return(t==null?void 0:t.supportedMediaTypes)||[]}const tV={campaigns:["Loading available campaigns...","Analyzing campaign data...","Preparing campaign options...","Finalizing campaign selection..."],dependencies:["Loading content dependencies...","Analyzing content relationships...","Preparing dependency options...","Finalizing dependency selection..."]},Tht=e=>{if(!e)return{};try{return typeof e=="string"?JSON.parse(e):e}catch(t){return console.error("Error parsing convergence metadata:",t),{}}},ij=(e,t)=>{if(!e.showWhen)return!0;const{field:r,values:s}=e.showWhen,a=t[r];
1847return typeof a=="string"?s.includes(a):Array.isArray(a)?a.some(i=>s.includes(i)):!1},Pht=(e,t)=>{if(!e.showWhen)return!0;const{field:r,values:s}=e.showWhen,a=t[r];return typeof a=="string"?s.includes(a):Array.isArray(a)?a.some(i=>s.includes(i)):!1},Iht=e=>typeof e=="object"&&e.status?e.status==="coming_soon":!1;function Oht({contentType:e,isOpen:t,onClose:r,onComplete:s,defaultCampaignId:a,defaultConvergenceId:i}){var Oe,be;const{selectedBrand:o}=mn(),[l,c]=g.useState([]),[d,u]=g.useState(""),[h,m]=g.useState(!0),[f,p]=g.useState(null),[A,v]=g.useState([]),[x,b]=g.useState(""),[y,w]=g.useState(""),[j,N]=g.useState(!1),[_,S]=g.useState(!1),[C,E]=g.useState(-1),T=g.useRef(null),B=g.useRef(null);g.useEffect(()=>{t||(S(!1),E(-1),w(""))},[t]);const[L,P]=g.useState(()=>{const ue={};return e.requiredInputs.forEach(Ee=>{Ee.default!==void 0&&(ue[Ee.name]=Ee.default)}),(e.id==="blog_post"||e.id==="social_post")&&(ue.mediaGeneration="none"),ue}),[F,M]=g.useState({}),[I,$]=g.useState({}),[V,R]=g.useState({}),[Q,U]=g.useState(!1),[D,q]=g.useState(null),[G,Y]=g.useState(null),[K,X]=g.useState([]),ne=e.requiredInputs.some(ue=>ue.required),ae=e.dependencies.length>0,[J,W]=g.useState(null),ie=ue=>{X([]);let Ee=0;return setInterval(()=>{Ee<ue.length&&(X(Ge=>[...Ge,ue[Ee]]),Ee++)},1500)};g.useEffect(()=>{async function ue(){if(!o)return;m(!0),p(null);let Ee;try{Ee=ie(tV.campaigns);const{data:De,error:Ge}
1847=await de.from("campaigns").select("*").eq("brand_id",o.id).eq("status","Active").order("name");if(Ge)throw Ge;if(De&&De.length>0)if(c(De),a)u(a);else{const Ye=De.find(Tt=>Tt.campaign_type==="BASE");Ye&&u(Ye.id)}else p("No active campaigns found for this brand")}catch(De){console.error("Error loading campaigns:",De),p("Failed to load campaigns")}finally{Ee&&clearInterval(Ee),m(!1),X([])}}t&&ue()},[t,o,a]),g.useEffect(()=>{async function ue(){if(o){N(!0);try{const{data:Ee,error:De}=await de.from("convergences").select("id, name, trend, convergence, status, type, metadata").eq("brand_id",o.id).in("status",["Unused","Used"]).order("created_at",{ascending:!1}).limit(100);if(De)throw De;Ee&&v(Ee)}catch(Ee){console.error("Error loading convergences:",Ee)}finally{N(!1)}}}t&&ue()},[t,o]),g.useEffect(()=>{if(i&&A.length>0){const ue=A.find(Ee=>Ee.id===i);ue&&(b(i),w(ue.name))}},[i,A]),g.useEffect(()=>{function ue(Ee){T.current&&B.current&&!T.current.contains(Ee.target)&&!B.current.contains(Ee.target)&&(S(!1),E(-1))}if(_)return document.addEventListener("mousedown",ue),()=>document.removeEventListener("mousedown",ue)},[_]);const he=()=>{const ue=y.toLowerCase();return A.filter(Ee=>Ee.name.toLowerCase().includes(ue)||Ee.trend.toLowerCase().includes(ue)||Ee.convergence&&Ee.convergence.toLowerCase().includes(ue))},ee=ue=>{if(!_)return;const Ee=he();if(ue.key==="ArrowDown")ue.preventDefault(),E(De=>De<Ee.length-1?De+1:De);else if(ue.key==="ArrowUp")ue.preventDefault(),E(De=>De>0?De-1:-1);else if(ue.key==="Enter"){if(ue.preventDefault(),C>=0&&C<Ee.length){const De=Ee[C];b(De.id),w(De.name),S(!1),E(-1)}}else ue.key==="Escape"&&(ue.preventDefault(),S(!1),E(-1))};g.useEffect(()=>{E(-1)},[y]),g.useEffect(()=>{if(C>=0&&B.current){const ue=B.current.children[C];ue&&ue.scrollIntoView({block:"nearest",behavior:"smooth"})}},[C]),g.useEffect(()=>{async function ue(){if(!d||!e.dependencies.length)return;U(!0),q(null);let Ge;try{Ge=ie(tV.dependencies);
1847const Ye=e.dependencies.map(_t=>_t.type),{data:Tt,error:Nt}=await de.from("contents").select("id, name, content_type").eq("campaign_id",d).eq("status","READY").in("content_type",Ye);if(Nt)throw Nt;const Pt=(Tt||[]).reduce((_t,zt)=>(_t[zt.content_type]||(_t[zt.content_type]=[]),_t[zt.content_type].push(zt),_t),{});$(Pt)}catch(Ye){q("Failed to load available dependencies"),console.error("Error loading dependencies:",Ye)}finally{Ge&&clearInterval(Ge),U(!1),X([])}}async function Ee(){if(!x){Y(null);return}try{console.log("Attempting to load convergence data for convergence:",x);const{data:Ge,error:Ye}=await de.from("convergences").select("*").eq("id",x).single();if(Ye){console.error("Error fetching convergence data:",Ye),Y(null);return}console.log("Convergence data:",Ge);const Tt=Tht(Ge.metadata);console.log("Parsed metadata:",Tt);const Nt={...Ge,metadata:Tt};Y(Nt),console.log("Set convergence data successfully")}catch(Ge){console.error("Error in loadConvergenceData:",Ge),Y(null)}}d&&ue(),e.requiredInputs.some(Ge=>Ge.type==="ideas")&&Ee()},[d,x,e.dependencies,e.requiredInputs]);const xe=(ue,Ee)=>{P(De=>{const Ge={...De,[ue]:Ee};return e.requiredInputs.forEach(Ye=>{Ye.showWhen&&!ij(Ye,Ge)&&delete Ge[Ye.name]}),Ge}),Ee&&M(De=>{const Ge={...De};return delete Ge[ue],Ge})},we=(ue,Ee,De)=>{const Ge=Zd(Ee);if(De){const Ye=Array.isArray(L[ue])?[...L[ue]]:[];Ye.includes(Ge)?xe(ue,Ye.filter(Tt=>Tt!==Ge)):xe(ue,[...Ye,Ge])}else xe(ue,Ge)},Se=(ue,Ee,De)=>{var Ye;const Ge=Zd(Ee);return De?Array.isArray(L[ue])&&((Ye=L[ue])==null?void 0:Ye.includes(Ge)):L[ue]===Ge},pe=(ue,Ee)=>{R(De=>({...De,[ue]:Ee}))},Ce=()=>{const ue={};let Ee=!0;if(e.requiredInputs.filter(Ge=>ij(Ge,L)).forEach(Ge=>{Ge.required&&(L[Ge.name]===void 0||L[Ge.name]==="")&&(ue[Ge.name]="This field is required",Ee=!1)}),!Ee){M(ue);return}if(ae&&e.dependencies.filter(Ye=>Ye.required).some(Ye=>!V[Ye.type]))return;const De=Sht(e.id);s({campaignId:d||void 0,convergenceId:x||void 0,inputs:L,dependencies:V,platform_key:De||void 0})},re=()=>e.requiredInputs.filter(ue=>ij(ue,L)).filter(ue=>ue.required).every(ue=>!!L[ue.name]),se=()=>e.dependencies.filter(ue=>ue.required).every(ue=>!!V[ue.type]),Pe=e.dependencies.filter(ue=>{var Ee;return ue.required&&!((Ee=I[ue.type])!=null&&Ee.length)}).map(ue=>ue.type);return n.jsxs(Zt,{open:t,onOpenChange:r,children:[n.jsx(Nht,{children:n.jsxs(tr,{children:["Create Your New ",e.title]})}),n.jsx(Jt,{className:"max-w-4xl overflow-y-auto max-h-[95vh] p-0",children:n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"relative overflow-hidden bg-gradient-to-br from-slate-50 via-white to-blue-50/30 border-b border-blue-100/50 p-8",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsx("div",{className:"absolute top-0 right-0 w-32 h-32 bg-gradient-to-br from-blue-200/20 to-transparent rounded-full -translate-y-16 translate-x-16"}),n.jsx("div",{className:"absolute bottom-0 left-0 w-24 h-24 bg-gradient-to-tr from-indigo-200/15 to-transparent rounded-full translate-y-12 -translate-x-12"}),n.jsx("div",{className:"relative",children:n.jsxs("div",{className:"flex items-center gap-4 mb-4",children:[n.jsx("div",{className:"p-3 bg-white/60 backdrop-blur-sm rounded-2xl shadow-sm border border-white/20",children:n.jsx(Xr,{className:"h-6 w-6 text-blue-600"})}),n.jsxs("div",{children:[n.jsxs("h2",{className:"text-3xl font-bold bg-gradient-to-r from-blue-700 via-indigo-700 to-purple-700 bg-clip-text text-transparent mb-2",children:["Create Your New ",e.title]}),n.jsxs("p",{className:"text-gray-600 leading-relaxed",children:["Fill out the details below to craft your ",e.title.toLowerCase()]})]})]})})]}),n.jsxs("div",{className:"overflow-y-auto px-8 py-6 bg-gradient-to-br from-white via-slate-50/30 to-blue-50/20",children:[!1,n.jsx("div",{className:"relative mb-8 z-10",children:n.jsxs("div",{className:"bg-white/60 backdrop-blur-sm rounded-2xl border border-purple-100/50 shadow-sm p-6 transition-all duration-300 hover:shadow-md",children:[n.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[n.jsx("div",{className:"w-8 h-8 bg-gradient-to-br from-purple-500 to-violet-600 rounded-xl flex items-center justify-center shadow-lg",children:n.jsx(mr,{className:"h-4 w-4 text-white"})}),n.jsx("h3",{className:"text-xl font-semibold bg-gradient-to-r from-purple-700 to-violet-700 bg-clip-text text-transparent",children:"Convergence (Optional)"})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"convergence",className:"text-sm text-gray-600",children:"Select a trend convergence to base this content on"}),n.jsxs("div",{className:"relative",children:[n.jsxs("div",{className:"relative",children:[n.jsx(Ns,{className:"absolute left-3 top-3 h-4 w-4 text-gray-400"}),n.jsx(qe,{ref:T,placeholder:"Search convergences by name or trend...",value:y,onChange:ue=>{w(ue.target.value),A.length>0&&S(!0)},onFocus:()=>{A.length>0&&S(!0)},onKeyDown:ee,className:"pl-10",autoComplete:"off"})]}),_&&A.length>0&&(()=>{const ue=he();return ue.length>0?n.jsx("div",{ref:B,className:"absolute z-[100] w-full mt-2 bg-white border-2 border-purple-200 rounded-xl shadow-2xl max-h-80 overflow-y-auto",children:ue.map((Ee,De)=>n.jsxs("div",{className:ye("p-4 cursor-pointer border-b border-gray-100 last:border-b-0 transition-all duration-150",x===Ee.id&&"bg-purple-100 border-purple-200",De===C?"bg-purple-100 ring-2 ring-inset ring-purple-400 shadow-inner":"hover:bg-purple-50"),onClick:()=>{b(Ee.id),w(Ee.name),S(!1),E(-1)},onMouseEnter:()=>E(De),children:[n.jsx("div",{className:"font-semibold text-gray-900 text-base leading-tight mb-2",children:Ee.name}),n.jsxs("div",{className:"text-sm text-gray-700 mb-2",children:[n.jsx("span",{className:"font-semibold text-purple-700",children:"Trend:"})," ",n.jsx("span",{className:"text-gray-800",children:Ee.trend})]}),Ee.convergence&&n.jsx("div",{className:"text-xs text-gray-600 leading-relaxed line-clamp-3",children:Ee.convergence})]},Ee.id))}):n.jsx("div",{className:"absolute z-[100] w-full mt-2 bg-white border border-gray-200 rounded-lg shadow-lg p-3",children:n.jsx("div",{className:"text-sm text-gray-500 text-center",children:"No convergences match your search"})})})(),x&&n.jsx("div",{className:"mt-3 p-3 bg-purple-50 rounded-lg border border-purple-200",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex-1",children:[n.jsx("div",{className:"font-medium text-purple-900",children:(Oe=A.find(ue=>ue.id===x))==null?void 0:Oe.name}),n.jsx("div",{className:"text-sm text-purple-700 mt-1",children:(be=A.find(ue=>ue.id===x))==null?void 0:be.trend})]}),n.jsx(te,{variant:"ghost",size:"sm",onClick:()=>{b(""),w("")},children:n.jsx(kr,{className:"h-4 w-4"})})]})}),j&&n.jsx("div",{className:"text-sm text-gray-500 mt-2",children:"Loading convergences..."}),!j&&A.length===0&&n.jsx("div",{className:"text-sm text-gray-500 mt-2",children:"No convergences available"})]})]})]})}),e.requiredInputs&&e.requiredInputs.length>0&&n.jsx("div",{className:"relative mb-8",children:n.jsxs("div",{className:"bg-white/60 backdrop-blur-sm rounded-2xl border border-green-100/50 shadow-sm p-6 transition-all duration-300 hover:shadow-md",children:[n.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[n.jsx("div",{className:"w-8 h-8 bg-gradient-to-br from-green-500 to-emerald-600 rounded-xl flex items-center justify-center shadow-lg",children:n.jsx(Xr,{className:"h-4 w-4 text-white"})}),n.jsx("h3",{className:"text-xl font-semibold bg-gradient-to-r from-green-700 to-emerald-700 bg-clip-text text-transparent",children:"Content Configuration"})]}),n.jsx("div",{className:"space-y-6",children:e.requiredInputs.filter(ue=>ij(ue,L)).filter(ue=>ue.name!=="mediaGeneration").map(ue=>{var Ee,De,Ge,Ye,Tt,Nt,Pt,_t,zt,vt,vr,Rt,rr,an,It,ht,ar;return n.jsxs("div",{className:ye("space-y-3 p-5 rounded-xl transition-all duration-300 hover:shadow-sm border-2",ue.required?"bg-gradient-to-r from-blue-50/80 via-white/60 to-indigo-50/40 border-blue-200/60 shadow-sm":"bg-gradient-to-r from-gray-50/50 via-white/40 to-slate-50/30 border-gray-200/50"),children:[n.jsx("div",{className:"flex items-center justify-between",children:n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(ze,{htmlFor:ue.name,className:"text-base font-semibold text-gray-800",children:ue.description}),ue.required&&n.jsx(Be,{variant:"secondary",className:"text-xs px-2 py-1 h-6 bg-gradient-to-r from-blue-100 to-indigo-100 hover:from-blue-200 hover:to-indigo-200 text-blue-700 border border-blue-200/50 transition-all duration-200",children:"Required"})]})}),ue.type==="text"&&n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:ye("rounded-xl border-2 bg-white/80 backdrop-blur-sm transition-all duration-200 focus-within:shadow-md",ue.required?"border-blue-300/60 focus-within:border-blue-400 shadow-blue-100/20":"border-gray-300/60 focus-within:border-gray-400"),children:[n.jsx(qe,{id:ue.
1847name,value:L[ue.name]||"",placeholder:ue.placeholder,onChange:tt=>xe(ue.name,tt.target.value),className:ye("border-0 focus-visible:ring-0 focus-visible:ring-offset-0 bg-transparent h-12 text-base",F[ue.name]?"text-red-600":"")}),ue.suggestions&&ue.suggestions.length>0&&n.jsxs("div",{className:"border-t border-blue-100/50 p-4 bg-gradient-to-r from-blue-50/50 to-indigo-50/30",children:[n.jsx("p",{className:"text-sm font-medium text-blue-700 mb-3",children:"Suggestions:"}),n.jsx("div",{className:"flex flex-wrap gap-2",children:ue.suggestions.map(tt=>n.jsxs(te,{type:"button",variant:L[ue.name]===tt?"default":"ghost",size:"sm",onClick:()=>xe(ue.name,tt),className:ye("text-sm h-8 px-3 transition-all duration-300 rounded-lg transform hover:scale-105","hover:bg-blue-100 hover:text-blue-700 active:scale-95",L[ue.name]===tt?"bg-gradient-to-r from-blue-500 to-indigo-600 text-white hover:from-blue-600 hover:to-indigo-700 shadow-lg":"bg-white/80 border border-blue-200 hover:border-blue-300","cursor-pointer"),children:[n.jsx("span",{className:"mr-1 text-xs opacity-70",children:"+"}),tt]},tt))})]})]}),F[ue.name]&&n.jsx("p",{className:"text-sm text-red-500",children:F[ue.name]})]}),ue.type==="number"&&n.jsx("div",{className:ye("rounded-xl border-2 bg-white/80 backdrop-blur-sm transition-all duration-200 focus-within:shadow-md",ue.required?"border-blue-300/60 focus-within:border-blue-400 shadow-blue-100/20":"border-gray-300/60 focus-within:border-gray-400"),children:n.jsx(qe,{id:ue.name,type:"number",value:L[ue.name]||"",placeholder:ue.placeholder,onChange:tt=>xe(ue.name,parseFloat(tt.target.value)),className:ye("border-0 focus-visible:ring-0 focus-visible:ring-offset-0 bg-transparent h-12 text-base",F[ue.name]?"text-red-600":"")})}),ue.type==="select"&&ue.options&&n.jsxs(ur,{value:L[ue.name]||"",onValueChange:tt=>xe(ue.name,tt),children:[n.jsx(or,{className:ye("w-full bg-white/80 backdrop-blur-sm border-2 transition-all duration-200 rounded-xl h-12",F[ue.name]?"border-red-300 focus:border-red-400":"",ue.required?"border-blue-300/60 hover:border-blue-300 focus:border-blue-400":"border-gray-300/60 hover:border-gray-300 focus:border-gray-400"),children:n.jsx(hr,{placeholder:ue.placeholder||`Select ${ue.description.toLowerCase()}`})}),n.jsx(lr,{className:"bg-white/95 backdrop-blur-sm border-blue-200 rounded-xl",children:ue.options.map(tt=>n.jsx(Fe,{value:Zd(tt),className:"transition-all duration-200 rounded-lg mx-1 my-0.5 hover:bg-blue-50",children:aj(tt)},Zd(tt)))})]}),ue.type==="select_buttons"&&ue.options&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"flex flex-wrap gap-3",children:ue.options.filter(tt=>Pht(tt,L)).map(tt=>{const it=Se(ue.name,tt,ue.multipleSelections),gt=eV(tt),pr=Iht(tt);return n.jsx("div",{className:"relative",children:n.jsxs(te,{type:"button",variant:it?"default":"outline",onClick:()=>{pr||we(ue.name,tt,ue.multipleSelections)},disabled:pr,className:ye("flex items-center gap-2 h-11 px-4 transition-all duration-300 rounded-xl border-2",!pr&&"transform hover:scale-105 active:scale-95",it&&!pr?"bg-gradient-to-r from-blue-500 to-indigo-600 text-white border-blue-500 hover:from-blue-600 hover:to-indigo-700 shadow-lg":pr?"bg-gray-100/60 backdrop-blur-sm border-gray-300 text-gray-400 cursor-not-allowed opacity-60":"bg-white/80 backdrop-blur-sm border-blue-200 hover:border-blue-300 hover:bg-blue-50 text-gray-700"),children:[gt&&hu(gt,"h-4 w-4"),aj(tt),pr&&n.jsx(Be,{variant:"secondary",className:"ml-2 text-xs bg-orange-100 text-orange-700 border-orange-300",children:"Coming Soon"})]})},Zd(tt))})}),ue.name==="platform_post_type"&&L.platform_post_type&&n.jsx("div",{className:"mt-4 p-4 bg-gradient-to-r from-blue-50 to-indigo-50 border-2 border-blue-200 rounded-xl",children:n.jsxs("p",{className:"text-sm text-blue-900",children:[n.jsx("span",{className:"font-semibold",children:"💡 When to use:"})," ",((Ee=id[L.platform_post_type])==null?void 0:Ee.whenToUse)||"Select a post type to see guidance"]})})]}),ue.type==="multiselect"&&ue.options&&n.jsx("div",{className:"flex flex-wrap gap-3",children:ue.options.map(tt=>{var Lr;const it=Zd(tt),gt=aj(tt),pr=eV(tt),xt=Array.isArray(L[ue.name])&&((Lr=L[ue.name])==null?void 0:Lr.includes(it));return n.jsxs(te,{type:"button",variant:xt?"default":"outline",onClick:()=>{const En=Array.isArray(L[ue.name])?[...L[ue.name]]:[];xt?xe(ue.name,En.filter(qr=>qr!==it)):xe(ue.name,[...En,it])},className:ye("flex items-center gap-2 h-11 px-4 transition-all duration-300 rounded-xl border-2 transform hover:scale-105 active:scale-95",xt?"bg-gradient-to-r from-green-500 to-emerald-600 text-white border-green-500 hover:from-green-600 hover:to-emerald-700 shadow-lg":"bg-white/80 backdrop-blur-sm border-green-200 hover:border-green-300 hover:bg-green-50 text-gray-700"),children:[pr&&hu(pr,"h-4 w-4"),gt]},it)})}),ue.type==="select_slider"&&ue.options&&n.jsx("div",{className:"space-y-2",children:n.jsx(Tie,{value:[L[ue.name]&&ue.options?ue.options.findIndex(tt=>Zd(tt)===L[ue.name]):0],defaultValue:ue.default!==void 0?[ue.options.findIndex(tt=>Zd(tt)===ue.default)]:void 0,onValueChange:tt=>{var pr;
1847const it=tt[0],gt=(pr=ue.options)==null?void 0:pr[it];gt&&xe(ue.name,Zd(gt))},options:ue.options.map(tt=>aj(tt)),showTooltip:!0,showSelectedValue:!0,className:ye("w-full",F[ue.name]?"border-red-500":"")})}),ue.type==="ideas"&&n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:ye("rounded-xl border-2 bg-white/80 backdrop-blur-sm transition-all duration-200 focus-within:shadow-md overflow-hidden",ue.required?"border-purple-300/60 focus-within:border-purple-400 shadow-purple-100/20":"border-gray-300/60 focus-within:border-gray-400"),children:[n.jsx("textarea",{id:ue.name,value:L[ue.name]||"",placeholder:ue.placeholder||"Enter your ideas here...",onChange:tt=>{var it;if(xe(ue.name,tt.target.value),(it=G==null?void 0:G.metadata)!=null&&it.ideas){const gt=G.metadata.ideas,pr=Object.entries(gt).find(([xt,Lr])=>Lr===tt.target.value);W(pr?pr[0]:null)}},className:ye("w-full h-32 p-4 bg-transparent border-0 focus:outline-none focus:ring-0 text-base resize-none",F[ue.name]?"text-red-600":""),rows:5}),x&&G&&n.jsxs("div",{className:"border-t border-purple-100/50 p-4 bg-gradient-to-r from-purple-50/50 to-indigo-50/30",children:[n.jsx("p",{className:"text-sm font-medium text-purple-700 mb-3",children:"Click to use a suggested idea from the selected convergence:"}),n.jsxs("div",{className:"flex flex-wrap gap-2",children:[n.jsxs(te,{type:"button",variant:J==="brand_opinion"?"default":"ghost",size:"sm",onClick:()=>{var it,gt;const tt=(gt=(it=G==null?void 0:G.metadata)==null?void 0:it.ideas)==null?void 0:gt.brand_opinion;tt&&(xe(ue.name,tt),W("brand_opinion"))},className:ye("text-sm h-8 px-3 transition-all duration-300 rounded-lg transform hover:scale-105 active:scale-95","hover:bg-purple-100 hover:text-purple-700",J==="brand_opinion"?"bg-gradient-to-r from-purple-500 to-indigo-600 text-white hover:from-purple-600 hover:to-indigo-700 shadow-lg":"bg-white/80 border border-purple-200 hover:border-purple-300",!((Ge=(De=G==null?void 0:G.metadata)==null?void 0:De.ideas)!=null&&Ge.brand_opinion)&&"opacity-50","cursor-pointer"),disabled:!((Tt=(Ye=G==null?void 0:G.metadata)==null?void 0:Ye.ideas)!=null&&Tt.brand_opinion),children:[n.jsx("span",{className:"mr-1 text-xs opacity-70",children:"+"}),"Brand Opinion"]}),n.jsxs(te,{type:"button",variant:J==="hot_takes"?"default":"ghost",size:"sm",onClick:()=>{var it,gt;const tt=(gt=(it=G==null?void 0:G.metadata)==null?void 0:it.ideas)==null?void 0:gt.hot_takes;tt&&(xe(ue.name,tt),W("hot_takes"))},className:ye("text-sm h-8 px-3 transition-all duration-300 rounded-lg transform hover:scale-105 active:scale-95","hover:bg-purple-100 hover:text-purple-700",J==="hot_takes"?"bg-gradient-to-r from-purple-500 to-indigo-600 text-white hover:from-purple-600 hover:to-indigo-700 shadow-lg":"bg-white/80 border border-purple-200 hover:border-purple-300",!((Pt=(Nt=G==null?void 0:G.metadata)==null?void 0:Nt.ideas)!=null&&Pt.hot_takes)&&"opacity-50","cursor-pointer"),disabled:!((zt=(_t=G==null?void 0:G.metadata)==null?void 0:_t.ideas)!=null&&zt.hot_takes),children:[n.jsx("span",{className:"mr-1 text-xs opacity-70",children:"+"}),"Hot Takes"]}),n.jsxs(te,{type:"button",variant:J==="controversial_takes"?"default":"ghost",size:"sm",onClick:()=>{var it,gt;const tt=(gt=(it=G==null?void 0:G.metadata)==null?void 0:it.ideas)==null?void 0:gt.controversial_takes;tt&&(xe(ue.name,tt),W("controversial_takes"))},className:ye("text-sm h-8 px-3 transition-all duration-300 rounded-lg transform hover:scale-105 active:scale-95","hover:bg-purple-100 hover:text-purple-700",J==="controversial_takes"?"bg-gradient-to-r from-purple-500 to-indigo-600 text-white hover:from-purple-600 hover:to-indigo-700 shadow-lg":"bg-white/80 border border-purple-200 hover:border-purple-300",!((vr=(vt=G==null?void 0:G.metadata)==null?void 0:vt.ideas)!=null&&vr.controversial_takes)&&"opacity-50","cursor-pointer"),disabled:!((rr=(Rt=G==null?void 0:G.metadata)==null?void 0:Rt.ideas)!=null&&rr.controversial_takes),children:[n.jsx("span",{className:"mr-1 text-xs opacity-70",children:"+"}),"Controversial Takes"]}),n.jsxs(te,{type:"button",variant:J==="unique_insights"?"default":"ghost",size:"sm",onClick:()=>{var it,gt;const tt=(gt=(it=G==null?void 0:G.metadata)==null?void 0:it.ideas)==null?void 0:gt.unique_insights;tt&&(xe(ue.name,tt),W("unique_insights"))},className:ye("text-sm h-8 px-3 transition-all duration-300 rounded-lg transform hover:scale-105 active:scale-95","hover:bg-purple-100 hover:text-purple-700",J==="unique_insights"?"bg-gradient-to-r from-purple-500 to-indigo-600 text-white hover:from-purple-600 hover:to-indigo-700 shadow-lg":"bg-white/80 border border-purple-200 hover:border-purple-300",!((It=(an=G==null?void 0:G.metadata)==null?void 0:an.ideas)!=null&&It.unique_insights)&&"opacity-50","cursor-pointer"),disabled:!((ar=(ht=G==null?void 0:G.metadata)==null?void 0:ht.ideas)!=null&&ar.unique_insights),children:[n.jsx("span",{className:"mr-1 text-xs opacity-70",children:"+"}),"Unique Insights"]})]})]})]}),!G&&x&&n.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No idea data available for this convergence."}),!x&&n.jsx("p",{className:"text-sm text-muted-foreground italic",children:"Select a convergence above to see suggested ideas."})]}),ue.type==="url"&&n.jsxs("div",{className:"space-y-2",children:[n.jsx("div",{className:ye("rounded-lg border border-input bg-background",ue.required&&"border-l-4 border-l-blue-300 dark:border-l-blue-700"),
1847children:n.jsx(qe,{id:ue.name,type:"url",value:L[ue.name]||"",placeholder:ue.placeholder||"https://example.com",onChange:tt=>{const it=tt.target.value;if(it&&!it.match(/^https?:\/\//)){const gt=`https://${it}`;if(it.includes(".")||it.includes("localhost")){xe(ue.name,gt);return}}xe(ue.name,it)},onBlur:tt=>{const it=tt.target.value;if(!it){delete F[ue.name],M({...F});return}try{new URL(it),delete F[ue.name],M({...F})}catch{M({...F,[ue.name]:"Please enter a valid URL"})}},className:ye("border-0 focus-visible:ring-0 focus-visible:ring-offset-0",F[ue.name]?"border-red-500":"")})}),F[ue.name]&&n.jsx("p",{className:"text-sm text-red-500",children:F[ue.name]})]})]},ue.name)})})]})}),(e.id==="blog_post"||e.id==="social_post")&&(()=>{var Tt;const ue=L.platform_post_type,Ee=ue&&((Tt=id[ue])==null?void 0:Tt.supportedMediaTypes)||["image","video"],De=Ee.includes("image"),Ge=Ee.includes("video");return Ee.includes("none")&&Ee.length===1?null:n.jsx("div",{className:"relative mb-8",children:n.jsxs("div",{className:"bg-white/60 backdrop-blur-sm rounded-2xl border border-purple-100/50 shadow-sm p-6 transition-all duration-300 hover:shadow-md",children:[n.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[n.jsx("div",{className:"w-8 h-8 bg-gradient-to-br from-purple-500 to-pink-600 rounded-xl flex items-center justify-center shadow-lg",children:n.jsx(Ra,{className:"h-4 w-4 text-white"})}),n.jsx("h3",{className:"text-xl font-semibold bg-gradient-to-r from-purple-700 to-pink-700 bg-clip-text text-transparent",children:"Media Automation"})]}),n.jsx("div",{className:"space-y-4",children:n.jsxs("div",{className:"space-y-3 p-5 rounded-xl transition-all duration-300 hover:shadow-sm border-2 bg-gradient-to-r from-purple-50/50 via-white/40 to-pink-50/30 border-purple-200/50",children:[n.jsx("div",{className:"flex items-center gap-3 mb-4",children:n.jsx(ze,{className:"text-base font-semibold text-gray-800",children:"Would you like to automatically generate media for this content?"})}),n.jsxs("div",{className:"flex flex-wrap gap-3",children:[De&&n.jsxs(te,{type:"button",variant:L.mediaGeneration==="images"?"default":"outline",onClick:()=>xe("mediaGeneration","images"),className:ye("flex items-center gap-2 h-11 px-4 transition-all duration-300 rounded-xl border-2 transform hover:scale-105 active:scale-95",L.mediaGeneration==="images"?"bg-gradient-to-r from-purple-500 to-pink-600 text-white border-purple-500 hover:from-purple-600 hover:to-pink-700 shadow-lg":"bg-white/80 backdrop-blur-sm border-purple-200 hover:border-purple-300 hover:bg-purple-50 text-gray-700"),children:[n.jsx(Ra,{className:"h-4 w-4"}),"Generate Image(s)"]}),Ge&&n.jsxs(te,{disabled:!0,type:"button",variant:L.mediaGeneration==="videos"?"default":"outline",onClick:()=>xe("mediaGeneration","videos"),className:ye("flex items-center gap-2 h-11 px-4 transition-all duration-300 rounded-xl border-2 transform hover:scale-105 active:scale-95",L.mediaGeneration==="videos"?"bg-gradient-to-r from-purple-500 to-pink-600 text-white border-purple-500 hover:from-purple-600 hover:to-pink-700 shadow-lg":"bg-white/80 backdrop-blur-sm border-purple-200 hover:border-purple-300 hover:bg-purple-50 text-gray-700"),children:[n.jsx(fi,{className:"h-4 w-4"}),"Generate Video(s)"]}),n.jsxs(te,{type:"button",variant:L.mediaGeneration==="none"?"default":"outline",onClick:()=>xe("mediaGeneration","none"),className:ye("flex items-center gap-2 h-11 px-4 transition-all duration-300 rounded-xl border-2 transform hover:scale-105 active:scale-95",L.mediaGeneration==="none"?"bg-gradient-to-r from-gray-500 to-slate-600 text-white border-gray-500 hover:from-gray-600 hover:to-slate-700 shadow-lg":"bg-white/80 backdrop-blur-sm border-gray-200 hover:border-gray-300 hover:bg-gray-50 text-gray-700"),children:[n.jsx(kr,{className:"h-4 w-4"}),"No Media Generation"]})]}),n.jsx("p",{className:"text-sm text-gray-600 mt-3",children:e.id==="blog_post"?"Generate relevant images or videos to enhance your blog post and make it more engaging.":ue&&id[ue]?`For ${id[ue].label}, you can generate ${Ee.filter(Nt=>Nt!=="none").join(" or ")} content.`:"Generate media assets optimized for your social media platform to increase engagement."})]})})]})})})(),ae&&(ne||e.id==="blog_post"||e.id==="social_post")&&n.jsx(xn,{className:"my-4"}),ae&&n.jsx("div",{className:"relative mb-8",children:n.jsxs("div",{className:"bg-white/60 backdrop-blur-sm rounded-2xl border border-orange-100/50 shadow-sm p-6 transition-all duration-300 hover:shadow-md",children:[n.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[n.jsx("div",{className:"w-8 h-8 bg-gradient-to-br from-orange-500 to-red-600 rounded-xl flex items-center justify-center shadow-lg",children:n.jsx(ju,{className:"h-4 w-4 text-white"})}),n.jsx("h3",{className:"text-xl font-semibold bg-gradient-to-r from-orange-700 to-red-700 bg-clip-text text-transparent",children:"Content Dependencies"})]}),Q?n.jsxs("div",{className:"flex flex-col items-center p-8 space-y-6",children:[n.jsxs("div",{className:"relative",children:[n.jsx("div",{className:"w-12 h-12 rounded-full border-4 border-orange-200/30"}),n.jsx("div",{className:"absolute inset-0 w-12 h-12 rounded-full border-4 border-t-orange-500 border-r-red-600 border-b-transparent border-l-transparent animate-spin"})]}),n.jsx("div",{className:"text-center space-y-2",children:K.map((ue,Ee)=>n.jsx("div",{className:"text-sm text-orange-600 font-medium animate-fade-in transition-all duration-500",style:{animationDelay:`${Ee*200}ms`},children:ue},Ee))})]}):D?n.jsxs(Ar,{variant:"destructive",children:[n.jsx(nr,{className:"h-4 w-4"}),n.jsx(gr,{children:D})]}):Pe.length>0?n.jsxs(Ar,{variant:"destructive",children:[n.jsx(nr,{className:"h-4 w-4"}),n.jsxs(gr,{children:["This campaign is missing required content of type: ",Pe.join(", ")
1847]})]}):n.jsx("div",{className:"space-y-4",children:e.dependencies.map(ue=>{var Ee;return n.jsxs("div",{className:"space-y-2",children:[n.jsxs(ze,{children:[ue.description,ue.required&&n.jsx("span",{className:"text-red-500",children:"*"})]}),n.jsxs(ur,{value:V[ue.type],onValueChange:De=>pe(ue.type,De),children:[n.jsx(or,{children:n.jsx(hr,{placeholder:"Select content..."})}),n.jsx(lr,{children:(Ee=I[ue.type])==null?void 0:Ee.map(De=>n.jsx(Fe,{value:De.id,children:De.name},De.id))})]})]},ue.type)})})]})})]}),n.jsx("div",{className:"bg-gradient-to-r from-slate-50 to-blue-50/30 border-t border-blue-100/50 p-8",children:n.jsxs("div",{className:"flex justify-end gap-4",children:[n.jsx(te,{variant:"outline",onClick:r,className:"h-12 px-6 rounded-xl border-2 border-gray-300 hover:border-gray-400 bg-white/80 backdrop-blur-sm transition-all duration-200 hover:shadow-sm",children:"Cancel"}),n.jsx(te,{onClick:Ce,disabled:ne&&!re()||ae&&(!se()||Pe.length>0),className:ye("h-12 px-8 rounded-xl transition-all duration-300 transform hover:scale-105 active:scale-95 shadow-lg",ne&&!re()||ae&&(!se()||Pe.length>0)?"bg-gray-300 text-gray-500 cursor-not-allowed hover:scale-100":"bg-gradient-to-r from-blue-500 to-indigo-600 hover:from-blue-600 hover:to-indigo-700 text-white font-semibold"),children:"Create Content"})]})})]})})]})}const Fht={"message-square":Cc,"file-text":Xr,globe:Is,mail:Cu,"help-circle":Xm,video:fi,wrench:SI,"layout-grid":K_};function Lht(e){return Fht[e]}var Dht={cm:!0,mm:!0,in:!0,px:!0,pt:!0,pc:!0,em:!0,ex:!0,ch:!0,rem:!0,vw:!0,vh:!0,vmin:!0,vmax:!0,"%":!0};function Rht(e){if(typeof e=="number")return{value:e,unit:"px"};var t,r=(e.match(/^[0-9.]*/)||"").toString();r.includes(".")?t=parseFloat(r):t=parseInt(r,10);var s=(e.match(/[^0-9]*$/)||"").toString();return Dht[s]?{value:t,unit:s}:(console.warn("React Spinners: ".concat(e," is not a valid css value. Defaulting to ").concat(t,"px.")),{value:t,unit:"px"})}function p4(e){var t=Rht(e);return"".concat(t.value).concat(t.unit)}var Uht=function(e,t,r){var s="react-spinners-".concat(e,"-").concat(r);if(typeof window>"u"||!window.document)return s;var a=document.createElement("style");document.head.appendChild(a);var i=a.sheet,o=`
1848    @keyframes `.concat(s,` {
1849      `).concat(t,`
1850    }
1851  `);return i&&i.insertRule(o,0),s},x_=function(){return x_=Object.assign||function(e){for(var t,r=1,s=arguments.length;r<s;r++){t=arguments[r];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},x_.apply(this,arguments)},Mht=function(e,t){var r={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(r[s]=e[s]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,s=Object.getOwnPropertySymbols(e);a<s.length;a++)t.indexOf(s[a])<0&&Object.prototype.propertyIsEnumerable.call(e,s[a])&&(r[s[a]]=e[s[a]]);return r},$ht=Uht("PulseLoader","0% {transform: scale(1); opacity: 1} 45% {transform: scale(0.1); opacity: 0.7} 80% {transform: scale(1); opacity: 1}","pulse");function ov(e){var t=e.loading,r=t===void 0?!0:t,s=e.color,a=s===void 0?"#000000":s,i=e.speedMultiplier,o=i===void 0?1:i,l=e.cssOverride,c=l===void 0?{}:l,d=e.size,u=d===void 0?15:d,h=e.margin,m=h===void 0?2:h,f=Mht(e,["loading","color","speedMultiplier","cssOverride","size","margin"]),p=x_({display:"inherit"},c),A=function(v){return{backgroundColor:a,width:p4(u),height:p4(u),margin:p4(m),borderRadius:"100%",display:"inline-block",animation:"".concat($ht," ").concat(.75/o,"s ").concat(v*.12/o,"s infinite cubic-bezier(0.2, 0.68, 0.18, 1.08)"),animationFillMode:"both"}};return r?g.createElement("span",x_({style:p},f),g.createElement("span",{style:A(1)}),g.createElement("span",{style:A(2)}),g.createElement("span",{style:A(3)})):null}const Qht=["Analyzing your campaign details...","Preparing your content workspace...","Gathering brand data...","Finalizing your content environment...","Generating content...","Running QA checks...","Getting ready to launch..."];function Hht({open:e,onOpenChange:t,shownMessages:r,currentMessageIndex:s,isLoading:a}){const[i,o]=g.useState(0),[l,c]=g.useState(0),[d,u]=g.useState(!1),h=[{text:"Scanning inputs",loader:"scan"},{text:"Analyzing content patterns",loader:"content"},{text:"Evaluating brand voice",loader:"voice"},{text:"Optimizing experience",loader:"ux"},{text:"Processing data",loader:"data"},{text:"Generating insights",loader:"insights"},{text:"Optimizing strategy",loader:"optimize"},{text:"Building recommendations",loader:"recommendations"},{text:"Finalizing",loader:"complete"}];g.useEffect(()=>{if(!e){o(0),c(0);return}let p=0;const A=6e4,v=setInterval(()=>{p+=100;const x=p/A,b=x<.8?x*100:80+(x-.8)*100;o(Math.min(95,b));const y=Math.floor(p/6e3)%(h.length-1);c(w=>(y!==w&&(u(!0),setTimeout(()=>u(!1),250)),y))},100);return()=>clearInterval(v)},[e]);const m=p=>{switch(p){case"scan":return n.jsx(Ns,{className:"h-6 w-6 text-white"});case"content":return n.jsx(sl,{className:"h-6 w-6 text-white"});case"voice":return n.jsx(ui,{className:"h-6 w-6 text-white"});case"ux":return n.jsx(sa,{className:"h-6 w-6 text-white"});case"data":return n.jsx(Gi,{className:"h-6 w-6 text-white"});case"insights":return n.jsx(mr,{className:"h-6 w-6 text-white"});case"optimize":return n.jsx(en,{className:"h-6 w-6 text-white"});
1851case"recommendations":return n.jsx(ui,{className:"h-6 w-6 text-white"});case"complete":return n.jsx(qt,{className:"h-6 w-6 text-white"});default:return n.jsx(Vr,{className:"h-6 w-6 text-white"})}},f=p=>{switch(p){case"scan":return n.jsx("div",{className:"relative w-48 h-28 mx-auto",children:n.jsxs("div",{className:"absolute inset-0 bg-gradient-to-br from-white/40 to-blue-50/60 backdrop-blur-sm rounded-2xl border border-white/30 shadow-sm",children:[[...Array(10)].map((A,v)=>n.jsx("div",{className:"absolute h-px bg-gradient-to-r from-transparent via-blue-500/80 to-transparent",style:{top:`${(v+1)*9}%`,left:"15%",right:"15%",animation:"scan 3s ease-in-out infinite",animationDelay:`${v*.08}s`}},v)),n.jsx("div",{className:"absolute w-full h-1 bg-gradient-to-r from-transparent via-blue-500 to-transparent",style:{animation:"scanLine 2s ease-in-out infinite"}})]})});case"content":return n.jsx("div",{className:"relative w-56 h-32 mx-auto",children:n.jsx("div",{className:"bg-white/30 backdrop-blur-sm rounded-2xl border border-white/20 p-3 h-full",children:n.jsx("div",{className:"space-y-2",children:[...Array(3)].map((A,v)=>n.jsxs("div",{className:"bg-white/40 rounded-xl p-2",children:[n.jsx("div",{className:"h-3 w-28 rounded-md bg-gradient-to-r from-gray-300/60 via-white/70 to-gray-300/60",style:{backgroundSize:"200% 100%",animation:"shimmer 2.2s ease-in-out infinite"}}),n.jsx("div",{className:"mt-2 space-y-2",children:[...Array(2)].map((x,b)=>n.jsx("div",{className:"h-2 rounded-md bg-gradient-to-r from-gray-300/50 via-white/60 to-gray-300/50",style:{backgroundSize:"200% 100%",animation:"shimmer 2.2s ease-in-out infinite",animationDelay:`${.12*b}s`}},b))})]},v))})})});case"voice":return n.jsx("div",{className:"relative w-48 h-28 mx-auto flex items-center justify-center",children:n.jsx("div",{className:"bg-gradient-to-br from-white/40 to-purple-50/60 backdrop-blur-sm rounded-2xl border border-white/30 p-4 flex items-center justify-center",children:n.jsx("div",{className:"flex space-x-1.5",children:[...Array(8)].map((A,v)=>n.jsx("div",{className:"w-2 bg-gradient-to-t from-purple-600 via-indigo-500 to-blue-400 rounded-full",style:{height:`${18+Math.sin(Date.now()*.005+v)*22}px`,animation:`${1.5+v*.1}s voice ease-in-out infinite`,animationDelay:`${v*.1}s`}},v))})})});case"ux":return n.jsxs("div",{className:"relative w-72 h-40 mx-auto",children:[n.jsx("div",{className:"absolute inset-0 rounded-[18px] bg-gradient-to-br from-white/50 to-cyan-50/60 border border-white/40 shadow-xl backdrop-blur-sm"}),n.jsxs("div",{className:"absolute inset-2 rounded-[14px] overflow-hidden bg-gradient-to-b from-white/70 to-sky-50/60",children:[n.jsxs("div",{className:"absolute left-0 right-0",style:{animation:"pageScrollUX 6s ease-in-out infinite"},children:[n.jsxs("div",{className:"px-3 pt-2 pb-4",children:[n.jsx("div",{className:"h-5 w-24 rounded-md bg-gradient-to-r from-sky-200 to-indigo-200 mb-2"}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("div",{className:"h-3 rounded-md bg-sky-200/70"}),n.jsx("div",{className:"h-3 rounded-md bg-sky-200/50"}),n.jsx("div",{className:"h-3 rounded-md bg-sky-200/60 w-4/5"})]})]}),n.jsx("div",{className:"px-3 pt-2 pb-4",children:n.jsx("div",{className:"grid grid-cols-3 gap-2",children:[...Array(6)].map((A,v)=>n.jsx("div",{className:"h-10 rounded-xl bg-white/70 border border-white/40"},v))})})]}),n.jsx("div",{className:"absolute w-4 h-4 rounded-full bg-white shadow ring-2 ring-indigo-400/80",style:{animation:"cursorMoveUX 6s ease-in-out infinite"},children:n.jsx("span",{className:"absolute -inset-3 rounded-full border-2 border-indigo-400/70",style:{animation:"tapRippleUX 6s ease-in-out infinite"}})})]})]});case"data":return n.jsx("div",{className:"relative w-56 h-32 mx-auto",children:n.jsx("div",{className:"bg-white/30 backdrop-blur-sm rounded-2xl border border-white/20 p-4 h-full",children:[0,1,2].map(A=>n.jsxs("div",{className:"relative",children:[n.jsx("div",{className:"absolute left-3 right-3 h-1 rounded-full",style:{top:`${10+A*26}px`,background:"linear-gradient(90deg, rgba(99,102,241,0.35), rgba(59,130,246,0.55), rgba(99,102,241,0.35))"}}
1851),[0,1,2].map(v=>n.jsx("span",{className:"absolute w-2.5 h-2.5 rounded-full",style:{top:`${9+A*26}px`,left:"-12px",background:"linear-gradient(135deg, #818cf8, #60a5fa)",boxShadow:"0 0 8px rgba(96, 165, 250, 0.6)",animation:"packetMove 2.4s linear infinite",animationDelay:`${A*.3+v*.5}s`}},v))]},A))})});case"insights":return n.jsx("div",{className:"relative w-48 h-28 mx-auto flex items-center justify-center",children:n.jsx("div",{className:"bg-gradient-to-br from-white/40 to-yellow-50/60 backdrop-blur-sm rounded-2xl border border-white/30 p-4 flex items-center justify-center",children:n.jsxs("div",{className:"relative",children:[n.jsx("div",{className:"w-16 h-16 rounded-full flex items-center justify-center bg-gradient-to-br from-yellow-100 to-amber-200",children:n.jsx(mr,{className:"w-8 h-8 text-yellow-600"})}),[...Array(6)].map((A,v)=>n.jsx("div",{className:"absolute w-2.5 h-2.5 bg-gradient-to-br from-yellow-400 to-amber-500 rounded-full",style:{left:"50%",top:"50%",transform:`rotate(${v*60}deg) translateY(-38px)`,transformOrigin:"50% 50%",animation:"insights 2s ease-in-out infinite",animationDelay:`${v*.2}s`}},v))]})})});case"optimize":return n.jsx("div",{className:"relative w-48 h-28 mx-auto flex items-center justify-center",children:n.jsx("div",{className:"bg-gradient-to-br from-white/40 to-green-50/60 backdrop-blur-sm rounded-2xl border border-white/30 p-4 flex items-center justify-center",children:n.jsxs("svg",{className:"w-32 h-20",viewBox:"0 0 128 80",children:[n.jsx("defs",{children:n.jsxs("linearGradient",{id:"optMini",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[n.jsx("stop",{offset:"0%",stopColor:"#10b981"}),n.jsx("stop",{offset:"50%",stopColor:"#059669"}),n.jsx("stop",{offset:"100%",stopColor:"#047857"})]})}),n.jsx("path",{d:"M 10 70 Q 30 10 50 40 T 90 20 T 118 30",stroke:"url(#optMini)",strokeWidth:"4",fill:"none",className:"animate-pulse"}),n.jsx("circle",{cx:"10",cy:"70",r:"4",fill:"url(#optMini)",style:{animation:"optimizeDot 3s ease-in-out infinite"}})]})})});case"recommendations":return n.jsx("div",{className:"relative w-48 h-28 mx-auto flex items-center justify-center",children:n.jsx("div",{className:"bg-gradient-to-br from-white/40 to-indigo-50/60 backdrop-blur-sm rounded-2xl border border-white/30 p-4 flex items-center justify-center",children:n.jsxs("div",{className:"relative",children:[[...Array(3)].map((A,v)=>n.jsx("div",{className:"absolute rounded-full",style:{width:`${40+v*20}px`,height:`${40+v*20}px`,left:`${-v*10}px`,top:`${-v*10}px`,border:"3px solid transparent",backgroundImage:"linear-gradient(45deg, #6366f1, #8b5cf6, #a855f7)",backgroundClip:"padding-box",animation:`recommendationRing ${2+v}s linear infinite`,animationDelay:`${v*.5}s`}},v)),n.jsx("div",{className:"w-9 h-9 bg-gradient-to-br from-indigo-500 to-purple-600 rounded-full flex items-center justify-center text-white text-sm font-bold",children:n.jsx(Gi,{className:"w-4.5 h-4.5"})})]})})});case"complete":return n.jsx("div",{className:"relative w-48 h-28 mx-auto flex items-center justify-center",children:n.jsx("div",{className:"bg-gradient-to-br from-white/40 to-green-50/60 backdrop-blur-sm rounded-2xl border border-white/30 p-4 flex items-center justify-center",children:n.jsxs("div",{className:"relative",children:[n.jsx("div",{className:"w-20 h-20 rounded-full flex items-center justify-center bg-gradient-to-br from-green-50 to-emerald-100 border-4 border-emerald-400/70",children:n.jsx(qt,{className:"w-10 h-10 text-green-600"})}),n.jsx("div",{className:"absolute inset-0 rounded-full border-4 border-green-300/60 animate-ping"})]})})});default:return null}};return n.jsx(Zt,{open:e,onOpenChange:t,children:n.jsxs(Jt,{className:"sm:max-w-md relative overflow-hidden bg-gradient-to-br from-green-50/90 via-emerald-50/60 to-white border border-green-200/60",style:{position:"fixed",top:"50%",left:"50%",transform:"translate(-50%, -50%)",zIndex:9999},children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-green-50/30 via-transparent to-emerald-50/20"}),n.jsxs("div",{className:"relative",children:[n.jsx("div",{className:"absolute -top-1 left-0 right-0 h-1 bg-gradient-to-r from-emerald-100 to-green-100",children:n.jsx("div",{className:"h-full bg-gradient-to-r from-green-500 via-emerald-500 to-teal-500 transition-all duration-300",style:{width:`${i}%`}})}),n.jsx(tr,{className:"text-xl font-bold bg-gradient-to-r from-green-700 to-emerald-700 bg-clip-text text-transparent mb-2",children:"Creating Your Content"}),n.jsx(Hr,{className:"text-green-600 mb-6",children:"Please wait while we set up your new content space..."}),n.jsxs("div",{className:"flex flex-col items-center justify-center p-4 sm:p-6 space-y-4 sm:sp
1851ace-y-6",children:[n.jsx("div",{className:`transition-all duration-500 ${d?"opacity-0 translate-y-2":"opacity-100 translate-y-0"}`,children:n.jsx("div",{className:"inline-flex items-center justify-center w-12 h-12 bg-gradient-to-br from-green-500 to-emerald-600 rounded-xl mb-3",children:m(h[l].loader)})}),n.jsx("div",{className:`bg-white/10 backdrop-blur-md rounded-2xl border border-white/20 shadow-sm p-4 transition-all duration-500 ${d?"opacity-0 scale-95":"opacity-100 scale-100"}`,children:f(h[l].loader)}),n.jsx("div",{className:"space-y-3 w-full",children:r.length>0&&n.jsxs("div",{className:"flex items-center space-x-3 text-sm text-green-700 animate-fade-in p-3 bg-green-50/60 rounded-xl border border-green-200/40",children:[a&&s===r.length-1?n.jsxs("div",{className:"flex gap-1",children:[n.jsx("span",{className:"w-1.5 h-1.5 bg-emerald-500 rounded-full animate-bounce",style:{animationDelay:"0ms"}}),n.jsx("span",{className:"w-1.5 h-1.5 bg-green-500 rounded-full animate-bounce",style:{animationDelay:"150ms"}}),n.jsx("span",{className:"w-1.5 h-1.5 bg-teal-500 rounded-full animate-bounce",style:{animationDelay:"300ms"}})]}):n.jsx("div",{className:"w-5 h-5 rounded-full bg-gradient-to-br from-green-400 to-emerald-500 flex items-center justify-center shadow-sm",children:n.jsx("div",{className:"w-2 h-2 rounded-full bg-white"})}),n.jsx("span",{className:"font-medium",children:r[s]})]})}),n.jsx("div",{className:"text-[12px] text-emerald-700/80",children:h[l].text})]}),n.jsx("style",{children:`
1852                        @keyframes scan { 0%,100%{opacity:.4;transform:scaleX(1)} 50%{opacity:1;transform:scaleX(1.05)} }
1853                        @keyframes scanLine { 0%{top:0%;opacity:1;transform:scaleY(.8)} 50%{opacity:.9;transform:scaleY(1.2)} 100%{top:100%;opacity:0;transform:scaleY(.8)} }
1854                        @keyframes shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }
1855                        @keyframes voice { 0%,100%{height:22px;opacity:.6;transform:scaleY(1)} 50%{height:64px;opacity:1;transform:scaleY(1.1)} }
1856                        @keyframes pageScrollUX { 0%{transform:translateY(0)} 35%{transform:translateY(0)} 60%{transform:translateY(-100%)} 100%{transform:translateY(-100%)} }
1857                        @keyframes cursorMoveUX { 0%{transform:translate(24px,92px)} 25%{transform:translate(160px,120px)} 50%{transform:translate(126px,32px)}
1857 75%{transform:translate(56px,128px)} 100%{transform:translate(24px,92px)} }
1858                        @keyframes tapRippleUX { 0%,49%{opacity:0;transform:scale(.8)} 50%{opacity:1;transform:scale(1)} 60%{opacity:0;transform:scale(1.5)} 100%{opacity:0;transform:scale(.8)} }
1859                        @keyframes packetMove { 0%{transform:translateX(0) scale(1);opacity:0} 10%{opacity:1} 50%{transform:translateX(200px) scale(1.05)} 100%{transform:translateX(400px) scale(1);opacity:0} }
1860                        @keyframes insights { 0%{opacity:0;transform:rotate(0deg) translateY(-38px) scale(0)} 50%{opacity:1;transform:rotate(180deg) translateY(-38px) scale(1.15)} 100%{opacity:0;transform:rotate(360deg) translateY(-38px) scale(0)} }
1861                        @keyframes recommendationRing { 0%{transform:scale(.9) rotate(0deg);opacity:1} 50%{transform:scale(1.25) rotate(180deg);opacity:.7} 100%{transform:scale(.9) rotate(360deg);opacity:1} }
1862                        @keyframes optimizeDot { 0%{cx:10;transform:scale(1)} 25%{cx:50;transform:scale(1.15)} 50%{cx:90;transform:scale(1)} 75%{cx:118;transform:scale(1.15)} 100%{cx:10;transform:scale(1)} }
1863                    `})]})]})})}function Die(){const{session:e,loading:t}=wa(),{trackEvent:r,events:s}=Lu(),a=Gs(),i=xr(),[o]=Bi(),{selectedBrand:l}=mn(),[c,d]=g.useState(null),[u,h]=g.useState(!1),[m,f]=g.useState(!1),[p,A]=g.useState(null),[v,x]=g.useState([]),[b,y]=g.useState(0),[w,j]=g.useState(!1),[N,_]=g.useState(null),[S,C]=g.useState(null),[E,T]=g.useState(null),[B,L]=g.useState(!1),[P,F]=g.useState(!1),[M,I]=g.useState({contentTypeRequest:"",name:"",email:"",additionalDetails:""}),[$,V]=g.useState(!1),[R,Q]=g.useState(!1);g.useEffect(()=>{P&&(e!=null&&e.user)&&I(ae=>{var J;return{...ae,name:((J=e.user.user_metadata)==null?void 0:J.full_name)||"",email:e.user.email||""}})},[P,e]);const{contentTypes:U,loading:D}=lht();g.useEffect(()=>{a.state&&a.state.campaignId&&(_(a.state.campaignId),r(s.FEATURE_USED,{feature:"campaign_auto_selected",campaign_id:a.state.campaignId}))},[a.state,r,s]),g.useEffect(()=>{const ae=o.get("convergenceId");ae&&(C(ae),r(s.FEATURE_USED,{feature:"convergence_auto_selected",convergence_id:ae}))},[o,r,s]),g.useEffect(()=>{u&&y(0)},[u]);const q=()=>{wre({particleCount:100,spread:70,origin:{y:.6}})},G=async ae=>{if(t){console.log("Auth still loading, please wait...");return}const J=U.find(W=>W.id===ae);if(J){if(r(s.CONTENT_TYPE_SELECTED,{content_type:ae,content_type_name:J.title,content_type_status:J.status,from_campaign_id:N}),J.status==="NOT_AVAILABLE"){console.log("This content type requires a higher plan");return}if(J.status==="COMING_SOON"){console.log("This content type is coming soon");return}A(J),f(!0)}},Y=({campaignId:ae,convergenceId:J,inputs:W,dependencies:ie,platform_key:he})=>{p&&(K(p.id,ae,J,ie,W,he),f(!1))},K=async(ae,J,W,ie,he,ee)=>{if(d(ae),h(!0),j(!0),x([]),T(null),!e)throw t?new Error("Authentication is still loading. Please wait a moment and try again."):new Error("No session found. Please sign in and try again.");r(s.CONTENT_GENERATION_STARTED,{content_type:ae,campaign_id:J,has_dependencies:!!ie&&Object.keys(ie).length>0,has_inputs:!!he&&Object.keys(he).length>0});const xe=pe=>{x([]);let Ce=0;return setInterval(()=>{Ce<pe.length&&(x(se=>[...se,pe[Ce]]),y(Ce),Ce++)},1500)},we=Date.now();let Se;try{Se=xe(Qht);const re=await fetch("https://worker.rainfactory.ai/rainfactory/content-functions/create-content",{method:"POST",headers:{Authorization:`Bearer ${e.access_token}`,"Content-Type":"application/json",apikey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im9sZ25uZW5jY3F3d2JhaGNwc2duIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MjQxNjUyMDksImV4cCI6MjAzOTc0MTIwOX0.qUa9W4vEYLC7LaUPczpqHA9tp8NSiWB7POqOWEvJpYQ"},body:JSON.stringify({content_type:ae,campaign_id:J,convergence_id:W,brand_id:l==null?void 0:l.id,dependencies:ie,inputs:he,platform_key:ee})});if(!re.ok){const Pe=await re.text(),Oe=new Error(Pe||"Failed to create content");throw Oe.status=re.status,Oe}const{id:se}=await re.json(),Ae=Date.now()-we;r(s.CONTENT_GENERATION_COMPLETED,{content_type:ae,campaign_id:J,content_id:se,duration_ms:Ae}),await new Promise(Pe=>setTimeout(Pe,3e3)),q(),i(`/content/${se}`)}catch(pe){const Ce=Date.now()-we;r(s.CONTENT_GENERATION_ERROR,{content_type:ae,campaign_id:J,error_message:pe instanceof Error?pe.message:String(pe),duration_ms:Ce}),console.error("Error creating content:",pe),(pe==null?void 0:pe.status)===402?T("You do not have enough credits to create this content. Please upgrade your plan or add more credits."):T("We encountered an error while creating your content. Please try again later."),h(!1),L(!0)}finally{Se&&clearInterval(Se),E||h(!1),j(!1),d(null),A(null),f(!1),x([])}},X=ae=>{const{name:J,value:W}=ae.target;I(ie=>({...ie,[J]:W}))},ne=async ae=>{ae.preventDefault(),V(!0);
1863try{if(r(s.CONTENT_TYPE_REQUESTED,{content_type_request:M.contentTypeRequest}),!(await fetch("https://worker.rainfactory.ai/marketing-functions/submit_contact",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:M.name,email:M.email,company:(l==null?void 0:l.brand_name)||"",interest:"content-type-request",message:`Content Type Request: ${M.contentTypeRequest}
1864
1865Additional Details: ${M.additionalDetails}`})})).ok)throw new Error("Failed to submit request");Q(!0),setTimeout(()=>{Q(!1),F(!1),I(ie=>({contentTypeRequest:"",name:ie.name,email:ie.email,additionalDetails:""}))},3e3)}catch(J){console.error("Error submitting content type request:",J)}finally{V(!1)}};return l?n.jsxs(n.Fragment,{children:[n.jsx(Hht,{open:u,onOpenChange:h,shownMessages:v,currentMessageIndex:b,isLoading:w}),n.jsx(Zt,{open:B,onOpenChange:L,children:n.jsxs(Jt,{className:"sm:max-w-md relative overflow-hidden bg-gradient-to-br from-red-50/90 via-orange-50/60 to-white border border-red-200/60",style:{position:"fixed",top:"50%",left:"50%",transform:"translate(-50%, -50%)",zIndex:9999},children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-red-50/30 via-transparent to-orange-50/20"}),n.jsxs("div",{className:"relative",children:[n.jsxs(tr,{className:"flex items-center gap-3 text-red-700 mb-4",children:[n.jsx("div",{className:"p-2 bg-gradient-to-br from-red-100 to-orange-200 rounded-xl shadow-sm",children:n.jsx(nr,{className:"h-6 w-6 text-red-600"})}),n.jsx("span",{className:"text-xl font-bold bg-gradient-to-r from-red-700 to-orange-700 bg-clip-text text-transparent",children:"Error Creating Content"})]}),n.jsx(Hr,{className:"text-red-600 leading-relaxed mb-6 pl-14",children:E||"An unexpected error occurred."}),n.jsx(Sn,{children:n.jsx(te,{onClick:()=>L(!1),className:"bg-gradient-to-r from-red-600 to-orange-600 hover:from-red-700 hover:to-orange-700 shadow-sm hover:shadow-md transition-all duration-300",children:"Close"})})]})]})}),n.jsx(Zt,{open:P,onOpenChange:F,children:n.jsxs(Jt,{className:"sm:max-w-md max-h-[90vh] overflow-y-auto relative bg-gradient-to-br from-purple-50/90 via-pink-50/60 to-white border border-purple-200/60",style:{position:"fixed",top:"50%",left:"50%",transform:"translate(-50%, -50%)",zIndex:9999},children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-purple-50/30 via-transparent to-pink-50/20"}),n.jsxs("div",{className:"relative",children:[n.jsx(tr,{className:"text-xl font-bold bg-gradient-to-r from-purple-700 to-pink-700 bg-clip-text text-transparent mb-2",children:"Request Content Type"}),n.jsx(Hr,{className:"text-purple-600 text-sm sm:text-base mb-6",children:"Let us know what kind of content you would like Rainfactory to generate for you."}),R?n.jsxs("div",{className:"text-center py-6 sm:py-8",children:[n.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-2xl bg-gradient-to-br from-green-100 to-emerald-200 text-green-600 mb-4 shadow-lg",children:n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-8 w-8",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),n.jsx("h3",{className:"text-xl font-bold bg-gradient-to-r from-green-700 to-emerald-700 bg-clip-text text-transparent mb-2",children:"Request Submitted!"}),n.jsx("p",{className:"text-green-600 leading-relaxed mb-4",children:"Thank you for your suggestion. Our team will review your request and consider adding this content type."})]}):n.jsxs("form",{onSubmit:ne,className:"space-y-4",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"contentTypeRequest",children:"What content type would you like to see?"}),n.jsx(Zr,{id:"contentTypeRequest",name:"contentTypeRequest",placeholder:"E.g., Social media videos, eBooks, product descriptions, etc.",value:M.contentTypeRequest,onChange:X,required:!0,className:"min-h-[80px] resize-none"})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"name",children:"Your Name"}),n.jsx(qe,{id:"name",name:"name",placeholder:"Your name",value:M.name,onChange:X,required:!0})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"email",children:"Your Email"}),n.jsx(qe,{id:"email",name:"email",type:"email",placeholder:"Your email address",value:M.email,onChange:X,required:!0})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"additionalDetails",children:"Additional Details (Optional)"}),n.jsx(Zr,{id:"additionalDetails",name:"additionalDetails",placeholder:"Any specific features or requirements for this content type?",value:M.additionalDetails,onChange:X,className:"min-h-[80px] resize-none"})]}),n.jsxs(Sn,{className:"sm:flex-row gap-2",children:[n.jsx(te,{type:"button",variant:"outline",onClick:()=>F(!1),className:"w-full sm:w-auto border-purple-200 text-purple-600 hover:bg-purple-50 hover:text-purple-700 hover:border-purple-300 transition-all duration-300",children:"Cancel"}),n.jsx(te,{type:"submit",disabled:$,className:"w-full sm:w-auto bg-gradient-to-r from-purple-600 to-pink-600 hover:from-purple-700 hover:to-pink-700 shadow-sm hover:shadow-md transition-all duration-300",children:$?"Submitting...":"Submit Request"})]})]})]})]})}),p&&n.jsx(Oht,{contentType:p,isOpen:m,onClose:()=>{f(!1),A(null)},onComplete:Y,defaultCampaignId:N,defaultConvergenceId:S}),n.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 via-white to-blue-50/30 relative overflow-hidden",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsxs("div",{className:"relative container mx-auto p-6 max-w-6xl",children:[n.jsxs("div",{className:"relative overflow-hidden bg-gradient-to-br from-white via-blue-50/30 to-indigo-50/40 rounded-2xl border border-blue-200/50 shadow-sm mb-8 p-8",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsx("div",{className:"absolute top-0 right-0 w-40 h-40 bg-gradient-to-br from-blue-200/20 to-transparent roun
1865ded-full -translate-y-20 translate-x-20"}),n.jsx("div",{className:"relative",children:n.jsx("div",{className:"flex items-start justify-between",children:n.jsxs("div",{className:"flex items-center gap-4",children:[n.jsx("div",{className:"p-3 bg-white/80 backdrop-blur-sm rounded-2xl shadow-lg",children:n.jsx(en,{className:"h-8 w-8 text-blue-600"})}),n.jsxs("div",{children:[n.jsx("h1",{className:"text-4xl font-bold bg-gradient-to-r from-blue-700 via-indigo-700 to-purple-700 bg-clip-text text-transparent mb-2",children:"Create Content"}),n.jsx("p",{className:"text-gray-600 text-lg leading-relaxed max-w-2xl",children:"Choose the type of content you'd like to create. We recommend starting with a landing page, as some content types depend on it."})]})]})})})]}),D?n.jsxs("div",{className:"relative overflow-hidden bg-gradient-to-br from-blue-50/80 via-indigo-50/60 to-white rounded-2xl border border-blue-200/60 shadow-lg",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-blue-50/30 via-transparent to-indigo-50/20"}),n.jsxs("div",{className:"relative flex flex-col justify-center items-center py-16 px-8",children:[n.jsx("div",{className:"mb-6",children:n.jsx(ov,{color:"#3B82F6",size:12,margin:4,speedMultiplier:.8})}),n.jsx("h3",{className:"text-xl font-semibold bg-gradient-to-r from-blue-700 to-indigo-700 bg-clip-text text-transparent mb-2",children:"Loading Content Types"}),n.jsx("p",{className:"text-blue-600 text-center max-w-sm",children:"Discovering available content types for your brand..."})]})]}):n.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6",children:[U.map(ae=>{const J=Lht(ae.iconName),W=c===ae.id;return n.jsxs("div",{onClick:(ae.status==="LIVE"||ae.status==="BETA")&&!t?()=>G(ae.id):void 0,className:ye("group relative overflow-hidden bg-gradient-to-br from-white/90 via-blue-50/60 to-indigo-50/40 rounded-2xl border border-blue-200/60 shadow-lg hover:shadow-2xl transition-all duration-500 transform hover:-translate-y-2 hover:scale-105 cursor-pointer p-6 min-h-[16rem]","dark:from-gray-900/90 dark:via-blue-900/60 dark:to-indigo-900/40 dark:border-blue-800/60",c&&!W?"opacity-50 pointer-events-none":"",ae.status!=="LIVE"&&ae.status!=="BETA"?"opacity-80":"",t?"opacity-50 cursor-wait":""),children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-blue-50/30 via-transparent to-indigo-50/20"}),n.jsx("div",{className:"absolute top-0 right-0 w-32 h-32 bg-gradient-to-br from-blue-200/30 to-transparent rounded-full -translate-y-16 translate-x-16"}),n.jsx("div",{className:"absolute bottom-0 left-0 w-24 h-24 bg-gradient-to-tr from-indigo-100/40 to-transparent rounded-full translate-y-12 -translate-x-12"}),n.jsxs("div",{className:"relative space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[n.jsx("div",{className:"p-3 bg-gradient-to-br from-blue-100 to-indigo-200 rounded-xl shadow-sm group-hover:from-blue-200 group-hover:to-indigo-300 transition-all duration-300",children:n.jsx(J,{className:"h-6 w-6 text-blue-600 group-hover:text-blue-700 group-hover:scale-110 transition-all duration-300"})}),n.jsxs("div",{className:"flex-1",children:[n.jsx("h3",{className:"text-xl font-bold bg-gradient-to-r from-blue-800 to-indigo-700 bg-clip-text text-transparent group-hover:from-blue-700 group-hover:to-indigo-600 transition-all duration-300",children:ae.title}),ae.status==="BETA"&&n.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-blue-100 text-blue-800 dark:bg-blue-800 dark:text-blue-100 mt-1",children:"BETA"})]})]}),n.jsx("p",{className:"text-blue-700 group-hover:text-blue-800 transition-colors duration-300 leading-relaxed flex-grow",children:ae.description}),n.jsx("div",{className:"mt-auto",children:n.jsxs(te,{variant:ae.status==="LIVE"||ae.status==="BETA"?"default":"outline",className:"w-full justify-between items-center text-sm bg-gradient-to-r from-blue-600 to-indigo-600 hover:from-blue-700 hover:to-indigo-700 shadow-sm hover:shadow-md transition-all duration-300",disabled:t,children:[t?"Loading...":ae.status==="LIVE"||ae.status==="BETA"?"Create Now":ae.status==="COMING_SOON"?"Coming Soon":"Upgrade Required",n.jsx(io,{className:"h-4 w-4 ml-1 group-hover:translate-x-1 transition-transform duration-300"})]})})]})]},ae.id)}),n.jsxs("div",{onClick:t?void 0:()=>F(!0),className:ye("group relative overflow-hidden bg-gradient-to-br from-purple-50/90 via-pink-50/60 to-indigo-50/40 rounded-2xl border border-purple-200/60 shadow-lg hover:shadow-2xl transition-all duration-500 transform hover:-translate-y-2 hover:scale-105 cursor-pointer p-6 min-h-[16rem]","dark:from-purple-900/90 dark:via-pink-900/60 dark:to-indigo-900/40 dark:border-purple-800/60",t?"opacity-50 cursor-wait":""),children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-purple-50/30 via-trans
1865parent to-pink-50/20"}),n.jsx("div",{className:"absolute top-0 right-0 w-32 h-32 bg-gradient-to-br from-purple-200/30 to-transparent rounded-full -translate-y-16 translate-x-16"}),n.jsx("div",{className:"absolute bottom-0 left-0 w-24 h-24 bg-gradient-to-tr from-pink-100/40 to-transparent rounded-full translate-y-12 -translate-x-12"}),n.jsxs("div",{className:"relative space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[n.jsx("div",{className:"p-3 bg-gradient-to-br from-purple-100 to-pink-200 rounded-xl shadow-sm group-hover:from-purple-200 group-hover:to-pink-300 transition-all duration-300",children:n.jsx(La,{className:"h-6 w-6 text-purple-600 group-hover:text-purple-700 group-hover:scale-110 transition-all duration-300"})}),n.jsx("div",{className:"flex-1",children:n.jsx("h3",{className:"text-xl font-bold bg-gradient-to-r from-purple-800 to-pink-700 bg-clip-text text-transparent group-hover:from-purple-700 group-hover:to-pink-600 transition-all duration-300",children:"Request Content Type"})})]}),n.jsx("p",{className:"text-purple-700 group-hover:text-purple-800 transition-colors duration-300 leading-relaxed flex-grow",children:"Don't see what you need? Request a new content type and we'll consider adding it to our platform."}),n.jsx("div",{className:"mt-auto",children:n.jsxs(te,{className:"w-full justify-between items-center text-sm bg-gradient-to-r from-purple-600 to-pink-600 hover:from-purple-700 hover:to-pink-700 shadow-sm hover:shadow-md transition-all duration-300",disabled:t,children:[t?"Loading...":"Request New",n.jsx(io,{className:"h-4 w-4 ml-1 group-hover:translate-x-1 transition-transform duration-300"})]})})]})]})]})]})]})]}):n.jsx(ep,{})}const zht={loading:!1,editMode:!1,viewMode:"preview",error:null,versionView:{isViewingVersion:!1,versionNumber:void 0},newVersionNumber:void 0,isVersionHistoryOpen:!1,isDataModalOpen:!1,isEditModalOpen:!1,isPublishHelpOpen:!1,platformConnected:!1,isCheckingConnection:!1,shouldFocusChat:!1};function Vht(e,t){switch(t.type){case"SET_LOADING":return{...e,loading:t.payload};case"SET_ERROR":return{...e,error:t.payload};case"TOGGLE_EDIT_MODE":return{...e,editMode:!e.editMode};case"SET_EDIT_MODE":return{...e,editMode:t.payload};case"TOGGLE_VIEW_MODE":return{...e,viewMode:e.viewMode==="preview"?"improve":"preview",shouldFocusChat:e.viewMode==="preview"};case"SET_VIEW_MODE":return{...e,viewMode:t.payload};case"VIEW_VERSION":return{...e,versionView:{isViewingVersion:!0,versionNumber:t.payload}};case"RESET_VERSION_VIEW":return{...e,versionView:{isViewingVersion:!1,versionNumber:void 0}};case"SET_NEW_VERSION":return{...e,newVersionNumber:t.payload};case"TOGGLE_VERSION_HISTORY":return{...e,isVersionHistoryOpen:!e.isVersionHistoryOpen};case"TOGGLE_DATA_MODAL":return{...e,isDataModalOpen:!e.isDataModalOpen};case"TOGGLE_EDIT_MODAL":return{...e,isEditModalOpen:!e.isEditModalOpen};case"TOGGLE_PUBLISH_HELP":return{...e,isPublishHelpOpen:!e.isPublishHelpOpen};case"SET_PLATFORM_CONNECTED":return{...e,platformConnected:t.payload};case"SET_CHECKING_CONNECTION":return{...e,isCheckingConnection:t.payload};case"SET_SHOULD_FOCUS_CHAT":return{...e,shouldFocusChat:t.payload};default:return e}}function Ght({content:e}){return n.jsx("div",{className:"space-y-4 flex-1",children:n.jsxs("div",{className:"space-y-3",children:[n.jsx("h1",{className:"text-4xl font-bold bg-gradient-to-r from-blue-700 via-indigo-700 to-purple-700 bg-clip-text text-transparent",children:e.name}),n.jsxs("div",{className:"relative",children:[n.jsx("p",{className:"text-gray-600 text-lg leading-relaxed",children:"Preview the content, improve it, and get it in a shareable format here."}),n.jsx("div",{className:"absolute -bottom-1 left-0 w-24 h-0.5 bg-gradient-to-r from-blue-500 to-purple-600 opacity-60"})]})]})})}const HP={};function qht(e){HP[e.id]&&console.warn(`Content type with ID "${e.id}" is already registered. Overwriting...`),HP[e.id]=e}function Rie(e){return HP[e]}const Kht=({content:e})=>n.jsxs("div",{className:"w-full h-full overflow-auto",children:[n.jsxs(Ar,{className:"mb-4",children:[n.jsx(nr,{className:"h-4 w-4"}),n.jsx(Wa,{children:"No Specific Renderer Available"}),n.jsx(gr,{children:"This content type does not have a specialized renderer. Displaying raw content."})]}),n.jsxs(Te,{children:[n.jsx(st,{children:n.jsx(ot,{children:e.name})}),n.jsx(Re,{children:n.jsx("pre",{className:"text-sm whitespace-pre-wrap bg-muted p-4 rounded-md overflow-auto",children:JSON.stringify(e.content_json,null,2)})})]})]});function Uie({content:e,versionNumber:t}){const[r,s]=g.useState(e),[a,i]=g.useState(!1),[o,l]=g.useState(null),[c,d]=g.useState(null),u=g.useCallback(async(f,p)=>{try{i(!0),l(null);const{data:A,error:v}=await de.from("content_versions").select("content_json, name").eq("content_id",f).eq("version_number",p).single();if(v)throw new Error(`Error fetching version: ${v.message}`);if(!A)throw new Error(`Version ${p} not found`);s({...e,content_json:A.content_json,name:A.name,version_number:p}),d(p)}catch(A){console.error("Error fetching content version:",A),l(A instanceof Error?A:new Error(String(A)))}finally{i(!1)}},[e]),h=g.useCallback(async()=>{try{i(!0),l(null);const{data:f,error:p}=await de.from("contents").select("current_version").eq("id",e.id).single();if(p)throw new Error(`Error fetching content: ${p.message}`);if(!f)throw new Error("Content not found");const A=f.current_version;A!==e.current_version?await u(e.id,A):(s({...e,version_number:A}),d(A))}catch(f){console.error("Error fetching latest content version:",f),l(f instanceof Error?f:new Error(String(f))),s(e)}finally{i(!1)}},[e,u]),m=g.useCallback(()=>{t?u(e.id,t):h()},[e.id,t,u,h]);return g.useEffect(()=>{if(!t){s(e),e.current_version!==c&&h();return}t!==c&&u(e.id,t)},[e,t,c,u,h]),{versionedContent:r,isLoading:a,error:o,refreshVersion:m}}const nL=({content:e,versionNumber:t,showControls:r=!0})=>{if(!e)return n.jsx("div",{children:"No content available"});const{versionedContent:s,isLoading:a,error:i,refreshVersion:o}=Uie({content:e,versionNumber:t});if(g.useEffect(()=>{o()},[e.current_version,o]),a)return n.jsxs("div",{className:"p-6 h-full",children:[n.jsx(Lt,{className:"h-12 w-3/4 mb-4"}),n.jsx(Lt,{className:"h-6 w-1/2 mb-2"}),n.jsx(Lt,{className:"h-32 w-full mb-6"}),n.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[n.jsx(Lt,{className:"h-24 w-full"}),n.jsx(Lt,{className:"h-24 w-full"})]})]});if(i)return n.jsx("div",{className:"p-6",children:n.jsxs(Ar,{variant:"destructive",children:[n.jsx(nr,{className:"h-4 w-4"}),n.jsx(Wa,{children:"Error Loading Content"}),n.jsx(gr,{children:i.message})]})});const l=Rie(e.content_type);if(l!=null&&l.renderer&&s){const c=l.renderer;return n.jsx(c,{content:s,versionNumber:t,showControls:r})}return n.jsx(Kht,{content:e,versionNumber:t,showControls:r})},Wht=({content:e,onSaved:t,onCancel:r,onUnsavedChanges:s})=>{const{toast:a}=sn(),i=async(c,d=!0)=>{try{const{error:u}=await de.rpc("create_content_version",{p_content_id:e.id,p_content_json:c.content_json,p_name:c.name||e.name,p_change_summary:"Edited via UI",p_status:"READY",p_metadata:{}});if(u)throw u;a({title:"Content saved",description:"Your changes have been saved as a new version."}),d&&t&&t()}catch(u){console.error("Error saving content:",u),a({title:"Error saving content",description:u.message||"An unexpected error occurred.",variant:"destructive"})}},o=()=>{r&&r()};if(!e)return n.jsx("div",{children:"No content available"});const l=Rie(e.content_type);if(l&&l.editor){const c=l.editor;return n.jsx(c,{content:e,onSave:i,onCancel:o,onUnsavedChanges:s})}return n.jsxs("div",{className:"w-full h-full overflow-auto p-6",children:[n.jsxs(Ar,{className:"mb-4",children:[n.jsx(nr,{className:"h-4 w-4"}),n.jsx(Wa,{children:"No Editor Available"}),n.jsxs(gr,{children:['No editor is available for the content type "',e.content_type,'". Please implement an editor for this content type.']})]}),n.jsx("pre",{className:"mt-4 p-4 bg-gray-100 dark:bg-gray-800 rounded-md overflow-auto",children:JSON.stringify(e,null,2)})]})},Yht=({content:e})=>{const t=e.content_json,{platform:r}=t,s=Fie(t),a=Lie(s),i=t.posts||(t.text?[{text:t.text,hashtags:t.hashtags,media:t.media}]:[]),o=h=>({single:"Tweet",thread:"Thread",single_image:"Post",carousel:"C
1865arousel",reel:"Reel",story:"Story",video:"Video",live:"Live",photo:"Photo",link:"Link",text:"Text Post",event:"Event",document:"Document",poll:"Poll",newsletter:"Newsletter",image:"Image",article:"Article"})[h]||h.charAt(0).toUpperCase()+h.slice(1),l=h=>{if(!h)return!1;const m=[".mp4",".mov",".avi",".webm",".mkv",".flv",".wmv",".m4v",".ogv"],f=h.toLowerCase().split(".").pop();return m.includes(`.${f}`)},c=(h,m=[])=>{if(!m||m.length===0)return h;const f=m.map(p=>p.startsWith("#")?p:`#${p}`);return h.split(" ").map((p,A)=>f.includes(p)||f.includes(`#${p}`)?n.jsxs("span",{className:"text-blue-500 dark:text-blue-400 font-medium",children:[p," "]},A):`${p} `)},d=()=>{switch(r==null?void 0:r.toLowerCase()){case"twitter":case"x":return"bg-gray-100 dark:bg-gray-800 rounded-xl";case"facebook":return"bg-blue-50 dark:bg-blue-950 rounded-md";case"instagram":return"bg-gradient-to-br from-purple-100 to-pink-100 dark:from-purple-900 dark:to-pink-900 rounded-md";case"linkedin":return"bg-blue-50 dark:bg-blue-950 rounded-md";default:return"bg-gray-100 dark:bg-gray-800 rounded-md"}},u=()=>new Date().toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"});return n.jsx("div",{className:"max-w-2xl mx-auto p-4",children:i.length===0?n.jsx("div",{className:"text-center text-gray-500 dark:text-gray-400 py-8",children:"No content available"}):n.jsxs("div",{className:"space-y-4",children:[a&&i.length>1&&n.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[n.jsx(Be,{variant:"secondary",className:"text-sm",children:o(s)}),n.jsxs("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:[i.length," posts"]})]}),i.map((h,m)=>{var f;return n.jsx(Te,{className:`overflow-hidden ${d()}`,children:n.jsxs(Re,{className:"p-6",children:[n.jsx("div",{className:"flex items-center mb-4",children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("div",{className:"h-8 w-8 bg-gradient-to-br from-gray-200 to-gray-300 dark:from-gray-700 dark:to-gray-600 rounded-full"}),n.jsxs("div",{children:[n.jsx("p",{className:"font-medium",children:e.name.split(":")[0]||"Social Post"}),n.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:[r||"Social Post"," · ",u(),a&&i.length>1&&` · ${m+1}/${i.length}`]})]})]})}),n.jsx("div",{className:"mb-4 whitespace-pre-wrap text-gray-800 dark:text-gray-200",children:c(h.text||"",h.hashtags||[])}),(h.media&&h.media.length>0||h.image_url)&&n.jsx("div",{className:"mt-4 overflow-hidden rounded-md",children:(()=>{const p=h.image_url||h.media&&h.media[0];return p&&l(p)?n.jsx("video",{src:p,className:"w-full h-auto object-cover",controls:!0,autoPlay:!0,muted:!0,playsInline:!0,loop:!0,preload:"metadata",children:"Your browser does not support the video tag."}):p?n.jsx("img",{src:p,alt:"Post media",className:"w-full h-auto object-cover"}):null})()}),h.calls_to_action&&h.calls_to_action.length>0&&n.jsx("div",{className:"mt-4 text-sm text-blue-600 dark:text-blue-400 font-medium",children:h.calls_to_action[0]}),h.hashtags&&h.hashtags.length>0&&!((f=h.text)!=null&&f.includes("#"))&&n.jsx("div",{className:"mt-4 text-sm",children:h.hashtags.map((p,A)=>n.jsx("span",{className:"inline-block mr-2 text-blue-500 dark:text-blue-400 font-medium",children:p.startsWith("#")?p:`#${p}`},A))})]})},m)})]})})},Jht=({content:e,versionNumber:t})=>{const{versionedContent:r,refreshVersion:s}=Uie({content:e,versionNumber:t});g.useEffect(()=>{s()},[e.current_version,s]);const a=r||e,i=a.content_json,o=a.brand_id,{brand:l}=_0(o),c=l==null?void 0:l.brand_name,{headline:d,byline:u,benefits:h=[],testimonials:m=[],faq:f=[],primary_cta:p,secondary_cta:A,closing_statement:v}=i;i.brand_name=c;const x=b=>{switch(b.toLowerCase()){case"compass":return n.jsx(UR,{className:"h-6 w-6"});case"camera":return n.jsx(xK,{className:"h-6 w-6"});case"map":return n.jsx(Rxe,{className:"h-6 w-6"});case"message":return n.jsx(Cc,{className:"h-6 w-6"});case"user":return n.jsx(li,{className:"h-6 w-6"});case"mail":return n.jsx(Cu,{className:"h-6 w-6"});case"globe":return n.jsx(Is,{className:"h-6 w-6"});
1865case"instagram":return n.jsx(Vh,{className:"h-6 w-6"});default:return n.jsx(UR,{className:"h-6 w-6"})}};return n.jsx(QS,{brandId:e.brand_id,contentType:"landing-page",children:n.jsxs("div",{className:"landing-page w-full overflow-auto bg-white dark:bg-gray-900",children:[n.jsx("header",{className:"bg-white dark:bg-gray-900 shadow-sm sticky top-0 z-10",children:n.jsxs("div",{className:"max-w-6xl mx-auto px-4 py-4 flex justify-between items-center",children:[n.jsx("div",{className:"flex items-center",children:n.jsx("span",{className:"text-xl font-bold text-gray-900 dark:text-white",children:c})}),n.jsxs("nav",{className:"hidden md:flex space-x-6",children:[n.jsx("a",{href:"#",className:"text-gray-600 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white",children:"Home"}),n.jsx("a",{href:"#",className:"text-gray-600 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white",children:"Features"}),n.jsx("a",{href:"#",className:"text-gray-600 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white",children:"Testimonials"}),n.jsx("a",{href:"#",className:"text-gray-600 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white",children:"Contact"})]}),n.jsx("button",{style:{backgroundColor:"var(--brand-primary, #3b82f6)",color:"white",borderRadius:"var(--border-radius-md, var(--brand-radius-md, 0.25rem))"},className:"px-4 py-2 hover:opacity-90 transition-colors",children:"Sign Up"})]})}),n.jsxs("main",{children:[n.jsx("section",{style:{background:"linear-gradient(to bottom right, var(--brand-primary, #3b82f6), var(--brand-secondary, #10b981))",fontFamily:"var(--font-body, var(--brand-font-primary, inherit))"},className:"py-16 px-6 text-white",children:n.jsxs("div",{className:"max-w-5xl mx-auto flex flex-col md:flex-row items-center md:items-stretch text-center md:text-left gap-8",children:[n.jsxs("div",{className:"flex-1 flex flex-col justify-center items-center md:pr-8 text-center",children:[n.jsx("h1",{style:{fontFamily:"var(--font-heading, var(--brand-font-heading, var(--brand-font-primary, inherit)))"},className:"text-4xl md:text-5xl font-bold mb-6 w-full",children:d}),n.jsx("p",{className:"text-xl mb-8 max-w-3xl mx-auto md:mx-0 w-full",children:u}),p&&n.jsx("a",{href:p.url||"#",style:{backgroundColor:"white",color:"var(--brand-primary, #3b82f6)",borderRadius:"var(--border-radius-full, var(--brand-radius-full, 9999px))",fontFamily:"var(--font-body, var(--brand-font-primary, inherit))",maxWidth:340,width:"100%",marginTop:"2rem",display:"block"},className:"px-8 py-3 font-medium hover:bg-gray-100 transition-colors mx-auto",children:p.text})]}),i.hero_image_url&&n.jsx("div",{className:"flex-1 flex justify-center items-center mb-8 md:mb-0",children:n.jsx("img",{src:i.hero_image_url,alt:c||d||"Hero image",className:"mx-auto rounded-lg shadow-lg max-h-80 object-contain bg-white dark:bg-gray-800",style:{maxWidth:"100%",background:"rgba(255,255,255,0.7)"}})})]})}),h.length>0&&n.jsx("section",{className:"py-16 px-6 bg-white dark:bg-gray-900",children:n.jsxs("div",{className:"max-w-5xl mx-auto",children:[n.jsx("h2",{style:{fontFamily:"var(--font-heading, var(--brand-font-heading, var(--brand-font-primary, inherit)))"},className:"text-3xl font-bold text-center mb-12 text-gray-900 dark:text-white",children:"Why Choose Us"}),n.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-8",children:h.map((b,y)=>n.jsxs("div",{style:{backgroundColor:"var(--bg-light-alt, #F5F7FA)",borderRadius:"var(--border-radius-lg, var(--brand-radius-lg, 0.5rem))",fontFamily:"var(--font-body, var(--brand-font-primary, inherit))",padding:"var(--spacing-md, var(--brand-spacing-md, 1rem))"},className:"dark:bg-gray-800",children:[n.jsx("div",{style:{backgroundColor:"color-mix(in srgb, var(--brand-primary, #3b82f6) 10%, white)",color:"var(--brand-primary, #3b82f6)",borderRadius:"var(--border-radius-full, var(--brand-radius-full, 9999px))"},className:"w-12 h-12 flex items-center justify-center mb-4 dark:bg-blue-900 dark:text-blue-300",children:x(b.icon)}),n.jsx("h3",{style:{color:"var(--text-primary-light, #212121)",fontFamily:"var(--font-heading, var(--brand-font-heading, var(--brand-font-primary, inherit)))"},className:"text-xl font-semibold mb-2 dark:text-white",children:b.title}),n.jsx("p",{style:{color:"var(--text-secondary-light, #757575)"},className:"dark:text-gray-300",children:b.description})]},y))})]})}),m.length>0&&n.jsx("section",{className:"py-16 px-6 bg-gray-50 dark:bg-gray-800",children:n.jsxs("div",{className:"max-w-5xl mx-auto",children:[n.jsx("h2",{className:"text-3xl font-bold text-center mb-12 text-gray-900 dark:text-white",children:"What Our Customers Say"}),n.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8",children:m.map((b,y)=>n.jsxs("div",{className:"p-6 bg-white dark:bg-gray-900 rounded-lg shadow-sm",children:[n.jsxs("p",{className:"text-gray-600 dark:text-gray-300 italic mb-4",children:['"',b.quote,'"']}),n.jsxs("div",{className:"flex items-center",children:[n.jsx("div",{className:"w-10 h-10 bg-gray-200 dark:bg-gray-700 rounded-full mr-3 flex items-center justify-center",children:n.jsx(li,{className:"h-5 w-5 text-gray-500 dark:text-gray-400"})}),n.jsxs("div",{children:[n.jsx("h4",{className:"font-semibold text-gray-900 dark:text-white",children:b.author}),n.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:b.role})]})]})]},y))})]})}),f.length>0&&n.jsx("section",{className:"py-16 px-6 bg-white dark:bg-gray-900",children:n.jsxs("div",{className:"max-w-4xl mx-auto",children:[n.jsx("h2",{className:"text-3xl font-bold text-center mb-12 text-gray-900 dark:text-white",children:"Frequently Asked Questions"}),n.jsx("div",{className:"space-y-6",children:f.map((b,y)=>n.jsx(Te,{className:"border-gray-200 dark:border-gray-700",children:n.jsxs(Re,{className:"pt-6",children:[n.jsx("h3",{className:"text-xl font-semibold mb-3 text-gray-900 dark:text-white",children:b.question}),n.jsx("p",{className:"text-gray-600 dark:text-gray-300",children:b.answer})]})},y))})]})}),n.jsx("section",{style:{backgroundColor:"var(--brand-primary, #3b82f6)",fontFamily:"var(--font-body, var(--brand-font-primary, inherit))",padding:"var(--spacing-xl, var(--brand-spacing-xl, 2rem)) var(--spacing-md, var(--brand-spacing-md, 1rem))"},className:"text-white",children:n.jsxs("div",{className:"max-w-4xl mx-auto text-center",children:[n.jsx("h2",{style:{fontFamily:"var(--font-heading, var(--brand-font-heading, var(--brand-font-primary, inherit)))"},className:"text-3xl font-bold mb-6",children:"Ready to Begin Your Adventure?"}),n.jsx("p",{className:"text-xl mb-8",children:v}),n.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center",children:[p&&n.jsx("a",{href:p.url,style:{backgroundColor:"white",color:"var(--brand-primary, #3b82f6)",borderRadius:"var(--border-radius-full, var(--brand-radius-full, 9999px))",fontFamily:"var(--font-body, var(--brand-font-primary, inherit))"},className:"inline-block px-8 py-3 font-medium hover:bg-gray-100 transition-colors",children:p.text}),A&&n.jsx("a",{href:A.url,style:{backgroundColor:"var(--brand-accent, #f97316)",borderRadius:"var(--border-radius-full, var(--brand-radius-full, 9999px))",fontFamily:"var(--font-body, var(--brand-font-primary, inherit))"},className:"inline-block px-8 py-3 text-white font-medium border border-white hover:opacity-90 transition-colors",children:A.text})]})]})})]}),n.jsx("footer",{style:{fontFamily:"var(--font-body, var(--brand-font-primary, inherit))"},className:"bg-gray-900 text-white py-12 px-6",children:n.jsxs("div",{className:"max-w-6xl mx-auto",children:[n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-8",children:[n.jsxs("div",{children:[n.jsx("h3",{style:{fontFamily:"var(--font-heading, var(--brand-font-heading, var(--brand-font-primary, inherit)))"},className:"text-lg font-semibold mb-4",children:a.name}),n.jsx("p",{className:"text-gray-400",children:"Beautiful landing page built with Rainfactory"})]}),n.jsxs("div",{children:[n.jsx("h4",{style:{fontFamily:"var(--font-heading, var(--brand-font-heading, var(--brand-font-primary, inherit)))"},className:"text-md font-medium mb-4",children:"Product"}),n.jsxs("ul",{className:"space-y-2 text-gray-400",children:[n.jsx("li",{children:n.jsx("a",{href:"#",className:"hover:text-white transition-colors",children:"Features"})}),n.jsx("li",{children:n.jsx("a",{href:"#",className:"hover:text-white transition-colors",children:"Pricing"})}),n.jsx("li",{children:n.jsx("a",{href:"#",className:"hover:text-white transition-colors",children:"Testimonials"})})]})]}),n.jsxs("div",{children:[n.jsx("h4",{style:{fontFamily:"var(--font-heading, var(--brand-font-heading, var(--brand-font-primary, inherit)))"},className:"text-md font-medium mb-4",children:"Resources"}),n.jsxs("ul",{className:"space-y-2 text-gray-400",children:[n.jsx("li",{children:n.jsx("a",{href:"#",className:"hover:text-white transition-colors",children:"Documentation"})}),n.jsx("li",{children:n.jsx("a",{href:"#",className:"hover:text-white transition-colors",children:"Blog"})}),n.jsx("li",{children:n.jsx("a",{href:"#",className:"hover:text-white transition-colors",children:"Support"})})]})]}),n.jsxs("div",{children:[n.jsx("h4",{style:{fontFamily:"var(--font-heading, var(--brand-font-heading, var(--brand-font-primary, inherit)))"},className:"text-md font-medium mb-4",children:"Company"}),n.jsxs("ul",{className:"space-y-2 text-gray-400",children:[n.jsx("li",{children:n.jsx("a",{href:"#",className:"hover:text-white transition-colors",children:"About"})}),n.jsx("li",{children:n.jsx("a",{href:"#",className:"hover:text-white transition-colors",children:"Careers"})}),n.jsx("li",{children:n.jsx("a",{href:"#",className:"hover:text-white transition-colors",children:"Contact"})})]})]})]}),n.jsx("div",{className:"border-t border-gray-800 mt-12 pt-8 text-center text-gray-400",children:n.jsxs("p",{children:["© ",new Date().getFullYear()," ",a.name,". All rights reserved."]})})]})})]})})};var Xht=e=>{switch(e){case"success":return tft;case"info":return nft;case"warning":return rft;case"error":return sft;default:return null}},Zht=Array(12).fill(0),eft=({visible:e,className:t})=>oe.createElement("div",{className:["sonner-loading-wrapper",t].filter(
1865Boolean).join(" "),"data-visible":e},oe.createElement("div",{className:"sonner-spinner"},Zht.map((r,s)=>oe.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${s}`})))),tft=oe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},oe.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),rft=oe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},oe.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),nft=oe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},oe.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),sft=oe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},oe.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),aft=oe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},oe.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),oe.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),ift=()=>{let[e,t]=oe.useState(document.hidden);return oe.useEffect(()=>{let r=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),e},zP=1,oft=class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var t;let{message:r,...s}=e,a=typeof(e==null?void 0:e.id)=="number"||((t=e.id)==null?void 0:t.length)>0?e.id:zP++,i=this.toasts.find(l=>l.id===a),o=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(a)&&this.dismissedToasts.delete(a),i?this.toasts=this.toasts.map(l=>l.id===a?(this.publish({...l,...e,id:a,title:r}),{...l,...e,id:a,dismissible:o,title:r}):l):this.addToast({title:r,...s,dismissible:o,id:a}),a},this.dismiss=e=>(this.dismissedToasts.add(e),e||this.toasts.forEach(t=>{this.subscribers.forEach(r=>r({id:t.id,dismiss:!0}))}),this.subscribers.forEach(t=>t({id:e,dismiss:!0})),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:"error"}),this.success=(e,t)=>this.create({...t,type:"success",message:e}),this.info=(e,t)=>this.create({...t,type:"info",message:e}),this.warning=(e,t)=>this.create({...t,type:"warning",message:e}),this.loading=(e,t)=>
1865this.create({...t,type:"loading",message:e}),this.promise=(e,t)=>{if(!t)return;let r;t.loading!==void 0&&(r=this.create({...t,promise:e,type:"loading",message:t.loading,description:typeof t.description!="function"?t.description:void 0}));let s=e instanceof Promise?e:e(),a=r!==void 0,i,o=s.then(async c=>{if(i=["resolve",c],oe.isValidElement(c))a=!1,this.create({id:r,type:"default",message:c});else if(cft(c)&&!c.ok){a=!1;let d=typeof t.error=="function"?await t.error(`HTTP error! status: ${c.status}`):t.error,u=typeof t.description=="function"?await t.description(`HTTP error! status: ${c.status}`):t.description;this.create({id:r,type:"error",message:d,description:u})}else if(t.success!==void 0){a=!1;let d=typeof t.success=="function"?await t.success(c):t.success,u=typeof t.description=="function"?await t.description(c):t.description;this.create({id:r,type:"success",message:d,description:u})}}).catch(async c=>{if(i=["reject",c],t.error!==void 0){a=!1;let d=typeof t.error=="function"?await t.error(c):t.error,u=typeof t.description=="function"?await t.description(c):t.description;this.create({id:r,type:"error",message:d,description:u})}}).finally(()=>{var c;a&&(this.dismiss(r),r=void 0),(c=t.finally)==null||c.call(t)}),l=()=>new Promise((c,d)=>o.then(()=>i[0]==="reject"?d(i[1]):c(i[1])).catch(d));return typeof r!="string"&&typeof r!="number"?{unwrap:l}:Object.assign(r,{unwrap:l})},this.custom=(e,t)=>{let r=(t==null?void 0:t.id)||zP++;return this.create({jsx:e(r),id:r,...t}),r},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},eo=new oft,lft=(e,t)=>{let r=(t==null?void 0:t.id)||zP++;return eo.addToast({title:e,...t,id:r}),r},cft=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",dft=lft,uft=()=>eo.toasts,hft=()=>eo.getActiveToasts(),VP=Object.assign(dft,{success:eo.success,info:eo.info,warning:eo.warning,error:eo.error,custom:eo.custom,message:eo.message,promise:eo.promise,dismiss:eo.dismiss,loading:eo.loading},{getHistory:uft,getToasts:hft});function fft(e,{insertAt:t}={}){if(typeof document>"u")return;let r=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css",t==="top"&&r.firstChild?r.insertBefore(s,r.firstChild):r.appendChild(s),s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e))}fft(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-bottom)}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;
1865left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:-50%;right:-50%;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}
1865:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y, 0px)) translate(var(--swipe-amount-x, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-bg-hover: hsl(0, 0%, 12%);--normal-border: hsl(0, 0%, 20%);--normal-border-hover: hsl(0, 0%, 25%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);
1865--error-text: hsl(358, 100%, 81%)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}
1866`);function oj(e){return e.label!==void 0}var mft=3,pft="32px",Aft="16px",rV=4e3,gft=356,xft=14,vft=20,bft=200;function ac(...e){return e.filter(Boolean).join(" ")}function yft(e){let[t,r]=e.split("-"),s=[];return t&&s.push(t),r&&s.push(r),s}var wft=e=>{var t,r,s,a,i,o,l,c,d,u,h;let{invert:m,toast:f,unstyled:p,interacting:A,setHeights:v,visibleToasts:x,heights:b,index:y,toasts:w,expanded:j,removeToast:N,defaultRichColors:_,closeButton:S,style:C,cancelButtonStyle:E,actionButtonStyle:T,className:B="",descriptionClassName:L="",duration:P,position:F,gap:M,loadingIcon:I,expandByDefault:$,classNames:V,icons:R,closeButtonAriaLabel:Q="Close toast",pauseWhenPageIsHidden:U}=e,[D,q]=oe.useState(null),[G,Y]=oe.useState(null),[K,X]=oe.useState(!1),[ne,ae]=oe.useState(!1),[J,W]=oe.useState(!1),[ie,he]=oe.useState(!1),[ee,xe]=oe.useState(!1),[we,Se]=oe.useState(0),[pe,Ce]=oe.useState(0),re=oe.useRef(f.duration||P||rV),se=oe.useRef(null),Ae=oe.useRef(null),Pe=y===0,Oe=y+1<=x,be=f.type,ue=f.dismissible!==!1,Ee=f.className||"",De=f.descriptionClassName||"",Ge=oe.useMemo(()=>b.findIndex(tt=>tt.toastId===f.id)||0,[b,f.id]),Ye=oe.useMemo(()=>{var tt;return(tt=f.closeButton)!=null?tt:S},[f.closeButton,S]),Tt=oe.useMemo(()=>f.duration||P||rV,[f.duration,P]),Nt=oe.useRef(0),Pt=oe.useRef(0),_t=oe.useRef(0),zt=oe.useRef(null),[vt,vr]=F.split("-"),Rt=oe.useMemo(()=>b.reduce((tt,it,gt)=>gt>=Ge?tt:tt+it.height,0),[b,Ge]),rr=ift(),an=f.invert||m,It=be==="loading";Pt.current=oe.useMemo(()=>Ge*M+Rt,[Ge,Rt]),oe.useEffect(()=>{re.current=Tt},[Tt]),oe.useEffect(()=>{X(!0)},[]),oe.useEffect(()=>{let tt=Ae.current;if(tt){let it=tt.getBoundingClientRect().height;return Ce(it),v(gt=>[{toastId:f.id,height:it,position:f.position},...gt]),()=>v(gt=>gt.filter(pr=>pr.toastId!==f.id))}},[v,f.id]),oe.useLayoutEffect(()=>{if(!K)return;let tt=Ae.current,it=tt.style.height;tt.style.height="auto";let gt=tt.getBoundingClientRect().height;tt.style.height=it,Ce(gt),v(pr=>pr.find(xt=>xt.toastId===f.id)?pr.map(xt=>xt.toastId===f.id?{...xt,height:gt}:xt):[{toastId:f.id,height:gt,position:f.position},...pr])},[K,f.title,f.description,v,f.id]);let ht=oe.useCallback(()=>{ae(!0),Se(Pt.current),v(tt=>tt.filter(it=>it.toastId!==f.id)),setTimeout(()=>{N(f)},bft)},[f,N,v,Pt]);oe.useEffect(()=>{if(f.promise&&be==="loading"||f.duration===1/0||f.type==="loading")return;let tt;return j||A||U&&rr?(()=>{if(_t.current<Nt.current){let it=new Date().getTime()-Nt.current;re.current=re.current-it}
1866_t.current=new Date().getTime()})():re.current!==1/0&&(Nt.current=new Date().getTime(),tt=setTimeout(()=>{var it;(it=f.onAutoClose)==null||it.call(f,f),ht()},re.current)),()=>clearTimeout(tt)},[j,A,f,be,U,rr,ht]),oe.useEffect(()=>{f.delete&&ht()},[ht,f.delete]);function ar(){var tt,it,gt;return R!=null&&R.loading?oe.createElement("div",{className:ac(V==null?void 0:V.loader,(tt=f==null?void 0:f.classNames)==null?void 0:tt.loader,"sonner-loader"),"data-visible":be==="loading"},R.loading):I?oe.createElement("div",{className:ac(V==null?void 0:V.loader,(it=f==null?void 0:f.classNames)==null?void 0:it.loader,"sonner-loader"),"data-visible":be==="loading"},I):oe.createElement(eft,{className:ac(V==null?void 0:V.loader,(gt=f==null?void 0:f.classNames)==null?void 0:gt.loader),visible:be==="loading"})}return oe.createElement("li",{tabIndex:0,ref:Ae,className:ac(B,Ee,V==null?void 0:V.toast,(t=f==null?void 0:f.classNames)==null?void 0:t.toast,V==null?void 0:V.default,V==null?void 0:V[be],(r=f==null?void 0:f.classNames)==null?void 0:r[be]),"data-sonner-toast":"","data-rich-colors":(s=f.richColors)!=null?s:_,"data-styled":!(f.jsx||f.unstyled||p),"data-mounted":K,"data-promise":!!f.promise,"data-swiped":ee,"data-removed":ne,"data-visible":Oe,"data-y-position":vt,"data-x-position":vr,"data-index":y,"data-front":Pe,"data-swiping":J,"data-dismissible":ue,"data-type":be,"data-invert":an,"data-swipe-out":ie,"data-swipe-direction":G,"data-expanded":!!(j||$&&K),style:{"--index":y,"--toasts-before":y,"--z-index":w.length-y,"--offset":`${ne?we:Pt.current}px`,"--initial-height":$?"auto":`${pe}px`,...C,...f.style},onDragEnd:()=>{W(!1),q(null),zt.current=null},onPointerDown:tt=>{It||!ue||(se.current=new Date,Se(Pt.current),tt.target.setPointerCapture(tt.pointerId),tt.target.tagName!=="BUTTON"&&(W(!0),zt.current={x:tt.clientX,y:tt.clientY}))},onPointerUp:()=>{var tt,it,gt,pr;if(ie||!ue)return;zt.current=null;let xt=Number(((tt=Ae.current)==null?void 0:tt.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Lr=Number(((it=Ae.current)==null?void 0:it.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),En=new Date().getTime()-((gt=se.current)==null?void 0:gt.getTime()),qr=D==="x"?xt:Lr,pn=Math.abs(qr)/En;if(Math.abs(qr)>=vft||pn>.11){Se(Pt.current),(pr=f.onDismiss)==null||pr.call(f,f),Y(D==="x"?xt>0?"right":"left":Lr>0?"down":"up"),ht(),he(!0),xe(!1);return}W(!1),q(null)},onPointerMove:tt=>{var it,gt,pr,xt;if(!zt.current||!ue||((it=window.getSelection())==null?void 0:it.toString().length)>0)return;let Lr=tt.clientY-zt.current.y,En=tt.clientX-zt.current.x,qr=(gt=e.swipeDirections)!=null?gt:yft(F);!D&&(Math.abs(En)>1||Math.abs(Lr)>1)&&q(Math.abs(En)>Math.abs(Lr)?"x":"y");let pn={x:0,y:0};D==="y"?(qr.includes("top")||qr.includes("bottom"))&&(qr.includes("top")&&Lr<0||qr.includes("bottom")&&Lr>0)&&(pn.y=Lr):D==="x"&&(qr.includes("left")||qr.includes("right"))&&(qr.includes("left")&&En<0||qr.includes("right")&&En>0)&&(pn.x=En),(Math.abs(pn.x)>0||Math.abs(pn.y)>0)&&xe(!0),(pr=Ae.current)==null||pr.style.setProperty("--swipe-amount-x",`${pn.x}px`),(xt=Ae.current)==null||xt.style.setProperty("--swipe-amount-y",`${pn.y}px`)}},Ye&&!f.jsx?oe.createElement("button",{"aria-label":Q,"data-disabled":It,"data-close-button":!0,onClick:It||!ue?(
1866)=>{}:()=>{var tt;ht(),(tt=f.onDismiss)==null||tt.call(f,f)},className:ac(V==null?void 0:V.closeButton,(a=f==null?void 0:f.classNames)==null?void 0:a.closeButton)},(i=R==null?void 0:R.close)!=null?i:aft):null,f.jsx||g.isValidElement(f.title)?f.jsx?f.jsx:typeof f.title=="function"?f.title():f.title:oe.createElement(oe.Fragment,null,be||f.icon||f.promise?oe.createElement("div",{"data-icon":"",className:ac(V==null?void 0:V.icon,(o=f==null?void 0:f.classNames)==null?void 0:o.icon)},f.promise||f.type==="loading"&&!f.icon?f.icon||ar():null,f.type!=="loading"?f.icon||(R==null?void 0:R[be])||Xht(be):null):null,oe.createElement("div",{"data-content":"",className:ac(V==null?void 0:V.content,(l=f==null?void 0:f.classNames)==null?void 0:l.content)},oe.createElement("div",{"data-title":"",className:ac(V==null?void 0:V.title,(c=f==null?void 0:f.classNames)==null?void 0:c.title)},typeof f.title=="function"?f.title():f.title),f.description?oe.createElement("div",{"data-description":"",className:ac(L,De,V==null?void 0:V.description,(d=f==null?void 0:f.classNames)==null?void 0:d.description)},typeof f.description=="function"?f.description():f.description):null),g.isValidElement(f.cancel)?f.cancel:f.cancel&&oj(f.cancel)?oe.createElement("button",{"data-button":!0,"data-cancel":!0,style:f.cancelButtonStyle||E,onClick:tt=>{var it,gt;oj(f.cancel)&&ue&&((gt=(it=f.cancel).onClick)==null||gt.call(it,tt),ht())},className:ac(V==null?void 0:V.cancelButton,(u=f==null?void 0:f.classNames)==null?void 0:u.cancelButton)},f.cancel.label):null,g.isValidElement(f.action)?f.action:f.action&&oj(f.action)?oe.createElement("button",{"data-button":!0,"data-action":!0,style:f.actionButtonStyle||T,onClick:tt=>{var it,gt;oj(f.action)&&((gt=(it=f.action).onClick)==null||gt.call(it,tt),!tt.defaultPrevented&&ht())},className:ac(V==null?void 0:V.actionButton,(h=f==null?void 0:f.classNames)==null?void 0:h.actionButton)},f.action.label):null))};function nV(){if(typeof window>"u"||typeof document>"u")return"ltr";let e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function jft(e,t){let r={};return[e,t].forEach((s,a)=>{let i=a===1,o=i?"--mobile-offset":"--offset",l=i?Aft:pft;function c(d){["top","right","bottom","left"].forEach(u=>{r[`${o}-${u}`]=typeof d=="number"?`${d}px`:d})}typeof s=="number"||typeof s=="string"?c(s):typeof s=="object"?["top","right","bottom","left"].forEach(d=>{s[d]===void 0?r[`${o}-${d}`]=l:r[`${o}-${d}`]=typeof s[d]=="number"?`${s[d]}px`:s[d]}):c(l)}),r}g.forwardRef(function(e,t){let{invert:r,position:s="bottom-right",hotkey:a=["altKey","KeyT"],expand:i,closeButton:o,className:l,offset:c,mobileOffset:d,theme:u="light",richColors:h,duration:m,style:f,visibleToasts:p=mft,toastOptions:A,dir:v=nV(),gap:x=xft,loadingIcon:b,icons:y,containerAriaLabel:w="Notifications",pauseWhenPageIsHidden:j}=e,[N,_]=oe.useState([]),S=oe.useMemo(()=>Array.from(new Set([s].concat(N.filter(U=>U.position).map(U=>U.position)))),[N,s]),[C,E]=oe.useState([]),[T,B]=oe.useState(!1),[L,P]=oe.useState(!1),[F,M]=oe.useState(u!=="system"?u:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),I=oe.useRef(null),$=a.join("+").replace(/Key/g,"").replace(/Digit/g,""),V=oe.useRef(null),R=oe.useRef(!1),Q=oe.useCallback(U=>{_(D=>{var q;return(q=D.find(G=>G.id===U.id))!=null&&q.delete||eo.dismiss(U.id),D.filter(({id:G})=>G!==U.id)})},[]);return oe.useEffect(()=>eo.subscribe(U=>{if(U.dismiss){_(D=>D.map(q=>q.id===U.id?{...q,delete:!0}:q));return}setTimeout(()=>{Gde.flushSync(()=>{_(D=>{let q=D.findIndex(G=>G.id===U.id);return q!==-1?[...D.slice(0,q),{...D[q],...U},...D.slice(q+1)]:[U,...D]})})})}),[]),oe.useEffect(()=>{if(u!=="system"){M(u);return}if(u==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?M("dark"):M("light")),typeof window>"u")return;let U=window.matchMedia("(prefers-color-scheme: dark)");try{U.addEventListener("change",({matches:D})=>{M(D?"dark":"light")})}catch{U.addListener(({matches:q})=>{try{M(q?"dark":"light")}catch(G){console.error(G)}})}},[u]),oe.useEffect(()=>{N.length<=1&&B(!1)},[N]),oe.useEffect(()=>{let U=D=>{var q,G;a.every(Y=>D[Y]||D.code===Y)&&(B(!0),(q=I.current)==null||q.focus()),D.code==="Escape"&&(document.activeElement===I.current||(G=I.current)!=null&&G.contains(document.activeElement))&&B(!1)};
1866return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},[a]),oe.useEffect(()=>{if(I.current)return()=>{V.current&&(V.current.focus({preventScroll:!0}),V.current=null,R.current=!1)}},[I.current]),oe.createElement("section",{ref:t,"aria-label":`${w} ${$}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},S.map((U,D)=>{var q;let[G,Y]=U.split("-");return N.length?oe.createElement("ol",{key:U,dir:v==="auto"?nV():v,tabIndex:-1,ref:I,className:l,"data-sonner-toaster":!0,"data-theme":F,"data-y-position":G,"data-lifted":T&&N.length>1&&!i,"data-x-position":Y,style:{"--front-toast-height":`${((q=C[0])==null?void 0:q.height)||0}px`,"--width":`${gft}px`,"--gap":`${x}px`,...f,...jft(c,d)},onBlur:K=>{R.current&&!K.currentTarget.contains(K.relatedTarget)&&(R.current=!1,V.current&&(V.current.focus({preventScroll:!0}),V.current=null))},onFocus:K=>{K.target instanceof HTMLElement&&K.target.dataset.dismissible==="false"||R.current||(R.current=!0,V.current=K.relatedTarget)},onMouseEnter:()=>B(!0),onMouseMove:()=>B(!0),onMouseLeave:()=>{L||B(!1)},onDragEnd:()=>B(!1),onPointerDown:K=>{K.target instanceof HTMLElement&&K.target.dataset.dismissible==="false"||P(!0)},onPointerUp:()=>P(!1)},N.filter(K=>!K.position&&D===0||K.position===U).map((K,X)=>{var ne,ae;return oe.createElement(wft,{key:K.id,icons:y,index:X,toast:K,defaultRichColors:h,duration:(ne=A==null?void 0:A.duration)!=null?ne:m,className:A==null?void 0:A.className,descriptionClassName:A==null?void 0:A.descriptionClassName,invert:r,visibleToasts:p,closeButton:(ae=A==null?void 0:A.closeButton)!=null?ae:o,interacting:L,position:U,style:A==null?void 0:A.style,unstyled:A==null?void 0:A.unstyled,classNames:A==null?void 0:A.classNames,cancelButtonStyle:A==null?void 0:A.cancelButtonStyle,actionButtonStyle:A==null?void 0:A.actionButtonStyle,removeToast:Q,toasts:N.filter(J=>J.position==K.position),heights:C.filter(J=>J.position==K.position),setHeights:E,expandByDefault:i,gap:x,loadingIcon:b,expanded:T,pauseWhenPageIsHidden:j,swipeDirections:e.swipeDirections})})):null}))});const Nft=({content:e})=>{const{name:t,platform:r="google",ads:s=[],settings:a={},targeting:i={},descriptions:o=[],short_headlines:l=[],bonus_metadata:c={}}=e.content_json||{},u=(()=>{var b,y,w,j;return(b=e.name)!=null&&b.toLowerCase().includes("instagram")?"instagram":(y=e.name)!=null&&y.toLowerCase().includes("facebook")?"facebook":(w=e.name)!=null&&w.toLowerCase().includes("google")?"google":(j=e.name)!=null&&j.toLowerCase().includes("linkedin")?"linkedin":r})(),h=async(b,y="Text")=>{try{await navigator.clipboard.writeText(b),VP.success(`${y} copied to clipboard`,{duration:2e3,position:"bottom-center"})}catch{VP.error("Failed to copy to clipboard",{duration:2e3,position:"bottom-center"})}},m=(b,y)=>{var w,j;return n.jsxs(Te,{className:"mb-4",children:[n.jsx(st,{className:"pb-3",children:n.jsxs("div",{className:"flex justify-between items-center",children:[n.jsxs("h4",{className:"text-sm font-medium",children:["Responsive Search Ad ",y+1]}),n.jsx(Be,{variant:"outline",children:"Google Ads"})]})}),n.jsxs(Re,{className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"Headlines"}),n.jsx("div",{className:"space-y-1",children:((w=b.headlines)==null?void 0:w.map((N,_)=>n.jsxs("div",{className:"text-sm cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-800 rounded px-2 py-1 transition-colors group flex items-center",onClick:()=>h(N.text,"Headline"),title:"Click to copy",children:[_===0&&n.jsx("span",{className:"text-muted-foreground mr-1",children:"•"}),_>0&&n.jsx("span",{className:"text-muted-foreground mr-1",children:"|"}),n.jsx("span",{className:_===0?"font-medium flex-1":"flex-1",children:N.text}),n.jsx(Cn,{className:"h-3 w-3 text-gray-400 opacity-0 group-hover:opacity-100 transition-opacity ml-1"})]},_)))||n.jsx("span",{className:"text-muted-foreground",children:"No headlines"})})]}),n.jsxs("div",{children:[n.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"Descriptions"}),n.jsx("div",{className:"space-y-1",children:((j=b.descriptions)==null?void 0:j.map((N,_)=>n.jsxs("div",{className:"text-sm text-muted-foreground cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-800 rounded px-2 py-1 transition-colors group flex items-center",onClick:()=>h(N.text,"Description"),title:"Click to copy",children:[n.jsx("span",{className:"flex-1",children:N.text}),n.jsx(Cn,{className:"h-3 w-3 text-gray-400 opacity-0 group-hover:opacity-100 transition-opacity ml-1"})]},_)))||n.jsx("span",{className:"text-muted-foreground",children:"No descriptions"})})]}),(b.path||b.finalUrl)&&n.jsxs("div",{className:"pt-2 border-t",children:[b.path&&n.jsxs("div",{className:"text-xs cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-800 rounded px-2 py-1 transition-colors",onClick:()=>h(b.path,"Display Path"),title:"Click to copy",children:[n.jsx("span",{className:"text-muted-foreground",children:"Display Path:"}),n.jsx("span",{className:"ml-1 text-blue-600",children:b.path})]}),b.finalUrl&&n.jsxs("div",{className:"text-xs mt-1 cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-800 rounded px-2 py-1 transition-colors",onClick:()=>h(b.finalUrl,"Final URL"),title:"Click to copy",children:[n.jsx("span",{className:"text-muted-foreground",children:"Final URL:"}),n.jsx("span",{className:"ml-1 text-blue-600 truncate inline-block max-w-xs",children:b.finalUrl})]})]})]})]},b.id||y)},f=(b,y)=>n.jsxs(Te,{className:"mb-4",children:[n.jsx(st,{className:"pb-3",children:n.jsxs("div",{className:"flex justify-between items-center",children:[n.jsxs("h4",{className:"text-sm font-medium",children:["Facebook Ad ",y+1]}),n.jsx(Be,{variant:"outline",children:"Facebook"})]})}),n.jsx(Re,{className:"space-y-4",children:n.jsxs("div",{className:"border rounded-lg p-4 bg-gray-50 dark:bg-gray-900",children:[b.imageUrl&&n.jsx("div",{className:"mb-3 rounded-lg overflow-hidden bg-gray-200 dark:bg-gray-800",style:{height:"200px"},children:n.jsx("img",{src:b.imageUrl,alt:"Ad preview",className:"w-full h-full object-cover",onError:w=>{w.target.style.display="none"}})}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("div",{className:"text-xs text-blue-600 font-medium",children:"SPONSORED"}),n.jsx("div",{className:"font-semibold cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-800 rounded px-2 py-1 transition-colors",onClick:()=>h(b.headline||"No headline","Headline"),title:"Click to copy",children:b.headline||"No headline"}),n.jsx("div",{className:"text-sm text-muted-foreground cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-800 rounded px-2 py-1 transition-colors",onClick:()=>h(b.body||"No body text","Body text"),title:"Click to copy",children:b.body||"No body text"}),b.cta&&n.jsx("div",{className:"pt-2",children:n.jsx("div",{className:"inline-block bg-blue-600 text-white px-4 py-2 rounded text-sm font-medium cursor-pointer hover:bg-blue-700 transition-colors",onClick:()=>h(b.cta,"CTA"),title:"Click to copy",children:b.cta})})]})]})})]},b.id||y),p=(b,y)=>n.jsxs(Te,{className:"mb-4",children:[n.jsx(st,{className:"pb-3",children:n.jsxs("div",{className:"flex justify-between items-center",children:[n.jsxs("h4",{className:"text-sm font-medium",children:["LinkedIn Ad ",y+1]}),n.jsx(Be,{variant:"outline",children:"LinkedIn"})]})}),n.jsx(Re,{children:n.jsx("div",{className:"text-sm text-muted-foreground",children:JSON.stringify(b,null,2)})})]},b.id||y),A=()=>n.jsxs("div",{className:"space-y-6",children:[n.jsxs(Te,{children:[n.jsxs(st,{children:[n.jsx(ot,{className:"text-lg",children:"Headlines"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Short, impactful headlines for your Instagram ads"})]}),n.jsx(Re,{children:n.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-3",children:l.map((b,y)=>n.jsxs("div",{className:"p-3 border rounded-lg bg-gray-50 dark:bg-gray-900 cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors group",onClick:()=>h(b,"Headline"),title:"Click to copy",children:[n.jsxs("div",{className:"flex items-start justify-between",children:[n.jsx("span",{className:"text-sm font-medium",children:b}),n.jsx(Cn,{className:"h-3 w-3 text-gray-400 opacity-0 group-hover:opacity-100 transition-opacity flex-shrink-0 ml-1"})]}),n.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:[b.length," chars"]})]},y))})})]}),n.jsxs(Te,{children:[n.jsxs(st,{children:[n.jsx(ot,{className:"text-lg",children:"Descriptions"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Compelling descriptions to engage your audience"})]}),n.jsx(Re,{children:n.jsx("div",{className:"space-y-3",children:o.map((b,y)=>n.jsxs("div",{className:"p-4 border rounded-lg bg-gray-50 dark:bg-gray-900 cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors group",onClick:()=>h(b,"Description"),title:"Click to copy",children:[n.jsxs("div",{className:"flex items-start justify-between",children:[n.jsx("p",{className:"text-sm flex-1",children:b}),n.jsx(Cn,{className:"h-3 w-3 text-gray-400 opacity-0 group-hover:opacity-100 transition-opacity flex-shrink-0 ml-2"})]}),n.jsxs("div",{className:"text-xs text-muted-foreground mt-2",children:[b.length," characters"]})]},y))})})]}),c&&Object.keys(c).length>0&&n.jsxs(Te,{children:[n.jsx(st,{children:n.jsx(ot,{className:"text-lg",children:"Additional Metadata"})}),n.jsxs(Re,{className:"space-y-4",children:[c.cta_suggestions&&n.jsxs("div",{children:[n.jsx("h4",{className:"font-medium mb-2",children:"CTA Suggestions"}),n.jsx("div",{className:"flex flex-wrap gap-2",children:c.cta_suggestions.map((b,y)=>n.jsx(Be,{variant:"secondary",className:"cursor-pointer hover:bg-secondary/80 transition-colors",onClick:()=>h(b,"CTA"),children:b},y))})]}),c.search_keywords&&n.jsxs("div",{children:[n.jsx("h4",{className:"font-medium mb-2",children:"Search Keywords"}),n.jsx("div",{className:"flex flex-wrap gap-2",children:c.search_keywords.map((b,y)=>n.jsx(Be,{variant:"outline",className:"cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors",onClick:()=>
1866h(b,"Keyword"),children:b},y))})]}),c.negative_keywords&&n.jsxs("div",{children:[n.jsx("h4",{className:"font-medium mb-2",children:"Negative Keywords"}),n.jsx("div",{className:"flex flex-wrap gap-2",children:c.negative_keywords.map((b,y)=>n.jsx(Be,{variant:"destructive",className:"opacity-70 cursor-pointer hover:opacity-100 transition-opacity",onClick:()=>h(b,"Negative keyword"),children:b},y))})]}),c.audience_targeting_suggestions&&n.jsxs("div",{children:[n.jsx("h4",{className:"font-medium mb-2",children:"Audience Targeting"}),n.jsx("div",{className:"flex flex-wrap gap-2",children:c.audience_targeting_suggestions.map((b,y)=>n.jsx(Be,{variant:"secondary",className:"cursor-pointer hover:bg-secondary/80 transition-colors",onClick:()=>h(b,"Audience"),children:b},y))})]})]})]})]}),v=()=>{switch(u){case"google":return n.jsx(ui,{className:"h-4 w-4"});case"facebook":return n.jsx(Ka,{className:"h-4 w-4"});case"instagram":return n.jsx(xK,{className:"h-4 w-4"});case"linkedin":return n.jsx(Ka,{className:"h-4 w-4"});default:return n.jsx(ui,{className:"h-4 w-4"})}},x=()=>{switch(u){case"google":return"Google Ads";case"facebook":return"Facebook Ads";case"instagram":return"Instagram Ads";case"linkedin":return"LinkedIn Ads";default:return u.charAt(0).toUpperCase()+u.slice(1)}};return n.jsx("div",{className:"w-full h-full overflow-auto bg-white dark:bg-gray-950 p-6",children:n.jsxs("div",{className:"max-w-4xl mx-auto",children:[n.jsxs("div",{className:"mb-6",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[v(),n.jsx("h2",{className:"text-2xl font-bold",children:t||e.name||"Untitled Ad Group"})]}),n.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[n.jsx(Be,{variant:"secondary",children:x()}),u==="instagram"?n.jsxs("span",{children:[l.length," headline",l.length!==1?"s":"",","," ",o.length," description",o.length!==1?"s":""]}):n.jsxs("span",{children:[s.length," ad",s.length!==1?"s":""]}),e.created_at&&n.jsxs("span",{children:["Created ",new Date(e.created_at).toLocaleDateString()]})]})]}),u==="instagram"&&(o.length>0||l.length>0)?A():s.length===0?n.jsxs(Ar,{children:[n.jsx(qi,{className:"h-4 w-4"}),n.jsx(gr,{children:"No ads have been created for this ad group yet. Use the editor to add ads."})]}):n.jsxs(Cs,{defaultValue:"ads",className:"w-full",children:[n.jsxs(ps,{children:[n.jsx(pt,{value:"ads",children:"Ad Variations"}),n.jsx(pt,{value:"performance",children:"Performance"}),n.jsx(pt,{value:"settings",children:"Settings"})]}),n.jsx(Ct,{value:"ads",className:"mt-6",children:n.jsx("div",{children:s.map((b,y)=>{switch(u){case"google":return m(b,y);case"facebook":return f(b,y);case"linkedin":return p(b,y);default:return n.jsx(Te,{className:"mb-4",children:n.jsx(Re,{className:"pt-6",children:n.jsx("pre",{className:"text-sm overflow-auto",children:JSON.stringify(b,null,2)})})},y)}})})}),n.jsx(Ct,{value:"performance",className:"mt-6",children:n.jsxs(Te,{children:[n.jsx(st,{children:n.jsx(ot,{className:"text-lg",children:"Performance Metrics"})}),n.jsx(Re,{children:n.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[n.jsx(q_,{className:"h-12 w-12 mx-auto mb-2 opacity-20"}),n.jsx("p",{children:"Performance data will be displayed here once the ads are running."}),n.jsxs("p",{className:"text-sm mt-2",children:["Connect your ",x()," account to view metrics."]})]})})]})}),n.jsx(Ct,{value:"settings",className:"mt-6",children:n.jsxs(Te,{children:[n.jsx(st,{children:n.jsx(ot,{className:"text-lg",children:"Ad Group Settings"})}),n.jsxs(Re,{className:"space-y-4",children:[Object.keys(i).length>0&&n.jsxs("div",{children:[n.jsx("h4",{className:"font-medium mb-2",children:"Targeting"}),n.jsx("pre",{className:"text-sm bg-gray-100 dark:bg-gray-900 p-3 rounded overflow-auto",children:JSON.stringify(i,null,2)})]}),Object.keys(a).length>0&&n.jsxs("div",{children:[n.jsx("h4",{className:"font-medium mb-2",children:"Additional Settings"}),n.jsx("pre",{className:"text-sm bg-gray-100 dark:bg-gray-900 p-3 rounded overflow-auto",children:JSON.stringify(a,null,2)})]}),Object.keys(i).length===0&&Object.keys(a).length===0&&n.jsx("div",{className:"text-center py-4 text-muted-foreground",children:n.jsx("p",{children:"No additional settings configured for this ad group."})})]})]})})]})]})})},_ft=({content:e,onSave:t,onCancel:r,onUnsavedChanges:s})=>{const[a,i]=g.useState(()=>{const{title:P,image_url:F,ideal_media_type:M,ideal_media_description:I,bonus_metadata:$={},content_sections:V=[]}=e.content_json||{};return{title:P||"",image_url:F||"",ideal_media_type:M||"",ideal_media_description:I||"",bonus_metadata:{slug:$.slug||"",tags:$.tags||[],excerpt:$.excerpt||"",keywords:$.keywords||[],schema_markup:$.schema_markup||"",call_to_action:$.call_to_action||"",target_audience:$.target_audience||"",meta_description:$.meta_description||"",author:$.author||"",reading_time:$.reading_time||""},content_sections:Array.isArray(V)&&V.length?V:[{heading:"",content:""}]}}),[o,l]=g.useState(a),[c,d]=g.useState(!1),[u,h]=g.useState("initial");AS(c);const[m,f]=g.useState(!1),p=P=>{const{name:F,value:M}=P.target;i(I=>({...I,[F]:M}))},A=(P,F)=>{i(M=>({...M,bonus_metadata:{...M.bonus_metadata,[P]:F}}))},v=(P,F)=>{A(P,F)},x=(P,F,M)=>{i(I=>{const $=[...I.content_sections];return $[P]={...$[P],[F]:M},{...I,content_sections:$}})},b=()=>{i(P=>({...P,content_sections:[...P.content_sections,{heading:"",content:""}]}))},y=P=>{i(F=>{const M=[...F.content_sections];return M.splice(P,1),{...F,content_sections:M}})},w=(P,F)=>{i(M=>{const I=[...M.content_sections];return F==="up"&&P>0?[I[P-1],I[P]]=[I[P],I[P-1]]:F==="down"&&P<I.length-1&&([I[P],I[P+1]]=[I[P+1],I[P]]),{...M,content_sections:I}})},j=()=>{f(!0)},N=()=>{i(P=>({...P,image_url:""}))},_=P=>{P&&P.url_to_inject&&i(F=>({...F,image_url:P.url_to_inject})),f(!1)};g.useEffect(()=>{const P=JSON.stringify(a)!==JSON.stringify(o);d(P),s&&s(P)},[a,o,s]);const S=async P=>{P.preventDefault(),h("loading");try{const F={content_json:{...e.content_json,title:a.title,image_url:a.image_url,
1866ideal_media_type:a.ideal_media_type,ideal_media_description:a.ideal_media_description,bonus_metadata:a.bonus_metadata,content_sections:a.content_sections},name:a.title};await t(F,!0),l(a),h("success"),setTimeout(()=>h("initial"),2e3)}catch(F){h("initial"),console.error("Error saving blog post:",F)}},C=()=>{S({preventDefault:()=>{}})},E=()=>{i(o),h("initial")},T=({value:P,onChange:F,placeholder:M})=>{const[I,$]=g.useState(""),V=()=>{I.trim()&&!P.includes(I.trim())&&(F([...P,I.trim()]),$(""))},R=Q=>{F(P.filter((U,D)=>D!==Q))};return n.jsxs("div",{className:"flex flex-wrap gap-2",children:[P.map((Q,U)=>n.jsxs("span",{className:"bg-gray-200 dark:bg-gray-700 rounded px-2 py-1 flex items-center text-sm",children:[Q,n.jsx("button",{type:"button",className:"ml-1 text-gray-500 hover:text-red-500",onClick:()=>R(U),children:"×"})]},Q)),n.jsx("input",{className:"border rounded px-2 py-1 text-sm focus:outline-none",value:I,placeholder:M,onChange:Q=>$(Q.target.value),onKeyDown:Q=>{(Q.key==="Enter"||Q.key===",")&&(Q.preventDefault(),V())},onBlur:V})]})},B=()=>n.jsxs(Te,{className:"mb-6",children:[n.jsx(st,{children:n.jsx(ot,{children:"SEO & Metadata"})}),n.jsxs(Re,{className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx(ze,{htmlFor:"slug",children:"Slug"}),n.jsx(qe,{id:"slug",name:"slug",value:a.bonus_metadata.slug,onChange:P=>A("slug",P.target.value),placeholder:"URL slug (e.g. my-awesome-post)"})]}),n.jsxs("div",{children:[n.jsx(ze,{children:"Tags"}),n.jsx(T,{value:a.bonus_metadata.tags??[],onChange:P=>v("tags",P),placeholder:"Add tag and press Enter"})]}),n.jsxs("div",{children:[n.jsx(ze,{children:"Keywords"}),n.jsx(T,{value:a.bonus_metadata.keywords??[],onChange:P=>v("keywords",P),placeholder:"Add keyword and press Enter"})]}),n.jsxs("div",{children:[n.jsx(ze,{htmlFor:"excerpt",children:"Excerpt"}),n.jsx(Zr,{id:"excerpt",name:"excerpt",value:a.bonus_metadata.excerpt,onChange:P=>A("excerpt",P.target.value),placeholder:"Short summary for SEO/social preview",className:"h-20"})]}),n.jsxs("div",{children:[n.jsx(ze,{htmlFor:"meta_description",children:"Meta Description"}),n.jsx(Zr,{id:"meta_description",name:"meta_description",value:a.bonus_metadata.meta_description,onChange:P=>A("meta_description",P.target.value),placeholder:"Meta description for SEO",className:"h-20"})]}),n.jsxs("div",{children:[n.jsx(ze,{htmlFor:"call_to_action",children:"Call to Action"}),n.jsx(qe,{id:"call_to_action",name:"call_to_action",value:a.bonus_metadata.call_to_action,onChange:P=>A("call_to_action",P.target.value),placeholder:"e.g. Plan your next adventure!"})]}),n.jsxs("div",{children:[n.jsx(ze,{htmlFor:"target_audience",children:"Target Audience"}),n.jsx(qe,{id:"target_audience",name:"target_audience",value:a.bonus_metadata.target_audience,onChange:P=>A("target_audience",P.target.value),placeholder:"e.g. Adventure travelers, space fans"})]}),n.jsxs("div",{children:[n.jsx(ze,{htmlFor:"author",children:"Author"}),n.jsx(qe,{id:"author",name:"author",value:a.bonus_metadata.author,onChange:P=>A("author",P.target.value),placeholder:"e.g. John Smith, Travel Writer"})]}),n.jsxs("div",{children:[n.jsx(ze,{htmlFor:"reading_time",children:"Reading Time"}),n.jsx(qe,{id:"reading_time",name:"reading_time",value:a.bonus_metadata.reading_time,onChange:P=>A("reading_time",P.target.value),placeholder:"e.g. 5 min read"})]}),n.jsxs("div",{children:[n.jsx(ze,{htmlFor:"schema_markup",children:"Schema Markup (JSON-LD)"}),n.jsx(Zr,{id:"schema_markup",name:"schema_markup",value:a.bonus_metadata.schema_markup,onChange:P=>A("schema_markup",P.target.value),placeholder:"Paste JSON-LD here",className:"h-32 font-mono"}),n.jsx(Nae,{type:"single",collapsible:!0,className:"mt-2",children:n.jsxs(I6,{value:"schema-preview",children:[n.jsx(O6,{children:"Preview Schema JSON"}),n.jsx(F6,{children:n.jsx("pre",{className:"bg-gray-100 dark:bg-gray-800 rounded p-2 text-xs overflow-x-auto",children:(()=>{try{return JSON.stringify(JSON.parse(a.bonus_metadata.schema_markup),null,2)}catch{return"Invalid JSON"}})()})})]})})]})]})]}),L=()=>n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsx("h3",{className:"font-semibold text-lg",children:"Content Sections"}),n.jsx(te,{type:"button",variant:"outline",onClick:b,children:"Add Section"})]}),a.content_sections.map((P,F)=>n.jsxs(Te,{className:"relative",children:[n.jsxs(st,{className:"flex flex-row items-center justify-between",children:[n.jsx("div",{className:"flex-1",children:n.jsx(qe,{className:"font-semibold text-base mb-2",placeholder:`Section Heading (e.g. Introduction, Part ${F+1})`,value:P.heading,onChange:M=>x(F,"heading",M.target.value)})}),n.jsxs("div",{className:"flex gap-1 ml-2",children:[n.jsx(te,{type:"button",size:"icon",variant:"ghost",onClick:()=>w(F,"up"),disabled:F===0,title:"Move Up",children:"↑"}),n.jsx(te,{type:"button",size:"icon",variant:"ghost",onClick:()=>w(F,"down"),disabled:F===a.content_sections.length-1,title:"Move Down",children:"↓"}),n.jsx(te,{type:"button",size:"icon",variant:"destructive",onClick:()=>y(F),title:"Remove Section",children:"×"})]})]}),n.jsxs(Re,{children:[F===0&&n.jsxs("div",{className:"mb-4",children:[n.jsx(ze,{className:"text-sm font-medium mb-2 block",children:"Blog Post Image"}),a.image_url?n.jsxs("div",{className:"relative mb-2",children:[n.jsx("img",{src:a.image_url,alt:"Blog Post",className:"max-h-48 rounded border w-full object-contain"}),n.jsxs("div",{className:"absolute top-2 right-2 flex gap-2",children:[n.jsx(te,{type:"button",size:"icon",variant:"destructive",onClick:()=>N(),title:"Remove Image",children:"×"}),n.jsx(te,{type:"button",size:"icon",variant:"outline",onClick:()=>j(),title:"Change Image",children:"🖼️"})]})]}):n.jsx(te,{type:"button",variant:"outline",onClick:()=>j(),children:"Add Image"})]}),n.jsx(Zr,{className:"font-mono h-32",placeholder:"Section content (markdown or HTML allowed)",value:P.content,onChange:M=>x(F,"content",M.target.value)})]})]},F)),n.jsx(Zt,{open:m,onOpenChange:f,children:n.jsxs(Jt,{className:"max-w-5xl h-[80vh] flex flex-col",children:[n.jsx(tr,{children:"Select Image"}),n.jsx("div",{className:"flex-grow overflow-hidden",children:n.jsx(oy,{mode:"picker",onResourceSelect:_,onCancel:()=>f(!1),allowedTypes:["image"],brandId:e.brand_id})})]})})]});return n.jsxs("div",{className:"w-full h-full overflow-auto bg-white dark:bg-gray-900 p-6",children:[c&&n.jsx("div",{className:"fixed bottom-4 left-1/2 transform -translate-x-1/2 z-50",children:n.jsx(ry,{state:u,onSave:C,onReset:E,loadingText:"Saving changes...",successText:"All changes saved",initialText:"You have unsaved changes",resetText:"Cancel",saveText:"Save"})}),n.jsx("form",{onSubmit:S,children:n.jsxs(Te,{className:"w-full max-w-4xl mx-auto",children:[n.jsx(st,{children:n.jsx(ot,{children:"Edit Blog Post"})}),n.jsxs(Re,{className:"space-y-6",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"title",children:"Title"}),n.jsx(qe,{id:"title",name:"title",value:a.title,onChange:p,placeholder:"Enter blog post title",required:!0})]}),B(),L()]}),n.jsxs(uo,{className:"flex justify-end space-x-2",children:[n.jsx(te,{type:"button",variant:"outline",onClick:r,children:"Cancel"}),n.jsx(te,{type:"submit",children:"Save Changes"})]})]})})]})};function Cft(e){return Eht(e).map(r=>{var s,a,i;return{value:r,label:((s=id[r])==null?void 0:s.label)||r,description:((a=id[r])==null?void 0:a.description)||"",whenToUse:((i=id[r])==null?void 0:i.whenToUse)||""}})}const Sft=({content:e,onSave:t,onCancel:r,onUnsavedChanges:s})=>{var ie,he,ee,xe,we,Se,pe,Ce;const a=e.brand_id,i=e.content_json||{},{platform:o="twitter",post_type:l="text"}=i,c=Fie(i),d=i.posts&&i.posts.length>0?i.posts.map(re=>({text:re.text||"",hashtags:re.hashtags||[],image_url:re.image_url||"",calls_to_action:re.calls_to_action||[]})):i.text?[{text:i.text||"",hashtags:i.hashtags||[],image_url:"",calls_to_action:[]}]:[{text:"",hashtags:[],image_url:"",calls_to_action:[]}],[u,h]=g.useState({platform:o,platform_post_type:c,post_type:l,posts:d}),[m,f]=g.useState(u),[p,A]=g.useState(!1),[v,x]=g.useState("initial"),[b,y]=g.useState("");AS(p);const[w,j]=g.useState(0),[N,_]=g.useState(!1),[S,C]=g.useState(0),E=Lie(u.platform_post_type),T=re=>{if(!re)return!1;const se=[".mp4",".mov",".avi",".webm",".mkv",".flv",".wmv",".m4v",".ogv"],Ae=re.toLowerCase().split(".").pop();return se.includes(`.${Ae}`)},B=re=>{const se=rL(re);h(Ae=>({...Ae,platform:re,platform_post_type:se}))},L=re=>{h(se=>({...se,platform_post_type:re}))},P=(re,se)=>{h(Ae=>{const Pe=[...Ae.posts];return Pe[re]={...Pe[re],text:se},{...Ae,posts:Pe}})},F=()=>{h(re=>({...re,posts:[...re.posts,{text:"",hashtags:[],image_url:"",calls_to_action:[]}]})),j(u.posts.length)},M=re=>{h(se=>{const Ae=[...se.posts];return Ae.splice(re,1),Ae.length===0&&Ae.push({text:"",hashtags:[],image_url:"",calls_to_action:[]}),{...se,posts:Ae}}),w>=re&&w>0&&j(w-1)},I=(re,se)=>{if(se==="up"&&re===0||se==="down"&&re===u.posts.length-1)return;const Ae=se==="up"?re-1:re+1;h(Pe=>{const Oe=[...Pe.posts],be=Oe[re];return Oe.splice(re,1),Oe.splice(Ae,0,be),{...Pe,posts:Oe}}),j(Ae)},[$,V]=g.useState(""),R=re=>{if(!$.trim())return;const se=$.startsWith("#")?$:`#${$}`;h(Ae=>{const Pe=[...Ae.posts];return Pe[re].hashtags.includes(se)||(Pe[re]={...Pe[re],hashtags:[...Pe[re].hashtags,se]}),{...Ae,posts:Pe}}),V("")},Q=(re,se)=>{h(Ae=>{const Pe=[...Ae.posts];return Pe[re]={...Pe[re],hashtags:Pe[re].hashtags.filter(Oe=>Oe!==se)},{...Ae,posts:Pe}})},[U,D]=g.useState(""),q=re=>{U.trim()&&(h(se=>{const Ae=[...se.posts];return Ae[re].calls_to_action.includes(U)||(Ae[re]={...Ae[re],calls_to_action:[...Ae[re].calls_to_action,U]}),{...se,posts:Ae}}),D(""))},G=(re,se)=>{h(Ae=>{const Pe=[...Ae.posts];
1866return Pe[re]={...Pe[re],calls_to_action:Pe[re].calls_to_action.filter(Oe=>Oe!==se)},{...Ae,posts:Pe}})},Y=re=>{C(re),_(!0)},K=re=>{re&&re.url_to_inject&&h(se=>{const Ae=[...se.posts];return Ae[S]={...Ae[S],image_url:re.url_to_inject||""},{...se,posts:Ae}}),_(!1)},X=re=>{h(se=>{const Ae=[...se.posts];return Ae[re]={...Ae[re],image_url:""},{...se,posts:Ae}})},ne=()=>{switch(u.platform){case"twitter":case"x":return 280;default:return}};oe.useEffect(()=>{const re=JSON.stringify(u)!==JSON.stringify(m);A(re),s&&s(re)},[u,m,s]);const ae=async re=>{re.preventDefault(),x("loading"),y("");try{const se={content_json:{posts:u.posts,platform:u.platform,platform_post_type:u.platform_post_type,post_type:u.post_type},name:`${u.posts[0].text.substring(0,30)}${u.posts[0].text.length>30?"...":""}`};await t(se,!0),f(u),x("success"),setTimeout(()=>x("initial"),3e3)}catch(se){x("error");const Ae=se instanceof Error?se.message:"Failed to save changes. Please try again.";y(Ae),console.error("Error saving social post:",se),setTimeout(()=>{x("initial"),y("")},5e3)}},J=()=>{ae({preventDefault:()=>{}})},W=()=>{h(m),x("initial")};return n.jsxs("div",{className:"w-full h-full overflow-auto bg-white dark:bg-gray-900 p-6",children:[p&&n.jsx("div",{className:"fixed bottom-4 left-1/2 transform -translate-x-1/2 z-50",children:n.jsx(ry,{state:v==="error"?"initial":v,onSave:J,onReset:W,loadingText:"Saving changes...",successText:"All changes saved",initialText:"You have unsaved changes",resetText:"Cancel",saveText:"Save"})}),n.jsx("form",{onSubmit:ae,children:n.jsxs(Te,{className:"w-full max-w-4xl mx-auto",children:[n.jsxs(st,{children:[n.jsx(ot,{children:"Edit Social Post"}),n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mt-4",children:[n.jsxs("div",{className:"flex flex-col gap-2",children:[n.jsx(ze,{htmlFor:"platform",children:"Platform"}),n.jsxs(ur,{value:u.platform,onValueChange:B,children:[n.jsx(or,{id:"platform",children:n.jsx(hr,{placeholder:"Select platform"})}),n.jsxs(lr,{children:[n.jsx(Fe,{value:"twitter",children:"Twitter/X"}),n.jsx(Fe,{value:"facebook",children:"Facebook"}),n.jsx(Fe,{value:"instagram",children:"Instagram"}),n.jsx(Fe,{value:"linkedin",children:"LinkedIn"})]})]})]}),n.jsxs("div",{className:"flex flex-col gap-2",children:[n.jsx(ze,{htmlFor:"post-type-select",children:"Post Type"}),n.jsxs(ur,{value:u.platform_post_type,onValueChange:L,children:[n.jsx(or,{id:"post-type-select",children:n.jsx(hr,{placeholder:"Select post type"})}),n.jsx(lr,{children:Cft(u.platform).map(re=>n.jsx(Fe,{value:re.value,children:n.jsxs("div",{className:"flex flex-col py-1",children:[n.jsx("div",{className:"font-medium",children:re.label}),n.jsx("div",{className:"text-xs text-muted-foreground",children:re.description}),n.jsx("div",{className:"text-xs text-blue-600 dark:text-blue-400 mt-1 italic",children:re.whenToUse})]})},re.value))})]}),u.platform_post_type&&id[u.platform_post_type]&&n.jsxs("p",{className:"text-xs text-muted-foreground italic",children:["💡 ",id[u.platform_post_type].whenToUse]})]})]})]}),n.jsxs(Re,{className:"space-y-6",children:[u.posts.length>1&&n.jsxs(Cs,{value:w.toString(),onValueChange:re=>j(parseInt(re)),className:"w-full",children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsxs("div",{className:"text-sm text-muted-foreground",children:[E?"Thread":"Posts"," · ",u.posts.length," ",u.posts.length===1?"post":"posts"]}),n.jsxs(te,{variant:"outline",size:"sm",onClick:F,children:[n.jsx(al,{className:"h-4 w-4 mr-1"}),"Add Post"]})]}),n.jsx(ps,{className:"w-full overflow-x-auto whitespace-nowrap",children:u.posts.map((re,se)=>n.jsx(pt,{value:se.toString(),className:ye("relative min-w-[90px]",E&&"flex items-center justify-center"),children:E?n.jsxs("span",{className:"flex items-center",children:["Post ",se+1," / ",u.posts.length]}):n.jsxs("span",{children:["Post ",se+1]})},se))})]}),n.jsxs("div",{className:"space-y-6 pt-4 border rounded-lg p-6",children:[u.posts.length>1&&n.jsxs("div",{className:"flex justify-between items-center",children:[n.jsx("div",{className:"text-lg font-medium",children:E?`Post ${w+1} / ${u.posts.length}`:`Post ${w+1}`}),n.jsxs("div",{className:"flex space-x-2",children:[n.jsx(te,{type:"button",variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>I(w,"up"),disabled:w===0,children:n.jsx(Fu,{className:"h-4 w-4"})}),n.jsx(te,{type:"button",variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>I(w,"down"),disabled:w===u.posts.length-1,children:n.jsx(Un,{className:"h-4 w-4"})}),n.jsx(te,{type:"button",variant:"outline",size:"icon",className:"h-8 w-8 text-red-500 hover:text-red-700",onClick:()=>M(w),disabled:u.posts.length<=1,children:n.jsx(va,{className:"h-4 w-4"})})]})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:`post-text-${w}`,children:"Post Content"}),n.jsx(Zr,{id:`post-text-${w}`,value:((ie=u.posts[w])==null?void 0:ie.text)||"",onChange:re=>P(w,re.target.value),placeholder:"What's on your mind?",className:"min-h-[120px]",required:!0}),ne()!==void 0&&n.jsxs("div",{className:`text-xs text-right ${(((ee=(he=u.posts[w])==null?void 0:he.text)==null?void 0:ee.length)||0)>ne()?"text-red-500 font-medium":"text-muted-foreground"}`,children:[((we=(xe=u.posts[w])==null?void 0:xe.text)==null?void 0:we.length)||0,"/",ne()," characters"]})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{children:"Post Media"}),(Se=u.posts[w])!=null&&Se.image_url?n.jsxs("div",{className:"relative",children:[T(u.posts[w].image_url)?n.jsx("video",{src:u.posts[w].image_url,className:"w-full max-h-[300px] object-contain rounded-md border",controls:!0,preload:"metadata",children:"Your browser does not support the video tag."}):n.jsx("img",{src:u.posts[w].image_url,alt:"Post media",className:"w-full max-h-[300px] object-contain rounded-md border"}),n.jsxs("div",{className:"absolute top-2 right-2 flex space-x-2",children:[n.jsx(te,{type:"button",variant:"destructive",size:"icon",className:"h-8 w-8 bg-white text-red-500 hover:bg-red-50 hover:text-red-600 border border-red-200",onClick:()=>X(w),children:n.jsx(kr,{className:"h-4 w-4"})}),n.jsx(te,{type:"button",variant:"outline",size:"icon",className:"h-8 w-8 bg-white hover:bg-gray-50",onClick:()=>Y(w),children:n.jsx(Ra,{className:"h-4 w-4"})})]})]}):n.jsxs("div",{className:"w-full h-[200px] border-2 border-dashed rounded-md flex flex-col items-center justify-center cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>Y(w),children:[n.jsx(Ra,{className:"h-10 w-10 text-muted-foreground mb-2"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Click to add media (image or video)"})]})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:`hashtags-${w}`,children:"Hashtags"}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx(qe,{id:`hashtags-${w}`,value:$,onChange:re=>V(re.target.value),placeholder:"Add a hashtag",className:"flex-1"}),n.jsx(te,{type:"button",onClick:()=>R(w),children:"Add"})]}),((pe=u.posts[w])==null?void 0:pe.hashtags.length)>0&&n.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:u.posts[w].hashtags.map((re,se)=>n.jsxs("div",{className:`bg-primary-100 text-primary-800 dark:bg-primary-900 dark:text-primary-300 
1867                                  px-3 py-1 rounded-full flex items-center gap-2`,children:[n.jsx("span",{children:re}),n.jsx("button",{type:"button",onClick:()=>Q(w,re),className:"text-primary-800 dark:text-primary-300 hover:text-primary-900 dark:hover:text-primary-200",children:n.jsx(kr,{className:"h-3 w-3"})})]},se))})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:`cta-${w}`,children:"Call to Action"}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx(qe,{id:`cta-${w}`,value:U,onChange:re=>D(re.target.value),placeholder:"Add a call to action (e.g., 'Click link in bio', 'Follow for more')",className:"flex-1"}),n.jsx(te,{type:"button",onClick:()=>q(w),children:"Add"})]}),((Ce=u.posts[w])==null?void 0:Ce.calls_to_action.length)>0&&n.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:u.posts[w].calls_to_action.map((re,se)=>n.jsxs("div",{className:`bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-300 
1868                                  px-3 py-1 rounded-full flex items-center gap-2`,children:[n.jsx("span",{children:re}),n.jsx("button",{type:"button",onClick:()=>G(w,re),className:"text-blue-800 dark:text-blue-300 hover:text-blue-900 dark:hover:text-blue-200",children:n.jsx(kr,{className:"h-3 w-3"})})]},se))})]})]}),n.jsx("div",{className:"flex justify-center",children:n.jsxs(te,{type:"button",variant:"outline",onClick:F,children:[n.jsx(al,{className:"h-4 w-4 mr-2"}),"Add Post"]})})]}),n.jsxs(uo,{className:"flex flex-col gap-2",children:[b&&n.jsx("div",{className:"w-full p-3 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-md",children:n.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:b})}),n.jsxs("div",{className:"flex justify-between space-x-2 w-full",children:[n.jsx(te,{type:"button",variant:"outline",onClick:r,disabled:v==="loading",children:"Cancel"}),n.jsxs(te,{type:"submit",disabled:v==="loading",className:ye(v==="success"&&"bg-green-600 hover:bg-green-700",v==="error"&&"bg-red-600 hover:bg-red-700"),children:[v==="loading"&&n.jsx(kt,{className:"mr-2 h-4 w-4 animate-spin"}),v==="success"&&n.jsx(Gn,{className:"mr-2 h-4 w-4"}),v==="loading"&&"Saving...",v==="success"&&"Saved!",v==="error"&&"Save Failed",v==="initial"&&"Save Changes"]})]})]})]})}),n.jsx(Zt,{open:N,onOpenChange:_,children:n.jsxs(Jt,{className:"max-w-5xl h-[80vh] flex flex-col",children:[n.jsx(tr,{children:"Select Media"}),n.jsx("div",{className:"flex-grow overflow-hidden",children:n.jsx(oy,{mode:"picker",onResourceSelect:K,onCancel:()=>_(!1),allowedTypes:["image","video"],brandId:a})})]})})]})},kft=({content:e,onSave:t})=>{var D,q,G;const{headline:r="",byline:s="",benefits:a=[],faq:i=[],resources:o=[],primary_cta:l={text:"",url:""},secondary_cta:c={text:"",url:""},testimonials:d=[],closing_statement:u="",meta:h={},style:m={},hero_image_url:f=""}=e.content_json,[p,A]=g.useState({headline:r,byline:s,benefits:[...a],faq:[...i],resources:[...o],primary_cta:{...l},secondary_cta:{...c},testimonials:[...d],closing_statement:u,meta:{...h},style:{...m},hero_image_url:f}),[v,x]=g.useState(p),[b,y]=g.useState(!1),[w,j]=g.useState("initial"),[N,_]=g.useState(!1),[S,C]=g.useState(!1);AS(b),oe.useEffect(()=>{y(JSON.stringify(p)!==JSON.stringify(v))},[p,v]);const E=(Y,K)=>{A(X=>({...X,[Y]:K}))},T=(Y,K)=>{A(X=>({...X,[Y]:[...X[Y],K]}))},B=(Y,K)=>{A(X=>{const ne=[...X[Y]];return ne.splice(K,1),{...X,[Y]:ne}})},L=(Y,K,X,ne)=>{A(ae=>{const J=[...ae[Y]];return J[K]={...J[K],[X]:ne},{...ae,[Y]:J}})},P=(Y,K,X)=>{A(ne=>{const ae=[...ne[Y]];return X==="up"&&K>0?[ae[K-1],ae[K]]=[ae[K],ae[K-1]]:X==="down"&&K<ae.length-1&&([ae[K+1],ae[K]]=[ae[K],ae[K+1]]),{...ne,[Y]:ae}})},F=(Y,K,X)=>{A(ne=>({...ne,[Y]:{...ne[Y],[K]:X}}))},M=async Y=>{var K;Y.preventDefault(),_(!0),j("loading");try{const X={...e,content_json:{...e.content_json,...p},name:((K=p.meta)==null?void 0:K.siteName)||e.name||"Landing Page"};await t(X,!0),x(p),j("success"),setTimeout(()=>j("initial"),2e3)}catch(X){j("initial"),console.error("Error saving changes:",X)}finally{_(!1)}},I=()=>{M({preventDefault:()=>{}})},$=()=>{A(v),j("initial")},V=()=>n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex justify-between items-center",children:[n.jsx("h4",{className:"font-medium",children:"Benefits"}),n.jsxs(te,{type:"button",onClick:()=>T("benefits",{icon:"",title:"",description:""}),children:[n.jsx(La,{className:"h-4 w-4 mr-2"})," Add Benefit"]})]}),p.benefits.length===0&&n.jsx("p",{className:"text-muted-foreground",children:"No benefits added."}),p.benefits.map((Y,K)=>n.jsxs("div",{className:"p-3 border rounded-md mb-3 bg-white dark:bg-gray-900",children:[n.jsxs("div",{className:"flex justify-between items-center mb-2",children:[n.jsxs("h5",{className:"font-medium",children:["Benefit ",K+1]}),n.jsxs("div",{className:"flex gap-1",children:[n.jsx(te,{size:"icon",variant:"ghost",onClick:()=>P("benefits",K,"up"),disabled:K===0,children:n.jsx(Xw,{className:"h-4 w-4"})}),n.jsx(te,{size:"icon",variant:"ghost",onClick:()=>P("benefits",K,"down"),disabled:K===p.benefits.length-1,children:n.jsx(Jw,{className:"h-4 w-4"})}),n.jsx(te,{size:"icon",variant:"ghost",onClick:()=>B("benefits",K),className:"text-red-500 hover:text-red-700",children:n.jsx(kr,{className:"h-4 w-4"})})]})]}),n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{children:"Icon"}),n.jsx(qe,{value:Y.icon,onChange:X=>
1868L("benefits",K,"icon",X.target.value),placeholder:"icon name"})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{children:"Title"}),n.jsx(qe,{value:Y.title,onChange:X=>L("benefits",K,"title",X.target.value),placeholder:"Benefit title"})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{children:"Description"}),n.jsx(Zr,{value:Y.description,onChange:X=>L("benefits",K,"description",X.target.value),placeholder:"Benefit description"})]})]})]},K))]}),R=()=>n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex justify-between items-center",children:[n.jsx("h4",{className:"font-medium",children:"FAQ"}),n.jsxs(te,{type:"button",onClick:()=>T("faq",{question:"",answer:""}),children:[n.jsx(La,{className:"h-4 w-4 mr-2"})," Add FAQ"]})]}),p.faq.length===0&&n.jsx("p",{className:"text-muted-foreground",children:"No FAQ added."}),p.faq.map((Y,K)=>n.jsxs("div",{className:"p-3 border rounded-md mb-3 bg-white dark:bg-gray-900",children:[n.jsxs("div",{className:"flex justify-between items-center mb-2",children:[n.jsxs("h5",{className:"font-medium",children:["FAQ ",K+1]}),n.jsxs("div",{className:"flex gap-1",children:[n.jsx(te,{size:"icon",variant:"ghost",onClick:()=>P("faq",K,"up"),disabled:K===0,children:n.jsx(Xw,{className:"h-4 w-4"})}),n.jsx(te,{size:"icon",variant:"ghost",onClick:()=>P("faq",K,"down"),disabled:K===p.faq.length-1,children:n.jsx(Jw,{className:"h-4 w-4"})}),n.jsx(te,{size:"icon",variant:"ghost",onClick:()=>B("faq",K),className:"text-red-500 hover:text-red-700",children:n.jsx(kr,{className:"h-4 w-4"})})]})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{children:"Question"}),n.jsx(qe,{value:Y.question,onChange:X=>L("faq",K,"question",X.target.value),placeholder:"FAQ question"})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{children:"Answer"}),n.jsx(Zr,{value:Y.answer,onChange:X=>L("faq",K,"answer",X.target.value),placeholder:"FAQ answer"})]})]},K))]}),Q=()=>n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex justify-between items-center",children:[n.jsx("h4",{className:"font-medium",children:"Testimonials"}),n.jsxs(te,{type:"button",onClick:()=>T("testimonials",{role:"",quote:"",author:""}),children:[n.jsx(La,{className:"h-4 w-4 mr-2"})," Add Testimonial"]})]}),p.testimonials.length===0&&n.jsx("p",{className:"text-muted-foreground",children:"No testimonials added."}),p.testimonials.map((Y,K)=>n.jsxs("div",{className:"p-3 border rounded-md mb-3 bg-white dark:bg-gray-900",children:[n.jsxs("div",{className:"flex justify-between items-center mb-2",children:[n.jsxs("h5",{className:"font-medium",children:["Testimonial ",K+1]}),n.jsxs("div",{className:"flex gap-1",children:[n.jsx(te,{size:"icon",variant:"ghost",onClick:()=>P("testimonials",K,"up"),disabled:K===0,children:n.jsx(Xw,{className:"h-4 w-4"})}),n.jsx(te,{size:"icon",variant:"ghost",onClick:()=>P("testimonials",K,"down"),disabled:K===p.testimonials.length-1,children:n.jsx(Jw,{className:"h-4 w-4"})}),n.jsx(te,{size:"icon",variant:"ghost",onClick:()=>B("testimonials",K),className:"text-red-500 hover:text-red-700",children:n.jsx(kr,{className:"h-4 w-4"})})]})]}),n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{children:"Role"}),n.jsx(qe,{value:Y.role,onChange:X=>L("testimonials",K,"role",X.target.value),placeholder:"Role (e.g. Social Media Influencer)"})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{children:"Author"}),n.jsx(qe,{value:Y.author,onChange:X=>L("testimonials",K,"author",X.target.value),placeholder:"Author name"})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{children:"Quote"}),n.jsx(Zr,{value:Y.quote,onChange:X=>L("testimonials",K,"quote",X.target.value),placeholder:"Testimonial quote"})]})]})]},K))]}),U=()=>n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex justify-between items-center",children:[n.jsx("h4",{className:"font-medium",children:"Resources"}),n.jsxs(te,{type:"button",onClick:()=>T("resources",{id:"",type:"",required:!1,description:"",brand_specific:!1,http_content_type:""}),children:[n.jsx(La,{className:"h-4 w-4 mr-2"})," Add Resource"]})]}),p.resources.length===0&&n.jsx("p",{className:"text-muted-foreground",children:"No resources added."}),p.resources.map((Y,K)=>n.jsxs("div",{className:"p-3 border rounded-md mb-3 bg-white dark:bg-gray-900",children:[n.jsxs("div",{className:"flex justify-between items-center mb-2",children:[n.jsxs("h5",{className:"font-medium",children:["Resource ",K+1]}),n.jsxs("div",{className:"flex gap-1",children:[n.jsx(te,{size:"icon",variant:"ghost",onClick:()=>P("resources",K,"up"),disabled:K===0,children:n.jsx(Xw,{className:"h-4 w-4"})}),n.jsx(te,{size:"icon",variant:"ghost",onClick:()=>P("resources",K,"down"),disabled:K===p.resources.length-1,children:n.jsx(Jw,{className:"h-4 w-4"})}),n.jsx(te,{size:"icon",variant:"ghost",onClick:()=>B("resources",K),className:"text-red-500 hover:text-red-700",children:n.jsx(kr,{className:"h-4 w-4"})})]})]}),n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{children:"ID"}),n.jsx(qe,{value:Y.id,onChange:X=>L("resources",K,"id",X.target.value),placeholder:"Resource ID"})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{children:"Type"}
1868),n.jsx(qe,{value:Y.type,onChange:X=>L("resources",K,"type",X.target.value),placeholder:"Type (e.g. image)"})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{children:"Description"}),n.jsx(Zr,{value:Y.description,onChange:X=>L("resources",K,"description",X.target.value),placeholder:"Resource description"})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{children:"Required"}),n.jsx(qe,{type:"checkbox",checked:Y.required,onChange:X=>L("resources",K,"required",X.target.checked)})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{children:"Brand Specific"}),n.jsx(qe,{type:"checkbox",checked:Y.brand_specific,onChange:X=>L("resources",K,"brand_specific",X.target.checked)})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{children:"HTTP Content Type"}),n.jsx(qe,{value:Y.http_content_type,onChange:X=>L("resources",K,"http_content_type",X.target.value),placeholder:"image/jpeg"})]})]})]},K))]});return n.jsxs("div",{className:"w-full h-full overflow-auto bg-white dark:bg-gray-900 p-6",children:[b&&n.jsx("div",{className:"fixed bottom-4 left-1/2 transform -translate-x-1/2 z-50",children:n.jsx(ry,{state:w,onSave:I,onReset:$,loadingText:"Saving changes...",successText:"All changes saved",initialText:"You have unsaved changes",resetText:"Cancel",saveText:"Save"})}),n.jsx("form",{onSubmit:M,children:n.jsxs(Te,{className:"w-full max-w-5xl mx-auto mb-4",children:[n.jsx(st,{children:n.jsx(ot,{children:"Edit Landing Page"})}),n.jsx(Re,{children:n.jsxs(Cs,{defaultValue:"main",children:[n.jsxs(ps,{className:"mb-4 flex flex-wrap gap-2",children:[n.jsx(pt,{value:"main",children:"Main"}),n.jsx(pt,{value:"media",children:"Media"}),n.jsx(pt,{value:"benefits",children:"Benefits"}),n.jsx(pt,{value:"faq",children:"FAQ"}),n.jsx(pt,{value:"testimonials",children:"Testimonials"}),n.jsx(pt,{value:"resources",children:"Resources"}),n.jsx(pt,{value:"ctas",children:"CTAs"}),n.jsx(pt,{value:"closing",children:"Closing"}),n.jsx(pt,{value:"settings",children:"Settings"})]}),n.jsx(Ct,{value:"main",children:n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{children:"Headline"}),n.jsx(qe,{value:p.headline,onChange:Y=>E("headline",Y.target.value),placeholder:"Headline"})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{children:"Byline"}),n.jsx(Zr,{value:p.byline,onChange:Y=>E("byline",Y.target.value),placeholder:"Byline"})]}),p.hero_image_url&&n.jsxs("div",{className:"mt-4 flex flex-col items-center",children:[n.jsx(ze,{children:"Hero Image Preview"}),n.jsx("img",{src:p.hero_image_url,alt:"Hero Preview",className:"max-h-48 rounded shadow border bg-white dark:bg-gray-800 my-2",style:{maxWidth:"100%"}})]})]})}),n.jsxs(Ct,{value:"media",children:[n.jsxs("div",{className:"space-y-4",children:[n.jsx(ze,{children:"Hero Image"}),p.hero_image_url?n.jsxs("div",{className:"flex flex-col items-center gap-2",children:[n.jsx("img",{src:p.hero_image_url,alt:"Hero Preview",className:"max-h-48 rounded shadow border bg-white dark:bg-gray-800",style:{maxWidth:"100%"}}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx(te,{type:"button",variant:"outline",onClick:()=>A(Y=>({...Y,hero_image_url:""})),children:"Remove"}),n.jsx(te,{type:"button",variant:"outline",onClick:()=>C(!0),children:"Change"})]})]}):n.jsxs("div",{className:"flex flex-col gap-2",children:[n.jsx(te,{type:"button",variant:"outline",onClick:()=>C(!0),children:"Select Image from Brand Resources"}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(qe,{value:p.hero_image_url||"",onChange:Y=>A(K=>({...K,hero_image_url:Y.target.value})),placeholder:"Paste image URL..."}),n.jsx(te,{type:"button",variant:"outline",onClick:()=>A(Y=>({...Y,hero_image_url:""})),children:"Clear"})]})]})]}),n.jsx(Zt,{open:S,onOpenChange:C,children:n.jsxs(Jt,{className:"max-w-5xl h-[80vh] flex flex-col",children:[n.jsx(tr,{children:"Select Hero Image"}),n.jsx("div",{className:"flex-grow overflow-hidden",children:n.jsx(oy,{mode:"picker",onResourceSelect:Y=>{Y&&Y.url_to_inject&&A(K=>({...K,hero_image_url:Y.url_to_inject||""})),C(!1)},onCancel:()=>C(!1),allowedTypes:["image"],brandId:e.brand_id})})]})})]}),n.jsx(Ct,{value:"benefits",children:V()}),n.jsx(Ct,{value:"faq",children:R()}),n.jsx(Ct,{value:"testimonials",children:Q()}),n.jsx(Ct,{value:"resources",children:U()}),n.jsx(Ct,{value:"ctas",children:n.jsxs("div",{className:"space-y-6",children:[n.jsx("h3",{className:"text-lg font-medium",children:"Primary CTA"}),n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{children:"Text"}),n.jsx(qe,{value:p.primary_cta.text,onChange:Y=>F("primary_cta","text",Y.target.value),placeholder:"CTA text"})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{children:"URL"}),n.jsx(qe,{value:p.primary_cta.url,onChange:Y=>F("primary_cta","url",Y.target.value),placeholder:"CTA url"})]})]}
1868),n.jsx("h3",{className:"text-lg font-medium mt-6",children:"Secondary CTA"}),n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{children:"Text"}),n.jsx(qe,{value:p.secondary_cta.text,onChange:Y=>F("secondary_cta","text",Y.target.value),placeholder:"CTA text"})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{children:"URL"}),n.jsx(qe,{value:p.secondary_cta.url,onChange:Y=>F("secondary_cta","url",Y.target.value),placeholder:"CTA url"})]})]})]})}),n.jsx(Ct,{value:"closing",children:n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{children:"Closing Statement"}),n.jsx(Zr,{value:p.closing_statement,onChange:Y=>E("closing_statement",Y.target.value),placeholder:"Closing statement"})]})}),n.jsx(Ct,{value:"settings",children:n.jsxs("div",{className:"space-y-6",children:[n.jsx("h3",{className:"text-lg font-medium",children:"Page Metadata"}),n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"siteName",children:"Site Name"}),n.jsx(qe,{id:"siteName",name:"siteName",value:((D=p.meta)==null?void 0:D.siteName)||"",onChange:Y=>A(K=>({...K,meta:{...K.meta,siteName:Y.target.value}})),placeholder:"Your Site Name"})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"headerCta",children:"Header CTA Text"}),n.jsx(qe,{id:"headerCta",name:"headerCta",value:((q=p.meta)==null?void 0:q.headerCta)||"",onChange:Y=>A(K=>({...K,meta:{...K.meta,headerCta:Y.target.value}})),placeholder:"Sign Up"})]})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"footerTagline",children:"Footer Tagline"}),n.jsx(qe,{id:"footerTagline",name:"footerTagline",value:((G=p.meta)==null?void 0:G.footerTagline)||"",onChange:Y=>A(K=>({...K,meta:{...K.meta,footerTagline:Y.target.value}})),placeholder:"Beautiful landing page built with Rainfactory"})]})]})})]})}),n.jsx(uo,{className:"flex justify-end space-x-2",children:n.jsx(te,{type:"submit",disabled:N,children:N?n.jsx(n.Fragment,{children:"Saving..."}):n.jsx(n.Fragment,{children:"Save Changes"})})})]})})]})},Eft=({content:e,onSave:t,onCancel:r})=>{const{name:s,platform:a="google",ads:i=[],settings:o={},targeting:l={},descriptions:c=[],short_headlines:d=[],bonus_metadata:u={}}=e.content_json,m=(()=>{var M,I,$,V;return(M=e.name)!=null&&M.toLowerCase().includes("instagram")?"instagram":(I=e.name)!=null&&I.toLowerCase().includes("facebook")?"facebook":($=e.name)!=null&&$.toLowerCase().includes("google")?"google":(V=e.name)!=null&&V.toLowerCase().includes("linkedin")?"linkedin":a})(),[f,p]=g.useState({name:s||e.name||"",platform:m||"google",ads:[...i],settings:{...o},targeting:{...l},descriptions:[...c],short_headlines:[...d],bonus_metadata:{...u}}),A=M=>{const{name:I,value:$}=M.target;p(V=>({...V,[I]:$}))},v=M=>{p(I=>({...I,platform:M}))},x=()=>{let M={};switch(f.platform){case"google":M={id:`ad-${Date.now()}`,type:"responsive",headlines:[{text:"Primary Headline"},{text:"Secondary Headline"},{text:"Optional Headline"}],descriptions:[{text:"Primary description text goes here."},{text:"Secondary description adds more details."}],path:"example.com/path",finalUrl:"https://example.com/landing-page"};break;case"facebook":M={id:`ad-${Date.now()}`,type:"image",headline:"Ad Headline",body:"Ad body text goes here. Explain your value proposition.",cta:"Learn More",imageUrl:""};break;default:M={id:`ad-${Date.now()}`,type:"standard",headline:"New Ad",body:"Ad content goes here"}}p(I=>({...I,ads:[...I.ads,M]}))},b=M=>{p(I=>({...I,ads:I.ads.filter($=>$.id!==M)}))},y=(M,I,$,V)=>{const R=[...f.ads],Q={...R[M]};if(I==="headlines"||I==="descriptions"){const U=[...Q[I]];U[$]={...U[$],text:V},Q[I]=U}else Q[I]=V;R[M]=Q,p(U=>({...U,ads:R}))},w=(M,I,$)=>{const V=[...f.ads],R={...V[M]};R[I]=$,V[M]=R,p(Q=>({...Q,ads:V}))},j=(M,I)=>{const $=[...f.short_headlines];$[M]=I,p(V=>({...V,short_headlines:$}))},N=()=>{p(M=>({...M,short_headlines:[...M.short_headlines,""]}))},_=M=>{const I=f.short_headlines.filter(($,V)=>V!==M);p($=>({...$,short_headlines:I}))},S=(M,I)=>{const $=[...f.descriptions];$[M]=I,p(V=>({...V,descriptions:$}))},C=()=>{p(M=>({...M,descriptions:[...M.descriptions,""]}
1868))},E=M=>{const I=f.descriptions.filter(($,V)=>V!==M);p($=>({...$,descriptions:I}))},T=(M,I)=>{p($=>({...$,bonus_metadata:{...$.bonus_metadata,[M]:I}}))},B=(M,I)=>n.jsxs("div",{className:"border p-4 rounded-md mb-4 bg-white dark:bg-gray-900",children:[n.jsxs("div",{className:"flex justify-between items-center mb-4",children:[n.jsxs("h4",{className:"font-medium",children:["Responsive Search Ad ",I+1]}),n.jsx(te,{variant:"ghost",size:"icon",onClick:()=>b(M.id),className:"text-red-500 hover:text-red-700",children:n.jsx(kr,{className:"h-4 w-4"})})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{children:"Headlines"}),n.jsx("div",{className:"space-y-2",children:M.headlines.map(($,V)=>n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(qe,{value:$.text,onChange:R=>y(I,"headlines",V,R.target.value),placeholder:`Headline ${V+1}`,className:"flex-1",maxLength:30}),n.jsxs("div",{className:"text-xs text-muted-foreground w-12 text-right",children:[$.text.length,"/30"]})]},V))})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{children:"Descriptions"}),n.jsx("div",{className:"space-y-2",children:M.descriptions.map(($,V)=>n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(qe,{value:$.text,onChange:R=>y(I,"descriptions",V,R.target.value),placeholder:`Description ${V+1}`,className:"flex-1",maxLength:90}),n.jsxs("div",{className:"text-xs text-muted-foreground w-12 text-right",children:[$.text.length,"/90"]})]},V))})]}),n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:`ad-${I}-path`,children:"Display Path"}),n.jsx(qe,{id:`ad-${I}-path`,value:M.path||"",onChange:$=>y(I,"path",0,$.target.value),placeholder:"example.com/path"})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:`ad-${I}-finalUrl`,children:"Final URL"}),n.jsx(qe,{id:`ad-${I}-finalUrl`,value:M.finalUrl||"",onChange:$=>y(I,"finalUrl",0,$.target.value),placeholder:"https://example.com/landing-page"})]})]})]})]},M.id),L=(M,I)=>n.jsxs("div",{className:"border p-4 rounded-md mb-4 bg-white dark:bg-gray-900",children:[n.jsxs("div",{className:"flex justify-between items-center mb-4",children:[n.jsxs("h4",{className:"font-medium",children:["Facebook Ad ",I+1]}),n.jsx(te,{variant:"ghost",size:"icon",onClick:()=>b(M.id),className:"text-red-500 hover:text-red-700",children:n.jsx(kr,{className:"h-4 w-4"})})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:`ad-${I}-headline`,children:"Headline"}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(qe,{id:`ad-${I}-headline`,value:M.headline||"",onChange:$=>w(I,"headline",$.target.value),placeholder:"Headline",className:"flex-1",maxLength:40}),n.jsxs("div",{className:"text-xs text-muted-foreground w-12 text-right",children:[(M.headline||"").length,"/40"]})]})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:`ad-${I}-body`,children:"Body Text"}),n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx(Zr,{id:`ad-${I}-body`,value:M.body||"",onChange:$=>w(I,"body",$.target.value),placeholder:"Ad body text",className:"flex-1 min-h-[80px]",maxLength:125}),n.jsxs("div",{className:"text-xs text-muted-foreground w-12 text-right pt-2",children:[(M.body||"").length,"/125"]})]})]}),n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:`ad-${I}-cta`,children:"Call to Action"}),n.jsxs(ur,{value:M.cta||"Learn More",onValueChange:$=>w(I,"cta",$),children:[n.jsx(or,{id:`ad-${I}-cta`,children:n.jsx(hr,{placeholder:"Select CTA"})}),n.jsxs(lr,{children:[n.jsx(Fe,{value:"Learn More",children:"Learn More"}),n.jsx(Fe,{value:"Shop Now",children:"Shop Now"}),n.jsx(Fe,{value:"Sign Up",children:"Sign Up"}),n.jsx(Fe,{value:"Download",children:"Download"}),n.jsx(Fe,{value:"Get Offer",children:"Get Offer"})]})]})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:`ad-${I}-imageUrl`,children:"Image URL"}),n.jsx(qe,{id:`ad-${I}-imageUrl`,value:M.imageUrl||"",onChange:$=>w(I,"imageUrl",$.target.value),placeholder:"https://example.com/image.jpg"})]})]}),M.imageUrl&&n.jsx("div",{className:"mt-2 border rounded overflow-hidden h-40 bg-gray-100 dark:bg-gray-800",children:n.jsx("img",{src:M.imageUrl,alt:"Ad preview",className:"w-full h-full object-cover",onError:$=>
1868{$.target.src="https://placehold.co/600x400?text=Invalid+Image+URL"}})})]})]},M.id),P=()=>{var M,I,$,V,R,Q,U,D;return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex justify-between items-center",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"text-lg font-medium",children:"Short Headlines"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Create impactful headlines for your Instagram ads (max 40 characters)"})]}),n.jsxs(te,{type:"button",onClick:N,size:"sm",variant:"outline",children:[n.jsx(La,{className:"h-4 w-4 mr-2"}),"Add Headline"]})]}),n.jsxs("div",{className:"space-y-2",children:[f.short_headlines.map((q,G)=>n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(qe,{value:q,onChange:Y=>j(G,Y.target.value),placeholder:`Headline ${G+1}`,className:"flex-1",maxLength:40}),n.jsxs("div",{className:"text-xs text-muted-foreground w-12 text-right",children:[q.length,"/40"]}),n.jsx(te,{type:"button",variant:"ghost",size:"icon",onClick:()=>_(G),className:"text-red-500 hover:text-red-700",children:n.jsx(kr,{className:"h-4 w-4"})})]},G)),f.short_headlines.length===0&&n.jsx("div",{className:"text-center py-4 text-muted-foreground",children:'No headlines yet. Click "Add Headline" to create one.'})]})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex justify-between items-center",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"text-lg font-medium",children:"Descriptions"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Write compelling descriptions for your ads"})]}),n.jsxs(te,{type:"button",onClick:C,size:"sm",variant:"outline",children:[n.jsx(La,{className:"h-4 w-4 mr-2"}),"Add Description"]})]}),n.jsxs("div",{className:"space-y-3",children:[f.descriptions.map((q,G)=>n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx(Zr,{value:q,onChange:Y=>S(G,Y.target.value),placeholder:`Description ${G+1}`,className:"flex-1 min-h-[80px]",maxLength:300}),n.jsx(te,{type:"button",variant:"ghost",size:"icon",onClick:()=>E(G),className:"text-red-500 hover:text-red-700 mt-2",children:n.jsx(kr,{className:"h-4 w-4"})})]}),n.jsxs("div",{className:"text-xs text-muted-foreground text-right",children:[q.length,"/300 characters"]})]},G)),f.descriptions.length===0&&n.jsx("div",{className:"text-center py-4 text-muted-foreground",children:'No descriptions yet. Click "Add Description" to create one.'})]})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsx("h3",{className:"text-lg font-medium",children:"Additional Metadata"}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{children:"CTA Suggestions"}),n.jsx(qe,{value:((I=(M=f.bonus_metadata)==null?void 0:M.cta_suggestions)==null?void 0:I[0])||"",onChange:q=>T("cta_suggestions",[q.target.value]),placeholder:"e.g., Start Your Adventure Now"})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{children:"Search Keywords (comma-separated)"}),n.jsx(Zr,{value:((V=($=f.bonus_metadata)==null?void 0:$.search_keywords)==null?void 0:V.join(", "))||"",onChange:q=>T("search_keywords",q.target.value.split(",").map(G=>G.trim()).filter(G=>G)),placeholder:"e.g., travel videos, adventure, cultural insights",className:"min-h-[60
1868px]"})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{children:"Negative Keywords (comma-separated)"}),n.jsx(Zr,{value:((Q=(R=f.bonus_metadata)==null?void 0:R.negative_keywords)==null?void 0:Q.join(", "))||"",onChange:q=>T("negative_keywords",q.target.value.split(",").map(G=>G.trim()).filter(G=>G)),placeholder:"e.g., cheap, discount, free",className:"min-h-[60px]"})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{children:"Audience Targeting (comma-separated)"}),n.jsx(Zr,{value:((D=(U=f.bonus_metadata)==null?void 0:U.audience_targeting_suggestions)==null?void 0:D.join(", "))||"",onChange:q=>T("audience_targeting_suggestions",q.target.value.split(",").map(G=>G.trim()).filter(G=>G)),placeholder:"e.g., travel lovers, adventure seekers, cultural explorers",className:"min-h-[60px]"})]})]})]})},F=async M=>{M.preventDefault();let I={...e.content_json,name:f.name};m==="instagram"?I={...I,descriptions:f.descriptions,short_headlines:f.short_headlines,bonus_metadata:f.bonus_metadata}:I={...I,platform:f.platform,ads:f.ads,settings:f.settings,targeting:f.targeting};const $={content_json:I,name:f.name};await t($)};return n.jsx("div",{className:"w-full h-full overflow-auto bg-white dark:bg-gray-900 p-6",children:n.jsx("form",{onSubmit:F,children:n.jsxs(Te,{className:"w-full max-w-4xl mx-auto",children:[n.jsx(st,{children:n.jsx(ot,{children:"Edit Ad Group"})}),n.jsx(Re,{children:m==="instagram"?n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"name",children:"Ad Group Name"}),n.jsx(qe,{id:"name",name:"name",value:f.name,onChange:A,placeholder:"Enter ad group name",required:!0})]}),P()]}):n.jsxs(Cs,{defaultValue:"basic",children:[n.jsxs(ps,{className:"mb-4",children:[n.jsx(pt,{value:"basic",children:"Basic Info"}),n.jsx(pt,{value:"ads",children:"Ad Variations"}),n.jsx(pt,{value:"preview",children:"Preview"})]}),n.jsxs(Ct,{value:"basic",className:"space-y-6",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"name",children:"Ad Group Name"}),n.jsx(qe,{id:"name",name:"name",value:f.name,onChange:A,placeholder:"Enter ad group name",required:!0})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"platform",children:"Ad Platform"}),n.jsxs(ur,{value:f.platform,onValueChange:v,children:[n.jsx(or,{id:"platform",children:n.jsx(hr,{placeholder:"Select platform"})}),n.jsxs(lr,{children:[n.jsx(Fe,{value:"google",children:"Google Ads"}),n.jsx(Fe,{value:"facebook",children:"Facebook Ads"}),n.jsx(Fe,{value:"linkedin",children:"LinkedIn Ads"})]})]})]}),n.jsx("div",{className:"p-6 border rounded-md bg-gray-50 dark:bg-gray-800",children:n.jsx("p",{className:"text-center text-muted-foreground",children:"Additional ad group settings such as budget, bidding strategy, and targeting are managed through the platform's dashboard."})})]}),n.jsxs(Ct,{value:"ads",className:"space-y-6",children:[n.jsxs("div",{className:"flex justify-between items-center",children:[n.jsx("h3",{className:"text-lg font-medium",children:"Ad Variations"}),n.jsxs(te,{type:"button",onClick:x,className:"flex items-center",children:[n.jsx(La,{className:"h-4 w-4 mr-2"}),"Add Ad"]})]}),n.jsx("div",{className:"space-y-2",children:f.ads.length===0?n.jsxs("div",{className:"p-8 border rounded-md text-center",children:[n.jsx("p",{className:"text-muted-foreground mb-4",children:"No ads created yet"}),n.jsx(te,{onClick:x,children:"Create First Ad"})]}):n.jsx("div",{children:f.ads.map((M,I)=>f.platform==="google"?B(M,I):L(M,I))})})]}),n.jsx(Ct,{value:"preview",className:"space-y-6",children:f.ads.length===0?n.jsx("div",{className:"p-8 border rounded-md text-center",children:n.jsx("p",{className:"text-muted-foreground",children:"Create ads to see previews"})}):n.jsxs("div",{className:"space-y-6",children:[n.jsx("h3",{className:"text-lg font-medium",children:"Ad Previews"}),f.platform==="google"?n.jsx("div",{className:"space-y-4",children:f.ads.map((M,I)=>{var $,V,R;return n.jsxs("div",{className:"p-4 border rounded-md",children:[n.jsxs("div",{className:"text-blue-600 text-sm mb-1",children:["Ad · ",M.path||"example.com/path"]}),n.jsxs("div",{className:"text-[18px] text-blue-800 font-medium mb-1",children:[M.headlines&&(($=M.headlines[0])==null?void 0:$.text),M.headlines&&((V=M.headlines[1])==null?void 0:V.text)&&` | ${M.headlines[1].text}`]}),n.jsx("div",{className:"text-sm text-gray-600",children:M.descriptions&&((R=M.descriptions[0])==null?void 0:R.text)})]},I)})}):n.jsx("div",{className:"space-y-4",children:f.ads.map((M,I)=>n.jsxs("div",{className:"p-4 border rounded-md",children:[M.imageUrl&&n.jsx("div",{className:"w-full h-48 bg-gray-100 mb-3 rounded overflow-hidden",children:n.jsx("img",{src:M.imageUrl,alt:"Ad",className:"w-full h-full object-cover",onError:$=>{$.target.src="https://placehold.co/600x400?text=Image+Preview"}})}),n.jsx("div",{className:"text-sm text-blue-600 mb-1",children:"SPONSORED"}),n.jsx("div",{className:"font-bold mb-2",children:M.headline||"Ad Headline"}),n.jsx("div",{className:"text-sm mb-2",children:M.body||"Ad body text goes here."}),n.jsx("div",{className:"bg-blue-600 text-white text-center py-1 px-3 text-sm rounded w-32",children:M.cta||"Learn More"})]},I))})]})})]})}),n.jsxs(uo,{className:"flex justify-end space-x-2",children:[n.jsx(te,{type:"button",variant:"outline",onClick:r,children:"Cancel"}),n.jsx(te,{type:"submit",children:"Save Changes"})]})]})})})},Bft=[{id:"blog_post",displayName:"Blog Post",description:"A blog post with title, body, and optional media",renderer:aie,editor:_ft},{id:"social_post",displayName:"Social Post",description:"A social media post for platforms like Twitter, Facebook, etc.",renderer:Yht,editor:Sft},{id:"landing_page",displayName:"Landing Page",description:"A landing page with configurable sections",renderer:Jht,editor:kft},{id:"ad_group",displayName:"Ad Group",description:"A collection of ads for Google, Facebook, or LinkedIn campaigns",renderer:Nft,editor:Eft}];
1868Bft.forEach(e=>{qht(e)});function Tft({onRestoreClick:e}){return n.jsxs(Ar,{className:"mb-4",children:[n.jsx(nr,{className:"h-4 w-4"}),n.jsx(Wa,{children:"Viewing Historical Version"}),n.jsxs(gr,{className:"flex items-center justify-between",children:[n.jsx("span",{children:"You can only improve the current version. Restore this version first if you want to make improvements to it."}),n.jsx(te,{variant:"outline",size:"sm",onClick:e,className:"ml-4 whitespace-nowrap",children:"Restore Version"})]})]})}function Pft({isOpen:e,onConfirm:t,onCancel:r,isSaving:s=!1}){return n.jsx(Zt,{open:e,onOpenChange:r,children:n.jsxs(Jt,{children:[n.jsxs(_r,{children:[n.jsx(tr,{children:"Unsaved Changes"}),n.jsx(Hr,{children:"You have unsaved changes. What would you like to do?"})]}),n.jsxs(Sn,{className:"flex flex-col sm:flex-row gap-2",children:[n.jsx(te,{variant:"outline",onClick:r,disabled:s,children:"Cancel"}),n.jsx(te,{variant:"destructive",onClick:()=>t("discard"),disabled:s,children:"Discard Changes"}),n.jsx(te,{onClick:()=>t("save"),disabled:s,children:s?"Saving...":"Save & Exit"})]})]})})}function Mie({onEnhanceMedia:e,enhancingMedia:t=!1,className:r,variant:s="outline",size:a="default",platformPostType:i}){const o=h=>{e(h)},l=i?Bht(i):["image","video"],c=l.includes("image"),d=l.includes("video");return!!l.includes("none")||!c&&!d?null:n.jsxs(ll,{children:[n.jsx(cl,{asChild:!0,children:n.jsxs(te,{variant:s,size:a,className:r,disabled:t,children:[n.jsx(Ra,{className:"h-4 w-4 mr-2"}),t?"Enhancing...":"Enhance Media",!t&&n.jsx(Un,{className:"h-4 w-4 ml-2"})]})}),n.jsxs(fo,{align:"end",className:"w-48",children:[c&&n.jsxs(Fr,{onClick:()=>o("image"),disabled:t,children:[n.jsx(Ra,{className:"h-4 w-4 mr-2"}),"Enhance with Images"]}),d&&n.jsxs(Fr,{onClick:()=>o("video"),disabled:t,children:[n.jsx(fi,{className:"h-4 w-4 mr-2"}),"Enhance with Videos"]})]})]})}function $ie({content:e,editMode:t,versionNumber:r,isViewingOldVersion:s,onSaveEdit:a,onCancelEdit:i,onRestoreVersion:o,onExitEditRequest:l,onEnhanceMedia:c,enhancingMedia:d}){var j;const[u,h]=g.useState(!1),[m,f]=g.useState(!1),[p,A]=g.useState(!1),v=(j=e.content_json)==null?void 0:j.platform_post_type,x=N=>{h(N)},b=()=>{u?f(!0):i()},y=async N=>{if(N==="save"){A(!0);try{await a(),f(!1)}catch(_){console.error("Error saving:",_)}finally{A(!1)}}else f(!1),i()};oe.useEffect(()=>{l&&l(b)},[l]);const w=g.useMemo(()=>{var N;return!!((N=e==null?void 0:e.content_json)!=null&&N.bonus_metadata&&typeof e.content_json.bonus_metadata=="object")},[e]);return n.jsxs("div",{className:"flex flex-col flex-1 min-h-screen bg-gradient-to-br from-slate-50 via-white to-indigo-50/20 relative overflow-hidden",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),s&&n.jsx(Tft,{onRestoreClick:o}),n.jsx("div",{className:"flex-1 px-6 pb-6 pt-6 relative",children:n.jsxs("div",{className:"group relative overflow-hidden bg-gradient-to-br from-white via-indigo-50/30 to-purple-50/40 rounded-2xl border border-indigo-200/60 shadow-lg hover:shadow-2xl transition-all duration-500",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-indigo-50/30 via-transparent to-purple-50/20"}),n.jsx("div",{className:"absolute top-0 right-0 w-32 h-32 bg-gradient-to-br from-indigo-200/20 to-transparent rounded-full -translate-y-16 translate-x-16"}),n.jsx("div",{className:"relative",children:t?n.jsxs("div",{className:"flex flex-col",children:[c&&n.jsx("div",{className:"border-b p-4 bg-gray-50 dark:bg-gray-900 hidden",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Edit Tools"}),n.jsx(Mie,{onEnhanceMedia:c,enhancingMedia:d,platformPostType:v})]})}),n.jsx(Wht,{content:e,onSaved:a,onCancel:b,onUnsavedChanges:x})]}):n.jsx(nL,{content:e,versionNumber:r})})]})}),w&&n.jsx("div",{className:"flex-1 px-6 pb-6 relative",children:n.jsxs("div",{className:"group relative overflow-hidden bg-gradient-to-br from-amber-50/80 via-orange-50/60 to-white rounded-2xl border border-amber-200/60 shadow-lg hover:shadow-2xl transition-all duration-500",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-amber-50/30 via-trans
1868parent to-orange-50/20"}),n.jsx("div",{className:"absolute top-0 right-0 w-32 h-32 bg-gradient-to-br from-amber-200/20 to-transparent rounded-full -translate-y-16 translate-x-16"}),n.jsxs("div",{className:"relative",children:[n.jsxs("div",{className:"p-6 pb-4 border-b border-amber-100/50",children:[n.jsx("h3",{className:"text-xl font-bold bg-gradient-to-r from-amber-800 to-orange-700 bg-clip-text text-transparent",children:"Bonus Data"}),n.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Additional metadata to enhance your content"})]}),n.jsx("div",{className:"p-6",children:Object.entries(e.content_json.bonus_metadata).map(([N,_])=>n.jsxs("div",{className:"mb-8",children:[n.jsx("h4",{className:"font-medium mb-2",children:N.split("_").map(S=>S.charAt(0).toUpperCase()+S.slice(1)).join(" ")}),Ift(_)]},N))})]})]})}),n.jsx(Pft,{isOpen:m,onConfirm:y,onCancel:()=>f(!1),isSaving:p})]})}function Ift(e){return Array.isArray(e)?n.jsx("div",{className:"grid gap-4 grid-cols-1 sm:grid-cols-2 lg:grid-cols-3",children:e.map((t,r)=>n.jsxs("div",{className:"group relative overflow-hidden bg-white/60 backdrop-blur-sm rounded-xl border border-white/50 shadow-sm hover:shadow-md transition-all duration-300 hover:scale-105",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-amber-50/20 via-transparent to-orange-50/20 opacity-0 group-hover:opacity-100 transition-opacity duration-300"}),n.jsx("div",{className:"relative p-4",children:n.jsxs("div",{className:"flex justify-between items-start",children:[n.jsx("div",{className:"font-medium mt-1 text-gray-800",children:t}),n.jsx(te,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-full hover:bg-amber-100/50 transition-all duration-300 transform hover:scale-110",onClick:()=>{navigator.clipboard.writeText(t),He({title:"Copied!",description:"Text copied to clipboard"})},children:n.jsx(Cn,{className:"h-4 w-4 text-amber-600"})})]})})]},r))}):typeof e=="object"&&e!==null?n.jsx("div",{className:"space-y-6",children:Object.entries(e).map(([t,r])=>n.jsxs("div",{className:"space-y-3",children:[n.jsx("h5",{className:"font-medium",children:t.split("_").map(s=>s.charAt(0).toUpperCase()+s.slice(1)).join(" ")}),Oft(r)]},t))}):n.jsxs("div",{className:"group relative overflow-hidden bg-white/60 backdrop-blur-sm rounded-xl border border-white/50 shadow-sm hover:shadow-md transition-all duration-300",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-amber-50/20 via-transparent to-orange-50/20 opacity-0 group-hover:opacity-100 transition-opacity duration-300"}),n.jsx("div",{className:"relative p-4",children:n.jsxs("div",{className:"flex justify-between items-start",children:[n.jsx("p",{className:"pr-8 text-gray-800",children:String(e)}),n.jsx(te,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-full hover:bg-amber-100/50 transition-all duration-300 transform hover:scale-110",onClick:()=>
1868{navigator.clipboard.writeText(String(e)),He({title:"Copied!",description:"Text copied to clipboard"})},children:n.jsx(Cn,{className:"h-4 w-4 text-amber-600"})})]})})]})}function Oft(e){return typeof e=="string"?n.jsxs("div",{className:"group relative overflow-hidden bg-white/60 backdrop-blur-sm rounded-xl border border-white/50 shadow-sm hover:shadow-md transition-all duration-300",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-amber-50/20 via-transparent to-orange-50/20 opacity-0 group-hover:opacity-100 transition-opacity duration-300"}),n.jsx("div",{className:"relative p-4",children:n.jsxs("div",{className:"flex justify-between items-start",children:[n.jsx("p",{className:"pr-8 text-gray-800",children:e}),n.jsx(te,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-full hover:bg-amber-100/50 transition-all duration-300 transform hover:scale-110",onClick:()=>{navigator.clipboard.writeText(e),He({title:"Copied!",description:"Text copied to clipboard"})},children:n.jsx(Cn,{className:"h-4 w-4 text-amber-600"})})]})})]}):Array.isArray(e)?n.jsx("div",{className:"grid gap-4 grid-cols-1 sm:grid-cols-2 lg:grid-cols-3",children:e.map((t,r)=>n.jsxs("div",{className:"group relative overflow-hidden bg-white/60 backdrop-blur-sm rounded-xl border border-white/50 shadow-sm hover:shadow-md transition-all duration-300 hover:scale-105",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-amber-50/20 via-transparent to-orange-50/20 opacity-0 group-hover:opacity-100 transition-opacity duration-300"}),n.jsx("div",{className:"relative p-4",children:n.jsxs("div",{className:"flex justify-between items-start",children:[n.jsx("div",{className:"font-medium mt-1 text-gray-800",children:t}),n.jsx(te,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-full hover:bg-amber-100/50 transition-all duration-300 transform hover:scale-110",onClick:()=>{navigator.clipboard.writeText(t),He({title:"Copied!",description:"Text copied to clipboard"})},children:n.jsx(Cn,{className:"h-4 w-4 text-amber-600"})})]})})]},r))}):n.jsxs("div",{className:"group relative overflow-hidden bg-white/60 backdrop-blur-sm rounded-xl border border-white/50 shadow-sm hover:shadow-md transition-all duration-300",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-amber-50/20 via-transparent to-orange-50/20 opacity-0 group-hover:opacity-100 transition-opacity duration-300"}),n.jsx("div",{className:"relative p-4",children:n.jsxs("div",{className:"flex justify-between items-start",children:[n.jsx("pre",{className:"text-xs overflow-auto pr-8 text-gray-800",children:JSON.stringify(e,null,2)}),n.jsx(te,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-full hover:bg-amber-100/50 transition-all duration-300 transform hover:scale-110",onClick:()=>{navigator.clipboard.writeText(JSON.stringify(e,null,2)),He({title:"Copied!",description:"JSON copied to clipboard"})},children:n.jsx(Cn,{className:"h-4 w-4 text-amber-600"})})]})})]})}$ie.displayName="ContentPreview";function Fft({contentId:e,onVersionCreated:t,autoFocus:r,onFocused:s,onError:a}){const[i,o]=g.useState([{role:"assistant",content:"How can I help improve this content?"}]),[l,c]=g.useState(""),[d,u]=g.useState(!1),h=g.useRef(null),m=g.useRef(null),{session:f}=wa();g.useEffect(()=>{m.current&&m.current.scrollIntoView({behavior:"smooth"})},[i]),g.useEffect(()=>{r&&h.current&&(h.current.focus(),s==null||s())},[r,s]);const p=g.useCallback(b=>{o(y=>[...y,b])},[]),A=g.useCallback(async b=>{if((b.chat_response||b.chatResponse)&&p({role:"assistant",content:b.chat_response||b.chatResponse}),b.version_id)try{const{data:y,error:w}=await de.from("content_versions").select("version_number").eq("id",b.version_id).single();if(w)throw w;const j=y==null?void 0:y.version_number;j&&(t==null||t(j),setTimeout(()=>{o(N=>N.some(_=>_.role==="assistant"&&(_.content.includes(`version ${j}`)||_.content.includes("updated successfully")))?N:[...N])},100))}catch(y){console.error("Error getting version number:",y),t==null||t(0)}},[p,i,t]),v=async b=>{if(b.preventDefault(),!l.trim()||d)return;const y={role:"user",content:l};p(y),c(""),u(!0);try{const N=await fetch("https://worker.rainfactory.ai/rainfactory/content-functions/improve-content",{method:"POST",headers:{Authorization:`Bearer ${f==null?void 0:f.access_token}`,"Content-Type":"application/json",apikey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im9sZ25uZW5jY3F3d2JhaGNwc2duIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MjQxNjUyMDksImV4cCI6MjAzOTc0MTIwOX0.qUa9W4vEYLC7LaUPczpqHA9tp8NSiWB7POqOWEvJpYQ"},body:JSON.stringify({content_id:e,conversation:[...i,y]})});
1868if(!N.ok){let S="Failed to improve content";try{S=(await N.json()).error||S}catch{S=N.statusText||S}a==null||a(S),p({role:"assistant",content:`⚠️ ${S}. Please try again or rephrase your request.`}),He({title:"Error",description:S,variant:"destructive"});return}const _=await N.json();if(!_.data)throw new Error("Invalid response format");await A(_.data)}catch(w){console.error("Error improving content:",w);const j=(w==null?void 0:w.message)||"Failed to improve content";a==null||a(j),p({role:"assistant",content:`⚠️ ${j}. Please try again or contact support if the issue persists.`}),He({title:"Error",description:j,variant:"destructive"})}finally{u(!1)}},x=b=>{b.key==="Enter"&&!b.shiftKey&&(b.preventDefault(),l.trim()&&!d&&v(b))};return n.jsxs("div",{className:"flex flex-col h-full",children:[n.jsx(ol,{className:"flex-1 p-4 bg-gradient-to-br from-slate-50 to-white dark:from-slate-900 dark:to-slate-800",children:n.jsxs("div",{className:"space-y-4",children:[i.map((b,y)=>n.jsx("div",{className:`flex ${b.role==="assistant"?"justify-start":"justify-end"}`,children:n.jsx("div",{className:`rounded-lg px-4 py-2 max-w-[85%] shadow-sm ${b.role==="assistant"?"bg-white dark:bg-slate-800 border border-slate-200 dark:border-slate-700":"bg-primary text-primary-foreground"}`,children:b.content.split(`
1869`).map((w,j)=>n.jsxs("span",{children:[w,j!==b.content.split(`
1870`).length-1&&n.jsx("br",{})]},j))})},y)),d&&n.jsx("div",{className:"flex justify-start",children:n.jsxs(ut.div,{className:"bg-white dark:bg-slate-800 border border-slate-200 dark:border-slate-700 rounded-lg px-4 py-2 flex items-center gap-2 shadow-sm",initial:{opacity:0,y:10},animate:{opacity:1,y:0,transition:{duration:.3,ease:"easeOut"}},children:[n.jsx(ut.div,{animate:{y:[0,-4,0]},transition:{duration:1.5,repeat:1/0,ease:"easeInOut"},className:"w-2 h-2 bg-primary rounded-full"}),n.jsx(ut.div,{animate:{y:[0,-4,0]},transition:{duration:1.5,repeat:1/0,ease:"easeInOut",delay:.2},className:"w-2 h-2 bg-primary rounded-full"}),n.jsx(ut.div,{animate:{y:[0,-4,0]},transition:{duration:1.5,repeat:1/0,ease:"easeInOut",delay:.4},className:"w-2 h-2 bg-primary rounded-full"}),n.jsx("span",{className:"text-foreground",children:"Thinking..."})]})}),n.jsx("div",{ref:m})]})}),n.jsxs("form",{onSubmit:v,className:"p-4 border-t bg-background",children:[n.jsxs("div",{className:"flex gap-2",children:[n.jsx(qe,{value:l,onChange:b=>c(b.target.value),onKeyDown:x,placeholder:"Type your message...",disabled:d,ref:h,className:"border-slate-200 dark:border-slate-700"}),n.jsx(te,{type:"submit",disabled:d,children:"Send"})]}),n.jsxs("div",{className:"mt-2 text-xs text-muted-foreground flex items-center",children:[n.jsx(nr,{className:"h-3 w-3 mr-1"}),"Hint: Ask specific questions about the content or request improvements"]})]})]})}const pk=g.createContext(null);pk.displayName="PanelGroupContext";const Qs={group:"data-panel-group",groupDirection:"data-panel-group-direction",groupId:"data-panel-group-id",panel:"data-panel",panelCollapsible:"data-panel-collapsible",panelId:"data-panel-id",panelSize:"data-panel-size",resizeHandle:"data-resize-handle",resizeHandleActive:"data-resize-handle-active",resizeHandleEnabled:"data-panel-resize-handle-enabled",resizeHandleId:"data-panel-resize-handle-id",resizeHandleState:"data-resize-handle-state"},sL=10,km=g.useLayoutEffect,sV=Qv.useId,Lft=typeof sV=="function"?sV:()=>null;let Dft=0;function aL(e=null){const t=Lft(),r=g.useRef(e||t||null);return r.current===null&&(r.current=""+Dft++),e??r.current}function Qie({children:e,className:t="",collapsedSize:r,collapsible:s,defaultSize:a,forwardedRef:i,id:o,maxSize:l,minSize:c,onCollapse:d,onExpand:u,onResize:h,order:m,style:f,tagName:p="div",...A}){const v=g.useContext(pk);if(v===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:x,expandPanel:b,getPanelSize:y,getPanelStyle:w,groupId:j,isPanelCollapsed:N,reevaluatePanelConstraints:_,registerPanel:S,resizePanel:C,unregisterPanel:E}=v,T=aL(o),B=g.useRef({callbacks:{onCollapse:d,onExpand:u,onResize:h},constraints:{collapsedSize:r,collapsible:s,defaultSize:a,maxSize:l,minSize:c},id:T,idIsFromProps:o!==void 0,order:m});g.useRef({didLogMissingDefaultSizeWarning:!1}),km(()=>{const{callbacks:P,constraints:F}=B.current,M={...F};B.current.id=T,B.current.idIsFromProps=o!==void 0,B.current.order=m,P.onCollapse=d,P.onExpand=u,P.onResize=h,F.collapsedSize=r,F.collapsible=s,F.defaultSize=a,F.maxSize=l,F.minSize=c,(M.collapsedSize!==F.collapsedSize||M.collapsible!==F.collapsible||M.maxSize!==F.maxSize||M.minSize!==F.minSize)&&_(B.current,M)}),km(()=>{const P=B.current;return S(P),()=>{E(P)}},[m,T,S,E]),g.useImperativeHandle(i,()=>({collapse:()=>{x(B.current)},expand:P=>{b(B.current,P)},getId(){return T},getSize(){return y(B.current)},isCollapsed(){return N(B.current)},isExpanded(){return!N(B.current)},resize:P=>{C(B.current,P)}}),[x,b,y,N,T,C]);const L=w(B.current,a);return g.createElement(p,{...A,children:e,className:t,id:T,style:{...L,...f},[Qs.groupId]:j,[Qs.panel]:"",[Qs.panelCollapsible]:s||void 0,[Qs.panelId]:T,[Qs.panelSize]:parseFloat(""+L.flexGrow).toFixed(1)})}const Hie=g.forwardRef((e,t)=>
1870g.createElement(Qie,{...e,forwardedRef:t}));Qie.displayName="Panel";Hie.displayName="forwardRef(Panel)";let GP=null,Gj=-1,jh=null;function Rft(e,t){if(t){const r=(t&Kie)!==0,s=(t&Wie)!==0,a=(t&Yie)!==0,i=(t&Jie)!==0;if(r)return a?"se-resize":i?"ne-resize":"e-resize";if(s)return a?"sw-resize":i?"nw-resize":"w-resize";if(a)return"s-resize";if(i)return"n-resize"}switch(e){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}function Uft(){jh!==null&&(document.head.removeChild(jh),GP=null,jh=null,Gj=-1)}function A4(e,t){var r,s;const a=Rft(e,t);if(GP!==a){if(GP=a,jh===null&&(jh=document.createElement("style"),document.head.appendChild(jh)),Gj>=0){var i;(i=jh.sheet)===null||i===void 0||i.removeRule(Gj)}Gj=(r=(s=jh.sheet)===null||s===void 0?void 0:s.insertRule(`*{cursor: ${a} !important;}`))!==null&&r!==void 0?r:-1}}function zie(e){return e.type==="keydown"}function Vie(e){return e.type.startsWith("pointer")}function Gie(e){return e.type.startsWith("mouse")}function Ak(e){if(Vie(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if(Gie(e))return{x:e.clientX,y:e.clientY};return{x:1/0,y:1/0}}function Mft(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function $ft(e,t,r){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function Qft(e,t){if(e===t)throw new Error("Cannot compare node with itself");const r={a:oV(e),b:oV(t)};let s;for(;r.a.at(-1)===r.b.at(-1);)e=r.a.pop(),t=r.b.pop(),s=e;$r(s,"Stacking order can only be calculated for elements with a common ancestor");const a={a:iV(aV(r.a)),b:iV(aV(r.b))};if(a.a===a.b){const i=s.childNodes,o={a:r.a.at(-1),b:r.b.at(-1)};let l=i.length;for(;l--;){const c=i[l];if(c===o.a)return 1;if(c===o.b)return-1}}return Math.sign(a.a-a.b)}const Hft=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function zft(e){var t;const r=getComputedStyle((t=qie(e))!==null&&t!==void 0?t:e).display;return r==="flex"||r==="inline-flex"}function Vft(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||zft(e))||+t.opacity<1||"transform"in t&&t.transform!=="none"||"webkitTransform"in t&&t.webkitTransform!=="none"||"mixBlendMode"in t&&t.mixBlendMode!=="normal"||"filter"in t&&t.filter!=="none"||"webkitFilter"in t&&t.webkitFilter!=="none"||"isolation"in t&&t.isolation==="isolate"||Hft.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function aV(e){let t=e.length;for(;t--;){const r=e[t];if($r(r,"Missing node"),Vft(r))return r}return null}function iV(e){return e&&Number(getComputedStyle(e).zIndex)||0}function oV(e){const t=[];for(;e;)t.push(e),e=qie(e);return t}function qie(e){const{parentNode:t}=e;return t&&t instanceof ShadowRoot?t.host:t}const Kie=1,Wie=2,Yie=4,Jie=8,Gft=Mft()==="coarse";let jc=[],VA=!1,sm=new Map,gk=new Map;const gy=new Set;function qft(e,t,r,s,a){var i;const{ownerDocument:o}=t,l={direction:r,element:t,hitAreaMargins:s,setResizeHandlerState:a},c=(i=sm.get(o))!==null&&i!==void 0?i:0;return sm.set(o,c+1),gy.add(l),v_(),function(){var u;gk.delete(e),gy.delete(l);const h=(u=sm.get(o))!==null&&u!==void 0?u:1;if(sm.set(o,h-1),v_(),h===1&&sm.delete(o),jc.includes(l)){const m=jc.indexOf(l);m>=0&&jc.splice(m,1),oL(),a("up",!0,null)}}}function Kft(e){const{target:t}=e,{x:r,y:s}=Ak(e);VA=!0,iL({target:t,x:r,y:s}),v_(),jc.length>0&&(b_("down",e),e.preventDefault(),Xie(t)||e.stopImmediatePropagation())}function g4(e){const{x:t,y:r}=Ak(e);if(VA&&e.buttons===0&&(VA=!1,b_("up",e)),!VA){const{target:s}=e;iL({target:s,x:t,y:r})}b_("move",e),oL(),jc.length>0&&e.preventDefault()}function x4(e){const{target:t}=e,{x:r,y:s}=Ak(e);gk.clear(),VA=!1,jc.length>0&&(e.preventDefault(),Xie(t)||e.stopImmediatePropagation()),b_("up",e),iL({target:t,x:r,y:s}),oL(),v_()}function Xie(e){let t=e;for(;t;){if(t.hasAttribute(Qs.resizeHandle))return!0;t=t.parentElement}return!1}function iL({target:e,x:t,y:r}){jc.splice(0);let s=null;(e instanceof HTMLElement||e instanceof SVGElement)&&(s=e),gy.forEach(a=>{const{element:i,hitAreaMargins:o}=a,l=i.getBoundingClientRect(),{bottom:c,left:d,right:u,top:h}=l,m=Gft?o.coarse:o.fine;if(t>=d-m&&t<=u+m&&r>=h-m&&r<=c+m){if(s!==null&&document.contains(s)&&i!==s&&!i.contains(s)&&!s.contains(i)&&Qft(s,i)>0){let p=s,A=!1;for(;p&&!p.contains(i);){if($ft(p.getBoundingClientRect(),l)){A=!0;break}p=p.parentElement}if(A)return}jc.push(a)}})}function v4(e,t){gk.set(e,t)}function oL(){let e=!1,t=!1;jc.forEach(s=>{const{direction:a}=s;a==="horizontal"?e=!0:t=!0});let r=0;
1870gk.forEach(s=>{r|=s}),e&&t?A4("intersection",r):e?A4("horizontal",r):t?A4("vertical",r):Uft()}let b4=new AbortController;function v_(){b4.abort(),b4=new AbortController;const e={capture:!0,signal:b4.signal};gy.size&&(VA?(jc.length>0&&sm.forEach((t,r)=>{const{body:s}=r;t>0&&(s.addEventListener("contextmenu",x4,e),s.addEventListener("pointerleave",g4,e),s.addEventListener("pointermove",g4,e))}),window.addEventListener("pointerup",x4,e),window.addEventListener("pointercancel",x4,e)):sm.forEach((t,r)=>{const{body:s}=r;t>0&&(s.addEventListener("pointerdown",Kft,e),s.addEventListener("pointermove",g4,e))}))}function b_(e,t){gy.forEach(r=>{const{setResizeHandlerState:s}=r,a=jc.includes(r);s(e,a,t)})}function Wft(){const[e,t]=g.useState(0);return g.useCallback(()=>t(r=>r+1),[])}function $r(e,t){if(!e)throw console.error(t),Error(t)}function Ym(e,t,r=sL){return e.toFixed(r)===t.toFixed(r)?0:e>t?1:-1}function ou(e,t,r=sL){return Ym(e,t,r)===0}function Ro(e,t,r){return Ym(e,t,r)===0}function Yft(e,t,r){if(e.length!==t.length)return!1;for(let s=0;s<e.length;s++){const a=e[s],i=t[s];if(!Ro(a,i,r))return!1}return!0}function CA({panelConstraints:e,panelIndex:t,size:r}){const s=e[t];$r(s!=null,`Panel constraints not found for index ${t}`);let{collapsedSize:a=0,collapsible:i,maxSize:o=100,minSize:l=0}=s;if(Ym(r,l)<0)if(i){const c=(a+l)/2;Ym(r,c)<0?r=a:r=l}else r=l;return r=Math.min(o,r),r=parseFloat(r.toFixed(sL)),r}function lv({delta:e,initialLayout:t,panelConstraints:r,pivotIndices:s,prevLayout:a,trigger:i}){if(Ro(e,0))return t;const o=[...t],[l,c]=s;$r(l!=null,"Invalid first pivot index"),$r(c!=null,"Invalid second pivot index");let d=0;if(i==="keyboard"){{const h=e<0?c:l,m=r[h];$r(m,`Panel constraints not found for index ${h}`);const{collapsedSize:f=0,collapsible:p,minSize:A=0}=m;if(p){const v=t[h];if($r(v!=null,`Previous layout not found for panel index ${h}`),Ro(v,f)){const x=A-v;Ym(x,Math.abs(e))>0&&(e=e<0?0-x:x)}}}{const h=e<0?l:c,m=r[h];$r(m,`No panel constraints found for index ${h}`);const{collapsedSize:f=0,collapsible:p,minSize:A=0}=m;if(p){const v=t[h];if($r(v!=null,`Previous layout not found for panel index ${h}`),Ro(v,A)){const x=v-f;Ym(x,Math.abs(e))>0&&(e=e<0?0-x:x)}}}}{const h=e<0?1:-1;let m=e<0?c:l,f=0;for(;;){const A=t[m];$r(A!=null,`Previous layout not found for panel index ${m}`);const x=CA({panelConstraints:r,panelIndex:m,size:100})-A;if(f+=x,m+=h,m<0||m>=r.length)break}const p=Math.min(Math.abs(e),Math.abs(f));e=e<0?0-p:p}{let m=e<0?l:c;for(;m>=0&&m<r.length;){const f=Math.abs(e)-Math.abs(d),p=t[m];$r(p!=null,`Previous layout not found for panel index ${m}`);const A=p-f,v=CA({panelConstraints:r,panelIndex:m,size:A});if(!Ro(p,v)&&(d+=p-v,o[m]=v,d.toPrecision(3).localeCompare(Math.abs(e).toPrecision(3),void 0,{numeric:!0})>=0))break;e<0?m--:m++}}if(Yft(a,o))return a;{const h=e<0?c:l,m=t[h];$r(m!=null,`Previous layout not found for panel index ${h}`);const f=m+d,p=CA({panelConstraints:r,panelIndex:h,size:f});if(o[h]=p,!Ro(p,f)){let A=f-p,x=e<0?c:l;for(;x>=0&&x<r.length;){const b=o[x];$r(b!=null,`Previous layout not found for panel index ${x}`);const y=b+A,w=CA({panelConstraints:r,panelIndex:x,size:y});if(Ro(b,w)||(A-=w-b,o[x]=w),Ro(A,0))break;e>0?x--:x++}}}const u=o.reduce((h,m)=>m+h,0);return Ro(u,100)?o:a}function Jft({layout:e,panelsArray:t,pivotIndices:r}){let s=0,a=100,i=0,o=0;const l=r[0];$r(l!=null,"No pivot index found"),t.forEach((h,m)=>{const{constraints:f}=h,{maxSize:p=100,minSize:A=0}=f;m===l?(s=A,a=p):(i+=A,o+=p)});const c=Math.min(a,100-i),d=Math.max(s,100-o),u=e[l];return{valueMax:c,valueMin:d,valueNow:u}}function xy(e,t=document){return Array.from(t.querySelectorAll(`[${Qs.resizeHandleId}][data-panel-group-id="${e}"]`))}function Zie(e,t,r=document){const a=xy(e,r).findIndex(i=>i.getAttribute(Qs.resizeHandleId)===t);return a??null}function eoe(e,t,r){const s=Zie(e,t,r);return s!=null?[s,s+1]:[-1,-1]}function toe(e,t=document){var r;if(t instanceof HTMLElement&&(t==null||(r=t.dataset)===null||r===void 0?void 0:r.panelGroupId)==e)return t;
1870const s=t.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`);return s||null}function xk(e,t=document){const r=t.querySelector(`[${Qs.resizeHandleId}="${e}"]`);return r||null}function Xft(e,t,r,s=document){var a,i,o,l;const c=xk(t,s),d=xy(e,s),u=c?d.indexOf(c):-1,h=(a=(i=r[u])===null||i===void 0?void 0:i.id)!==null&&a!==void 0?a:null,m=(o=(l=r[u+1])===null||l===void 0?void 0:l.id)!==null&&o!==void 0?o:null;return[h,m]}function Zft({committedValuesRef:e,eagerValuesRef:t,groupId:r,layout:s,panelDataArray:a,panelGroupElement:i,setLayout:o}){g.useRef({didWarnAboutMissingResizeHandle:!1}),km(()=>{if(!i)return;const l=xy(r,i);for(let c=0;c<a.length-1;c++){const{valueMax:d,valueMin:u,valueNow:h}=Jft({layout:s,panelsArray:a,pivotIndices:[c,c+1]}),m=l[c];if(m!=null){const f=a[c];$r(f,`No panel data found for index "${c}"`),m.setAttribute("aria-controls",f.id),m.setAttribute("aria-valuemax",""+Math.round(d)),m.setAttribute("aria-valuemin",""+Math.round(u)),m.setAttribute("aria-valuenow",h!=null?""+Math.round(h):"")}}return()=>{l.forEach((c,d)=>{c.removeAttribute("aria-controls"),c.removeAttribute("aria-valuemax"),c.removeAttribute("aria-valuemin"),c.removeAttribute("aria-valuenow")})}},[r,s,a,i]),g.useEffect(()=>{if(!i)return;const l=t.current;$r(l,"Eager values not found");const{panelDataArray:c}=l,d=toe(r,i);$r(d!=null,`No group found for id "${r}"`);const u=xy(r,i);$r(u,`No resize handles found for group id "${r}"`);const h=u.map(m=>{const f=m.getAttribute(Qs.resizeHandleId);$r(f,"Resize handle element has no handle id attribute");const[p,A]=Xft(r,f,c,i);if(p==null||A==null)return()=>{};const v=x=>{if(!x.defaultPrevented)switch(x.key){case"Enter":{x.preventDefault();const b=c.findIndex(y=>y.id===p);if(b>=0){const y=c[b];$r(y,`No panel data found for index ${b}`);const w=s[b],{collapsedSize:j=0,collapsible:N,minSize:_=0}=y.constraints;if(w!=null&&N){const S=lv({delta:Ro(w,j)?_-j:j-w,initialLayout:s,panelConstraints:c.map(C=>C.constraints),pivotIndices:eoe(r,f,i),prevLayout:s,trigger:"keyboard"});s!==S&&o(S)}}break}}};return m.addEventListener("keydown",v),()=>{m.removeEventListener("keydown",v)}});return()=>{h.forEach(m=>m())}},[i,e,t,r,s,a,o])}function lV(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}function roe(e,t){const r=e==="horizontal",{x:s,y:a}=Ak(t);return r?s:a}function emt(e,t,r,s,a){const i=r==="horizontal",o=xk(t,a);$r(o,`No resize handle element found for id "${t}"`);const l=o.getAttribute(Qs.groupId);$r(l,"Resize handle element has no group id attribute");let{initialCursorPosition:c}=s;const d=roe(r,e),u=toe(l,a);$r(u,`No group element found for id "${l}"`);const h=u.getBoundingClientRect(),m=i?h.width:h.height;return(d-c)/m*100}function tmt(e,t,r,s,a,i){if(zie(e)){const o=r==="horizontal";let l=0;e.shiftKey?l=100:a!=null?l=a:l=10;let c=0;switch(e.key){case"ArrowDown":c=o?0:l;break;case"ArrowLeft":c=o?-l:0;break;case"ArrowRight":c=o?l:0;break;case"ArrowUp":c=o?0:-l;break;case"End":c=100;break;case"Home":c=-100;break}return c}else return s==null?0:emt(e,t,r,s,i)}function rmt({panelDataArray:e}){const t=Array(e.length),r=e.map(i=>i.constraints);let s=0,a=100;for(let i=0;i<e.length;i++){const o=r[i];$r(o,`Panel constraints not found for index ${i}`);const{defaultSize:l}=o;l!=null&&(s++,t[i]=l,a-=l)}for(let i=0;i<e.length;i++){const o=r[i];$r(o,`Panel constraints not found for index ${i}`);const{defaultSize:l}=o;if(l!=null)continue;const c=e.length-s,d=a/c;s++,t[i]=d,a-=d}return t}function Jp(e,t,r){t.forEach((s,a)=>{const i=e[a];$r(i,`Panel data not found for index ${a}`);const{callbacks:o,constraints:l,id:c}=i,{collapsedSize:d=0,collapsible:u}=l,h=r[c];if(h==null||s!==h){r[c]=s;const{onCollapse:m,onExpand:f,onResize:p}=o;p&&p(s,h),u&&(m||f)&&(f&&(h==null||ou(h,d))&&!ou(s,d)&&f(),m&&(h==null||!ou(h,d))&&ou(s,d)&&m())}})}function lj(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!=t[r])return!1;return!0}function nmt({defaultSize:e,dragState:t,layout:r,panelData:s,panelIndex:a,precision:i=3}){const o=r[a];let l;return o==null?l=e!=null?e.toPrecision(i):"1":s.length===1?l="1":l=o.toPrecision(i),{flexBasis:0,flexGrow:l,flexShrink:1,overflow:"hidden",pointerEvents:t!==null?"none":void 0}}function smt(e,t=10){let r=null;return(...a)=>{r!==null&&clearTimeout(r),r=setTimeout(()=>{e(...a)},t)}}function cV(e){try{if(typeof localStorage<"u")e.getItem=t=>localStorage.getItem(t),e.setItem=(t,r)=>{localStorage.setItem(t,r)};else throw new Error("localStorage not supported in this environment")}catch(t){console.error(t),e.getItem=()=>null,e.setItem=()=>{}}}function noe(e){return`react-resizable-panels:${e}`}function soe(e){return e.map(t=>{const{constraints:r,id:s,idIsFromProps:a,order:i}=t;return a?s:i?`${i}:${JSON.stringify(r)}`:JSON.stringify(r)}).sort((t,r)=>t.localeCompare(r)).join(",")}function aoe(e,t){try{const r=noe(e),s=t.getItem(r);if(s){const a=JSON.parse(s);if(typeof a=="object"&&a!=null)return a}}catch{}return null}function amt(e,t,r){var s,a;const i=(s=aoe(e,r))!==null&&s!==void 0?s:{},o=soe(t);return(a=i[o])!==null&&a!==void 0?a:null}function imt(e,t,r,s,a){var i;const o=noe(e),l=soe(t),c=(i=aoe(e,a))!==null&&i!==void 0?i:{};c[l]={expandToSizes:Object.fromEntries(r.entries()),layout:s};try{a.setItem(o,JSON.stringify(c))}catch(d){console.error(d)}}function dV({layout:e,panelConstraints:t}){const r=[...e],s=r.reduce((i,o)=>i+o,0);if(r.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${r.map(i=>`${i}%`).join(", ")}`);
1870if(!Ro(s,100)&&r.length>0)for(let i=0;i<t.length;i++){const o=r[i];$r(o!=null,`No layout data found for index ${i}`);const l=100/s*o;r[i]=l}let a=0;for(let i=0;i<t.length;i++){const o=r[i];$r(o!=null,`No layout data found for index ${i}`);const l=CA({panelConstraints:t,panelIndex:i,size:o});o!=l&&(a+=o-l,r[i]=l)}if(!Ro(a,0))for(let i=0;i<t.length;i++){const o=r[i];$r(o!=null,`No layout data found for index ${i}`);const l=o+a,c=CA({panelConstraints:t,panelIndex:i,size:l});if(o!==c&&(a-=c-o,r[i]=c,Ro(a,0)))break}return r}const omt=100,cv={getItem:e=>(cV(cv),cv.getItem(e)),setItem:(e,t)=>{cV(cv),cv.setItem(e,t)}},uV={};function ioe({autoSaveId:e=null,children:t,className:r="",direction:s,forwardedRef:a,id:i=null,onLayout:o=null,keyboardResizeBy:l=null,storage:c=cv,style:d,tagName:u="div",...h}){const m=aL(i),f=g.useRef(null),[p,A]=g.useState(null),[v,x]=g.useState([]),b=Wft(),y=g.useRef({}),w=g.useRef(new Map),j=g.useRef(0),N=g.useRef({autoSaveId:e,direction:s,dragState:p,id:m,keyboardResizeBy:l,onLayout:o,storage:c}),_=g.useRef({layout:v,panelDataArray:[],panelDataArrayChanged:!1});g.useRef({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),g.useImperativeHandle(a,()=>({getId:()=>N.current.id,getLayout:()=>{const{layout:D}=_.current;return D},setLayout:D=>{const{onLayout:q}=N.current,{layout:G,panelDataArray:Y}=_.current,K=dV({layout:D,panelConstraints:Y.map(X=>X.constraints)});lV(G,K)||(x(K),_.current.layout=K,q&&q(K),Jp(Y,K,y.current))}}),[]),km(()=>{N.current.autoSaveId=e,N.current.direction=s,N.current.dragState=p,N.current.id=m,N.current.onLayout=o,N.current.storage=c}),Zft({committedValuesRef:N,eagerValuesRef:_,groupId:m,layout:v,panelDataArray:_.current.panelDataArray,setLayout:x,panelGroupElement:f.current}),g.useEffect(()=>{const{panelDataArray:D}=_.current;if(e){if(v.length===0||v.length!==D.length)return;let q=uV[e];q==null&&(q=smt(imt,omt),uV[e]=q);const G=[...D],Y=new Map(w.current);q(e,G,Y,v,c)}},[e,v,c]),g.useEffect(()=>{});const S=g.useCallback(D=>{const{onLayout:q}=N.current,{layout:G,panelDataArray:Y}=_.current;if(D.constraints.collapsible){const K=Y.map(J=>J.constraints),{collapsedSize:X=0,panelSize:ne,pivotIndices:ae}=Mf(Y,D,G);if($r(ne!=null,`Panel size not found for panel "${D.id}"`),!ou(ne,X)){w.current.set(D.id,ne);const W=dA(Y,D)===Y.length-1?ne-X:X-ne,ie=lv({delta:W,initialLayout:G,panelConstraints:K,pivotIndices:ae,prevLayout:G,trigger:"imperative-api"});lj(G,ie)||(x(ie),_.current.layout=ie,q&&q(ie),Jp(Y,ie,y.current))}}},[]),C=g.useCallback((D,q)=>{const{onLayout:G}=N.current,{layout:Y,panelDataArray:K}=_.current;if(D.constraints.collapsible){const X=K.map(he=>he.constraints),{collapsedSize:ne=0,panelSize:ae=0,minSize:J=0,pivotIndices:W}=Mf(K,D,Y),ie=q??J;if(ou(ae,ne)){const he=w.current.get(D.id),ee=he!=null&&he>=ie?he:ie,we=dA(K,D)===K.length-1?ae-ee:ee-ae,Se=lv({delta:we,initialLayout:Y,panelConstraints:X,pivotIndices:W,prevLayout:Y,trigger:"imperative-api"});lj(Y,Se)||(x(Se),_.current.layout=Se,G&&G(Se),Jp(K,Se,y.current))}}},[]),E=g.useCallback(D=>{const{layout:q,panelDataArray:G}=_.current,{panelSize:Y}=Mf(G,D,q);return $r(Y!=null,`Panel size not found for panel "${D.id}"`),Y},[]),T=g.useCallback((D,q)=>{const{panelDataArray:G}=_.current,Y=dA(G,D);return nmt({defaultSize:q,dragState:p,layout:v,panelData:G,panelIndex:Y})},[p,v]),B=g.useCallback(D=>{const{layout:q,panelDataArray:G}=_.current,{collapsedSize:Y=0,collapsible:K,panelSize:X}=Mf(G,D,q);return $r(X!=null,`Panel size not found for panel "${D.id}"`),K===!0&&ou(X,Y)},[]),L=g.useCallback(D=>{const{layout:q,panelDataArray:G}=_.current,{collapsedSize:Y=0,collapsible:K,panelSize:X}=Mf(G,D,q);return $r(X!=null,`Panel size not found for panel "${D.id}"`),!K||Ym(X,Y)>0},[]),P=g.useCallback(D=>{const{panelDataArray:q}=_.current;q.push(D),q.sort((G,Y)=>{const K=G.order,X=Y.order;return K==null&&X==null?0:K==null?-1:X==null?1:K-X}),_.current.panelDataArrayChanged=!0,b()},[b]);km(()=>{if(_.current.panelDataArrayChanged){_.current.panelDataArrayChanged=!1;const{autoSaveId:D,onLayout:q,storage:G}=N.current,{layout:Y,panelDataArray:K}=_.current;let X=null;if(D){const ae=amt(D,K,G);
1870ae&&(w.current=new Map(Object.entries(ae.expandToSizes)),X=ae.layout)}X==null&&(X=rmt({panelDataArray:K}));const ne=dV({layout:X,panelConstraints:K.map(ae=>ae.constraints)});lV(Y,ne)||(x(ne),_.current.layout=ne,q&&q(ne),Jp(K,ne,y.current))}}),km(()=>{const D=_.current;return()=>{D.layout=[]}},[]);const F=g.useCallback(D=>{let q=!1;const G=f.current;return G&&window.getComputedStyle(G,null).getPropertyValue("direction")==="rtl"&&(q=!0),function(K){K.preventDefault();const X=f.current;if(!X)return()=>null;const{direction:ne,dragState:ae,id:J,keyboardResizeBy:W,onLayout:ie}=N.current,{layout:he,panelDataArray:ee}=_.current,{initialLayout:xe}=ae??{},we=eoe(J,D,X);let Se=tmt(K,D,ne,ae,W,X);const pe=ne==="horizontal";pe&&q&&(Se=-Se);const Ce=ee.map(Ae=>Ae.constraints),re=lv({delta:Se,initialLayout:xe??he,panelConstraints:Ce,pivotIndices:we,prevLayout:he,trigger:zie(K)?"keyboard":"mouse-or-touch"}),se=!lj(he,re);(Vie(K)||Gie(K))&&j.current!=Se&&(j.current=Se,!se&&Se!==0?pe?v4(D,Se<0?Kie:Wie):v4(D,Se<0?Yie:Jie):v4(D,0)),se&&(x(re),_.current.layout=re,ie&&ie(re),Jp(ee,re,y.current))}},[]),M=g.useCallback((D,q)=>{const{onLayout:G}=N.current,{layout:Y,panelDataArray:K}=_.current,X=K.map(he=>he.constraints),{panelSize:ne,pivotIndices:ae}=Mf(K,D,Y);$r(ne!=null,`Panel size not found for panel "${D.id}"`);const W=dA(K,D)===K.length-1?ne-q:q-ne,ie=lv({delta:W,initialLayout:Y,panelConstraints:X,pivotIndices:ae,prevLayout:Y,trigger:"imperative-api"});lj(Y,ie)||(x(ie),_.current.layout=ie,G&&G(ie),Jp(K,ie,y.current))},[]),I=g.useCallback((D,q)=>{const{layout:G,panelDataArray:Y}=_.current,{collapsedSize:K=0,collapsible:X}=q,{collapsedSize:ne=0,collapsible:ae,maxSize:J=100,minSize:W=0}=D.constraints,{panelSize:ie}=Mf(Y,D,G);ie!=null&&(X&&ae&&ou(ie,K)?ou(K,ne)||M(D,ne):ie<W?M(D,W):ie>J&&M(D,J))},[M]),$=g.useCallback((D,q)=>{const{direction:G}=N.current,{layout:Y}=_.current;if(!f.current)return;const K=xk(D,f.current);$r(K,`Drag handle element not found for id "${D}"`);const X=roe(G,q);A({dragHandleId:D,dragHandleRect:K.getBoundingClientRect(),initialCursorPosition:X,initialLayout:Y})},[]),V=g.useCallback(()=>{A(null)},[]),R=g.useCallback(D=>{const{panelDataArray:q}=_.current,G=dA(q,D);G>=0&&(q.splice(G,1),delete y.current[D.id],_.current.panelDataArrayChanged=!0,b())},[b]),Q=g.useMemo(()=>({collapsePanel:S,direction:s,dragState:p,expandPanel:C,getPanelSize:E,getPanelStyle:T,groupId:m,isPanelCollapsed:B,isPanelExpanded:L,reevaluatePanelConstraints:I,registerPanel:P,registerResizeHandle:F,resizePanel:M,startDragging:$,stopDragging:V,unregisterPanel:R,panelGroupElement:f.current}),[S,p,s,C,E,T,m,B,L,I,P,F,M,$,V,R]),U={display:"flex",flexDirection:s==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return g.createElement(pk.Provider,{value:Q},g.createElement(u,{...h,children:t,className:r,id:i,ref:f,style:{...U,...d},[Qs.group]:"",[Qs.groupDirection]:s,[Qs.groupId]:m}))}const ooe=g.forwardRef((e,t)=>g.createElement(ioe,{...e,forwardedRef:t}));ioe.displayName="PanelGroup";ooe.displayName="forwardRef(PanelGroup)";function dA(e,t){return e.findIndex(r=>r===t||r.id===t.id)}function Mf(e,t,r){const s=dA(e,t),i=s===e.length-1?[s-1,s]:[s,s+1],o=r[s];return{...t.constraints,panelSize:o,pivotIndices:i}}function lmt({disabled:e,handleId:t,resizeHandler:r,panelGroupElement:s}){g.useEffect(()=>{if(e||r==null||s==null)return;const a=xk(t,s);if(a==null)return;const i=o=>{if(!o.defaultPrevented)switch(o.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{o.preventDefault(),r(o);break}case"F6":{o.preventDefault();const l=a.getAttribute(Qs.groupId);$r(l,`No group element found for id "${l}"`);const c=xy(l,s),d=Zie(l,t,s);$r(d!==null,`No resize element found for id "${t}"`);const u=o.shiftKey?d>0?d-1:c.length-1:d+1<c.length?d+1:0;c[u].focus();break}}};return a.addEventListener("keydown",i),()=>{a.removeEventListener("keydown",i)}},[s,e,t,r])}function loe({children:e=null,className:t="",disabled:r=!1,hitAreaMargins:s,id:a,onBlur:i,onClick:o,onDragging:l,onFocus:c,onPointerDown:d,onPointerUp:u,style:h={},tabIndex:m=0,tagName:f="div",...p}){var A,v;const x=g.useRef(null),b=g.useRef({onClick:o,onDragging:l,onPointerDown:d,onPointerUp:u});g.useEffect(()=>{b.current.onClick=o,b.current.onDragging=l,b.current.onPointerDown=d,b.current.onPointerUp=u});const y=g.useContext(pk);if(y===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:w,groupId:j,registerResizeHandle:N,startDragging:_,stopDragging:S,panelGroupElement:C}=y,E=aL(a),[T,B]=g.useState("inactive"),[L,P]=g.useState(!1),[F,M]=g.useState(null),I=g.useRef({state:T});km(()=>{I.current.state=T}),g.useEffect(()=>{if(r)M(null);else{const Q=N(E);M(()=>Q)}},[r,E,N]);const $=(A=s==null?void 0:s.coarse)!==null&&A!==void 0?A:15,V=(v=s==null?void 0:s.fine)!==null&&v!==void 0?v:5;g.useEffect(()=>{if(r||F==null)return;const Q=x.current;$r(Q,"Element ref not attached");let U=!1;return qft(E,Q,w,{coarse:$,fine:V},(q,G,Y)=>{if(!G){B("inactive");return}switch(q){case"down":{B("drag"),U=!1,$r(Y,'Expected event to be defined for "down" action'),_(E,Y);const{onDragging:K,onPointerDown:X}=b.current;K==null||K(!0),X==null||X();break}case"move":{const{state:K}=I.current;U=!0,K!=="drag"&&B("hover"),$r(Y,'Expected event to be defined for "move" action'),F(Y);break}case"up":{B("hover"),S();const{onClick:K,onDragging:X,onPointerUp:ne}=b.current;X==null||X(!1),ne==null||ne(),U||K==null||K();break}}})},[$,w,r,V,N,E,F,_,S]),lmt({disabled:r,handleId:E,resizeHandler:F,panelGroupElement:C});const R={touchAction:"none",userSelect:"none"};return g.createElement(f,{...p,children:e,className:t,id:a,onBlur:()=>{P(!1),i==null||i()},onFocus:()=>{P(!0),c==null||c()},ref:x,role:"separator",style:{...R,...h},tabIndex:m,[Qs.groupDirection]:w,[Qs.groupId]:j,[Qs.resizeHandle]:"",[Qs.resizeHandleActive]:T==="drag"?"pointer":L?"keyboard":void 0,[Qs.resizeHandleEnabled]:!r,[Qs.resizeHandleId]:E,[Qs.resizeHandleState]:T})}loe.displayName="PanelResizeHandle";const cmt=({className:e,...t})=>n.jsx(ooe,{className:ye("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...t}),hV=Hie,dmt=({withHandle:e,className:t,...r})=>n.jsx(loe,{className:ye("relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",t),...r,children:e&&n.jsx("div",{className:"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border",children:n.jsx(jK,{className:"h-2.5 w-2.5"})})});function umt({message:e}){return n.jsxs(Ar,{variant:"destructive",className:"mb-4",children:[n.jsx(nr,{className:"h-4 w-4"}),n.jsx(Wa,{children:"Error"}),n.jsx(gr,{children:e})]})}function hmt({content:e,versionNumber:t,error:r,onVersionCreated:s,onExitImproveMode:
1870a,chatInitialFocus:i=!1,onChatFocused:o,onError:l}){return n.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 via-white to-emerald-50/20 relative overflow-hidden p-6",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),r&&n.jsx(umt,{message:r}),n.jsxs("div",{className:"relative",children:[n.jsxs(cmt,{direction:"horizontal",className:"h-[calc(100vh-12rem)] rounded-2xl border border-emerald-200/60 shadow-lg overflow-hidden",children:[n.jsx(hV,{defaultSize:50,minSize:30,children:n.jsxs("div",{className:"h-full bg-gradient-to-br from-emerald-50/80 via-green-50/60 to-white flex flex-col relative overflow-hidden",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-emerald-50/30 via-transparent to-green-50/20"}),n.jsx("div",{className:"absolute top-0 right-0 w-32 h-32 bg-gradient-to-br from-emerald-200/20 to-transparent rounded-full -translate-y-16 translate-x-16"}),n.jsxs("div",{className:"relative border-b border-emerald-100/50 p-6",children:[n.jsx("h3",{className:"text-xl font-bold bg-gradient-to-r from-emerald-800 to-green-700 bg-clip-text text-transparent mb-2",children:"AI Assistant"}),n.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:"Chat with AI to get suggestions and improvements for your content."})]}),n.jsx("div",{className:"flex-1 relative",children:n.jsx(Fft,{contentId:e.id,onVersionCreated:s,autoFocus:i,onFocused:o,onError:l})})]})}),n.jsx(dmt,{className:"bg-gradient-to-b from-emerald-200/50 to-green-200/50 hover:from-emerald-300/60 hover:to-green-300/60 transition-all duration-300"}),n.jsx(hV,{defaultSize:50,minSize:30,children:n.jsxs("div",{className:"h-full bg-gradient-to-br from-blue-50/80 via-indigo-50/60 to-white flex flex-col relative overflow-hidden",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-blue-50/30 via-transparent to-indigo-50/20"}),n.jsx("div",{className:"absolute top-0 right-0 w-32 h-32 bg-gradient-to-br from-blue-200/20 to-transparent rounded-full -translate-y-16 translate-x-16"}),n.jsxs("div",{className:"relative border-b border-blue-100/50 p-6",children:[n.jsx("h3",{className:"text-xl font-bold bg-gradient-to-r from-blue-800 to-indigo-700 bg-clip-text text-transparent mb-2",children:"Content Preview"}),n.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:"See your content updates in real-time as you make improvements."})]}),n.jsx("div",{className:"flex-1 relative",children:n.jsx("div",{className:"h-full bg-white/80 backdrop-blur-sm",children:n.jsx(nL,{content:e,versionNumber:t})})})]})})]}),n.jsx("div",{className:"flex justify-center mt-6",children:n.jsxs("div",{className:"group relative overflow-hidden bg-gradient-to-r from-purple-500 to-pink-600 rounded-xl shadow-lg hover:shadow-2xl transition-all duration-500 transform hover:-translate-y-1 hover:scale-105",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-white/10 via-trans
1870parent to-white/5"}),n.jsx(te,{variant:"default",onClick:a,className:"relative bg-transparent hover:bg-transparent text-white font-medium px-8 py-3 border-0 shadow-none",children:"Exit Improve Mode"})]})})]})]})}var fmt=Symbol("radix.slottable");function mmt(e){const t=({children:r})=>n.jsx(n.Fragment,{children:r});return t.displayName=`${e}.Slottable`,t.__radixId=fmt,t}var coe="AlertDialog",[pmt]=Ki(coe,[sq]),$u=sq(),doe=e=>{const{__scopeAlertDialog:t,...r}=e,s=$u(t);return n.jsx(hI,{...s,...r,modal:!0})};doe.displayName=coe;var Amt="AlertDialogTrigger",gmt=g.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...s}=e,a=$u(r);return n.jsx(QG,{...a,...s,ref:t})});gmt.displayName=Amt;var xmt="AlertDialogPortal",uoe=e=>{const{__scopeAlertDialog:t,...r}=e,s=$u(t);return n.jsx(uI,{...s,...r})};uoe.displayName=xmt;var vmt="AlertDialogOverlay",hoe=g.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...s}=e,a=$u(r);return n.jsx(by,{...a,...s,ref:t})});hoe.displayName=vmt;var GA="AlertDialogContent",[bmt,ymt]=pmt(GA),wmt=mmt("AlertDialogContent"),foe=g.forwardRef((e,t)=>{const{__scopeAlertDialog:r,children:s,...a}=e,i=$u(r),o=g.useRef(null),l=zr(t,o),c=g.useRef(null);return n.jsx(qde,{contentName:GA,titleName:moe,docsSlug:"alert-dialog",children:n.jsx(bmt,{scope:r,cancelRef:c,children:n.jsxs(yy,{role:"alertdialog",...i,...a,ref:l,onOpenAutoFocus:yt(a.onOpenAutoFocus,d=>{var u;d.preventDefault(),(u=c.current)==null||u.focus({preventScroll:!0})}),onPointerDownOutside:d=>d.preventDefault(),onInteractOutside:d=>d.preventDefault(),children:[n.jsx(wmt,{children:s}),n.jsx(Nmt,{contentRef:o})]})})})});foe.displayName=GA;var moe="AlertDialogTitle",poe=g.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...s}=e,a=$u(r);return n.jsx(wy,{...a,...s,ref:t})});poe.displayName=moe;var Aoe="AlertDialogDescription",goe=g.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...s}=e,a=$u(r);return n.jsx(jy,{...a,...s,ref:t})});goe.displayName=Aoe;var jmt="AlertDialogAction",xoe=g.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...s}=e,a=$u(r);return n.jsx(P_,{...a,...s,ref:t})});xoe.displayName=jmt;var voe="AlertDialogCancel",boe=g.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...s}=e,{cancelRef:a}=ymt(voe,r),i=$u(r),o=zr(t,a);return n.jsx(P_,{...i,...s,ref:o})});boe.displayName=voe;var Nmt=({contentRef:e})=>{const t=`\`${GA}\` requires a description for the component to be accessible for screen reader users.
1871
1872You can add a description to the \`${GA}\` by passing a \`${Aoe}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
1873
1874Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${GA}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
1875
1876For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return g.useEffect(()=>{var s;document.getElementById((s=e.current)==null?void 0:s.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},_mt=doe,Cmt=uoe,yoe=hoe,woe=foe,joe=xoe,Noe=boe,_oe=poe,Coe=goe;const Soe=_mt,Smt=Cmt,koe=g.forwardRef(({className:e,...t},r)=>n.jsx(yoe,{className:ye("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",e),...t,ref:r}));koe.displayName=yoe.displayName;const lL=g.forwardRef(({className:e,...t},r)=>n.jsxs(Smt,{children:[n.jsx(koe,{}),n.jsx(woe,{ref:r,className:ye("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rou
1876nded-lg",e),...t})]}));lL.displayName=woe.displayName;const cL=({className:e,...t})=>n.jsx("div",{className:ye("flex flex-col space-y-2 text-center sm:text-left",e),...t});cL.displayName="AlertDialogHeader";const dL=({className:e,...t})=>n.jsx("div",{className:ye("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});dL.displayName="AlertDialogFooter";const uL=g.forwardRef(({className:e,...t},r)=>n.jsx(_oe,{ref:r,className:ye("text-lg font-semibold",e),...t}));uL.displayName=_oe.displayName;const hL=g.forwardRef(({className:e,...t},r)=>n.jsx(Coe,{ref:r,className:ye("text-sm text-muted-foreground",e),...t}));hL.displayName=Coe.displayName;const fL=g.forwardRef(({className:e,...t},r)=>n.jsx(joe,{ref:r,className:ye(tb(),e),...t}));fL.displayName=joe.displayName;const mL=g.forwardRef(({className:e,...t},r)=>n.jsx(Noe,{ref:r,className:ye(tb({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));mL.displayName=Noe.displayName;function Eoe({contentId:e,contentType:t,versionNumber:r,onShowPublishHelp:s,onContentUpdate:a}){var Se;const[i,o]=g.useState(!1),[l,c]=g.useState(!1),[d,u]=g.useState(!1),[h,m]=g.useState(!1),[f,p]=g.useState(null),[A,v]=g.useState(!1),[x,b]=g.useState(!1),[y,w]=g.useState(!0),[j,N]=g.useState(!1),[_,S]=g.useState(!1),{toast:C}=sn(),{currentContent:E,fetchContentDetails:T,fetchScheduledPostStatus:B,publishContentNow:L,cancelScheduledPost:P,unpublishContent:F,updateContentDetails:M}=sw();g.useEffect(()=>{i&&e&&(T(e).then(pe=>(pe||C({title:"Error",description:"Content not found",variant:"destructive"}),pe)).then(async pe=>{if(pe!=null&&pe.platform_key&&(pe!=null&&pe.brand_id)){w(!0);try{const{data:Ce}=await de.from("platforms").select("id").eq("platform_key",pe.platform_key).single();if(Ce){const{data:re}=await de.from("platform_brand_settings").select("status").eq("brand_id",pe.brand_id).eq("platform_id",Ce.id).single();b((re==null?void 0:re.status)==="CONNECTED")}else b(!1)}catch(Ce){console.error("Error checking platform connection:",Ce),b(!1)}finally{w(!1)}}else b(!1),w(!1)}).catch(pe=>{console.error("Error refreshing content on dropdown open:",pe),w(!1)}),v(!0),B(e).then(pe=>{p(pe)}).catch(pe=>{console.error("Error checking scheduled post:",pe)}).finally(()=>{v(!1)}))},[i,e,T,B]);const I=()=>E?r===void 0?!0:r===E.current_version:!1,$=g.useMemo(()=>I(),[E,r]),V=pe=>{const Ce=Xz(e,pe,r);navigator.clipboard.writeText(Ce),C({title:"URL Copied",description:"Shareable URL copied to clipboard"})},R=pe=>{window.open(Xz(e,pe,r),"_blank")},Q=async()=>{c(!0);try{const pe=await L(e);if(pe.success){C({title:"Success",description:"Content published successfully"}),await T(e);const Ce=await B(e);p(Ce),a&&a()}else C({title:"Error",description:pe.error||"Failed to publish content",variant:"destructive"})}catch(pe){console.error("Error publishing content:",pe),C({title:"Error",description:"An unexpected error occurred while publishing",variant:"destructive"})}finally{c(!1)}},U=async()=>{if(f){c(!0);try{await P(e);const pe=await L(e);if(pe.success){C({title:"Success",description:"Content published immediately"}),await T(e);const Ce=await B(e);p(Ce),a&&a()}else C({title:"Error",description:pe.error||"Failed to publish content",variant:"destructive"})}catch(pe){console.error("Error publishing content:",pe),C({title:"Error",description:"An unexpected error occurred while publishing",variant:"destructive"})}finally{c(!1)}}},D=async()=>{if(f){c(!0);try{const pe=await P(e);pe.success?(C({title:"Success",description:"Scheduled post cancelled"}),p(null),a&&a()):C({title:"Error",description:pe.error||"Failed to cancel schedule",variant:"destructive"})}catch(pe){console.error("Error canceling schedule:",pe),C({title:"Error",description:"An unexpected error occurred",variant:"destructive"})}finally{c(!1)}}},q=()=>{S(!0)},G=async()=>{if(f){S(!1),c(!0);try{const pe=await F(e);if(pe.success){C({title:"Success",description:"Content unpublished successfully"}),await T(e);const Ce=await B(e);p(Ce),a&&a()}else C({title:"Error",description:pe.error||"Failed to unpublish content",variant:"destructive"})}catch(pe){console.error("Error unpublishing content:",pe),C({title:"Error",description:"An unexpected error occurred while unpublishing",variant:"destructive"})}finally{c(!1)}}},Y=pe=>{m(pe),u(!0)},K=async()=>{const pe=await B(e);p(pe),a&&a()},X=pe=>{o(pe)},ne=async()=>
1876{if(!E||j)return;const pe=E.status==="DRAFT"?"READY":"DRAFT";N(!0);try{await M(e,{status:pe}),C({title:"Status Updated",description:`Content status changed to ${pe==="DRAFT"?"Draft":"Ready"}`}),await T(e),a&&a()}catch(Ce){console.error("Error updating content status:",Ce),C({title:"Error",description:"Failed to update content status",variant:"destructive"})}finally{N(!1)}},ae=(E==null?void 0:E.platform_key)||((Se=E==null?void 0:E.content_json)==null?void 0:Se.platform),J=f&&(f.status==="scheduled"||f.status==="SCHEDULED"),W=f&&(f.status==="published"||f.status==="PUBLISHED"),ie=$&&E&&(E.status==="DRAFT"||E.status==="READY"),ee=(E==null?void 0:E.status)==="DRAFT",xe=t==="tool",we=t==="tool";return n.jsxs(n.Fragment,{children:[n.jsxs(ll,{open:i,onOpenChange:X,children:[n.jsx(cl,{asChild:!0,children:n.jsx(te,{variant:"default",disabled:l,children:l?n.jsxs(n.Fragment,{children:[n.jsx(kt,{className:"h-4 w-4 mr-2 animate-spin"}),"Publishing..."]}):n.jsxs(n.Fragment,{children:[n.jsx(og,{className:"h-4 w-4 mr-2"}),"Share & Publish"]})})}),n.jsxs(fo,{className:"w-80",children:[n.jsxs(Fr,{onClick:s,className:"py-2 px-3",children:[n.jsx(Xm,{className:"h-4 w-4 mr-2"}),n.jsx("span",{children:"How do I publish this?"})]}),ie&&n.jsxs(n.Fragment,{children:[n.jsx(Mo,{}),n.jsx(Am,{className:"text-xs text-muted-foreground py-2 px-3",children:"Content Status"}),n.jsx(Fr,{onClick:ne,disabled:j,className:"py-2 px-3",children:j?n.jsxs(n.Fragment,{children:[n.jsx(kt,{className:"h-4 w-4 mr-2 animate-spin"}),n.jsx("span",{children:"Updating..."})]}):ee?n.jsxs(n.Fragment,{children:[n.jsx(gd,{className:"h-4 w-4 mr-2"}),n.jsx("span",{children:"Mark as Ready"})]}):n.jsxs(n.Fragment,{children:[n.jsx(Xr,{className:"h-4 w-4 mr-2"}),n.jsx("span",{children:"Mark as Draft"})]})}),n.jsx(Fr,{disabled:!0,className:"py-2 px-3",children:n.jsxs("div",{className:"flex items-center gap-2 w-full text-xs text-muted-foreground",children:[n.jsx("div",{className:`w-2 h-2 rounded-full ${ee?"bg-blue-500":"bg-yellow-500"}`}),n.jsxs("span",{children:["Currently: ",ee?"Draft":"Ready"]})]})}),ee&&n.jsx(Fr,{disabled:!0,className:"py-2 px-3",children:n.jsxs("div",{className:"text-xs text-muted-foreground leading-relaxed",children:[n.jsx(nr,{className:"h-3 w-3 mr-1 inline"}),"Content in draft mode will not be available or used in any automatic content scheduling"]})})]}),n.jsx(Mo,{}),n.jsxs(Fr,{onClick:()=>R("html"),className:"py-2 px-3",children:[n.jsx(Vs,{className:"h-4 w-4 mr-2"}),n.jsx("span",{children:"Open in New Tab"})]}),n.jsxs(Fr,{onClick:()=>V("html"),className:"py-2 px-3",children:[n.jsx(Cn,{className:"h-4 w-4 mr-2"}),n.jsx("span",{children:"Copy Shareable URL"})]}),$&&ae&&!ee&&n.jsxs(n.Fragment,{children:[n.jsx(Mo,{}),A?n.jsxs(Fr,{disabled:!0,className:"py-2 px-3",children:[n.jsx(kt,{className:"h-4 w-4 mr-2 animate-spin"}),n.jsx("span",{children:"Checking schedule status..."})]}):W?n.jsxs(n.Fragment,{children:[n.jsx(Am,{className:"text-xs text-muted-foreground py-2 px-3",children:"Published Content"}),n.jsx(Fr,{disabled:!0,className:"py-2 px-3",children:n.jsxs("div",{className:"flex items-center gap-2 w-full",children:[n.jsx(qt,{className:"h-4 w-4 text-green-600"}),n.jsx("span",{className:"flex-1",children:"Published"}),(f==null?void 0:f.published_at)&&n.jsx("span",{className:"text-xs text-muted-foreground",children:nn(new Date(f.published_at),"MMM d, h:mm a")})]})}),(f==null?void 0:f.published_url)&&n.jsxs(Fr,{onClick:()=>window.open(f.published_url,"_blank"),className:"py-2 px-3 text-blue-600",children:[n.jsx(Vs,{className:"h-4 w-4 mr-2"}),n.jsx("span",{children:"View Published Post"})]}),n.jsxs(Fr,{onClick:q,disabled:l,className:"py-2 px-3 text-destructive",children:[n.jsx(kr,{className:"h-4 w-4 mr-2"}),n.jsx("span",{children:"Unpublish"})]})]}):J?n.jsxs(n.Fragment,{children:[n.jsx(Am,{className:"text-xs text-muted-foreground py-2 px-3",children:"Scheduled Post"}),n.jsx(Fr,{disabled:!0,className:"py-2 px-3",children:n.jsxs("div",{className:"flex items-center gap-2 w-full",children:[n.jsx(Vr,{className:"h-4 w-4 text-blue-600"}),n.jsx("span",{className:"flex-1",children:"Scheduled for"}),(f==null?void 0:f.scheduled_for)&&n.jsx("span",{className:"text-xs font-medium",children:nn(new Date(f.scheduled_for),"MMM d, h:mm a")})]})}),n.jsxs(Fr,{onClick:()=>Y(!1),className:"py-2 px-3",children:[n.jsx(ave,{className:"h-4 w-4 mr-2"}),n.jsx("span",{children:"Reschedule"})]}),n.jsxs(Fr,{onClick:U,disabled:l,className:"py-2 px-3",children:[n.jsx(Om,{className:"h-4 w-4 mr-2"}),n.jsx("span",{children:"Publish Now Instead"})]}),n.jsxs(Fr,{onClick:D,disabled:l,className:"py-2 px-3 text-destructive",children:[n.jsx(kr,{className:"h-4 w-4 mr-2"}),n.jsx("span",{children:"Cancel Schedule"})]})]}):n.jsxs(n.Fragment,{children:[n.jsx(Am,{className:"text-xs text-muted-foreground py-2 px-3",children:"Publishing Options"}),n.jsx(Fr,{onClick:Q,disabled:l||!x||y,className:"py-2 px-3",children:y?n.jsxs(n.Fragment,{children:[n.jsx(kt,{className:"h-4 w-4 mr-2 animate-spin"}),n.jsx("span",{children:"Checking connection..."})]}):x?n.jsxs(n.Fragment,{children:[n.jsx(Om,{className:"h-4 w-4 mr-2"}),n.jsx("span",{children:"Publish Now"})]}):n.jsxs(n.Fragment,{children:[n.jsx(nr,{className:"h-4 w-4 mr-2"}),n.jsx("span",{children:"Publish Now (Not connected)"})]})}),n.jsx(Fr,{onClick:()=>Y(!0),disabled:!x||y,className:"py-2 px-3",children:x?n.jsxs(n.Fragment,{children:[n.jsx(Kn,{className:"h-4 w-4 mr-2"}),n.jsx("span",{children:"Schedule for Later"})]}):n.jsxs(n.Fragment,{children:[n.jsx(nr,{className:"h-4 w-4 mr-2"}),n.jsx("span",{children:"Schedule for Later (Not connected)"})]})})]})]}),$&&ae&&ee&&n.jsxs(n.Fragment,{children:[n.jsx(Mo,{}),n.jsx(Fr,{disabled:!0,className:"py-2 px-3",children:n.jsxs("div",{className:"text-sm text-muted-foreground",children:[n.jsx(Xr,{className:"h-4 w-4 mb-1"}),'Content must be marked as "Ready" before publishing']})})]}),$&&!ae&&!ee&&n.jsxs(n.Fragment,{children:[n.jsx(Mo,{}),n.jsx(Fr,{disabled:!0,className:"py-2 px-3",children:n.jsxs("div",{className:"text-sm text-muted-foreground",children:[n.jsx(Is,{className:"h-4 w-4 mb-1"}),"No platform specified for this content"]})})]}),(xe||we)&&n.jsx(Mo,{}),xe&&n.jsxs(Fr,{onClick:()=>
1876V("js"),className:"py-2 px-3",children:[n.jsx(ng,{className:"h-4 w-4 mr-2"}),n.jsx("span",{children:"Copy JS URL"})]}),we&&n.jsxs(Fr,{onClick:()=>V("css"),className:"py-2 px-3",children:[n.jsx(ng,{className:"h-4 w-4 mr-2"}),n.jsx("span",{children:"Copy CSS URL"})]})]})]}),n.jsx(hk,{isOpen:d,onClose:()=>u(!1),contentId:e,currentScheduledTime:f==null?void 0:f.scheduled_for,onScheduleUpdate:K,isNewSchedule:h}),n.jsx(Soe,{open:_,onOpenChange:S,children:n.jsxs(lL,{className:"sm:max-w-md",children:[n.jsxs(cL,{children:[n.jsxs(uL,{className:"flex items-center gap-2",children:[n.jsx(hn,{className:"h-5 w-5 text-amber-500"}),"Unpublish Content?"]}),n.jsxs(hL,{className:"text-left space-y-3 pt-2",children:[n.jsx("p",{className:"font-medium text-foreground",children:"Warning: This action may not be reversible on some platforms."}),n.jsx("p",{children:"While this will remove the post from the platform, some platforms (like LinkedIn) may prevent you from republishing the same content due to duplicate detection."}),n.jsx("p",{children:"If republishing fails, you may need to make edits to the content before trying again."}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Are you sure you want to unpublish this content?"})]})]}),n.jsxs(dL,{className:"flex-col sm:flex-row gap-2",children:[n.jsx(mL,{className:"w-full sm:w-auto",children:"Cancel"}),n.jsx(fL,{onClick:G,disabled:l,className:"w-full sm:w-auto bg-destructive text-destructive-foreground hover:bg-destructive/90",children:l?n.jsxs(n.Fragment,{children:[n.jsx(kt,{className:"h-4 w-4 mr-2 animate-spin"}),"Unpublishing..."]}):"Yes, Unpublish"})]})]})})]})}function kmt({content:e,versionNumber:t,onShowPublishHelp:r,onContentUpdate:s}){var S,C,E,T,B,L;const a=e==null?void 0:e.scheduledPostData,[i,o]=g.useState(!1),[l,c]=g.useState(!1),[d,u]=g.useState(!1),[h,m]=g.useState(!1),{toast:f}=sn();console.log("PublishStatusCard render:",{contentId:e==null?void 0:e.id,hasScheduledPostData:!!a,scheduledPostStatus:a==null?void 0:a.status,timestamp:new Date().toISOString()});const p=null,A=P=>{switch(P){case"PUBLISHED":return"bg-gradient-to-r from-emerald-100 to-green-200 dark:from-emerald-900 dark:to-green-800 text-emerald-800 dark:text-emerald-100 border border-emerald-300/50 shadow-sm";case"SCHEDULED":return"bg-gradient-to-r from-blue-100 to-indigo-200 dark:from-blue-900 dark:to-indigo-800 text-blue-800 dark:text-blue-100 border border-blue-300/50 shadow-sm";case"HOLD":case"HELD":return"bg-gradient-to-r from-yellow-100 to-amber-200 dark:from-yellow-900 dark:to-amber-800 text-yellow-800 dark:text-yellow-100 border border-yellow-300/50 shadow-sm";case"PROCESSING":return"bg-gradient-to-r from-amber-100 to-yellow-200 dark:from-amber-900 dark:to-yellow-800 text-amber-800 dark:text-amber-100 border border-amber-300/50 shadow-sm";case"CANCELLED":return"bg-gradient-to-r from-gray-100 to-slate-200 dark:from-gray-800 dark:to-slate-700 text-gray-800 dark:text-gray-100 border border-gray-300/50 shadow-sm";case"FAILED":case"error":return"bg-gradient-to-r from-red-100 to-rose-200 dark:from-red-900 dark:to-rose-800 text-red-800 dark:text-red-100 border border-red-300/50 shadow-sm";default:return"bg-gradient-to-r from-gray-100 to-slate-200 dark:from-gray-800 dark:to-slate-700 text-gray-800 dark:text-gray-100 border border-gray-300/50 shadow-sm"}},v=P=>{switch(P){case"PUBLISHED":return"Published";case"SCHEDULED":return`Scheduled for ${e.scheduled_time?new Date(e.scheduled_time).toLocaleString():"Unknown date"}`;case"HOLD":case"HELD":return"On Hold";case"PROCESSING":return"Publishing...";case"CANCELLED":return"Unpublished";case"FAILED":case"error":return"Publishing Failed";default:return`Status: ${P}`}},x=()=>{o(!0)},b=()=>{o(!1)},y=()=>{s==null||s()},w=()=>{c(!0)},j=async()=>{var P;if(!(a!=null&&a.id)){f({title:"Error",description:"No scheduled post found to cancel",variant:"destructive"});return}u(!0),c(!1);try{const F=await fetch("https://worker.rainfactory.ai/api/autopost/cancel-publishing",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${(P=(await de.auth.getSession()).data.session)==null?void 0:P.access_token}`}
1876,body:JSON.stringify({scheduledPostId:a.id,force:!0})}),M=await F.json();if(F.ok)f({title:"Publishing Cancelled",description:M.warning||"The publishing process has been cancelled.",variant:(M.warning,"default")}),s==null||s();else throw new Error(M.error||"Failed to cancel publishing")}catch(F){console.error("Error canceling publishing:",F),f({title:"Error",description:F instanceof Error?F.message:"Failed to cancel publishing. Please try again.",variant:"destructive"})}finally{u(!1)}},N=()=>{c(!1),f({title:"Check Platform",description:"Please check your social media platform directly to verify if the post was published"})},_=async()=>{if(!(a!=null&&a.id)){f({title:"Error",description:"No scheduled post found",variant:"destructive"});return}m(!0);try{const P=e.display_status==="SCHEDULED"?"HOLD":"SCHEDULED",{error:F}=await de.from("scheduled_social_posts").update({status:P,updated_at:new Date().toISOString()}).eq("id",a.id);if(F)throw F;f({title:P==="HOLD"?"Post Put On Hold":"Hold Removed",description:P==="HOLD"?"This post will not be published until you remove the hold.":"This post will be published at the scheduled time."}),s==null||s()}catch(P){console.error("Error toggling hold status:",P),f({title:"Error",description:P instanceof Error?P.message:"Failed to update hold status. Please try again.",variant:"destructive"})}finally{m(!1)}};return n.jsxs("div",{className:"group relative overflow-hidden bg-gradient-to-br from-white via-blue-50/30 to-indigo-50/40 rounded-2xl border border-blue-200/60 shadow-lg hover:shadow-2xl transition-all duration-500 transform hover:-translate-y-1 hover:scale-105 w-80",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-blue-50/30 via-transparent to-indigo-50/20"}),n.jsx("div",{className:"absolute top-0 right-0 w-32 h-32 bg-gradient-to-br from-blue-200/20 to-transparent rounded-full -translate-y-16 translate-x-16"}),n.jsxs("div",{className:"relative p-4 space-y-3",children:[e.display_status?n.jsxs("div",{className:"space-y-2",children:[n.jsx("div",{className:`text-sm rounded-full px-4 py-2 text-center font-medium transition-all duration-300 ${A(e.display_status)}`,children:e.display_status==="PROCESSING"?n.jsxs("span",{className:"flex items-center justify-center",children:[n.jsx(kt,{className:"h-3 w-3 mr-1 animate-spin"}),v(e.display_status)]}):v(e.display_status)}),e.display_status==="PROCESSING"&&n.jsx("div",{className:"flex justify-center",children:n.jsx(te,{variant:"outline",size:"sm",onClick:w,disabled:d,className:"text-xs bg-white/60 hover:bg-white/80 border-red-300/50 text-red-600 hover:text-red-700 hover:border-red-400/60 transition-all duration-300 transform hover:scale-105",children:d?n.jsxs(n.Fragment,{children:[n.jsx(kt,{className:"h-3 w-3 mr-1 animate-spin"}),"Canceling..."]}):n.jsxs(n.Fragment,{children:[n.jsx(kr,{className:"h-3 w-3 mr-1"}),"Cancel"]})})}),e.published_at&&n.jsxs("div",{className:"flex items-center justify-center gap-1 text-xs text-gray-600 bg-white/40 rounded-lg px-3 py-1.5 mt-2",children:[n.jsx(gK,{className:"h-3 w-3"}),n.jsxs("span",{children:["Published: ",new Date(e.published_at).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})," at ",new Date(e.published_at).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0})]})]}),(e.display_status==="SCHEDULED"||e.display_status==="HOLD"||e.display_status==="HELD")&&n.jsxs("div",{className:"flex justify-center gap-2",children:[n.jsxs(te,{variant:"outline",size:"sm",onClick:x,className:"text-xs bg-white/60 hover:bg-white/80 border-blue-300/50 text-blue-600 hover:text-blue-700 hover:border-blue-400/60 transition-all duration-300 transform hover:scale-105",children:[n.jsx(Vr,{className:"h-3 w-3 mr-1"}),"Change Schedule"]}),n.jsx(te,{variant:"outline",size:"sm",onClick:_,disabled:h,className:`text-xs transition-all duration-300 transform hover:scale-105 ${e.display_status==="HOLD"||e.display_status==="HELD"?"bg-green-50/60 hover:bg-green-100/80 border-green-300/50 text-green-600 hover:text-green-700 hover:border-green-400/60":"bg-yellow-50/60 hover:bg-yellow-100/80 border-yellow-300/50 text-yellow-600 hover:text-yellow-700 hover:border-yellow-400/60"}`,children:h?n.jsxs(n.Fragment,{children:[n.jsx(kt,{className:"h-3 w-3 mr-1 animate-spin"}),e.display_status==="HOLD"||e.display_status==="HELD"?"Removing Hold...":"Holding..."]}):n.jsx(n.Fragment,{children:e.display_status==="HOLD"||e.display_status==="HELD"?n.jsxs(n.Fragment,{children:[n.jsx(ho,{className:"h-3 w-3 mr-1"}),"Stop Holding"]}):n.jsxs(n.Fragment,{children:[n.jsx(A2,{className:"h-3 w-3 mr-1"}),"Hold This Post"]})})})]}
1876),(e.display_status==="PUBLISHED"||e.published_at)&&n.jsxs("button",{onClick:()=>{var P;e.content_type==="blog_post"?window.open(`/brands/${e.brand_id}/blog/${e.id}`,"_blank"):(P=e.scheduledPostData)!=null&&P.published_url&&(console.log("Opening published URL:",e.scheduledPostData.published_url),window.open(e.scheduledPostData.published_url,"_blank","noopener,noreferrer"))},className:"text-sm text-primary flex items-center justify-center hover:underline cursor-pointer",children:["View Published Post ",n.jsx(Vs,{className:"h-3 w-3 ml-1"})]}),e.display_status==="FAILED"&&((S=e.scheduledPostData)==null?void 0:S.error_message)&&n.jsxs("div",{className:"text-xs p-2 bg-red-50 dark:bg-red-950 border border-red-200 dark:border-red-800 rounded",children:[n.jsx("div",{className:"font-medium text-red-800 dark:text-red-200 mb-1",children:"Error:"}),n.jsx("div",{className:"text-red-700 dark:text-red-300",children:e.scheduledPostData.error_message}),e.scheduledPostData.attempt_count&&e.scheduledPostData.attempt_count>1&&n.jsxs("div",{className:"text-red-600 dark:text-red-400 mt-1",children:["Failed after ",e.scheduledPostData.attempt_count," attempts"]})]}),e.display_status==="CANCELLED"&&n.jsxs("div",{className:`text-xs p-2 rounded ${(C=e.scheduledPostData)!=null&&C.error_message?"bg-red-50 dark:bg-red-950 border border-red-200 dark:border-red-800":"bg-gray-50 dark:bg-gray-900 border border-gray-200 dark:border-gray-700"}`,children:[n.jsxs("div",{className:`font-medium mb-1 flex items-center gap-1 ${(E=e.scheduledPostData)!=null&&E.error_message?"text-red-800 dark:text-red-200":"text-gray-800 dark:text-gray-200"}`,children:[((T=e.scheduledPostData)==null?void 0:T.error_message)&&n.jsx(hn,{className:"h-3 w-3"}),"Unpublished"]}),n.jsx("div",{className:(B=e.scheduledPostData)!=null&&B.error_message?"text-red-700 dark:text-red-300 space-y-2":"text-gray-700 dark:text-gray-300",children:(L=e.scheduledPostData)!=null&&L.error_message?n.jsxs(n.Fragment,{children:[n.jsx("div",{children:e.scheduledPostData.error_message}),e.scheduledPostData.error_message.toLowerCase().includes("duplicate")&&n.jsxs("div",{className:"text-xs pt-1 border-t border-red-200 dark:border-red-800",children:["💡 ",n.jsx("strong",{children:"Tip:"})," This platform prevents republishing identical content. Try editing the post before republishing."]})]}):"This content was previously published and has been unpublished."})]})]}):n.jsxs("div",{className:"space-y-2",children:[n.jsx("div",{className:"text-sm rounded-full px-4 py-2 text-center font-medium bg-gradient-to-r from-gray-100 to-slate-200 dark:from-gray-800 dark:to-slate-700 text-gray-800 dark:text-gray-100 border border-gray-300/50 shadow-sm transition-all duration-300",children:"Unpublished"}),n.jsx("div",{className:"text-xs text-muted-foreground text-center",children:"This content has not been published yet"})]}),p,n.jsx("div",{className:"flex justify-center",children:n.jsx(Eoe,{contentId:e.id,contentType:e.content_type,versionNumber:t||e.current_version,onShowPublishHelp:r,onContentUpdate:s})}),n.jsx(hk,{isOpen:i,onClose:b,contentId:e.id,currentScheduledTime:e.scheduled_time,onScheduleUpdate:y}),n.jsx(Soe,{open:l,onOpenChange:c,children:n.jsxs(lL,{className:"sm:max-w-md",children:[n.jsxs(cL,{children:[n.jsxs(uL,{className:"flex items-center gap-2",children:[n.jsx(hn,{className:"h-5 w-5 text-amber-500"}),"Cancel Publishing?"]}),n.jsxs(hL,{className:"text-left space-y-3 pt-2",children:[n.jsx("p",{children:"This publishing process appears to be in progress."}),n.jsx("p",{children:"If the post has already been published on the platform, cancelling here won't remove it."}),n.jsx("p",{children:"This could result in duplicate posts if you try to publish again."}),n.jsx("p",{children:"Please check the platform directly before cancelling."})]})]}),n.jsxs(dL,{className:"flex-col sm:flex-row gap-2",children:[n.jsx(mL,{onClick:N,className:"w-full sm:w-auto",children:"Check Platform First"}),n.jsx(fL,{onClick:j,disabled:d,className:"w-full sm:w-auto bg-destructive text-destructive-foreground hover:bg-destructive/90",children:d?n.jsxs(n.Fragment,{children:[n.jsx(kt,{className:"h-4 w-4 mr-2 animate-spin"}),"Cancelling..."]}):"Force Cancel"})]})]})})]})]})}function Emt({content:e}){const t=xr(),[r,s]=g.useState(null),[a,i]=g.useState(!0);if(g.useEffect(()=>{(async()=>
1876{if(!e.platform_key||!e.brand_id){i(!1);return}try{const{data:u,error:h}=await de.from("platforms").select("id").eq("platform_key",e.platform_key).single();if(h||!u){console.error("Error fetching platform:",h),i(!1);return}const{data:m,error:f}=await de.from("platform_brand_settings").select("*").eq("brand_id",e.brand_id).eq("platform_id",u.id).single();!f&&m&&s({...m,platform_id:u.id})}catch(u){console.error("Error fetching platform connection:",u)}finally{i(!1)}})()},[e.platform_key,e.brand_id]),!e.platform_key)return null;const o=()=>{r!=null&&r.platform_id&&t(`/brands/${e.brand_id}/connections/${r.platform_id}/settings`)},l=em(e.platform_key),c=(r==null?void 0:r.status)==="CONNECTED";return n.jsxs("div",{className:"group relative overflow-hidden bg-gradient-to-br from-blue-50/80 via-indigo-50/60 to-white rounded-2xl border border-blue-200/60 shadow-lg hover:shadow-2xl transition-all duration-500 transform hover:-translate-y-1 hover:scale-105",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-blue-50/30 via-transparent to-indigo-50/20"}),n.jsx("div",{className:"absolute top-0 right-0 w-24 h-24 bg-gradient-to-br from-blue-200/30 to-transparent rounded-full -translate-y-12 translate-x-12"}),n.jsxs("div",{className:"relative",children:[n.jsx("div",{className:"p-4 pb-3 border-b border-blue-100/50",children:n.jsxs("h4",{className:"text-base font-bold bg-gradient-to-r from-blue-800 to-indigo-700 bg-clip-text text-transparent flex items-center gap-2",children:[n.jsx("div",{className:"p-1.5 bg-gradient-to-br from-blue-100 to-indigo-200 rounded-lg shadow-sm group-hover:from-blue-200 group-hover:to-indigo-300 transition-all duration-300",children:n.jsx(fs,{className:"h-4 w-4 text-blue-600 group-hover:text-blue-700 transition-colors duration-300"})}),"Platform"]})}),n.jsxs("div",{className:"p-4 space-y-3",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs("div",{className:`relative flex-shrink-0 ${a?"animate-pulse":""}`,children:[n.jsx("div",{className:`w-12 h-12 rounded-full flex items-center justify-center shadow-md border-2 border-white/50 ${c?"bg-gradient-to-br from-blue-100 to-indigo-200":"bg-gradient-to-br from-gray-100 to-gray-200"}`,children:hu(e.platform_key,"h-6 w-6")}),c&&!a&&n.jsx("div",{className:"absolute -top-1 -right-1",children:n.jsxs("div",{className:"relative",children:[n.jsx("div",{className:"absolute inset-0 bg-green-500 rounded-full animate-ping opacity-75"}),n.jsx("div",{className:"relative bg-green-500 rounded-full p-1",children:n.jsx("svg",{className:"h-2.5 w-2.5 text-white",fill:"currentColor",viewBox:"0 0 8 8",children:n.jsx("circle",{cx:"4",cy:"4",r:"3"})})})]})})]}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsx("div",{className:"font-medium text-sm truncate",children:l}),n.jsx("div",{className:"text-xs text-gray-600 mt-0.5",children:a?n.jsxs("span",{className:"flex items-center gap-1",children:[n.jsx(kt,{className:"h-3 w-3 animate-spin"}),"Checking connection..."]}):c?n.jsxs("span",{className:"flex items-center gap-1 text-green-600",children:[n.jsx("span",{className:"inline-block w-1.5 h-1.5 bg-green-500 rounded-full"}),"Connected"]}):n.jsxs("span",{className:"flex items-center gap-1 text-amber-600",children:[n.jsx(nr,{className:"h-3 w-3"}),"Not connected"]})})]})]}),r&&n.jsxs(te,{onClick:o,variant:"outline",size:"sm",className:"w-full group bg-white/60 hover:bg-gradient-to-r hover:from-blue-500 hover:to-indigo-600 hover:text-white hover:border-transparent transition-all duration-300 text-xs",children:[n.jsx(fs,{className:"h-3.5 w-3.5 mr-1.5 group-hover:rotate-90 transition-transform duration-300"}),"Platform Settings",n.jsx(Vs,{className:"h-3 w-3 ml-auto opacity-50"})]}),!c&&!a&&n.jsx("div",{className:"p-2.5 bg-amber-50/80 border border-amber-200/60 rounded-lg",children:n.jsx("p",{className:"text-xs text-amber-800 leading-relaxed",children:"This platform is not currently connected. Connect it in platform settings to enable publishing."})})]})]})]})}const fV={AI_GENERATE:"AI Image Generation",SEARCH_EXISTING:"Existing Media Search",STOCK_SEARCH:"Stock Image Search"},y4={"KIE task polling timeout":"Image generation took too long and timed out","Failed to get image URL from KIE task":"Unable to generate image","All configured steps completed without finding or generating media":"Could not find or generate suitable media for this content"};function mV(e){if(y4[e])return y4[e];for(const[t,r]of Object.entries(y4))if(e.includes(t))return r;return e}function Bmt({errors:e,onRetry:t,retrying:r=!1,onDismiss:s}){const[a,i]=g.useState(!1),[o,l]=g.useState(!1);if(a||!e||e.length===0)return null;const c=e.reduce((h,m)=>new Date(m.timestamp)>new Date(h.timestamp)?m:h,e[0]),d=()=>{i(!0),s==null||s()},u=e.some(h=>h.retryable);return n.jsxs(Ar,{variant:"destructive",className:"relative bg-red-50/80 border-red-200 shadow-md",children:[n.jsx(nr,{className:"h-5 w-5 text-red-600"}),n.jsx(te,{variant:"ghost",size:"sm",onClick:d,className:"absolute top-2 right-2 h-6 w-6 p-0 hover:bg-red-100","aria-label":"Dismiss error",children:n.jsx(kr,{className:"h-4 w-4"})}),n.jsxs("div",{className:"pr-8",children:[n.jsx(Wa,{className:"text-red-900 font-semibold mb-2",children:"Media Generation Issue"}),n.jsxs(gr,{className:"text-red-800 space-y-3",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsxs("span",{className:"font-medium text-sm",children:[fV[c.step]||c.step,":"]}),n.jsx("span",{className:"text-sm",children:mV(c.error)})]}),n.jsx("div",{className:"text-xs text-red-700",children:rK(new Date(c.timestamp),{addSuffix:!0})})]}),(e.length>1||c.taskId)&&n.jsxs("div",{className:"border-t border-red-200 pt-2 mt-2",children:[n.jsx(te,{variant:"ghost",size:"sm",onClick:()=>l(!o),className:"h-6 px-2 text-xs text-red-700 hover:bg-red-100 hover:text-red-900",children:o?n.jsxs(n.Fragment,{children:[n.jsx(Fu,{className:"h-3 w-3 mr-1"}),"Hide Details"]}
1876):n.jsxs(n.Fragment,{children:[n.jsx(Un,{className:"h-3 w-3 mr-1"}),"Show Details ",e.length>1&&`(${e.length} errors)`]})}),o&&n.jsxs("div",{className:"mt-2 space-y-2 text-xs bg-red-100/50 p-3 rounded-md",children:[c.taskId&&n.jsxs("div",{className:"text-red-700",children:[n.jsx("span",{className:"font-medium",children:"Task ID:"})," ",n.jsx("code",{className:"bg-red-200 px-1 py-0.5 rounded text-xs",children:c.taskId})]}),c.attempts&&c.attempts>1&&n.jsxs("div",{className:"text-red-700",children:[n.jsx("span",{className:"font-medium",children:"Attempts:"})," ",c.attempts]}),e.length>1&&n.jsxs("div",{className:"space-y-2 mt-2",children:[n.jsx("div",{className:"font-medium text-red-800",children:"All Errors:"}),e.map((h,m)=>n.jsxs("div",{className:"pl-2 border-l-2 border-red-300 space-y-1",children:[n.jsx("div",{className:"text-red-900 font-medium",children:fV[h.step]||h.step}),n.jsx("div",{className:"text-red-700",children:mV(h.error)}),h.requirementIndex!==void 0&&n.jsxs("div",{className:"text-red-600 text-xs",children:["Media requirement #",h.requirementIndex+1]})]},m))]})]})]}),u&&t&&n.jsx("div",{className:"pt-2",children:n.jsxs(te,{variant:"outline",size:"sm",onClick:t,disabled:r,className:"bg-white hover:bg-red-50 border-red-300 text-red-700 hover:text-red-800",children:[n.jsx(Es,{className:`h-3 w-3 mr-2 ${r?"animate-spin":""}`}),r?"Retrying...":"Retry Media Generation"]})})]})]})]})}function Tmt({content:e,versionNumber:t,isViewingOldVersion:r,onViewHistory:s,onResetVersionView:a,onShowPublishHelp:i,onEnhanceMedia:o,enhancingMedia:l=!1,onScheduleChange:c}){var y,w,j;const d=t||e.current_version,[u,h]=g.useState(!1),[m,f]=g.useState(""),p=(y=e.content_json)==null?void 0:y.platform_post_type,A=((w=e.version_metadata)==null?void 0:w.media_generation_errors)||[],v=()=>{if(e.scheduled_time){const N=new Date(e.scheduled_time),_=new Date(N.getTime()-N.getTimezoneOffset()*6e4);f(_.toISOString().slice(0,16))}else{const N=new Date;N.setHours(N.getHours()+1);const _=new Date(N.getTime()-N.getTimezoneOffset()*6e4);f(_.toISOString().slice(0,16))}h(!0)},x=()=>{if(c&&m){const N=new Date(m).toISOString();c(N)}h(!1)},b=()=>{h(!1),f("")};return n.jsxs("div",{className:"relative min-h-screen bg-gradient-to-br from-slate-50 via-white to-purple-50/20",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsxs("div",{className:"relative grid grid-cols-1 lg:grid-cols-3 gap-6 p-6",children:[n.jsx("div",{className:"lg:col-span-2",children:n.jsxs("div",{className:"group relative overflow-hidden bg-gradient-to-br from-white via-purple-50/30 to-indigo-50/40 rounded-2xl border border-purple-200/60 shadow-lg hover:shadow-2xl transition-all duration-500 h-full",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-purple-50/30 via-transparent to-indigo-50/20"}),n.jsx("div",{className:"absolute top-0 right-0 w-40 h-40 bg-gradient-to-br from-purple-200/20 to-transparent rounded-full -translate-y-20 translate-x-20"}),n.jsxs("div",{className:"relative",children:[n.jsx("div",{className:"p-6 pb-3 border-b border-purple-100/50",children:n.jsxs("h3",{className:"text-xl font-bold bg-gradient-to-r from-purple-800 to-indigo-700 bg-clip-text text-transparent flex items-center gap-3",children:[n.jsx("div",{className:"p-2 bg-gradient-to-br from-purple-100 to-indigo-200 rounded-xl shadow-sm group-hover:from-purple-200 group-hover:to-indigo-300 transition-all duration-300",children:n.jsx(Xr,{className:"h-5 w-5 text-purple-600 group-hover:text-purple-700 transition-colors duration-300"})}),"Content Preview"]})}),n.jsx("div",{className:"p-6",children:n.jsx("div",{className:"",children:n.jsx(nL,{content:e,versionNumber:t,showControls:!1})})})]})]})}),n.jsxs("div",{className:"space-y-4",children:[A.length>0&&n.jsx(Bmt,{errors:A,onRetry:o?()=>o("image"):void 0,retrying:l}),n.jsx(Emt,{content:e}),n.jsxs("div",{className:"group relative overflow-hidden bg-gradient-to-br from-purple-50/80 via-indigo-50/60 to-white rounded-2xl border border-purple-200/60 shadow-lg hover:shadow-2xl transition-all duration-500 transform hover:-translate-y-1 hover:scale-105",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-purple-50/30 via-trans
1876parent to-indigo-50/20"}),n.jsx("div",{className:"absolute top-0 right-0 w-24 h-24 bg-gradient-to-br from-purple-200/30 to-transparent rounded-full -translate-y-12 translate-x-12"}),n.jsxs("div",{className:"relative",children:[n.jsx("div",{className:"p-4 pb-3 border-b border-purple-100/50",children:n.jsxs("h4",{className:"text-base font-bold bg-gradient-to-r from-purple-800 to-indigo-700 bg-clip-text text-transparent flex items-center gap-2",children:[n.jsx("div",{className:"p-1.5 bg-gradient-to-br from-purple-100 to-indigo-200 rounded-lg shadow-sm group-hover:from-purple-200 group-hover:to-indigo-300 transition-all duration-300",children:n.jsx(mr,{className:"h-4 w-4 text-purple-600 group-hover:text-purple-700 transition-colors duration-300"})}),"Parent Convergence"]})}),n.jsx("div",{className:"p-4 space-y-2",children:e.convergence_id&&e.convergence_name?n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center gap-3",children:[e.convergence_image_url?n.jsx("div",{className:"w-12 h-12 rounded-full overflow-hidden shadow-md border-2 border-white/50 flex-shrink-0",children:n.jsx("img",{src:e.convergence_image_url,alt:`${e.convergence_name} convergence`,className:"w-full h-full object-cover",loading:"lazy"})}):n.jsx("div",{className:"w-12 h-12 bg-gradient-to-br from-purple-100 to-indigo-200 rounded-full flex items-center justify-center shadow-md flex-shrink-0",children:n.jsx(mr,{className:"h-6 w-6 text-purple-600"})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsx("div",{className:"font-medium text-sm truncate",children:e.convergence_name}),e.convergence_power_score&&n.jsxs("div",{className:"flex items-center gap-1 mt-1",children:[n.jsx(en,{className:"h-3 w-3 text-amber-500"}),n.jsxs("span",{className:"text-xs text-muted-foreground",children:["Power: ",e.convergence_power_score]})]})]})]}),e.convergence_text&&n.jsx("div",{className:"text-xs text-muted-foreground mt-2 line-clamp-2",children:e.convergence_text}),n.jsxs(te,{size:"sm",variant:"outline",className:"w-full mt-2 bg-white/60 hover:bg-white/80 border-purple-300/50 text-purple-600 hover:text-purple-700 hover:border-purple-400/60 transition-all duration-300 transform hover:scale-105",onClick:()=>{window.open(`/convergences/${e.convergence_id}`,"_blank")},children:[n.jsx(Vs,{className:"h-3 w-3 mr-2"}),"View Convergence"]})]}):n.jsx("div",{className:"text-sm text-muted-foreground",children:"No convergence associated"})})]})]}),n.jsxs("div",{className:"group relative overflow-hidden bg-gradient-to-br from-blue-50/80 via-indigo-50/60 to-white rounded-2xl border border-blue-200/60 shadow-lg hover:shadow-2xl transition-all duration-500 transform hover:-translate-y-1 hover:scale-105",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-blue-50/30 via-transparent to-indigo-50/20"}),n.jsx("div",{className:"absolute top-0 right-0 w-24 h-24 bg-gradient-to-br from-blue-200/30 to-transparent rounded-full -translate-y-12 translate-x-12"}),n.jsxs("div",{className:"relative",children:[n.jsx("div",{className:"p-4 pb-3 border-b border-blue-100/50",children:n.jsxs("h4",{className:"text-base font-bold bg-gradient-to-r from-blue-800 to-indigo-700 bg-clip-text text-transparent flex items-center gap-2",children:[n.jsx("div",{className:"p-1.5 bg-gradient-to-br from-blue-100 to-indigo-200 rounded-lg shadow-sm group-hover:from-blue-200 group-hover:to-indigo-300 transition-all duration-300",children:n.jsx(ag,{className:"h-4 w-4 text-blue-600 group-hover:text-blue-700 transition-colors duration-300"})}),"Version Info"]})}),n.jsxs("div",{className:"p-4 space-y-3",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-sm text-muted-foreground",children:"Current Version:"}),n.jsx("div",{className:"px-2 py-1 rounded-full text-xs font-medium bg-gradient-to-r from-blue-100 to-indigo-200 text-blue-800 border border-blue-300/50 shadow-sm",children:d})]}),n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-sm text-muted-foreground",children:"Latest Version:"}),n.jsx("div",{className:"px-2 py-1 rounded-full text-xs font-medium bg-gradient-to-r from-gray-100 to-slate-200 text-gray-800 border border-gray-300/50 shadow-sm",children:e.current_version})]}
1876),r&&n.jsx("div",{className:"text-xs text-amber-600 dark:text-amber-400 pt-2 border-t",children:"You're viewing an older version"}),n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-sm text-muted-foreground",children:"Created:"}),n.jsx("span",{className:"text-xs",children:new Date(e.created_at).toLocaleDateString()})]}),n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-sm text-muted-foreground",children:"Last Updated:"}),n.jsx("span",{className:"text-xs",children:new Date(e.updated_at).toLocaleDateString()})]}),n.jsx("div",{className:"pt-2 border-t space-y-2",children:r?n.jsxs(te,{variant:"outline",size:"sm",onClick:a,className:"w-full bg-white/60 hover:bg-white/80 border-blue-300/50 text-blue-600 hover:text-blue-700 hover:border-blue-400/60 transition-all duration-300 transform hover:scale-105",children:[n.jsx(Yo,{className:"h-3 w-3 mr-2"}),"Return to Current Version"]}):n.jsxs(te,{variant:"outline",size:"sm",onClick:s,className:"w-full bg-white/60 hover:bg-white/80 border-blue-300/50 text-blue-600 hover:text-blue-700 hover:border-blue-400/60 transition-all duration-300 transform hover:scale-105",children:[n.jsx(ag,{className:"h-3 w-3 mr-2"}),"View Version History"]})})]})]})]}),n.jsxs("div",{className:"group relative overflow-hidden bg-gradient-to-br from-amber-50/80 via-orange-50/60 to-white rounded-2xl border border-amber-200/60 shadow-lg hover:shadow-2xl transition-all duration-500 transform hover:-translate-y-1 hover:scale-105",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-amber-50/30 via-transparent to-orange-50/20"}),n.jsx("div",{className:"absolute top-0 right-0 w-24 h-24 bg-gradient-to-br from-amber-200/30 to-transparent rounded-full -translate-y-12 translate-x-12"}),n.jsxs("div",{className:"relative",children:[n.jsx("div",{className:"p-4 pb-3 border-b border-amber-100/50",children:n.jsxs("h4",{className:"text-base font-bold bg-gradient-to-r from-amber-800 to-orange-700 bg-clip-text text-transparent flex items-center gap-2",children:[n.jsx("div",{className:"p-1.5 bg-gradient-to-br from-amber-100 to-orange-200 rounded-lg shadow-sm group-hover:from-amber-200 group-hover:to-orange-300 transition-all duration-300",children:n.jsx(qi,{className:"h-4 w-4 text-amber-600 group-hover:text-amber-700 transition-colors duration-300"})}),"Next Steps"]})}),n.jsx("div",{className:"p-4",children:e.display_status==="PUBLISHED"||e.is_published?n.jsxs("div",{className:"space-y-2",children:[n.jsx("div",{className:"text-sm text-green-700 dark:text-green-300",children:"✅ Content is published!"}),n.jsx("div",{className:"text-xs text-muted-foreground",children:"Your content is live and available to your audience."}),((j=e.scheduledPostData)==null?void 0:j.published_url)&&n.jsxs(te,{variant:"link",size:"sm",className:"p-0 h-auto text-xs",onClick:()=>{var N;(N=e.scheduledPostData)!=null&&N.published_url&&(console.log("Opening live post URL:",e.scheduledPostData.published_url),window.open(e.scheduledPostData.published_url,"_blank","noopener,noreferrer"))},children:[n.jsx(Vs,{className:"h-3 w-3 mr-1"}),"View Live Post"]})]}):e.display_status==="SCHEDULED"||e.is_scheduled?n.jsxs("div",{className:"space-y-2",children:[n.jsx("div",{className:"text-sm text-blue-700 dark:text-blue-300",children:"📅 Content is scheduled"}),u?n.jsxs("div",{className:"space-y-2",children:[n.jsx(qe,{type:"datetime-local",value:m,onChange:N=>f(N.target.value),className:"text-xs",min:new Date().toISOString().slice(0,16)}),n.jsxs("div",{className:"flex gap-1",children:[n.jsxs(te,{variant:"default",size:"sm",onClick:x,className:"h-6 px-2 text-xs flex-1",disabled:!m,children:[n.jsx(Gn,{className:"h-3 w-3 mr-1"}),"Save"]}),n.jsxs(te,{variant:"ghost",size:"sm",onClick:b,className:"h-6 px-2 text-xs flex-1",children:[n.jsx(kr,{className:"h-3 w-3 mr-1"}),"Cancel"]})]})]}):n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"text-xs text-muted-foreground",children:["Will be published: ",e.scheduled_time?new Date(e.scheduled_time).toLocaleString():"Unknown date"]}),c&&n.jsxs(te,{variant:"ghost",size:"sm",onClick:v,className:"h-6 px-2 text-xs",children:[n.jsx(_j,{className:"h-3 w-3 mr-1"}),"Change Time"]})]})]}):e.display_status==="PROCESSING"?n.jsxs("div",{className:"space-y-2",children:[n.jsx("div",{className:"text-sm text-yellow-700 dark:text-yellow-300",children:"⏳ Publishing in progress..."}),n.jsx("div",{className:"text-xs text-muted-foreground",children:"Your content is being published. This may take a few moments."})]}):e.display_status==="FAILED"?n.jsxs("div",{className:"space-y-2",children:[n.jsx("div",{className:"text-sm text-red-700 dark:text-red-300",children:"❌ Publishing failed"}),n.jsx("div",{className:"text-xs text-muted-foreground",children:"Check the error details and try publishing again."})]}):n.jsxs("div",{className:"space-y-2",children:[n.jsx("div",{className:"text-sm text-muted-foreground",children:"📝 Ready to publish"}),n.jsx("div",{className:"text-xs text-muted-foreground",children:'Use the "Share & Publish" button to make your content live, or switch to the Edit tab to make changes.'}),o&&n.jsx("div",{className:"pt-2",children:n.jsx(Mie,{onEnhanceMedia:o,enhancingMedia:l,platformPostType:p})}),n.jsx("div",{className:"pt-2",children:n.jsx(Eoe,{contentId:e.id,contentType:e.content_type,versionNumber:t||e.current_version,onShowPublishHelp:i,className:"w-full"})})]})})]})]})]})]})]})}function Pmt({contentId:e,isOpen:t,onClose:r,onViewVersion:s,initialVersion:a,onRevert:i}){const[o,l]=g.useState([]);return g.useEffect(()=>{async function c(){const{data:d,error:u}=await de.from("content_versions").select(`
1877                    version_number,
1878                    name,
1879                    created_at,
1880                    change_summary,
1881                    is_current,
1882                    created_by,
1883                    status
1884                `).eq("content_id",e).order("version_number",{ascending:!1});d&&!u&&l(d)}t&&c()},[e,t]),g.useEffect(()=>{t&&a&&(s(a),r())},[t,a,s,r]),n.jsx(Zt,{open:t,onOpenChange:r,children:n.jsxs(Jt,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[n.jsx(_r,{children:n.jsx(tr,{children:"Version History"})}
1884),n.jsx("div",{className:"space-y-4 mt-4",children:o.map(c=>n.jsx("div",{className:"p-4 border rounded-lg bg-card",children:n.jsxs("div",{className:"flex justify-between items-start",children:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("h4",{className:"font-medium",children:["Version ",c.version_number]}),c.is_current&&n.jsx(Be,{variant:"secondary",children:"Current"})]}),c.change_summary&&n.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:c.change_summary}),n.jsx("time",{className:"text-sm text-muted-foreground block mt-2",children:new Date(c.created_at).toLocaleString()})]}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx(te,{variant:"outline",size:"sm",onClick:()=>{s(c.version_number),r()},children:"View"}),!c.is_current&&n.jsx(te,{variant:"outline",size:"sm",onClick:()=>i(c.version_number),children:"Restore"})]})]})},c.version_number))})]})})}const Imt=sf({name:ys().min(1,"Name is required"),status:qq(["GENERATING","READY","SCHEDULED","DRAFT","PUBLISHED","ERROR","ARCHIVED","DELETED"])});function Omt({content:e,isOpen:t,onClose:r,onSave:s}){const a=Cd({resolver:up(Imt),defaultValues:{name:e.name,status:Zz.includes(e.status)?e.status:"READY"}}),i=async o=>{try{await s(o),r()}catch(l){console.error("Failed to update content:",l),He({title:"Error",description:"Failed to update content. Please try again.",variant:"destructive"})}};return n.jsx(Zt,{open:t,onOpenChange:r,children:n.jsxs(Jt,{children:[n.jsx(_r,{children:n.jsx(tr,{children:"Edit Content"})}),n.jsx(dk,{...a,children:n.jsxs("form",{onSubmit:a.handleSubmit(i),className:"space-y-4",children:[n.jsx(za,{control:a.control,name:"name",render:({field:o})=>n.jsxs(Ta,{children:[n.jsx(Pa,{children:"Name"}),n.jsx(Ia,{children:n.jsx(qe,{...o})}),n.jsx(ro,{})]})}),n.jsx(za,{control:a.control,name:"status",render:({field:o})=>n.jsxs(Ta,{children:[n.jsx(Pa,{children:"Status"}),n.jsxs(ur,{value:o.value,onValueChange:o.onChange,children:[n.jsx(Ia,{children:n.jsx(or,{children:n.jsx(hr,{placeholder:"Select a status"})})}),n.jsx(lr,{children:Zz.map(l=>n.jsx(Fe,{value:l,children:tht(l)},l))})]}),n.jsx(ro,{})]})}),n.jsxs("div",{className:"flex justify-end gap-2",children:[n.jsx(te,{type:"button",variant:"outline",onClick:r,children:"Cancel"}),n.jsx(te,{type:"submit",children:"Save Changes"})]})]})})]})})}function Fmt({content:e,isOpen:t,onClose:r}){return n.jsx(Zt,{open:t,onOpenChange:r,children:n.jsxs(Jt,{className:"max-w-4xl max-h-[80vh]",children:[n.jsx(_r,{children:n.jsx(tr,{children:"Raw Content Data"})}),n.jsx(ol,{className:"mt-4 h-[60vh]",children:n.jsx("pre",{className:"p-4 bg-secondary/50 rounded-md overflow-x-auto",children:JSON.stringify(e,null,2)})}),n.jsx("div",{className:"flex justify-end mt-4",children:n.jsx(Dv,{text:JSON.stringify(e,null,2),variant:"button",labelText:"Copy Raw Data"})})]})})}function Lmt(){return n.jsxs(n.Fragment,{children:[n.jsx("h3",{className:"font-medium text-lg mb-2",children:"Publishing Blog Posts"}),n.jsxs("div",{className:"space-y-5",children:[n.jsxs("div",{children:[n.jsx("h4",{className:"font-medium text-base mb-2",children:"Publishing Options"}),n.jsx("div",{className:"bg-secondary/30 p-4 rounded-md border border-border mb-4",children:n.jsxs("ul",{className:"grid gap-3",children:[n.jsxs("li",{className:"flex items-start gap-3",children:[n.jsx(Be,{variant:"outline",className:"mt-0.5",children:"Option 1"}),n.jsxs("div",{children:[n.jsx("span",{className:"font-medium",children:"HTML Export:"})," Copy the HTML and host it on your own server or CMS"]})]}),n.jsxs("li",{className:"flex items-start gap-3",children:[n.jsx(Be,{variant:"outline",className:"mt-0.5",children:"Option 2"}),n.jsxs("div",{children:[n.jsx("span",{className:"font-medium",children:"Direct Link:"})," Share the hosted version directly from Rainfactory's servers"]})]}),n.jsxs("li",{className:"flex items-start gap-3",children:[n.jsx(Be,{variant:"outline",className:"mt-0.5",children:"Option 3"}),n.jsxs("div",{children:[n.jsx("span",{className:"font-medium",children:"Embed:"})," Embed the blog post on your existing website using an iframe"]})]})]})})]}),n.jsxs("div",{children:[n.jsx("h4",{className:"font-medium text-base mb-2",children:"Step-by-step Publishing Guide"}),n.jsxs("ol",{className:"list-decimal pl-5 space-y-3 mb-4",children:[n.jsxs("li",{children:[n.jsx("span",{className:"font-medium",children:"Finalize your content:"})," Ensure all text, images, and formatting are ready",n.jsx("div",{className:"pl-5 mt-1 text-sm text-muted-foreground",children:n.jsxs("p",{children:["Use the ",n.jsx(Be,{variant:"outline",className:"mx-1 font-normal",children:"Improve Content"})," feature to optimize your blog post"]})})]}),n.jsxs("li",{children:[n.jsx("span",{className:"font-medium",children:"Set status to Published:"})," Open the content settings and change status to",n.jsx(Be,{className:"ml-1 mr-1 font-normal",children:"Published"}),n.jsx("div",{className:"pl-5 mt-1 text-sm",children:n.jsx("p",{className:"text-muted-foreground",children:"This marks the content as ready for public viewing and enables all sharing features"})})]}),n.jsxs("li",{children:[n.jsx("span",{className:"font-medium",children:"Choose your publishing method:"}),n.jsxs("div",{className:"pl-5 mt-1 space-y-2",children:[n.jsxs("div",{children:[n.jsx("p",{className:"font-medium text-sm",children:"For HTML/Custom hosting:"}),n.jsxs("ol",{className:"list-[lower-alpha] pl-5 text-sm text-muted-foreground",children:[n.jsxs("li",{children:["Click ",n.jsx(Be,{variant:"outline",className:"mx-1 font-normal",children:"Share & Embed"})," in the toolbar"]}),n.jsxs("li",{children:["Select ",n.jsx("span",{className:"font-semibold",children:"Copy HTML"})]}),n.jsx("li",{children:"Paste the HTML into your CMS or hosting platform"})]})]}),n.jsxs("div",{children:[n.jsx("p",{className:"font-medium text-sm",children:"For Direct Link:"}),n.jsxs("ol",{className:"list-[lower-alpha] pl-5 text-sm text-muted-foreground",children:[n.jsxs("li",{children:["Click ",n.jsx(Be,{variant:"outline",className:"mx-1 font-normal",children:"Share & Embed"})," in the toolbar"]}),n.jsxs("li",{children:["Click ",n.jsx("span",{className:"font-semibold",children:"Open as Webpage"})]}),n.jsx("li",{children:"Copy the URL from your browser address bar"})]})]}),n.jsxs("div",{children:[n.jsx("p",{className:"font-medium text-sm",children:"For Embedding:"}),n.jsxs("ol",{className:"list-[lower-alpha] pl-5 text-sm text-muted-foreground",children:[n.jsxs("li",{children:["Click ",n.jsx(Be,{variant:"outline",className:"mx-1 font-normal",children:"Share & Embed"})," in the toolbar"]}),n.jsxs("li",{children:["Click ",n.jsx("span",{className:"font-semibold",children:"Copy Preview URL"})]}),n.jsx("li",{children:"Use this URL in an iframe on your site"})]})]})]})]}),n.jsxs("li",{children:[n.jsx("span",{className:"font-medium",children:"SEO Optimization:"})," Ensure your blog post has appropriate meta titles, descriptions, and keywords",n.jsx("div",{className:"pl-5 mt-1 text-sm text-muted-foreground",children:n.jsx("p",{children:"This will help maximize search engine visibility for your content"})})]})]})]}),n.jsxs("div",{children:[n.jsx("h4",{className:"font-medium text-base mb-2",children:"Making Updates After Publishing"}),n.jsx("div",{className:"bg-secondary/30 p-4 rounded-md border border-border mb-4",children:n.jsxs("ol",{className:"list-decimal pl-5 space-y-2",children:[n.jsx("li",{children:"Return to this page and make your desired changes"}),n.jsxs("li",{children:["Use ",n.jsx(Be,{variant:"outline",className:"mx-1 font-normal",children:"Improve Content"})," or edit directly"]}),n.jsx("li",{children:"A new version will be created automatically"}),n.jsx("li",{children:"For embedded or direct links, the content updates automatically"})]})})]}),n.jsxs("div",{className:"bg-amber-50 dark:bg-amber-950/30 p-4 rounded-md border border-amber-200 dark:border-amber-800 mb-4",children:[n.jsxs("h4",{className:"font-medium text-amber-800 dark:text-amber-400 flex items-center gap-2 mb-2",children:[n.jsx(nr,{className:"h-4 w-4"}),"Blog Post Best Practices"]}),n.jsxs("ul",{className:"list-disc pl-5 space-y-1 text-sm text-amber-700 dark:text-amber-300",children:[n.jsx("li",{children:"Test all links and media to ensure they work properly"}),n.jsx("li",{children:"Verify the post is mobile-responsive using the preview mode"}),n.jsx("li",{children:"Check that images are properly optimized for web"}),n.jsx("li",{children:"Confirm that all formatting displays correctly"}),n.jsx("li",{children:"Review the post for typos and grammatical errors"})]})]})]})]})}function Dmt(){return n.jsxs(n.Fragment,{children:[n.jsx("h3",{className:"font-medium text-lg mb-2",children:"Publishing Landing Pages"}),n.jsxs("div",{className:"space-y-5",children:[n.jsxs("div",{children:[n.jsx("h4",{className:"font-medium text-base mb-2",children:"Publishing Options"}),n.jsx("div",{className:"bg-secondary/30 p-4 rounded-md border border-border mb-4",children:n.jsxs("ul",{className:"grid gap-3",children:[n.jsxs("li",{className:"flex items-start gap-3",children:[n.jsx(Be,{variant:"outline",className:"mt-0.5",children:"Option 1"}),n.jsxs("div",{children:[n.jsx("span",{className:"font-medium",children:"Embed:"})," Embed the landing page on your existing website using an iframe"]})]}),n.jsxs("li",{className:"flex items-start gap-3",children:[n.jsx(Be,{variant:"outline",className:"mt-0.5",children:"Option 2"}),n.jsxs("div",{children:[n.jsx("span",{className:"font-medium",children:"HTML Export:"})," Copy the HTML and host it on your own server or hosting platform"]})]}),n.jsxs("li",{className:"flex items-start gap-3",children:[n.jsx(Be,{variant:"outline",className:"mt-0.5",children:"Option 3"}),n.jsxs("div",{children:[n.jsx("span",{className:"font-medium",children:"Direct Link:"}
1884)," Share the hosted version directly from Rainfactory's servers"]})]})]})})]}),n.jsxs("div",{children:[n.jsx("h4",{className:"font-medium text-base mb-2",children:"Step-by-step Publishing Guide"}),n.jsxs("ol",{className:"list-decimal pl-5 space-y-3 mb-4",children:[n.jsxs("li",{children:[n.jsx("span",{className:"font-medium",children:"Finalize your content:"})," Ensure all text, images, and interactive elements are ready",n.jsx("div",{className:"pl-5 mt-1 text-sm text-muted-foreground",children:n.jsxs("p",{children:["Use the ",n.jsx(Be,{variant:"outline",className:"mx-1 font-normal",children:"Improve Content"})," feature to optimize your landing page"]})})]}),n.jsxs("li",{children:[n.jsx("span",{className:"font-medium",children:"Set status to Published:"})," Open the content settings and change status to",n.jsx(Be,{className:"ml-1 mr-1 font-normal",children:"Published"}),n.jsx("div",{className:"pl-5 mt-1 text-sm",children:n.jsx("p",{className:"text-muted-foreground",children:"This marks the content as ready for public viewing and enables all sharing features"})})]}),n.jsxs("li",{children:[n.jsx("span",{className:"font-medium",children:"Choose your publishing method:"}),n.jsxs("div",{className:"pl-5 mt-1 space-y-2",children:[n.jsxs("div",{children:[n.jsx("p",{className:"font-medium text-sm",children:"For HTML/Custom hosting:"}),n.jsxs("ol",{className:"list-[lower-alpha] pl-5 text-sm text-muted-foreground",children:[n.jsxs("li",{children:["Click ",n.jsx(Be,{variant:"outline",className:"mx-1 font-normal",children:"Share & Embed"})," in the toolbar"]}),n.jsxs("li",{children:["Select ",n.jsx("span",{className:"font-semibold",children:"Copy HTML"})]}),n.jsx("li",{children:"Paste the HTML into your hosting platform"})]})]}),n.jsxs("div",{children:[n.jsx("p",{className:"font-medium text-sm",children:"For Embedding:"}),n.jsxs("ol",{className:"list-[lower-alpha] pl-5 text-sm text-muted-foreground",children:[n.jsxs("li",{children:["Click ",n.jsx(Be,{variant:"outline",className:"mx-1 font-normal",children:"Share & Embed"})," in the toolbar"]}),n.jsxs("li",{children:["Click ",n.jsx("span",{className:"font-semibold",children:"Copy Preview URL"})]}),n.jsx("li",{children:"Use this URL in an iframe on your site"})]})]}),n.jsxs("div",{children:[n.jsx("p",{className:"font-medium text-sm",children:"For Direct Link:"}),n.jsxs("ol",{className:"list-[lower-alpha] pl-5 text-sm text-muted-foreground",children:[n.jsxs("li",{children:["Click ",n.jsx(Be,{variant:"outline",className:"mx-1 font-normal",children:"Share & Embed"})," in the toolbar"]}),n.jsxs("li",{children:["Click ",n.jsx("span",{className:"font-semibold",children:"Open as Webpage"})]}),n.jsx("li",{children:"Copy the URL from your browser address bar"})]})]})]})]}),n.jsxs("li",{children:[n.jsx("span",{className:"font-medium",children:"Track performance:"})," Connect analytics to monitor conversions",n.jsx("div",{className:"pl-5 mt-1 text-sm text-muted-foreground",children:n.jsx("p",{children:"Consider adding UTM parameters to your landing page links for better tracking"})})]})]})]}),n.jsxs("div",{children:[n.jsx("h4",{className:"font-medium text-base mb-2",children:"Making Updates After Publishing"}),n.jsx("div",{className:"bg-secondary/30 p-4 rounded-md border border-border mb-4",children:n.jsxs("ol",{className:"list-decimal pl-5 space-y-2",children:[n.jsx("li",{children:"Return to this page and make your desired changes"}),n.jsxs("li",{children:["Use ",n.jsx(Be,{variant:"outline",className:"mx-1 font-normal",children:"Improve Content"})," or edit directly"]}),n.jsx("li",{children:"A new version will be created automatically"}),n.jsx("li",{children:"For embedded or direct links, the content updates automatically"})]})})]}),n.jsxs("div",{className:"bg-amber-50 dark:bg-amber-950/30 p-4 rounded-md border border-amber-200 dark:border-amber-800 mb-4",children:[n.jsxs("h4",{className:"font-medium text-amber-800 dark:text-amber-400 flex items-center gap-2 mb-2",children:[n.jsx(nr,{className:"h-4 w-4"}),"Landing Page Best Practices"]}),n.jsxs("ul",{className:"list-disc pl-5 space-y-1 text-sm text-amber-700 dark:text-amber-300",children:[n.jsx("li",{children:"Test all links and forms to ensure they work properly"}),n.jsx("li",{children:"Verify the page is mobile-responsive using the preview mode"}),n.jsx("li",{children:"Check that call-to-action buttons are clearly visible"}),n.jsx("li",{children:"Confirm that all tracking codes are implemented correctly"}),n.jsx("li",{children:"Test the complete user journey from entry to conversion"})]})]})]})]})}function Rmt(){return n.jsxs(n.Fragment,{children:[n.jsx("h3",{className:"font-medium text-lg mb-2",children:"Publishing Interactive Tools"}),n.jsxs("ol",{className:"list-decimal pl-5 space-y-3 mb-4",children:[n.jsxs("li",{children:[n.jsx("strong",{children:"Embed on Website:"})," Click the ",n.jsx(Be,{variant:"outline",className:"ml-1 mr-1 font-normal",children:"Share & Embed"})," button to get embeddable iframe code that can be added to any webpage."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Direct Link:"})," Use the ",n.jsx(Be,{variant:"outline",className:"ml-1 mr-1 font-normal",children:"Share & Embed → Copy URL"})," option to get a direct link that can be shared with users."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"JavaScript Integration:"})," For advanced usage, you can use the JS URL option to programmatically integrate this tool with your existing web application."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Testing:"})," Thoroughly test all interactive elements and calculations to ensure they function correctly before sharing."]})]}),n.jsxs("div",{className:"bg-amber-50 dark:bg-amber-950/30 p-3 rounded-md border border-amber-200 dark:border-amber-800 mb-4",children:[n.jsxs("h4",{className:"font-medium text-amber-800 dark:text-amber-400 flex items-center gap-2 mb-2",children:[n.jsx(nr,{className:"h-4 w-4"}),"Interactive Tool Integration Note"]}),n.jsx("p",{className:"text-sm text-amber-700 dark:text-amber-300",children:"When embedding tools, ensure you use the correct sandbox permissions in the iframe if your tool requires user inputs or form submissions. The default embed code includes these permissions, but you may 
1884need to adjust them depending on your specific requirements."})]})]})}function Umt(){return n.jsxs(n.Fragment,{children:[n.jsx("h3",{className:"font-medium text-lg mb-2",children:"Publishing Email Campaigns"}),n.jsxs("ol",{className:"list-decimal pl-5 space-y-3 mb-4",children:[n.jsxs("li",{children:[n.jsx("strong",{children:"Copy HTML:"})," Use the ",n.jsx(Be,{variant:"outline",className:"ml-1 mr-1 font-normal",children:"Copy Source"})," button to copy the HTML code for your email campaign."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Integration with Email Platforms:"})," Paste the copied HTML into your email marketing platform (Mailchimp, HubSpot, etc.) as an HTML email template."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Test Email:"})," Send a test email to yourself to verify all links, images, and formatting display correctly."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Email Preview:"})," Use the ",n.jsx(Be,{variant:"outline",className:"ml-1 mr-1 font-normal",children:"Share & Embed → Open as Webpage"}),' option to see how the email will look as a webpage for recipients who click "View in browser".']})]}),n.jsxs("div",{className:"bg-amber-50 dark:bg-amber-950/30 p-3 rounded-md border border-amber-200 dark:border-amber-800 mb-4",children:[n.jsxs("h4",{className:"font-medium text-amber-800 dark:text-amber-400 flex items-center gap-2 mb-2",children:[n.jsx(nr,{className:"h-4 w-4"}),"Email Compatibility"]}),n.jsx("p",{className:"text-sm text-amber-700 dark:text-amber-300",children:"The generated email HTML is designed to be compatible with most email clients, but we recommend testing with services like Litmus or Email on Acid if you're targeting a wide variety of email clients. Some advanced styling may need adjustment."})]})]})}function Mmt(){return n.jsxs(n.Fragment,{children:[n.jsx("h3",{className:"font-medium text-lg mb-2",children:"Publishing Ad Groups"}),n.jsxs("div",{className:"space-y-5",children:[n.jsxs("div",{children:[n.jsx("h4",{className:"font-medium text-base mb-2",children:"Publishing Options"}),n.jsx("div",{className:"bg-secondary/30 p-4 rounded-md border border-border mb-4",children:n.jsxs("ul",{className:"grid gap-3",children:[n.jsxs("li",{className:"flex items-start gap-3",children:[n.jsx(Be,{variant:"outline",className:"mt-0.5",children:"Option 1"}),n.jsxs("div",{children:[n.jsx("span",{className:"font-medium",children:"Copy Headlines & Descriptions:"})," Export your ad content for use in ad platforms"]})]}),n.jsxs("li",{className:"flex items-start gap-3",children:[n.jsx(Be,{variant:"outline",className:"mt-0.5",children:"Option 2"}),n.jsxs("div",{children:[n.jsx("span",{className:"font-medium",children:"Preview Format:"})," View how your ads will appear on different platforms"]})]}),n.jsxs("li",{className:"flex items-start gap-3",children:[n.jsx(Be,{variant:"outline",className:"mt-0.5",children:"Option 3"}),n.jsxs("div",{children:[n.jsx("span",{className:"font-medium",children:"Share Collection:"})," Share all your ad variations with team members"]})]})]})})]}),n.jsxs("div",{children:[n.jsx("h4",{className:"font-medium text-base mb-2",children:"Step-by-step Publishing Guide"}),n.jsxs("ol",{className:"list-decimal pl-5 space-y-3 mb-4",children:[n.jsxs("li",{children:[n.jsx("span",{className:"font-medium",children:"Finalize your ad content:"})," Review all headlines and descriptions",n.jsx("div",{className:"pl-5 mt-1 text-sm text-muted-foreground",children:n.jsxs("p",{children:["Use the ",n.jsx(Be,{variant:"outline",className:"mx-1 font-normal",children:"Improve Content"})," feature to refine your ad copy"]})})]}),n.jsxs("li",{children:[n.jsx("span",{className:"font-medium",children:"Set status to Published:"})," Open the content settings and change status to",n.jsx(Be,{className:"ml-1 mr-1 font-normal",children:"Published"}),n.jsx("div",{className:"pl-5 mt-1 text-sm",children:n.jsx("p",{className:"text-muted-foreground",children:"This marks the ad group as ready for use and enables all sharing features"})})]}),n.jsxs("li",{children:[n.jsx("span",{className:"font-medium",children:"Choose your export method:"}),n.jsxs("div",{className:"pl-5 mt-1 space-y-2",children:[n.jsxs("div",{children:[n.jsx("p",{className:"font-medium text-sm",children:"For copying all headlines and descriptions:"}),n.jsxs("ol",{className:"list-[lower-alpha] pl-5 text-sm text-muted-foreground",children:[n.jsxs("li",{children:["Click ",n.jsx(Be,{variant:"outline",className:"mx-1 font-normal",children:"Share & Embed"})," in the toolbar"]}),n.jsxs("li",{children:["Select ",n.jsx("span",{className:"font-semibold",children:"Copy Markdown"})," to get all content in a structured format"]}),n.jsx("li",{children:"Paste into a document or your ad platform's bulk upload tool"})]})]}),n.jsxs("div",{children:[n.jsx("p",{className:"font-medium text-sm",children:"For viewing ad previews:"}),n.jsxs("ol",{className:"list-[lower-alpha] pl-5 text-sm text-muted-foreground",children:[n.jsxs("li",{children:["Click ",n.jsx(Be,{variant:"outline",className:"mx-1 font-normal",children:"Share & Embed"})," in the toolbar"]}),n.jsxs("li",{children:["Click ",n.jsx("span",{className:"font-semibold",children:"Open as Webpage"})]}
1884),n.jsx("li",{children:"View how your ads will appear in various formats"})]})]}),n.jsxs("div",{children:[n.jsx("p",{className:"font-medium text-sm",children:"For sharing with your team:"}),n.jsxs("ol",{className:"list-[lower-alpha] pl-5 text-sm text-muted-foreground",children:[n.jsxs("li",{children:["Click ",n.jsx(Be,{variant:"outline",className:"mx-1 font-normal",children:"Share & Embed"})," in the toolbar"]}),n.jsxs("li",{children:["Click ",n.jsx("span",{className:"font-semibold",children:"Copy Preview URL"})]}),n.jsx("li",{children:"Share this URL with team members for review or implementation"})]})]})]})]}),n.jsxs("li",{children:[n.jsx("span",{className:"font-medium",children:"Implement in ad platforms:"})," Upload to your advertising accounts",n.jsx("div",{className:"pl-5 mt-1 text-sm text-muted-foreground",children:n.jsx("p",{children:"Add creative assets, set targeting parameters, and configure campaign settings in your ad platform"})})]})]})]}),n.jsxs("div",{children:[n.jsx("h4",{className:"font-medium text-base mb-2",children:"Making Updates After Publishing"}),n.jsx("div",{className:"bg-secondary/30 p-4 rounded-md border border-border mb-4",children:n.jsxs("ol",{className:"list-decimal pl-5 space-y-2",children:[n.jsx("li",{children:"Return to this page and make your desired changes to headlines or descriptions"}),n.jsxs("li",{children:["Use ",n.jsx(Be,{variant:"outline",className:"mx-1 font-normal",children:"Improve Content"})," or edit directly"]}),n.jsx("li",{children:"A new version will be created automatically"}),n.jsx("li",{children:"For ads already running, you'll need to update them in your ad platform"}),n.jsx("li",{children:"Consider A/B testing new versions against existing ones to measure performance"})]})})]}),n.jsxs("div",{className:"bg-amber-50 dark:bg-amber-950/30 p-4 rounded-md border border-amber-200 dark:border-amber-800 mb-4",children:[n.jsxs("h4",{className:"font-medium text-amber-800 dark:text-amber-400 flex items-center gap-2 mb-2",children:[n.jsx(nr,{className:"h-4 w-4"}),"Online Advertising Best Practices"]}),n.jsxs("ul",{className:"list-disc pl-5 space-y-1 text-sm text-amber-700 dark:text-amber-300",children:[n.jsx("li",{children:"Test multiple headline and description combinations to find the best performers"}),n.jsx("li",{children:"Keep headlines clear, concise, and focused on a single value proposition"}),n.jsx("li",{children:"Include a specific call-to-action in your descriptions"}),n.jsx("li",{children:"Ensure landing pages match the messaging in your ads for consistency"}),n.jsx("li",{children:"Monitor performance metrics and optimize campaigns regularly"}),n.jsx("li",{children:"Check that all ads comply with the target platform's policies and character limits"})]})]})]})]})}function $mt(){return n.jsxs(n.Fragment,{children:[n.jsx("h3",{className:"font-medium text-lg mb-2",children:"Publishing Social Media Content"}),n.jsxs("div",{className:"space-y-5",children:[n.jsxs("div",{children:[n.jsx("h4",{className:"font-medium text-base mb-2",children:"Publishing Options"}),n.jsx("div",{className:"bg-secondary/30 p-4 rounded-md border border-border mb-4",children:n.jsxs("ul",{className:"grid gap-3",children:[n.jsxs("li",{className:"flex items-start gap-3",children:[n.jsx(Be,{variant:"outline",className:"mt-0.5",children:"Option 1"}),n.jsxs("div",{children:[n.jsx("span",{className:"font-medium",children:"Copy Content:"})," Copy the formatted text content for pasting into social platforms"]})]}),n.jsxs("li",{className:"flex items-start gap-3",children:[n.jsx(Be,{variant:"outline",className:"mt-0.5",children:"Option 2"}),n.jsxs("div",{children:[n.jsx("span",{className:"font-medium",children:"Web Preview:"})," View and share as a standalone webpage"]})]}),n.jsxs("li",{className:"flex items-start gap-3",children:[n.jsx(Be,{variant:"outline",className:"mt-0.5",children:"Option 3"}),n.jsxs("div",{children:[n.jsx("span",{className:"font-medium",children:"Multi-Platform:"})," Adapt the content for different social networks"]})]})]})})]}),n.jsxs("div",{children:[n.jsx("h4",{className:"font-medium text-base mb-2",children:"Step-by-step Publishing Guide"}),n.jsxs("ol",{className:"list-decimal pl-5 space-y-3 mb-4",children:[n.jsxs("li",{children:[n.jsx("span",{className:"font-medium",children:"Finalize your content:"})," Ensure your text, hashtags, and messaging are ready",n.jsx("div",{className:"pl-5 mt-1 text-sm text-muted-foreground",children:n.jsxs("p",{children:["Use the ",n.jsx(Be,{variant:"outline",className:"mx-1 font-normal",children:"Improve Content"})," feature to refine your social media post"]})})]}),n.jsxs("li",{children:[n.jsx("span",{className:"font-medium",children:"Set status to Published:"})," Open the content settings and change status to",n.jsx(Be,{className:"ml-1 mr-1 font-normal",children:"Published"}),n.jsx("div",{className:"pl-5 mt-1 text-sm",children:n.jsx("p",{className:"text-muted-foreground",children:"This marks the content as ready for distribution and enables all sharing features"})})]}),n.jsxs("li",{children:[n.jsx("span",{className:"font-medium",children:"Choose your publishing method:"}),n.jsxs("div",{className:"pl-5 mt-1 space-y-2",children:[n.jsxs("div",{children:[n.jsx("p",{className:"font-medium text-sm",children:"For copying text content:"}),n.jsxs("ol",{className:"list-[lower-alpha] pl-5 text-sm text-muted-foreground",children:[n.jsxs("li",{children:["Click ",n.jsx(Be,{variant:"outline",className:"mx-1 font-normal",children:"Share & Embed"})," in the toolbar"]}),n.jsxs("li",{children:["Select ",n.jsx("span",{className:"font-semibold",children:"Copy Markdown"})," or ",n.jsx("span",{className:"font-semibold",children:"Copy Preview"})]}),n.jsx("li",{children:"Paste into your social media platform or scheduling tool"})]})]}),n.jsxs("div",{children:[n.jsx("p",{className:"font-medium text-sm",children:"For sharing as a webpage:"}),n.jsxs("ol",{className:"list-[lower-alpha] pl-5 text-sm text-muted-foreground",children:[n.jsxs("li",{children:["Click ",n.jsx(Be,{variant:"outline",className:"mx-1 font-normal",children:"Share & Embed"})," in the toolbar"]}),n.jsxs("li",{children:["Click ",n.jsx("span",{className:"font-semibold",children:"Open as Webpage"})]}),n.jsx("li",{children:"Share the URL with your audience or on platforms that support link sharing"})]})]}),n.jsxs("div",{children:[n.jsx("p",{className:"font-medium text-sm",children:"For adapting to multiple platforms:"}),n.jsxs("ol",{className:"list-[lower-alpha] pl-5 text-sm text-muted-foreground",children:[n.jsxs("li",{children:["First, copy the content using the ",n.jsx("span",{className:"font-semibold",children:"Copy Preview"})," option"]}),n.jsx("li",{children:"Adjust formatting, length, and hashtags according to each platform's best practices"}),n.jsx("li",{children:"Schedule or post content to each platform individually"})]})]})]})]}),n.jsxs("li",{children:[n.jsx("span",{className:"font-medium",children:"Optimize for engagement:"})," Customize content for each platform",n.jsx("div",{className:"pl-5 mt-1 text-sm text-muted-foreground",children:n.jsx("p",{children:"Add relevant hashtags, mentions, and calls-to-action to increase visibility and engagement"})})]})]})]}),n.jsxs("div",{children:[n.jsx("h4",{className:"font-medium text-base mb-2",children:"Making Updates After Publishing"}),n.jsx("div",{className:"bg-secondary/30 p-4 rounded-md border border-border mb-4",children:n.jsxs("ol",{className:"list-decimal pl-5 space-y-2",children:[n.jsx("li",{children:"Return to this page and make your desired changes"}),n.jsxs("li",{children:["Use ",n.jsx(Be,{variant:"outline",className:"mx-1 font-normal",children:"Improve Content"})," or edit directly"]}),n.jsx("li",{children:"A new version will be created automatically"}),n.jsx("li",{children:"For already posted content, you'll need to manually update each post on your social platforms"}),n.jsx("li",{children:"For scheduled but not yet posted content, replace with the updated version"})]})})]}),n.jsxs("div",{className:"bg-amber-50 dark:bg-amber-950/30 p-4 rounded-md border border-amber-200 dark:border-amber-800 mb-4",children:[n.jsxs("h4",{className:"font-medium text-amber-800 dark:text-amber-400 flex items-center gap-2 mb-2",children:[n.jsx(nr,{className:"h-4 w-4"}),"Social Media Best Practices"]}),n.jsxs("ul",{className:"list-disc pl-5 space-y-1 text-sm text-amber-700 dark:text-amber-300",children:[n.jsx("li",{children:"Tailor content length for each platform (Twitter: 280 chars, Instagram: focus on visuals)"}),n.jsx("li",{children:"Use relevant hashtags but don't overload - 2-3 for Twitter, 5-10 for Instagram"}),n.jsx("li",{children:"Include a clear call-to-action in every post"}),n.jsx("li",{children:"Consider timing - post when your audience is most active"}),n.jsx("li",{children:"Add visual elements when possible to increase engagement"}),n.jsx("li",{children:"For link sharing, use UTM parameters to track performance"})]})]})]})]})}function Qmt({contentType:e}){const t=e.replace("_"," ").split(" ").map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join(" ");return n.jsxs(n.Fragment,{children:[n.jsxs("h3",{className:"font-medium text-lg mb-2",children:["Publishing ",t]}),n.jsxs("ol",{className:"list-decimal pl-5 space-y-3 mb-4",children:[n.jsxs("li",{children:[n.jsx("strong",{children:"Set Status to Published:"})," Use the status dropdown at the top of the page to mark this content as",n.jsx(Be,{className:"ml-1 mr-1 font-normal",children:"Published"}),"."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Share with Others:"})," Use the ",n.jsx(Be,{variant:"outline",className:"ml-1 mr-1 font-normal",children:"Share & Embed"})," button to get embed codes or direct URLs."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Copy Content:"})," Use the ",n.jsx(Be,{variant:"outline",className:"ml-1 mr-1 font-normal",children:"Copy Source"})," button to copy the raw content for use in other platforms."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Content Integration:"})," Embed the content into your existing platforms using the provided embedding tools."]})]})]})}function Hmt({isOpen:e,onClose:t,contentType:r}){const s=()=>{switch(r){case"blog_post":return n.jsx(Lmt,{});case"landing_page":return n.jsx(Dmt,{});case"tool":return n.jsx(Rmt,{});case"email_campaign":return n.jsx(Umt,{});case"ad_group":return n.jsx(Mmt,{});case"social_post":return n.jsx($mt,{});default:return n.jsx(Qmt,{contentType:r})}};return n.jsx(Zt,{open:e,onOpenChange:t,children:n.jsxs(Jt,{className:"max-w-2xl",children:[n.jsx(_r,{className:"space-y-2",children:n.jsxs(tr,{className:"flex items-center gap-2",children:[n.jsx(og,{className:"h-5 w-5 text-primary"}),"How to Publish This Content"]})}),n.jsxs("div",{className:"relative flex flex-col h-[calc(100vh-12rem)]",children:[n.jsx(ol,{className:"flex-1 -mx-6 px-6",children:n.jsxs("div",{className:"py-4 space-y-6",children:[s(),n.jsxs("div",{className:"bg-secondary/30 p-4 rounded-lg border border-border",children:[n.jsx("h4",{className:"font-medium mb-2",children:"General Publishing Tips"}),n.jsxs("ul",{className:"list-disc pl-5 space-y-2",children:[n.jsx("li",{children:"Make sure to review your content thoroughly before publishing."}),n.jsx("li",{children:"Test all interactive elements and links to ensure they work as expected."}),n.jsxs("li",{children:["Consider using the ",n.jsx(Be,{variant:"outline",className:"mx-1 font-normal",children:"Improve Content"})," tool to optimize your content before publishing."]}),n.jsx("li",{children:"If you need to make changes after publishing, simply update the content and republish."}),n.jsxs("li",{children:["Use the ",n.jsx(Be,{variant:"outline",className:"mx-1 font-normal",children:"Version History"})," button to revert to previous versions if needed."]})]})]})]})}
1884),n.jsx("div",{className:"py-4 flex justify-end border-t mt-auto",children:n.jsx(te,{onClick:t,children:"Close"})})]})]})})}const pV=()=>{var B,L,P,F;const{id:e}=Ei(),t=xr(),[r]=Bi(),{selectedBrand:s}=mn(),{currentContent:a,fetchContentDetails:i,updateContentDetails:o,enhanceContentMedia:l}=sw(),{isSuperAdmin:c}=rp(),[d,u]=g.useState("preview"),[h,m]=g.useState(!1),[f,p]=g.useState(null);console.log("exitEditHandler",f);const[A,v]=g.useState(!1);g.useEffect(()=>{const M=r.get("action");if(M){switch(M){case"improve":u("improve");break;case"cancel":case"reschedule":v(!0);break;default:console.log("Unknown action parameter:",M);break}const I=new URLSearchParams(r);I.delete("action");const $=I.toString()?`${window.location.pathname}?${I.toString()}`:window.location.pathname;t($,{replace:!0})}},[r,t]);const[x,b]=g.useReducer(Vht,zht),y=g.useCallback(async()=>{if(!e)return null;b({type:"SET_LOADING",payload:!0});try{const M=await i(e);return b({type:"SET_LOADING",payload:!1}),M}catch(M){return console.error("Error loading content:",M),b({type:"SET_LOADING",payload:!1}),null}},[e,i]);g.useEffect(()=>{e&&y()},[e,y]),g.useEffect(()=>{var I;let M=null;return((I=a==null?void 0:a.scheduledPostData)==null?void 0:I.status)==="PROCESSING"&&(M=setInterval(()=>{y()},1e4)),()=>{M&&clearInterval(M)}},[(B=a==null?void 0:a.scheduledPostData)==null?void 0:B.status,y]),g.useEffect(()=>{const M=a==null?void 0:a.scheduledPostData;((M==null?void 0:M.status)==="FAILED"||(M==null?void 0:M.status)==="error")&&M.error_message&&He({title:"Publishing Failed",description:M.error_message,variant:"destructive"})},[(L=a==null?void 0:a.scheduledPostData)==null?void 0:L.status,(P=a==null?void 0:a.scheduledPostData)==null?void 0:P.error_message]),g.useEffect(()=>{a&&s&&a.brand_id!==s.id&&(console.log("Content brand mismatch:",{contentBrandId:a.brand_id,selectedBrandId:s.id}),He({title:"Brand Mismatch",description:"This content belongs to a different brand. Redirecting to content list.",variant:"destructive"}),t("/content"))},[a,s,t]);const w=g.useCallback(M=>{b({type:"VIEW_VERSION",payload:M})},[]),j=g.useCallback(async M=>{if(a)try{if(b({type:"SET_LOADING",payload:!0}),He({title:"Reverting...",description:`Restoring version ${M} as the current version`}),!await eht(a.id,M))throw new Error("Failed to revert version");He({title:"Success!",description:`Version ${M} has been restored as the current version`}),b({type:"RESET_VERSION_VIEW"}),y()}catch(I){console.error("Error reverting version:",I),He({title:"Error",description:"Failed to restore version. Please try again.",variant:"destructive"})}finally{b({type:"SET_LOADING",payload:!1})}},[a,y]),N=g.useCallback(()=>!(!a||!x.versionView.isViewingVersion||x.versionView.versionNumber===a.current_version),[a,x.versionView]),_=g.useCallback(async()=>{b({type:"SET_EDIT_MODE",payload:!1}),await y()},[y]),S=g.useCallback(()=>{b({type:"SET_EDIT_MODE",payload:!1})},[]),C=g.useCallback(async(M="image")=>{if(a)try{m(!0),He({title:"Enhancing Media...",description:`Finding and generating optimal ${M==="image"?"images":"videos"} for your content`}),await l(a.id,M),He({title:"Media Enhanced!",description:`Your content has been updated with enhanced ${M==="image"?"images":"videos"}`})}catch(I){console.error("Error enhancing media:",I),He({title:"Enhancement Failed",description:I instanceof Error?I.message:"Failed to enhance media. Please try again.",variant:"destructive"})}finally{m(!1)}},[a,l]),E=g.useCallback(async M=>{if(a)try{await o(a.id,{name:M.name,status:M.status}),He({title:"Updated",description:"Content details updated successfully"}),y()}catch(I){throw console.error("Error updating content:",I),He({title:"Error",description:"Failed to update content. Please try again.",variant:"destructive"}),I}},[a,o,y]),T=g.useCallback(async M=>{if(a)try{const{error:I}=await de.from("scheduled_social_posts").update({scheduled_time:M,updated_at:new Date().toISOString()}).eq("content_id",a.id).eq("status","SCHEDULED");if(I)throw I;He({title:"Schedule Updated",description:"Content schedule updated successfully"}),y()}
1884catch(I){console.error("Error updating schedule:",I),He({title:"Error",description:"Failed to update schedule. Please try again.",variant:"destructive"})}},[a,y]);return a?n.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 via-white to-blue-50/30 relative overflow-hidden",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsxs("div",{className:"relative overflow-hidden bg-gradient-to-br from-white via-blue-50/30 to-indigo-50/40 border-b border-blue-200/50 shadow-sm",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsx("div",{className:"absolute top-0 right-0 w-40 h-40 bg-gradient-to-br from-blue-200/20 to-transparent rounded-full -translate-y-20 translate-x-20"}),n.jsx("div",{className:"container p-0",children:n.jsx("div",{className:"relative space-y-6 p-6",children:n.jsxs("div",{className:"flex flex-col md:flex-row md:justify-between md:items-start gap-4 md:gap-4",children:[n.jsx(Ght,{content:a}),n.jsx("div",{className:"w-full md:w-auto md:flex-shrink-0",children:n.jsx(kmt,{content:a,versionNumber:x.versionView.isViewingVersion?x.versionView.versionNumber:void 0,onShowPublishHelp:()=>b({type:"TOGGLE_PUBLISH_HELP"}),onContentUpdate:()=>i(a.id)})})]})})})]}),n.jsx("div",{className:"flex-1",children:n.jsx("div",{className:"container p-0 h-full flex flex-col",children:n.jsxs(Cs,{value:d,onValueChange:u,className:"h-full flex flex-col",children:[n.jsx("div",{className:"px-6 pt-6",children:n.jsxs("div",{className:"relative overflow-hidden bg-white/60 backdrop-blur-sm rounded-xl border border-white/50 shadow-sm p-1 max-w-md",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-blue-50/30 via-transparent to-purple-50/30"}),n.jsxs(ps,{className:"relative grid w-full grid-cols-3 bg-transparent border-0 gap-1",children:[n.jsxs(pt,{value:"preview",className:"relative bg-white/40 data-[state=active]:bg-gradient-to-r data-[state=active]:from-blue-500 data-[state=active]:to-indigo-600 data-[state=active]:text-white data-[state=active]:shadow-md hover:bg-white/60 transition-all duration-300 font-medium",children:[n.jsx(gd,{className:"h-4 w-4 mr-2"}),"Preview"]}),n.jsxs(pt,{value:"edit",className:"relative bg-white/40 data-[state=active]:bg-gradient-to-r data-[state=active]:from-purple-500 data-[state=active]:to-pink-600 data-[state=active]:text-white data-[state=active]:shadow-md hover:bg-white/60 transition-all duration-300 font-medium",children:[n.jsx(ab,{className:"h-4 w-4 mr-2"}),"Edit"]}),n.jsxs(pt,{value:"improve",className:"relative bg-white/40 data-[state=active]:bg-gradient-to-r data-[state=active]:from-emerald-500 data-[state=active]:to-teal-600 data-[state=active]:text-white data-[state=active]:shadow-md hover:bg-white/60 transition-all duration-300 font-medium",children:[n.jsx(mr,{className:"h-4 w-4 mr-2"}),"Improve"]})]})]})}),n.jsxs("div",{className:"flex-1",children:[n.jsx(Ct,{value:"preview",className:"h-full m-0",children:n.jsx(Tmt,{content:a,versionNumber:x.versionView.isViewingVersion?x.versionView.versionNumber:void 0,isViewingOldVersion:N(),onViewHistory:()=>b({type:"TOGGLE_VERSION_HISTORY"}),onResetVersionView:()=>{y(),b({type:"RESET_VERSION_VIEW"})},onShowPublishHelp:()=>b({type:"TOGGLE_PUBLISH_HELP"}),onEnhanceMedia:C,enhancingMedia:h,onScheduleChange:T})}),n.jsx(Ct,{value:"edit",className:"h-full m-0",children:n.jsx($ie,{content:a,editMode:!0,versionNumber:x.versionView.isViewingVersion?x.versionView.versionNumber:void 0,isViewingOldVersion:N(),onSaveEdit:_,onCancelEdit:S,onRestoreVersion:()=>x.versionView.versionNumber&&j(x.versionView.versionNumber),onExitEditRequest:p,onEnhanceMedia:C,enhancingMedia:h})}),n.jsx(Ct,{value:"improve",className:"h-full m-0",children:n.jsx(hmt,{content:a,versionNumber:x.versionView.isViewingVersion?x.versionView.versionNumber:void 0,error:x.error,onVersionCreated:M=>{b({type:"SET_ERROR",payload:null}),console.log("Version created:",M),(async()=>{try{b({type:"SET_LOADING",payload:!0});const $=await y();console.log("Updated content:",$),b({type:"RESET_VERSION_VIEW"})}catch($){console.error("Error updating content after version creation:",$)}finally{b({type:"SET_LOADING",payload:!1})}})()},onExitImproveMode:()=>u("preview"),chatInitialFocus:x.shouldFocusChat,onChatFocused:()=>b({type:"SET_SHOULD_FOCUS_CHAT",payload:!1}),onError:M=>b({type:"SET_ERROR",payload:M})})})]})]})})}),c&&n.jsxs("div",{className:"relative overflow-hidden bg-gradient-to-br from-red-50/80 via-pink-50/60 to-white border-t border-red-200/50",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsx("div",{className:"relative p-4",children:n.jsx("div",{className:"flex justify-center",children:n.jsxs(te,{variant:"destructive",onClick:()=>b({type:"TOGGLE_DATA_MODAL"}),className:"bg-gradient-to-r from-red-500 to-pink-600 hover:from-red-600 hover:to-pink-700 text-white shadow-lg hover:shadow-xl transition-all duration-300 transform hover:scale-105",children:[n.jsx(pd,{className:"h-4 w-4 mr-2"}),"[Superadmin Only] View Raw Data"]})})})]}),n.jsx(Fmt,{content:a,isOpen:x.isDataModalOpen,onClose:()=>b({type:"TOGGLE_DATA_MODAL"})}),n.jsx(Pmt,{contentId:a.id,isOpen:x.isVersionHistoryOpen,onClose:()=>b({type:"TOGGLE_VERSION_HISTORY"}),onViewVersion:w,initialVersion:x.newVersionNumber,onRevert:j}),n.jsx(Omt,{content:a,isOpen:x.isEditModalOpen,onClose:()=>b({type:"TOGGLE_EDIT_MODAL"}),onSave:E}),n.jsx(Hmt,{isOpen:x.isPublishHelpOpen,onClose:()=>b({type:"TOGGLE_PUBLISH_HELP"}),contentType:a.content_type}),n.jsx(hk,{isOpen:A,onClose:()=>v(!1),contentId:a.id,currentScheduledTime:(F=a.scheduledPostData)==null?void 0:F.scheduled_for,onScheduleUpdate:y})]}):n.jsx("div",{className:"container mx-auto py-6",children:n.jsx(Te,{children:n.jsxs(Re,{className:"flex flex-col items-center justify-center p-6",children:[n.jsx("h3",{className:"text-lg font-medium",children:"Content not found"}),n.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"The content you're looking for doesn't exist or you don't have permission to view it."})]})})})};function zmt(){return!0}function Boe(){const[e,t]=g.useState(!0),[r,s]=g.useState(null),[a,i]=g.useState(null),o=zmt(),l=g.useRef(0),c=async(h={showLoading:!0,forceRefresh:!1})=>{try{const m=Date.now();if(!h.forceRefresh&&m-l.current<5e3)return;l.current=m,h.showLoading&&t(!0),s(null);const{data:f}=await de.rpc("get_personal_account");if(!(f!=null&&f.account_id))throw new Error("No account found");const p=await de.auth.getSession();if(!p.data.session)throw new Error("No session found");const A="https://worker.rainfactory.ai",v=h.forceRefresh?`${A}/billing-functions/get_current_billing_status?force_refresh=true`:`${A}/billing-functions/get_current_billing_status`,x=await fetch(v,{method:"POST",headers:{Authorization:`Bearer ${p.data.session.access_token}`},body:JSON.stringify({account_id:f.account_id})});if(!x.ok)throw new Error("Failed to fetch billing status");const b=await x.json();JSON.stringify(b)!==JSON.stringify(a)&&i(b)}catch(m){s(m instanceof Error?m:new Error("Failed to fetch billing status")),console.error("Error fetching billing status:",m)}finally{h.showLoading&&t(!1)}},d=async()=>{try{t(!0);const{data:h}=await de.rpc("get_personal_account");if(!(h!=null&&h.account_id))throw new Error("No account found");const m=await de.auth.getSession();if(!m.data.session)throw new Error("No session found");const p=await fetch("https://worker.rainfactory.ai/billing-functions/get_billing_portal_url",{method:"POST",headers:{Authorization:`Bearer ${m.data.session.access_token}`},body:JSON.stringify({account_id:h.account_id,return_url:`${window.location.origin}/settings`})});if(!p.ok)throw new Error("Failed to get billing portal URL");const A=await p.json();A!=null&&A.url&&(window.location.href=A.url)}catch(h){console.error("Error accessing billing portal:",h)}finally{t(!1)}},u=async(h,m,f)=>{var p;try{t(!0),console.log("Changing plan to:",h,m,f);const{data:A}=await de.rpc("get_personal_account");if(!(A!=null&&A.account_id))throw new Error("No account found");const v=await de.auth.getSession();if(!v.data.session)throw new Error("No session found");const b=await fetch("https://worker.rainfactory.ai/billing-functions/change_subscription",{method:"POST",headers:{Authorization:`Bearer ${v.data.session.access_token}`},body:JSON.stringify({args:{new_plan_id:h,billing_interval:m,current_plan_id:(p=a==null?void 0:a.subscription)==null?void 0:p.price_id}})});if(!b.ok){const w=await b.json().catch(()=>({}));throw new Error(w.error||"Failed to change plan")}const y=await b.json();return await c({showLoading:!0,forceRefresh:!1}),y}catch(A){return console.error("Error changing plan:",A),{error:A}}finally{t(!1)}};return g.useEffect(()=>{c()},[]),g.useEffect(()=>{const h=setInterval(()=>{c({showLoading:!1,forceRefresh:!1})},1e4);return()=>clearInterval(h)},[o]),g.useEffect(()=>{c({showLoading:!1,forceRefresh:!1})}
vendor: 10,027 bytes, line 1884
1884,[o]),{loading:e,error:r,billingStatus:a,handleManageSubscription:d,handleChangePlan:u,refresh:c}}function Vmt(e,t=[]){let r=[];function s(i,o){const l=g.createContext(o);l.displayName=i+"Context";const c=r.length;r=[...r,o];const d=h=>{var x;const{scope:m,children:f,...p}=h,A=((x=m==null?void 0:m[e])==null?void 0:x[c])||l,v=g.useMemo(()=>p,Object.values(p));return n.jsx(A.Provider,{value:v,children:f})};d.displayName=i+"Provider";function u(h,m){var A;const f=((A=m==null?void 0:m[e])==null?void 0:A[c])||l,p=g.useContext(f);if(p)return p;if(o!==void 0)return o;throw new Error(`\`${h}\` must be used within \`${i}\``)}return[d,u]}const a=()=>{const i=r.map(o=>g.createContext(o));return function(l){const c=(l==null?void 0:l[e])||i;return g.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return a.scopeName=e,[s,Gmt(a,...t)]}function Gmt(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const s=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(i){const o=s.reduce((l,{useScope:c,scopeName:d})=>{const h=c(i)[`__scope${d}`];return{...l,...h}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return r.scopeName=t.scopeName,r}var qmt=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],pL=qmt.reduce((e,t)=>{const r=Ly(`Primitive.${t}`),s=g.forwardRef((a,i)=>{const{asChild:o,...l}=a,c=o?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),n.jsx(c,{...l,ref:i})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{});function Kmt(){return G_e.useSyncExternalStore(Wmt,()=>!0,()=>!1)}function Wmt(){return()=>{}}var AL="Avatar",[Ymt]=Vmt(AL),[Jmt,Toe]=Ymt(AL),Poe=g.forwardRef((e,t)=>{const{__scopeAvatar:r,...s}=e,[a,i]=g.useState("idle");return n.jsx(Jmt,{scope:r,imageLoadingStatus:a,onImageLoadingStatusChange:i,children:n.jsx(pL.span,{...s,ref:t})})});Poe.displayName=AL;var Ioe="AvatarImage",Ooe=g.forwardRef((e,t)=>{const{__scopeAvatar:r,src:s,onLoadingStatusChange:a=()=>{},...i}=e,o=Toe(Ioe,r),l=Xmt(s,i),c=$o(d=>{a(d),o.onImageLoadingStatusChange(d)});return co(()=>{l!=="idle"&&c(l)},[l,c]),l==="loaded"?n.jsx(pL.img,{...i,ref:t,src:s}):null});Ooe.displayName=Ioe;var Foe="AvatarFallback",Loe=g.forwardRef((e,t)=>{const{__scopeAvatar:r,delayMs:s,...a}=e,i=Toe(Foe,r),[o,l]=g.useState(s===void 0);return g.useEffect(()=>{if(s!==void 0){const c=window.setTimeout(()=>l(!0),s);return()=>window.clearTimeout(c)}},[s]),o&&i.imageLoadingStatus!=="loaded"?n.jsx(pL.span,{...a,ref:t}):null});Loe.displayName=Foe;function AV(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}function Xmt(e,{referrerPolicy:t,crossOrigin:r}){const s=Kmt(),a=g.useRef(null),i=s?(a.current||(a.current=new window.Image),a.current):null,[o,l]=g.useState(()=>AV(i,e));return co(()=>{l(AV(i,e))},[i,e]),co(()=>{const c=h=>()=>{l(h)};if(!i)return;const d=c("loaded"),u=c("error");return i.addEventListener("load",d),i.addEventListener("error",u),t&&(i.referrerPolicy=t),typeof r=="string"&&(i.crossOrigin=r),()=>{i.removeEventListener("load",d),i.removeEventListener("error",u)}},[i,r,t]),o}var Doe=Poe,Roe=Ooe,Uoe=Loe;const y_=g.forwardRef(({className:e,...t},r)=>n.jsx(Doe,{ref:r,className:ye("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",e),...t}));y_.displayName=Doe.displayName;const w_=g.forwardRef(({className:e,...t},r)=>n.jsx(Roe,{ref:r,className:ye("aspect-square h-full w-full",e),...t}));w_.displayName=Roe.displayName;const j_=g.forwardRef(({className:e,...t},r)=>n.jsx(Uoe,{ref:r,className:ye("flex h-full w-full items-center justify-center rounded-full bg-muted",e),...t}));j_.displayName=Uoe.displayName;function Zmt({profileData:e}){return e?n.jsxs(Te,{children:[n.jsx(st,{className:"pb-4",children:n.jsx(ot,{children:"Profile"})}),n.jsx(Re,{children:n.jsxs("div",{className:"flex items-start space-x-4",children:[n.jsxs(y_,{className:"h-20 w-20",children:[n.jsx(w_,{src:e.avatar_url,alt:e.email||""}),n.jsx(j_,{children:n.jsx(ibe,{className:"h-10 w-10"})})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("h2",{className:"text-2xl font-bold",children:e.full_name||"User"}),n.jsxs("div",{className:"flex items-center text-muted-foreground",children:[n.jsx(Cu,{className:"mr-2 h-4 w-4"}),n.jsx("span",{children:e.email})]})]})]})})]}):n.jsx("div",{className:"space-y-4",children:n.jsx(Lt,{className:"h-[125px] w-full"})})}function ept(e){const t=tpt(e),r=g.forwardRef((s,a)=>{const{children:i,...o}=s,l=g.Children.toArray(i),c=l.find(npt);if(c){const d=c.props.children,u=l.map(h=>h===c?g.Children.count(d)>1?g.Children.only(null):g.isValidElement(d)?d.props.children:null:h);return n.jsx(t,{...o,ref:a,children:g.isValidElement(d)?g.cloneElement(d,void 0,u):null})}return n.jsx(t,{...o,ref:a,children:i})});return r.displayName=`${e}.Slot`,r}function tpt(e){const t=g.forwardRef((r,s)=>{const{children:a,...i}=r;if(g.isValidElement(a)){const o=apt(a),l=spt(i,a.props);return a.type!==g.Fragment&&(l.ref=s?fI(s,o):o),g.cloneElement(a,l)}return g.Children.count(a)>1?g.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var rpt=Symbol("radix.slottable");function npt(e){return g.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===rpt}function spt(e,t){const r={...t};for(const s in t){const a=e[s],i=t[s];/^on[A-Z]/.test(s)?a&&i?r[s]=(...l)=>{const c=i(...l);return a(...l),c}:a&&(r[s]=a):s==="style"?r[s]={...a,...i}:s==="className"&&(r[s]=[a,i].filter(Boolean).join(" "))}return{...e,...r}}function apt(e){var s,a;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var vk="Popover",[Moe]=Ki(vk,[rf]),aw=rf(),[ipt,mf]=Moe(vk),$oe=e=>{const{__scopePopover:t,children:r,open:s,defaultOpen:a,onOpenChange:i,modal:o=!1}=e,l=aw(t),c=g.useRef(null),[d,u]=g.useState(!1),[h,m]=lo({prop:s,defaultProp:a??!1,onChange:i,caller:vk});return n.jsx(R_,{...l,children:n.jsx(ipt,{scope:t,contentId:tf(),triggerRef:c,open:h,onOpenChange:m,onOpenToggle:g.useCallback(()=>m(f=>!f),[m]),hasCustomAnchor:d,onCustomAnchorAdd:g.useCallback(()=>u(!0),[]),onCustomAnchorRemove:g.useCallback(()=>u(!1),[]),modal:o,children:r})})};$oe.displayName=vk;var Qoe="PopoverAnchor",opt=g.forwardRef((e,t)=>{const{__scopePopover:r,...s}=e,a=mf(Qoe,r),i=aw(r),{onCustomAnchorAdd:o,onCustomAnchorRemove:l}=a;return g.useEffect(()=>(o(),()=>l()),[o,l]),n.jsx(Ny,{...i,...s,ref:t})});opt.displayName=Qoe;var Hoe="PopoverTrigger",zoe=g.forwardRef((e,t)=>{const{__scopePopover:r,...s}=e,a=mf(Hoe,r),i=aw(r),o=zr(t,a.triggerRef),l=n.jsx(sr.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":Woe(a.open),...s,ref:o,onClick:yt(e.onClick,a.onOpenToggle)});return a.hasCustomAnchor?l:n.jsx(Ny,{asChild:!0,...i,children:l})});zoe.displayName=Hoe;var gL="PopoverPortal",[lpt,cpt]=Moe(gL,{forceMount:void 0}),Voe=e=>{const{__scopePopover:t,forceMount:r,children:s,container:a}=e,i=mf(gL,t);return n.jsx(lpt,{scope:t,forceMount:r,children:n.jsx(xo,{present:r||i.open,children:n.jsx(O_,{asChild:!0,container:a,children:s})})})};Voe.displayName=gL;var Wg="PopoverContent",Goe=g.forwardRef((e,t)=>{const r=cpt(Wg,e.__scopePopover),{forceMount:s=r.forceMount,...a}=e,i=mf(Wg,e.__scopePopover);return n.jsx(xo,{present:s||i.open,children:i.modal?n.jsx(upt,{...a,ref:t}):n.jsx(hpt,{...a,ref:t})})});Goe.displayName=Wg;var dpt=ept("PopoverContent.RemoveScroll"),upt=g.forwardRef((e,t)=>{const r=mf(Wg,e.__scopePopover),s=g.useRef(null),a=zr(t,s),i=g.useRef(!1);return g.useEffect(()=>{const o=s.current;if(o)return HG(o)},[]),n.jsx(VG,{as:dpt,allowPinchZoom:!0,children:n.jsx(qoe,{...e,ref:a,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:yt(e.onCloseAutoFocus,o=>{var l;o.preventDefault(),i.current||(l=r.triggerRef.current)==null||l.focus()}),onPointerDownOutside:yt(e.onPointerDownOutside,o=>{const l=o.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,d=l.button===2||c;i.current=d},{checkForDefaultPrevented:!1}),onFocusOutside:yt(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),hpt=g.forwardRef((e,t)=>{const r=mf(Wg,e.__scopePopover),s=g.useRef(!1),a=g.useRef(!1);return n.jsx(qoe,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,l;(o=e.onCloseAutoFocus)==null||o.call(e,i),i.defaultPrevented||(s.current||(l=r.triggerRef.current)==null||l.focus(),i.preventDefault()),s.current=!1,a.current=!1},onInteractOutside:i=>{var c,d;(c=e.onInteractOutside)==null||c.call(e,i),i.defaultPrevented||(s.current=!0,i.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const o=i.target;((d=r.triggerRef.current)==null?void 0:d.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&a.current&&i.preventDefault()}})}),qoe=g.forwardRef((e,t)=>{const{__scopePopover:r,trapFocus:s,onOpenAutoFocus:a,onCloseAutoFocus:i,disableOutsidePointerEvents:o,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:u,...h}=e,m=mf(Wg,r),f=aw(r);return zG(),n.jsx(GG,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:a,onUnmountAutoFocus:i,children:n.jsx(L_,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onDismiss:()=>m.onOpenChange(!1),children:n.jsx(D_,{"data-state":Woe(m.open),role:"dialog",id:m.contentId,...f,...h,ref:t,style:{...h.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),Koe="PopoverClose",fpt=g.forwardRef((e,t)=>
1884{const{__scopePopover:r,...s}=e,a=mf(Koe,r);return n.jsx(sr.button,{type:"button",...s,ref:t,onClick:yt(e.onClick,()=>a.onOpenChange(!1))})});fpt.displayName=Koe;var mpt="PopoverArrow",ppt=g.forwardRef((e,t)=>{const{__scopePopover:r,...s}=e,a=aw(r);return n.jsx(U_,{...a,...s,ref:t})});ppt.displayName=mpt;function Woe(e){return e?"open":"closed"}var Apt=$oe,gpt=zoe,xpt=Voe,Yoe=Goe;const Joe=Apt,Xoe=gpt,xL=g.forwardRef(({className:e,align:t="center",sideOffset:r=4,...s},a)=>n.jsx(xpt,{children:n.jsx(Yoe,{ref:a,align:t,sideOffset:r,className:ye("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none 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",e),...s})}));xL.displayName=Yoe.displayName;const vpt=sf({full_name:ys().min(2,"Name must be at least 2 characters").max(50),language:ys(),timezone:ys(),emailNotifications:Gq()}),bpt=Object.entries(fA).flatMap(([e,t])=>e==="COMMON"?t.timezones.map(r=>({...r,group:t.label,isCommon:!0})):t.timezones.map(r=>({...r,group:t.label,isCommon:!1}))).reduce((e,t)=>{const r=e.find(s=>s.value===t.value);if(!r)e.push(t);else if(t.isCommon&&!r.isCommon){const s=e.indexOf(r);e[s]=t}return e},[]);function ypt({value:e,onValueChange:t,disabled:r}){const[s,a]=g.useState(!1),[i,o]=g.useState(""),[l,c]=g.useState(null),d=g.useMemo(()=>bpt.map(p=>{const A=Au(p.value),v=TA(new Date,p.value);return{...p,offset:A.offsetString,currentTime:v}}),[]);g.useEffect(()=>{const p=d.find(A=>A.value===e);c(p||null)},[e,d]);const u=g.useMemo(()=>{if(!i.trim())return d;const p=i.toLowerCase();return d.filter(A=>A.label.toLowerCase().includes(p)||A.region.toLowerCase().includes(p)||A.value.toLowerCase().includes(p))},[d,i]),h=g.useMemo(()=>{const p={};return u.forEach(A=>{p[A.group]||(p[A.group]=[]),p[A.group].push(A)}),p},[u]),m=p=>{c(p),t(p.value),a(!1),o("")},f=()=>{const p=Xv(),A=d.find(v=>v.value===p);A&&m(A)};return n.jsxs(Joe,{open:s,onOpenChange:a,children:[n.jsx(Xoe,{asChild:!0,children:n.jsxs(te,{variant:"outline",role:"combobox","aria-expanded":s,className:"w-full justify-between h-10",disabled:r,children:[n.jsxs("div",{className:"flex items-center gap-2 flex-1 text-left",children:[n.jsx(sb,{className:"h-4 w-4 text-muted-foreground"}),l?n.jsxs("div",{className:"flex flex-col",children:[n.jsx("span",{className:"text-sm",children:l.label}),n.jsxs("span",{className:"text-xs text-muted-foreground",children:[l.offset," • ",l.currentTime]})]}):n.jsx("span",{children:"Select timezone..."})]}),n.jsx(Un,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),n.jsx(xL,{className:"w-[400px] p-0",align:"start",children:n.jsxs("div",{className:"flex flex-col",children:[n.jsxs("div",{className:"flex items-center border-b px-3 py-2",children:[n.jsx(Ns,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),n.jsx(qe,{placeholder:"Search timezones...",value:i,onChange:p=>o(p.target.value),className:"border-0 focus-visible:ring-0 focus-visible:ring-offset-0 h-8"})]}),n.jsx("div",{className:"p-2 border-b",children:n.jsxs(te,{variant:"ghost",size:"sm",onClick:f,className:"w-full justify-start h-8",children:[n.jsx(sb,{className:"mr-2 h-4 w-4"}),"Auto-detect my timezone"]})}),n.jsx("div",{className:"max-h-[300px] overflow-auto",children:Object.entries(h).map(([p,A])=>n.jsxs("div",{children:[n.jsx("div",{className:"px-3 py-2 text-xs font-medium text-muted-foreground border-b bg-muted/30",children:p}),A.map(v=>n.jsxs("button",{onClick:()=>m(v),className:"w-full flex items-center justify-between px-3 py-2 text-sm hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus:outline-none",children:[n.jsx("div",{className:"flex items-center gap-2 flex-1 text-left",children:n.jsxs("div",{className:"flex flex-col",children:[n.jsx("span",{children:v.label}),n.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[n.jsx("span",{children:v.offset}),n.jsx(Vr,{className:"h-3 w-3"}),n.jsx("span",{children:v.currentTime})]})]})}),(l==null?void 0:l.value)===v.value&&n.jsx(Gn,{className:"h-4 w-4"})]},v.value))]},p))}),u.length===0&&n.jsx("div",{className:"p-4 text-center text-sm text-muted-foreground",children:"No timezones found."})]})})]})}function wpt({profileData:e,loading:t}){const{updateProfile:r}=wa(),{toast:s}=sn(),{setTimezone:a,error:i}=Gl(),o=Cd({resolver:up(vpt),defaultValues:{full_name:"",language:"en",timezone:"UTC",emailNotifications:!0}});g.useEffect(()=>{if(e){const c=e.notificationPreferences||{emailNotifications:!0},d=e.timezone||Xv()||"UTC";o.reset({full_name:e.full_name||"",language:e.preferred_language||"en",timezone:d,emailN
1884otifications:c.emailNotifications})}},[e,o]);async function l(c){try{await a(c.timezone),await r(c),s({title:"Settings updated",description:"Your profile settings have been updated successfully."})}catch(d){console.error("Error updating settings:",d),s({title:"Error",description:i||"Failed to update settings. Please try again.",variant:"destructive"})}}return n.jsxs(Te,{children:[n.jsx(st,{children:n.jsx(ot,{children:"Settings"})}),n.jsx(Re,{className:"space-y-4",children:t?n.jsx("div",{className:"flex justify-center",children:n.jsx(kt,{className:"h-6 w-6 animate-spin"})}):n.jsx(n.Fragment,{children:n.jsx(dk,{...o,children:n.jsxs("form",{onSubmit:o.handleSubmit(l),className:"space-y-6",children:[n.jsx(za,{control:o.control,name:"full_name",render:({field:c})=>n.jsxs(Ta,{children:[n.jsx(Pa,{children:"Full Name"}),n.jsx(Ia,{children:n.jsx(qe,{...c})})]})}),n.jsx(za,{control:o.control,name:"language",render:({field:c})=>n.jsxs(Ta,{children:[n.jsx(Pa,{children:"Language"}),n.jsxs(ur,{onValueChange:c.onChange,defaultValue:c.value,children:[n.jsx(Ia,{children:n.jsx(or,{children:n.jsx(hr,{placeholder:"Select language"})})}),n.jsxs(lr,{children:[n.jsx(Fe,{value:"en",children:"English"}),n.jsx(Fe,{value:"es",children:"Spanish"}),n.jsx(Fe,{value:"fr",children:"French"})]})]})]})}),n.jsx(za,{control:o.control,name:"timezone",render:({field:c})=>n.jsxs(Ta,{children:[n.jsx(Pa,{children:"Timezone"}),n.jsx(RP,{children:"Select your timezone for accurate scheduling and notifications"}),n.jsx(Ia,{children:n.jsx(ypt,{value:c.value,onValueChange:c.onChange,disabled:t})}),i&&n.jsx("p",{className:"text-sm text-destructive mt-1",children:i})]})}),n.jsxs("div",{className:"space-y-4",children:[n.jsx("h3",{className:"text-lg font-medium",children:"Notification Preferences"}),n.jsx(za,{control:o.control,name:"emailNotifications",render:({field:c})=>n.jsxs(Ta,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[n.jsxs("div",{className:"space-y-0.5",children:[n.jsx(Pa,{className:"text-base",children:"Email Notifications"}),n.jsx(RP,{children:"Master switch for all email notifications"})]}),n.jsx(Ia,{children:n.jsx(ns,{checked:c.value,onCheckedChange:c.onChange})})]})})]}),n.jsx("div",{className:"flex justify-end",children:n.jsx(te,{type:"submit",children:"Save Changes"})})]})})})})]})}const Ma=e=>(e==null?void 0:e.toLowerCase())||"unknown";function jpt({profileData:e}){var m;const{loading:t,error:r,billingStatus:s}=Boe(),[a,i]=g.useState(null),[o,l]=g.useState(!1),c=f=>{switch(f==null?void 0:f.toLowerCase()){case"active":return"text-green-600";case"trialing":return"text-blue-600";case"past_due":case"incomplete":return"text-orange-600";case"canceled":case"unpaid":return"text-red-600";default:return"text-muted-foreground"}},d=f=>{switch(f==null?void 0:f.toLowerCase()){case"active":return n.jsx(Gn,{className:"h-4 w-4 text-green-600"});case"trialing":return n.jsx(Kn,{className:"h-4 w-4 text-blue-600"});case"past_due":case"incomplete":return n.jsx(nr,{className:"h-4 w-4 text-orange-600"});case"canceled":case"unpaid":return n.jsx(nr,{className:"h-4 w-4 text-red-600"});default:return n.jsx(sg,{className:"h-4 w-4 text-muted-foreground"})}},u=f=>{switch(f==null?void 0:f.toLowerCase()){case"active":return"Your subscription is currently active";case"trialing":return"Your trial is currently active";case"past_due":return"Payment is past due - please update your payment method";case"incomplete":return"Payment is incomplete - please complete payment setup";case"canceled":return"Your subscription has been canceled";case"unpaid":return"Payment failed - please update your payment method";default:return null}};g.useEffect(()=>{(async()=>{var p;if((p=s==null?void 0:s.subscription)!=null&&p.plan_id)try{l(!0);const{data:A}=await de.rpc("get_personal_account");if(!(A!=null&&A.account_id))throw new Error("No account found");const v=await de.auth.getSession();if(!v.data.session)throw new Error("No session found");const b=await fetch("https://worker.rainfactory.ai/billing-functions/get_plan_details",{method:"POST",headers:{Authorization:`Bearer ${v.data.session.access_token}`},body:JSON.stringify({account_id:A.account_id})});if(!b.ok)throw new Error("Failed to fetch plan details");const y=await b.json();console.log("All plans:",y);const w=y.plans.find(j=>j.id===s.subscription.plan_id);console.log("Found plan:",w,"looking for ID:",s.subscription.plan_id),i(w)}catch(A){console.error("Error fetching plan details:",A)}finally{l(!1)}})()},[(m=s==null?void 0:s.subscription)==null?void 0:m.plan_id]);const h=f=>new Date(f).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"});return t||o?n.jsxs(Te,{children:[n.jsx(st,{children:n.jsx(ot,{children:"Subscription Status"})}),n.jsx(Re,{className:"flex justify-center",children:n.jsx(kt,{className:"h-6 w-6 animate-spin"})})]}):r?n.jsxs(Te,{children:[n.jsx(st,{children:n.jsx(ot,{children:"Subscription Status"})}),n.jsx(Re,{children:n.jsx("p",{className:"text-red-500",children:"Error loading subscription status"})})]}):s!=null&&s.has_active_subscription?n.jsxs(Te,{children:[n.jsx(st,{children:n.jsx(ot,{children:"Subscription Status"})}),n.jsxs(Re,{className:"space-y-6",children:[n.jsx("div",{className:"space-y-2",children:n.jsxs("div",{className:"flex items-start justify-between",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"font-semibold text-lg",children:(a==null?void 0:a.name)||"Unknown Plan"}),(a==null?void 0:a.description)&&n.jsx("p",{className:"text-sm text-muted-foreground",children:a.description})]}),n.jsxs("div",{className:"text-right",children:[n.jsx("p",{className:"font-semibold",children:a&&fK(a.price,a.currency)}),n.jsxs("p",{className:"text-sm text-muted-foreground",children:["per ",(a==null?void 0:a.interval)||"month"]})]})]})}),n.jsx(xn,{}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[d(Ma(e==null?void 0:e.customer_status)),n.jsx("span",{className:"text-muted-foreground",children:"Customer Status:"}),n.jsx("span",{className:`capitalize font-medium ${c(Ma(e==null?void 0:e.customer_status))}`,children:(e==null?void 0:e.customer_status)||"Unknown"})]}),u(Ma(e==null?void 0:e.customer_status))&&Ma(e==null?void 0:e.customer_status)!=="active"&&n.jsxs("div",{className:`flex items-start gap-2 rounded-md p-3 text-sm ${Ma(e==null?void 0:e.customer_status)==="trialing"?"bg-blue-50":Ma(e==null?void 0:e.customer_status)==="past_due"||Ma(e==null?void 0:e.customer_status)==="incomplete"?"bg-orange-50":"bg-red-50"}`,children:[n.jsx(nr,{className:`h-5 w-5 mt-0.5 ${Ma(e==null?void 0:e.customer_status)==="trialing"?"text-blue-600":Ma(e==null?void 0:e.customer_status)==="past_due"||Ma(e==null?void 0:e.customer_status)==="incomplete"?"text-orange-600":"text-red-600"}`}),n.jsxs("div",{children:[n.jsx("p",{className:`font-medium ${Ma(e==null?void 0:e.customer_status)==="trialing"?"text-blue-800":Ma(e==null?void 0:e.customer_status)==="past_due"||Ma(e==null?void 0:e.customer_status)==="incomplete"?"text-orange-800":"text-red-800"}`,children:Ma(e==null?void 0:e.customer_status)==="trialing"?"Trial Active":"Action Required"}),n.jsx("p",{className:Ma(e==null?void 0:e.customer_status)==="trialing"?"text-blue-700":Ma(e==null?void 0:e.customer_status)==="past_due"||Ma(e==null?void 0:e.customer_status)==="incomplete"?"text-orange-700":"text-red-700",children:u(Ma(e==null?void 0:e.customer_status))})]})]}),n.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[n.jsx(Kn,{className:"h-4 w-4 text-muted-foreground"}),n.jsx("span",{className:"text-muted-foreground",children:"Current Period:"}),n.jsxs("span",{children:[h(s.subscription.billing_period_start)," - ",h(s.subscription.billing_period_end)]})]}),s.subscription.cancel_at_period_end&&n.jsxs("div",{className:"flex items-start gap-2 rounded-md bg-yellow-50 p-3 text-sm",children:[n.jsx(nr,{className:"h-5 w-5 text-yellow-600 mt-0.5"}),n.jsxs("div",{children:[n.jsx("p",{className:"font-medium text-yellow-800",children:"Subscription will end"}),n.jsxs("p",{className:"text-yellow-700",children:["Your subscription will cancel on ",h(s.subscription.billing_period_end)]})]})]})]}),(a==null?void 0:a.features)&&a.features.length>0&&n.jsxs(n.Fragment,{children:[n.jsx(xn,{}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("h4",{className:"font-medium",children:"Included Features"}),n.jsx("ul",{className:"space-y-2",children:a.features.map((f,p)=>n.jsxs("li",{className:"flex items-center gap-2",children:[n.jsx(Gn,{className:"h-4 w-4 text-green-600"}),n.jsx("span",{className:"text-sm",children:f})]},p))})]})]}),n.jsx("div",{className:"pt-4",children:n.jsx(Ir,{to:"/settings",children:n.jsx(te,{className:"w-full",children:"Manage Subscription"})})})]})]}):n.jsxs(Te,{children:[n.jsx(st,{children:n.jsx(ot,{children:"Subscription Status"})}),n.jsxs(Re,{className:"space-y-4",children:[n.jsx("p",{children:"You don't have an active subscription."}),n.jsx(Ir,{to:"/settings",children:n.jsx(te,{children:"View Plans"})})]})]})}function Npt(){const[e,t]=g.useState(null),[r,s]=g.useState(!0);return g.useEffect(()=>{(async()=>{try{const{data:i}=await de.rpc("get_personal_account");if(!(i!=null&&i.account_id)){console.error("No account found");return}const{data:o,error:l}=await de.schema("marketing_and_customer_success").from("profiles").select("*").eq("id",i.account_id).single();if(l){console.error("Error fetching profile:",l);return}const c={...o,notificationPreferences:typeof o.notificationPreferences=="string"?JSON.parse(o.notificationPreferences):o.notificationPreferences};t(c)}catch(i){console.error("Error in fetchProfileData:",i)}finally{s(!1)}})()},[]),n.jsxs("div",{className:"container mx-auto p-6 space-y-6",children:[n.jsx(Zmt,{profileData:e}),n.jsx(xn,{className:"my-6"}),n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[n.jsx(wpt,{profileData:e,loading:r}),n.jsxs("div",{className:"space-y-6",children:[n.jsx(jpt,{profileData:e}),!1]})]})]})}function _pt(){const{session:e}=wa(),[t,r]=g.useState(`<html><head>
1885<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body><div dir="ltr"><span id="gmail-docs-internal-guid-a5c8cc31-7fff-6886-c36d-baf59e6fcb4e"><p dir="ltr" style="line-height:1.38; margin-top:0pt; margin-bottom:0pt"><span style="font-size:8pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(0,0,0); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline"><span class="gmail-Apple-tab-span" style=""></span></span><span style="font-size:8pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(0,0,0); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline"><span class="gmail-Apple-tab-span" style=""></span></span><span style="font-size:8pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(0,0,0); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline"><span class="gmail-Apple-tab-span" style=""></span></span><span style="font-size:8pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(0,0,0); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline"><span class="gmail-Apple-tab-span" style=""></span></span><span style="font-size:8pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(0,0,0); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline"><span class="gmail-Apple-tab-span" style=""></span></span><span style="font-size:8pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(0,0,0); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline"><span class="gmail-Apple-tab-span" style=""></span></span><span style="font-size:8pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(0,0,0); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline"><span class="gmail-Apple-tab-span" style=""></span></span><span style="font-size:8pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(0,0,0); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline"><span class="gmail-Apple-tab-span" style=""></span></span><span style="font-size:8pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(0,0,0); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline"><span class="gmail-Apple-tab-span" style=""></span></span><span style="font-size:8pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(0,0,0); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline"><span class="gmail-Apple-tab-span" style=""></span></span><span style="font-size:8pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(0,0,0); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline"><span class="gmail-Apple-tab-span" style=""></span></span></p><p dir="ltr" style="line-height:1.656; text-align:center; margin-top:0pt; margin-bottom:0pt"><span style="font-size:16pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(0,0,0); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">Wellness and Nutrition</span></p><p dir="ltr" style="line-height:1.38; text-align:center; margin-top:0pt; margin-bottom:0pt"><span style="font-size:11pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(0,0,0); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">Published February 25, 2025</span></p><p dir="ltr" style="line-height:1.38; text-align:center; margin-top:0pt; margin-bottom:0pt"></p><hr><p></p><br><p dir="ltr" style="line-height:1.38; margin-top:0pt; margin-bottom:0pt"><span style="font-size:11pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(67,67,67); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">For more insights and data storytelling on how the world is searching, follow us on Twitter </span><a href="https://notifications.google.com/g/p/AD-FnEwmRbd0FVA-OO11ytxy5_lT5uFvzayKXSkiHQNxFEwXV2t_U9XDfjH-j2YqLnRYCLs4VDFtH8E4idC9IGBrra8fOpRjjg" style="text-decoration-line:none"><span style="font-size:11pt; font-family:&quot;Google Sans&quot;,sans-serif; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; text-decoration-line:underline; vertical-align:baseline">@GoogleTrends</span></a><span style="font-size:11pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(67,67,67); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline"> and Instagram </span><a href="https://notifications.google.com/g/p/ANiao5pU9iQBR3vuuwbWTjiwn_jv-T9Fj08-7H98GmZTLjh85fBFTqSwBlaIaDjksnntu_t6Ox8k40MXaSt5BAKfRry3lwJfEnes_0aYonR4zbP7N4z7p3SW0U-KubLS2LN7zA5qWpg" style="text-decoration-line:none"><span style="font-size:12pt; font-family:&quot;Google Sans&quot;,sans-serif; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; text-decoration-line:underline; vertical-align:baseline">@googletrends</span></a><span style="font-size:11pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(67,67,67); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">. All data is correct at the time of writing.</span></p><br><p dir="ltr" style="line-
1885height:1.38; margin-top:0pt; margin-bottom:0pt"><span style="font-size:11pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(67,67,67); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">Simon Rogers</span></p><p dir="ltr" style="line-height:1.38; margin-top:0pt; margin-bottom:0pt"><span style="font-size:11pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(67,67,67); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">Data Editor, Google Trends</span></p><br><p dir="ltr" style="line-height:1.38; margin-top:0pt; margin-bottom:0pt"><span style="font-size:11pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(67,67,67); background-color:transparent; font-style:italic; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">With Sabrina Elfarra</span></p><p dir="ltr" style="line-height:1.38; margin-top:0pt; margin-bottom:0pt"></p><hr><p></p><h3 dir="ltr" style="line-height:1.38; margin-top:16pt; margin-bottom:4pt"><span style="font-size:14pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(66,133,244); background-color:transparent; font-weight:400; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">Top Trends</span></h3><ul style="margin-top:0px; margin-bottom:0px"><li dir="ltr" style="list-style-type:disc; font-size:11pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(0,0,0); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline; white-space:pre"><p dir="ltr" role="presentation" style="line-height:1.38; margin-top:12pt; margin-bottom:0pt"><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">Search interest in “</span><a href="https://notifications.google.com/g/p/ANiao5r3lxkGcQmjGZZLWnCRGxo_qmtQwUmFSngdYLZAmGpcHHNNxx48837oiR02XcWE7neDDx-U3wB4eo8E9dTWhr-6Q-5QEaqLLpd-KSC5q5JLVvCnQKGyN7O06udY05mMn2NTdgCDPCSicVtOo5PJSNEsB6HXxbyomQhyGgYXTyjP_jZZjILlA-Wv-m2O" style="text-decoration-line:none"><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; text-decoration-line:underline; vertical-align:baseline">no buy</span></a><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">” is at all time high, and &quot;</span><span style="font-size:11pt; background-color:transparent; font-weight:700; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">no buy year rules</span><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">&quot; increased +120% in 2025 and is one of the top-trending searches relating to “</span><span style="font-size:11pt; background-color:transparent; font-weight:700; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">underconsumption core</span><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">”</span></p></li><li dir="ltr" style="list-style-type:disc; font-size:11pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(0,0,0); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline; white-space:pre"><p dir="ltr" role="presentation" style="line-height:1.38; margin-top:0pt; margin-bottom:0pt"><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">“</span><a href="https://notifications.google.com/g/p/ANiao5oFCwQo4CNrWNrTmsrSdcwoa1De59-QUvtK0afbzMx5YV5pK2y7eJEYHKogdSf6m38PHF0fxmobUjh9Sg7qVZ7YmlUfD6W5LcXavIxx34Z8roGFaS5NEKU5zVgYHquuOESgzPS08Zuhvh9jsEEedgjStOwt83iDO4433RwYlQaL6WO3kt8opMuZVPCynJJzVEBcoA" style="text-decoration-line:none"><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; text-decoration-line:underline; vertical-align:baseline">nasa mars footage</span></a><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">” searches spiked +400% in the past week, and “</span><span style="font-size:11pt; background-color:transparent; font-weight:700; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">ice found on mars</span><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">” was a top-trending related search</span></p></li><li dir="ltr" style="list-style-type:disc; font-size:11pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(0,0,0); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline; white-space:pre"><p dir="ltr" role="presentation" style="line-height:1.38; margin-top:0pt; margin-bottom:0pt"><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">“</span><a href="https://notifications.google.com/g/p/ANiao5qV7e5qJxbh6s-V8qvAvEduW_LORvR1YOrv4Pk4ZX7_Ah-rGdLQcvwG2TcmaHX2T8a9j73z2nqfVvXWh2PsLVYJFVQHPHdL_e6JGaUj9wTWPAM2-ekl2GcFeApSR_dKavYbVkBsuBpVFXsVxJjloNu3oAluTHX1W1xrnFNnwCNt_zx6A3mW
1885SYvZtbPaG3nPb6n2M7DIGBBUj54aQQ" style="text-decoration-line:none"><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; text-decoration-line:underline; vertical-align:baseline">frozen fruit recall 2025</span></a><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">” was the top-trending recall searched in the past day, and </span><a href="https://notifications.google.com/g/p/ANiao5oVIx4u1bE4gLL3tilHOL9GaYmFoH5HpFVmoUC2_qc9U_xiuWYlPhTCVUliS13w5ciwu8XYvOvf7qu-Mzt7lhkCgS1cLx7knrnoelbodsPD1s4uUpfxrlALfkRI2Tg9zuXtVKPS2hHP9tkKW33BhsUGWe74rn7STazi1IoWW0cfrPnJ4fVlN_v3KTI" style="text-decoration-line:none"><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; text-decoration-line:underline; vertical-align:baseline">smoothie</span></a><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline"> was a top-trending related topic</span></p></li><li dir="ltr" style="list-style-type:disc; font-size:11pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(0,0,0); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline; white-space:pre"><p dir="ltr" role="presentation" style="line-height:1.38; margin-top:0pt; margin-bottom:0pt"><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">Search interest in “</span><span style="font-size:11pt; background-color:transparent; font-weight:700; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">earthquake nebraska</span><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">” spiked +850% in the past day, and “</span><a href="https://notifications.google.com/g/p/ANiao5ppRzlYdx5cMyCBs0VoJZZuN0-Dj3G7eG45IhA7SstTToAIqbL4HGyLZOuFA3qfij7_06SneNBk8U49L_mPKwzGvQpCIXNytLwyHIXT8jBYFKRykL20KxB64yNDhC4u4kRIx-leYblIpRXaqkkCO1HHWMExoUnxtv3IZ0sezpld1OoX3FEuroEoRu6ZZsDMUt1B7_53qFFxlV4" style="text-decoration-line:none"><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; text-decoration-line:underline; vertical-align:baseline">earthquake safety poster</span></a><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">” searches rose +250% in the US</span></p></li><li dir="ltr" style="list-style-type:disc; font-size:11pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(0,0,0); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline; white-space:pre"><p dir="ltr" role="presentation" style="line-height:1.38; margin-top:0pt; margin-bottom:0pt"><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">“</span><a href="https://notifications.google.com/g/p/ANiao5q2rASM2cZMDnnqQV-b5saXv4hPW7pCDeBHvOrB6wvm_GuE83CsBiSargjrO-jiVQriXNY9QqlDtgs9xdSR1X0AzYbnRR-MAnHDI_u78bJgG6RuXfODZtwPFMY2qzDQfMgoBtCzHY88d7Jxu9u92enYIIkgtCeS9QvRmC4Q5smGJPX_SaQ_NSgAfeHRRxi345O5YA0OWhpffVRsGgYHCqeVEamIT3q2zHfhMbB8SA2lcV4mjVBbGV3LSHIo" style="text-decoration-line:none"><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; text-decoration-line:underline; vertical-align:baseline">when was the last time all the planets aligned</span></a><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">” was a breakout search in the past day, and “</span><span style="font-size:11pt; background-color:transparent; font-weight:700; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">seven planet alignment</span><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">” rose +50%&nbsp;</span></p></li></ul><h3 dir="ltr" style="line-height:1.38; margin-top:16pt; margin-bottom:4pt"><span style="font-size:14pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(66,133,244); background-color:transparent; font-weight:400; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">Entertainment</span></h3><ul style="margin-top:0px; margin-bottom:0px"><li dir="ltr" style="list-style-type:disc; font-size:11pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(0,0,0); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline; white-space:pre"><p dir="ltr" role="presentation" style="line-height:1.38; margin-top:0pt; margin-bottom:0pt"><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">Search interest in actor </span><a href="https://notifications.google.com/g/p/ANiao5p-Ms4gKHBG_Zp1O4iH7naZJ18zEIZCPTDEFy_dHAIs_SGt7bGqMzkKWr2bEQITvbVjPjvR8SjsWp2BJ4qMCKtyf-jR1h9pYVuQAHxEG4AeSrzno1vIRk4Nbczl-o87PEYmKzeux4mwW9N
1885MPmfBkKHjLaMync6_o1kNRqcwHuXDSIw5431wXOJcpmtp7QYTlYU" style="text-decoration-line:none"><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; text-decoration-line:underline; vertical-align:baseline">John Amos</span></a><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline"> spiked +800% in the past day, and “suits cast” was the top-trending related search</span></p></li><li dir="ltr" style="list-style-type:disc; font-size:11pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(0,0,0); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline; white-space:pre"><p dir="ltr" role="presentation" style="line-height:1.38; margin-top:0pt; margin-bottom:0pt"><span style="font-size:11pt; background-color:transparent; font-weight:700; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">Roberta Flack</span><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline"> was the top-trending arts &amp; entertainment search in the past day, and “</span><a href="https://notifications.google.com/g/p/ANiao5qiTZ90P5xJNSuVetsjXUUOz-pxh7TpdZ3VFy8ua7U29sbn2p7Jtv34KEZOgPts8fzL8c_M4sPjKt1Lp7jGRZtHgDdOGTIa34ig5G0_dDTL9mwyeQfsQnBCbEMrWsYCGOCkmM7ffOnx4MZWlCgWBv4Vqm9zNSmGMTFPAchpD1NAv9htfVEPn9uwR5cg3AxFfvBEz262ktXXf2P01E3Dv0hvcQ" style="text-decoration-line:none"><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; text-decoration-line:underline; vertical-align:baseline">first time i saw your face</span></a><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">” was a breakout-related search</span></p></li><li dir="ltr" style="list-style-type:disc; font-size:11pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(0,0,0); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline; white-space:pre"><p dir="ltr" role="presentation" style="line-height:1.38; margin-top:0pt; margin-bottom:0pt"><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">“</span><span style="font-size:11pt; background-color:transparent; font-weight:700; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">sag awards speech</span><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">” searches are at a five year high, and Vermont was the top state searching in the past week</span></p></li></ul><h3 dir="ltr" style="line-height:1.38; margin-top:16pt; margin-bottom:4pt"><span style="font-size:14pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(66,133,244); background-color:transparent; font-weight:400; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">Lifestyle</span></h3><ul style="margin-top:0px; margin-bottom:0px"><li dir="ltr" style="list-style-type:disc; font-size:11pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(0,0,0); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline; white-space:pre"><p dir="ltr" role="presentation" style="line-height:1.38; margin-top:0pt; margin-bottom:0pt"><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">Searches for “</span><span style="font-size:11pt; background-color:transparent; font-weight:700; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">jacaranda tree care</span><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">” spiked +180% in the past week, and </span><a href="https://notifications.google.com/g/p/ANiao5pc3wGLrhTfytMzFhFiCUTrpiz94sR7EQfdo_YbaDBzh5Y9H7nAY_oTGw4Z9XPydHs1mH0hKxVETVGblOV_nRNyKPo3VkHWT75KYhhjboqe5WuKjnA0lVM9M3QN5zE-YKjOjzRDvixLBk-cdBIC5hgG9cSQk6DRQ14zPnVRnr7CGKppGDffQ7TGyB8" style="text-decoration-line:none"><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; text-decoration-line:underline; vertical-align:baseline">Blue Jacaranda</span></a><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline"> was the top-trending jacaranda tree type</span></p></li><li dir="ltr" style="list-style-type:disc; font-size:11pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(0,0,0); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline; white-space:pre"><p dir="ltr" role="presentation" style="line-height:1.38; margin-top:0pt; margin-bottom:0pt"><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">“</span><span style="font-size:11pt; background-color:transparent; font-weight:700; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">ribbon skirt</span><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">” searches doubled in the past week, and “</span><a href="https://notifications.google.com/g/p/ANiao5pzogkR4EDuTXnO3j_v1M2le_x0Q9IiET7EnystBPzU11-H-ZzZwjxdjcReqXFekyXKsx5qYts3pvcnZ82kGUVyV_dtERcq8g7PdTnP89Car4wbt5vqLd91brMba-3-hhEfJQDhNtMiyXJdToL6CqIewxdH6mQEScxpkd0q6MJex_F34whufo0dLJS3lSQKJ29IUgiJYWxAzy7-iw" style="text-decoration-line:none"><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; text-decoration-line:underline; vertical-align:baseline">what is a ribbon skirt</span></a><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">” searches spiked +130% in the past week</span></p></li><li dir="ltr" style="list-style-type:disc; font-size:11pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(0,0,0); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline; white-space:pre"><p dir="ltr" role="presentation" style="line-height:1.38; margin-top:0pt; margin-bottom:12pt"><a href="https://notifications.google.com/g/p/ANiao5pzFJdstJAB_cladJggYH7Svm0h0ptrwmc6r4fNOlfUh3HHVWTC7fhG5IHn0Hn-20zjM8cAqRj2Tz4qIytWJ5kXfkPtXZi-JaaEQnv2Cky1cZEbTzpjI6eCD1DnWlWLOE828Yh1XGyDRoMdfrG-eIo-5Da0nqlJ4lIpBfT_GFyFXdlUCvRvfdwFJZJb" style="text-decoration-line:none"><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; text-decoration-line:underline; vertical-align:baseline">Hair clip</span></a><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline"> currently being searched more than ever, and </span><span style="font-size:11pt; color:rgb(95,99,104); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">“</span><a href="https://notifications.google.com/g/p/ANiao5r9dHvcB9cfHP81BeZ3nuZvnSCbGwj5Nl-FX4RxH5Ju4e4Ce1LpGiKfkrhkY9xiwzxK3oJg62kJNariYDqkAafnWeb_SFlCEsngfRckB4A23SpFokgyzZCJHy0Ca5W_e6XjTOvwgzI-rA4MJbWA64fyY8ZWSYn0rJuOE64h4p0xqOOEGdbFQDsgT7o4c3amSG8jZKh775cYLg" style="text-decoration-line:none"><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; text-decoration-line:underline; vertical-align:baseline">leather hair barrette</span></a><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">” is a breakout search over the past 30 days</span></p></li></ul><h3 dir="ltr" style="line-height:1.38; margin-top:16pt; margin-bottom:4pt"><span style="font-size:14pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(66,133,244); background-color:transparent; font-weight:400; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">Sports</span></h3><ul style="margin-top:0px; margin-bottom:0px"><li dir="ltr" style="list-style-type:disc; font-size:11pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(0,0,0); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline; white-space:pre"><p dir="ltr" role="presentation" style="line-height:1.38; margin-top:0pt; margin-bottom:0pt"><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">“</span><a href="https://notifications.google.com/g/p/ANiao5qYdIIPo8M0LGMbsp1dMzwuoiDfOM2hx7nWNAER3E49z5XrgZrw3tulQYIOx7vl7DLKLQa43e6Tt-32B_CTsho_Ujplwl6LWXwNh3-bW1vXXPwsyneg_Ub4CgZ7TH3Olo_MY957HHNLpigk2tJ_mJ6Qf_OdYYR5V7Da65cr2HfgG-KGQSYukh6xu9JOpvoAI8I73ywiFA" style="text-decoration-line:none"><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; text-decoration-line:underline; vertical-align:baseline">australia vs south africa</span></a><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">” is the top trending search in the world over the past day and </span><a href="https://notifications.google.com/g/p/ANiao5oPifrY7oudZhI71ZYhRmM4ddzPHp30ayVtrziVMVTqCvDs-eCmbVUIqG_bDS7Aob4YoqAfl0BzJjR-1HtlKlFtL9nyzfa8BfIfYHSltmpATQrVoKrZ-NexF8r3vUcrTSsThfW6dk2UyhOKAeFbmG593TiIxCSlMFI4S5eJZNYm82WRztQT-OM" style="text-decoration-line:none"><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; text-decoration-line:underline; vertical-align:baseline">Cooper Connolly </span></a><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">is the top trending related player</span></p></li><li dir="ltr" style="list-style-type:disc; font-size:11pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(0,0,0); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline; white-space:pre"><p dir="ltr" role="presentation" style="line-height:1.38; margin-top:0pt; margin-bottom:0pt"><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">“</span><a href="https://notifications.google.com/g/p/ANiao5pwpuW_1J--hx0wCk6rCQDUYSUxxKcoyD9z_COES9aiBBazRVz473vptvMei9uVMf9V6ALQpftIJX5rXHUVMzfGACI8nOuYBPUrehgKmqCY4erv9Q9OjdWf_yOxVDC-bOofvt5VT7WhhgX0E1diESD8-Eejf5_8XAVdA8sBAiSQQ2N8olZXa0i4wAwlr0wz9X0" style="text-decoration-line:none"><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; text-decoration-line:underline; vertical-align:baseline">kyle filipowski stats</span></a><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">” was the top-trending “stats” searched in the past day, and he was the top three most trending Utah Jazz players in the past day</span></p></li><li dir="ltr" style="list-style-type:disc; font-size:11pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(0,0,0); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline; white-space:pre"><p dir="ltr" role="presentation" style="line-height:1.38; margin-top:0pt; margin-bottom:0pt"><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">“</span><a href="https://notifications.google.com/g/p/ANiao5q2gY4GkOA0hdNu_QDKqifgi_2xzp-QmvuniUsKfQBaLWiBtqDXH7B0Vu8UDSjkBvbwa8H-EkK7U93oQs7qLiAz-mO5D8xuqgG7HVB8qGkSb_izjrsHdtWYcy5nULL_ohgkAbOnZIpGXklZqPfxBfY3XwAdatJdmHhev0NWUP-ifYW0dVg5i1gTrA" style="text-decoration-line:none"><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; text-decoration-line:underline; vertical-align:baseline">zoe brooks</span></a><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">” of NC State is the top trending NCAA Division I Women's Basketball player over the past week and is currently being searched </span><a href="https://notifications.google.com/g/p/ANiao5qNtZtRpE_V3jNHAZcQOmXmzpdk67JkJW3wEUBGJQBhI5DIgRhCyMuFMCrhLYZH6G0yw0en96-CeAuUQBs6vOfhtpkfhIv-xUeUc-q3inRFEcEPQbUOE82PiYITF5jLmPkL2bONO9xqGyq8wYrHSMnlc38xxcdCsMRMitAmoRMMFsanqQ" style="text-decoration-line:none"><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; text-decoration-line:underline; vertical-align:baseline">more than ever before</span></a></p></li></ul><br><p dir="ltr" style="line-height:1.38; margin-top:0pt; margin-bottom:0pt"><a href="https://notifications.google.com/g/p/ANiao5p8s1cx2rPzKTjcVR8x9sYJGBqPwhVN2GXVPBn_xIPoF29bSRVHAZCH2YK8nkCoP0E3wb1iRt6NPcHjfGwqSEU_uyJbcWKYGwbf8zAp54-QXzMeYWDAr_KE_ZSYVOoNYYPCCKQujcy9W1NH3fJnBCnJT496vc4XNkmLgg" style="text-decoration-line:none"><span style="font-size:11pt; font-family:&quot;Google Sans&quot;,sans-serif; background-color:transparent; font-style:italic; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; text-decoration-line:underline; vertical-align:baseline">Find more daily top Trends here &gt;&gt;</span></a></p><p dir="ltr" style="line-height:1.38; margin-top:0pt; margin-bottom:0pt"></p><hr><p></p><h3 dir="ltr" style="line-height:1.38; margin-top:16pt; margin-bottom:4pt"><span style="font-size:14pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(66,133,244); background-color:transparent; font-weight:400; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">Daily Quiz</span></h3><p dir="ltr" style="line-height:1.38; text-align:center; margin-top:0pt; margin-bottom
1885:0pt"><span style="font-size:11pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(67,67,67); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">Which was searched more in the past month:</span></p><p dir="ltr" style="line-height:1.38; text-align:center; margin-top:0pt; margin-bottom:0pt"><span style="font-size:11pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(67,67,67); background-color:transparent; font-weight:700; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">Vitamin C </span><span style="font-size:11pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(67,67,67); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">or </span><span style="font-size:11pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(67,67,67); background-color:transparent; font-weight:700; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">vitamin D</span><span style="font-size:11pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(67,67,67); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">?</span></p><br><p dir="ltr" style="line-height:1.38; margin-top:0pt; margin-bottom:0pt"></p><hr><p></p><h3 dir="ltr" style="line-height:1.38; margin-top:16pt; margin-bottom:4pt"><span style="font-size:14pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(66,133,244); background-color:transparent; font-weight:400; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">Wellness and Nutrition</span></h3><ul style="margin-top:0px; margin-bottom:0px"><li dir="ltr" style="list-style-type:disc; font-size:11pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(0,0,0); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline; white-space:pre"><p dir="ltr" role="presentation" style="line-height:1.38; margin-top:0pt; margin-bottom:0pt"><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">Search interest in “</span><a href="https://notifications.google.com/g/p/ANiao5qtZav8eTXA0GQPVjtHwA1lQc_J-VuKLE2JPiTfbau2lyNm_lDvit3dFxB5PX47eIpufMmNT_UD69AgMatZYfuX0HxIT2RnJZKTUU873FRV9uSP9V9mKwbOIKsAtyVbFcR-RhKwtoqj2FgvMT4vkCiVVWg8NxBq-Y0tJqgnFpR8d83pQGkISa_Rut8lsife_RUXaO2V" style="text-decoration-line:none"><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; text-decoration-line:underline; vertical-align:baseline">best omega 3 supplement</span></a><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">” is at an all-time high, and “</span><a href="https://notifications.google.com/g/p/ANiao5pc1ZP9Evzl1C9MyvSgCo-i6llUdAdQ2b5FndAmlB8Obq9O1ch4PCuq1TAqZSM1yGkhd4N5TWy80IcsqLc5pAHewdMv9IrJQ70K7XcICpH5-IoG-Wo--HZq2qFeZ5aaBSBzLEMpVc4dhJ8YoVDZiGb6e7Vn8M6-V4gDgBtxA6883uCyrd-h_P7Uc-exUkxgPiKE9u4S66VL__4NUrw" style="text-decoration-line:none"><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; text-decoration-line:underline; vertical-align:baseline">best vitamins for women</span></a><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">” was a breakout-related search</span></p></li><li dir="ltr" style="list-style-type:disc; font-size:11pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(0,0,0); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline; white-space:pre"><p dir="ltr" role="presentation" style="line-height:1.38; margin-top:0pt; margin-bottom:0pt"><a href="https://notifications.google.com/g/p/ANiao5o8609x_xFUl_AbtFxMmS0197Uj9ulMr518ZsBs_WSuDkX5Y_nl0fJWM
1885ZA48aXzaTJBv8i8Jpl_8m5XK-yx7GV1NzfAisOcoMPxj7eTuU8S4EzFcUSUwkC-ARLsGH0fFJh78hx2JgL0IE-8151xWF5C-2tB-1PQpwbV-eg1tZL8Po27l9euUSO1LOGD" style="text-decoration-line:none"><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; text-decoration-line:underline; vertical-align:baseline">Dietary supplement</span></a><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline"> is at an all-time high, and “</span><a href="https://notifications.google.com/g/p/ANiao5pTdUSBtcOeJvUbYnZIPUgN0y3nf1hH1zGZ_PRpG9icHdULQUypmzpMqgSqJfzSQ4U-rlCIAEki1cK74_8TGdcEYn3gCHaQr06_GrxvaZUEmCfnK7pBZp95iCtuAvXtGHj-Ce6uymSLEeFpzJCLeoN53H8iY_kiV4Jhq61e-QHZJ2lKiI_KUEz-K3B3-7bovR-MW4fKeu7n9kpQD6U" style="text-decoration-line:none"><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; text-decoration-line:underline; vertical-align:baseline">best sources of calcium</span></a><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">” was a breakout search in the past month</span></p></li><li dir="ltr" style="list-style-type:disc; font-size:11pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(0,0,0); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline; white-space:pre"><p dir="ltr" role="presentation" style="line-height:1.38; margin-top:0pt; margin-bottom:0pt"><a href="https://notifications.google.com/g/p/ANiao5rYDyoa5qyyWrHAXa-DwNl5zITbb-dmNpyAOH8vJbHK2wkMEkh2gXJx4u1tT7rAuiEL1hh-AMoPg2mWbhkKaoD3kSCdwTlycO1I98yq6bgtgnkdTsLtYKGvoO__kDZNFDRcsxuOm5sJumbSmlzs_hr38xmBmTikJTSuhWbNK0cgdkAVzg" style="text-decoration-line:none"><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; text-decoration-line:underline; vertical-align:baseline">Peptide</span></a><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline"> search interest is at an all-time high, and “</span><a href="https://notifications.google.com/g/p/ANiao5pAoZsCmeveaLq-8pHiUJqFzmznhFW4JeQOX6vYQfhexfpKa8rgCwc2yGpp9GZTpdTppAVn0zEL-fiJt2Po6D6ta_v-EkGxK1RcFxhAC8h1hSnemCgcZxksqtvn7SvqJXRJ3wntqMk-AM5xeTW8id3mSkiQFvuC_WhOIjPwjwFbrfLu7m6SR-jk0qF7n7kTGgnqEI7Ewh3nGmk" style="text-decoration-line:none"><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; text-decoration-line:underline; vertical-align:baseline">lip balm with peptides</span></a><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">” spiked +250% in the past week</span></p></li><li dir="ltr" style="list-style-type:disc; font-size:11pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(0,0,0); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline; white-space:pre"><p dir="ltr" role="presentation" style="line-height:1.38; margin-top:0pt; margin-bottom:0pt"><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">Search interest in “</span><a href="https://notifications.google.com/g/p/ANiao5p3p0zTQjAtdbDpErwGYUY0dRbJ5p3E3_No5PAKZveJzYeg7QV4kL8_-Kc9wyM5khK1NpEiF3IvxvGyjTxNg5hJ34x7D_ePD9ZKzeROQaBz-Qi5HAB98rCX1H_L7-ql8ZhNAjddK5xSi5VxE-AroTctGckNrWCSl4fRHkyb1g-D0sGyW9IszciU2Pm-ZcHB7Ye23wNe5CAebMm1HWBx" style="text-decoration-line:none"><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; text-decoration-line:underline; vertical-align:baseline">best pre workout for men</span></a><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">” spiked +350% in the past week, and </span><a href="https://notifications.google.com/g/p/ANiao5pqbzDf94HA2hxgtsl1rXNditIrYUGsJlRjKr672ocsisS0FUFeiM0xQ8NyTWJ0J01fh8eZWr6Re3rvFFSAYsmIJZHYFJtvGBm3pCbiOIz17q3XDGfpHZ8T3J5K2X3a6vhGZZyJDrKUKQzJURth-vJDjY_F0l7ooKYcuQFCBccqxm5DpLjpIp5Th0A" style="text-decoration-line:none"><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; text-decoration-line:underline; vertical-align:baseline">oatmeal</span></a><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline"> was a top-trending related topic</span></p></li><li dir="ltr" style="list-style-type:disc; font-size:11pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(0,0,0); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline; white-space:pre"><p dir="ltr" role="presentation" style="line-height:1.38; margin-top:0pt; margin-bottom:0pt"><a href="https://notifications.google.com/g/p/ANiao5qp9nIAnnRbknsX8MyBsqWonM_W7vLR_FTHf8eaW7Pzb4jOvh6FyNtNyqkY23vKM3RLunjBY4GVsmDDc0TQPMtA2tiY3sEiHIig5lYOA460NSeqsEuWa7zN00jcyCFy5KM5VrLaTyieNyoX3_9gQKea_4sSfind05GKVj6naGAnYwWuLyy7KflmxCW-O_1zc_ZW8lpP0w" style="text-decoration-line:none"><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; text-decoration-line:underline; vertical-align:baseline">Superfoods</span></a><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline"> search interest is at a four year high, and Nebraska was the top state searching in the past month</span></p></li></ul><h4 dir="ltr" style="line-height:1.38; margin-top:14pt; margin-bottom:4pt"><a href="https://notifications.google.com/g/p/ANiao5qOJTb0kdksLdctw0nti971LFK5moZ5656SAYEO54asX69ePjEjtvtaLAyQfaYSGCNfCVLiq_SzE1fd9LJM3k1qjdJuvFfaEUX6Aoxa4zrxxyOUljpL4XU5eJWubdk1DQN9FqOcb3yam4SG1QeMgSYyrvTrj4INAL4oWaGU5XgzyemcORQpy
1885QQXNUKISj6AQ6tSV1PT1Kn5rRKEW7MyPI6xaWdokBEcWTscxRMpUKNuINWmBQznKU4mqGQjj8SaLDQF5WsjY8NB4hsJK91u" style="text-decoration-line:none"><span style="font-size:12pt; font-family:&quot;Google Sans&quot;,sans-serif; background-color:transparent; font-weight:400; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; text-decoration-line:underline; vertical-align:baseline">MAP</span></a><span style="font-size:12pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(102,102,102); background-color:transparent; font-weight:400; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">: “</span><span style="font-size:12pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(66,133,244); background-color:transparent; font-weight:400; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">improve sleep</span><span style="font-size:12pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(102,102,102); background-color:transparent; font-weight:400; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">” was the top-searched “improve” health search, followed by “</span><span style="font-size:12pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(246,207,82); background-color:transparent; font-weight:400; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">improve memory</span><span style="font-size:12pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(102,102,102); background-color:transparent; font-weight:400; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">” in the past month</span></h4><p dir="ltr" style="line-height:1.38; margin-top:0pt; margin-bottom:0pt"><span style="font-size:11pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(0,0,0); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline"><span style="border:none; display:inline-block; overflow:hidden; width:624px; height:215px"><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXdWuJQckAhcD-JZJ5_6nMCrWLBa5DB6flkpBdvCOpN2jBObb7lfRWw3G2_aGBOtV5TPjH1cFwC3mpHI9Y4x31mW2_WlflE3FVcQZ56kvkzEvCzqHnUBIf3yK2MW02cL6V4vWBhR34QMSS_lPFdq23-9OiwzrE1SoGE8cGcSn4rg1s6q?key=VTJy08An5KGac0GPBO2rXqp5" width="624" height="215" style="margin-left:0px; margin-top:0px"></span></span></p><h4 dir="ltr" style="line-height:1.38; margin-top:14pt; margin-bottom:4pt"><span style="font-size:12pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(102,102,102); background-color:transparent; font-weight:400; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">Top searched “is … a superfood”</span></h4><p dir="ltr" style="line-height:1.38; margin-top:0pt; margin-bottom:0pt"><span style="font-size:11pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(0,0,0); background-color:transparent; font-style:italic; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">Past week, US</span></p><ol style="margin-top:0px; margin-bottom:0px"><li dir="ltr" style="list-style-type:decimal; font-size:11pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(0,0,0); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline; white-space:pre"><p dir="ltr" role="presentation" style="line-height:1.38; margin-top:0pt; margin-bottom:0pt"><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">Matcha</span></p></li><li dir="ltr" style="list-style-type:decimal; font-size:11pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(0,0,0); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline; white-space:pre"><p dir="ltr" role="presentation" style="line-height:1.38; margin-top:0pt; margin-bottom:0pt"><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">Kiwi</span></p></li><li dir="ltr" style="list-style-type:decimal; font-size:11pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(0,0,0); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline; white-space:pre"><p dir="ltr" role="presentation" style="line-height:1.38; margin-top:0pt; margin-bottom:0pt"><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">Kale</span></p></li><li dir="ltr" style="list-style-type:decimal; font-size:11pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(0,0,0); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline; white-space:pre"><p dir="ltr" role="presentation" style="line-height:1.38; margin-top:0pt; margin-bottom:0pt"><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">Watermelon</span></p></li><li dir="ltr" style="list-style-type:decimal; font-size:11pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(0,0,0); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline; white-space:pre"><p dir="ltr" role="presentation" style="line-height:1.38; margin-top:0pt; margin-bottom:0pt"><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">Eggs</span></p></li></ol><h4 dir="ltr" style="line-height:1.38; margin-top:14pt; margin-bottom:4pt"><span style="font-size:12pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(102,102,102); background-color:transparent; font-weight:400; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">Top searched health-related “benefits of…”</span></h4><p dir="ltr" style="line-height:1.38; margin-top:0pt; margin-bottom:0pt"><span style="font-size:11pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(0,0,0); background-color:transparent; font-style:italic; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">Past month, US</span></p><ol style="margin-top:0px; margin-bottom:0px"><li dir="ltr" style="list-style-type:decimal; font-size:11pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(0,0,0); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline; white-space:pre"><p dir="ltr" role="presentation" style="line-height:1.38; margin-top:0pt; margin-bottom:0pt"><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">Water</span></p></li><li dir="ltr" style="list-style-type:decimal; font-size:11pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(0,0,0); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline; white-space:pre"><p dir="ltr" role="presentation" style="line-height:1.38; margin-top:0pt; margin-bottom:0pt"><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">Magnesium</span></p></li><li dir="ltr" style="list-style-type:decimal; font-size:11pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(0,0,0); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline; white-space:pre"><p dir="ltr" role="presentation" style="line-height:1.38; margin-top:0pt; margin-bottom:0pt"><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">Ginger</span></p></li><li dir="ltr" style="list-style-type:decimal; font-size:11pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(0,0,0); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline; white-space:pre"><p dir="ltr" role="presentation" style="line-height:1.38; margin-top:0pt; margin-bottom:0pt"><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">Sauna</span></p></li><li dir="ltr" style="list-style-type:decimal; font-size:11pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(0,0,0); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline; white-space:pre"><p dir="ltr" role="presentation" style="line-height:1.38; margin-top:0pt; margin-bottom:0pt"><span style="font-size:11pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">Milk&nbsp;</span></p></li></ol><br><h4 dir="ltr" style="line-height:1.38; margin-top:14pt; margin-bottom:4pt"><a href="https://notifications.google.com/g/p/ANiao5qenQ0MOl1yuZIGuVY01yvSEFNZNEkZ9FW_iXTbNR-SgCBORnayEoHCRrVwkkWOYo94aPuv9m1_k2JGi2BTiA2FIOkX19v4gmkMF6xIzzG0oSOi7bvECvNF5aV_6mPy54ftdyUwCg5ERzRFPV8ZjXjiWy-z9lbqRGtTDQpXW5kHrNui15aGYjHm4S4ikqjkO__wFOup8GnEvEEghfBYfcAAhcGdwnzzYw6jApxGI5wVNoCsTF_-ckbKN339CQtd5N6F" style="text-decoration-line:none"><span style="font-size:12pt; font-family:&quot;Google Sans&quot;,sans-serif; background-color:transparent; font-weight:400; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; text-decoration-line:underline; vertical-align:baseline">MAP</span></a><span style="font-size:12pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(102,102,102); background-color:transparent; font-weight:400; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">: </span><span style="font-size:12pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(52,168,83); background-color:transparent; font-weight:400; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">low carb diet</span><span style="font-size:12pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(102,102,102); background-color:transparent; font-weight:400; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline"> was one of the top-searched diets in the past year</span></h4><p dir="ltr" style="line-height:1.38; margin-top:0pt; margin-bottom:0pt"><span style="font-size:11pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(0,0,0); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline"><span style="border:none; display:inline-block; overflow:hidden; width:624px; height:212px"><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXf7mTMIzca7ca8oR4TVcE4aYNODaApP9VPvvfkM1co6Cx61d5hXqbS3XMV_yD7TdgomtqqMkajCfNh7Ckk8VYHmSy3r-msSGJsuZFcZ-zM8h_2Yo6xzBfYRW8mouty1qae7jBKSeAb
1885KFXVq8Eg4yLLUR9GjOuJBO1bkc0vXTSao3t-H?key=VTJy08An5KGac0GPBO2rXqp5" width="624" height="212" style="margin-left:0px; margin-top:0px"></span></span></p><br><p dir="ltr" style="line-height:1.38; margin-top:0pt; margin-bottom:0pt"></p><hr><p></p><h3 dir="ltr" style="line-height:1.38; margin-top:16pt; margin-bottom:4pt"><span style="font-size:14pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(66,133,244); background-color:transparent; font-weight:400; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">Daily Quiz answer</span></h3><p dir="ltr" style="line-height:1.38; margin-top:0pt; margin-bottom:0pt"><span style="font-size:11pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(0,0,0); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">Answer: Vitamin D&nbsp;</span></p><p dir="ltr" style="line-height:1.38; margin-top:0pt; margin-bottom:0pt"><span style="font-size:11pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(0,0,0); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline"><span style="border:none; display:inline-block; overflow:hidden; width:504px; height:420px"><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXeiDQCsCYhnvOZj4WAk8dq69fMcCVJ27_mw4g7lvYhW8TIurdzqkGYlBp2YRTaSlZIHnK2jHoaRtW-tk2QxvqkEfGZ72GFdfSWscc0ncmvPwVpb2lO-FJTeGVPNlgbbh9ZH33zwkudmlwURUCwAqhAwT7htKX7dVDNHkhOtkfx1vbM?key=VTJy08An5KGac0GPBO2rXqp5" width="504" height="420" style="margin-left:0px; margin-top:0px"></span></span></p><br><p dir="ltr" style="line-height:1.38; margin-top:0pt; margin-bottom:0pt"></p><hr><p></p><br><p dir="ltr" style="line-height:1.38; text-align:center; margin-top:0pt; margin-bottom:0pt"><span style="font-size:11pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(67,67,67); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">For more newsletters, subscribe here:&nbsp; </span><a href="https://notifications.google.com/g/p/ANiao5rFBpLkOcc9Mj4zy_9I5xczRFJErVQCH4QwQjCB3ReF5oy44t61L5QL7OJ1P7w4vb7Im8BpshnMyYaKqUzNVHCvnpQCLY3AC-iv1mdfwwLVke_i4DTH8DTOrDGNzj3BSFt_h_gdwVQ8L7tnCCohSXbqoQIYwvlBIeq_vUAgaUp6TvQmCWA9h5sYiN90JsQiH5r0xoVsZDaR-JxbEt3ndLGUW73E1qaQUllTsXiWsGngWZbsVXQh5SxfuZ4zP6pCWS-AoUtteA" style="text-decoration-line:none"><span style="font-size:11pt; font-family:&quot;Google Sans&quot;,sans-serif; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; text-decoration-line:underline; vertical-align:baseline">UK </span></a><span style="font-size:11pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(0,0,0); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">, </span><a href="https://notifications.google.com/g/p/ANiao5rTlBz4MM2sd6CPYdq3dBzUgHKWD-rzGagdXVqGJhtRsjfDBJE2l1E5GRGQfgoxwDDtKMAzK_4QltqBDYkqRFwSJsBScs1891PQKVcIIU6s-1GeUcs7GSgKwoaFatm4051opHx73fon2SYSEbTZRQxwX0ifqF3fusQxMPDplAAnl7TkeMeMpf0d-vISkz9pJY0MT0Zo4iY-6IlPJsxwkmo" style="text-decoration-line:none"><span style="font-size:11pt; font-family:&quot;Google Sans&quot;,sans-serif; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; text-decoration-line:underline; vertical-align:baseline">Germany</span></a><span style="font-size:11pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(0,0,0); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">, </span><a href="https://notifications.google.com/g/p/ANiao5pdOq2tbudJ_DArmMxJGZzMqBTWYgR6qlLuuRLoYPJ8_Z1ITwZZqqrcwpE8Ldwn7UskH0XS9LnRUaEGTBpXNbmyY0CL7oGKj1tYWXryFjeBxcFU-fPDLtwvCBRWhsAyWaGDgBm6qi06_FSsQ1zEJyuzMYDqQT3OnO3_u3e-nHYgDcAcbGEDiDEwqvaOMh1_GUiqKOOkstuz3lyAlFbyTpo" style="text-decoration-line:none"><span style="font-size:11pt; font-family:&quot;Google Sans&quot;,sans-serif; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; text-decoration-line:underline; vertical-align:baseline">Sports</span></a></p><p dir="ltr" style="line-height:1.38; margin-top:0pt; margin-bottom:0pt"></p><hr><span style="font-size:9pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(67,67,67); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">Methodology</span>
1885<p></p><ul style="margin-top:0px; margin-bottom:0px"><li dir="ltr" style="list-style-type:disc; font-size:9pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(67,67,67); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline; white-space:pre"><p dir="ltr" role="presentation" style="line-height:1.38; margin-top:0pt; margin-bottom:0pt"><span style="font-size:9pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">All data is based on the U.S. unless otherwise stated</span></p></li><li dir="ltr" style="list-style-type:disc; font-size:9pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(67,67,67); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline; white-space:pre"><p dir="ltr" role="presentation" style="line-height:1.38; margin-top:0pt; margin-bottom:0pt"><span style="font-size:9pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">All data is accurate the time of writing</span></p></li></ul><br><p dir="ltr" style="line-height:1.38; margin-top:0pt; margin-bottom:0pt"><span style="font-size:9pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(67,67,67); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">Notes</span></p><ul style="margin-top:0px; margin-bottom:0px"><li dir="ltr" style="list-style-type:disc; font-size:9pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(67,67,67); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline; white-space:pre"><p dir="ltr" role="presentation" style="line-height:1.38; margin-top:0pt; margin-bottom:0pt"><span style="font-size:9pt; background-color:transparent; font-style:italic; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">Breakout:</span><span style="font-size:9pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline"> search terms had a tremendous increase, in some cases&nbsp; because these terms are new and had few (if any) prior searches</span></p></li><li dir="ltr" style="list-style-type:disc; font-size:9pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(67,67,67); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline; white-space:pre"><p dir="ltr" role="presentation" style="line-height:1.38; margin-top:0pt; margin-bottom:0pt"><span style="font-size:9pt; background-color:transparent; font-style:italic; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">Top or Most Searched:</span><span style="font-size:9pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline"> search terms that rank highest by search volume for a given timeframe and location</span></p></li><li dir="ltr" style="list-style-type:disc; font-size:9pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(67,67,67); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline; white-space:pre"><p dir="ltr" role="presentation" style="line-height:1.38; margin-top:0pt; margin-bottom:0pt"><span style="font-size:9pt; background-color:transparent; font-style:italic; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">Trending Searches</span><span style="font-size:9pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">: search terms that had the highest spike in traffic over a given time period as compared with the previous equivalent period&nbsp;</span></p></li><li dir="ltr" style="list-style-type:disc; font-size:9pt; font-family:&quot;Google Sans&quot;,sans-serif; color:rgb(0,0,0); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline; white-space:pre"><p dir="ltr" role="presentation" style="line-height:1.38; margin-top:0pt; margin-bottom:0pt"><span style="font-size:9pt; color:rgb(67,67,67); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">For more information about our methodology and how to interpret the data, please read our</sp
1885an><a href="https://notifications.google.com/g/p/ANiao5pSrnWNuhid_4a0_5m02xxueBKTM1V9heJpw7k0GulJ1mpfnV1BHGAmG0qesXzeaHqOSYEhhn7EcHOoP7A00eS1RUtyBkXkNYvOH7DLo_MBuUqpupd-mDfsESkSWyD5qCoBbxfAFpzFePr_alWo3ujJq-yWorLZcu9f5N2GNe4qHA8b3BQ" style="text-decoration-line:none"><span style="font-size:9pt; color:rgb(67,67,67); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; text-decoration-line:underline; vertical-align:baseline"> </span><span style="font-size:9pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; text-decoration-line:underline; vertical-align:baseline">FAQs</span></a><span style="font-size:9pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline"> </span><span style="font-size:9pt; color:rgb(67,67,67); background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline">and</span><span style="font-size:9pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; vertical-align:baseline"> </span><a href="https://notifications.google.com/g/p/ANiao5qInefS12O3cch1iLWNkCz0b_BKuJfhRBygHiXwgxaoL3SpFx6d7aCfjL5SseO-94GDNTHTpb-YwrtOJnygm7ktx12pFon_t8s0926dzkr9zF0VSb4iSeMBRbxGtIwiET-fCDanGDKrgn6NNOa7dmVyMWmq3D0-zuZ9TPEOygBHYiZJnXOJR0udqx60FnenTNdOSWHFiYVSiLz3L0A" style="text-decoration-line:none"><span style="font-size:9pt; background-color:transparent; font-variant-numeric:normal; font-variant-east-asian:normal; font-variant-alternates:normal; text-decoration-line:underline; vertical-align:baseline">learn more here</span></a></p></li></ul><p dir="ltr" style="line-height:1.38; margin-top:0pt; margin-bottom:0pt"></p><hr><p></p><br><br></span></div>
1885Google LLC 1600 Amphitheatre Parkway, Mountain View, CA 94043.<br><br>This email was sent to [email protected] because you have subscribed to the Google Trends Daily Trending Newsletter. If you do not wish to receive such emails in the future, please <a href="https://myaccount.google.com/communication-preferences/unsubscribe/gt/ANiao5pb-pU9OBF-cb8HyFpdVjIR1ns8n502e90VEPe0sc9VH75XdkIxmoB4b3snT48I6sYbBcAq4bchwKzqLw0GCaNxymbe91OEN2uwRN55eXHGYNqooaW3U6Z8kxnNYiWlNq9F1XQcAIqfrJRtGAoU3176X1CywaxCAxEJLldZMRAnf8P7kgUCkwp1k4FP60kq9n7QmAYy00bJez2ANiehTClkEwGtYL6D9wRt-jA2QbumDq0DJCCKYCD2m-mURKLi6LS2yg?utm_source=gm&amp;utm_medium=email&amp;auto=true">unsubscribe here</a> </body></html>
1886`),[s,a]=g.useState(""),[i,o]=g.useState(!1),[l,c]=g.useState(null),[d,u]=g.useState(null),[h,m]=g.useState(!0),[f,p]=g.useState([]),[A,v]=g.useState(null);g.useEffect(()=>{async function b(){try{if(!de)throw new Error("Supabase client not initialized");const{data:y,error:w}=await de.from("custom_news_sources").select("id, source_name, source_type").order("source_name");if(w)throw w;p(y||[]),y&&y.length>0&&a(y[0].id)}catch(y){console.error("Error fetching sources:",y),v(y instanceof Error?y.message:"Failed to load news sources")}finally{m(!1)}}b()},[de]);const x=async b=>{if(b.preventDefault(),!e){u("You must be logged in to process content");return}if(!t.trim()){u("Content cannot be empty");return}o(!0),u(null),c(null);try{if(!f.find(S=>S.id===s))throw new Error("Please select a valid news source");const N=await fetch("https://worker.rainfactory.ai/rainfactory/process-news-content",{method:"POST",headers:{Authorization:`Bearer ${e.access_token}`,"Content-Type":"application/json",apikey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im9sZ25uZW5jY3F3d2JhaGNwc2duIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MjQxNjUyMDksImV4cCI6MjAzOTc0MTIwOX0.qUa9W4vEYLC7LaUPczpqHA9tp8NSiWB7POqOWEvJpYQ"},body:JSON.stringify({content:t,source:s})});if(!N.ok)throw new Error("Failed to process content");const _=await N.json();c(JSON.stringify(_,null,2))}catch(y){console.error("Processing error:",y),u(y instanceof Error?y.message:"An error occurred while processing content")}finally{o(!1)}};return n.jsxs("div",{className:"space-y-4",children:[n.jsx("h2",{className:"text-xl font-semibold",children:"Content Processing Test"}),n.jsxs("form",{onSubmit:x,className:"space-y-4",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx("label",{className:"text-sm font-medium",children:"Content"}),n.jsx(Zr,{value:t,onChange:b=>r(b.target.value),placeholder:"Paste content to process...",className:"min-h-[200px]"})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("label",{className:"text-sm font-medium",children:"News Source"}),h?n.jsx(Lt,{className:"h-10 w-full"}):A?n.jsx(Ar,{variant:"destructive",children:n.jsx(gr,{children:A})}):n.jsxs(ur,{value:s,onValueChange:b=>a(b),children:[n.jsx(or,{className:"w-full bg-background border-input",children:n.jsx(hr,{placeholder:"Select news source"})}),n.jsx(lr,{className:"bg-popover border-input shadow-md",children:f.map(b=>n.jsxs(Fe,{value:b.id,className:"hover:bg-accent",children:[b.source_name," (",b.source_type,")"]},b.id))})]})]}),n.jsx(te,{type:"submit",disabled:i,variant:"default",className:"bg-primary text-primary-foreground hover:bg-primary/90 transition-colors",children:i?"Processing...":"Process Content"})]}),d&&n.jsx(Ar,{variant:"destructive",children:n.jsx(gr,{children:d})}),l&&n.jsxs("div",{className:"space-y-4",children:[n.jsx("h3",{className:"text-lg font-medium",children:"Content Submitted"}),n.jsx("pre",{className:"bg-background p-4 rounded-md",children:l})]})]})}function Cpt(){const[e,t]=g.useState([]),[r,s]=g.useState(!0);console.log(r);const[a,i]=g.useState(null),{toast:o}=sn(),[l,c]=g.useState({source_name:"",source_type:"url",source_description:"",news_source_url:"",rss_url:"",email_inbox_address:"",email_imap_server:"",email_imap_port:993,email_imap_username:"",email_imap_password:"",ingestion_filtering_rules:""});g.useEffect(()=>{d()},[]);const d=async()=>{try{const{data:f,error:p}=await de.from("custom_news_sources").select("*").order("source_name");if(p)throw p;t(f||[])}catch(f){console.error("Error fetching sources:",f),o({title:"Error",description:"Failed to fetch news sources",variant:"destructive"})}finally{s(!1)}},u=async f=>{f.preventDefault();try{if(a){const{error:p}=await de.from("custom_news_sources").update(l).eq("id",a);if(p)throw p;o({title:"Success",description:"News source updated successfully"})}else{const p=new Date().toISOString(),{error:A}=await de.from("custom_news_sources").insert([{...l,created_at:p,updated_at:p,source_name:l.source_name,source_type:l.source_type}]);if(A)throw A;o({title:"Success",description:"News source added successfully"})}i(null),c({source_name:"",source_type:"url",source_description:"",news_source_url:"",rss_url:"",email_inbox_address:"",email_imap_server:"",email_imap_port:993,email_imap_username:"",email_imap_password:"",ingestion_filtering_rules:""}),d()}catch(p){console.error("Error saving source:",p),o({title:"Error",description:"Failed to save news source",variant:"destructive"})}},h=f=>{i(f.id),c(f)},m=async f=>{try{const{error:p}=await de.from("custom_news_sources").delete().eq("id",f);if(p)throw p;o({title:"Success",description:"News source deleted successfully"}),d()}catch(p){console.error("Error deleting source:",p),o({title:"Error",description:"Failed to delete news source",variant:"destructive"})}};return n.jsxs("div",{className:"space-y-4",children:[n.jsxs(Zt,{children:[n.jsx(aC,{asChild:!0,children:n.jsxs(te,{children:[n.jsx(al,{className:"h-4 w-4 mr-2"}),"Add News Source"]})}),n.jsxs(Jt,{className:"sm:max-w-[425px]",children:[n.jsxs(_r,{children:[n.jsxs(tr,{children:[a?"Edit":"Add"," News Source"]}),n.jsx(Hr,{children:"Configure a new source for news content ingestion."})]}),n.jsxs("form",{onSubmit:u,className:"space-y-4",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"source_name",children:"Source Name"}),n.jsx(qe,{id:"source_name",value:l.source_name,onChange:f=>c(p=>({...p,source_name:f.target.value})),required:!0})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"source_type",children:"Source Type"}),n.jsxs(ur,{value:l.source_type,onValueChange:f=>c(p=>({...p,source_type:f})),children:[n.jsx(or,{children:n.jsx(hr,{placeholder:"Select source type"})}),n.jsxs(lr,{children:[n.jsx(Fe,{value:"url",children:"URL"}),n.jsx(Fe,{value:"rss",children:"RSS"}),n.jsx(Fe,{value:"email",children:"Email"})]})]})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"source_description",children:"Description"}),n.jsx(qe,{id:"source_description",value:l.source_description||"",onChange:f=>c(p=>({...p,source_description:f.target.value}))})]}),l.source_type==="url"&&n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"news_source_url",children:"Source URL"}),n.jsx(qe,{id:"news_source_url",value:l.news_source_url||"",onChange:f=>c(p=>({...p,news_source_url:f.target.value}))})]}),l.source_type==="rss"&&n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"rss_url",children:"RSS URL"}),n.jsx(qe,{id:"rss_url",value:l.rss_url||"",onChange:f=>c(p=>({...p,rss_url:f.target.value}))})]}),l.source_type==="email"&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"email_inbox_address",children:"Email Address"}),n.jsx(qe,{id:"email_inbox_address",value:l.email_inbox_address||"",onChange:f=>c(p=>({...p,email_inbox_address:f.target.value}))})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"email_imap_server",children:"IMAP Server"}),n.jsx(qe,{id:"email_imap_server",value:l.email_imap_server||"",onChange:f=>c(p=>({...p,email_imap_server:f.target.value}))})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"email_imap_port",children:"IMAP Port"}),n.jsx(qe,{id:"email_imap_port",type:"number",value:l.email_imap_port||993,onChange:f=>c(p=>({...p,email_imap_port:parseInt(f.target.value)}))})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"email_imap_username",children:"IMAP Username"}),n.jsx(qe,{id:"email_imap_username",value:l.email_imap_username||"",onChange:f=>c(p=>({...p,email_imap_username:f.target.value}))})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"email_imap_password",children:"IMAP Password"}),n.jsx(qe,{id:"email_imap_password",type:"password",value:l.email_imap_password||"",onChange:f=>c(p=>({...p,email_imap_password:f.target.value}))})]})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"ingestion_filtering_rules",children:"Filtering Rules"}),n.jsx(qe,{id:"ingestion_filtering_rules",value:l.ingestion_filtering_rules||"",onChange:f=>c(p=>({...p,ingestion_filtering_rules:f.target.value}))})]}),n.jsx(Sn,{children:n.jsxs(te,{type:"submit",children:[a?"Update":"Add"," Source"]})})]})]})]}),n.jsx("div",{className:"rounded-md border",children:n.jsxs(po,{children:[n.jsx(Ao,{children:n.jsxs(Yr,{children:[n.jsx($t,{children:"Name"}),n.jsx($t,{children:"Type"}),n.jsx($t,{children:"Description"}),n.jsx($t,{className:"text-right",children:"Actions"})]})}),n.jsx(go,{children:e.map(f=>n.jsxs(Yr,{children:[n.jsx(mt,{className:"font-medium",children:f.source_name}),n.jsx(mt,{children:f.source_type}),n.jsx(mt,{children:f.source_description}),n.jsxs(mt,{className:"text-right",children:[n.jsx(te,{variant:"ghost",size:"icon",onClick:()=>h(f),children:n.jsx(cm,{className:"h-4 w-4"})}),n.jsx(te,{variant:"ghost",size:"icon",onClick:()=>m(f.id),children:n.jsx(va,{className:"h-4 w-4"})})]})]},f.id))})]})})]})}const Spt=Jte,Zoe=g.forwardRef(({className:e,...t},r)=>n.jsx(fS,{ref:r,className:ye("flex flex-col rounded-lg bg-muted p-1 text-muted-foreground
1886/70",e),...t}));Zoe.displayName=fS.displayName;const lc=g.forwardRef(({className:e,...t},r)=>n.jsx(mS,{ref:r,className:ye("flex items-center justify-start whitespace-nowrap rounded-md px-3 py-2 text-sm font-medium outline-offset-2 transition-all w-full hover:text-muted-foreground focus-visible:outline focus-visible:outline-2 focus-visible:outline-ring/70 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm data-[state=active]:shadow-black/5",e),...t}));lc.displayName=mS.displayName;const jl=g.forwardRef(({className:e,...t},r)=>n.jsx(pS,{ref:r,className:ye("outline-offset-2 focus-visible:outline focus-visible:outline-2 focus-visible:outline-ring/70",e),...t}));jl.displayName=pS.displayName;function kpt({content:e,open:t,onOpenChange:r}){if(!e)return null;const s=({title:o,value:l})=>n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-medium text-muted-foreground mb-1",children:o}),n.jsx("p",{className:"whitespace-pre-wrap break-words overflow-wrap-anywhere",children:l||"Not available"})]}),a=(()=>{try{if(!e.authoritative_urls)return[];const o=e.authoritative_urls;return Array.isArray(o)?o.filter(l=>l&&typeof l=="object"&&"url"in l):[]}catch(o){return console.error("Error parsing authoritative URLs:",o),[]}})(),i=(()=>{try{if(!e.interesting_links)return[];const o=e.interesting_links;return Array.isArray(o)?o.filter(l=>l&&typeof l=="object"&&"url"in l):[]}catch(o){return console.error("Error parsing interesting links:",o),[]}})();return n.jsx(Zt,{open:t,onOpenChange:r,children:n.jsxs(Jt,{className:"max-w-4xl max-h-[80vh] overflow-y-auto",children:[n.jsx(_r,{children:n.jsx(tr,{className:"break-words overflow-wrap-anywhere",children:e.raw_headline||e.name})}),n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"space-y-4",children:[n.jsx(s,{title:"Content",value:e.raw_content||e.description}),e.contents&&n.jsx(s,{title:"Contents",value:e.contents}),n.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[n.jsx(s,{title:"Name",value:e.name}),n.jsx(s,{title:"Primary Keyword",value:e.primary_keyword})]})]}),e.images&&n.jsxs("div",{className:"border-t pt-4",children:[n.jsx("h2",{className:"text-lg font-semibold mb-3",children:"News Content Images"}),n.jsx("div",{className:"space-y-2",children:(()=>{try{return(Array.isArray(e.images)?e.images:[]).map((l,c)=>n.jsx("div",{className:"border rounded p-3",children:n.jsx("img",{src:typeof l=="string"?l:(l==null?void 0:l.url)||l,alt:`News content image ${c+1}`,className:"max-w-full h-auto rounded",onError:d=>{d.target.style.display="none"}})},c))}catch{return n.jsx("p",{className:"text-sm text-muted-foreground",children:"Error loading images"})}})()})]}),n.jsxs("div",{className:"border-t pt-4",children:[n.jsx("h2",{className:"text-lg font-semibold mb-3",children:"Trend Analysis"}),n.jsxs("div",{className:"space-y-4",children:[n.jsx(s,{title:"Trend",value:e.trend}),n.jsx(s,{title:"Trend Analysis",value:e.trend_analysis}),n.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[n.jsx(s,{title:"Longevity (Days)",value:e.longevity_in_days}),n.jsx(s,{title:"Months Till Peak",value:e.months_till_peak}),n.jsx(s,{title:"Total Duration (Months)",value:e.total_duration_in_months})]})]})]}),n.jsxs("div",{className:"border-t pt-4",children:[n.jsx("h2",{className:"text-lg font-semibold mb-3",children:"Business Analysis"}),n.jsxs("div",{className:"space-y-4",children:[n.jsx(s,{title:"Audience and Brand Analysis",value:e.audience_and_brand_analysis}),n.jsx(s,{title:"Business Opportunities",value:e.business_opportunities_anal
1886ysis}),n.jsx(s,{title:"Comparable Trends",value:e.comparable_trends})]})]}),n.jsxs("div",{className:"border-t pt-4",children:[n.jsx("h2",{className:"text-lg font-semibold mb-3",children:"Virality Metrics"}),n.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[n.jsx(s,{title:"Virality Score",value:e.virality_score}),n.jsx(s,{title:"Virality Explanation",value:e.virality_explanation})]})]}),n.jsxs("div",{className:"border-t pt-4",children:[n.jsx("h2",{className:"text-lg font-semibold mb-3",children:"Metadata"}),n.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[n.jsx(s,{title:"Created",value:new Date(e.created_at).toLocaleString()}),n.jsx(s,{title:"Updated",value:e.updated_at?new Date(e.updated_at).toLocaleString():"Never"}),n.jsx(s,{title:"Status",value:e.status})]}),n.jsxs("div",{className:"grid grid-cols-2 gap-4 mt-4",children:[n.jsx(s,{title:"Enrichment Status",value:e.enrichment_status}),n.jsx(s,{title:"Source",value:e.custom_news_source_id})]})]}),e.related_news_and_data&&n.jsxs("div",{className:"border-t pt-4",children:[n.jsx("h2",{className:"text-lg font-semibold mb-3",children:"Related News and Data"}),n.jsx("div",{className:"bg-muted p-4 rounded-md whitespace-pre-wrap break-words overflow-wrap-anywhere font-mono text-sm",children:JSON.stringify(e.related_news_and_data,null,2)})]}),e.images&&n.jsxs("div",{className:"border-t pt-4",children:[n.jsx("h2",{className:"text-lg font-semibold mb-3",children:"Images"}),n.jsx("div",{className:"bg-muted p-4 rounded-md whitespace-pre-wrap break-words overflow-wrap-anywhere font-mono text-sm",children:JSON.stringify(e.images,null,2)})]}),i.length>0&&n.jsxs("div",{className:"border-t pt-4",children:[n.jsx("h2",{className:"text-lg font-semibold mb-3",children:"Interesting Links"}),n.jsx("div",{className:"space-y-4",children:i.map((o,l)=>n.jsxs("div",{className:"bg-muted p-4 rounded-md break-words overflow-wrap-anywhere",children:[o.title&&n.jsx("div",{className:"font-medium mb-2 break-words overflow-wrap-anywhere text-lg",children:o.title}),n.jsx("div",{className:"mb-2",children:n.jsx("a",{href:o.url,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:underline break-all overflow-wrap-anywhere text-sm",children:o.url})}),o.author&&n.jsxs("div",{className:"text-sm text-muted-foreground mb-2",children:["Author: ",o.author]}),o.publishedDate&&n.jsxs("div",{className:"text-sm text-muted-foreground mb-2",children:["Published: ",new Date(o.publishedDate).toLocaleDateString()]}),o.contents&&n.jsxs("div",{className:"text-sm mt-3 p-3 bg-background rounded border-l-2 border-primary/20",children:[n.jsx("div",{className:"font-medium text-muted-foreground mb-1",children:"Content:"}),n.jsx("div",{className:"whitespace-pre-wrap break-words overflow-wrap-anywhere",children:o.contents})]}),o.image&&n.jsx("div",{className:"mt-3",children:n.jsx("img",{src:o.image,alt:o.title||"Content image",className:"max-w-full h-auto rounded border",onError:c=>{c.target.style.display="none"}})})]},l))})]}),a.length>0&&n.jsxs("div",{className:"border-t pt-4",children:[n.jsx("h2",{className:"text-lg font-semibold mb-3",children:"Authoritative URLs"}),n.jsx("div",{className:"space-y-2",children:a.map((o,l)=>n.jsxs("div",{className:"bg-muted p-3 rounded-md break-words overflow-wrap-anywhere",children:[o.title&&n.jsx("div",{className:"font-medium mb-1 break-words overflow-wrap-anywhere",children:o.title}),n.jsx("a",{href:o.url,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:underline break-all overflow-wrap-anywhere",children:o.url})]},l))})]})]})]})})}/**
1887   * table-core
1888   *
1889   * Copyright (c) TanStack
1890   *
1891   * This source code is licensed under the MIT license found in the
1892   * LICENSE.md file in the root directory of this source tree.
1893   *
1894   * @license MIT
1895   */function Ph(e,t){return typeof e=="function"?e(t):e}function dl(e,t){return r=>{t.setState(s=>({...s,[e]:Ph(r,s[e])}))}}function bk(e){return e instanceof Function}function Ept(e){return Array.isArray(e)&&e.every(t=>typeof t=="number")}function Bpt(e,t){const r=[],s=a=>{a.forEach(i=>{r.push(i);const o=t(i);o!=null&&o.length&&s(o)})};return s(e),r}function br(e,t,r){let s=[],a;return i=>{let o;r.key&&r.debug&&(o=Date.now());const l=e(i);if(!(l.length!==s.length||l.some((u,h)=>s[h]!==u)))return a;s=l;let d;if(r.key&&r.debug&&(d=Date.now()),a=t(...l),r==null||r.onChange==null||r.onChange(a),r.key&&r.debug&&r!=null&&r.debug()){const u=Math.round((Date.now()-o)*100)/100,h=Math.round((Date.now()-d)*100)/100,m=h/16,f=(p,A)=>{for(p=String(p);p.length<A;)p=" "+p;return p};console.info(`%c⏱ ${f(h,5)} /${f(u,5)} ms`,`
1896            font-size: .6rem;
1897            font-weight: bold;
1898            color: hsl(${Math.max(0,Math.min(120-120*m,120))}deg 100% 31%);`,r==null?void 0:r.key)}return a}}function yr(e,t,r,s){return{debug:()=>{var a;return(a=e==null?void 0:e.debugAll)!=null?a:e[t]},key:!1,onChange:s}}function Tpt(e,t,r,s){const a=()=>{var o;return(o=i.getValue())!=null?o:e.options.renderFallbackValue},i={id:`${t.id}_${r.id}`,row:t,column:r,getValue:()=>t.getValue(s),renderValue:a,getContext:br(()=>[e,r,t,i],(o,l,c,d)=>({table:o,column:l,row:c,cell:d,getValue:d.getValue,renderValue:d.renderValue}),yr(e.options,"debugCells"))};
vendor: 44,768 bytes, line 1898
1898return e._features.forEach(o=>{o.createCell==null||o.createCell(i,r,t,e)},{}),i}function Ppt(e,t,r,s){var a,i;const l={...e._getDefaultColumnDef(),...t},c=l.accessorKey;let d=(a=(i=l.id)!=null?i:c?typeof String.prototype.replaceAll=="function"?c.replaceAll(".","_"):c.replace(/\./g,"_"):void 0)!=null?a:typeof l.header=="string"?l.header:void 0,u;if(l.accessorFn?u=l.accessorFn:c&&(c.includes(".")?u=m=>{let f=m;for(const A of c.split(".")){var p;f=(p=f)==null?void 0:p[A]}return f}:u=m=>m[l.accessorKey]),!d)throw new Error;let h={id:`${String(d)}`,accessorFn:u,parent:s,depth:r,columnDef:l,columns:[],getFlatColumns:br(()=>[!0],()=>{var m;return[h,...(m=h.columns)==null?void 0:m.flatMap(f=>f.getFlatColumns())]},yr(e.options,"debugColumns")),getLeafColumns:br(()=>[e._getOrderColumnsFn()],m=>{var f;if((f=h.columns)!=null&&f.length){let p=h.columns.flatMap(A=>A.getLeafColumns());return m(p)}return[h]},yr(e.options,"debugColumns"))};for(const m of e._features)m.createColumn==null||m.createColumn(h,e);return h}const vi="debugHeaders";function gV(e,t,r){var s;let i={id:(s=r.id)!=null?s:t.id,column:t,index:r.index,isPlaceholder:!!r.isPlaceholder,placeholderId:r.placeholderId,depth:r.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const o=[],l=c=>{c.subHeaders&&c.subHeaders.length&&c.subHeaders.map(l),o.push(c)};return l(i),o},getContext:()=>({table:e,header:i,column:t})};return e._features.forEach(o=>{o.createHeader==null||o.createHeader(i,e)}),i}const Ipt={createTable:e=>{e.getHeaderGroups=br(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,r,s,a)=>{var i,o;const l=(i=s==null?void 0:s.map(h=>r.find(m=>m.id===h)).filter(Boolean))!=null?i:[],c=(o=a==null?void 0:a.map(h=>r.find(m=>m.id===h)).filter(Boolean))!=null?o:[],d=r.filter(h=>!(s!=null&&s.includes(h.id))&&!(a!=null&&a.includes(h.id)));return cj(t,[...l,...d,...c],e)},yr(e.options,vi)),e.getCenterHeaderGroups=br(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,r,s,a)=>(r=r.filter(i=>!(s!=null&&s.includes(i.id))&&!(a!=null&&a.includes(i.id))),cj(t,r,e,"center")),yr(e.options,vi)),e.getLeftHeaderGroups=br(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,r,s)=>{var a;const i=(a=s==null?void 0:s.map(o=>r.find(l=>l.id===o)).filter(Boolean))!=null?a:[];return cj(t,i,e,"left")},yr(e.options,vi)),e.getRightHeaderGroups=br(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,r,s)=>{var a;const i=(a=s==null?void 0:s.map(o=>r.find(l=>l.id===o)).filter(Boolean))!=null?a:[];return cj(t,i,e,"right")},yr(e.options,vi)),e.getFooterGroups=br(()=>[e.getHeaderGroups()],t=>[...t].reverse(),yr(e.options,vi)),e.getLeftFooterGroups=br(()=>[e.getLeftHeaderGroups()],t=>[...t].reverse(),yr(e.options,vi)),e.getCenterFooterGroups=br(()=>[e.getCenterHeaderGroups()],t=>[...t].reverse(),yr(e.options,vi)),e.getRightFooterGroups=br(()=>[e.getRightHeaderGroups()],t=>[...t].reverse(),yr(e.options,vi)),e.getFlatHeaders=br(()=>[e.getHeaderGroups()],t=>t.map(r=>r.headers).flat(),yr(e.options,vi)),e.getLeftFlatHeaders=br(()=>[e.getLeftHeaderGroups()],t=>t.map(r=>r.headers).flat(),yr(e.options,vi)),e.getCenterFlatHeaders=br(()=>[e.getCenterHeaderGroups()],t=>t.map(r=>r.headers).flat(),yr(e.options,vi)),e.getRightFlatHeaders=br(()=>[e.getRightHeaderGroups()],t=>t.map(r=>r.headers).flat(),yr(e.options,vi)),e.getCenterLeafHeaders=br(()=>[e.getCenterFlatHeaders()],t=>t.filter(r=>{var s;return!((s=r.subHeaders)!=null&&s.length)}),yr(e.options,vi)),e.getLeftLeafHeaders=br(()=>[e.getLeftFlatHeaders()],t=>t.filter(r=>{var s;return!((s=r.subHeaders)!=null&&s.length)}),yr(e.options,vi)),e.getRightLeafHeaders=br(()=>[e.getRightFlatHeaders()],t=>t.filter(r=>{var s;return!((s=r.subHeaders)!=null&&s.length)}),yr(e.options,vi)),e.getLeafHeaders=br(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(t,r,s)=>{var a,i,o,l,c,d;return[...(a=(i=t[0])==null?void 0:i.headers)!=null?a:[],...(o=(l=r[0])==null?void 0:l.headers)!=null?o:[],...(c=(d=s[0])==null?void 0:d.headers)!=null?c:[]].map(u=>u.getLeafHeaders()).flat()},yr(e.options,vi))}};function cj(e,t,r,s){var a,i;let o=0;const l=function(m,f){f===void 0&&(f=1),o=Math.max(o,f),m.filter(p=>p.getIsVisible()).forEach(p=>{var A;(A=p.columns)!=null&&A.length&&l(p.columns,f+1)},0)};l(e);let c=[];const d=(m,f)=>{const p={depth:f,id:[s,`${f}`].filter(Boolean).join("_"),headers:[]},A=[];m.forEach(v=>{const x=[...A].reverse()[0],b=v.column.depth===p.depth;let y,w=!1;if(b&&v.column.parent?y=v.column.parent:(y=v.column,w=!0),x&&(x==null?void 0:x.column)===y)x.subHeaders.push(v);else{const j=gV(r,y,{id:[s,f,y.id,v==null?void 0:v.id].filter(Boolean).join("_"),isPlaceholder:w,placeholderId:w?`${A.filter(N=>N.column===y).length}`:void 0,depth:f,index:A.length});j.subHeaders.push(v),A.push(j)}p.headers.push(v),v.headerGroup=p}),c.push(p),f>0&&d(A,f-1)},u=t.map((m,f)=>gV(r,m,{depth:o,index:f}));d(u,o-1),c.reverse();const h=m=>m.filter(p=>p.column.getIsVisible()).map(p=>{let A=0,v=0,x=[0];p.subHeaders&&p.subHeaders.length?(x=[],h(p.subHeaders).forEach(y=>{let{colSpan:w,rowSpan:j}=y;A+=w,x.push(j)})):A=1;const b=Math.min(...x);return v=v+b,p.colSpan=A,p.rowSpan=v,{colSpan:A,rowSpan:v}});return h((a=(i=c[0])==null?void 0:i.headers)!=null?a:[]),c}const Opt=(e,t,r,s,a,i,o)=>{let l={id:t,index:s,original:r,depth:a,parentId:o,_valuesCache:{},_uniqueValuesCache:{},getValue:c=>{if(l._valuesCache.hasOwnProperty(c))return l._valuesCache[c];const d=e.getColumn(c);if(d!=null&&d.accessorFn)return l._valuesCache[c]=d.accessorFn(l.original,s),l._valuesCache[c]},getUniqueValues:c=>{if(l._uniqueValuesCache.hasOwnProperty(c))return l._uniqueValuesCache[c];const d=e.getColumn(c);if(d!=null&&d.accessorFn)return d.columnDef.getUniqueValues?(l._uniqueValuesCache[c]=d.columnDef.getUniqueValues(l.original,s),l._uniqueValuesCache[c]):(l._uniqueValuesCache[c]=[l.getValue(c)],l._uniqueValuesCache[c])},renderValue:c=>{var d;return(d=l.getValue(c))!=null?d:e.options.renderFallbackValue},subRows:[],getLeafRows:()=>Bpt(l.subRows,c=>c.subRows),getParentRow:()=>l.parentId?e.getRow(l.parentId,!0):void 0,getParentRows:()=>{let c=[],d=l;for(;;){const u=d.getParentRow();if(!u)break;c.push(u),d=u}return c.reverse()},getAllCells:br(()=>[e.getAllLeafColumns()],c=>c.map(d=>Tpt(e,l,d,d.id)),yr(e.options,"debugRows")),_getAllCellsByColumnId:br(()=>[l.getAllCells()],c=>c.reduce((d,u)=>(d[u.column.id]=u,d),{}),yr(e.options,"debugRows"))};for(let c=0;c<e._features.length;c++){const d=e._features[c];d==null||d.createRow==null||d.createRow(l,e)}return l},Fpt={createColumn:(e,t)=>{e._getFacetedRowModel=t.options.getFacetedRowModel&&t.options.getFacetedRowModel(t,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():t.getPreFilteredRowModel(),e._getFacetedUniqueValues=t.options.getFacetedUniqueValues&&t.options.getFacetedUniqueValues(t,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=t.options.getFacetedMinMaxValues&&t.options.getFacetedMinMaxValues(t,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},ele=(e,t,r)=>{var s,a;const i=r==null||(s=r.toString())==null?void 0:s.toLowerCase();return!!(!((a=e.getValue(t))==null||(a=a.toString())==null||(a=a.toLowerCase())==null)&&a.includes(i))};ele.autoRemove=e=>Nc(e);const tle=(e,t,r)=>{var s;return!!(!((s=e.getValue(t))==null||(s=s.toString())==null)&&s.includes(r))};tle.autoRemove=e=>Nc(e);const rle=(e,t,r)=>{var s;return((s=e.getValue(t))==null||(s=s.toString())==null?void 0:s.toLowerCase())===(r==null?void 0:r.toLowerCase())};rle.autoRemove=e=>Nc(e);const nle=(e,t,r)=>{var s;return(s=e.getValue(t))==null?void 0:s.includes(r)};nle.autoRemove=e=>Nc(e);const sle=(e,t,r)=>!r.some(s=>{var a;return!((a=e.getValue(t))!=null&&a.includes(s))});sle.autoRemove=e=>Nc(e)||!(e!=null&&e.length);const ale=(e,t,r)=>r.some(s=>{var a;return(a=e.getValue(t))==null?void 0:a.includes(s)});ale.autoRemove=e=>Nc(e)||!(e!=null&&e.length);const ile=(e,t,r)=>e.getValue(t)===r;ile.autoRemove=e=>Nc(e);const ole=(e,t,r)=>e.getValue(t)==r;ole.autoRemove=e=>Nc(e);const vL=(e,t,r)=>{let[s,a]=r;const i=e.getValue(t);return i>=s&&i<=a};vL.resolveFilterValue=e=>{let[t,r]=e,s=typeof t!="number"?parseFloat(t):t,a=typeof r!="number"?parseFloat(r):r,i=t===null||Number.isNaN(s)?-1/0:s,o=r===null||Number.isNaN(a)?1/0:a;if(i>o){const l=i;i=o,o=l}return[i,o]};vL.autoRemove=e=>Nc(e)||Nc(e[0])&&Nc(e[1]);const tu={includesString:ele,includesStringSensitive:tle,equalsString:rle,arrIncludes:nle,arrIncludesAll:sle,arrIncludesSome:ale,equals:ile,weakEquals:ole,inNumberRange:vL};function Nc(e){return e==null||e===""}const Lpt={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:dl("columnFilters",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,t)=>{e.getAutoFilterFn=()=>{const r=t.getCoreRowModel().flatRows[0],s=r==null?void 0:r.getValue(e.id);return typeof s=="string"?tu.includesString:typeof s=="number"?tu.inNumberRange:typeof s=="boolean"||s!==null&&typeof s=="object"?tu.equals:Array.isArray(s)?tu.arrIncludes:tu.weakEquals},e.getFilterFn=()=>{var r,s;return bk(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn==="auto"?e.getAutoFilterFn():(r=(s=t.options.filterFns)==null?void 0:s[e.columnDef.filterFn])!=null?r:tu[e.columnDef.filterFn]},e.getCanFilter=()=>{var r,s,a;return((r=e.columnDef.enableColumnFilter)!=null?r:!0)&&((s=t.options.enableColumnFilters)!=null?s:!0)&&((a=t.options.enableFilters)!=null?a:!0)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var r;return(r=t.getState().columnFilters)==null||(r=r.find(s=>s.id===e.id))==null?void 0:r.value},e.getFilterIndex=()=>{var r,s;return(r=(s=t.getState().columnFilters)==null?void 0:s.findIndex(a=>a.id===e.id))!=null?r:-1},e.setFilterValue=r=>{t.setColumnFilters(s=>{const a=e.getFilterFn(),i=s==null?void 0:s.find(u=>u.id===e.id),o=Ph(r,i?i.value:void 0);if(xV(a,o,e)){var l;return(l=s==null?void 0:s.filter(u=>u.id!==e.id))!=null?l:[]}const c={id:e.id,value:o};if(i){var d;return(d=s==null?void 0:s.map(u=>u.id===e.id?c:u))!=null?d:[]}return s!=null&&s.length?[...s,c]:[c]})}},createRow:(e,t)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=t=>{const r=e.getAllLeafColumns(),s=a=>{var i;return(i=Ph(t,a))==null?void 0:i.filter(o=>{const l=r.find(c=>c.id===o.id);if(l){const c=l.getFilterFn();if(xV(c,o.value,l))return!1}return!0})};e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(s)},e.resetColumnFilters=t=>{var r,s;e.setColumnFilters(t?[]:(r=(s=e.initialState)==null?void 0:s.columnFilters)!=null?r:[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel())}};function xV(e,t,r){return(e&&e.autoRemove?e.autoRemove(t,r):!1)||typeof t>"u"||typeof t=="string"&&!t}const Dpt=(e,t,r)=>r.reduce((s,a)=>{const i=a.getValue(e);return s+(typeof i=="number"?i:0)},0),Rpt=(e,t,r)=>{let s;return r.forEach(a=>{const i=a.getValue(e);i!=null&&(s>i||s===void 0&&i>=i)&&(s=i)}),s},Upt=(e,t,r)=>{let s;return r.forEach(a=>{const i=a.getValue(e);i!=null&&(s<i||s===void 0&&i>=i)&&(s=i)}),s},Mpt=(e,t,r)=>{let s,a;return r.forEach(i=>{const o=i.getValue(e);o!=null&&(s===void 0?o>=o&&(s=a=o):(s>o&&(s=o),a<o&&(a=o)))}),[s,a]},$pt=(e,t)=>{let r=0,s=0;if(t.forEach(a=>{let i=a.getValue(e);i!=null&&(i=+i)>=i&&(++r,s+=i)}),r)return s/r},Qpt=(e,t)=>{if(!t.length)return;const r=t.map(i=>i.getValue(e));if(!Ept(r))return;if(r.length===1)return r[0];const s=Math.floor(r.length/2),a=r.sort((i,o)=>i-o);return r.length%2!==0?a[s]:(a[s-1]+a[s])/2},Hpt=(e,t)=>Array.from(new Set(t.map(r=>r.getValue(e))).values()),zpt=(e,t)=>new Set(t.map(r=>r.getValue(e))).size,Vpt=(e,t)=>t.length,w4={sum:Dpt,min:Rpt,max:Upt,extent:Mpt,mean:$pt,median:Qpt,unique:Hpt,uniqueCount:zpt,count:Vpt},Gpt={getDefaultColumnDef:()=>({aggregatedCell:e=>{var t,r;return(t=(r=e.getValue())==null||r.toString==null?void 0:r.toString())!=null?t:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:dl("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,t)=>{e.toggleGrouping=()=>{t.setGrouping(r=>r!=null&&r.includes(e.id)?r.filter(s=>s!==e.id):[...r??[],e.id])},e.getCanGroup=()=>{var r,s;return((r=e.columnDef.enableGrouping)!=null?r:!0)&&((s=t.options.enableGrouping)!=null?s:!0)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue)},e.getIsGrouped=()=>{var r;return(r=t.getState().grouping)==null?void 0:r.includes(e.id)},e.getGroupedIndex=()=>{var r;return(r=t.getState().grouping)==null?void 0:r.indexOf(e.id)},e.getToggleGroupingHandler=()=>{const r=e.getCanGroup();return()=>{r&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{const r=t.getCoreRowModel().flatRows[0],s=r==null?void 0:r.getValue(e.id);if(typeof s=="number")return w4.sum;if(Object.prototype.toString.call(s)==="[object Date]")return w4.extent},e.getAggregationFn=()=>{var r,s;if(!e)throw new Error;return bk(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn==="auto"?e.getAutoAggregationFn():(r=(s=t.options.aggregationFns)==null?void 0:s[e.columnDef.aggregationFn])!=null?r:w4[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=t=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(t),e.resetGrouping=t=>{var r,s;e.setGrouping(t?[]:(r=(s=e.initialState)==null?void 0:s.grouping)!=null?r:[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,t)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=r=>{if(e._groupingValuesCache.hasOwnProperty(r))return e._groupingValuesCache[r];const s=t.getColumn(r);return s!=null&&s.columnDef.getGroupingValue?(e._groupingValuesCache[r]=s.columnDef.getGroupingValue(e.original),e._groupingValuesCache[r]):e.getValue(r)},e._groupingValuesCache={}},createCell:(e,t,r,s)=>{e.getIsGrouped=()=>t.getIsGrouped()&&t.id===r.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&t.getIsGrouped(),e.getIsAggregated=()=>{var a;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((a=r.subRows)!=null&&a.length)}}};function qpt(e,t,r){if(!(t!=null&&t.length)||!r)return e;const s=e.filter(i=>!t.includes(i.id));return r==="remove"?s:[...t.map(i=>e.find(o=>o.id===i)).filter(Boolean),...s]}const Kpt={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:dl("columnOrder",e)}),createColumn:(e,t)=>{e.getIndex=br(r=>[Rv(t,r)],r=>r.findIndex(s=>s.id===e.id),yr(t.options,"debugColumns")),e.getIsFirstColumn=r=>{var s;return((s=Rv(t,r)[0])==null?void 0:s.id)===e.id},e.getIsLastColumn=r=>{var s;const a=Rv(t,r);return((s=a[a.length-1])==null?void 0:s.id)===e.id}},createTable:e=>{e.setColumnOrder=t=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(t),e.resetColumnOrder=t=>{var r;e.setColumnOrder(t?[]:(r=e.initialState.columnOrder)!=null?r:[])},e._getOrderColumnsFn=br(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(t,r,s)=>a=>{let i=[];if(!(t!=null&&t.length))i=a;else{const o=[...t],l=[...a];for(;l.length&&o.length;){const c=o.shift(),d=l.findIndex(u=>u.id===c);d>-1&&i.push(l.splice(d,1)[0])}i=[...i,...l]}return qpt(i,r,s)},yr(e.options,"debugTable"))}},j4=()=>({left:[],right:[]}),Wpt={getInitialState:e=>({columnPinning:j4(),...e}),getDefaultOptions:e=>({onColumnPinningChange:dl("columnPinning",e)}),createColumn:(e,t)=>{e.pin=r=>{const s=e.getLeafColumns().map(a=>a.id).filter(Boolean);t.setColumnPinning(a=>{var i,o;if(r==="right"){var l,c;return{left:((l=a==null?void 0:a.left)!=null?l:[]).filter(h=>!(s!=null&&s.includes(h))),right:[...((c=a==null?void 0:a.right)!=null?c:[]).filter(h=>!(s!=null&&s.includes(h))),...s]}}if(r==="left"){var d,u;return{left:[...((d=a==null?void 0:a.left)!=null?d:[]).filter(h=>!(s!=null&&s.includes(h))),...s],right:((u=a==null?void 0:a.right)!=null?u:[]).filter(h=>!(s!=null&&s.includes(h)))}}return{left:((i=a==null?void 0:a.left)!=null?i:[]).filter(h=>!(s!=null&&s.includes(h))),right:((o=a==null?void 0:a.right)!=null?o:[]).filter(h=>!(s!=null&&s.includes(h)))}})},e.getCanPin=()=>e.getLeafColumns().some(s=>{var a,i,o;return((a=s.columnDef.enablePinning)!=null?a:!0)&&((i=(o=t.options.enableColumnPinning)!=null?o:t.options.enablePinning)!=null?i:!0)}),e.getIsPinned=()=>{const r=e.getLeafColumns().map(l=>l.id),{left:s,right:a}=t.getState().columnPinning,i=r.some(l=>s==null?void 0:s.includes(l)),o=r.some(l=>a==null?void 0:a.includes(l));return i?"left":o?"right":!1},e.getPinnedIndex=()=>{var r,s;const a=e.getIsPinned();return a?(r=(s=t.getState().columnPinning)==null||(s=s[a])==null?void 0:s.indexOf(e.id))!=null?r:-1:0}},createRow:(e,t)=>{e.getCenterVisibleCells=br(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,t.getState().columnPinning.right],(r,s,a)=>{const i=[...s??[],...a??[]];return r.filter(o=>!i.includes(o.column.id))},yr(t.options,"debugRows")),e.getLeftVisibleCells=br(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left],(r,s)=>(s??[]).map(i=>r.find(o=>o.column.id===i)).filter(Boolean).map(i=>({...i,position:"left"})),yr(t.options,"debugRows")),e.getRightVisibleCells=br(()=>[e._getAllVisibleCells(),t.getState().columnPinning.right],(r,s)=>(s??[]).map(i=>r.find(o=>o.column.id===i)).filter(Boolean).map(i=>({...i,position:"right"})),yr(t.options,"debugRows"))},createTable:e=>{e.setColumnPinning=t=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(t),e.resetColumnPinning=t=>{var r,s;return e.setColumnPinning(t?j4():(r=(s=e.initialState)==null?void 0:s.columnPinning)!=null?r:j4())},e.getIsSomeColumnsPinned=t=>{var r;const s=e.getState().columnPinning;if(!t){var a,i;return!!((a=s.left)!=null&&a.length||(i=s.right)!=null&&i.length)}return!!((r=s[t])!=null&&r.length)},e.getLeftLeafColumns=br(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(t,r)=>(r??[]).map(s=>t.find(a=>a.id===s)).filter(Boolean),yr(e.options,"debugColumns")),e.getRightLeafColumns=br(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(t,r)=>(r??[]).map(s=>t.find(a=>a.id===s)).filter(Boolean),yr(e.options,"debugColumns")),e.getCenterLeafColumns=br(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,r,s)=>{const a=[...r??[],...s??[]];return t.filter(i=>!a.includes(i.id))},yr(e.options,"debugColumns"))}};function Ypt(e){return e||(typeof document<"u"?document:null)}const dj={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},N4=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),Jpt={getDefaultColumnDef:()=>dj,getInitialState:e=>({columnSizing:{},columnSizingInfo:N4(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:dl("columnSizing",e),onColumnSizingInfoChange:dl("columnSizingInfo",e)}),createColumn:(e,t)=>{e.getSize=()=>{var r,s,a;const i=t.getState().columnSizing[e.id];return Math.min(Math.max((r=e.columnDef.minSize)!=null?r:dj.minSize,(s=i??e.columnDef.size)!=null?s:dj.size),(a=e.columnDef.maxSize)!=null?a:dj.maxSize)},e.getStart=br(r=>[r,Rv(t,r),t.getState().columnSizing],(r,s)=>s.slice(0,e.getIndex(r)).reduce((a,i)=>a+i.getSize(),0),yr(t.options,"debugColumns")),e.getAfter=br(r=>[r,Rv(t,r),t.getState().columnSizing],(r,s)=>s.slice(e.getIndex(r)+1).reduce((a,i)=>a+i.getSize(),0),yr(t.options,"debugColumns")),e.resetSize=()=>{t.setColumnSizing(r=>{let{[e.id]:s,...a}=r;return a})},e.getCanResize=()=>{var r,s;return((r=e.columnDef.enableResizing)!=null?r:!0)&&((s=t.options.enableColumnResizing)!=null?s:!0)},e.getIsResizing=()=>t.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,t)=>{e.getSize=()=>{let r=0;const s=a=>{if(a.subHeaders.length)a.subHeaders.forEach(s);else{var i;r+=(i=a.column.getSize())!=null?i:0}};return s(e),r},e.getStart=()=>{if(e.index>0){const r=e.headerGroup.headers[e.index-1];return r.getStart()+r.getSize()}return 0},e.getResizeHandler=r=>{const s=t.getColumn(e.column.id),a=s==null?void 0:s.getCanResize();return i=>{if(!s||!a||(i.persist==null||i.persist(),_4(i)&&i.touches&&i.touches.length>1))return;const o=e.getSize(),l=e?e.getLeafHeaders().map(x=>[x.column.id,x.column.getSize()]):[[s.id,s.getSize()]],c=_4(i)?Math.round(i.touches[0].clientX):i.clientX,d={},u=(x,b)=>{typeof b=="number"&&(t.setColumnSizingInfo(y=>{var w,j;const N=t.options.columnResizeDirection==="rtl"?-1:1,_=(b-((w=y==null?void 0:y.startOffset)!=null?w:0))*N,S=Math.max(_/((j=y==null?void 0:y.startSize)!=null?j:0),-.999999);return y.columnSizingStart.forEach(C=>{let[E,T]=C;d[E]=Math.round(Math.max(T+T*S,0)*100)/100}),{...y,deltaOffset:_,deltaPercentage:S}}),(t.options.columnResizeMode==="onChange"||x==="end")&&t.setColumnSizing(y=>({...y,...d})))},h=x=>u("move",x),m=x=>{u("end",x),t.setColumnSizingInfo(b=>({...b,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},f=Ypt(r),p={moveHandler:x=>h(x.clientX),upHandler:x=>{f==null||f.removeEventListener("mousemove",p.moveHandler),f==null||f.removeEventListener("mouseup",p.upHandler),m(x.clientX)}},A={moveHandler:x=>(x.cancelable&&(x.preventDefault(),x.stopPropagation()),h(x.touches[0].clientX),!1),upHandler:x=>{var b;f==null||f.removeEventListener("touchmove",A.moveHandler),f==null||f.removeEventListener("touchend",A.upHandler),x.cancelable&&(x.preventDefault(),x.stopPropagation()),m((b=x.touches[0])==null?void 0:b.clientX)}},v=Xpt()?{passive:!1}:!1;_4(i)?(f==null||f.addEventListener("touchmove",A.moveHandler,v),f==null||f.addEventListener("touchend",A.upHandler,v)):(f==null||f.addEventListener("mousemove",p.moveHandler,v),f==null||f.addEventListener("mouseup",p.upHandler,v)),t.setColumnSizingInfo(x=>({...x,startOffset:c,startSize:o,deltaOffset:0,deltaPercentage:0,columnSizingStart:l,isResizingColumn:s.id}))}}},createTable:e=>{e.setColumnSizing=t=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(t),e.setColumnSizingInfo=t=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(t),e.resetColumnSizing=t=>{var r;e.setColumnSizing(t?{}:(r=e.initialState.columnSizing)!=null?r:{})},e.resetHeaderSizeInfo=t=>{var r;e.setColumnSizingInfo(t?N4():(r=e.initialState.columnSizingInfo)!=null?r:N4())},e.getTotalSize=()=>{var t,r;return(t=(r=e.getHeaderGroups()[0])==null?void 0:r.headers.reduce((s,a)=>s+a.getSize(),0))!=null?t:0},e.getLeftTotalSize=()=>{var t,r;return(t=(r=e.getLeftHeaderGroups()[0])==null?void 0:r.headers.reduce((s,a)=>s+a.getSize(),0))!=null?t:0},e.getCenterTotalSize=()=>{var t,r;return(t=(r=e.getCenterHeaderGroups()[0])==null?void 0:r.headers.reduce((s,a)=>s+a.getSize(),0))!=null?t:0},e.getRightTotalSize=()=>{var t,r;return(t=(r=e.getRightHeaderGroups()[0])==null?void 0:r.headers.reduce((s,a)=>s+a.getSize(),0))!=null?t:0}}};let uj=null;function Xpt(){if(typeof uj=="boolean")return uj;let e=!1;try{const t={get passive(){return e=!0,!1}},r=()=>{};window.addEventListener("test",r,t),window.removeEventListener("test",r)}catch{e=!1}return uj=e,uj}function _4(e){return e.type==="touchstart"}const Zpt={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:dl("columnVisibility",e)}),createColumn:(e,t)=>{e.toggleVisibility=r=>{e.getCanHide()&&t.setColumnVisibility(s=>({...s,[e.id]:r??!e.getIsVisible()}))},e.getIsVisible=()=>{var r,s;const a=e.columns;return(r=a.length?a.some(i=>i.getIsVisible()):(s=t.getState().columnVisibility)==null?void 0:s[e.id])!=null?r:!0},e.getCanHide=()=>{var r,s;return((r=e.columnDef.enableHiding)!=null?r:!0)&&((s=t.options.enableHiding)!=null?s:!0)},e.getToggleVisibilityHandler=()=>r=>{e.toggleVisibility==null||e.toggleVisibility(r.target.checked)}},createRow:(e,t)=>{e._getAllVisibleCells=br(()=>[e.getAllCells(),t.getState().columnVisibility],r=>r.filter(s=>s.column.getIsVisible()),yr(t.options,"debugRows")),e.getVisibleCells=br(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(r,s,a)=>[...r,...s,...a],yr(t.options,"debugRows"))},createTable:e=>{const t=(r,s)=>br(()=>[s(),s().filter(a=>a.getIsVisible()).map(a=>a.id).join("_")],a=>a.filter(i=>i.getIsVisible==null?void 0:i.getIsVisible()),yr(e.options,"debugColumns"));e.getVisibleFlatColumns=t("getVisibleFlatColumns",()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=t("getVisibleLeafColumns",()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=t("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=t("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=t("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),e.setColumnVisibility=r=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(r),e.resetColumnVisibility=r=>{var s;e.setColumnVisibility(r?{}:(s=e.initialState.columnVisibility)!=null?s:{})},e.toggleAllColumnsVisible=r=>{var s;r=(s=r)!=null?s:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((a,i)=>({...a,[i.id]:r||!(i.getCanHide!=null&&i.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some(r=>!(r.getIsVisible!=null&&r.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some(r=>r.getIsVisible==null?void 0:r.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>r=>{var s;e.toggleAllColumnsVisible((s=r.target)==null?void 0:s.checked)}}};function Rv(e,t){return t?t==="center"?e.getCenterVisibleLeafColumns():t==="left"?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}const eAt={createTable:e=>{e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},tAt={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:dl("globalFilter",e),globalFilterFn:"auto",getColumnCanGlobalFilter:t=>{var r;const s=(r=e.getCoreRowModel().flatRows[0])==null||(r=r._getAllCellsByColumnId()[t.id])==null?void 0:r.getValue();return typeof s=="string"||typeof s=="number"}}),createColumn:(e,t)=>{e.getCanGlobalFilter=()=>{var r,s,a,i;return((r=e.columnDef.enableGlobalFilter)!=null?r:!0)&&((s=t.options.enableGlobalFilter)!=null?s:!0)&&((a=t.options.enableFilters)!=null?a:!0)&&((i=t.options.getColumnCanGlobalFilter==null?void 0:t.options.getColumnCanGlobalFilter(e))!=null?i:!0)&&!!e.accessorFn}},createTable:e=>{e.getGlobalAutoFilterFn=()=>tu.includesString,e.getGlobalFilterFn=()=>{var t,r;const{globalFilterFn:s}=e.options;return bk(s)?s:s==="auto"?e.getGlobalAutoFilterFn():(t=(r=e.options.filterFns)==null?void 0:r[s])!=null?t:tu[s]},e.setGlobalFilter=t=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(t)},e.resetGlobalFilter=t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)}}},rAt={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:dl("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let t=!1,r=!1;e._autoResetExpanded=()=>{var s,a;if(!t){e._queue(()=>{t=!0});return}if((s=(a=e.options.autoResetAll)!=null?a:e.options.autoResetExpanded)!=null?s:!e.options.manualExpanding){if(r)return;r=!0,e._queue(()=>{e.resetExpanded(),r=!1})}},e.setExpanded=s=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(s),e.toggleAllRowsExpanded=s=>{s??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=s=>{var a,i;e.setExpanded(s?{}:(a=(i=e.initialState)==null?void 0:i.expanded)!=null?a:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(s=>s.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>s=>{s.persist==null||s.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{const s=e.getState().expanded;return s===!0||Object.values(s).some(Boolean)},e.getIsAllRowsExpanded=()=>{const s=e.getState().expanded;return typeof s=="boolean"?s===!0:!(!Object.keys(s).length||e.getRowModel().flatRows.some(a=>!a.getIsExpanded()))},e.getExpandedDepth=()=>{let s=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(i=>{const o=i.split(".");s=Math.max(s,o.length)}),s},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,t)=>{e.toggleExpanded=r=>{t.setExpanded(s=>{var a;const i=s===!0?!0:!!(s!=null&&s[e.id]);let o={};if(s===!0?Object.keys(t.getRowModel().rowsById).forEach(l=>{o[l]=!0}):o=s,r=(a=r)!=null?a:!i,!i&&r)return{...o,[e.id]:!0};if(i&&!r){const{[e.id]:l,...c}=o;return c}return s})},e.getIsExpanded=()=>{var r;const s=t.getState().expanded;return!!((r=t.options.getIsRowExpanded==null?void 0:t.options.getIsRowExpanded(e))!=null?r:s===!0||s!=null&&s[e.id])},e.getCanExpand=()=>{var r,s,a;return(r=t.options.getRowCanExpand==null?void 0:t.options.getRowCanExpand(e))!=null?r:((s=t.options.enableExpanding)!=null?s:!0)&&!!((a=e.subRows)!=null&&a.length)},e.getIsAllParentsExpanded=()=>{let r=!0,s=e;for(;r&&s.parentId;)s=t.getRow(s.parentId,!0),r=s.getIsExpanded();return r},e.getToggleExpandedHandler=()=>{const r=e.getCanExpand();return()=>{r&&e.toggleExpanded()}}}},qP=0,KP=10,C4=()=>({pageIndex:qP,pageSize:KP}),nAt={getInitialState:e=>({...e,pagination:{...C4(),...e==null?void 0:e.pagination}}),getDefaultOptions:e=>({onPaginationChange:dl("pagination",e)}),createTable:e=>{let t=!1,r=!1;e._autoResetPageIndex=()=>{var s,a;if(!t){e._queue(()=>{t=!0});return}if((s=(a=e.options.autoResetAll)!=null?a:e.options.autoResetPageIndex)!=null?s:!e.options.manualPagination){if(r)return;r=!0,e._queue(()=>{e.resetPageIndex(),r=!1})}},e.setPagination=s=>{const a=i=>Ph(s,i);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(a)},e.resetPagination=s=>{var a;e.setPagination(s?C4():(a=e.initialState.pagination)!=null?a:C4())},e.setPageIndex=s=>{e.setPagination(a=>{let i=Ph(s,a.pageIndex);const o=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return i=Math.max(0,Math.min(i,o)),{...a,pageIndex:i}})},e.resetPageIndex=s=>{var a,i;e.setPageIndex(s?qP:(a=(i=e.initialState)==null||(i=i.pagination)==null?void 0:i.pageIndex)!=null?a:qP)},e.resetPageSize=s=>{var a,i;e.setPageSize(s?KP:(a=(i=e.initialState)==null||(i=i.pagination)==null?void 0:i.pageSize)!=null?a:KP)},e.setPageSize=s=>{e.setPagination(a=>{const i=Math.max(1,Ph(s,a.pageSize)),o=a.pageSize*a.pageIndex,l=Math.floor(o/i);return{...a,pageIndex:l,pageSize:i}})},e.setPageCount=s=>e.setPagination(a=>{var i;let o=Ph(s,(i=e.options.pageCount)!=null?i:-1);return typeof o=="number"&&(o=Math.max(-1,o)),{...a,pageCount:o}}),e.getPageOptions=br(()=>[e.getPageCount()],s=>{let a=[];return s&&s>0&&(a=[...new Array(s)].fill(null).map((i,o)=>o)),a},yr(e.options,"debugTable")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{const{pageIndex:s}=e.getState().pagination,a=e.getPageCount();return a===-1?!0:a===0?!1:s<a-1},e.previousPage=()=>e.setPageIndex(s=>s-1),e.nextPage=()=>e.setPageIndex(s=>s+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>{var s;return(s=e.options.pageCount)!=null?s:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var s;return(s=e.options.rowCount)!=null?s:e.getPrePaginationRowModel().rows.length}}},S4=()=>({top:[],bottom:[]}),sAt={getInitialState:e=>({rowPinning:S4(),...e}),getDefaultOptions:e=>({onRowPinningChange:dl("rowPinning",e)}),createRow:(e,t)=>{e.pin=(r,s,a)=>{const i=s?e.getLeafRows().map(c=>{let{id:d}=c;return d}):[],o=a?e.getParentRows().map(c=>{let{id:d}=c;return d}):[],l=new Set([...o,e.id,...i]);t.setRowPinning(c=>{var d,u;if(r==="bottom"){var h,m;return{top:((h=c==null?void 0:c.top)!=null?h:[]).filter(A=>!(l!=null&&l.has(A))),bottom:[...((m=c==null?void 0:c.bottom)!=null?m:[]).filter(A=>!(l!=null&&l.has(A))),...Array.from(l)]}}if(r==="top"){var f,p;return{top:[...((f=c==null?void 0:c.top)!=null?f:[]).filter(A=>!(l!=null&&l.has(A))),...Array.from(l)],bottom:((p=c==null?void 0:c.bottom)!=null?p:[]).filter(A=>!(l!=null&&l.has(A)))}}return{top:((d=c==null?void 0:c.top)!=null?d:[]).filter(A=>!(l!=null&&l.has(A))),bottom:((u=c==null?void 0:c.bottom)!=null?u:[]).filter(A=>!(l!=null&&l.has(A)))}})},e.getCanPin=()=>{var r;const{enableRowPinning:s,enablePinning:a}=t.options;return typeof s=="function"?s(e):(r=s??a)!=null?r:!0},e.getIsPinned=()=>{const r=[e.id],{top:s,bottom:a}=t.getState().rowPinning,i=r.some(l=>s==null?void 0:s.includes(l)),o=r.some(l=>a==null?void 0:a.includes(l));return i?"top":o?"bottom":!1},e.getPinnedIndex=()=>{var r,s;const a=e.getIsPinned();if(!a)return-1;const i=(r=a==="top"?t.getTopRows():t.getBottomRows())==null?void 0:r.map(o=>{let{id:l}=o;return l});return(s=i==null?void 0:i.indexOf(e.id))!=null?s:-1}},createTable:e=>{e.setRowPinning=t=>e.options.onRowPinningChange==null?void 0:e.options.onRowPinningChange(t),e.resetRowPinning=t=>{var r,s;return e.setRowPinning(t?S4():(r=(s=e.initialState)==null?void 0:s.rowPinning)!=null?r:S4())},e.getIsSomeRowsPinned=t=>{var r;const s=e.getState().rowPinning;if(!t){var a,i;return!!((a=s.top)!=null&&a.length||(i=s.bottom)!=null&&i.length)}return!!((r=s[t])!=null&&r.length)},e._getPinnedRows=(t,r,s)=>{var a;return((a=e.options.keepPinnedRows)==null||a?(r??[]).map(o=>{const l=e.getRow(o,!0);return l.getIsAllParentsExpanded()?l:null}):(r??[]).map(o=>t.find(l=>l.id===o))).filter(Boolean).map(o=>({...o,position:s}))},e.getTopRows=br(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(t,r)=>e._getPinnedRows(t,r,"top"),yr(e.options,"debugRows")),e.getBottomRows=br(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(t,r)=>e._getPinnedRows(t,r,"bottom"),yr(e.options,"debugRows")),e.getCenterRows=br(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(t,r,s)=>{const a=new Set([...r??[],...s??[]]);return t.filter(i=>!a.has(i.id))},yr(e.options,"debugRows"))}},aAt={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:dl("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=t=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(t),e.resetRowSelection=t=>{var r;return e.setRowSelection(t?{}:(r=e.initialState.rowSelection)!=null?r:{})},e.toggleAllRowsSelected=t=>{e.setRowSelection(r=>{t=typeof t<"u"?t:!e.getIsAllRowsSelected();const s={...r},a=e.getPreGroupedRowModel().flatRows;return t?a.forEach(i=>{i.getCanSelect()&&(s[i.id]=!0)}):a.forEach(i=>{delete s[i.id]}),s})},e.toggleAllPageRowsSelected=t=>e.setRowSelection(r=>{const s=typeof t<"u"?t:!e.getIsAllPageRowsSelected(),a={...r};return e.getRowModel().rows.forEach(i=>{WP(a,i.id,s,!0,e)}),a}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=br(()=>[e.getState().rowSelection,e.getCoreRowModel()],(t,r)=>Object.keys(t).length?k4(e,r):{rows:[],flatRows:[],rowsById:{}},yr(e.options,"debugTable")),e.getFilteredSelectedRowModel=br(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(t,r)=>Object.keys(t).length?k4(e,r):{rows:[],flatRows:[],rowsById:{}},yr(e.options,"debugTable")),e.getGroupedSelectedRowModel=br(()=>[e.getState().rowSelection,e.getSortedRowModel()],(t,r)=>Object.keys(t).length?k4(e,r):{rows:[],flatRows:[],rowsById:{}},yr(e.options,"debugTable")),e.getIsAllRowsSelected=()=>{const t=e.getFilteredRowModel().flatRows,{rowSelection:r}=e.getState();let s=!!(t.length&&Object.keys(r).length);return s&&t.some(a=>a.getCanSelect()&&!r[a.id])&&(s=!1),s},e.getIsAllPageRowsSelected=()=>{const t=e.getPaginationRowModel().flatRows.filter(a=>a.getCanSelect()),{rowSelection:r}=e.getState();let s=!!t.length;return s&&t.some(a=>!r[a.id])&&(s=!1),s},e.getIsSomeRowsSelected=()=>{var t;const r=Object.keys((t=e.getState().rowSelection)!=null?t:{}).length;return r>0&&r<e.getFilteredRowModel().flatRows.length},e.getIsSomePageRowsSelected=()=>{const t=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:t.filter(r=>r.getCanSelect()).some(r=>r.getIsSelected()||r.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>t=>{e.toggleAllRowsSelected(t.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>t=>{e.toggleAllPageRowsSelected(t.target.checked)}},createRow:(e,t)=>{e.toggleSelected=(r,s)=>{const a=e.getIsSelected();t.setRowSelection(i=>{var o;if(r=typeof r<"u"?r:!a,e.getCanSelect()&&a===r)return i;const l={...i};return WP(l,e.id,r,(o=s==null?void 0:s.selectChildren)!=null?o:!0,t),l})},e.getIsSelected=()=>{const{rowSelection:r}=t.getState();return bL(e,r)},e.getIsSomeSelected=()=>{const{rowSelection:r}=t.getState();return YP(e,r)==="some"},e.getIsAllSubRowsSelected=()=>{const{rowSelection:r}=t.getState();return YP(e,r)==="all"},e.getCanSelect=()=>{var r;return typeof t.options.enableRowSelection=="function"?t.options.enableRowSelection(e):(r=t.options.enableRowSelection)!=null?r:!0},e.getCanSelectSubRows=()=>{var r;return typeof t.options.enableSubRowSelection=="function"?t.options.enableSubRowSelection(e):(r=t.options.enableSubRowSelection)!=null?r:!0},e.getCanMultiSelect=()=>{var r;return typeof t.options.enableMultiRowSelection=="function"?t.options.enableMultiRowSelection(e):(r=t.options.enableMultiRowSelection)!=null?r:!0},e.getToggleSelectedHandler=()=>{const r=e.getCanSelect();return s=>{var a;r&&e.toggleSelected((a=s.target)==null?void 0:a.checked)}}}},WP=(e,t,r,s,a)=>{var i;const o=a.getRow(t,!0);r?(o.getCanMultiSelect()||Object.keys(e).forEach(l=>delete e[l]),o.getCanSelect()&&(e[t]=!0)):delete e[t],s&&(i=o.subRows)!=null&&i.length&&o.getCanSelectSubRows()&&o.subRows.forEach(l=>WP(e,l.id,r,s,a))};function k4(e,t){const r=e.getState().rowSelection,s=[],a={},i=function(o,l){return o.map(c=>{var d;const u=bL(c,r);if(u&&(s.push(c),a[c.id]=c),(d=c.subRows)!=null&&d.length&&(c={...c,subRows:i(c.subRows)}),u)return c}).filter(Boolean)};return{rows:i(t.rows),flatRows:s,rowsById:a}}function bL(e,t){var r;return(r=t[e.id])!=null?r:!1}function YP(e,t,r){var s;if(!((s=e.subRows)!=null&&s.length))return!1;let a=!0,i=!1;return e.subRows.forEach(o=>{if(!(i&&!a)&&(o.getCanSelect()&&(bL(o,t)?i=!0:a=!1),o.subRows&&o.subRows.length)){const l=YP(o,t);l==="all"?i=!0:(l==="some"&&(i=!0),a=!1)}}),a?"all":i?"some":!1}const JP=/([0-9]+)/gm,iAt=(e,t,r)=>lle(ef(e.getValue(r)).toLowerCase(),ef(t.getValue(r)).toLowerCase()),oAt=(e,t,r)=>lle(ef(e.getValue(r)),ef(t.getValue(r))),lAt=(e,t,r)=>yL(ef(e.getValue(r)).toLowerCase(),ef(t.getValue(r)).toLowerCase()),cAt=(e,t,r)=>yL(ef(e.getValue(r)),ef(t.getValue(r))),dAt=(e,t,r)=>{const s=e.getValue(r),a=t.getValue(r);return s>a?1:s<a?-1:0},uAt=(e,t,r)=>yL(e.getValue(r),t.getValue(r));function yL(e,t){return e===t?0:e>t?1:-1}function ef(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function lle(e,t){const r=e.split(JP).filter(Boolean),s=t.split(JP).filter(Boolean);for(;r.length&&s.length;){const a=r.shift(),i=s.shift(),o=parseInt(a,10),l=parseInt(i,10),c=[o,l].sort();if(isNaN(c[0])){if(a>i)return 1;if(i>a)return-1;continue}if(isNaN(c[1]))return isNaN(o)?-1:1;if(o>l)return 1;if(l>o)return-1}return r.length-s.length}const Dx={alphanumeric:iAt,alphanumericCaseSensitive:oAt,text:lAt,textCaseSensitive:cAt,datetime:dAt,basic:uAt},hAt={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:dl("sorting",e),isMultiSortEvent:t=>t.shiftKey}),createColumn:(e,t)=>{e.getAutoSortingFn=()=>{const r=t.getFilteredRowModel().flatRows.slice(10);let s=!1;for(const a of r){const i=a==null?void 0:a.getValue(e.id);if(Object.prototype.toString.call(i)==="[object Date]")return Dx.datetime;if(typeof i=="string"&&(s=!0,i.split(JP).length>1))return Dx.alphanumeric}return s?Dx.text:Dx.basic},e.getAutoSortDir=()=>{const r=t.getFilteredRowModel().flatRows[0];return typeof(r==null?void 0:r.getValue(e.id))=="string"?"asc":"desc"},e.getSortingFn=()=>{var r,s;if(!e)throw new Error;return bk(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn==="auto"?e.getAutoSortingFn():(r=(s=t.options.sortingFns)==null?void 0:s[e.columnDef.sortingFn])!=null?r:Dx[e.columnDef.sortingFn]},e.toggleSorting=(r,s)=>{const a=e.getNextSortingOrder(),i=typeof r<"u"&&r!==null;t.setSorting(o=>{const l=o==null?void 0:o.find(f=>f.id===e.id),c=o==null?void 0:o.findIndex(f=>f.id===e.id);let d=[],u,h=i?r:a==="desc";if(o!=null&&o.length&&e.getCanMultiSort()&&s?l?u="toggle":u="add":o!=null&&o.length&&c!==o.length-1?u="replace":l?u="toggle":u="replace",u==="toggle"&&(i||a||(u="remove")),u==="add"){var m;d=[...o,{id:e.id,desc:h}],d.splice(0,d.length-((m=t.options.maxMultiSortColCount)!=null?m:Number.MAX_SAFE_INTEGER))}else u==="toggle"?d=o.map(f=>f.id===e.id?{...f,desc:h}:f):u==="remove"?d=o.filter(f=>f.id!==e.id):d=[{id:e.id,desc:h}];return d})},e.getFirstSortDir=()=>{var r,s;return((r=(s=e.columnDef.sortDescFirst)!=null?s:t.options.sortDescFirst)!=null?r:e.getAutoSortDir()==="desc")?"desc":"asc"},e.getNextSortingOrder=r=>{var s,a;const i=e.getFirstSortDir(),o=e.getIsSorted();return o?o!==i&&((s=t.options.enableSortingRemoval)==null||s)&&(!(r&&(a=t.options.enableMultiRemove)!=null)||a)?!1:o==="desc"?"asc":"desc":i},e.getCanSort=()=>{var r,s;return((r=e.columnDef.enableSorting)!=null?r:!0)&&((s=t.options.enableSorting)!=null?s:!0)&&!!e.accessorFn},e.getCanMultiSort=()=>{var r,s;return(r=(s=e.columnDef.enableMultiSort)!=null?s:t.options.enableMultiSort)!=null?r:!!e.accessorFn},e.getIsSorted=()=>{var r;const s=(r=t.getState().sorting)==null?void 0:r.find(a=>a.id===e.id);return s?s.desc?"desc":"asc":!1},e.getSortIndex=()=>{var r,s;return(r=(s=t.getState().sorting)==null?void 0:s.findIndex(a=>a.id===e.id))!=null?r:-1},e.clearSorting=()=>{t.setSorting(r=>r!=null&&r.length?r.filter(s=>s.id!==e.id):[])},e.getToggleSortingHandler=()=>{const r=e.getCanSort();return s=>{r&&(s.persist==null||s.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?t.options.isMultiSortEvent==null?void 0:t.options.isMultiSortEvent(s):!1))}}},createTable:e=>{e.setSorting=t=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(t),e.resetSorting=t=>{var r,s;e.setSorting(t?[]:(r=(s=e.initialState)==null?void 0:s.sorting)!=null?r:[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},fAt=[Ipt,Zpt,Kpt,Wpt,Fpt,Lpt,eAt,tAt,hAt,Gpt,rAt,nAt,sAt,aAt,Jpt];function mAt(e){var t,r;const s=[...fAt,...(t=e._features)!=null?t:[]];let a={_features:s};const i=a._features.reduce((m,f)=>Object.assign(m,f.getDefaultOptions==null?void 0:f.getDefaultOptions(a)),{}),o=m=>a.options.mergeOptions?a.options.mergeOptions(i,m):{...i,...m};let c={...{},...(r=e.initialState)!=null?r:{}};
1898a._features.forEach(m=>{var f;c=(f=m.getInitialState==null?void 0:m.getInitialState(c))!=null?f:c});const d=[];let u=!1;const h={_features:s,options:{...i,...e},initialState:c,_queue:m=>{d.push(m),u||(u=!0,Promise.resolve().then(()=>{for(;d.length;)d.shift()();u=!1}).catch(f=>setTimeout(()=>{throw f})))},reset:()=>{a.setState(a.initialState)},setOptions:m=>{const f=Ph(m,a.options);a.options=o(f)},getState:()=>a.options.state,setState:m=>{a.options.onStateChange==null||a.options.onStateChange(m)},_getRowId:(m,f,p)=>{var A;return(A=a.options.getRowId==null?void 0:a.options.getRowId(m,f,p))!=null?A:`${p?[p.id,f].join("."):f}`},getCoreRowModel:()=>(a._getCoreRowModel||(a._getCoreRowModel=a.options.getCoreRowModel(a)),a._getCoreRowModel()),getRowModel:()=>a.getPaginationRowModel(),getRow:(m,f)=>{let p=(f?a.getPrePaginationRowModel():a.getRowModel()).rowsById[m];if(!p&&(p=a.getCoreRowModel().rowsById[m],!p))throw new Error;return p},_getDefaultColumnDef:br(()=>[a.options.defaultColumn],m=>{var f;return m=(f=m)!=null?f:{},{header:p=>{const A=p.header.column.columnDef;return A.accessorKey?A.accessorKey:A.accessorFn?A.id:null},cell:p=>{var A,v;return(A=(v=p.renderValue())==null||v.toString==null?void 0:v.toString())!=null?A:null},...a._features.reduce((p,A)=>Object.assign(p,A.getDefaultColumnDef==null?void 0:A.getDefaultColumnDef()),{}),...m}},yr(e,"debugColumns")),_getColumnDefs:()=>a.options.columns,getAllColumns:br(()=>[a._getColumnDefs()],m=>{const f=function(p,A,v){return v===void 0&&(v=0),p.map(x=>{const b=Ppt(a,x,v,A),y=x;return b.columns=y.columns?f(y.columns,b,v+1):[],b})};return f(m)},yr(e,"debugColumns")),getAllFlatColumns:br(()=>[a.getAllColumns()],m=>m.flatMap(f=>f.getFlatColumns()),yr(e,"debugColumns")),_getAllFlatColumnsById:br(()=>[a.getAllFlatColumns()],m=>m.reduce((f,p)=>(f[p.id]=p,f),{}),yr(e,"debugColumns")),getAllLeafColumns:br(()=>[a.getAllColumns(),a._getOrderColumnsFn()],(m,f)=>{let p=m.flatMap(A=>A.getLeafColumns());return f(p)},yr(e,"debugColumns")),getColumn:m=>a._getAllFlatColumnsById()[m]};Object.assign(a,h);for(let m=0;m<a._features.length;m++){const f=a._features[m];f==null||f.createTable==null||f.createTable(a)}return a}function wL(){return e=>br(()=>[e.options.data],t=>{const r={rows:[],flatRows:[],rowsById:{}},s=function(a,i,o){i===void 0&&(i=0);const l=[];for(let d=0;d<a.length;d++){const u=Opt(e,e._getRowId(a[d],d,o),a[d],d,i,void 0,o==null?void 0:o.id);if(r.flatRows.push(u),r.rowsById[u.id]=u,l.push(u),e.options.getSubRows){var c;u.originalSubRows=e.options.getSubRows(a[d],d),(c=u.originalSubRows)!=null&&c.length&&(u.subRows=s(u.originalSubRows,i+1,u))}}return l};return r.rows=s(t),r},yr(e.options,"debugTable","getRowModel",()=>e._autoResetPageIndex()))}function jL(){return e=>br(()=>[e.getState().sorting,e.getPreSortedRowModel()],(t,r)=>{if(!r.rows.length||!(t!=null&&t.length))return r;const s=e.getState().sorting,a=[],i=s.filter(c=>{var d;return(d=e.getColumn(c.id))==null?void 0:d.getCanSort()}),o={};i.forEach(c=>{const d=e.getColumn(c.id);d&&(o[c.id]={sortUndefined:d.columnDef.sortUndefined,invertSorting:d.columnDef.invertSorting,sortingFn:d.getSortingFn()})});const l=c=>{const d=c.map(u=>({...u}));return d.sort((u,h)=>{for(let f=0;f<i.length;f+=1){var m;const p=i[f],A=o[p.id],v=A.sortUndefined,x=(m=p==null?void 0:p.desc)!=null?m:!1;let b=0;if(v){const y=u.getValue(p.id),w=h.getValue(p.id),j=y===void 0,N=w===void 0;if(j||N){if(v==="first")return j?-1:1;if(v==="last")return j?1:-1;b=j&&N?0:j?v:-v}}if(b===0&&(b=A.sortingFn(u,h,p.id)),b!==0)return x&&(b*=-1),A.invertSorting&&(b*=-1),b}return u.index-h.index}),d.forEach(u=>{var h;a.push(u),(h=u.subRows)!=null&&h.length&&(u.subRows=l(u.subRows))}),d};return{rows:l(r.rows),flatRows:a,rowsById:r.rowsById}},yr(e.options,"debugTable","getSortedRowModel",()=>e._autoResetPageIndex()))}/**
1899   * react-table
1900   *
1901   * Copyright (c) TanStack
1902   *
1903   * This source code is licensed under the MIT license found in the
1904   * LICENSE.md file in the root directory of this source tree.
1905   *
1906   * @license MIT
1907   */function Yg(e,t){return e?pAt(e)?g.createElement(e,t):e:null}function pAt(e){return AAt(e)||typeof e=="function"||gAt(e)}function AAt(e){return typeof e=="function"&&(()=>{const t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function gAt(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function NL(e){const t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[r]=g.useState(()=>({current:mAt(t)})),[s,a]=g.useState(()=>r.current.initialState);return r.current.setOptions(i=>({...i,...e,state:{...s,...e.state},onStateChange:o=>{a(o),e.onStateChange==null||e.onStateChange(o)}})),r.current}const vV="news-contents-view-mode",bV=e=>{if(!e)return null;try{const t=e;if(Array.isArray(t)){for(const r of t)if(r){if(typeof r=="string")return r;if(typeof r=="object"){const s=r.url??r.image_url??r.src;if(typeof s=="string")return s}}}if(typeof t=="object"&&t!==null){const r=t.url??t.image_url??t.src;if(typeof r=="string")return r}}catch(t){console.debug("Unable to parse news content images",t)}return null},xAt=e=>{const t=e.raw_content||e.description||"";if(!t)return"";const r=t.replace(/\s+/g," ").trim();return r.length<=160?r:`${r.slice(0,157)}...`},vAt=e=>{const t=new Date(e);return Number.isNaN(t.getTime())?"":t.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})};function bAt(){var E;const[e,t]=g.useState([]),[r,s]=g.useState(!0),[a,i]=g.useState(0),[o,l]=g.useState(""),[c,d]=g.useState(0),[u,h]=g.useState([]),[m,f]=g.useState(null),[p,A]=g.useState(!1),[v,x]=g.useState(()=>{if(typeof window>"u")return"table";const T=window.localStorage.getItem(vV);return T==="tiles"||T==="supertile"?T:"table"}),{toast:b}=sn(),y=v==="supertile"?100:10;g.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(vV,v)},[v]);const w=[{accessorKey:"raw_headline",header:({column:T})=>n.jsxs(te,{variant:"ghost",onClick:()=>
1907T.toggleSorting(T.getIsSorted()==="asc"),children:["Title",n.jsx(ju,{className:"ml-2 h-4 w-4"})]}),cell:({row:T})=>{const B=T.getValue("raw_headline")||T.original.name;return n.jsx("div",{className:"font-medium",children:B})}},{accessorKey:"raw_content",header:"Content",cell:({row:T})=>{const B=T.getValue("raw_content")||T.original.description;return n.jsx("div",{className:"max-w-[500px] truncate",children:B||""})}},{accessorKey:"created_at",header:({column:T})=>n.jsxs(te,{variant:"ghost",onClick:()=>T.toggleSorting(T.getIsSorted()==="asc"),children:["Date",n.jsx(ju,{className:"ml-2 h-4 w-4"})]}),cell:({row:T})=>new Date(T.getValue("created_at")).toLocaleDateString()}],j=async()=>{try{s(!0);let T=de.from("news_contents").select("*",{count:"exact"}).range(a*y,(a+1)*y-1);if(o&&(T=T.or(`raw_headline.ilike.%${o}%,raw_content.ilike.%${o}%,description.ilike.%${o}%,name.ilike.%${o}%`)),u.length>0){const{id:F,desc:M}=u[0];T=T.order(F,{ascending:!M})}else T=T.order("created_at",{ascending:!1});const{data:B,error:L,count:P}=await T;if(L)throw L;t(B||[]),d(P||0)}catch(T){console.error("Error fetching news contents:",T),b({title:"Error fetching news contents",description:"There was a problem loading the news contents.",variant:"destructive"})}finally{s(!1)}};g.useEffect(()=>{j()},[a,o,u,v]);const N=NL({data:e,columns:w,getCoreRowModel:wL(),onSortingChange:h,getSortedRowModel:jL(),state:{sorting:u},manualSorting:!0,pageCount:Math.ceil(c/y)}),_=T=>{T.preventDefault(),i(0),j()},S=T=>{x(T),i(0)},C=n.jsx("div",{className:"flex h-48 items-center justify-center",children:n.jsx("div",{className:"h-8 w-8 rounded-full border-2 border-primary border-t-transparent animate-spin"})});return n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between md:items-center",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[n.jsx("h2",{className:"text-xl font-bold",children:"News Contents"}),n.jsxs("div",{className:"flex items-center gap-1 rounded-lg border bg-background p-1",children:[n.jsxs(te,{type:"button",size:"sm",variant:v==="table"?"default":"ghost",className:"h-9 gap-2 px-3",onClick:()=>S("table"),children:[n.jsx(mve,{className:"h-4 w-4"}),n.jsx("span",{className:"hidden sm:inline",children:"Table"})]}),n.jsxs(te,{type:"button",size:"sm",variant:v==="tiles"?"default":"ghost",className:"h-9 gap-2 px-3",onClick:()=>S("tiles"),children:[n.jsx(K_,{className:"h-4 w-4"}),n.jsx("span",{className:"hidden sm:inline",children:"Tiles"})]}),n.jsxs(te,{type:"button",size:"sm",variant:v==="supertile"?"default":"ghost",className:"h-9 gap-2 px-3",onClick:()=>S("supertile"),children:[n.jsx(_I,{className:"h-4 w-4"}),n.jsx("span",{className:"hidden sm:inline",children:"Supertile"})]})]})]}),n.jsxs("form",{onSubmit:_,className:"flex w-full gap-2 sm:w-auto",children:[n.jsx(qe,{type:"text",placeholder:"Search headlines and content...",value:o,onChange:T=>l(T.target.value),className:"w-full sm:w-64"}),n.jsx(te,{type:"submit",size:"icon",className:"shrink-0",children:n.jsx(Ns,{className:"h-4 w-4"})})]})]}),v==="table"?n.jsx("div",{className:"rounded-md border",children:n.jsxs(po,{children:[n.jsx(Ao,{children:N.getHeaderGroups().map(T=>n.jsx(Yr,{children:T.headers.map(B=>n.jsx($t,{children:B.isPlaceholder?null:Yg(B.column.columnDef.header,B.getContext())},B.id))},T.id))}),n.jsx(go,{children:r?n.jsx(Yr,{children:n.jsx(mt,{colSpan:w.length,className:"h-24 text-center",children:n.jsx("div",{className:"flex justify-center",children:n.jsx("div",{className:"h-6 w-6 rounded-full border-2 border-primary border-t-transparent animate-spin"})})})}):(E=N.getRowModel().rows)!=null&&E.length?N.getRowModel().rows.map(T=>n.jsx(Yr,{className:"cursor-pointer hover:bg-muted/50",onClick:()=>{f(T.original),A(!0)},children:T.getVisibleCells().map(B=>n.jsx(mt,{children:Yg(B.column.columnDef.cell,B.getContext())},B.id))},T.id)):n.jsx(Yr,{children:n.jsx(mt,{colSpan:w.length,className:"h-24 text-center",children:"No results found"})})})]})}):v==="tiles"?n.jsx("div",{className:"rounded-md border p-4",children:r?C:e.length?n.jsx("div",{className:"grid gap-4 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4",children:e.map(T=>{var I;const B=T.raw_headline||T.name,L=bV(T.images),P=xAt(T),F=vAt(T.created_at),M=((I=B==null?void 0:B.trim().charAt(0))==null?void 0:I.toUpperCase())||"N";return n.jsxs("button",{type:"button",onClick:()=>{f(T),A(!0)},className:"group flex h-full flex-col overflow-hidden rounded-lg border bg-background text-left shadow-sm transition hover:-translate-y-0.5 hover:shadow-lg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2",children:[L?n.jsx("div",{className:"aspect-video overflow-hidden bg-muted",children:n.jsx("img",{src:L,alt:B||"News content image",className:"h-full w-full object-cover transition duration-300 group-hover:scale-105",onError:$=>{$.currentTarget.style.display="none"}})}):n.jsx("div",{className:"aspect-video flex items-center justify-center bg-gradient-to-br from-primary/10 via-primary/5 to-primary/20 text-3xl font-semibold text-primary",children:n.jsx("span",{"aria-hidden":"true",children:M})}),n.jsxs("div",{className:"flex flex-1 flex-col gap-2 p-4",children:[n.jsx("h3",{className:"line-clamp-2 text-base font-semibold text-foreground",children:B}),P&&n.jsx("p",{className:"line-clamp-3 text-sm text-muted-foreground",children:P}),n.jsxs("div",{className:"mt-auto flex items-center justify-between text-xs text-muted-foreground",children:[n.jsx("span",{children:F}),T.status&&n.jsx("span",{className:"rounded-full bg-muted px-2 py-0.5 font-medium uppercase tracking-wide text-[10px]",children:T.status})]})]})]},T.id)})}):n.jsx("div",{className:"flex h-32 items-center justify-center text-sm text-muted-foreground",children:"No results found"})}):n.jsx("div",{className:"rounded-md border p-3",children:r?C:e.length?n.jsx("div",{className:"grid gap-2 sm:grid-cols-3 md:grid-cols-5 xl:grid-cols-8 2xl:grid-cols-10",children:e.map(T=>{var F;const B=T.raw_headline||T.name,L=bV(T.images),P=((F=B==null?void 0:B.trim().charAt(0))==null?void 0:F.toUpperCase())||"N";return n.jsxs("button",{type:"button",onClick:()=>{f(T),A(!0)},className:"group flex h-full flex-col overflow-hidden rounded-md border bg-background text-left transition hover:border-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2",children:[n.jsx("div",{className:"relative aspect-[4/3] w-full overflow-hidden bg-muted",children:L?n.jsx("img",{src:L,alt:B||"News content image",className:"h-full w-full object-cover transition duration-300 group-hover:scale-105",onError:M=>{M.currentTarget.style.display="none"}}):n.jsx("div",{className:"flex h-full w-full items-center justify-center bg-gradient-to-br from-primary/10 via-primary/5 to-primary/20 text-lg font-semibold text-primary",children:n.jsx("span",{"aria-hidden":"true",children:P})})}),n.jsx("div",{className:"p-2",children:n.jsx("h3",{className:"line-clamp-2 text-xs font-semibold text-foreground",children:B})})]},T.id)})}):n.jsx("div",{className:"flex h-32 items-center justify-center text-sm text-muted-foreground",children:"No results found"})}),n.jsxs("div",{className:"flex items-center justify-between mt-4",children:[n.jsx("div",{className:"text-sm text-muted-foreground",children:c>0?`Showing ${a*y+1}-${Math.min((a+1)*y,c)} of ${c} results`:"No results"}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx(te,{variant:"outline",size:"sm",onClick:()=>i(T=>Math.max(0,T-1)),disabled:a===0,children:"Previous"}),n.jsx(te,{variant:"outline",size:"sm",onClick:()=>i(T=>T+1),disabled:(a+1)*y>=c,children:"Next"})]})]}),n.jsx(kpt,{content:m,open:p,onOpenChange:A})]})}const cle=dae,dle=C6,ule=k6;function yAt(e,t=[]){let r=[];function s(i,o){const l=g.createContext(o);l.displayName=i+"Context";const c=r.length;r=[...r,o];const d=h=>{var x;const{scope:m,children:f,...p}=h,A=((x=m==null?void 0:m[e])==null?void 0:x[c])||l,v=g.useMemo(()=>p,Object.values(p));return n.jsx(A.Provider,{value:v,children:f})};d.displayName=i+"Provider";function u(h,m){var A;const f=((A=m==null?void 0:m[e])==null?void 0:A[c])||l,p=g.useContext(f);if(p)return p;if(o!==void 0)return o;throw new Error(`\`${h}\` must be used within \`${i}\``)}return[d,u]}const a=()=>{const i=r.map(o=>g.createContext(o));return function(l){const c=(l==null?void 0:l[e])||i;return g.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return a.scopeName=e,[s,wAt(a,...t)]}function wAt(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const s=e.map(a=>({useScope:a(),scopeName:a.scopeName}));
1907return function(i){const o=s.reduce((l,{useScope:c,scopeName:d})=>{const h=c(i)[`__scope${d}`];return{...l,...h}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return r.scopeName=t.scopeName,r}var jAt=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],hle=jAt.reduce((e,t)=>{const r=Ly(`Primitive.${t}`),s=g.forwardRef((a,i)=>{const{asChild:o,...l}=a,c=o?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),n.jsx(c,{...l,ref:i})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{}),_L="Progress",CL=100,[NAt]=yAt(_L),[_At,CAt]=NAt(_L),fle=g.forwardRef((e,t)=>{const{__scopeProgress:r,value:s=null,max:a,getValueLabel:i=SAt,...o}=e;(a||a===0)&&!yV(a)&&console.error(kAt(`${a}`,"Progress"));const l=yV(a)?a:CL;s!==null&&!wV(s,l)&&console.error(EAt(`${s}`,"Progress"));const c=wV(s,l)?s:null,d=N_(c)?i(c,l):void 0;return n.jsx(_At,{scope:r,value:c,max:l,children:n.jsx(hle.div,{"aria-valuemax":l,"aria-valuemin":0,"aria-valuenow":N_(c)?c:void 0,"aria-valuetext":d,role:"progressbar","data-state":Ale(c,l),"data-value":c??void 0,"data-max":l,...o,ref:t})})});fle.displayName=_L;var mle="ProgressIndicator",ple=g.forwardRef((e,t)=>{const{__scopeProgress:r,...s}=e,a=CAt(mle,r);return n.jsx(hle.div,{"data-state":Ale(a.value,a.max),"data-value":a.value??void 0,"data-max":a.max,...s,ref:t})});ple.displayName=mle;function SAt(e,t){return`${Math.round(e/t*100)}%`}function Ale(e,t){return e==null?"indeterminate":e===t?"complete":"loading"}function N_(e){return typeof e=="number"}function yV(e){return N_(e)&&!isNaN(e)&&e>0}function wV(e,t){return N_(e)&&!isNaN(e)&&e<=t&&e>=0}function kAt(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${CL}\`.`}function EAt(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be:
1908  - a positive number
1909  - less than the value passed to \`max\` (or ${CL} if no \`max\` prop is set)
1910  - \`null\` or \`undefined\` if the progress is indeterminate.
1911
1912Defaulting to \`null\`.`}var gle=fle,BAt=ple;const Ou=g.forwardRef(({className:e,value:t,indicatorClassName:r,...s},a)=>n.jsx(gle,{ref:a,className:ye("relative h-4 w-full overflow-hidden rounded-full bg-secondary",e),...s,children:n.jsx(BAt,{className:ye("h-full w-full flex-1 bg-primary transition-all",r),style:{transform:`translateX(-${100-(t||0)}%)`}})}));Ou.displayName=gle.displayName;const Cl={CHECK_INACTIVE_BILLING:"check_inactive_billing",PROCESS_BRAND_CONVERGENCES:"process_brand_convergences",PROCESS_ALL:"process_all",WEEKLY_REVIEW:"weekly_review",AUTOPOST_CONTENT_GENERATION:"autopost_content_generation",AUTOPOST_PUBLISHING:"autopost_publishing",DAILY_CONTENT_DIGEST:"daily_content_digest",FETCH_POST_STATS:"fetch_post_stats"};function Jg(e){var t;return e&&typeof e=="object"&&e.execution&&typeof e.execution=="object"&&((t=e._meta)==null?void 0:t.schema_version)==="2.0"}const TAt=e=>{switch(e.toLowerCase()){case"success":case"completed":return n.jsx(qt,{className:"w-4 h-4 text-green-600"});case"error":case"failed":return n.jsx(Rl,{className:"w-4 h-4 text-red-600"});case"running":case"in_progress":case"started":return n.jsx(ho,{className:"w-4 h-4 text-blue-600"});default:return n.jsx(Vr,{className:"w-4 h-4 text-gray-600"})}},PAt=e=>{const t=(e==null?void 0:e.toLowerCase())||"";return t.includes("autopost_content_generation")?n.jsx(gu,{className:"w-4 h-4 text-purple-600"}):t.includes("autopost_content_queued")?n.jsx(Om,{className:"w-4 h-4 text-blue-600"}):t.includes("brand_convergence_queued")?n.jsx(NB,{className:"w-4 h-4 text-green-600"}):t.includes("daily_content_digest")?n.jsx(Cu,{className:"w-4 h-4 text-orange-600"}):t.includes("manual_trigger_process_all")?n.jsx(Nxe,{className:"w-4 h-4 text-indigo-600"}):t.includes("scheduled_brand_processing")?n.jsx(NB,{className:"w-4 h-4 text-green-600"}):t.includes("scheduled_post_sender")?n.jsx(og,{className:"w-4 h-4 text-teal-600"}):t.includes("check_inactive_billing")?n.jsx(qt,{className:"w-4 h-4 text-green-600"}):t.includes("process_brand_convergences")?n.jsx(Es,{className:"w-4 h-4 text-blue-600"}):t.includes("process_all")?n.jsx(AK,{className:"w-4 h-4 text-purple-600"}):t.includes("weekly_review")?n.jsx(Cu,{className:"w-4 h-4 text-orange-600"}):t.includes("fetch_post_stats")?n.jsx(sl,{className:"w-4 h-4 text-cyan-600"}):n.jsx(fs,{className:"w-4 h-4 text-gray-600"})},jV=e=>{const t=(e==null?void 0:e.toLowerCase())||"";return t.includes("autopost_content_generation")?{label:"Content Generation Files",files:["workers/src/rainfactory/content_and_convergences/scheduled-content-generation-worker.ts","workers/src/rainfactory/content_and_convergences/content-generator-worker.ts","workers/src/_shared/services/AutopostDecisionService.ts","workers/src/rainfactory/content_and_convergences/shared-content-creation.ts"]}:t.includes("autopost_content_queued")||t.includes("autopost_publishing")?{label:"Content Publishing Files",files:["workers/src/rainfactory/content_and_convergences/scheduled-post-sender.ts","workers/src/rainfactory/content_and_convergences/social-post-publisher.ts","workers/src/rainfactory/social-platforms/platform-adapter.ts","workers/src/rainfactory/autopost/social-post-queue-worker.ts"]}:t.includes("brand_convergence_queued")||t.includes("scheduled_brand_processing")?{label:"Brand Processing Files",files:["workers/src/rainfactory/content_and_convergences/scheduled-brand-processing.ts","workers/src/rainfactory/content_and_convergences/convergence-task-worker.ts","workers/src/rainfactory/content_and_convergences/lib/database-service.ts"]}:t.includes("daily_content_digest")?{label:"Email Digest Files",files:["workers/src/rainfactory/content_and_convergences/daily-content-digest-worker.ts","workers/src/rainfactory/trigger-daily-content-digest.ts","workers/src/_shared/services/emailSender.ts","workers/src/_shared/services/emailBuilder.ts"]}:t.includes("manual_trigger_process_all")?{label:"Process All Files",files:["workers/src/rainfactory/trigger-scheduled-task.ts","workers/src/routes/rainfactory.ts","workers/src/rainfactory/content_and_convergences/scheduled-brand-processing.ts"]}:t.includes("scheduled_post_sender")?{label:"Post Sender Files",files:["workers/src/rainfactory/content_and_convergences/scheduled-post-sender.ts","workers/src/rainfactory/content_and_convergences/social-post-publisher.ts","workers/src/rainfactory/social-platforms/platform-adapter.ts"]}:t.includes("check_inactive_billing")?{label:"Billing Check Files",files:["workers/src/rainfactory/content_and_convergences/scheduled-brand-processing.ts","workers/src/billing-functions/BillingHttpWorker.ts","workers/src/billing-functions/billing-webhooks-wor
1912ker.ts"]}:t.includes("process_brand_convergences")?{label:"Brand Convergence Files",files:["workers/src/rainfactory/content_and_convergences/scheduled-brand-processing.ts","workers/src/rainfactory/content_and_convergences/convergence-task-worker.ts","workers/src/rainfactory/content_and_convergences/lib/database-service.ts"]}:t.includes("weekly_review")?{label:"Weekly Review Files",files:["workers/src/rainfactory/content_and_convergences/weekly-review-worker.ts","workers/src/rainfactory/trigger-weekly-review.ts","workers/src/_shared/services/emailSender.ts"]}:t.includes("fetch_post_stats")?{label:"Post Statistics Files",files:["workers/src/rainfactory/content_and_convergences/fetch-post-stats-worker.ts","workers/src/rainfactory/social-platforms/instagram-adapter.ts","workers/src/rainfactory/social-platforms/facebook-adapter.ts","workers/src/rainfactory/social-platforms/platform-adapter.ts"]}:{label:"General Task Files",files:["workers/src/rainfactory/content_and_convergences/scheduled-brand-processing.ts","workers/src/routes/rainfactory.ts"]}},XP=e=>{switch(e.toLowerCase()){case"success":case"completed":return"default";case"error":case"failed":return"destructive";case"running":case"in_progress":case"started":return"secondary";default:return"outline"}},NV=e=>{if(!e)return"N/A";if(typeof e=="string"){const t=e.split(":");if(t.length===3){const r=parseInt(t[0]),s=parseInt(t[1]),a=parseFloat(t[2]);return`${((r*3600+s*60+a)*1e3).toFixed(0)}ms`}return e}return String(e)};function IAt({triggerTask:e,triggerLoading:t,selectedBrand:r}){const s=[{key:Cl.CHECK_INACTIVE_BILLING,icon:n.jsx(qt,{className:"w-4 h-4"}),tooltip:"Check Inactive Billing",description:"Check for inactive billing accounts and disable their brands",variant:"outline"},{key:Cl.PROCESS_BRAND_CONVERGENCES,icon:n.jsx(Es,{className:"w-4 h-4"}),tooltip:"Find & Re-rank Convergences (Selected Brand)",description:r?`Process convergences for ${r.brand_name}`:"Select a brand to process convergences",variant:"outline",disabled:!r},{key:Cl.PROCESS_ALL,icon:n.jsx(AK,{className:"w-4 h-4"}),tooltip:"Process All",description:"Run the complete scheduled task process for all brands",variant:"secondary"},{key:Cl.WEEKLY_REVIEW,icon:n.jsx(Cu,{className:"w-4 h-4"}),tooltip:"Send Weekly Review",description:"Generate and send weekly review emails to all active brands",variant:"outline"},{key:Cl.AUTOPOST_CONTENT_GENERATION,icon:n.jsx(gu,{className:"w-4 h-4"}),tooltip:"Test Auto-Creation",description:"Trigger daily content generation cron job",variant:"outline"},{key:Cl.AUTOPOST_PUBLISHING,icon:n.jsx(og,{className:"w-4 h-4"}),tooltip:"Test Publishing",description:"Trigger 5-minute publishing check cron job",variant:"outline"},{key:Cl.DAILY_CONTENT_DIGEST,icon:n.jsx(Xr,{className:"w-4 h-4"}),tooltip:"Daily Content Digest",description:"Send daily digest emails with content updates",variant:"outline"},{key:Cl.FETCH_POST_STATS,icon:n.jsx(sl,{className:"w-4 h-4"}),tooltip:"Fetch Post Statistics",description:"Fetch statistics for Instagram and Facebook posts from last 30 days",variant:"outline"}];return n.jsx(Te,{className:"bg-blue-50 border-blue-200",children:n.jsx(Re,{className:"p-4",children:n.jsxs("div",{className:"flex flex-col space-y-3",children:[n.jsxs("div",{className:"flex items-center space-x-2",children:[n.jsx(fs,{className:"w-4 h-4 text-blue-600"}),n.jsx("h3",{className:"font-medium text-blue-900",children:"Manual Triggers"}),n.jsx("span",{className:"text-xs text-blue-600 bg-blue-100 px-2 py-1 rounded",children:"Superadmin Only"})]}),n.jsx("div",{className:"flex flex-wrap gap-2",children:s.map(a=>n.jsxs(Hs,{children:[n.jsx(zs,{asChild:!0,children:n.jsxs(te,{onClick:()=>e(a.key),disabled:t[a.key]||a.disabled,variant:a.variant,size:"sm",className:"h-9 px-3",children:[t[a.key]?n.jsx(Es,{className:"w-4 h-4 animate-spin"}):a.icon,n.jsx("span",{className:"ml-2 hidden sm:inline",children:a.tooltip})]})}),n.jsx(Vn,{className:"max-w-xs",children:n.jsxs("div",{className:"space-y-1",children:[n.jsx("p",{className:"font-medium",children:a.tooltip}),n.jsx("p",{className:"text-xs text-muted-foreground",children:a.description})]})})]},a.key))})]})})})}function OAt(){const{toast:e}=sn(),{isSuperAdmin:t}=rp(),{selectedBrand:r}=mn(),[s,a]=g.useState([]),[i,o]=g.useState(!0),[l,c]=g.useState(""),[d,u]=g.useState(""),[h,m]=g.useState(""),[f,p]=g.useState("7d"),[A,v]=g.useState(new Set),[x,b]=g.useState(!1),[y,w]=g.useState({}),j=g.useCallback(async()=>{try{let L=de.from("cron_logs_clean_detailed").select("*").order("created_at",{ascending:!1});if(f!=="all"){let M;const I=new Date;if(f==="5m")M=TAe(I,5);else if(f==="1h")M=BAe(I,1);else{const $=parseInt(f.replace("d",""));M=BA(Fh(I,$))}L=L.gte("created_at",M.toISOString())}h&&(L=L.ilike("job_name",`%${h}%`)),d&&(L=L.eq("status",d)),L=L.limit(100);const{data:P,error:F}=await L;if(F)throw F;a(P||[])}catch(L){console.error("Error fetching clean cron logs:",L),e({title:"Error fetching logs",description:"Failed to fetch cron logs",variant:"destructive"})}finally{o(!1)}},[f,h,d,e]);g.useEffect(()=>{j()},[j]),g.useEffect(()=>{let L;return x&&(L=setInterval(()=>{j()},1e4)),()=>{L&&clearInterval(L)}},[x,j]);const N=g.useMemo(()=>[...new Set(s.map(P=>
1912P.job_name).filter(Boolean))].sort(),[s]),_=g.useMemo(()=>{const L=s.filter(F=>!F.parent_log_id),P=s.filter(F=>F.parent_log_id);return L.map(F=>({...F,children:P.filter(M=>M.parent_log_id===F.id)}))},[s]),S=g.useMemo(()=>_.filter(L=>{var M,I,$,V,R,Q,U,D;if(!l)return!0;const P=l.toLowerCase();if((M=L.job_name)!=null&&M.toLowerCase().includes(P)||(I=L.error_message)!=null&&I.toLowerCase().includes(P))return!0;const F=Jg(L.details)?L.details:null;return!!(F&&(($=F.workflow_steps)!=null&&$.some(q=>{var G;return q.step.toLowerCase().includes(P)||((G=q.error_message)==null?void 0:G.toLowerCase().includes(P))||JSON.stringify(q.result).toLowerCase().includes(P)})||(V=F.content_generated)!=null&&V.some(q=>{var G;return q.content_type.toLowerCase().includes(P)||((G=q.name)==null?void 0:G.toLowerCase().includes(P))||q.content_id.toLowerCase().includes(P)})||(R=F.content_published)!=null&&R.some(q=>{var G;return q.platform.toLowerCase().includes(P)||q.post_id.toLowerCase().includes(P)||((G=q.error_message)==null?void 0:G.toLowerCase().includes(P))})||(Q=F.error)!=null&&Q.message.toLowerCase().includes(P)||(D=(U=F.error)==null?void 0:U.error_code)!=null&&D.toLowerCase().includes(P)))}),[_,l]),C=L=>{const P=new Set(A);P.has(L)?P.delete(L):P.add(L),v(P)},E=async()=>{o(!0),await j()},T=async L=>{if(L===Cl.PROCESS_BRAND_CONVERGENCES&&!r){e({title:"No brand selected",description:"Please select a brand to process convergences.",variant:"destructive"});return}if(!t){e({title:"Unauthorized",description:"Only superadmins can execute scheduled operations.",variant:"destructive"});return}w(P=>({...P,[L]:!0}));try{const P=await de.auth.getSession();if(!P.data.session)throw new Error("No session found");const F="https://worker.rainfactory.ai";let M,I;L===Cl.DAILY_CONTENT_DIGEST?(M=`${F}/rainfactory/trigger-daily-content-digest`,I={}):L===Cl.FETCH_POST_STATS?(M=`${F}/rainfactory/trigger-fetch-post-stats`,I={}):(M=`${F}/rainfactory/trigger-scheduled-task`,I={taskName:L},L===Cl.PROCESS_BRAND_CONVERGENCES&&r&&(I.brandId=r.id));const $=await fetch(M,{method:"POST",headers:{Authorization:`Bearer ${P.data.session.access_token}`,"Content-Type":"application/json"},body:JSON.stringify(I)}),V=await $.json();if(!$.ok)throw new Error((V==null?void 0:V.error)||`HTTP error! status: ${$.status}`);e({title:"Task triggered successfully",description:V.message}),await j()}catch(P){console.error("Error triggering task:",P);const F=P instanceof Error?P.message:"Unknown error";e({title:"Error triggering task",description:F,variant:"destructive"})}finally{w(P=>({...P,[L]:!1}))}},B=async()=>{try{const L={export_metadata:{export_date:new Date().toISOString(),export_type:"clean_cron_logs",total_logs:S.length,filters_applied:{search_term:l||null,status_filter:d||null,job_name_filter:h||null,date_range:f},version:"2.0"},logs:S.map(I=>{var $,V,R;return{...I,clean_structure_summary:Jg(I.details)?{execution_status:I.details.execution.status,workflow_steps_count:(($=I.details.workflow_steps)==null?void 0:$.length)||0,content_generated_count:((V=I.details.content_generated)==null?void 0:V.length)||0,content_published_count:((R=I.details.content_published)==null?void 0:R.length)||0,has_error:!!I.details.error,has_metrics:!!I.details.metrics,duration_ms:I.details.execution.duration_ms}:null}})},P=JSON.stringify(L,null,2);await navigator.clipboard.writeText(P);const F=L.logs.length,M=Math.round(new Blob([P]).size/1024);e({title:"✅ Clean Data Copied!",description:`Successfully copied ${F} logs (${M} KB) as clean, structured JSON. No parsing required!`})}catch(L){console.error("Error copying logs to clipboard:",L),e({title:"Copy failed",description:"Failed to copy logs to clipboard",variant:"destructive"})}};return i?n.jsxs("div",{className:"space-y-4",children:[n.jsx("div",{className:"flex items-center space-x-2",children:n.jsx("div",{className:"h-8 w-48 bg-gray-200 rounded animate-pulse"})}),n.jsx("div",{className:"space-y-2",children:[1,2,3,4,5].map(L=>n.jsx("div",{className:"h-12 bg-gray-200 rounded animate-pulse"},L))})]}):n.jsx(Ya,{children:n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex flex-col space-y-4",children:[n.jsx("div",{className:"flex flex-col lg:flex-row lg:items-center lg:justify-between space-y-4 lg:space-y-0",children:n.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.jsxs(te,{onClick:E,variant:"outline",size:"sm",disabled:i,title:"Refresh log data",children:[n.jsx(Es,{className:`w-4 h-4 mr-1 ${i||x?"animate-spin":""}`}),x?"Auto":"Refresh"]}),n.jsxs(te,{onClick:()=>b(!x),variant:x?"default":"outline",size:"sm",title:x?"Disable auto-refresh":"Enable auto-refresh",children:[n.jsx(sl,{className:"w-4 h-4 mr-1"}),"Live"]}),n.jsxs(te,{onClick:B,variant:"outline",size:"sm",disabled:S.length===0,title:"Export clean structured data - no parsing required!",children:[n.jsx(Cn,{className:"w-4 h-4 mr-1"}),"Export Clean Data"]})]})}),t&&n.jsx(IAt,{triggerTask:T,triggerLoading:y,selectedBrand:r})]}),n.jsx("div",{className:"flex flex-col space-y-4",children:n.jsxs("div",{className:"flex flex-wrap gap-3 items-center",children:[n.jsxs("div",{className:"relative flex-1 min-w-[200px] max-w-[300px]",children:[n.jsx(Ns,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 w-4 h-4"}),n.jsx(qe,{placeholder:"Search jobs, steps, content, errors...",value:l,onCh
1912ange:L=>c(L.target.value),className:"pl-10 w-full"})]}),n.jsxs(ur,{value:f,onValueChange:L=>p(L),children:[n.jsxs(or,{className:"w-32",children:[n.jsx(Kn,{className:"w-4 h-4 mr-2"}),n.jsx(hr,{})]}),n.jsxs(lr,{children:[n.jsx(Fe,{value:"5m",children:"Last 5 Min"}),n.jsx(Fe,{value:"1h",children:"Last Hour"}),n.jsx(Fe,{value:"1d",children:"Last Day"}),n.jsx(Fe,{value:"3d",children:"Last 3 Days"}),n.jsx(Fe,{value:"7d",children:"Last Week"}),n.jsx(Fe,{value:"30d",children:"Last Month"}),n.jsx(Fe,{value:"all",children:"All Time"})]})]}),n.jsxs(ur,{value:d||"all",onValueChange:L=>u(L==="all"?"":L),children:[n.jsxs(or,{className:"w-32",children:[n.jsx(IA,{className:"w-4 h-4 mr-2"}),n.jsx(hr,{placeholder:"Status"})]}),n.jsxs(lr,{children:[n.jsx(Fe,{value:"all",children:"All Status"}),n.jsx(Fe,{value:"success",children:"Success"}),n.jsx(Fe,{value:"completed",children:"Completed"}),n.jsx(Fe,{value:"error",children:"Error"}),n.jsx(Fe,{value:"failed",children:"Failed"}),n.jsx(Fe,{value:"started",children:"Started"})]})]}),n.jsxs(ur,{value:h||"all",onValueChange:L=>m(L==="all"?"":L),children:[n.jsxs(or,{className:"w-48",children:[n.jsx(pd,{className:"w-4 h-4 mr-2"}),n.jsx(hr,{placeholder:"Job Name"})]}),n.jsxs(lr,{children:[n.jsx(Fe,{value:"all",children:"All Jobs"}),N.map(L=>n.jsx(Fe,{value:L,children:L},L))]})]}),(d||h||l||f!=="7d")&&n.jsx(te,{onClick:()=>{u(""),m(""),c(""),p("7d")},variant:"ghost",size:"sm",children:"Clear Filters"})]})}),n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[n.jsx(Te,{children:n.jsx(Re,{className:"p-3 md:p-4",children:n.jsxs("div",{className:"flex items-center space-x-2",children:[n.jsx(qt,{className:"w-5 h-5 text-green-600"}),n.jsxs("div",{children:[n.jsx("p",{className:"text-xs md:text-sm text-muted-foreground",children:"Successful"}),n.jsx("p",{className:"text-lg md:text-xl font-semibold",children:s.filter(L=>L.status&&["success","completed"].includes(L.status)).length})]})]})})}),n.jsx(Te,{children:n.jsx(Re,{className:"p-3 md:p-4",children:n.jsxs("div",{className:"flex items-center space-x-2",children:[n.jsx(Rl,{className:"w-5 h-5 text-red-600"}),n.jsxs("div",{children:[n.jsx("p",{className:"text-xs md:text-sm text-muted-foreground",children:"Failed"}),n.jsx("p",{className:"text-lg md:text-xl font-semibold",children:s.filter(L=>L.status&&["error","failed"].includes(L.status)).length})]})]})})}),n.jsx(Te,{children:n.jsx(Re,{className:"p-3 md:p-4",children:n.jsxs("div",{className:"flex items-center space-x-2",children:[n.jsx(ho,{className:"w-5 h-5 text-blue-600"}),n.jsxs("div",{children:[n.jsx("p",{className:"text-xs md:text-sm text-muted-foreground",children:"Running"}),n.jsx("p",{className:"text-lg md:text-xl font-semibold",children:s.filter(L=>L.status&&["running","started","in_progress"].includes(L.status)).length})]})]})})}),n.jsx(Te,{children:n.jsx(Re,{className:"p-3 md:p-4",children:n.jsxs("div",{className:"flex items-center space-x-2",children:[n.jsx(Vr,{className:"w-5 h-5 text-gray-600"}),n.jsxs("div",{children:[n.jsx("p",{className:"text-xs md:text-sm text-muted-foreground",children:"Total"}),n.jsx("p",{className:"text-lg md:text-xl font-semibold",children:_.length})]})]})})})]}),n.jsx("div",{className:"border rounded-lg overflow-hidden",children:n.jsx("div",{className:"overflow-x-auto",children:n.jsxs(po,{className:"w-full",children:[n.jsx(Ao,{children:n.jsxs(Yr,{children:[n.jsx($t,{className:"w-8"}),n.jsx($t,{className:"w-1/3",children:"Job Name"}),n.jsx($t,{className:"w-16",children:"Status"}),n.jsx($t,{className:"w-1/5",children:"Progress"}),n.jsx($t,{className:"w-20",children:"Duration"}),n.jsx($t,{className:"w-16",children:"Actions"})]})}),n.jsx(go,{children:S.map(L=>n.jsx(FAt,{log:L,isExpanded:A.has(L.id||""),onToggle:()=>C(L.id||"")},L.id||""))})]})})}),S.length===0&&n.jsxs("div",{className:"text-center py-12",children:[n.jsx(hn,{className:"w-12 h-12 text-gray-400 mx-auto mb-4"}),n.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:"No logs found"}),n.jsx("p",{className:"text-gray-500",children:l||d?"Try adjusting your filters.":"No cron jobs have run recently."})]})]})})}function FAt({log:e,isExpanded:t,onToggle:r}){var c,d,u,h;const s=Jg(e.details)?e.details:null,a=!!s,i=e.children&&e.children.length>0,o=a||i,l=g.useMemo(()=>{var p;if(!((p=s==null?void 0:s.workflow_steps)!=null&&p.length))return null;const m=s.workflow_steps.filter(A=>A.status==="completed").length,f=s.workflow_steps.length;return Math.round(m/Math.max(f,1)*100)},[s==null?void 0:s.workflow_steps]);
1912return n.jsxs(n.Fragment,{children:[n.jsxs(Yr,{className:`cursor-pointer hover:bg-gray-50 transition-colors ${e.status==="error"||e.status==="failed"?"bg-red-50 hover:bg-red-100":""}`,onClick:o?r:void 0,children:[n.jsx(mt,{children:o&&n.jsx("div",{className:"flex items-center justify-center",children:t?n.jsx(Un,{className:"w-4 h-4 text-gray-400"}):n.jsx(_s,{className:"w-4 h-4 text-gray-400"})})}),n.jsx(mt,{className:"font-medium",children:n.jsxs("div",{className:"flex items-center space-x-2 min-w-0",children:[PAt(e.job_name||""),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsx("div",{className:"truncate",children:e.job_name||"N/A"}),n.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:[n.jsx("div",{className:"hidden md:block",children:e.run_at?nn(new Date(e.run_at),"MMM d, HH:mm:ss"):"N/A"}),n.jsx("div",{className:"md:hidden",children:e.run_at?nn(new Date(e.run_at),"MMM d HH:mm"):"N/A"}),n.jsx("div",{className:"text-xs text-muted-foreground hidden sm:block",children:e.run_at?rK(new Date(e.run_at),{addSuffix:!0}):"N/A"})]})]}),e.brand_id&&n.jsx(Be,{variant:"outline",className:"text-xs flex-shrink-0",children:"Brand"})]})}),n.jsx(mt,{children:n.jsx(Be,{variant:XP(((c=s==null?void 0:s.execution)==null?void 0:c.status)||e.status||"completed"),children:((d=s==null?void 0:s.execution)==null?void 0:d.status)||e.status||"Completed"})}),n.jsx(mt,{children:n.jsxs("div",{className:"space-y-1",children:[l!==null&&n.jsxs("div",{className:"w-24",children:[n.jsx(Ou,{value:l,className:"h-2"}),n.jsxs("span",{className:"text-xs text-muted-foreground",children:[l,"%"]})]}),(s==null?void 0:s.metrics)&&n.jsxs("div",{className:"text-xs text-muted-foreground",children:[s.metrics.success_count||0," success,"," ",s.metrics.error_count||0," errors"]}),i&&n.jsxs("div",{className:"text-xs text-muted-foreground",children:[(u=e.children)==null?void 0:u.length," workers"]}),(s==null?void 0:s.content_generated)&&n.jsxs("div",{className:"text-xs text-blue-600",children:[s.content_generated.length," content generated"]}),(s==null?void 0:s.content_published)&&n.jsxs("div",{className:"text-xs text-green-600",children:[s.content_published.length," published"]})]})}),n.jsx(mt,{children:n.jsx("div",{className:"text-sm",children:s!=null&&s.execution.duration_ms?`${s.execution.duration_ms}ms`:NV(e.execution_time)})}),n.jsx(mt,{onClick:m=>m.stopPropagation(),children:n.jsxs(Zt,{children:[n.jsx(aC,{asChild:!0,children:n.jsx(te,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",title:"View clean structured data",children:n.jsx(pd,{className:"w-4 h-4"})})}),n.jsxs(Jt,{className:"max-w-4xl max-h-[80vh] overflow-y-auto",children:[n.jsxs(_r,{children:[n.jsxs(tr,{children:["Clean Log Data: ",e.job_name]}),n.jsx(Hr,{children:"Direct access to structured data - no parsing required"})]}),n.jsx($At,{log:e})]})]})})]}),t&&n.jsx(Yr,{children:n.jsx(mt,{colSpan:6,className:"bg-gray-50 p-0",children:n.jsx("div",{className:"p-6",children:n.jsx(LAt,{log:e})})})}),t&&i&&n.jsx(n.Fragment,{children:(h=e.children)==null?void 0:h.map(m=>n.jsxs(Yr,{className:"bg-blue-50",children:[n.jsx(mt,{className:"pl-8",children:n.jsx("div",{className:"w-4 h-4 border-l-2 border-b-2 border-gray-300"})}),n.jsx(mt,{className:"font-medium",children:n.jsxs("div",{className:"flex items-center space-x-2",children:[TAt(m.status||""),n.jsx("span",{className:"text-sm",children:m.job_name}),n.jsx(Be,{variant:"secondary",className:"text-xs",children:"Worker"})]})}),n.jsx(mt,{children:n.jsx(Be,{variant:XP(m.status||""),className:"text-xs",children:m.status||"unknown"})}),n.jsx(mt,{children:Jg(m.details)&&m.details.metrics&&n.jsxs("div",{className:"text-xs text-muted-foreground",children:[m.details.metrics.items_processed||0," processed"]})}),n.jsx(mt,{children:n.jsx("div",{className:"text-sm",children:NV(m.execution_time)})}),n.jsx(mt,{children:m.error_message&&n.jsx("div",{className:"text-xs text-red-600 truncate",title:m.error_message,children:m.error_message})})]},m.id||""))})]})}function LAt({log:e}){var r,s,a;const t=Jg(e.details)?e.details:null;return!t&&!e.error_message?n.jsx("div",{className:"text-center py-4 text-muted-foreground",children:"No clean structured data available"}):n.jsxs("div",{className:"space-y-6",children:[(e.error_message||(t==null?void 0:t.error))&&n.jsxs(Te,{className:"border-red-200 bg-red-50",children:[n.jsx(st,{className:"pb-3",children:n.jsxs(ot,{className:"text-red-800 flex items-center space-x-2",children:[n.jsx(hn,{className:"w-5 h-5"}),n.jsx("span",{children:"Error Details"})]})}),n.jsxs(Re,{children:[(t==null?void 0:t.error)&&n.jsxs("div",{className:"space-y-2",children:[n.jsx("p",{className:"text-red-700 font-medium",children:t.error.message}),t.error.error_code&&n.jsxs("p",{className:"text-sm text-red-600",children:["Code: ",t.error.error_code]}),t.error.context&&n.jsx("pre",{className:"text-xs text-red-600 bg-red-100 p-2 rounded",children:JSON.stringify(t.error.context,null,2)})]}),e.error_message&&!(t!=null&&t.error)&&n.jsx("pre",{className:"text-red-700 text-sm whitespace-pre-wrap",children:e.error_message})]})]}),n.jsxs(Te,{className:"border-amber-200 bg-amber-50",children:[n.jsx(st,{className:"pb-3",children:n.jsxs(ot,{className:"flex items-center space-x-2 text-amber-800",children:[n.jsx(vB,{className:"w-5 h-5"}),n.jsx("span",{children:jV(e.job_name||"").label})]})}),n.jsx(Re,{children:n.jsx("div",{className:"space-y-2",children:jV(e.job_name||"").files.map((i,o)=>n.jsxs("div",{className:"flex items-center space-x-2 text-sm",children:[n.jsx(Xr,{className:"w-4 h-4 text-amber-600 flex-shrink-0"}),n.jsx("code",{className:"bg-amber-100 px-2 py-1 rounded text-amber-800 font-mono text-xs",children:i})]},o))})})]}),t&&n.jsxs(Te,{children:[n.jsx(st,{className:"pb-3",children:n.jsxs(ot,{className:"flex items-center space-x-2",children:[n.jsx(en,{className:"w-5 h-5"}),n.jsx("span",{children:"Clean Execution Summary"}),n.jsx(Be,{variant:"default",className:"text-xs",children:"v2.0"})]})}),n.jsx(Re,{children:n.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4 text-sm",children:[n.jsxs("div",{children:[n.jsx("span",{className:"font-medium text-gray-600",children:"Status:"}),n.jsx("p",{className:"mt-1",children:t.execution.status})]}),n.jsxs("div",{children:[n.jsx("span",{className:"font-medium text-gray-600",children:"Started:"}),n.jsx("p",{className:"mt-1",children:nn(new Date(t.execution.start_time),"HH:mm:ss")})]}),t.execution.end_time&&n.jsxs("div",{children:[n.jsx("span",{className:"font-medium text-gray-600",children:"Completed:"}),n.jsx("p",{className:"mt-1",children:nn(new Date(t.execution.end_time),"HH:mm:ss")})]}),t.execution.duration_ms&&n.jsxs("div",{children:[n.jsx("span",{className:"font-medium text-gray-600",children:"Duration:"}),n.jsxs("p",{className:"mt-1",children:[t.execution.duration_ms,"ms"]})]}),t.execution.trigger_type&&n.jsxs("div",{children:[n.jsx("span",{className:"font-medium text-gray-600",children:"Trigger:"}),n.jsx("p",{className:"mt-1 capitalize",children:t.execution.trigger_type})]}),t.execution.triggered_by&&n.jsxs("div",{children:[n.jsx("span",{className:"font-medium text-gray-600",children:"Triggered By:"}),n.jsx("p",{className:"mt-1 font-mono text-xs",children:t.execution.triggered_by})]})]})})]}),t&&n.jsxs(Cs,{defaultValue:"workflow",className:"w-full",children:[n.jsxs(ps,{className:"grid w-full grid-cols-5",children:[n.jsxs(pt,{value:"workflow",children:["Workflow (",((r=t.workflow_steps)==null?void 0:r.length)||0,")"]}),n.jsxs(pt,{value:"content",children:["Generated (",((s=t.content_generated)==null?void 0:s.length)||0,")"]}),n.jsxs(pt,{value:"published",children:["Published (",((a=t.content_published)==null?void 0:a.length)||0,")"]}),n.jsx(pt,{value:"metrics",children:"Metrics"}),n.jsx(pt,{value:"raw",children:"Raw Data"})]}),n.jsx(Ct,{value:"workflow",className:"space-y-4",children:t.workflow_steps&&t.workflow_steps.length>0?n.jsx(DAt,{steps:t.workflow_steps}):n.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No workflow steps recorded"})}),n.jsx(Ct,{value:"content",className:"space-y-4",children:t.content_generated&&t.content_generated.length>0?n.jsx(RAt,{items:t.content_generated}):n.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No content generated"})}),n.jsx(Ct,{value:"published",className:"space-y-4",children:t.content_published&&t.content_published.length>0?n.jsx(UAt,{items:t.content_published}):n.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No content published"})}),n.jsx(Ct,{value:"metrics",className:"space-y-4",children:t.metrics?n.jsx(MAt,{metrics:t.metrics}):n.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No metrics recorded"})}),n.jsx(Ct,{value:"raw",children:n.jsx(vh,{data:t,title:"Clean Structured Data"})})]})]})}function DAt({steps:e}){return n.jsx("div",{className:"space-y-4",children:e.map((t,r)=>n.jsxs("div",{className:"flex items-start space-x-3",children:[n.jsx("div",{className:"flex-shrink-0",children:n.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center bg-blue-100 text-blue-600",children:n.jsx(qt,{className:"w-4 h-4"})})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("div",{className:"flex items-center space-x-2",children:[n.jsx("h4",{className:"font-medium",children:t.step}),t.status&&n.jsx(Be,{variant:t.status==="completed"?"default":t.status==="failed"?"destructive":"secondary",children:t.status})]}),n.jsxs("p",{className:"text-sm text-muted-foreground",children:[nn(new Date(t.timestamp),"HH:mm:ss.SSS"),t.duration_ms&&` • ${t.duration_ms}ms`]}),t.result&&Object.keys(t.result).length>0&&n.jsx("div",{className:"mt-2",children:n.jsx(vh,{data:t.result,title:"Step Result",collapsible:!0})}),t.error_message&&n.jsx("div",{className:"mt-2 p-2 bg-red-50 border border-red-200 rounded",children:n.jsx("p",{className:"text-red-700 text-sm",children:t.error_message})})]})]},r))})}function RAt({items:e}){return n.jsx("div",{className:"grid gap-4",children:e.map((t,r)=>n.jsx(Te,{children:n.jsx(Re,{className:"p-4",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex-1",children:[n.jsxs("div",{className:"flex items-center space-x-2",children:[n.jsx(Xr,{className:"w-4 h-4 text-blue-600"}),n.jsx(Ir,{to:`/content/${t.content_id}`,className:"font-medium text-blue-600 hover:text-blue-800 hover:underline transition-colors",children:t.content_type}),n.jsxs(Be,{variant:"outline",children:[t.content_id.slice(0,8),"..."]})]}),t.name&&n.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:t.name}),t.convergence_id&&n.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:["Convergence: ",t.convergence_id.slice(0,8),"..."]}),n.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Created: ",nn(new Date(t.created_at),"MMM d, HH:mm")]})]}),n.jsx("div",{className:"ml-2",children:n.jsx(Ir,{to:`/content/${t.content_id}`,className:"text-gray-400 hover:text-blue-600 transition-colors",title:"View content details",children:n.jsx(Vs,{className:"w-4 h-4"})})})]})})},r))})}function UAt({items:e}){return n.jsx("div",{className:"grid gap-4",children:e.map((t,r)=>n.jsx(Te,{children:n.jsx(Re,{className:"p-4",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex-1",children:[n.jsxs("div",{className:"flex items-center space-x-2",children:[n.jsx(wve,{className:"w-4 h-4 text-green-600"}),n.jsx(Ir,{to:`/brands/${t.brand_id}/connections`,className:"font-medium text-green-600 hover:text-green-800 hover:underline transition-colors",title:"View platform connections",children:t.platform}),n.jsx(Be,{variant:t.status==="published"?"default":t.status==="failed"?"destructive":"secondary",children:t.status})]}),t.published_at&&n.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:["Published: ",nn(new Date(t.published_at),"MMM d, HH:mm")]}),t.scheduled_at&&!t.published_at&&n.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:["Scheduled: ",nn(new Date(t.scheduled_at),"MMM d, HH:mm")]}),t.error_message&&n.jsxs("p",{className:"text-sm text-red-600 mt-1",children:["Error: ",t.error_message]})]}),n.jsx("div",{className:"ml-2",children:n.jsx(Ir,{to:`/brands/${t.brand_id}/connections`,className:"text-gray-400 hover:text-green-600 transition-colors",title:"View platform connections",children:n.jsx(Vs,{className:"w-4 h-4"})})})]})})},r))})}function MAt({metrics:e}){return n.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[e.items_processed!==void 0&&n.jsx(Te,{children:n.jsxs(Re,{className:"p-4 text-center",children:[n.jsx("div",{className:"text-2xl font-bold text-blue-600",children:e.items_processed}),n.jsx("div",{className:"text-sm text-blue-800",children:"Items Processed"})]})}),e.success_count!==void 0&&n.jsx(Te,{children:n.jsxs(Re,{className:"p-4 text-center",children:[n.jsx("div",{className:"text-2xl font-bold text-green-600",children:e.success_count}),n.jsx("div",{className:"text-sm text-green-800",children:"Successful"})]})}),e.error_count!==void 0&&n.jsx(Te,{children:n.jsxs(Re,{className:"p-4 text-center",children:[n.jsx("div",{className:"text-2xl font-bold text-red-600",children:e.error_count}),n.jsx("div",{className:"text-sm text-red-800",children:"Errors"})]})}),e.content_generated!==void 0&&n.jsx(Te,{children:n.jsxs(Re,{className:"p-4 text-center",children:[n.jsx("div",{className:"text-2xl font-bold text-purple-600",children:e.content_generated}),n.jsx("div",{className:"text-sm text-purple-800",children:"Content Generated"})]})}),e.posts_published!==void 0&&n.jsx(Te,{children:n.jsxs(Re,{className:"p-4 text-center",children:[n.jsx("div",{className:"text-2xl font-bold text-indigo-600",children:e.posts_published}),n.jsx("div",{className:"text-sm text-indigo-800",children:"Posts Published"})]})}),e.emails_sent!==void 0&&n.jsx(Te,{children:n.jsxs(Re,{className:"p-4 text-center",children:[n.jsx("div",{className:"text-2xl font-bold text-orange-600",children:e.emails_sent}),n.jsx("div",{className:"text-sm text-orange-800",children:"Emails Sent"})]})}),e.api_calls!==void 0&&n.jsx(Te,{children:n.jsxs(Re,{className:"p-4 text-center",children:[n.jsx("div",{className:"text-2xl font-bold text-cyan-600",children:e.api_calls}),n.jsx("div",{className:"text-sm text-cyan-800",children:"API Calls"})]})}),e.credit_consumption!==void 0&&n.jsx(Te,{children:n.jsxs(Re,{className:"p-4 text-center",children:[n.jsx("div",{className:"text-2xl font-bold text-yellow-600",children:e.credit_consumption}),n.jsx("div",{className:"text-sm text-yellow-800",children:"Credits Used"})]})})]})}function vh({data:e,title:t,collapsible:r=!1}){const[s,a]=g.useState(!r),{toast:i}=sn(),o=JSON.stringify(e,null,2),l=()=>{navigator.clipboard.writeText(o),i({title:"Copied to clipboard",description:"Clean structured data copied - no parsing required!"})};if(!e)return n.jsx("div",{className:"text-center py-4 text-muted-foreground",children:"No data available"});const c=n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[t&&n.jsx("h5",{className:"font-medium text-sm",children:t}),n.jsxs("div",{className:"flex items-center space-x-2",children:[n.jsx(Be,{variant:"default",className:"text-xs",children:"Clean v2.0"}),n.jsxs("span",{className:"text-xs text-muted-foreground",children:[o.length," characters"]}),n.jsx(te,{onClick:l,variant:"ghost",size:"sm",className:"h-6 px-2",children:n.jsx(Cn,{className:"w-3 h-3"})})]})]}),n.jsx("pre",{className:"p-3 bg-gray-50 border rounded text-xs max-h-96 overflow-auto font-mono whitespace-pre-wrap",children:o})]});return r?n.jsxs(cle,{open:s,onOpenChange:a,children:[n.jsx("div",{className:"flex items-center justify-between py-2",children:n.jsxs(dle,{className:"flex items-center space-x-2 text-sm hover:text-blue-600",children:[s?n.jsx(Un,{className:"w-4 h-4"}):n.jsx(_s,{className:"w-4 h-4"}),n.jsx("span",{children:t||"View Clean JSON Data"})]})}),n.jsx(ule,{children:c})]}):c}function $At({log:e}){var a,i;const t=Jg(e.details)?e.details:null,{toast:r}=sn(),s=()=>{navigator.clipboard.writeText(JSON.stringify(e,null,2)),r({title:"Copied to clipboard",description:"Complete clean log data copied successfully"})};return n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-cente
1912r justify-between",children:[n.jsxs("div",{className:"flex items-center space-x-2",children:[t&&n.jsxs(Be,{variant:"default",children:[n.jsx(en,{className:"w-3 h-3 mr-1"}),"Clean v",((a=t._meta)==null?void 0:a.schema_version)||"2.0"]}),!t&&n.jsx(Be,{variant:"destructive",children:"Legacy Structure"})]}),n.jsxs(te,{onClick:s,variant:"outline",size:"sm",children:[n.jsx(Cn,{className:"w-4 h-4 mr-2"}),"Copy All"]})]}),t?n.jsxs(Cs,{defaultValue:"overview",children:[n.jsxs(ps,{children:[n.jsx(pt,{value:"overview",children:"Overview"}),n.jsx(pt,{value:"execution",children:"Execution"}),n.jsx(pt,{value:"data",children:"Clean Data"}),n.jsx(pt,{value:"raw",children:"Raw JSON"})]}),n.jsx(Ct,{value:"overview",className:"space-y-4",children:n.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-gray-600",children:"Job Name"}),n.jsx("p",{className:"mt-1 text-sm",children:e.job_name})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-gray-600",children:"Status"}),n.jsx("p",{className:"mt-1",children:n.jsx(Be,{variant:XP(t.execution.status),children:t.execution.status})})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-gray-600",children:"Schema Version"}),n.jsx("p",{className:"mt-1",children:n.jsxs(Be,{variant:"default",children:[n.jsx(en,{className:"w-3 h-3 mr-1"}),"Clean v",((i=t._meta)==null?void 0:i.schema_version)||"2.0"]})})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-gray-600",children:"Duration"}),n.jsx("p",{className:"mt-1 text-sm",children:t.execution.duration_ms?`${t.execution.duration_ms}ms`:"N/A"})]})]})}),n.jsx(Ct,{value:"execution",children:n.jsx(vh,{data:t.execution,title:"Execution Info"})}),n.jsx(Ct,{value:"data",children:n.jsxs("div",{className:"space-y-4",children:[t.workflow_steps&&n.jsx(vh,{data:t.workflow_steps,title:"Workflow Steps",collapsible:!0}),t.metrics&&n.jsx(vh,{data:t.metrics,title:"Performance Metrics",collapsible:!0}),t.content_generated&&n.jsx(vh,{data:t.content_generated,title:"Content Generated",collapsible:!0})]})}),n.jsx(Ct,{value:"raw",children:n.jsx(vh,{data:e,title:"Complete Clean Log Data"})})]}):n.jsxs("div",{className:"text-center py-8",children:[n.jsx(hn,{className:"w-12 h-12 text-yellow-400 mx-auto mb-4"}),n.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:"Legacy Structure Detected"}),n.jsx("p",{className:"text-gray-500",children:"This log uses the legacy structure and may require parsing. Migrate to clean v2.0 structure for direct object access."}),e.details&&n.jsx("div",{className:"mt-4",children:n.jsx(vh,{data:e.details,title:"Legacy Log Data"})})]})]})}const Xp=["#0088FE","#00C49F","#FFBB28","#FF8042","#8884d8","#82ca9d","#ffc658","#8dd1e1"];function QAt(){const[e,t]=g.useState({from:Fh(new Date,30),to:new Date}),[r,s]=g.useState(null),[a,i]=g.useState([]),[o,l]=g.useState([]),[c,d]=g.useState(!0),[u,h]=g.useState(null);g.useEffect(()=>{const y=async()=>{d(!0),h(null);try{const w=e.from?nn(e.from,"yyyy-MM-dd"):"",j=e.to?nn(Yq(e.to,1),"yyyy-MM-dd"):"",{data:N,error:_}=await de.rpc("get_llm_costs",{start_date:w,end_date:j});if(_)throw console.error("Error from get_llm_costs:",_),new Error(_.message);if(N&&N.length>0){const B=N[0];let L={};if(typeof B.costs_by_model=="string")try{L=JSON.parse(B.costs_by_model)}catch(P){console.warn("Failed to parse costs_by_model as JSON:",P),L={}}else L=B.costs_by_model||{};s({total_cost:Number(B.total_cost)||0,calls_made:Number(B.calls_made)||0,avg_cost_per_call:Number(B.avg_cost_per_call)||0,costs_by_model:L})}else s({total_cost:0,calls_made:0,avg_cost_per_call:0,costs_by_model:{}});const{data:S,error:C}=await de.from("daily_llm_costs").select("*").gte("day",w).lt("day",j).order("day",{ascending:!0});if(C)throw console.error("Error from daily_llm_costs:",C),new Error(C.message);i(S?S.map(B=>({day:B.day,model_name:B.model_name,total_calls:Number(B.total_calls)||0,total_cost:Number(B.total_cost)||0,avg_cost_per_call:Number(B.avg_cost_per_call)||0,total_tokens:Number(B.total_tokens)||0})):[]);const{data:E,error:T}=await de.from("prompt_llm_costs").select("*").gte("day",w).lt("day",j).order("day",{ascending:!0});if(T)throw console.error("Error from prompt_llm_costs:",T),new Error(T.message);l(E?E.map(B=>({day:B.day,prompt_name:B.prompt_name,model_name:B.model_name,total_calls:Number(B.total_calls)||0,total_cost:Number(B.total_cost)||0,avg_cost_per_call:Number(B.avg_cost_per_call)||0,total_tokens:Number(B.total_tokens)||0,min_duration_ms:Number(B.min_duration_ms)||0,avg_duration_ms:Number(B.avg_duration_ms)||0,max_duration_ms:Number(B.max_duration_ms)||0,error_count:Number(B.error_count)||0,error_rate:Number(B.error_rate)||0})):[])}catch(w){console.error("Error fetching LLM data:",w),h(w instanceof Error?w.message:"An unknown error occurred"),s({total_cost:0,calls_made:0,avg_cost_per_call:0,costs_by_model:{}}),i([])}finally{d(!1)}};e.from&&e.to&&y()},[e]);const m=r!=null&&r.costs_by_model?Object.entries(r.costs_by_model).map(([y,w])=>({name:y,value:typeof w.total_cost=="number"?parseFloat(w.total_cost.toFixed(6)):0,calls:typeof w.calls=="number"?w.calls:0,avgCost:typeof w.avg_cost=="number"?parseFloat(w.avg_cost.toFixed(6)):0})):[],f=a.reduce((y,w)=>{const j=nn(new Date(w.day),"MMM dd"),N=y.find(_=>_.day===j);return N?(N.totalCost+=parseFloat((w.total_cost||0).toFixed(6)),N.totalCalls+=w.total_calls||0,N.totalTokens+=w.total_tokens||0):y.push({day:j,totalCost:parseFloat((w.total_cost||0).toFixed(6)),totalCalls:w.total_calls||0,totalTokens:w.total_tokens||0}),y},[]),p=o.reduce((y,w)=>{const j=w.prompt_name||"unknown",N=y.find(_=>_.name===j);return N?(N.value+=parseFloat((w.total_cost||0).toFixed(6)),N.calls+=w.total_calls||0,N.tokens+=w.total_tokens||0,N.avgDuration=(N.avgDuration*N.callCount+(w.avg_duration_ms||0))/(N.callCount+1),N.callCount+=1,N.errorRate=(N.errorRate*N.callCount+(w.error_rate||0))/(N.callCount+1)):y.push({name:j,value:parseFloat((w.total_cost||0).toFixed(6)),calls:w.total_calls||0,tokens:w.total_tokens||0,avgDuration:w.avg_duration_ms||0,errorRate:w.error_rate||0,callCount:1}),y},[]).sort((y,w)=>w.value-y.value),A=o.reduce((y,w)=>{const j=`${w.prompt_name||"unknown"}_${w.model_name||"unknown"}`,N=y.find(_=>_.key===j);return N?(N.totalCost+=parseFloat((w.total_cost||0).toFixed(6)),N.totalCalls+=w.total_calls||0,N.totalTokens+=w.total_tokens||0,N.avgDuration=(N.avgDuration*N.callCount+(w.avg_duration_ms||0))/(N.callCount+1),N.callCount+=1):y.push({key:j,promptName:w.prompt_name||"unknown",modelName:w.model_name||"unknown",totalCost:parseFloat((w.total_cost||0).toFixed(6)),totalCalls:w.total_calls||0,totalTokens:w.total_tokens||0,avgDuration:w.avg_duration_ms||0,avgCostPerCall:parseFloat(((w.total_cost||0)/Math.max(w.total_calls||1,1)).toFixed(6)),callCount:1}),y},[]).sort((y,w)=>w.totalCost-y.totalCost),v=o.reduce((y,w)=>{const j=w.prompt_name||"unknown",N=w.model_name||"unknown",_=y.find(S=>S.name===j);if(_)_[N]?_[N]+=parseFloat((w.total_cost||0).toFixed(6)):_[N]=parseFloat((w.total_cost||0).toFixed(6)),_.totalCost+=parseFloat((w.total_cost||0).toFixed(6));
1912else{const S={name:j,totalCost:parseFloat((w.total_cost||0).toFixed(6)),[N]:parseFloat((w.total_cost||0).toFixed(6))};y.push(S)}return y},[]).sort((y,w)=>w.totalCost-y.totalCost),x=[...new Set(o.map(y=>y.model_name||"unknown"))],b=x.reduce((y,w,j)=>(y[w]=Xp[j%Xp.length],y),{});return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row justify-between gap-4",children:[n.jsx("h2",{className:"text-2xl font-bold",children:"LLM Usage Dashboard"}),n.jsx(HAt,{date:e,setDate:t})]}),u&&n.jsxs(Ar,{variant:"destructive",children:[n.jsx(Wa,{children:"Error"}),n.jsx(gr,{children:u})]}),n.jsxs("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:[n.jsx(hj,{title:"Total Cost",value:c?void 0:`$${((r==null?void 0:r.total_cost)||0).toFixed(4)}`,description:"Total spending on LLM API calls",icon:n.jsx(q_,{className:"h-4 w-4 text-muted-foreground"})}),n.jsx(hj,{title:"API Calls",value:c?void 0:`${((r==null?void 0:r.calls_made)||0).toLocaleString()}`,description:"Number of LLM API calls made",icon:n.jsx(Cc,{className:"h-4 w-4 text-muted-foreground"})}),n.jsx(hj,{title:"Avg. Cost/Call",value:c?void 0:`$${((r==null?void 0:r.avg_cost_per_call)||0).toFixed(6)}`,description:"Average cost per API call",icon:n.jsx(sl,{className:"h-4 w-4 text-muted-foreground"})}),n.jsx(hj,{title:"Date Range",value:c?void 0:`${e.from?nn(e.from,"MMM d"):""} - ${e.to?nn(e.to,"MMM d"):""}`,description:"Current analysis period",icon:n.jsx(Kn,{className:"h-4 w-4 text-muted-foreground"})})]}),n.jsxs(Cs,{defaultValue:"cost",children:[n.jsxs(ps,{className:"grid w-full md:w-auto md:inline-grid grid-cols-5",children:[n.jsx(pt,{value:"cost",children:"Cost Analysis"}),n.jsx(pt,{value:"usage",children:"Usage Trends"}),n.jsx(pt,{value:"models",children:"Model Breakdown"}),n.jsx(pt,{value:"prompts",children:"Prompt Breakdown"}),n.jsx(pt,{value:"prompt-models",children:"Prompt-Model Analysis"})]}),n.jsx(Ct,{value:"cost",className:"space-y-4",children:n.jsxs(Te,{children:[n.jsxs(st,{children:[n.jsx(ot,{children:"Daily Cost Trend"}),n.jsx(Wr,{children:"LLM API costs over time"})]}),n.jsx(Re,{className:"h-[400px]",children:c?n.jsx(Lt,{className:"w-full h-full"}):f.length>0?n.jsx(Sl,{width:"100%",height:"100%",children:n.jsxs(Mte,{data:f,margin:{top:20,right:30,left:20,bottom:5},children:[n.jsx(au,{strokeDasharray:"3 3"}),n.jsx(zo,{dataKey:"day"}),n.jsx(so,{yAxisId:"left",orientation:"left",stroke:"#8884d8"}),n.jsx(so,{yAxisId:"right",orientation:"right",stroke:"#82ca9d"}),n.jsx(Aa,{formatter:y=>[`$${y}`,"Cost"]}),n.jsx(Mi,{}),n.jsx(Vm,{yAxisId:"left",type:"monotone",dataKey:"totalCost",name:"Daily Cost ($)",stroke:"#8884d8",activeDot:{r:8}}),n.jsx(Vm,{yAxisId:"right",type:"monotone",dataKey:"totalCalls",name:"API Calls",stroke:"#82ca9d"})]})}):n.jsx("div",{className:"flex items-center justify-center h-full",children:n.jsx("p",{className:"text-muted-foreground",children:"No data available for the selected period"})})})]})}),n.jsx(Ct,{value:"usage",className:"space-y-4",children:n.jsxs(Te,{children:[n.jsxs(st,{children:[n.jsx(ot,{children:"Token Usage"}),n.jsx(Wr,{children:"Daily token consumption"})]}),n.jsx(Re,{className:"h-[400px]",children:c?n.jsx(Lt,{className:"w-full h-full"}):f.length>0?n.jsx(Sl,{width:"100%",height:"100%",children:n.jsxs(Jx,{data:f,margin:{top:20,right:30,left:20,bottom:5},children:[n.jsx(au,{strokeDasharray:"3 3"}),n.jsx(zo,{dataKey:"day"}),n.jsx(so,{}),n.jsx(Aa,{formatter:y=>[y.toLocaleString(),"Tokens"]}),n.jsx(Mi,{}),n.jsx(vc,{dataKey:"totalTokens",name:"Tokens Used",fill:"#8884d8"})]})}):n.jsx("div",{className:"flex items-center justify-center h-full",children:n.jsx("p",{className:"text-muted-foreground",children:"No data available for the selected period"})})})]})}),n.jsx(Ct,{value:"models",className:"space-y-4",children:n.jsxs(Te,{children:[n.jsxs(st,{children:[n.jsx(ot,{children:"Cost by Model"}),n.jsx(Wr,{children:"Breakdown of costs by LLM model"})]}),n.jsx(Re,{className:"h-[400px]",children:c?n.jsx(Lt,{className:"w-full h-full"}):m.length>0?n.jsxs("div",{className:"grid md:grid-cols-2 gap-4 h-full",children:[n.jsx(Sl,{width:"100%",height:"100%",children:n.jsxs(I3,{children:[n.jsx(Sc,{data:m,cx:"50%",cy:"50%",labelLine:!1,outerRadius:80,fill:"#8884d8",dataKey:"value",label:({name:y,percent:w})=>`${y}: ${(w*100).toFixed(0)}%`,children:m.map((y,w)=>n.jsx(yg,{fill:Xp[w%Xp.length]},`cell-${w}`))}),n.jsx(Aa,{formatter:y=>[`$${y}`,"Cost"]}),n.jsx(Mi,{})]})}),n.jsx(Sl,{width:"100%",height:"100%",children:n.jsxs(Jx,{data:m,layout:"vertical",margin:{top:20,right:30,left:40,bottom:5},children:[n.jsx(au,{strokeDasharray:"3 3"}),n.jsx(zo,{type:"number"}),n.jsx(so,{type:"category",dataKey:"name",width:100}),n.jsx(Aa,{formatter:y=>[`${y}`,"Calls"]}),n.jsx(Mi,{}),n.jsx(vc,{dataKey:"calls",name:"Number of Calls",fill:"#82ca9d"})]})})]}):n.jsx("div",{className:"flex items-center justify-center h-full",children:n.jsx("p",{className:"text-muted-foreground",children:"No data available for the selected period"})})})]})}),n.jsx(Ct,{value:"prompts",className:"space-y-4",children:n.jsxs(Te,{children:[n.jsxs(st,{children:[n.jsx(ot,{children:"Cost by Prompt"}),n.jsx(Wr,{children:"Breakdown of costs by prompt name"})]}),n.jsx(Re,{className:"h-[600px]",children:c?n.jsx(Lt,{className:"w-full h-full"}):p.length>0?n.jsxs("div",{className:"grid md:grid-cols-2 gap-4 h-full",children:[n.jsx(Sl,{width:"100%",height:"100%",children:n.jsxs(I3,{children:[n.jsx(Sc,{data:p.slice(0,8),cx:"50%",cy:"50%",labelLine:!1,outerRadius:80,fill:"#8884d8",dataKey:"value",label:({name:y,percent:w})=>`${y.substring(0,15)}${y.length>15?"...":""}: ${(w*100).toFixed(0)}%`,children:p.slice(0,8).map((y,w)=>n.jsx(yg,{fill:Xp[w%Xp.length]},`cell-${w}`))}),n.jsx(Aa,{formatter:y=>[`$${y}`,"Cost"]}),n.jsx(Mi,{})]})}),n.jsx("div",{className:"overflow-auto h-full",children:n.jsxs("table",{className:"w-full text-sm",children:[n.jsx("thead",{children:n.jsxs("tr",{children:[n.jsx("th",{className:"text-left p-2",children:"Prompt Name"}),n.jsx("th",{className:"text-right p-2",children:"Cost"}),n.jsx("th",{className:"text-right p-2",children:"Calls"}),n.jsx("th",{className:"text-right p-2",children:"Avg. MS"}),n.jsx("th",{className:"text-right p-2",children:"Error %"})]})}),n.jsx("tbody",{children:p.map((y,w)=>n.jsxs("tr",{className:w%2===0?"bg-muted/30":"",children:[n.jsx("td",{className:"p-2 truncate max-w-[160px]",title:y.name,children:y.name}),n.jsxs("td",{className:"text-right p-2",children:["$",y.value.toFixed(4)]}),n.jsx("td",{className:"text-right p-2",children:y.calls.toLocaleStr
1912ing()}),n.jsx("td",{className:"text-right p-2",children:Math.round(y.avgDuration).toLocaleString()}),n.jsxs("td",{className:"text-right p-2",children:[y.errorRate.toFixed(1),"%"]})]},w))})]})})]}):n.jsx("div",{className:"flex items-center justify-center h-full",children:n.jsx("p",{className:"text-muted-foreground",children:"No prompt data available for the selected period"})})})]})}),n.jsxs(Ct,{value:"prompt-models",className:"space-y-4",children:[n.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[n.jsxs(Te,{children:[n.jsxs(st,{children:[n.jsx(ot,{children:"Cost by Prompt and Model"}),n.jsx(Wr,{children:"Stacked view showing which models each prompt uses"})]}),n.jsx(Re,{className:"h-[400px]",children:c?n.jsx(Lt,{className:"w-full h-full"}):v.length>0?n.jsx(Sl,{width:"100%",height:"100%",children:n.jsxs(Jx,{data:v.slice(0,10),margin:{top:20,right:30,left:20,bottom:60},children:[n.jsx(au,{strokeDasharray:"3 3"}),n.jsx(zo,{dataKey:"name",angle:-45,textAnchor:"end",height:80,interval:0,fontSize:10}),n.jsx(so,{}),n.jsx(Aa,{formatter:(y,w)=>[`$${y}`,w],labelFormatter:y=>`Prompt: ${y}`}),n.jsx(Mi,{}),x.map(y=>n.jsx(vc,{dataKey:y,stackId:"cost",name:y,fill:b[y]},y))]})}):n.jsx("div",{className:"flex items-center justify-center h-full",children:n.jsx("p",{className:"text-muted-foreground",children:"No prompt-model data available for the selected period"})})})]}),n.jsxs(Te,{children:[n.jsxs(st,{children:[n.jsx(ot,{children:"Top Prompt-Model Combinations"}),n.jsx(Wr,{children:"Highest cost prompt-model pairs"})]}),n.jsx(Re,{className:"h-[400px]",children:c?n.jsx(Lt,{className:"w-full h-full"}):A.length>0?n.jsx(Sl,{width:"100%",height:"100%",children:n.jsxs(Jx,{data:A.slice(0,10),layout:"vertical",margin:{top:20,right:30,left:120,bottom:5},children:[n.jsx(au,{strokeDasharray:"3 3"}),n.jsx(zo,{type:"number"}),n.jsx(so,{type:"category",dataKey:"key",tickFormatter:y=>{const[w,j]=y.split("_");return`${w.substring(0,15)}${w.length>15?"...":""} (${j})`},width:110,fontSize:10}),n.jsx(Aa,{formatter:y=>[`$${y}`,"Cost"],labelFormatter:y=>{const[w,j]=y.split("_");return`${w} using ${j}`}}),n.jsx(vc,{dataKey:"totalCost",name:"Total Cost",fill:"#8884d8"})]})}):n.jsx("div",{className:"flex items-center justify-center h-full",children:n.jsx("p",{className:"text-muted-foreground",children:"No prompt-model data available for the selected period"})})})]})]}),n.jsxs(Te,{children:[n.jsxs(st,{children:[n.jsx(ot,{children:"Detailed Prompt-Model Analysis"}),n.jsx(Wr,{children:"Complete breakdown of prompt-model cost relationships"})]}),n.jsx(Re,{children:c?n.jsx(Lt,{className:"w-full h-[300px]"}):A.length>0?n.jsx("div",{className:"overflow-auto max-h-[500px]",children:n.jsxs("table",{className:"w-full text-sm",children:[n.jsx("thead",{className:"sticky top-0 bg-background",children:n.jsxs("tr",{className:"border-b",children:[n.jsx("th",{className:"text-left p-3 font-medium",children:"Prompt Name"}),n.jsx("th",{className:"text-left p-3 font-medium",children:"Model Name"}),n.jsx("th",{className:"text-right p-3 font-medium",children:"Total Cost"}),n.jsx("th",{className:"text-right p-3 font-medium",children:"Total Calls"}),n.jsx("th",{className:"text-right p-3 font-medium",children:"Avg. Cost/Call"}),n.jsx("th",{className:"text-right p-3 font-medium",children:"Total Tokens"}),n.jsx("th",{className:"text-right p-3 font-medium",children:"Avg. Duration (ms)"})]})}),n.jsx("tbody",{children:A.map((y,w)=>n.jsxs("tr",{className:w%2===0?"bg-muted/30":"",children:[n.jsx("td",{className:"p-3 truncate max-w-[200px]",title:y.promptName,children:y.promptName}),n.jsx("td",{className:"p-3 font-mono text-xs",children:n.jsx("span",{className:"px-2 py-1 bg-blue-100 text-blue-800 rounded-md",children:y.modelName})}),n.jsxs("td",{className:"text-right p-3 font-medium",children:["$",y.totalCost.toFixed(4)]}),n.jsx("td",{className:"text-right p-3",children:y.totalCalls.toLocaleString()}),n.jsxs("td",{className:"text-right p-3",children:["$",y.avgCostPerCall.toFixed(6)]}),n.jsx("td",{className:"text-right p-3",children:y.totalTokens.toLocaleString()}),n.jsx("td",{className:"text-right p-3",children:Math.round(y.avgDuration).toLocaleStr
1912ing()})]},w))})]})}):n.jsx("div",{className:"flex items-center justify-center h-[200px]",children:n.jsx("p",{className:"text-muted-foreground",children:"No prompt-model data available for the selected period"})})})]}),n.jsxs(Te,{children:[n.jsxs(st,{children:[n.jsx(ot,{children:"Cost Optimization Insights"}),n.jsx(Wr,{children:"Key findings and recommendations"})]}),n.jsx(Re,{children:c?n.jsx(Lt,{className:"w-full h-[100px]"}):A.length>0?n.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[n.jsxs("div",{className:"p-4 border rounded-lg",children:[n.jsx("h4",{className:"font-medium text-sm text-muted-foreground mb-2",children:"Most Expensive Combination"}),A.length>0&&n.jsxs("div",{children:[n.jsx("p",{className:"font-medium",children:A[0].promptName}),n.jsxs("p",{className:"text-sm text-muted-foreground",children:["using ",A[0].modelName]}),n.jsxs("p",{className:"text-lg font-bold text-red-600",children:["$",A[0].totalCost.toFixed(4)]})]})]}),n.jsxs("div",{className:"p-4 border rounded-lg",children:[n.jsx("h4",{className:"font-medium text-sm text-muted-foreground mb-2",children:"Total Combinations"}),n.jsx("p",{className:"text-2xl font-bold",children:A.length}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Unique prompt-model pairs"})]}),n.jsxs("div",{className:"p-4 border rounded-lg",children:[n.jsx("h4",{className:"font-medium text-sm text-muted-foreground mb-2",children:"Models in Use"}),n.jsx("p",{className:"text-2xl font-bold",children:x.length}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Different models across all prompts"})]})]}):n.jsx("div",{className:"flex items-center justify-center h-[100px]",children:n.jsx("p",{className:"text-muted-foreground",children:"No data available for insights"})})})]})]})]})]})}function HAt({date:e,setDate:t,className:r}){return n.jsx("div",{className:ye("grid gap-2",r),children:n.jsxs(Joe,{children:[n.jsx(Xoe,{asChild:!0,children:n.jsxs(te,{id:"date",variant:"outline",className:ye("w-[300px] justify-start text-left font-normal",!e&&"text-muted-foreground"),children:[n.jsx(Kn,{className:"mr-2 h-4 w-4"}),e!=null&&e.from?e.to?n.jsxs(n.Fragment,{children:[nn(e.from,"LLL dd, y")," - ",nn(e.to,"LLL dd, y")]}):nn(e.from,"LLL dd, y"):n.jsx("span",{children:"Pick a date range"})]})}),n.jsx(xL,{className:"w-auto p-0",align:"start",children:n.jsxs("div",{className:"grid grid-cols-2 gap-2 p-4",children:[n.jsxs("div",{children:[n.jsx(te,{variant:"outline",className:"w-full mb-2",onClick:()=>t({from:Fh(new Date,7),to:new Date}),children:"Last 7 days"}),n.jsx(te,{variant:"outline",className:"w-full mb-2",onClick:()=>t({from:Fh(new Date,30),to:new Date}),children:"Last 30 days"}),n.jsx(te,{variant:"outline",className:"w-full",onClick:()=>t({from:Fh(new Date,90),to:new Date}),children:"Last 90 days"})]}),n.jsxs("div",{children:[n.jsx(te,{variant:"outline",className:"w-full mb-2",onClick:()=>{const s=new Date,a=new Date(s.getFullYear(),s.getMonth(),1);t({from:a,to:s})},children:"This Month"}),n.jsx(te,{variant:"outline",className:"w-full mb-2",onClick:()=>{const s=new Date,a=new Date(s.getFullYear(),s.getMonth()-1,1),i=new Date(s.getFullYear(),s.getMonth(),0);t({from:a,to:i})},children:"Last Month"}),n.jsx(te,{variant:"outline",className:"w-full",onClick:()=>{const s=new Date,a=new Date(s.getFullYear(),0,1);t({from:a,to:s})},children:"Year to Date"})]})]})})]})})}function hj({title:e,value:t,description:r,icon:s}){return n.jsxs(Te,{children:[n.jsxs(st,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[n.jsx(ot,{className:"text-sm font-medium",children:e}),s]}),n.jsxs(Re,{children:[t?n.jsx("div",{className:"text-2xl font-bold",children:t}):n.jsx(Lt,{className:"h-8 w-[100px]"}),n.jsx("p",{className:"text-xs text-muted-foreground",children:r})]})]})}const _V=({data:e,level:t=0,onViewLongText:r})=>{const[s,a]=g.useState(new Set),i=c=>{const d=new Set(s);d.has(c)?d.delete(c):d.add(c),a(d)},o=(c,d)=>{if(c===null)return n.jsx("span",{className:"text-orange-600",children:"null"});if(c===void 0)return n.jsx("span",{className:"text-orange-600",children:"undefined"});if(typeof c=="boolean")return n.jsx("span",{className:c?"text-green-600":"text-red-600",children:String(c)});if(typeof c=="number")return n.jsx("span",{className:"text-blue-600",children:c});if(typeof c=="string"){if(c.length>100||c.includes(`
1913`)){const h=c.substring(0,80).replace(/\n/g," ")+"...";return n.jsxs("span",{className:"inline-flex items-center gap-2",children:[n.jsxs("span",{className:"text-green-600",children:['"',h,'"']}
1913),n.jsxs(te,{variant:"ghost",size:"sm",className:"h-6 px-2 text-xs",onClick:()=>r==null?void 0:r(c,d),children:[n.jsx(Mxe,{className:"h-3 w-3 mr-1"}),"View"]})]})}if(c.startsWith("{")&&c.endsWith("}")||c.startsWith("[")&&c.endsWith("]"))try{const h=JSON.parse(c);return n.jsxs("span",{className:"inline-flex items-center gap-2",children:[n.jsxs("span",{className:"text-green-600",children:['"',c.substring(0,30),'..."']}),n.jsxs(te,{variant:"ghost",size:"sm",className:"h-6 px-2 text-xs",onClick:()=>{const m=JSON.stringify(h,null,2);r==null||r(m,d+" (parsed JSON)")},children:[n.jsx(Xr,{className:"h-3 w-3 mr-1"}),"JSON"]})]})}catch{}return n.jsxs("span",{className:"text-green-600",children:['"',c,'"']})}if(Array.isArray(c))return n.jsxs("span",{className:"text-muted-foreground",children:["[",c.length," items]"]});if(typeof c=="object"){const u=Object.keys(c);return n.jsx("span",{className:"text-muted-foreground",children:`{${u.length} properties}`})}return n.jsx("span",{className:"text-muted-foreground",children:String(c)})},l=(c,d="")=>c==null?[]:Array.isArray(c)?c.map((u,h)=>{const m=`${d}[${h}]`,f=typeof u=="object"&&u!==null,p=s.has(m);return n.jsxs("div",{className:"font-mono text-sm",children:[n.jsxs("div",{className:ye("flex items-start py-1 hover:bg-muted/50 rounded px-2 -mx-2",f&&"cursor-pointer"),style:{paddingLeft:`${t*20}px`},onClick:()=>f&&i(m),children:[f&&n.jsx(_s,{className:ye("h-4 w-4 mr-1 mt-0.5 transition-transform flex-shrink-0",p&&"rotate-90")}),!f&&n.jsx("span",{className:"w-5"}),n.jsxs("span",{className:"text-muted-foreground mr-2",children:["[",h,"]:"]}),!f&&o(u,m)]}),f&&p&&n.jsx("div",{children:l(u,m).map((A,v)=>n.jsx("div",{children:A},v))})]},m)}):typeof c=="object"?Object.entries(c).map(([u,h])=>{const m=d?`${d}.${u}`:u,f=typeof h=="object"&&h!==null,p=s.has(m);return n.jsxs("div",{className:"font-mono text-sm",children:[n.jsxs("div",{className:ye("flex items-start py-1 hover:bg-muted/50 rounded px-2 -mx-2",f&&"cursor-pointer"),style:{paddingLeft:`${t*20}px`},onClick:()=>f&&i(m),children:[f&&n.jsx(_s,{className:ye("h-4 w-4 mr-1 mt-0.5 transition-transform flex-shrink-0",p&&"rotate-90")}),!f&&n.jsx("span",{className:"w-5"}),n.jsxs("span",{className:"text-purple-600 mr-2",children:[u,":"]}),o(h,m)]}),f&&p&&n.jsx("div",{children:l(h,m).map((A,v)=>n.jsx("div",{children:A},v))})]},m)}):[];return n.jsx("div",{className:"py-2",children:l(e)})},zAt=({text:e})=>{const t=["text-blue-600","text-green-600","text-purple-600","text-red-600","text-yellow-600","text-cyan-600","text-pink-600","text-indigo-600"],r=["text-red-700 font-bold text-lg","text-orange-600 font-semibold text-base","text-yellow-600 font-medium","text-green-600 font-medium","text-blue-600","text-purple-600"],s=a=>{const i=a.split(`
1914`),o=[];return i.forEach((l,c)=>{const d=[],u=l.match(/^(#{1,6})\s+(.+)$/);if(u){const h=u[1].length,m=u[2],f=r[h-1]||r[5];d.push(n.jsxs("span",{className:f,children:[n.jsx("span",{className:"text-gray-500",children:u[1]})," ",m]},`header-${c}`))}else{let h=0,m=0;const f=/<\/?[^>]+>/g;let p;const A=[];for(;(p=f.exec(l))!==null;){p.index>h&&A.push({text:l.slice(h,p.index),isXml:!1,depth:0});const v=p[0],x=v.startsWith("</"),b=v.endsWith("/>");x&&(m=Math.max(0,m-1)),A.push({text:v,isXml:!0,depth:m}),!x&&!b&&m++,h=p.index+p[0].length}h<l.length&&A.push({text:l.slice(h),isXml:!1,depth:0}),A.forEach((v,x)=>{if(v.isXml){const b=t[v.depth%t.length];d.push(n.jsx("span",{className:`${b} font-semibold`,children:v.text},`xml-${c}-${x}`))}else d.push(n.jsx("span",{children:v.text},`text-${c}-${x}`))})}o.push(n.jsx("div",{className:"leading-relaxed",children:d.length>0?d:n.jsx("span",{children:l})},c))}),o};return n.jsx("div",{className:"text-sm font-mono whitespace-pre-wrap break-words",children:s(e)})},VAt=({open:e,onOpenChange:t,text:r,title:s})=>{const a=i=>{navigator.clipboard.writeText(i).then(()=>{He({title:"Copied to clipboard",description:"Content has been copied to clipboard",duration:2e3})}).catch(o=>
1914{console.error("Failed to copy text: ",o),He({title:"Copy failed",description:"Failed to copy to clipboard",variant:"destructive"})})};return n.jsx(Zt,{open:e,onOpenChange:t,children:n.jsxs(Jt,{className:"max-w-4xl max-h-[90vh] flex flex-col",children:[n.jsxs(_r,{children:[n.jsxs(tr,{className:"flex items-center justify-between pr-10",children:[n.jsx("span",{children:"Text Viewer"}),n.jsx(Be,{variant:"outline",className:"ml-2 font-normal",children:s})]}),n.jsx(Hr,{children:"Viewing formatted text content"})]}),n.jsxs("div",{className:"flex-1 flex flex-col gap-2 min-h-0",children:[n.jsx("div",{className:"flex justify-end",children:n.jsxs(te,{variant:"outline",size:"sm",onClick:()=>a(r),children:[n.jsx(Cn,{className:"h-3 w-3 mr-2"}),"Copy"]})}),n.jsx("div",{className:"border rounded-md bg-muted/50",style:{height:"calc(90vh - 200px)"},children:n.jsx("div",{className:"h-full overflow-y-auto p-4",children:n.jsx(zAt,{text:r})})})]}),n.jsx(Sn,{children:n.jsx(te,{variant:"outline",onClick:()=>t(!1),children:"Close"})})]})})},Zp=e=>{if(e==null)return"null";try{return JSON.stringify(e,null,2)}catch{try{return JSON.stringify(e)}catch{return String(e)}}};function GAt(){const[e,t]=g.useState([]),[r,s]=g.useState(!0),[a,i]=g.useState(1),[o,l]=g.useState(20),[c,d]=g.useState(0),[u,h]=g.useState(null),[m,f]=g.useState("request"),[p,A]=g.useState(""),[v,x]=g.useState(!1),[b,y]=g.useState("tree"),[w,j]=g.useState(null),N=async()=>{try{s(!0);const{count:B,error:L}=await de.from("llm_logs").select("id",{count:"exact",head:!0}).ilike("prompt_name",p?`%${p}%`:"%");if(L)throw L;d(B||0);const{data:P,error:F}=await de.from("llm_logs").select("*").ilike("prompt_name",p?`%${p}%`:"%").order("created_at",{ascending:!1}).range((a-1)*o,a*o-1);if(F)throw F;t(P||[])}catch(B){console.error("Error loading LLM logs:",B),He({title:"Error",description:"Failed to load LLM logs. Please try again.",variant:"destructive"})}finally{s(!1),x(!1)}};g.useEffect(()=>{N()},[a,o,p]);const _=()=>{x(!0),N()},S=B=>{navigator.clipboard.writeText(B).then(()=>{He({title:"Copied to clipboard",description:"Content has been copied to clipboard",duration:2e3})}).catch(L=>{console.error("Failed to copy text: ",L),He({title:"Copy failed",description:"Failed to copy to clipboard",variant:"destructive"})})},C=B=>{if(B==null)return"—";if(B<1e3)return`${B}ms`;const L=B/1e3;if(L<60)return`${L.toFixed(2)}s`;const P=Math.floor(L/60),F=L%60;return`${P}m ${F.toFixed(0)}s`},E=Math.ceil(c/o),T=()=>{const B=[];B.push(n.jsx(_i,{children:n.jsx(bC,{onClick:()=>a>1&&i(a-1),isActive:a>1,className:a===1?"pointer-events-none opacity-50":""})},"prev")),B.push(n.jsx(_i,{children:n.jsx(Dh,{onClick:()=>i(1),isActive:a===1,children:"1"})},"first")),a>3&&B.push(n.jsx(_i,{children:n.jsx(Ab,{})},"ellipsis1"));for(let L=Math.max(2,a-1);L<=Math.min(E-1,a+1);L++)B.push(n.jsx(_i,{children:n.jsx(Dh,{onClick:()=>i(L),isActive:a===L,children:L})},L));return a<E-2&&B.push(n.jsx(_i,{children:n.jsx(Ab,{})},"ellipsis2")),E>1&&B.push(n.jsx(_i,{children:n.jsx(Dh,{onClick:()=>i(E),isActive:a===E,children:E})},"last")),B.push(n.jsx(_i,{children:n.jsx(yC,{onClick:()=>a<E&&i(a+1),isActive:a<E,className:a===E?"pointer-events-none opacity-50":""})},"next")),B};return n.jsxs("div",{className:"space-y-4",children:[n.jsx(ey,{placement:"inline",compact:!0,className:"mb-4"}),n.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-between items-center mb-6",children:[n.jsx("h2",{className:"text-2xl font-bold",children:"LLM Logs"}),n.jsxs("div",{className:"flex w-full sm:w-auto gap-2",children:[n.jsxs("div",{className:"relative flex-1",children:[n.jsx(Ns,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),n.jsx(qe,{placeholder:"Search by prompt name...",className:"pl-9",value:p,onChange:B=>A(B.target.value)})]}),n.jsxs(te,{onClick:_,variant:"outline",className:"flex-shrink-0",children:[n.jsx(Es,{className:`h-4 w-4 mr-2 ${v?"animate-spin":""}`}),"Refresh"]}),n.jsxs(ll,{children:[n.jsx(cl,{asChild:!0,children:n.jsxs(te,{variant:"outline",className:"flex-shrink-0",children:[o," per page ",n.jsx(Un,{className:"ml-2 h-4 w-4"})]})}),n.jsx(fo,{align:"end",children:[10,20,50,100].map(B=>n.jsxs(Fr,{onClick:()=>{l(B),i(1)},children:[B," per page"]},B))})]})]})]}),n.jsxs(Te,{children:[n.jsxs(st,{children:[n.jsx(ot,{children:"LLM API Call Logs"}),n.jsx(Wr,{children:"Recent LLM API calls with detailed request and response data"})]}),n.jsx(Re,{children:r?n.jsx("div",{className:"space-y-2",children:Array.from({length:5}).map((B,L)=>n.jsx(Lt,{className:"w-full h-16"},L))}):e.length>0?n.jsx("div",{className:"rounded-md border",children:n.jsxs(po,{children:[n.jsx(Ao,{children:n.jsxs(Yr,{children:[n.jsx($t,{children:"Timestamp"}),n.jsx($t,{children:"Prompt"}),n.jsx($t,{children:"Model"}),n.jsx($t,{className:"text-right",children:"Tokens"}),n.jsx($t,{className:"text-right",children:"Duration"}),n.jsx($t,{className:"text-right",children:"Cost"}),n.jsx($t,{className:"text-right",children:"Status"}),n.jsx($t,{className:"text-right",children:"Actions"})]})}),n.jsx(go,{children:e.map(B=>n.jsxs(Yr,{children:[n.jsx(mt,{className:"font-mono text-xs",children:n.jsx(Uh,{date:B.created_at,
1914showTimezone:!1,size:"xs",showTooltip:!0,showRelative:!0,relativeMode:"smart",preferRelative:!0,relativeOptions:{shortFormat:!0,absoluteThreshold:1}})}),n.jsx(mt,{children:n.jsxs("div",{className:"flex flex-col",children:[n.jsx("span",{className:"font-medium",children:B.prompt_name||"Unknown Prompt"}),B.brand_id&&n.jsxs("span",{className:"text-xs text-muted-foreground",children:["Brand ID: ",B.brand_id.substring(0,8),"..."]}),B.user_id&&n.jsxs("span",{className:"text-xs text-muted-foreground",children:["User ID: ",B.user_id.substring(0,8),"..."]})]})}),n.jsx(mt,{children:n.jsx(Be,{variant:"outline",children:B.model_name})}),n.jsx(mt,{className:"text-right font-mono",children:B.tokens_used||"—"}),n.jsx(mt,{className:"text-right",children:n.jsxs("div",{className:"flex items-center justify-end gap-1",children:[n.jsx(Vr,{className:"h-3 w-3 text-muted-foreground"}),n.jsx("span",{children:C(B.duration_ms)})]})}),n.jsx(mt,{className:"text-right",children:B.cost?`$${B.cost.toFixed(6)}`:"—"}),n.jsx(mt,{className:"text-right",children:B.error_message?n.jsx(Be,{variant:"destructive",children:"Error"}):n.jsx(Be,{variant:"success",children:"Success"})}),n.jsx(mt,{className:"text-right",children:n.jsxs("div",{className:"flex justify-end",children:[n.jsx(te,{variant:"ghost",size:"sm",onClick:()=>h(B),children:n.jsx(gd,{className:"h-4 w-4"})}),n.jsxs(ll,{children:[n.jsx(cl,{asChild:!0,children:n.jsx(te,{variant:"ghost",size:"sm",children:n.jsx(U0e,{className:"h-4 w-4"})})}),n.jsxs(fo,{align:"end",children:[n.jsxs(Fr,{onClick:()=>{S(Zp(B.request_messages))},children:[n.jsx(Cn,{className:"mr-2 h-4 w-4"}),"Copy Request"]}),n.jsxs(Fr,{onClick:()=>{S(Zp(B.response_body))},children:[n.jsx(Cn,{className:"mr-2 h-4 w-4"}),"Copy Response"]})]})]})]})})]},B.id))})]})}):n.jsxs("div",{className:"flex flex-col items-center justify-center p-8 text-center",children:[n.jsx(zve,{className:"h-10 w-10 text-muted-foreground mb-4"}),n.jsx("h3",{className:"text-lg font-semibold",children:"No LLM Logs Found"}),n.jsx("p",{className:"text-sm text-muted-foreground max-w-md",children:p?`No logs found matching "${p}". Try a different search term or clear the search.`:"No LLM API call logs found. Logs will appear here when API calls are made."})]})}),n.jsxs(uo,{className:"flex justify-between",children:[n.jsx("div",{className:"text-sm text-muted-foreground",children:c>0?n.jsxs(n.Fragment,{children:["Showing ",(a-1)*o+1,"-",Math.min(a*o,c)," of ",c," logs"]}):"No logs found"}),n.jsx(xC,{children:n.jsx(vC,{children:T()})})]})]}),u&&n.jsx(Zt,{open:!!u,onOpenChange:B=>!B&&h(null),children:n.jsxs(Jt,{className:"max-w-6xl max-h-[90vh] overflow-hidden flex flex-col min-h-0",children:[n.jsxs(_r,{children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs(tr,{className:"flex items-center gap-2",children:[n.jsx("span",{children:"LLM Log Details"}),u.error_message&&n.jsx(Be,{variant:"destructive",className:"ml-2",children:"Error"})]}),n.jsx(Be,{variant:"outline",children:u.model_name})]}),n.jsx(Hr,{children:n.jsxs("div",{className:"flex flex-col gap-1 mt-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"font-medium",children:"Prompt:"}),n.jsx("span",{children:u.prompt_name||"Unknown"})]}),u.brand_id&&n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"font-medium",children:"Brand ID:"}),n.jsx("span",{className:"font-mono text-xs",children:u.brand_id})]}),u.user_id&&n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"font-medium",children:"User ID:"}),n.jsx("span",{className:"font-mono text-xs",children:u.user_id})]}),n.jsxs("div",{className:"flex flex-wrap gap-x-4 gap-y-1 text-sm",children:[n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx(Vr,{className:"h-3 w-3"}),n.jsx("span",{children:"Created: "}),n.jsx(Uh,{date:u.created_at,showTimezone:!0,size:"xs",showTooltip:!0,showRelative:!0,relativeMode:"contextual",relativeContext:"detailed",preferRelative:!1})]}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx(xxe,{className:"h-3 w-3"}),n.jsxs("span",{children:["Duration: ",C(u.duration_ms)]})]}),u.tokens_used&&n.jsxs("div",{children:["Tokens: ",u.tokens_used.toLocaleStr
1914ing()]}),u.cost&&n.jsxs("div",{children:["Cost: $",u.cost.toFixed(6)]})]})]})})]}),n.jsxs(Cs,{defaultValue:"request",value:m,onValueChange:B=>f(B),className:"flex-1 flex flex-col min-h-0",children:[n.jsxs("div",{className:"flex items-center justify-between mb-2 flex-shrink-0",children:[n.jsxs(ps,{className:"grid grid-cols-2",children:[n.jsx(pt,{value:"request",children:"Request"}),n.jsx(pt,{value:"response",children:"Response"})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(te,{variant:b==="tree"?"default":"outline",size:"sm",onClick:()=>y("tree"),children:"Tree View"}),n.jsx(te,{variant:b==="raw"?"default":"outline",size:"sm",onClick:()=>y("raw"),children:"Raw JSON"})]})]}),n.jsx(Ct,{value:"request",className:"flex-1 overflow-hidden min-h-0",children:n.jsxs("div",{className:"h-full flex flex-col",children:[u.error_message&&n.jsx("div",{className:"mb-4 p-3 bg-red-50 border border-red-200 rounded-md flex-shrink-0",children:n.jsxs("div",{className:"flex gap-2 items-start",children:[n.jsx(nr,{className:"h-4 w-4 text-red-500 mt-0.5"}),n.jsxs("div",{children:[n.jsx("h4",{className:"font-semibold text-red-700",children:"Error Message"}),n.jsx("p",{className:"text-sm text-red-600",children:u.error_message})]})]})}),n.jsxs("div",{className:"border rounded-md p-4 h-full overflow-hidden flex flex-col min-h-0",children:[n.jsx("div",{className:"flex justify-end mb-2 flex-shrink-0",children:n.jsxs(te,{variant:"outline",size:"sm",onClick:()=>S(Zp(u.request_messages)),children:[n.jsx(Cn,{className:"h-3 w-3 mr-2"}),"Copy"]})}),n.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:n.jsx(ol,{className:"h-full",children:b==="tree"?n.jsx(_V,{data:u.request_messages,onViewLongText:(B,L)=>j({text:B,title:L})}):n.jsx("pre",{className:"text-xs font-mono",children:Zp(u.request_messages)})})})]})]})}),n.jsx(Ct,{value:"response",className:"flex-1 overflow-hidden min-h-0",children:n.jsx("div",{className:"h-full flex flex-col",children:n.jsxs("div",{className:"border rounded-md p-4 h-full overflow-hidden flex flex-col min-h-0",children:[n.jsx("div",{className:"flex justify-end mb-2 flex-shrink-0",children:n.jsxs(te,{variant:"outline",size:"sm",onClick:()=>S(Zp(u.response_body)),children:[n.jsx(Cn,{className:"h-3 w-3 mr-2"}),"Copy"]})}),n.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:n.jsx(ol,{className:"h-full",children:b==="tree"?n.jsx(_V,{data:u.response_body,onViewLongText:(B,L)=>j({text:B,title:L})}):n.jsx("pre",{className:"text-xs font-mono",children:Zp(u.response_body)})})})]})})})]}),n.jsx(Sn,{className:"mt-4",children:n.jsx(te,{onClick:()=>h(null),children:"Close"})})]})}),w&&n.jsx(VAt,{open:!!w,onOpenChange:B=>!B&&j(null),text:w.text,title:w.title})]})}const qAt=sf({title:ys().min(1,"Title is required"),message:ys().min(1,"Message is required"),active:Gq(),priority:Kme().min(1).max(10),target_user_segment:ys(),action_url:ys().refine(e=>{if(!e)return!0;try{return new URL(e),!0}catch{return/^\/|\.\.?\//.test(e)}},"Must be a valid URL or relative path (starting with /, ./, or ../)").optional().or(Wme("")),action_text:ys().optional(),start_date:ys(),end_date:ys().optional()});function KAt(){const[e,t]=g.useState([]),[r,s]=g.useState(!1),[a,i]=g.useState(null),{toast:o}=sn(),{isSuperAdmin:l}=rp(),c=Cd({resolver:up(qAt),defaultValues:{title:"",message:"",active:!0,priority:1,target_user_segment:"all",action_url:"",action_text:"",start_date:new Date().toISOString().split("T")[0],end_date:""}});g.useEffect(()=>{console.log("[MarketingMessages] Component mounted, isSuperAdmin:",l),l&&d()},[l]),g.useEffect(()=>{console.log("[MarketingMessages] Messages state updated:",e.length,"messages")},[e]),g.useEffect(()=>
1914{a&&c.reset({title:a.title,message:a.message,active:a.active,priority:a.priority,target_user_segment:a.target_user_segment,action_url:a.action_url||"",action_text:a.action_text||"",start_date:a.start_date.split("T")[0],end_date:a.end_date?a.end_date.split("T")[0]:""})},[a,c]);const d=async()=>{console.log("[MarketingMessages] Fetching messages...");const{data:p,error:A}=await de.schema("marketing_and_customer_success").from("marketing_messages").select("*").order("priority",{ascending:!1});if(console.log("[MarketingMessages] Fetch result:",{dataLength:p==null?void 0:p.length,data:p,error:A,hasError:!!A}),A){console.error("[MarketingMessages] Error fetching messages:",A),o({title:"Error fetching messages",description:A.message,variant:"destructive"});return}console.log("[MarketingMessages] Setting messages state with",p==null?void 0:p.length,"messages"),t(p)},u=async p=>{console.log("[MarketingMessages] onSubmit called with values:",p);const A={...p,action_url:p.action_url||null,action_text:p.action_text||null,end_date:p.end_date||null};let v,x;
1914if(a){console.log("[MarketingMessages] Updating message:",a.id);const b=await de.schema("marketing_and_customer_success").from("marketing_messages").update(A).eq("id",a.id).select();v=b.error,x=b.data}else{console.log("[MarketingMessages] Inserting new message");const b=await de.schema("marketing_and_customer_success").from("marketing_messages").insert([A]).select();v=b.error,x=b.data}if(console.log("[MarketingMessages] Save result:",{error:v,data:x,hasError:!!v,hasData:!!x}),v){console.error("[MarketingMessages] Error saving message:",v),o({title:"Error saving message",description:v.message,variant:"destructive"});return}o({title:"Success",description:`Marketing message ${a?"updated":"created"} successfully`}),s(!1),i(null),c.reset(),console.log("[MarketingMessages] About to fetch messages after save"),await d(),console.log("[MarketingMessages] Finished fetching messages after save")},h=async p=>{const{error:A}=await de.schema("marketing_and_customer_success").from("marketing_messages").delete().eq("id",p);if(A){o({title:"Error deleting message",description:A.message,variant:"destructive"});return}o({title:"Success",description:"Marketing message deleted successfully"}),d()},m=p=>{i(p),s(!0)},f=()=>{i(null),c.reset(),s(!0)};return l?n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex justify-between items-center",children:[n.jsx("h2",{className:"text-xl font-bold",children:"Marketing Messages"}),n.jsxs(te,{onClick:f,children:[n.jsx(al,{className:"h-4 w-4 mr-2"}),"Add New Message"]})]}),n.jsx(Zt,{open:r,onOpenChange:s,children:n.jsxs(Jt,{className:"sm:max-w-[600px]",children:[n.jsx(_r,{children:n.jsx(tr,{children:a?"Edit Marketing Message":"Create Marketing Message"})}),n.jsx(dk,{...c,children:n.jsxs("form",{onSubmit:c.handleSubmit(u),className:"space-y-4",children:[n.jsx(za,{control:c.control,name:"title",render:({field:p})=>n.jsxs(Ta,{children:[n.jsx(Pa,{children:"Title"}),n.jsx(Ia,{children:n.jsx(qe,{...p})}),n.jsx(ro,{})]})}),n.jsx(za,{control:c.control,name:"message",render:({field:p})=>n.jsxs(Ta,{children:[n.jsx(Pa,{children:"Message"}),n.jsx(Ia,{children:n.jsx(Zr,{...p})}),n.jsx(ro,{})]})}),n.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[n.jsx(za,{control:c.control,name:"active",render:({field:p})=>n.jsxs(Ta,{className:"flex items-center justify-between",children:[n.jsx(Pa,{children:"Active"}),n.jsx(Ia,{children:n.jsx(ns,{checked:p.value,onCheckedChange:p.onChange})})]})}),n.jsx(za,{control:c.control,name:"priority",render:({field:p})=>n.jsxs(Ta,{children:[n.jsx(Pa,{children:"Priority (1-10)"}),n.jsx(Ia,{children:n.jsx(qe,{type:"number",min:"1",max:"10",...p,onChange:A=>p.onChange(parseInt(A.target.value))})}),n.jsx(ro,{})]})})]}),n.jsx(za,{control:c.control,name:"target_user_segment",render:({field:p})=>n.jsxs(Ta,{children:[n.jsx(Pa,{children:"Target User Segment"}),n.jsx(Ia,{children:n.jsx(qe,{...p,placeholder:"e.g., all, premium, free"})}),n.jsx(ro,{})]})}),n.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[n.jsx(za,{control:c.control,name:"start_date",render:({field:p})=>n.jsxs(Ta,{children:[n.jsx(Pa,{children:"Start Date"}),n.jsx(Ia,{children:n.jsx(qe,{type:"date",...p})}),n.jsx(ro,{})]})}),n.jsx(za,{control:c.control,name:"end_date",render:({field:p})=>n.jsxs(Ta,{children:[n.jsx(Pa,{children:"End Date (Optional)"}),n.jsx(Ia,{children:n.jsx(qe,{type:"date",...p})}),n.jsx(ro,{})]})})]}),n.jsx(za,{control:c.control,name:"action_url",render:({field:p})=>n.jsxs(Ta,{children:[n.jsx(Pa,{children:"Action URL (Optional)"}),n.jsx(Ia,{children:n.jsx(qe,{...p,placeholder:"https:// or /relative/path"})}),n.jsx(ro,{})]})}),n.jsx(za,{control:c.control,name:"action_text",render:({field:p})=>n.jsxs(Ta,{children:[n.jsx(Pa,{children:"Action Text (Optional)"}),n.jsx(Ia,{children:n.jsx(qe,{...p,placeholder:"e.g., Learn More"})}),n.jsx(ro,{})]})}),n.jsx(te,{type:"submit",children:a?"Update Message":"Create Message"})]})})]})}),n.jsxs(po,{children:[n.jsx(Ao,{children:n.jsxs(Yr,{children:[n.jsx($t,{children:"Title"}),n.jsx($t,{children:"Message"}),n.jsx($t,{children:"Active"}),n.jsx($t,{children:"Priority"}),n.jsx($t,{children:"Target Segment"}),n.jsx($t,{children:"Start Date"}),n.jsx($t,{children:"End Date"}),n.jsx($t,{children:"Actions"})]})}),n.jsx(go,{children:e.length===0?n.jsx(Yr,{children:n.jsx(mt,{colSpan:8,className:"text-center text-muted-foreground py-8",children:"No marketing messages found. Create your first message to get started."})}):e.map(p=>n.jsxs(Yr,{children:[n.jsx(mt,{children:p.title}),n.jsx(mt,{className:"max-w-xs truncate",children:p.message}),n.jsx(mt,{children:p.active?"Yes":"No"}),n.jsx(mt,{children:p.priority}),n.jsx(mt,{children:p.target_user_segment}),n.jsx(mt,{children:new Date(p.start_date).toLocaleDateString()}),n.jsx(mt,{children:p.end_date?new Date(p.end_date).toLocaleDateString():"-"}),n.jsx(mt,{children:n.jsxs("div",{className:"flex space-x-2",children:[n.jsx(te,{variant:"outline",size:"icon",onClick:()=>m(p),children:n.jsx(cm,{className:"h-4 w-4"})}),n.jsx(te,{variant:"outline",size:"icon",onClick:()=>h(p.id),children:n.jsx(va,{className:"h-4 w-4"})})]})})]}
1914,p.id))})]})]}):n.jsxs(Ar,{variant:"destructive",children:[n.jsx(nr,{className:"h-4 w-4"}),n.jsx(gr,{children:"You must be a superadmin to manage marketing messages."})]})}function WAt(){const[e,t]=g.useState([]),[r,s]=g.useState(!1),{toast:a}=sn(),i=async()=>{s(!0);try{const o=await de.auth.getSession();if(!o.data.session)throw new Error("No session found");const c=await fetch("https://worker.rainfactory.ai/routes",{headers:{Authorization:`Bearer ${o.data.session.access_token}`}});if(!c.ok)throw new Error(`HTTP error! status: ${c.status}`);const d=await c.json();t(d.routes)}catch(o){console.error("Error fetching routes:",o),a({title:"Error fetching routes",description:"There was a problem fetching the routes. Please try again.",variant:"destructive"})}finally{s(!1)}};return g.useEffect(()=>{i()},[]),n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex justify-between items-center",children:[n.jsx("h2",{className:"text-xl font-bold",children:"API Routes"}),n.jsxs(te,{onClick:i,disabled:r,variant:"outline",size:"sm",children:[n.jsx(Es,{className:`h-4 w-4 mr-2 ${r?"animate-spin":""}`}),"Refresh"]})]}),n.jsx("div",{className:"rounded-md border",children:n.jsxs(po,{children:[n.jsx(Ao,{children:n.jsxs(Yr,{children:[n.jsx($t,{className:"w-[100px]",children:"Method"}),n.jsx($t,{children:"Path"}),n.jsx($t,{children:"Pattern"}),n.jsx($t,{className:"w-[200px]",children:"Handler"})]})}),n.jsx(go,{children:e.map((o,l)=>n.jsxs(Yr,{children:[n.jsx(mt,{className:"font-mono",children:n.jsx("span",{className:`
1915                                        px-2 py-1 rounded text-xs
1916                                        ${o.method==="GET"?"bg-blue-100 text-blue-800":""}
1917                                        ${o.method==="POST"?"bg-green-100 text-green-800":""}
1918                                        ${o.method==="PUT"?"bg-yellow-100 text-yellow-800":""}
1919                                        ${o.method==="DELETE"?"bg-red-100 text-red-800":""}
1920                                        ${o.method==="ALL"?"bg-gray-100 text-gray-800":""}
1921                                    `,children:o.method})}),n.jsx(mt,{className:"font-mono text-sm",children:o.path}),n.jsx(mt,{className:"font-mono text-sm text-muted-foreground",children:o.pattern}),n.jsx(mt,{className:"text-sm",children:n.jsx("span",{className:`
1922                                        px-2 py-1 rounded
1923                                        ${o.destination.includes("Worker")?"bg-purple-100 text-purple-800":""}
1924                                        ${o.destination.includes("Middleware")?"bg-orange-100 text-orange-800":""}
1925                                        ${o.destination==="UnknownHandler"?"bg-red-100 text-red-800":""}
1926                                        ${!o.destination.includes("Worker")&&!o.destination.includes("Middleware")&&o.destination!=="UnknownHandler"?"bg-blue-100 text-blue-800":""}
1927                                    `,children:o.destination})})]},`${o.method}-${o.path}-${l}`))})]})})]})}function YAt(){const[e,t]=g.useState([]),[r,s]=g.useState([]),[a,i]=g.useState(!0),[o,l]=g.useState("all"),[c,d]=g.useState("all"),{toast:u}=sn(),[h,m]=g.useState({name:"",channel:"email",enabled:!0,severity_threshold:"high",config:{}});g.useEffect(()=>{f(),p()},[o,c]);const f=async()=>{i(!0);try{let y=de.from("error_logs").select("*").order("created_at",{ascending:!1}).limit(100);o!=="all"&&(y=y.eq("severity",o)),c!=="all"&&(y=y.eq("category",c));const{data:w,error:j}=await y;if(j)throw j;t(w||[])}catch(y){console.error("Error fetching error logs:",y),u({title:"Error",description:"Failed to fetch error logs",variant:"destructive"})}finally{i(!1)}},p=async()=>{try{const{data:y,error:w}=await de.from("alert_configurations").select("*").order("created_at",{ascending:!1});if(w)throw w;s(y||[])}catch(y){console.error("Error fetching alert configurations:",y),u({title:"Error",description:"Failed to fetch alert configurations",variant:"destructive"})}},A=async()=>{try{let y={};switch(h.channel){case"email":y={to:[h.config.to],from:h.config.from||"[email protected]"};break;case"slack":case"discord":y={webhook_url:h.config.webhook_url};break;case"webhook":y={url:h.config.url,headers:h.config.headers||{}};break}const{error:w}=await de.from("alert_configurations").insert({name:h.name,channel:h.channel,enabled:h.enabled,severity_threshold:h.severity_threshold,config:y,categories:[]});if(w)throw w;u({title:"Success",description:"Alert configuration created successfully"}),m({name:"",channel:"email",enabled:!0,severity_threshold:"high",config:{}}),p()}catch(y){console.error("Error creating alert configuration:",y),u({title:"Error",description:"Failed to create alert configuration",variant:"destructive"})}},v=async y=>{try{const{error:w}=await de.from("alert_configurations").delete().eq("id",y);if(w)throw w;u({title:"Success",description:"Alert configuration deleted successfully"}),p()}catch(w){console.error("Error deleting alert configuration:",w),u({title:"Error",description:"Failed to delete alert configuration",variant:"destructive"})}},x=y=>{switch(y){case"critical":return"destructive";case"high":return"destructive";case"medium":return"default";case"low":return"secondary";default:return"outline"}},b=y=>{switch(y){case"authentication":case"authorization":return"destructive";case"external_api":case"network":return"default";default:return"secondary"}};return n.jsxs(Cs,{defaultValue:"logs",className:"w-full",children:[n.jsxs(ps,{className:"grid w-full grid-cols-2",children:[n.jsx(pt,{value:"logs",children:"Error Logs"}),n.jsx(pt,{value:"alerts",children:"Alert Configurations"})]}),n.jsx(Ct,{value:"logs",children:n.jsxs(Te,{children:[n.jsxs(st,{children:[n.jsx(ot,{children:"Error Logs"}),n.jsx(Wr,{children:"View and filter system error logs"})]}),n.jsxs(Re,{children:[n.jsxs("div",{className:"flex gap-4 mb-4",children:[n.jsxs(ur,{value:o,onValueChange:l,children:[n.jsx(or,{className:"w-[180px]",children:n.jsx(hr,{placeholder:"Filter by severity"})}),n.jsxs(lr,{children:[n.jsx(Fe,{value:"all",children:"All Severities"}),n.jsx(Fe,{value:"critical",children:"Critical"}),n.jsx(Fe,{value:"high",children:"High"}),n.jsx(Fe,{value:"medium",children:"Medium"}),n.jsx(Fe,{value:"low",children:"Low"})]})]}),n.jsxs(ur,{value:c,onValueChange:d,children:[n.jsx(or,{className:"w-[180px]",children:n.jsx(hr,{placeholder:"Filter by category"})}),n.jsxs(lr,{children:[n.jsx(Fe,{value:"all",children:"All Categories"}),n.jsx(Fe,{value:"authentication",children:"Authentication"}),n.jsx(Fe,{value:"authorization",children:"Authorization"}),n.jsx(Fe,{value:"validation",children:"Validation"}
1927),n.jsx(Fe,{value:"external_api",children:"External API"}),n.jsx(Fe,{value:"database",children:"Database"}),n.jsx(Fe,{value:"business_logic",children:"Business Logic"}),n.jsx(Fe,{value:"system",children:"System"}),n.jsx(Fe,{value:"network",children:"Network"})]})]})]}),a?n.jsx("div",{className:"text-center py-4",children:"Loading..."}):n.jsx("div",{className:"overflow-x-auto",children:n.jsxs(po,{children:[n.jsx(Ao,{children:n.jsxs(Yr,{children:[n.jsx($t,{children:"Time"}),n.jsx($t,{children:"Severity"}),n.jsx($t,{children:"Category"}),n.jsx($t,{children:"Error"}),n.jsx($t,{children:"Worker"}),n.jsx($t,{children:"Alert Sent"})]})}),n.jsx(go,{children:e.map(y=>n.jsxs(Yr,{children:[n.jsx(mt,{className:"text-sm",children:new Date(y.created_at).toLocaleString()}),n.jsx(mt,{children:n.jsx(Be,{variant:x(y.severity),children:y.severity||"unknown"})}),n.jsx(mt,{children:n.jsx(Be,{variant:b(y.category),children:y.category||"unknown"})}),n.jsx(mt,{className:"max-w-md",children:n.jsx("div",{className:"truncate",title:y.error_message,children:y.error_message})}),n.jsx(mt,{children:y.worker_name||"N/A"}),n.jsx(mt,{children:y.alert_sent?n.jsxs(Be,{variant:"outline",children:[n.jsx(nr,{className:"h-3 w-3 mr-1"}),"Sent"]}):"-"})]},y.id))})]})})]})]})}),n.jsx(Ct,{value:"alerts",children:n.jsxs(Te,{children:[n.jsxs(st,{children:[n.jsx(ot,{children:"Alert Configurations"}),n.jsx(Wr,{children:"Configure how and when alerts are sent"})]}),n.jsx(Re,{children:n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"border rounded-lg p-4",children:[n.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Create New Alert Configuration"}),n.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[n.jsxs("div",{children:[n.jsx(ze,{htmlFor:"name",children:"Configuration Name"}),n.jsx(qe,{id:"name",value:h.name,onChange:y=>m({...h,name:y.target.value}),placeholder:"e.g., Critical Errors to Slack"})]}),n.jsxs("div",{children:[n.jsx(ze,{htmlFor:"channel",children:"Alert Channel"}),n.jsxs(ur,{value:h.channel,onValueChange:y=>m({...h,channel:y}),children:[n.jsx(or,{children:n.jsx(hr,{})}),n.jsxs(lr,{children:[n.jsx(Fe,{value:"email",children:"Email"}),n.jsx(Fe,{value:"slack",children:"Slack"}),n.jsx(Fe,{value:"discord",children:"Discord"}),n.jsx(Fe,{value:"webhook",children:"Webhook"})]})]})]}),n.jsxs("div",{children:[n.jsx(ze,{htmlFor:"severity",children:"Minimum Severity"}),n.jsxs(ur,{value:h.severity_threshold,onValueChange:y=>m({...h,severity_threshold:y}),children:[n.jsx(or,{children:n.jsx(hr,{})}),n.jsxs(lr,{children:[n.jsx(Fe,{value:"low",children:"Low"}),n.jsx(Fe,{value:"medium",children:"Medium"}),n.jsx(Fe,{value:"high",children:"High"}),n.jsx(Fe,{value:"critical",children:"Critical"})]})]})]}),h.channel==="email"&&n.jsxs("div",{children:[n.jsx(ze,{htmlFor:"email",children:"Email Address"}),n.jsx(qe,{id:"email",type:"email",value:h.config.to||"",onChange:y=>m({...h,config:{...h.config,to:y.target.value}}),placeholder:"[email protected]"})]}),(h.channel==="slack"||h.channel==="discord")&&n.jsxs("div",{children:[n.jsx(ze,{htmlFor:"webhook",children:"Webhook URL"}),n.jsx(qe,{id:"webhook",value:h.config.webhook_url||"",onChange:y=>m({...h,config:{...h.config,webhook_url:y.target.value}}),placeholder:"https://hooks.slack.com/..."})]}),h.channel==="webhook"&&n.jsxs("div",{children:[n.jsx(ze,{htmlFor:"url",children:"Webhook URL"}),n.jsx(qe,{id:"url",value:h.config.url||"",onChange:y=>m({...h,config:{...h.config,url:y.target.value}}),placeholder:"https://example.com/webhook"})]})]}),n.jsxs(te,{onClick:A,className:"mt-4",disabled:!h.name,children:[n.jsx(al,{className:"h-4 w-4 mr-2"}),"Create Configuration"]})]}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Existing Configurations"}),n.jsx("div",{className:"space-y-4",children:r.map(y=>n.jsx(Ar,{children:n.jsxs(gr,{className:"flex justify-between items-center",children:[n.jsxs("div",{children:[n.jsx("strong",{children:y.name}),n.jsxs("span",{className:"ml-4",children:["Channel: ",n.jsx(Be,{variant:"outline",children:y.channel})]}),n.jsxs("span",{className:"ml-4",children:["Threshold: ",n.jsx(Be,{variant:x(y.severity_threshold),children:y.severity_threshold})]}),n.jsxs("span",{className:"ml-4",children:["Status: ",n.jsx(Be,{variant:y.enabled?"default":"secondary",children:y.enabled?"Enabled":"Disabled"})]})]}),n.jsx(te,{variant:"destructive",size:"sm",onClick:()=>v(y.id),children:n.jsx(va,{className:"h-4 w-4"})})]})},y.id))})]})]})})]})})]})}function JAt(){var he,ee,xe;const[e,t]=g.useState([]),[r,s]=g.useState(!0),[a,i]=g.useState(""),[o,l]=g.useState(null),[c,d]=g.useState(null),[u,h]=g.useState([]),[m,f]=g.useState(!1),[p,A]=g.useState("add"),[v,x]=g.useState(""),[b,y]=g.useState(""),[w,j]=g.useState(!1),[N,_]=g.useState(!1),[S,C]=g.useState(""),[E,T]=g.useState(!1),[B,L]=g.useState(!1),[P,F]=g.useState(null),[M,I]=g.useState(null),[$,V]=g.useState([]),[R,Q]=g.useState(!1),{toast:U}=sn(),{isSuperAdmin:D}=rp(),q=async()=>{try{s(!0);const{data:we,error:Se}=await de.schema("basejump").from("accounts").select("*").order("created_at",{ascending:!1});if(Se)throw Se;const pe=await Promise.all((we||[]).map(async Ce=>{const{data:re}=await de.schema("basejump").from("account_user").select("*").eq("account_id",Ce.id),{data:se}=await de.schema("basejump").from("billing_customers").select("*").eq("account_id",Ce.id);return{...Ce,account_users:re||[],billing_customers:se||[],user_count:(re==null?void 0:re.length)||0}}));t(pe)}catch(we){console.error("Error fetching accounts:",we),U({title:"Error fetching accounts",description:"Could not load the accounts list. Please try again.",variant:"destructive"})}finally{s(!1)}};g.useEffect(()=>{D&&q()},[D]);const G=async we=>{try{const{data:{session:Se}}=await de.auth.getSession();if(!Se)return;const pe=await fetch(`https://worker.rainfactory.ai/admin/credits/balance/${we}`,{headers:{Authorization:`Bearer ${Se.access_token}`}});if(!pe.ok)throw new Error("Failed to fetch credit balance");const Ce=await pe.json();d(Ce)}catch(Se){console.error("Error fetching credit balance:",Se),U({title:"Error fetching credit balance",description:"Could not load the credit balance.",variant:"destructive"})}},Y=async we=>{try{const{data:{session:Se}}=await de.auth.getSession();if(!Se)return;const pe=await fetch(`https://worker.rainfactory.ai/admin/credits/transactions/${we}`,{headers:{Authorization:`Bearer ${Se.access_token}`}});if(!pe.ok)throw new Error("Failed to fetch credit transactions");const Ce=await pe.json();h(Ce.transactions||[])}catch(Se){console.error("Error fetching credit transactions:",Se),U({title:"Error fetching transactions",description:"Could not load the transaction history.",variant:"destructive"})}},K=async we=>{try{Q(!0);const{data:Se,error:pe}=await de.from("brands").select("*").eq("account_id",we).order("created_at",{ascending:!1});if(pe)throw pe;V(Se||[])}catch(Se){console.error("Error fetching brands:",Se),U({title:"Error fetching brands",description:"Could not load the brands list.",variant:"destructive"})}finally{Q(!1)}},X=async()=>
1927{if(!o||!v||!b){U({title:"Missing information",description:"Please provide amount and reason.",variant:"destructive"});return}j(!0);try{const{data:{session:we}}=await de.auth.getSession();if(!we)return;const pe=await fetch(`https://worker.rainfactory.ai/admin/credits/${p==="add"?"add":"deduct"}`,{method:"POST",headers:{Authorization:`Bearer ${we.access_token}`,"Content-Type":"application/json"},body:JSON.stringify({accountId:o.id,amount:parseInt(v),reason:b})}),Ce=await pe.json();if(!pe.ok)throw new Error(Ce.error||"Failed to update credits");U({title:"Credits updated",description:Ce.message||"Credits updated successfully"}),Ce.newBalance&&d(Ce.newBalance),f(!1),x(""),y(""),Y(o.id)}catch(we){console.error("Error updating credits:",we),U({title:"Error updating credits",description:we instanceof Error?we.message:"Failed to update credits",variant:"destructive"})}finally{j(!1)}},ne=e.filter(we=>{var Se,pe;return((Se=we.name)==null?void 0:Se.toLowerCase().includes(a.toLowerCase()))||((pe=we.slug)==null?void 0:pe.toLowerCase().includes(a.toLowerCase()))||we.id.toLowerCase().includes(a.toLowerCase())}),ae=async we=>{l(we),G(we.id),Y(we.id),K(we.id)},J=async we=>{var Se;try{const{count:pe}=await de.from("brands").select("*",{count:"exact",head:!0}).eq("account_id",we.id),{data:Ce}=await de.from("brands").select("id").eq("account_id",we.id);let re=0,se=0;if(Ce&&Ce.length>0){const Oe=Ce.map(Ee=>Ee.id),{count:be}=await de.from("campaigns").select("*",{count:"exact",head:!0}).in("brand_id",Oe);re=be||0;const{count:ue}=await de.from("contents").select("*",{count:"exact",head:!0}).in("brand_id",Oe);se=ue||0}const{data:Ae}=await de.schema("basejump").rpc("get_credit_balance",{p_account_id:we.id}),Pe=Ae&&((Se=Ae[0])==null?void 0:Se.total_credits)||0;I({brands:pe||0,campaigns:re,contents:se,credits:Pe})}catch(pe){console.error("Error fetching deletion stats:",pe)}},W=async we=>{F(we),C(""),T(!1),I(null),_(!0),await J(we)},ie=async()=>{if(!P||!E)return;const we=P.name||P.slug||"";if(S.toLowerCase()!==we.toLowerCase()){U({title:"Confirmation name doesn't match",description:"Please type the exact account name to confirm deletion.",variant:"destructive"});return}L(!0);try{const{data:{session:Se}}=await de.auth.getSession();if(!Se)throw new Error("No session found");const pe=await fetch("https://worker.rainfactory.ai/admin/accounts/delete",{method:"DELETE",headers:{Authorization:`Bearer ${Se.access_token}`,"Content-Type":"application/json"},body:JSON.stringify({accountId:P.id,confirmationName:S})}),Ce=await pe.json();if(!pe.ok)throw new Error(Ce.error||"Failed to delete account");U({title:"Account deleted successfully",description:Ce.message||"The account and all associated data have been permanently deleted."}),_(!1),l(null),F(null),q()}catch(Se){console.error("Error deleting account:",Se),U({title:"Failed to delete account",description:Se instanceof Error?Se.message:"An error occurred while deleting the account.",variant:"destructive"})}finally{L(!1)}};return D?n.jsxs("div",{children:[n.jsx("h2",{className:"text-xl font-bold mb-4",children:"Accounts Management"}),n.jsxs("div",{className:"flex gap-4 mb-6",children:[n.jsx("div",{className:"flex-1",children:n.jsxs("div",{className:"relative",children:[n.jsx(Ns,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),n.jsx(qe,{placeholder:"Search by name, slug, or ID...",value:a,onChange:we=>i(we.target.value),className:"pl-9"})]})}),n.jsxs(te,{onClick:q,disabled:r,variant:"outline",children:[n.jsx(Es,{className:`h-4 w-4 mr-2 ${r?"animate-spin":""}`}),"Refresh"]})]}),n.jsx("div",{className:"rounded-md border",children:n.jsxs(po,{children:[n.jsx(Ao,{children:n.jsxs(Yr,{children:[n.jsx($t,{children:"Account"}),n.jsx($t,{children:"Type"}),n.jsx($t,{children:"Users"}),n.jsx($t,{children:"Plan"}),n.jsx($t,{children:"Status"}),n.jsx($t,{children:"Created"}),n.jsx($t,{children:"Actions"})]})}),n.jsx(go,{children:r?n.jsx(Yr,{children:n.jsx(mt,{colSpan:7,className:"text-center",children:"Loading accounts..."})}):ne.length===0?n.jsx(Yr,{children:n.jsx(mt,{colSpan:7,className:"text-center",children:"No accounts found"})}):ne.map(we=>{var Se,pe,Ce,re,se,Ae,Pe,Oe;return n.jsxs(Yr,{children:[n.jsx(mt,{children:n.jsxs("div",{className:"flex items-center gap-2",children:[we.personal_account?n.jsx(li,{className:"h-4 w-4 text-muted-foreground"}):n.jsx(zh,{className:"h-4 w-4 text-muted-foreground"}),n.jsxs("div",{children:[n.jsx("div",{className:"font-medium",children:we.name||"Unnamed"}),n.jsx("div",{className:"text-sm text-muted-foreground",children:we.slug||we.id})]})]})}),n.jsx(mt,{children:we.personal_account?"Personal":"Team"}),n.jsx(mt,{children:n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx(Ka,{className:"h-4 w-4 text-muted-foreground"}),we.user_count]})}),n.jsx(mt,{children:((pe=(Se=we.billing_customers)==null?void 0:Se[0])==null?void 0:pe.plan_id)||"-"}),n.jsx(mt,{children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("div",{className:`h-2 w-2 rounded-full ${((re=(Ce=we.billing_customers)==null?void 0:Ce[0])==null?void 0:re.billing_status)==="active"||((Ae=(se=we.billing_customers)==null?void 0:se[0])==null?void 0:Ae.billing_status)==="trialing"?"bg-green-500":"bg-gray-300"}`}
1927),((Oe=(Pe=we.billing_customers)==null?void 0:Pe[0])==null?void 0:Oe.billing_status)||"No billing"]})}),n.jsx(mt,{children:we.created_at?nn(new Date(we.created_at),"MMM d, yyyy"):"-"}),n.jsx(mt,{children:n.jsx(te,{size:"sm",variant:"outline",onClick:()=>ae(we),children:"View Details"})})]},we.id)})})]})}),n.jsx(Zt,{open:!!o,onOpenChange:()=>{l(null),d(null),h([]),V([])},children:n.jsxs(Jt,{className:"max-w-4xl max-h-[90vh] overflow-hidden flex flex-col",children:[n.jsxs(_r,{className:"flex flex-row items-center justify-between",children:[n.jsx(tr,{children:"Account Details"}),o&&n.jsxs(te,{variant:"destructive",size:"sm",onClick:()=>W(o),className:"ml-auto",children:[n.jsx(va,{className:"h-4 w-4 mr-2"}),"Delete Account"]})]}),o&&n.jsxs(Cs,{defaultValue:"details",className:"flex-1 overflow-hidden flex flex-col",children:[n.jsxs(ps,{className:"grid w-full grid-cols-4",children:[n.jsx(pt,{value:"details",children:"Account Details"}),n.jsxs(pt,{value:"brands",className:"flex items-center gap-2",children:[n.jsx(jB,{className:"h-4 w-4"}),"Brands"]}),n.jsxs(pt,{value:"credits",className:"flex items-center gap-2",children:[n.jsx(S0e,{className:"h-4 w-4"}),"Credits"]}),n.jsxs(pt,{value:"transactions",className:"flex items-center gap-2",children:[n.jsx(ag,{className:"h-4 w-4"}),"Transactions"]})]}),n.jsxs(Ct,{value:"details",className:"mt-4 space-y-4 overflow-y-auto",children:[n.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[n.jsxs("div",{children:[n.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Account ID"}),n.jsx("p",{className:"font-mono text-sm",children:o.id})]}),n.jsxs("div",{children:[n.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Name"}),n.jsx("p",{children:o.name||"Unnamed"})]}),n.jsxs("div",{children:[n.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Slug"}),n.jsx("p",{children:o.slug||"-"})]}),n.jsxs("div",{children:[n.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Type"}),n.jsx("p",{children:o.personal_account?"Personal":"Team"})]}),n.jsxs("div",{children:[n.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Created"}),n.jsx("p",{children:o.created_at?nn(new Date(o.created_at),"MMM d, yyyy h:mm a"):"-"})]}),n.jsxs("div",{children:[n.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Updated"}),n.jsx("p",{children:o.updated_at?nn(new Date(o.updated_at),"MMM d, yyyy h:mm a"):"-"})]})]}),((he=o.billing_customers)==null?void 0:he[0])&&n.jsxs("div",{className:"border-t pt-4",children:[n.jsx("h4",{className:"font-medium mb-2",children:"Billing Information"}),n.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[n.jsxs("div",{children:[n.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Status"}),n.jsx("p",{children:o.billing_customers[0].billing_status||"-"})]}),n.jsxs("div",{children:[n.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Plan"}),n.jsx("p",{children:o.billing_customers[0].plan_id||"-"})]}),n.jsxs("div",{children:[n.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Subscription ID"}),n.jsx("p",{className:"font-mono text-sm",children:o.billing_customers[0].billing_subscription_id||"-"})]}),n.jsxs("div",{children:[n.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Period End"}),n.jsx("p",{children:o.billing_customers[0].billing_period_end?nn(new Date(o.billing_customers[0].billing_period_end),"MMM d, yyyy"):"-"})]})]})]}),n.jsxs("div",{className:"border-t pt-4",children:[n.jsxs("h4",{className:"font-medium mb-2",children:["Users (",((ee=o.account_users)==null?void 0:ee.length)||0,")"]}),n.jsx("div",{className:"space-y-2",children:(xe=o.account_users)==null?void 0:xe.map(we=>n.jsxs("div",{className:"flex justify-between items-center p-2 bg-muted/50 rounded",children:[n.jsx("span",{className:"font-mono text-sm",children:we.user_id}),n.jsx("span",{className:"text-sm font-medium",children:we.account_role})]},we.user_id))})]})]}),n.jsx(Ct,{value:"brands",className:"mt-4 space-y-4 overflow-y-auto",children:n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("h4",{className:"font-medium",children:["Brands (",$.length,")"]}),n.jsxs(te,{onClick:()=>o&&K(o.id),disabled:R,variant:"outline",size:"sm",children:[n.jsx(Es,{className:`h-4 w-4 mr-2 ${R?"animate-spin":""}`}),"Refresh"]})]}),R?n.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Loading brands..."}):$.length===0?n.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No brands found for this account"}):n.jsx("div",{className:"rounded-md border",children:n.jsxs(po,{children:[n.jsx(Ao,{children:n.jsxs(Yr,{children:[n.jsx($t,{children:"Brand Name"}),n.jsx($t,{children:"Status"}),n.jsx($t,{children:"Niche"}),n.jsx($t,{children:"B2B/B2C"}),n.jsx($t,{children:"Created"}),n.jsx($t,{children:"Onboarding"})]})}),n.jsx(go,{children:$.map(we=>n.jsxs(Yr,{children:[n.jsx(mt,{children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(jB,{className:"h-4 w-4 text-muted-foreground"}),n.jsxs("div",{children:[n.jsx("div",{className:"font-medium",children:we.brand_name}),n.jsx("div",{className:"text-sm text-muted-foreground font-mono",children:we.id})]})]})}),n.jsx(mt,{children:n.jsx(Be,{variant:we.status==="ACTIVE"?"default":"secondary",children:we.status})}),n.jsx(mt,{children:n.jsx("div",{className:"max-w-[200px] truncate",children:we.niche||"-"})}),n.jsx(mt,{children:n.jsx(Be,{variant:"outline",children:we.b2b_b2c})}),n.jsx(mt,{children:we.created_at?nn(new Date(we.created_at),"MMM d, yyyy"):"-"}),n.jsx(mt,{children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("div",{className:`h-2 w-2 rounded-full ${we.onboarding_completed?"bg-green-500":"bg-yellow-500"}`}),n.jsx("span",{className:"text-sm",children:we.onboarding_completed?"Complete":`Step ${we.onboarding_step||0}`})]})})]},we.id))})]})})]})}),n.jsx(Ct,{value:"credits",className:"mt-4 space-y-4",children:c?n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[n.jsxs(Te,{children:[n.jsx(st,{className:"pb-3",children:n.jsx(ot,{className:"text-sm font-medium",children:"Plan Credits"})}),n.jsx(Re,{children:n.jsx("p",{className:"text-2xl font-bold",children:(c.plan_credits??0).toLocaleStr
1927ing()})})]}),n.jsxs(Te,{children:[n.jsx(st,{className:"pb-3",children:n.jsx(ot,{className:"text-sm font-medium",children:"Purchased Credits"})}),n.jsx(Re,{children:n.jsx("p",{className:"text-2xl font-bold",children:(c.purchased_credits??0).toLocaleString()})})]}),n.jsxs(Te,{children:[n.jsx(st,{className:"pb-3",children:n.jsx(ot,{className:"text-sm font-medium",children:"Total Credits"})}),n.jsx(Re,{children:n.jsx("p",{className:"text-2xl font-bold text-primary",children:(c.total_credits??0).toLocaleString()})})]})]}),n.jsxs("div",{className:"flex gap-2",children:[n.jsxs(te,{onClick:()=>{A("add"),f(!0)},variant:"outline",className:"flex items-center gap-2",children:[n.jsx(al,{className:"h-4 w-4"}),"Add Credits"]}),n.jsxs(te,{onClick:()=>{A("deduct"),f(!0)},variant:"outline",className:"flex items-center gap-2",children:[n.jsx(yB,{className:"h-4 w-4"}),"Deduct Credits"]})]})]}):n.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Loading credit balance..."})}),n.jsx(Ct,{value:"transactions",className:"mt-4 overflow-y-auto",children:n.jsx("div",{className:"space-y-2",children:u.length>0?u.map(we=>{var Se;return n.jsxs("div",{className:"border rounded-lg p-4 space-y-2",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[we.amount>0?n.jsx(al,{className:"h-4 w-4 text-green-600"}):n.jsx(yB,{className:"h-4 w-4 text-red-600"}),n.jsxs("span",{className:`font-semibold ${we.amount>0?"text-green-600":"text-red-600"}`,children:[we.amount>0?"+":"",we.amount.toLocaleString()," credits"]})]}),n.jsx(Be,{variant:"outline",children:we.type})]}),n.jsx("p",{className:"text-sm",children:we.description}),n.jsxs("div",{className:"flex items-center justify-between text-sm text-muted-foreground",children:[n.jsxs("span",{children:["Balance after: ",we.balance_after.toLocaleString()]}),n.jsx("span",{children:nn(new Date(we.created_at),"MMM d, yyyy h:mm a")})]}),((Se=we.metadata)==null?void 0:Se.adjusted_by_email)&&n.jsxs("p",{className:"text-xs text-muted-foreground",children:["Adjusted by: ",we.metadata.adjusted_by_email]})]},we.id)}):n.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No transactions found"})})})]})]})}),n.jsx(Zt,{open:m,onOpenChange:f,children:n.jsxs(Jt,{children:[n.jsxs(_r,{children:[n.jsx(tr,{children:p==="add"?"Add Credits":"Deduct Credits"}),n.jsx(Hr,{children:p==="add"?"Add credits to this account. These will be added as purchased credits.":"Deduct credits from this account. Credits will be deducted from plan credits first."})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx(ze,{htmlFor:"amount",children:"Amount"}),n.jsx(qe,{id:"amount",type:"number",placeholder:"Enter amount",value:v,onChange:we=>x(we.target.value),min:"1"})]}),n.jsxs("div",{children:[n.jsx(ze,{htmlFor:"reason",children:"Reason"}),n.jsx(Zr,{id:"reason",placeholder:"Enter reason for this adjustment",value:b,onChange:we=>y(we.target.value),rows:3})]})]}),n.jsxs(Sn,{children:[n.jsx(te,{variant:"outline",onClick:()=>{f(!1),x(""),y("")},disabled:w,children:"Cancel"}),n.jsx(te,{onClick:X,disabled:w||!v||!b,children:w?"Processing...":p==="add"?"Add Credits":"Deduct Credits"})]})]})}),n.jsx(Zt,{open:N,onOpenChange:we=>{B||(_(we),we||(C(""),T(!1),F(null),I(null)))},children:n.jsxs(Jt,{className:"max-w-lg",children:[n.jsxs(_r,{children:[n.jsxs(tr,{className:"flex items-center gap-2 text-destructive",children:[n.jsx(hn,{className:"h-5 w-5"}),"Permanently Delete Account"]}),n.jsx(Hr,{children:"This action cannot be undone. This will permanently delete the account and all associated data."})]}),P&&n.jsxs("div",{className:"space-y-4",children:[n.jsxs(Ar,{children:[n.jsx(Wa,{children:"Account to be deleted:"}),n.jsxs(gr,{className:"mt-2 space-y-1",children:[n.jsxs("div",{children:[n.jsx("strong",{children:"Name:"})," ",P.name||"Unnamed"]}),n.jsxs("div",{children:[n.jsx("strong",{children:"ID:"})," ",n.jsx("code",{className:"text-xs",children:P.id})]}),n.jsxs("div",{children:[n.jsx("strong",{children:"Type:"})," ",P.personal_account?"Personal":"Team"]})]})]}),M&&n.jsxs(Ar,{variant:"destructive",children:[n.jsx(hn,{className:"h-4 w-4"}),n.jsx(Wa,{children:"Data that will be permanently deleted:"}),n.jsxs(gr,{className:"mt-2 space-y-1",children:[n.jsxs("div",{children:["• ",M.brands," brand",M.brands!==1?"s":""]}),n.jsxs("div",{children:["• ",M.campaigns," campaign",M.campaigns!==1?"s":""]}),n.jsxs("div",{children:["• ",M.contents," content piece",M.contents!==1?"s":""]}),M.credits>
19270&&n.jsxs("div",{children:["• ",M.credits.toLocaleString()," credit",M.credits!==1?"s":""]}),n.jsx("div",{children:"• All user access and permissions"}),n.jsx("div",{children:"• All billing and subscription data"}),n.jsx("div",{children:"• All logs and analytics"})]})]}),n.jsxs("div",{className:"flex items-start space-x-2",children:[n.jsx(Xo,{id:"delete-confirm-checkbox",checked:E,onCheckedChange:we=>T(we),disabled:B}),n.jsx("label",{htmlFor:"delete-confirm-checkbox",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"I understand that this action is permanent and cannot be undone"})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs(ze,{htmlFor:"delete-confirmation",children:["Type ",n.jsx("strong",{children:P.name||P.slug||"the account name"})," to confirm:"]}),n.jsx(qe,{id:"delete-confirmation",value:S,onChange:we=>C(we.target.value),placeholder:"Type account name to confirm",disabled:B})]})]}),n.jsxs(Sn,{children:[n.jsx(te,{variant:"outline",onClick:()=>_(!1),disabled:B,children:"Cancel"}),n.jsx(te,{variant:"destructive",onClick:ie,disabled:B||!E||!S||S.toLowerCase()!==((P==null?void 0:P.name)||(P==null?void 0:P.slug)||"").toLowerCase(),children:B?n.jsxs(n.Fragment,{children:[n.jsx(Es,{className:"h-4 w-4 mr-2 animate-spin"}),"Deleting..."]}):n.jsxs(n.Fragment,{children:[n.jsx(va,{className:"h-4 w-4 mr-2"}),"Delete Account Permanently"]})})]})]})})]}):n.jsx(Ar,{children:n.jsx(gr,{children:"You need to be a superadmin to view accounts."})})}function XAt(){var a;const{user:e}=wa(),t=xr(),r=((a=e==null?void 0:e.user_metadata)==null?void 0:a.roles)||[];return g.useEffect(()=>{!r.includes("admin")&&!r.includes("superadmin")&&console.log("Not an admin, redirecting to /")},[r,t,!1]),n.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 via-blue-50/20 to-indigo-50/30",children:[n.jsx("div",{className:"px-4 sm:px-6 lg:px-8 pt-8",children:n.jsxs("div",{className:"relative overflow-hidden bg-gradient-to-br from-white via-blue-50/30 to-indigo-50/40 rounded-2xl border border-blue-200/50 shadow-sm p-8",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsx("div",{className:"absolute top-0 right-0 w-40 h-40 bg-gradient-to-br from-blue-200/20 to-transparent rounded-full -translate-y-20 translate-x-20"}),n.jsx("div",{className:"absolute bottom-0 left-0 w-32 h-32 bg-gradient-to-tr from-indigo-200/20 to-transparent rounded-full translate-y-16 -translate-x-16"}),n.jsx("div",{className:"relative",children:n.jsxs("div",{className:"flex items-center gap-4",children:[n.jsx("div",{className:"p-3 bg-white/80 backdrop-blur-sm rounded-2xl shadow-lg",children:n.jsx(Gh,{className:"h-8 w-8 text-blue-600"})}),n.jsxs("div",{children:[n.jsx("h1",{className:"text-4xl font-bold bg-gradient-to-r from-blue-700 via-indigo-700 to-purple-700 bg-clip-text text-transparent mb-2",children:"Superadmin Console"}),n.jsx("p",{className:"text-gray-600 text-lg leading-relaxed",children:"Manage system operations, monitor performance, and oversee platform functionality with advanced administrative controls."})]})]})})]})}),n.jsx("div",{className:"container mx-auto px-4 py-8",children:n.jsxs(Spt,{defaultValue:"accounts",className:"flex gap-6",asChild:!1,children:[n.jsxs(Zoe,{className:"w-64 bg-gradient-to-b from-white/90 to-slate-50/90 backdrop-blur-sm border border-slate-200/50 shadow-lg rounded-xl p-3 h-fit",children:[n.jsxs(lc,{value:"accounts",className:"flex items-center gap-3 py-3 px-4 transition-all duration-200 hover:bg-blue-50/50 data-[state=active]:bg-gradient-to-r data-[state=active]:from-blue-100 data-[state=active]:to-indigo-100 data-[state=active]:text-blue-900 data-[state=active]:shadow-sm rounded-lg",children:[n.jsx(Ka,{className:"h-4 w-4"}),n.jsx("span",{className:"font-medium",children:"Accounts"})]}),n.jsxs(lc,{value:"scheduled-tasks",className:"flex items-center gap-3 py-3 px-4 transition-all duration-200 hover:bg-blue-50/50 data-[state=active]:bg-gradient-to-r data-[state=active]:from-blue-100 data-[state=active]:to-indigo-100 data-[state=active]:text-blue-900 data-[state=active]:shadow-sm rounded-lg",children:[n.jsx(Kn,{className:"h-4 w-4"}),n.jsx("span",{className:"font-medium",children:"Scheduled Tasks"})]}),n.jsxs(lc,{value:"content-test",className:"flex items-center gap-3 py-3 px-4 transition-all duration-200 hover:bg-blue-50/50 data-[state=active]:bg-gradient-to-r data-[state=active]:from-blue-100 data-[state=active]:to-indigo-100 data-[state=active]:text-blue-900 data-[state=active]:shadow-sm rounded-lg",children:[n.jsx(Xr,{className:"h-4 w-4"}),n.jsx("span",{className:"font-medium",children:"Manual Content Add"})]}),n.jsxs(lc,{value:"news-sources",className:"flex items-center gap-3 py-3 px-4 transition-all duration-200 hover:bg-blue-50/50 data-[state=active]:bg-gradient-to-r data-[state=active]:from-blue-100 data-[state=active]:to-indigo-100 data-[state=active]:text-blue-900 data-[state=active]:shadow-sm rounded-lg",children:[n.jsx(pd,{className:"h-4 w-4"}),n.jsx("span",{className:"font-medium",children:"News Sources"})]}),n.jsxs(lc,{value:"news-contents",className:"flex items-center gap-3 py-3 px-4 transition-all duration-200 hover:bg-blue-50/50 data-[state=active]:bg-gradient-to-r data-[state=active]:from-blue-100 data-[state=active]:to-indigo-100 data-[state=active]:text-blue-900 data-[state=active]:shadow-sm rounded-lg",children:[n.jsx(Xr,{className:"h-4 w-4"}),n.jsx("span",{className:"font-medium",children:"News Contents"})]}),n.jsxs(lc,{value:"llm-usage",className:"flex items-center gap-3 py-3 px-4 transition-all duration-200 hover:bg-blue-50/50 data-[state=active]:bg-gradient-to-r data-[state=active]:from-blue-100 data-[state=active]:to-indigo-100 data-[state=active]:text-blue-900 data-[state=active]:shadow-sm rounded-lg",children:[n.jsx(f2,{className:"h-4 w-4"}),n.jsx("span",{className:"font-medium",children:"LLM Usage"})]}),n.jsxs(lc,{value:"llm-logs",className:"flex items-center gap-3 py-3 px-4 transition-all duration-200 hover:bg-blue-50/50 data-[state=active]:bg-gradient-to-r data-[state=active]:from-blue-100 data-[state=active]:to-indigo-100 data-[state=active]:text-blue-900 data-[state=active]:shadow-sm rounded-lg",children:[n.jsx(Xr,{className:"h-4 w-4"}),n.jsx("span",{className:"font-medium",children:"LLM Logs"})]}),n.jsxs(lc,{value:"marketing-messages",className:"flex items-center gap-3 py-3 px-4 transition-all duration-200 hover:bg-blue-50/50 data-[state=active]:bg-gradient-to-r data-[state=active]:from-blue-100 data-[state=active]:to-indigo-100 data-[state=active]:text-blue-900 data-[state=active]:shadow-sm rounded-lg",children:[n.jsx(Cc,{className:"h-4 w-4"}),n.jsx("span",{className:"font-medium",children:"Marketing Messages"})]}),n.jsxs(lc,{value:"test-functions",className:"flex items-center gap-3 py-3 px-4 transition-all duration-200 hover:bg-blue-50/50 data-[state=active]:bg-gradient-to-r data-[state=active]:from-blue-100 data-[state=active]:to-indigo-100 data-[state=active]:text-blue-900 data-[state=active]:shadow-sm rounded-lg",children:[n.jsx(v2,{className:"h-4 w-4"}),n.jsx("span",{className:"font-medium",children:"Test Functions"})]}),n.jsxs(lc,{value:"error-logs",className:"flex items-center gap-3 py-3 px-4 transition-all duration-200 hover:bg-blue-50/50 data-[state=active]:bg-gradient-to-r data-[state=active]:from-blue-100 data-[state=active]:to-indigo-100 data-[state=active]:text-blue-900 data-[state=active]:shadow-sm rounded-lg",children:[n.jsx(hn,{className:"h-4 w-4"}),n.jsx("span",{className:"font-medium",children:"Error Logs & Alerts"})]})]}),n.jsxs("div",{className:"flex-grow",children:[n.jsx(jl,{value:"accounts",className:"mt-0",children:n.jsxs("div",{className:"relative overflow-hidden bg-gradient-to-br from-white via-slate-50/50 to-blue-50/30 rounded-xl border border-slate-200/50 shadow-lg backdrop-blur-sm transition-all duration-300 hover:shadow-xl",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-transparent via-white/5 to-blue-100/10"}),n.jsxs("div",{className:"relative p-8",children:[n.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[n.jsx("div",{className:"p-2 bg-blue-100/80 rounded-lg",children:n.jsx(Ka,{className:"h-5 w-5 text-blue-700"})}),n.jsx("h2",{className:"text-2xl font-bold bg-gradient-to-r from-blue-700 to-indigo-700 bg-clip-text text-transparent",children:"Account Management"})]}),n.jsx(JAt,{})]})]})}),n.jsx(jl,{value:"convergence",className:"mt-0",children:n.jsxs("div",{className:"relative overflow-hidden bg-gradient-to-br from-white via-slate-50/50 to-blue-50/30 rounded-xl border border-slate-200/50 shadow-lg backdrop-blur-sm transition-all duration-300 hover:shadow-xl",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-transparent via-white/5 to-blue-100/10"}),n.jsxs("div",{className:"relative p-8",children:[n.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[n.jsx("div",{className:"p-2 bg-blue-100/80 rounded-lg",children:n.jsx(fs,{className:"h-5 w-5 text-blue-700"})}),n.jsx("h2",{className:"text-2xl font-bold bg-gradient-to-r from-blue-700 to-indigo-700 bg-clip-text text-transparent",children:"Convergence Control"})]}),n.jsx("div",{className:"bg-gradient-to-r from-amber-50 to-orange-50 border border-amber-200/50 rounded-lg p-4",children:n.jsx("p",{className:"text-sm text-amber-800 leading-relaxed",children:"Convergence management functionality has been moved to automated processes. Manual triggers are no longer available in this interface."})})]})]})}),n.jsx(jl,{value:"scheduled-tasks",className:"mt-0",children:n.jsxs("div",{className:"relative overflow-hidden bg-gradient-to-br from-white via-slate-50/50 to-blue-50/30 rounded-xl border border-slate-200/50 shadow-lg backdrop-blur-sm transition-all duration-300 hover:shadow-xl",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-transparent via-white/5 to-blue-100/10"}),n.jsxs("div",{className:"relative p-8",children:[n.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[n.jsx("div",{className:"p-2 bg-blue-100/80 rounded-lg",children:n.jsx(Kn,{className:"h-5 w-5 text-blue-700"})}),n.jsx("h2",{className:"text-2xl font-bold bg-gradient-to-r from-blue-700 to-indigo-700 bg-clip-text text-transparent",children:"Scheduled Tasks"})]}),n.jsx("div",{className:"space-y-8",children:n.jsx(OAt,{})})]})]})}),n.jsx(jl,{value:"content-test",className:"mt-0",children:n.jsxs("div",{className:"relative overflow-hidden bg-gradient-to-br from-white via-slate-50/50 to-blue-50/30 rounded-xl border border-slate-200/50 shadow-lg backdrop-blur-sm transition-all duration-300 hover:shadow-xl",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-transparent via-white/5 to-blue-100/10"}),n.jsxs("div",{className:"relative p-8",children:[n.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[n.jsx("div",{className:"p-2 bg-blue-100/80 rounded-lg",children:n.jsx(Xr,{className:"h-5 w-5 text-blue-700"})}),n.jsx("h2",{className:"text-2xl font-bold bg-gradient-to-r from-blue-700 to-indigo-700 bg-clip-text text-transparent",children:"Manual Content Add"})]}),n.jsxs(Ar,{className:"mb-6 bg-gradient-to-r from-slate-50 to-gray-50 border border-slate-200/50 shadow-sm",children:[n.jsx(ng,{className:"h-4 w-4 text-slate-600"}),n.jsxs(gr,{className:"font-mono text-xs mt-2 text-slate-700",children:["To manually add content for a given source:",n.jsx("br",{}),'curl -X POST "',"https://worker.rainfactory.ai",'/rainfactory/add-content-by-source?source=Coverager&date=2024-02-13T00:00:00Z" -H "X-API-Key: uInnbPUejxAe+yXAifFBmvvTHhjHPZXY1DlXW8pOx50=" -H "Content-Type: application/json" --data-binary @sample_content.md']})]}),n.jsx(_pt,{})]})]})}),n.jsx(jl,{value:"news-sources",className:"mt-0",children:n.jsxs("div",{className:"relative overflow-hidden bg-gradient-to-br from-white via-slate-50/50 to-blue-50/30 rounded-xl border border-slate-200/50 shadow-lg backdrop-blur-sm transition-all duration-300 hover:shadow-xl",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-transparent via-white/5 to-blue-100/10"}),n.jsxs("div",{className:"relative p-8",children:[n.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[n.jsx("div",{className:"p-2 bg-blue-100/80 rounded-lg",children:n.jsx(pd,{className:"h-5 w-5 text-blue-700"})}),n.jsx("h2",{className:"text-2xl font-bold bg-gradient-to-r from-blue-700 to-indigo-700 bg-clip-text text-transparent",children:"News Sources"})]}),n.jsx(Cpt,{})]})]})}),n.jsx(jl,{value:"news-contents",className:"mt-0",children:n.jsxs("div",{className:"relative overflow-hidden bg-gradient-to-br from-white via-slate-50/50 to-blue-50/30 rounded-xl border border-slate-200/50 shadow-lg backdrop-blur-sm transition-all duration-300 hover:shadow-xl",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-transparent via-white/5 to-blue-100/10"}),n.jsxs("div",{className:"relative p-8",children:[n.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[n.jsx("div",{className:"p-2 bg-blue-100/80 rounded-lg",children:n.jsx(Xr,{className:"h-5 w-5 text-blue-700"})}),n.jsx("h2",{className:"text-2xl font-bold bg-gradient-to-r from-blue-700 to-indigo-700 bg-clip-text text-transparent",children:"News Contents"})]}),n.jsx(bAt,{})]})]})}),n.jsx(jl,{value:"llm-usage",className:"mt-0",children:n.jsxs("div",{className:"relative overflow-hidden bg-gradient-to-br from-white via-slate-50/50 to-blue-50/30 rounded-xl border border-slate-200/50 shadow-lg backdrop-blur-sm transition-all duration-300 hover:shadow-xl",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-transparent via-white/5 to-blue-100/10"}),n.jsxs("div",{className:"relative p-8",children:[n.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[n.jsx("div",{className:"p-2 bg-blue-100/80 rounded-lg",children:n.jsx(f2,{className:"h-5 w-5 text-blue-700"})}),n.jsx("h2",{className:"text-2xl font-bold bg-gradient-to-r from-blue-700 to-indigo-700 bg-clip-text text-transparent",children:"LLM Usage Dashboard"})]}),n.jsx(QAt,{})]})]})}),n.jsx(jl,{value:"llm-logs",className:"mt-0",children:n.jsxs("div",{className:"relative overflow-hidden bg-gradient-to-br from-white via-slate-50/50 to-blue-50/30 rounded-xl border border-slate-200/50 shadow-lg backdrop-blur-sm transition-all duration-300 hover:shadow-xl",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-transparent via-white/5 to-blue-100/10"}),n.jsxs("div",{className:"relative p-8",children:[n.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[n.jsx("div",{className:"p-2 bg-blue-100/80 rounded-lg",children:n.jsx(Xr,{className:"h-5 w-5 text-blue-700"})}),n.jsx("h2",{className:"text-2xl font-bold bg-gradient-to-r from-blue-700 to-indigo-700 bg-clip-text text-transparent",children:"LLM Logs"})]}),n.jsx(GAt,{})]})]})}),n.jsx(jl,{value:"marketing-messages",className:"mt-0",children:n.jsxs("div",{className:"relative overflow-hidden bg-gradient-to-br from-white via-slate-50/50 to-blue-50/30 rounded-xl border border-slate-200/50 shadow-lg backdrop-blur-sm transition-all duration-300 hover:shadow-xl",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-transparent via-white/5 to-blue-100/10"}),n.jsxs("div",{className:"relative p-8",children:[n.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[n.jsx("div",{className:"p-2 bg-blue-100/80 rounded-lg",children:n.jsx(Cc,{className:"h-5 w-5 text-blue-700"})}),n.jsx("h2",{className:"text-2xl font-bold bg-gradient-to-r from-blue-700 to-indigo-700 bg-clip-text text-transparent",children:"Marketing Messages"})]}),n.jsx(KAt,{})]})]})}),n.jsx(jl,{value:"test-functions",className:"mt-0",children:n.jsxs("div",{className:"relative overflow-hidden bg-gradient-to-br from-white via-slate-50/50 to-blue-50/30 rounded-xl border border-slate-200/50 shadow-lg backdrop-blur-sm transition-all duration-300 hover:shadow-xl",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-transparent via-white/5 to-blue-100/10"}),n.jsxs("div",{className:"relative p-8",children:[n.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[n.jsx("div",{className:"p-2 bg-blue-100/80 rounded-lg",children:n.jsx(v2,{className:"h-5 w-5 text-blue-700"})}),n.jsx("h2",{className:"text-2xl font-bold bg-gradient-to-r f
1927rom-blue-700 to-indigo-700 bg-clip-text text-transparent",children:"Test Functions"})]}),n.jsx(WAt,{})]})]})}),n.jsx(jl,{value:"error-logs",className:"mt-0",children:n.jsxs("div",{className:"relative overflow-hidden bg-gradient-to-br from-white via-slate-50/50 to-blue-50/30 rounded-xl border border-slate-200/50 shadow-lg backdrop-blur-sm transition-all duration-300 hover:shadow-xl",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-transparent via-white/5 to-blue-100/10"}),n.jsxs("div",{className:"relative p-8",children:[n.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[n.jsx("div",{className:"p-2 bg-red-100/80 rounded-lg",children:n.jsx(hn,{className:"h-5 w-5 text-red-700"})}),n.jsx("h2",{className:"text-2xl font-bold bg-gradient-to-r from-red-700 to-orange-700 bg-clip-text text-transparent",children:"Error Logs & Alerts"})]}),n.jsx(YAt,{})]})]})})]})]})})]})}function ZAt(){const{id:e}=Ei(),t=xr(),{toast:r}=sn(),[s,a]=g.useState(null),[i,o]=g.useState(!0),[l,c]=g.useState(!1),[d,u]=g.useState({});g.useEffect(()=>{async function m(){try{if(!e){r({title:"Error",description:"Campaign ID is required",variant:"destructive"}),t("/campaigns");return}const{data:f,error:p}=await de.from("campaigns").select("id, name, status, custom_idea, campaign_type").eq("id",e).single();if(p)throw p;a(f),u(f)}catch(f){r({title:"Error",description:f instanceof Error?f.message:"Failed to fetch campaign",variant:"destructive"}),t("/campaigns")}finally{o(!1)}}m()},[e,t,r]);const h=async m=>{m.preventDefault(),c(!0);try{if(!e)throw new Error("Campaign ID is required");const{error:f}=await de.from("campaigns").update({name:d.name,status:d.status,custom_idea:d.custom_idea}).eq("id",e);if(f)throw f;r({title:"Success",description:"Campaign updated successfully"}),t(`/campaigns/${e}`)}catch(f){r({title:"Error",description:f instanceof Error?f.message:"Failed to update campaign",variant:"destructive"})}finally{c(!1)}};return i?n.jsx("div",{children:"Loading..."}):s?n.jsxs("div",{className:"container mx-auto p-6 space-y-6",children:[n.jsx(i0,{title:"Edit Campaign",description:"Update campaign details and settings"}),n.jsxs("form",{onSubmit:h,className:"space-y-8 max-w-2xl",children:[n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"name",children:"Campaign Name"}),n.jsx(qe,{id:"name",value:d.name||"",onChange:m=>u(f=>({...f,name:m.target.value})),required:!0})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"status",children:"Status"}),n.jsxs(ur,{value:d.status,onValueChange:m=>u(f=>({...f,status:m})),children:[n.jsx(or,{children:n.jsx(hr,{placeholder:"Select status"})}),n.jsxs(lr,{children:[n.jsx(Fe,{value:"Active",children:"Active"}),n.jsx(Fe,{value:"Inactive",children:"Inactive"})]})]})]}),s.campaign_type==="CUSTOM"&&n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"custom_idea",children:"Custom Campaign Idea"}),n.jsx(qe,{id:"custom_idea",value:d.custom_idea||"",onChange:m=>u(f=>({...f,custom_idea:m.target.value}))})]})]}),n.jsxs("div",{className:"flex gap-4",children:[n.jsxs(te,{type:"submit",disabled:l,children:[n.jsx(ld,{className:"h-4 w-4 mr-2"}),l?"Saving...":"Save Changes"]}),n.jsx(te,{type:"button",variant:"outline",onClick:()=>t(`/campaigns/${e}`),children:"Cancel"})]})]})]}):n.jsx("div",{children:"Campaign not found"})}const egt=e=>{if(!e)return{monthlyCredits:"",maxBrands:"",features:{}};const t={monthlyCredits:e.monthly_credits||"",maxBrands:e.max_brands||"",features:{}};if(e.features)try{t.features=typeof e.features=="string"?JSON.parse(e.features):e.features}catch(r){console.warn("Failed to parse features JSON:",r)}return t},CV=e=>{if(!e)return"";const t=e.replace(/,/g,""),r=parseInt(t,10);return isNaN(r)?e:r.toLocaleString()},SV=e=>{if(!e)return"";const t=parseInt(e,10);return isNaN(t)?e:t===999999||t>=999999?"Unlimited":t.toString()},tgt=(e,t,r)=>{const s=[Ka,Cc,Fm,sl,yK],a=["from-blue-500 to-cyan-600","from-indigo-500 to-purple-600","from-purple-600 to-pink-600","from-pink-600 to-rose-600","from-rose-600 to-orange-600"],i=Math.min(t,s.length-1),o=Math.min(t,a.length-1),l=e.name.toLowerCase()==="professional",c=l?"default":e.isEnterprise?"outline":"secondary";return{icon:s[i],gradient:a[o],buttonVariant:c,isPopular:r==="public"?l:!1}},rgt=(e=[])=>{const t={};return e.forEach(r=>{const s=r.product_name.toLowerCase().split("_")[0],a=r.interval==="year",i=egt(r.structured_features);t[s]||(t[s]={name:s.charAt(0).toUpperCase()+s.slice(1),description:r.product_description||`${s.charAt(0).toUpperCase()+s.slice(1)} plan with essential features`,monthlyPrice:0,yearlyPrice:0,monthlyPlanId:"",yearlyPlanId:"",isEnterprise:s==="enterprise",features:(r.features||[]).map(o=>typeof o=="object"?o.name:String(o)),monthlyCredits:i.monthlyCredits,maxBrands:i.maxBrands,structuredFeatures:i.features}),a?(t[s].yearlyPrice=r.price/100/12,t[s].yearlyPlanId=r.id):(t[s].monthlyPrice=r.price/100,t[s].monthlyPlanId=r.id)}),t.enterprise||(t.enterprise={name:"Enterprise",description:"Custom enterprise solution with unlimited features and dedicated support",monthlyPrice:0,yearlyPrice:0,monthlyPlanId:"enterprise",yearlyPlanId:"enterprise",isEnterprise:!0,features:["Unlimited monthly credits","Unlimited brands","Advanced team collaboration","Priority support","Custom integrations","Dedicated account manager","SLA guarantees","Advanced analytics & reporting","Custom training & onboarding","White-label options"],monthlyCredits:"Unlimited",maxBrands:"Unlimited",structuredFeatures:{teams:!0}}),Object.values(t).sort((r,s)=>r.isEnterprise?1:s.isEnterprise?-1:r.monthlyPrice-s.monthlyPrice)};function xle({plans:e,billingInterval:t,onBillingIntervalChange:r,onPlanSelect:s,currentPlanId:a,isChangingPlan:i=!1,loading:o=!1,showComparisonTable:l=!0,variant:c="public",className:d=""}){const u=g.useMemo(()=>rgt(e),[e]),h=g.useMemo(()=>u.map((f,p)=>{const A=tgt(f,p,c),v=t==="monthly"?f.monthlyPrice:f.yearlyPrice,x=t==="yearly"&&f.monthlyPrice>0?Math.round((f.monthlyPrice-f.yearlyPrice)/f.monthlyPrice*100):0;return{id:t==="monthly"?f.monthlyPlanId:f.yearlyPlanId,name:f.name,description:f.description,currentPrice:v,originalMonthlyPrice:f.monthlyPrice,savings:x,isEnterprise:f.isEnterprise||f.monthlyPrice===0,features:f.features,monthlyPlanId:f.monthlyPlanId,yearlyPlanId:f.yearlyPlanId,monthlyCredits:f.monthlyCredits,maxBrands:f.maxBrands,structuredFeatures:f.structuredFeatures,...A}}),[u,t,c]);if(o)return n.jsx("div",{className:"flex justify-center items-center p-8",children:n.jsx(kt,{className:"h-8 w-8 animate-spin"})});const m=c;return n.jsxs("div",{className:`space-y-8 ${d}`,children:[n.jsx("div",{className:"text-center",children:n.jsxs("div",{className:"relative overflow-hidden bg-white/60 backdrop-blur-sm rounded-2xl border border-white/50 shadow-lg p-2 inline-flex items-center justify-center",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-blue-50/30 via-trans
1927parent to-purple-50/30"}),n.jsx(te,{variant:t==="monthly"?"default":"ghost",onClick:()=>r("monthly"),className:`relative px-8 py-3 font-medium transition-all duration-300 ${t==="monthly"?"bg-gradient-to-r from-blue-600 to-indigo-600 text-white shadow-md hover:shadow-lg":"bg-transparent text-gray-600 hover:text-blue-600 hover:bg-blue-50/50"}`,children:"Pay monthly"}),n.jsxs(te,{variant:t==="yearly"?"default":"ghost",onClick:()=>r("yearly"),className:`relative px-8 py-3 font-medium transition-all duration-300 ${t==="yearly"?"bg-gradient-to-r from-blue-600 to-indigo-600 text-white shadow-md hover:shadow-lg":"bg-transparent text-gray-600 hover:text-blue-600 hover:bg-blue-50/50"}`,children:["Pay annually",n.jsx(Be,{className:"ml-2 bg-green-100 text-green-700 text-xs px-2 py-0.5 font-semibold border-0",children:"Save 20%"})]})]})}),u.length===0?n.jsxs("div",{className:"text-center py-16",children:[n.jsx("div",{className:"text-gray-500 mb-4",children:"No pricing plans available at the moment."}),n.jsx("div",{className:"text-sm text-gray-400",children:"Please check back later or contact support."})]}):n.jsx("div",{className:`grid gap-6 items-stretch lg:gap-8 ${h.length===1?"grid-cols-1 max-w-sm mx-auto":h.length===2?"grid-cols-1 lg:grid-cols-2 max-w-4xl mx-auto":h.length===3?"grid-cols-1 md:grid-cols-2 lg:grid-cols-3 max-w-6xl mx-auto":h.length===4?"grid-cols-1 md:grid-cols-2 xl:grid-cols-4 max-w-7xl mx-auto":"grid-cols-1 md:grid-cols-2 lg:grid-cols-3 max-w-7xl mx-auto"}`,children:h.map(f=>{var v;const p=f.icon,A=f.id===a;return n.jsxs(Te,{className:`group relative flex flex-col h-full overflow-hidden transition-all duration-500 ${`hover:shadow-2xl border-2 ${f.isPopular?"border-purple-400 shadow-2xl ring-4 ring-purple-100/50 bg-gradient-to-br from-white via-purple-50/60 to-indigo-50/40 transform scale-[1.05] hover:scale-[1.06]":"border-gray-200/80 shadow-lg hover:shadow-xl bg-gradient-to-br from-white via-slate-50/40 to-gray-50/30 hover:border-gray-300/80 hover:scale-[1.02]"}`}`,children:[n.jsxs(n.Fragment,{children:[n.jsx("div",{className:`absolute top-0 right-0 w-28 h-28 bg-gradient-to-br ${f.gradient} ${f.isPopular?"opacity-20":"opacity-8"} rounded-full -translate-y-14 translate-x-14 animate-pulse`}),n.jsx("div",{className:`absolute bottom-0 left-0 w-20 h-20 bg-gradient-to-tr ${f.gradient} ${f.isPopular?"opacity-15":"opacity-6"} rounded-full translate-y-10 -translate-x-10`}),f.isPopular&&n.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-purple-500/20 via-transparent to-indigo-500/20 rounded-lg pointer-events-none"})]}),n.jsx(st,{className:"relative flex-grow space-y-4 pt-8 pb-4",children:n.jsxs("div",{className:"text-center space-y-3",children:[n.jsx("div",{className:`inline-flex p-3 rounded-2xl bg-gradient-to-br ${f.gradient} shadow-lg group-hover:shadow-xl transition-all duration-300 ${f.isPopular?"ring-2 ring-purple-200 ring-offset-2":""}`,children:n.jsx(p,{className:`${f.isPopular?"h-7 w-7":"h-6 w-6"} text-white`})}),n.jsxs("div",{className:"space-y-1.5 ",children:[n.jsx("h3",{className:`${`${f.isPopular?"text-2xl":"text-xl"} font-bold ${f.isPopular?"bg-gradient-to-r from-purple-700 to-indigo-700 bg-clip-text text-transparent":"text-gray-900"} group-hover:text-gray-800 transition-colors`}`,children:f.name}),n.jsx("p",{className:"text-xs text-gray-600 leading-relaxed px-2 max-w-xs mx-auto",children:f.description})]}),m==="public"&&f.isPopular&&n.jsx("div",{className:"flex justify-center",children:n.jsxs(Be,{className:"bg-gradient-to-r from-purple-600 to-pink-600 text-white px-4 py-1.5 text-xs font-bold border-0 shadow-lg rounded-full whitespace-nowrap",children:[n.jsx(Fm,{className:"h-3 w-3 mr-1.5 fill-current"}),"Most Popular"]})}),n.jsxs("div",{className:"space-y-1.5 ",children:[n.jsx("div",{className:"flex items-baseline justify-center",children:f.isEnterprise?n.jsx("span",{className:"text-3xl font-bold text-gray-900",children:"Custom"}):n.jsxs(n.Fragment,{children:[n.jsxs("span",{className:`${`${f.isPopular?"text-4xl bg-gradient-to-r from-purple-600 to-indigo-600 bg-clip-text text-transparent":"text-3xl text-gray-900"} font-bold`}`,children:["$",f.currentPrice.toFixed(0)]}),n.jsx("span",{className:"text-sm text-gray-600 ml-1",children:"/month"})]})}),t==="yearly"&&!f.isEnterprise&&f.savings>0&&n.jsxs("div",{className:`text-xs font-medium ${f.isPopular?"text-green-700":"text-green-600"}`,children:["Save ",f.savings,"% annually"]})]}),n.jsxs("div",{className:`space-y-2 pt-3 ${f.isPopular?"border-t-2 border-gradient-to-r from-purple-200 to-indigo-200":"border-t border-gray-200/60"}`,children:[f.monthlyCredits&&n.jsxs("div",{className:"flex items-center justify-center space-x-2 text-xs font-semibold",children:[n.jsx("div",{className:`p-1.5 rounded-lg bg-gradient-to-r ${f.gradient} shadow-sm`,children:n.jsx(sg,{className:"h-3 w-3 text-white"})}),n.jsxs("span",{className:f.isPopular?"text-purple-800":"text-gray-800",children:[CV(f.monthlyCredits)," credits/month"]})]}
1927),f.maxBrands&&n.jsxs("div",{className:"flex items-center justify-center space-x-2 text-xs font-semibold",children:[n.jsx("div",{className:`p-1.5 rounded-lg bg-gradient-to-r ${f.gradient} shadow-sm`,children:n.jsx(zh,{className:"h-3 w-3 text-white"})}),n.jsxs("span",{className:f.isPopular?"text-purple-800":"text-gray-800",children:[SV(f.maxBrands)," brands"]})]}),((v=f.structuredFeatures)==null?void 0:v.teams)&&n.jsxs("div",{className:"flex items-center justify-center space-x-2 text-xs font-semibold",children:[n.jsx("div",{className:`p-1.5 rounded-lg bg-gradient-to-r ${f.gradient} shadow-sm`,children:n.jsx(Ka,{className:"h-3 w-3 text-white"})}),n.jsx("span",{className:f.isPopular?"text-purple-800":"text-gray-800",children:"Team Collaboration"})]})]})]})}),n.jsxs(Re,{className:"relative flex flex-col pt-0 pb-6 mt-auto",children:[m==="settings"&&n.jsx(te,{className:`w-full py-3.5 text-sm font-bold transition-all duration-300 hover:transform hover:scale-[1.02] mb-4 ${f.isEnterprise?"bg-gray-900 text-white hover:bg-gray-800":f.isPopular?"bg-gradient-to-r from-purple-600 to-indigo-600 text-white shadow-lg hover:shadow-xl hover:from-purple-700 hover:to-indigo-700":"bg-gradient-to-r from-blue-600 to-indigo-600 text-white hover:from-blue-700 hover:to-indigo-700"} ${A?"opacity-75 cursor-not-allowed":""}`,disabled:A,onClick:()=>{const x=t==="monthly"?f.monthlyPlanId:f.yearlyPlanId;s(x||f.id,f.name,f.currentPrice,f.isEnterprise)},children:A?"Current Plan":f.isEnterprise?"Contact Sales":"Select Plan"}),n.jsxs("div",{className:"space-y-3 flex-grow",children:[n.jsx("div",{className:`text-xs font-semibold ${`${f.isPopular?"text-purple-900":"text-gray-900"} border-b ${f.isPopular?"border-purple-200":"border-gray-200"} pb-2`}`,children:"What's included:"}),n.jsx("ul",{className:"space-y-2 text-xs",children:f.features.map((x,b)=>n.jsxs("li",{className:"flex gap-2.5",children:[n.jsx(Gn,{className:`${`h-3.5 w-3.5 flex-shrink-0 ${f.isPopular?"text-green-700":"text-green-600"} mt-0.5`}`}),n.jsx("span",{className:`${`${f.isPopular?"text-gray-800":"text-gray-700"} leading-tight font-medium`}`,children:x})]},b))})]}),m==="public"&&n.jsx(te,{className:`w-full py-3.5 text-sm font-bold transition-all duration-300 hover:transform hover:scale-[1.02] mt-4 ${f.isPopular?"bg-gradient-to-r from-purple-600 via-indigo-600 to-purple-700 text-white shadow-2xl hover:shadow-3xl border-0 ring-2 ring-purple-300 hover:ring-purple-400 hover:from-purple-700 hover:via-indigo-700 hover:to-purple-800":f.isEnterprise?"bg-gradient-to-r from-gray-700 to-gray-900 text-white shadow-lg hover:shadow-xl border-0 hover:from-gray-800 hover:to-gray-900":f.buttonVariant==="outline"?`border-2 border-gray-300 bg-transparent text-gray-700 hover:bg-gradient-to-r ${f.gradient} hover:text-white hover:border-transparent hover:shadow-lg`:"bg-white border-2 border-gray-200 text-gray-900 hover:border-gray-400 hover:shadow-lg hover:bg-gray-50"}`,onClick:()=>{const x=t==="monthly"?f.monthlyPlanId:f.yearlyPlanId;s(x||f.id,f.name,f.currentPrice,f.isEnterprise)},children:f.isEnterprise?n.jsxs(n.Fragment,{children:[n.jsx(Gh,{className:"h-4 w-4 mr-2"}),"Contact Sales"]}):n.jsxs(n.Fragment,{children:[n.jsx(en,{className:"h-4 w-4 mr-2"}),"Start Free Trial"]})})]})]},f.id)})}),l&&h.length>0&&n.jsx("div",{className:"relative",children:n.jsxs("div",{className:"relative overflow-hidden bg-gradient-to-br from-white via-indigo-50/20 to-purple-50/30 rounded-2xl border border-indigo-200/50 shadow-lg",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsxs("div",{className:"relative backdrop-blur-sm p-4 sm:p-6 lg:p-8",children:[n.jsxs("div",{className:"text-center mb-8 sm:mb-12",children:[n.jsx("h2",{className:"text-2xl sm:text-3xl font-bold bg-gradient-to-r from-indigo-700 via-purple-700 to-blue-700 bg-clip-text text-transparent mb-4",children:"Detailed Comparison"}),n.jsx("p",{className:"text-gray-600 text-base sm:text-lg",children:"Everything you need to know about our pricing plans"})]}),n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("table",{className:"w-full",children:[n.jsx("thead",{children:n.jsxs("tr",{className:"border-b border-gray-200",children:[n.jsx("th",{className:"text-left font-semibold text-gray-900 py-3 sm:py-4 px-3 sm:px-6",children:"Features"}),h.map(f=>n.jsx("th",{className:"text-center font-semibold text-gray-900 py-3 sm:py-4 px-2 sm:px-4 min-w-[100px] sm:min-w-[120px]",children:n.jsx("div",{className:"truncate",children:f.name})},f.id))]})}),n.jsxs("tbody",{className:"divide-y divide-gray-100",children:[n.jsxs("tr",{className:"hover:bg-blue-50/30 transition-colors",children:[n.jsx("td",{className:"font-medium text-gray-900 py-3 sm:py-4 px-3 sm:px-6 text-sm sm:text-base",children:"Monthly Price"}),h.map(f=>n.jsx("td",{className:"text-center text-gray-700 py-3 sm:py-4 px-2 sm:px-4",children:n.jsx("div",{className:"font-semibold",children:f.isEnterprise?"Custom"
1927:`$${f.originalMonthlyPrice.toFixed(0)}`})},f.id))]}),t==="yearly"&&n.jsxs("tr",{className:"hover:bg-blue-50/30 transition-colors",children:[n.jsx("td",{className:"font-medium text-gray-900 py-4 px-6",children:"Annual Price (per month)"}),h.map(f=>n.jsxs("td",{className:"text-center text-gray-700 py-4 px-4",children:[n.jsx("div",{className:"font-semibold",children:f.isEnterprise?"Custom":`$${f.currentPrice.toFixed(0)}`}),f.savings>0&&n.jsxs("div",{className:"text-xs text-green-600 mt-1",children:["Save ",f.savings,"%"]})]},f.id))]}),h.some(f=>f.monthlyCredits)&&n.jsxs("tr",{className:"hover:bg-blue-50/30 transition-colors",children:[n.jsx("td",{className:"font-medium text-gray-900 py-4 px-6",children:n.jsxs("div",{className:"flex items-center space-x-2",children:[n.jsx(sg,{className:"h-4 w-4 text-indigo-600"}),n.jsx("span",{children:"Monthly Credits"})]})}),h.map(f=>n.jsx("td",{className:"text-center text-gray-700 py-4 px-4",children:n.jsx("div",{className:"font-semibold text-indigo-600",children:f.monthlyCredits?CV(f.monthlyCredits):f.isEnterprise?"Custom":"N/A"})},f.id))]}),h.some(f=>f.maxBrands)&&n.jsxs("tr",{className:"hover:bg-blue-50/30 transition-colors",children:[n.jsx("td",{className:"font-medium text-gray-900 py-4 px-6",children:n.jsxs("div",{className:"flex items-center space-x-2",children:[n.jsx(zh,{className:"h-4 w-4 text-purple-600"}),n.jsx("span",{children:"Number of Brands"})]})}),h.map(f=>n.jsx("td",{className:"text-center text-gray-700 py-4 px-4",children:n.jsx("div",{className:"font-semibold text-purple-600",children:f.maxBrands?SV(f.maxBrands):f.isEnterprise?"Unlimited":"N/A"})},f.id))]}),h.some(f=>{var p;return((p=f.structuredFeatures)==null?void 0:p.teams)!==void 0})&&n.jsxs("tr",{className:"hover:bg-blue-50/30 transition-colors",children:[n.jsx("td",{className:"font-medium text-gray-900 py-4 px-6",children:n.jsxs("div",{className:"flex items-center space-x-2",children:[n.jsx(Ka,{className:"h-4 w-4 text-green-600"}),n.jsx("span",{children:"Team Collaboration"})]})}),h.map(f=>{var p;return n.jsx("td",{className:"text-center text-gray-700 py-4 px-4",children:((p=f.structuredFeatures)==null?void 0:p.teams)!==void 0?f.structuredFeatures.teams||f.isEnterprise?n.jsx(Gn,{className:"h-5 w-5 text-green-600 mx-auto"}):n.jsx("span",{className:"text-gray-400",children:"—"}):f.isEnterprise?n.jsx(Gn,{className:"h-5 w-5 text-green-600 mx-auto"}):n.jsx("span",{className:"text-gray-400",children:"—"})},f.id)})]}),h.some(f=>f.features.length>0)&&n.jsxs("tr",{className:"hover:bg-blue-50/30 transition-colors",children:[n.jsx("td",{className:"font-medium text-gray-900 py-4 px-6",children:"Features"}),h.map(f=>n.jsx("td",{className:"text-center text-gray-700 py-4 px-4",children:n.jsxs("div",{className:"text-sm space-y-1",children:[f.features.slice(0,3).map((p,A)=>n.jsxs("div",{className:"flex items-center justify-center",children:[n.jsx(Gn,{className:"h-3 w-3 text-green-600 mr-1 flex-shrink-0"}),n.jsx("span",{className:"text-xs truncate",children:p})]},A)),f.features.length>3&&n.jsxs("div",{className:"text-xs text-gray-500",children:["+",f.features.length-3," more"]})]})},f.id))]})]})]})})]})]})})]})}function vle(){var v,x,b;const[e,t]=g.useState("monthly"),[r,s]=g.useState({isOpen:!1,planId:"",planName:"",isUpgrade:!1}),[a,i]=g.useState(!1),[o,l]=g.useState([]),[c,d]=g.useState(!0),{loading:u,error:h,billingStatus:m,handleChangePlan:f}=Boe();g.useEffect(()=>{(async()=>{try{d(!0);const{data:w}=await de.rpc("get_personal_account");if(!(w!=null&&w.account_id))throw new Error("No account found");const j=await de.auth.getSession();if(!j.data.session)throw new Error("No session found");const _=await fetch("https://worker.rainfactory.ai/billing-functions/get_plans_public",{method:"POST",headers:{Authorization:`Bearer ${j.data.session.access_token}`},body:JSON.stringify({account_id:w.account_id})});if(!_.ok)throw new Error("Failed to fetch plans");const C=(await _.json()).map(E=>({id:E.id,product_name:E.product_name,product_description:E.product_description,price:E.price,currency:E.currency,interval:E.interval==="month"?"month":"year",features:E.features,structured_features:E.structured_features||{}}));l(C)}catch(w){console.error("Error fetching plans:",w),He({title:"Error",description:"Failed to load subscription plans",variant:"destructive"})}finally{d(!1)}})()},[]);const p=async(y,w,j,N)=>{var T;const _=o.find(B=>B.id===y),S=(T=m==null?void 0:m.subscription)==null?void 0:T.plan_id,C=S?o.find(B=>B.id===S):null;if(!C){s({isOpen:!0,planId:y,planName:w,isUpgrade:!1,isNewSubscription:!0}
1927);return}if(!_)return;const E=(_.price||0)>(C.price||0);s({isOpen:!0,planId:y,planName:w,isUpgrade:E,isNewSubscription:!1})},A=async()=>{i(!0);try{const y=await f(r.planId,e,{billing_cycle_anchor:r.isUpgrade?"now":"unchanged"});if(y.error)throw new Error(y.error);if(r.isNewSubscription&&y.checkout_url){window.location.href=y.checkout_url;return}He({title:r.isNewSubscription?"Subscription created":"Subscription updated",description:r.isNewSubscription?"Your subscription has been set up successfully.":r.isUpgrade?"Your upgrade has been processed and is effective immediately.":"Your downgrade will take effect at the end of your current billing period."}),s(w=>({...w,isOpen:!1}))}catch(y){He({title:"Error updating subscription",description:y.message,variant:"destructive"})}finally{i(!1)}};return m?c||u?n.jsx("div",{className:"flex justify-center items-center p-8",children:n.jsx(kt,{className:"h-8 w-8 animate-spin"})}):h?n.jsxs("div",{className:"text-red-500 p-4",children:["Error loading subscription data: ",h.message]}):!(m!=null&&m.has_active_subscription)&&((v=m==null?void 0:m.subscription)==null?void 0:v.status)!=="trialing"?n.jsxs(Te,{children:[n.jsx(st,{children:n.jsx(ot,{children:"Subscription Status"})}),n.jsxs(Re,{className:"space-y-4",children:[n.jsx("p",{children:"You don't have an active subscription."}),n.jsx(Ir,{to:"/onboarding?step=plan",children:n.jsx(te,{children:"View Plans"})})]})]}):n.jsxs("div",{className:"space-y-8 pt-8 max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:[((x=m==null?void 0:m.subscription)==null?void 0:x.status)==="trialing"&&n.jsx("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4",children:n.jsxs("div",{className:"flex",children:[n.jsx("div",{className:"flex-shrink-0",children:n.jsx(Kn,{className:"h-5 w-5 text-blue-600","aria-hidden":"true"})}),n.jsxs("div",{className:"ml-3",children:[n.jsx("h3",{className:"text-sm font-medium text-blue-800",children:"Trial Period Active"}),n.jsx("div",{className:"mt-2 text-sm text-blue-700",children:n.jsx("p",{children:m.subscription.trial_end?`Your trial ends on ${new Date(m.subscription.trial_end).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}. ${Math.ceil((new Date(m.subscription.trial_end).getTime()-new Date().getTime())/(1e3*60*60*24))} days remaining.`:"Your trial is currently active."})})]})]})}),n.jsx("div",{className:"text-center space-y-6 mb-8",children:n.jsx("h2",{className:"text-3xl md:text-4xl font-bold",children:"Plans to maximize your growth"})}),n.jsx(xle,{plans:o,billingInterval:e,onBillingIntervalChange:t,onPlanSelect:p,currentPlanId:(b=m==null?void 0:m.subscription)==null?void 0:b.plan_id,isChangingPlan:!0,loading:c,showComparisonTable:!0,variant:"settings"}),n.jsx(Zt,{open:r.isOpen,onOpenChange:y=>s(w=>({...w,isOpen:y})),children:n.jsxs(Jt,{children:[n.jsxs(_r,{children:[n.jsx(tr,{children:r.isNewSubscription?`Subscribe to ${r.planName}`:r.isUpgrade?`Upgrade to ${r.planName}`:`Downgrade to ${r.planName}`}),n.jsx(Hr,{children:r.isNewSubscription?"You will be charged according to the plan terms. New customers may be eligible for a free trial.":r.isUpgrade?"Your upgrade will be effective immediately and you will be charged a prorated amount for the remainder of your billing period.":"Your downgrade will take effect at the end of your current billing period. You will continue to have access to your current plan's features until then."})]}),n.jsxs(Sn,{children:[n.jsx(te,{variant:"outline",onClick:()=>s(y=>({...y,isOpen:!1})),disabled:a,children:"Cancel"}),n.jsx(te,{onClick:A,disabled:a,children:a?n.jsxs(n.Fragment,{children:[n.jsx(kt,{className:"mr-2 h-4 w-4 animate-spin"}),"Processing..."]}):r.isNewSubscription?"Subscribe":"Confirm Change"})]})]})}),n.jsx("div",{className:"text-center space-y-6 pt-12",children:n.jsx(AO,{})})]}):null}var E4,yk="HoverCard",[ble]=Ki(yk,[rf]),wk=rf(),[ngt,jk]=ble(yk),yle=e=>{const{__scopeHoverCard:t,children:r,open:s,defaultOpen:a,onOpenChange:i,openDelay:o=700,closeDelay:l=300}=e,c=wk(t),d=g.useRef(0),u=g.useRef(0),h=g.useRef(!1),m=g.useRef(!1),[f,p]=lo({prop:s,defaultProp:a??!1,onChange:i,caller:yk}),A=g.useCallback(()=>{clearTimeout(u.current),d.current=window.setTimeout(()=>p(!0),o)},[o,p]),v=g.useCallback(()=>{clearTimeout(d.current),!h.current&&!m.current&&(u.current=window.setTimeout(()=>p(!1),l))},[l,p]),x=g.useCallback(()=>p(!1),[p]);return g.useEffect(()=>()=>{clearTimeout(d.current),clearTimeout(u.current)},[]),n.jsx(ngt,{scope:t,open:f,onOpenChange:p,onOpen:A,onClose:v,onDismiss:x,hasSelectionRef:h,isPointerDownOnContentRef:m,children:n.jsx(R_,{...c,children:r})})};yle.displayName=yk;var wle="HoverCardTrigger",jle=g.forwardRef((e,t)=>
1927{const{__scopeHoverCard:r,...s}=e,a=jk(wle,r),i=wk(r);return n.jsx(Ny,{asChild:!0,...i,children:n.jsx(sr.a,{"data-state":a.open?"open":"closed",...s,ref:t,onPointerEnter:yt(e.onPointerEnter,C_(a.onOpen)),onPointerLeave:yt(e.onPointerLeave,C_(a.onClose)),onFocus:yt(e.onFocus,a.onOpen),onBlur:yt(e.onBlur,a.onClose),onTouchStart:yt(e.onTouchStart,o=>o.preventDefault())})})});jle.displayName=wle;var SL="HoverCardPortal",[sgt,agt]=ble(SL,{forceMount:void 0}),Nle=e=>{const{__scopeHoverCard:t,forceMount:r,children:s,container:a}=e,i=jk(SL,t);return n.jsx(sgt,{scope:t,forceMount:r,children:n.jsx(xo,{present:r||i.open,children:n.jsx(O_,{asChild:!0,container:a,children:s})})})};Nle.displayName=SL;var __="HoverCardContent",_le=g.forwardRef((e,t)=>{const r=agt(__,e.__scopeHoverCard),{forceMount:s=r.forceMount,...a}=e,i=jk(__,e.__scopeHoverCard);return n.jsx(xo,{present:s||i.open,children:n.jsx(igt,{"data-state":i.open?"open":"closed",...a,onPointerEnter:yt(e.onPointerEnter,C_(i.onOpen)),onPointerLeave:yt(e.onPointerLeave,C_(i.onClose)),ref:t})})});_le.displayName=__;var igt=g.forwardRef((e,t)=>{const{__scopeHoverCard:r,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:i,onInteractOutside:o,...l}=e,c=jk(__,r),d=wk(r),u=g.useRef(null),h=zr(t,u),[m,f]=g.useState(!1);return g.useEffect(()=>{if(m){const p=document.body;return E4=p.style.userSelect||p.style.webkitUserSelect,p.style.userSelect="none",p.style.webkitUserSelect="none",()=>{p.style.userSelect=E4,p.style.webkitUserSelect=E4}}},[m]),g.useEffect(()=>{if(u.current){const p=()=>{f(!1),c.isPointerDownOnContentRef.current=!1,setTimeout(()=>{var v;((v=document.getSelection())==null?void 0:v.toString())!==""&&(c.hasSelectionRef.current=!0)})};return document.addEventListener("pointerup",p),()=>{document.removeEventListener("pointerup",p),c.hasSelectionRef.current=!1,c.isPointerDownOnContentRef.current=!1}}},[c.isPointerDownOnContentRef,c.hasSelectionRef]),g.useEffect(()=>{u.current&&cgt(u.current).forEach(A=>A.setAttribute("tabindex","-1"))}),n.jsx(L_,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:o,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:yt(i,p=>{p.preventDefault()}),onDismiss:c.onDismiss,children:n.jsx(D_,{...d,...l,onPointerDown:yt(l.onPointerDown,p=>{p.currentTarget.contains(p.target)&&f(!0),c.hasSelectionRef.current=!1,c.isPointerDownOnContentRef.current=!0}),ref:h,style:{...l.style,userSelect:m?"text":void 0,WebkitUserSelect:m?"text":void 0,"--radix-hover-card-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-hover-card-content-available-width":"var(--radix-popper-available-width)","--radix-hover-card-content-available-height":"var(--radix-popper-available-height)","--radix-hover-card-trigger-width":"var(--radix-popper-anchor-width)","--radix-hover-card-trigger-height":"var(--radix-popper-anchor-height)"}})})}),ogt="HoverCardArrow",lgt=g.forwardRef((e,t)=>{const{__scopeHoverCard:r,...s}=e,a=wk(r);return n.jsx(U_,{...a,...s,ref:t})});lgt.displayName=ogt;function C_(e){return t=>t.pointerType==="touch"?void 0:e()}function cgt(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});for(;r.nextNode();)t.push(r.currentNode);return t}var dgt=yle,ugt=jle,hgt=Nle,Cle=_le;const fgt=dgt,mgt=ugt,Sle=g.forwardRef(({className:e,align:t="center",sideOffset:r=4,...s},a)=>n.jsx(hgt,{children:n.jsx(Cle,{ref:a,align:t,sideOffset:r,className:ye("z-[9999] w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none 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",e),...s})}));Sle.displayName=Cle.displayName;function kL({planCredits:e,purchasedCredits:t,totalCredits:r,usedCredits:s,className:a,showDetails:i=!0,onClick:o}){var S;const{balance:l,usage:c,loading:d}=Fc(),u=xr(),h=e??(l==null?void 0:l.plan_credits)??0,m=t??(l==null?void 0:l.purchased_credits)??0,f=s??((S=c==null?void 0:c.month)==null?void 0:S.totalConsumed)??0,p=h+m+f;if(d&&(e===void 0||t===void 0||r===void 0||s===void 0)&&p===0)return null;const v=p>0?f/p*100:0,x=Math.max(0,p-f),b=()=>v>=95?"bg-red-500":v>=80?"bg-yellow-500":"bg-green-500",y=()=>v>=95?"text-red-600":v>=80?"text-yellow-600":"text-green-600",w=()=>{o?o():u("/credits")},j=()=>v>=95?n.jsx(hn,{className:"w-4 h-4 text-red-500"}):v>=80?n.jsx(sa,{className:"w-4 h-4 text-yellow-500"}):n.jsx(en,{className:"w-4 h-4 text-green-500"}),N=()=>v>=95?"bg-gradient-to-br from-red-50 to-red-100 dark:from-red-900/20 dark:to-red-800/30 border-red-200/50":v>
1927=80?"bg-gradient-to-br from-yellow-50 to-orange-100 dark:from-yellow-900/20 dark:to-orange-800/30 border-yellow-200/50":"bg-gradient-to-br from-green-50 to-emerald-100 dark:from-green-900/20 dark:to-emerald-800/30 border-green-200/50",_=n.jsxs("div",{className:ye("space-y-3 p-4 rounded-lg border transition-all duration-300 hover:shadow-sm",N(),a),children:[n.jsxs("div",{className:"flex flex-col items-center text-center space-y-2",children:[n.jsx("div",{className:"flex justify-center",children:j()}),n.jsxs("div",{className:"text-sm font-semibold text-gray-800 dark:text-gray-200",children:[x5(x)," Credits Remaining"]})]}),n.jsxs("div",{className:"relative",children:[n.jsx(Ou,{value:v,className:"h-3 bg-white/60 dark:bg-gray-700/60 rounded-full shadow-inner",indicatorClassName:ye(b(),"transition-all duration-700 ease-out rounded-full shadow-sm",v>=95?"animate-pulse":"")}),v>0&&n.jsx("div",{className:"absolute top-0 left-0 h-full bg-white/30 rounded-full transition-all duration-1000 ease-out",style:{width:`${Math.min(v*.6,60)}%`}})]}),i&&n.jsxs("div",{className:"flex items-center justify-between text-xs",children:[n.jsx("div",{className:"flex items-center gap-4",children:n.jsxs("span",{className:"font-medium text-gray-600 dark:text-gray-300",children:[n.jsx("span",{className:y(),children:x5(f)})," used"]})}),n.jsxs("span",{className:ye("text-xs font-semibold",y()),children:[Math.round(v),"% used"]})]})]});return i?n.jsxs(fgt,{children:[n.jsx(mgt,{asChild:!0,children:n.jsx("button",{onClick:w,className:"w-full text-left hover:opacity-80 transition-opacity",children:_})}),n.jsx(Sle,{className:"w-80 bg-gradient-to-br from-white to-gray-50 dark:from-gray-900 dark:to-gray-800 border shadow-lg z-[9999]",side:"right",align:"start",sideOffset:8,avoidCollisions:!0,collisionPadding:16,children:n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[j(),n.jsx("h4",{className:"text-sm font-bold text-gray-800 dark:text-gray-200",children:"Credit Breakdown"})]}),n.jsxs("span",{className:ye("font-semibold text-sm",y()),children:[Math.round(v),"% used"]})]}),n.jsxs("div",{className:"space-y-3 text-sm",children:[m>0&&n.jsxs("div",{className:"flex justify-between items-center p-2 bg-blue-50 dark:bg-blue-900/20 rounded-lg",children:[n.jsx("span",{className:"text-blue-700 dark:text-blue-300 font-medium",children:"Purchased Credits:"}),n.jsxs("span",{className:"font-bold text-blue-600 dark:text-blue-400",children:["+",Li(m)]})]}),n.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[n.jsxs("div",{className:"p-3 bg-gradient-to-br from-gray-50 to-gray-100 dark:from-gray-800 dark:to-gray-700 rounded-lg text-center",children:[n.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"Total Available"}),n.jsx("div",{className:"font-bold text-gray-800 dark:text-gray-200",children:Li(p)})]}),n.jsxs("div",{className:"p-3 bg-gradient-to-br from-gray-50 to-gray-100 dark:from-gray-800 dark:to-gray-700 rounded-lg text-center",children:[n.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"Used"}),n.jsx("div",{className:ye("font-bold",y()),children:Li(f)})]})]}),n.jsx("div",{className:"p-3 bg-gradient-to-br from-emerald-50 to-green-50 dark:from-emerald-900/20 dark:to-green-900/20 rounded-lg border border-emerald-200/50",children:n.jsxs("div",{className:"flex justify-between items-center",children:[n.jsx("span",{className:"font-semibold text-emerald-800 dark:text-emerald-200",children:"Remaining:"}),n.jsx("span",{className:ye("font-bold text-lg",y()),children:x5(x)})]})})]}),v>=80&&n.jsx("div",{className:ye("p-3 rounded-lg border-l-4 transition-all duration-300",v>=95?"bg-red-50 dark:bg-red-900/20 border-red-400 text-red-800 dark:text-red-200":"bg-yellow-50 dark:bg-yellow-900/20 border-yellow-400 text-yellow-800 dark:text-yellow-200"),children:n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx(hn,{className:"w-4 h-4 mt-0.5 flex-shrink-0"}),n.jsx("p",{className:"text-xs font-medium leading-relaxed",children:v>=95?"You're almost out of credits. Consider purchasing more to continue creating content.":"You're running low on credits. Plan your usage or purchase more to avoid interruptions."})]})})]})})]}):n.jsx("button",{onClick:w,className:"w-full text-left hover:opacity-80 transition-opacity",children:_})}var EL="Radio",[pgt,kle]=Ki(EL),[Agt,ggt]=pgt(EL),Ele=g.forwardRef((e,t)=>
vendor: 2,802 bytes, line 1927
1927{const{__scopeRadio:r,name:s,checked:a=!1,required:i,disabled:o,value:l="on",onCheck:c,form:d,...u}=e,[h,m]=g.useState(null),f=zr(t,v=>m(v)),p=g.useRef(!1),A=h?d||!!h.closest("form"):!0;return n.jsxs(Agt,{scope:r,checked:a,disabled:o,children:[n.jsx(sr.button,{type:"button",role:"radio","aria-checked":a,"data-state":Ile(a),"data-disabled":o?"":void 0,disabled:o,value:l,...u,ref:f,onClick:yt(e.onClick,v=>{a||c==null||c(),A&&(p.current=v.isPropagationStopped(),p.current||v.stopPropagation())})}),A&&n.jsx(Ple,{control:h,bubbles:!p.current,name:s,value:l,checked:a,required:i,disabled:o,form:d,style:{transform:"translateX(-100%)"}})]})});Ele.displayName=EL;var Ble="RadioIndicator",Tle=g.forwardRef((e,t)=>{const{__scopeRadio:r,forceMount:s,...a}=e,i=ggt(Ble,r);return n.jsx(xo,{present:s||i.checked,children:n.jsx(sr.span,{"data-state":Ile(i.checked),"data-disabled":i.disabled?"":void 0,...a,ref:t})})});Tle.displayName=Ble;var xgt="RadioBubbleInput",Ple=g.forwardRef(({__scopeRadio:e,control:t,checked:r,bubbles:s=!0,...a},i)=>{const o=g.useRef(null),l=zr(o,i),c=Fy(r),d=I_(t);return g.useEffect(()=>{const u=o.current;if(!u)return;const h=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(h,"checked").set;if(c!==r&&f){const p=new Event("click",{bubbles:s});f.call(u,r),u.dispatchEvent(p)}},[c,r,s]),n.jsx(sr.input,{type:"radio","aria-hidden":!0,defaultChecked:r,...a,tabIndex:-1,ref:l,style:{...a.style,...d,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});Ple.displayName=xgt;function Ile(e){return e?"checked":"unchecked"}var vgt=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Nk="RadioGroup",[bgt]=Ki(Nk,[M_,kle]),Ole=M_(),Fle=kle(),[ygt,wgt]=bgt(Nk),Lle=g.forwardRef((e,t)=>{const{__scopeRadioGroup:r,name:s,defaultValue:a,value:i,required:o=!1,disabled:l=!1,orientation:c,dir:d,loop:u=!0,onValueChange:h,...m}=e,f=Ole(r),p=Xg(d),[A,v]=lo({prop:i,defaultProp:a??null,onChange:h,caller:Nk});return n.jsx(ygt,{scope:r,name:s,required:o,disabled:l,value:A,onValueChange:v,children:n.jsx(qG,{asChild:!0,...f,orientation:c,dir:p,loop:u,children:n.jsx(sr.div,{role:"radiogroup","aria-required":o,"aria-orientation":c,"data-disabled":l?"":void 0,dir:p,...m,ref:t})})})});Lle.displayName=Nk;var Dle="RadioGroupItem",Rle=g.forwardRef((e,t)=>{const{__scopeRadioGroup:r,disabled:s,...a}=e,i=wgt(Dle,r),o=i.disabled||s,l=Ole(r),c=Fle(r),d=g.useRef(null),u=zr(t,d),h=i.value===a.value,m=g.useRef(!1);return g.useEffect(()=>{const f=A=>{vgt.includes(A.key)&&(m.current=!0)},p=()=>m.current=!1;return document.addEventListener("keydown",f),document.addEventListener("keyup",p),()=>{document.removeEventListener("keydown",f),document.removeEventListener("keyup",p)}},[]),n.jsx(KG,{asChild:!0,...l,focusable:!o,active:h,children:n.jsx(Ele,{disabled:o,required:i.required,
1927checked:h,...c,...a,name:i.name,ref:u,onCheck:()=>i.onValueChange(a.value),onKeyDown:yt(f=>{f.key==="Enter"&&f.preventDefault()}),onFocus:yt(a.onFocus,()=>{var f;m.current&&((f=d.current)==null||f.click())})})})});Rle.displayName=Dle;var jgt="RadioGroupIndicator",Ule=g.forwardRef((e,t)=>{const{__scopeRadioGroup:r,...s}=e,a=Fle(r);return n.jsx(Tle,{...a,...s,ref:t})});Ule.displayName=jgt;var Mle=Lle,$le=Rle,Ngt=Ule;const BL=g.forwardRef(({className:e,...t},r)=>n.jsx(Mle,{className:ye("grid gap-2",e),...t,ref:r}));BL.displayName=Mle.displayName;const S_=g.forwardRef(({className:e,...t},r)=>n.jsx($le,{ref:r,className:ye("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:n.jsx(Ngt,{className:"flex items-center justify-center",children:n.jsx(vK,{className:"h-2.5 w-2.5 fill-current text-current"})})}));S_.displayName=$le.displayName;function _gt({open:e,onOpenChange:t,onSuccess:r}){const{costs:s,purchaseCredits:a}=Fc(),[i,o]=g.useState(null),[l,c]=g.useState(!1),d=(s==null?void 0:s.packages)||[{credits:1e3,price:10,label:"1,000 credits",popular:!1},{credits:5e3,price:40,label:"5,000 credits",popular:!0},{credits:1e4,price:70,label:"10,000 credits",popular:!1},{credits:25e3,price:150,label:"25,000 credits",popular:!1}],u=async()=>{if(i){c(!0);try{const m=await a(i);window.location.href=m,r==null||r()}catch(m){console.error("Error purchasing credits:",m),VP.error(m instanceof Error?m.message:"Failed to initiate purchase. Please try again.")}finally{c(!1)}}},h=d.find(m=>m.credits===i);return n.jsx(Zt,{open:e,onOpenChange:t,children:n.jsxs(Jt,{className:"sm:max-w-[600px]",children:[n.jsxs(_r,{children:[n.jsxs(tr,{className:"flex items-center gap-2",children:[n.jsx(en,{className:"h-5 w-5"}),"Purchase Credits"]}),n.jsx(Hr,{children:"Select a credit package to continue using all features. Credits never expire."})]}),n.jsxs("div",{className:"grid gap-4 py-4",children:[n.jsx(BL,{value:i==null?void 0:i.toString(),onValueChange:m=>o(parseInt(m)),children:d.map(m=>n.jsxs(Te,{className:ye("relative cursor-pointer transition-all",i===m.credits&&"border-primary ring-2 ring-primary",m.popular&&"border-blue-200 dark:border-blue-900"),onClick:()=>o(m.credits),children:[m.popular&&n.jsx(Be,{className:"absolute -top-2 right-4 bg-blue-500 text-white",variant:"default",children:"Most Popular"}),n.jsx(st,{className:"pb-3",children:n.jsxs("div",{className:"flex items-start justify-between",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(S_,{value:m.credits.toString()}),n.jsxs("div",{children:[n.jsxs("h3",{className:"font-semibold text-lg",children:[Li(m.credits)," Credits"]}),n.jsxs("p",{className:"text-sm text-muted-foreground",children:["$",(m.price/m.credits*1e3).toFixed(2)," per 1,000 credits"]})]})]}),n.jsxs("div",{className:"text-right",children:[n.jsxs("p",{className:"text-2xl font-bold",children:["$",m.price]}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"one-time"})]})]})}),n.jsx(Re,{children:n.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[n.jsx(Gn,{className:"h-4 w-4 text-green-500"}),n.jsx("span",{children:"Credits never expire"})]})})]},m.credits))}),n.jsxs(Te,{className:"bg-muted/50",children:[n.jsx(st,{className:"pb-3",children:n.jsx(Wr,{children:"What can you do with credits?"})}),n.jsx(Re,{children:n.jsxs("ul",{className:"space-y-2 text-sm",children:[n.jsxs("li",{className:"flex items-start gap-2",children:[n.jsx("span",{className:"text-muted-foreground",children:"•"}),n.jsxs("span",{children:[n.jsx("strong",{children:"Content Generation:"})," Create 10 pieces of content per 1,000 credits"]})]}),n.jsxs("li",{className:"flex items-start gap-2",children:[n.jsx("span",{className:"text-muted-foreground",children:"•"}),n.jsxs("span",{children:[n.jsx("strong",{children:"AI Images:"})," Generate 10 images per 1,000 credits"]})]}),n.jsxs("li",{className:"flex items-start gap-2",children:[n.jsx("span",{className:"text-muted-foreground",children:"•"}),n.jsxs("span",{children:[n.jsx("strong",{children:"Stock Media:"})," Search 100 stock images or 10 videos per 1,000 credits"]})]})]})})]})]}),n.jsx(Sn,{children:n.jsxs("div",{className:"flex items-center justify-between w-full",children:[n.jsx("div",{children:h&&n.jsxs("p",{className:"text-sm text-muted-foreground",children:["Total: ",n.jsxs("span",{className:"font-semibold text-foreground",children:["$",h.price]})]})}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx(te,{variant:"outline",onClick:()=>t(!1),disabled:l,children:"Cancel"}),n.jsxs(te,{onClick:u,disabled:!i||l,children:[l&&n.jsx(kt,{className:"mr-2 h-4 w-4 animate-spin"}),l?"Processing...":"Purchase Credits"]})]})]})})]})})}function Qle(){const[e,t]=g.useState(!1),[r,s]=g.useState(!1),{balance:a,loading:i,fetchBalance:o}=Fc(),{refresh:l}=o0();g.useEffect(()=>{o()},[]);const c=async()=>{try{t(!0);const{data:h}=await de.rpc("get_personal_account");if(!(h!=null&&h.account_id))throw new Error("No account found");const m=await de.auth.getSession();if(!m.data.session)throw new Error("No session found");const A=await(await fetch("https://worker.rainfactory.ai/billing-functions/get_billing_portal_url",{method:"POST",headers:{Authorization:`Bearer ${m.data.session.access_token}`},body:JSON.stringify({account_id:h.account_id,return_url:`${window.location.origin}/settings`})})).json();console.log("Got billing portal url",A),A!=null&&A.url&&(window.location.href=A.url)}catch(h){console.error("Error accessing billing portal:",h)}finally{t(!1)}},u=((a==null?void 0:a.total_credits)||0)-(((a==null?void 0:a.plan_credits)||0)+((a==null?void 0:a.purchased_credits)||0));return n.jsxs("div",{className:"space-y-6 pt-8 px-8",children:[n.jsxs("div",{children:[n.jsx("h2",{className:"text-2xl font-bold mb-2",children:"Billing & Credits"}),n.jsx("p",{className:"text-muted-foreground",children:"Manage your subscription, credits, and payment methods"})]}),n.jsxs(Te,{children:[n.jsxs(st,{children:[n.jsxs(ot,{className:"flex items-center gap-2",children:[n.jsx(en,{className:"h-5 w-5"}),"Credit Balance"]}),n.jsx(Wr,{children:"Your current credit usage and balance"})]}),n.jsx(Re,{className:"space-y-4",children:!i&&a?n.jsxs(n.Fragment,{children:[n.jsx(kL,{planCredits:a.plan_credits,purchasedCredits:a.purchased_credits,totalCredits:a.total_credits,usedCredits:u,showDetail
1927s:!0}),n.jsxs("div",{className:"flex flex-wrap gap-2 pt-2",children:[n.jsxs(te,{variant:"default",onClick:()=>s(!0),children:[n.jsx(CI,{className:"mr-2 h-4 w-4"}),"Purchase Credits"]}),n.jsx(te,{variant:"outline",asChild:!0,children:n.jsxs(Ir,{to:"/settings/billing/credits",children:[n.jsx(sa,{className:"mr-2 h-4 w-4"}),"View Usage Details"]})})]})]}):n.jsx("div",{className:"flex items-center justify-center py-8",children:n.jsx(kt,{className:"h-8 w-8 animate-spin text-muted-foreground"})})})]}),n.jsxs(Te,{children:[n.jsxs(st,{children:[n.jsxs(ot,{className:"flex items-center gap-2",children:[n.jsx(sg,{className:"h-5 w-5"}),"Subscription & Payment Methods"]}),n.jsx(Wr,{children:"Manage your subscription plan and payment information"})]}),n.jsxs(Re,{className:"space-y-4",children:[n.jsxs(te,{onClick:c,disabled:e,children:[e&&n.jsx(kt,{className:"mr-2 h-4 w-4 animate-spin"}),"Manage Subscription"]}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"You'll be redirected to the secure billing portal to manage your subscription, payment methods, and view invoice history."})]})]}),n.jsx(_gt,{open:r,onOpenChange:s,onSuccess:()=>{o(),l()}})]})}function Cgt({featureName:e,redirectTo:t=`/plan-upgrade/${e}`,children:r}){const{isFeatureAvailable:s,loading:a}=lC(),i=Gs();return a?n.jsx("div",{className:"flex items-center justify-center min-h-screen w-full",children:"Loading..."}):s(e)?n.jsx(n.Fragment,{children:r}):n.jsx(pu,{to:t,state:{from:i.pathname},replace:!0})}const Hle=()=>{const{brands:e}=mn(),[t,r]=g.useState([]),[s,a]=g.useState([]),[i,o]=g.useState(!0),[l,c]=g.useState(""),[d,u]=g.useState(""),[h,m]=g.useState(""),[f,p]=g.useState("viewer"),[A,v]=g.useState([]),[x,b]=g.useState(!1),[y,w]=g.useState(new Set),[j,N]=g.useState(!1),[_,S]=g.useState(new Set),[C,E]=g.useState(new Map),[T,B]=g.useState(new Map),[L,P]=g.useState(new Map),[F,M]=g.useState(null),{toast:I}=sn();g.useEffect(()=>{(async()=>{const{data:{user:ne}}=await de.auth.getUser();ne&&M(ne.id),await V(),$(),R()})()},[]);const $=async()=>{try{o(!0);const{data:{user:X}}=await de.auth.getUser();if(!X)return;const{data:ne,error:ae}=await de.from("brands").select("id, brand_name, account_id").neq("status","DELETED").order("brand_name");if(ae)throw ae;const J=new Map;for(const W of ne||[]){const{data:ie}=await de.from("brand_access").select("user_id, access_level").eq("brand_id",W.id);let he=[];if(W.account_id){const{data:xe}=await de.schema("basejump").from("account_user").select("user_id, account_role").eq("account_id",W.account_id);he=xe||[]}const ee=new Set([...(ie==null?void 0:ie.map(xe=>xe.user_id))||[],...he.map(xe=>xe.user_id)]);if(ee.size>0){const{data:xe}=await de.schema("marketing_and_customer_success").from("profiles").select("id, email, full_name").in("id",Array.from(ee)),{data:we}=await de.from("profiles").select("id, first_name, last_name").in("id",Array.from(ee)),Se=new Map;for(const pe of ee){const Ce=xe==null?void 0:xe.find(re=>re.id===pe);if(!(Ce!=null&&Ce.email)){const{data:re}=await de.rpc("get_user_email",{user_id:pe});re&&Se.set(pe,re)}}ee.forEach(pe=>{const Ce=xe==null?void 0:xe.find(Ee=>Ee.id===pe),re=we==null?void 0:we.find(Ee=>Ee.id===pe),se=(Ce==null?void 0:Ce.email)||Se.get(pe)||"";if(!Ce&&!re&&!se)return;const Ae=ie==null?void 0:ie.find(Ee=>Ee.user_id===pe),Pe=he.find(Ee=>Ee.user_id===pe);let Oe="member";Ae?Oe=Ae.access_level:Pe&&(Oe=Pe.account_role);const be=(Ce==null?void 0:Ce.full_name)||(re!=null&&re.first_name&&(re!=null&&re.last_name)?`${re.first_name} ${re.last_name}`:null)||(re==null?void 0:re.first_name)||(re==null?void 0:re.last_name)||se||"Unknown User";J.has(pe)||J.set(pe,{user_id:pe,email:se,name:be,brands:[]}),J.get(pe).brands.push({brand_id:W.id,brand_name:W.brand_name,access_level:Oe})})}}r(Array.from(J.values()).sort((W,ie)=>W.email.localeCompare(ie.email)))}catch(X){console.error("Error fetching users:",X),I({title:"Error",description:"Failed to load users",variant:"destructive"})}finally{o(!1)}},V=async()=>{try{const{data:X,error:ne}=await de.rpc("get_user_owned_brands");if(ne){console.error("Error fetching owned brands:",ne);return}const ae=Array.isArray(X)?X:[],J=ae.length>0?Array.from(new Map(ae.map(W=>[W.brand_id,W])).values()):[];v(J),J.length>0&&m(J[0].brand_id)}catch(X){console.error("Error in fetchOwnedBrands:",X)}},R=async()=>{try{const X="https://worker.rainfactory.ai",ne=await de.auth.getSession();if(!ne.data.session)return;const ae=[];for(const J of e)try{const W=await fetch(`${X}/rainfactory/brands/${J.id}/invitations`,{headers:{Authorization:`Bearer ${ne.data.session.access_token}`}});if(W.ok){const{data:ie}=await W.json();ie&&Array.isArray(ie)&&ie.forEach(he=>{ae.push({id:he.id,email:he.email,message:he.message,created_at:he.created_at,expires_at:he.expires_at,inviter_email:he.inviter_email,inviter_name:he.inviter_name,brand_id:J.id,brand_name:J.brand_name})})}}catch(W){console.error(`Error fetching invitations for brand ${J.id}:`,W)}a(ae)}catch(X){console.error("Error fetching invitations:",X)}},Q=async X=>{S(ne=>new Set(ne).add(X.id));try{const ne=await de.auth.getSession();if(!ne.data.session)return;const J=await fetch(`https://worker.rainfactory.ai/rainfactory/brands/${X.brand_id}/invitations/${X.id}`,{method:"DELETE",headers:{Authorization:`Bearer ${ne.data.session.access_token}`}});if(!J.ok){const W=await J.json();throw new Error(W.error||"Failed to cancel invitation")}I({title:"Success",description:`Invitation to ${X.email} has been cancelled.`}),a(W=>W.filter(ie=>ie.id!==X.id)),setTimeout(()=>{R()},500)}catch(ne){console.error("Error cancelling invitation:",ne),I({title:"Error",description:ne instanceof Error?ne.message:"Failed to cancel invitation",variant:"destructive"})}finally{S(ne=>{const ae=new Set(ne);return ae.delete(X.id),ae})}},U=async()=>
1927{if(!l){I({title:"Error",description:"Please enter an email address",variant:"destructive"});return}if(!h){I({title:"Error",description:"Please select a brand to grant initial access to",variant:"destructive"});return}N(!0);try{const X=await de.auth.getSession();if(!X.data.session)return;const ne=A.find(W=>W.brand_id===h);if(!ne){I({title:"Error",description:"Selected brand not found",variant:"destructive"});return}const J=await fetch(`https://worker.rainfactory.ai/rainfactory/brands/${h}/invite`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${X.data.session.access_token}`},body:JSON.stringify({action:"create-invitation",email:l,access_level:f,message:d||"You've been invited to join Rainfactory. After signing up, you'll be granted access to collaborate on various brands."})});if(!J.ok){const W=await J.json();throw new Error(W.error||"Failed to send invitation")}I({title:"Success",description:`Invitation sent to ${l}. They will have ${f} access to ${ne.brand_name}.`}),c(""),u(""),p("viewer"),b(!1),setTimeout(()=>{$(),R()},1e3)}catch(X){console.error("Error sending invitation:",X),I({title:"Error",description:X instanceof Error?X.message:"Failed to send invitation",variant:"destructive"})}finally{N(!1)}},D=X=>{const ne=new Set(y);ne.has(X)?ne.delete(X):ne.add(X),w(ne)},q=async X=>{var ne;b(X),X?await V():(c(""),u(""),p("viewer"),m(((ne=A[0])==null?void 0:ne.brand_id)||""))},G=async(X,ne,ae="viewer")=>{E(J=>{const W=new Map(J),ie=W.get(X)||new Set;return ie.add(ne),W.set(X,ie),W});try{const J=await de.auth.getSession();if(!J.data.session)return;const W=A.find(xe=>xe.brand_id===ne);if(!W)return;const ie=t.find(xe=>xe.user_id===X);if(!ie)return;const ee=await fetch(`https://worker.rainfactory.ai/rainfactory/brands/${ne}/access`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${J.data.session.access_token}`},body:JSON.stringify({action:"grant-access",email:ie.email,access_level:ae})});if(!ee.ok){const xe=await ee.json();throw new Error(xe.error||"Failed to grant access")}I({title:"Success",description:`Granted ${ie.name} access to ${W.brand_name}`}),await $()}catch(J){console.error("Error granting access:",J),I({title:"Error",description:J instanceof Error?J.message:"Failed to grant access",variant:"destructive"})}finally{E(J=>{const W=new Map(J),ie=W.get(X);return ie&&(ie.delete(ne),ie.size===0?W.delete(X):W.set(X,ie)),W})}},Y=async(X,ne)=>{B(ae=>{const J=new Map(ae),W=J.get(X)||new Set;return W.add(ne),J.set(X,W),J});try{const ae=await de.auth.getSession();if(!ae.data.session)return;const J=A.find(ee=>ee.brand_id===ne);if(!J)return;const W=t.find(ee=>ee.user_id===X);if(!W)return;const he=await fetch(`https://worker.rainfactory.ai/rainfactory/brands/${ne}/access/${X}`,{method:"DELETE",headers:{Authorization:`Bearer ${ae.data.session.access_token}`}});if(!he.ok){const ee=await he.json();throw new Error(ee.error||"Failed to revoke access")}I({title:"Success",description:`Revoked ${W.name}'s access to ${J.brand_name}`}),await $()}catch(ae){console.error("Error revoking access:",ae),I({title:"Error",description:ae instanceof Error?ae.message:"Failed to revoke access",variant:"destructive"})}finally{B(ae=>{const J=new Map(ae),W=J.get(X);return W&&(W.delete(ne),W.size===0?J.delete(X):J.set(X,W)),J})}},K=async(X,ne,ae)=>{P(J=>{const W=new Map(J),ie=W.get(X)||new Set;return ie.add(ne),W.set(X,ie),W});try{const J=await de.auth.getSession();if(!J.data.session)return;const W=A.find(xe=>xe.brand_id===ne);if(!W)return;const ie=t.find(xe=>xe.user_id===X);if(!ie)return;const ee=await fetch(`https://worker.rainfactory.ai/rainfactory/brands/${ne}/access/${X}`,{method:"PATCH",headers:{"Content-Type":"application/json",Authorization:`Bearer ${J.data.session.access_token}`},body:JSON.stringify({access_level:ae})});if(!ee.ok){const xe=await ee.json();throw new Error(xe.error||"Failed to update access level")}I({title:"Success",description:`Updated ${ie.name}'s access level to ${ae} for ${W.brand_name}`}),await $()}catch(J){console.error("Error updating access level:",J),I({title:"Error",description:J instanceof Error?J.message:"Failed to update access level",variant:"destructive"})}finally{P(J=>{const W=new Map(J),ie=W.get(X);return ie&&(ie.delete(ne),ie.size===0?W.delete(X):W.set(X,ie)),W})}};return i&&t.length===0?n.jsx("div",{className:"flex items-center justify-center p-8",children:"Loading users..."}):n.jsxs("div",{className:"space-y-6",children:[n.jsxs(Te,{children:[n.jsxs(st,{children:[n.jsx(ot,{children:"User Management"}),n.jsx(Wr,{children:"View all users in your organization and their brand access. To manage access for a specific brand, visit that brand's settings."})]}),n.jsx(Re,{children:n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsxs("h3",{className:"text-lg font-medium flex items-center gap-2",children:[n.jsx(Ka,{className:"h-5 w-5"}),"Platform Users (",t.length,")"]}),n.jsxs(Zt,{open:x,onOpenChange:q,children:[n.jsx(aC,{asChild:!0,children:n.jsxs(te,{children:[n.jsx(sbe,{className:"h-4 w-4 mr-2"}),"Invite New User"]})}),n.jsxs(Jt,{children:[n.jsxs(_r,{children:[n.jsx(tr,{children:"Invite User to Rainfactory"}),n.jsx(Hr,{children:"Send an invitation for a new user to join the platform. Select which brand they should have initial access to."})]}),n.jsxs("div",{className:"space-y-4 py-4",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"email",children:"Email Address"}),n.jsx(qe,{id:"email",type:"email",placeholder:"[email protected]",value:l,onCh
1927ange:X=>c(X.target.value)})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"brand",children:"Initial Brand Access"}),n.jsxs(ur,{value:h,onValueChange:m,children:[n.jsx(or,{id:"brand",children:n.jsx(hr,{placeholder:"Select a brand"})}),n.jsx(lr,{children:A.length===0?n.jsx("div",{className:"p-2 text-sm text-muted-foreground",children:"You need to be an owner of at least one brand to invite users."}):A.map(X=>n.jsx(Fe,{value:X.brand_id,children:X.brand_name},X.brand_id))})]})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"access-level",children:"Access Level"}),n.jsxs(ur,{value:f,onValueChange:X=>p(X),children:[n.jsx(or,{id:"access-level",children:n.jsx(hr,{placeholder:"Select access level"})}),n.jsxs(lr,{children:[n.jsx(Fe,{value:"owner",children:"Owner"}),n.jsx(Fe,{value:"editor",children:"Editor"}),n.jsx(Fe,{value:"viewer",children:"Viewer"})]})]}),n.jsxs("p",{className:"text-xs text-muted-foreground",children:[f==="owner"&&"Full control over the brand including user management",f==="editor"&&"Can view and edit brand content but cannot manage users",f==="viewer"&&"Can view brand content but cannot make changes"]})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"message",children:"Message (optional)"}),n.jsx(Zr,{id:"message",placeholder:"Add a personal message to the invitation...",value:d,onChange:X=>u(X.target.value),rows:3})]})]}),n.jsxs(Sn,{children:[n.jsx(te,{variant:"outline",onClick:()=>b(!1),disabled:j,children:"Cancel"}),n.jsx(te,{onClick:U,disabled:j||!l||!h||A.length===0,children:j?"Sending...":"Send Invitation"})]})]})]})]}),t.length===0?n.jsxs("div",{className:"text-center py-8 border rounded-lg",children:[n.jsx(Ka,{className:"h-12 w-12 mx-auto text-muted-foreground mb-2"}),n.jsx("p",{className:"text-muted-foreground",children:"No users yet."}),n.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Invite users to collaborate on your brands."})]}):n.jsx("div",{className:"space-y-2",children:t.map(X=>n.jsx(cle,{open:y.has(X.user_id),onOpenChange:()=>D(X.user_id),children:n.jsxs("div",{className:"border rounded-lg",children:[n.jsx(dle,{className:"w-full",children:n.jsxs("div",{className:"flex items-center justify-between p-4 hover:bg-muted/50 transition-colors",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[y.has(X.user_id)?n.jsx(Un,{className:"h-4 w-4"}):n.jsx(_s,{className:"h-4 w-4"}),n.jsxs("div",{className:"text-left",children:[n.jsx("p",{className:"font-medium",children:X.name}),n.jsx("p",{className:"text-sm text-muted-foreground",children:X.email})]})]}),n.jsxs(Be,{variant:"outline",children:[X.brands.length," brand",X.brands.length!==1?"s":""]})]})}),n.jsx(ule,{children:n.jsxs("div",{className:"px-4 pb-4 pt-2 space-y-2",children:[n.jsx("p",{className:"text-sm font-medium text-muted-foreground mb-2",children:"Brand Access:"}),X.brands.length===0?n.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No brand access"}):X.brands.map(ne=>n.jsxs("div",{className:"flex items-center gap-3 p-3 bg-muted/50 rounded-md",children:[n.jsx(zh,{className:"h-4 w-4 text-muted-foreground"}),n.jsx("div",{className:"flex-1",children:n.jsx("p",{className:"font-medium text-sm",children:ne.brand_name})}),n.jsx(Be,{variant:ne.access_level==="owner"?"default":"secondary",className:"text-xs",children:ne.access_level==="member"?"editor":ne.access_level})]},ne.brand_id)),A.length>0&&X.user_id!==F&&n.jsxs("div",{className:"mt-3 pt-3 border-t",children:[n.jsx("p",{className:"text-sm font-medium text-muted-foreground mb-2",children:"Manage Access for Your Brands:"}),n.jsx("div",{className:"space-y-2",children:A.map(ne=>{var ee,xe,we;const ae=X.brands.find(Se=>Se.brand_id===ne.brand_id),J=!!ae,W=(ee=C.get(X.user_id))==null?void 0:ee.has(ne.brand_id),ie=(xe=T.get(X.user_id))==null?void 0:xe.has(ne.brand_id),he=(we=L.get(X.user_id))==null?void 0:we.has(ne.brand_id);return n.jsxs("div",{className:"flex items-center justify-between p-2 rounded-md bg-muted/30",children:[n.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[n.jsx(zh,{className:"h-3 w-3 text-muted-foreground"}),n.jsx("span",{className:"text-sm",children:ne.brand_name})]}),J?n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs(ur,{value:ae.access_level,onValueChange:Se=>K(X.user_id,ne.brand_id,Se),disabled:he,children:[n.jsx(or,{className:"h-7 w-24 text-xs",children:n.jsx(hr,{})}),n.jsxs(lr,{children:[n.jsx(Fe,{value:"owner",children:"Owner"}),n.jsx(Fe,{value:"editor",children:"Editor"}),n.jsx(Fe,{value:"viewer",children:"Viewer"})]})]}),n.jsx(te,{size:"sm",variant:"ghost",className:"h-7 text-xs",onClick:()=>Y(X.user_id,ne.brand_id),disabled:ie,children:ie?n.jsx("div",{className:"animate-spin h-3 w-3 border-2 border-current border-t-transparent roun
1927ded-full"}):n.jsxs(n.Fragment,{children:[n.jsx(yB,{className:"h-3 w-3 mr-1"}),"Revoke"]})})]}):n.jsxs(ll,{children:[n.jsx(cl,{asChild:!0,children:n.jsx(te,{size:"sm",variant:"ghost",className:"h-7 text-xs",disabled:W,children:W?n.jsx("div",{className:"animate-spin h-3 w-3 border-2 border-current border-t-transparent rounded-full"}):n.jsxs(n.Fragment,{children:[n.jsx(al,{className:"h-3 w-3 mr-1"}),"Grant Access"]})})}),n.jsxs(fo,{align:"end",children:[n.jsx(Am,{className:"text-xs",children:"Select Access Level"}),n.jsx(Mo,{}),n.jsx(Fr,{className:"text-xs",onClick:()=>G(X.user_id,ne.brand_id,"owner"),children:"Owner"}),n.jsx(Fr,{className:"text-xs",onClick:()=>G(X.user_id,ne.brand_id,"editor"),children:"Editor"}),n.jsx(Fr,{className:"text-xs",onClick:()=>G(X.user_id,ne.brand_id,"viewer"),children:"Viewer"})]})]})]},ne.brand_id)})})]})]})})]})},X.user_id))})]}),s.length>0&&n.jsxs("div",{children:[n.jsxs("h3",{className:"text-lg font-medium flex items-center gap-2 mb-4",children:[n.jsx(Cu,{className:"h-5 w-5"}),"Pending Invitations (",s.length,")"]}),n.jsx("div",{className:"space-y-2",children:s.map(X=>n.jsxs("div",{className:"flex items-center justify-between p-4 border rounded-lg bg-amber-50 dark:bg-amber-900/20",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(nr,{className:"h-5 w-5 text-amber-600"}),n.jsxs("div",{children:[n.jsx("p",{className:"font-medium",children:X.email}),n.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Invited by ",X.inviter_name," •",X.brand_name&&`To ${X.brand_name} • `,"Expires ",new Date(X.expires_at).toLocaleDateString()]})]})]}),n.jsx(te,{variant:"ghost",size:"sm",onClick:()=>Q(X),disabled:_.has(X.id),className:"h-8 w-8 p-0",title:"Cancel invitation",children:_.has(X.id)?n.jsx("div",{className:"animate-spin h-4 w-4 border-2 border-current border-t-transparent rounded-full"}):n.jsx(kr,{className:"h-4 w-4"})})]},X.id))})]})]})})]}),n.jsxs(Te,{children:[n.jsx(st,{children:n.jsxs(ot,{className:"text-base flex items-center gap-2",children:[n.jsx(Gh,{className:"h-4 w-4"}),"About User Management"]})}),n.jsx(Re,{children:n.jsxs("div",{className:"space-y-2 text-sm text-muted-foreground",children:[n.jsxs("p",{children:["• ",n.jsx("strong",{children:"Platform Users:"})," All users who have access to any brands in your organization."]}),n.jsxs("p",{children:["• ",n.jsx("strong",{children:"Brand Access:"})," Shows which brands each user can access and their role."]}),n.jsxs("p",{children:["• ",n.jsx("strong",{children:"Managing Access:"})," For brands you own, you can grant or revoke access directly from this page. For other brands, visit that brand's settings page."]}),n.jsxs("p",{children:["• ",n.jsx("strong",{children:"Invitations:"})," New users will receive an email invitation to join the platform. After signing up, you can grant them access to specific brands."]})]})})]})]})},Sgt=()=>n.jsx(Cgt,{featureName:"teams",children:n.jsx(Hle,{})}),kgt=()=>{const[e,t]=g.useState(0),r=h2e(),s=d=>({numCards:6,cols:d>=1024?3:d>=640?2:1,xBase:40,yBase:60,xStep:210,yStep:230}),a=d=>{const{numCards:u,cols:h,xBase:m,yBase:f,xStep:p,yStep:A}=d,v=Math.ceil(u/h);let x=[];for(let w=0;w<v;w++)for(let j=0;j<h;j++)w*h+j<u&&x.push({x:m+j*p,y:f+w*A});const y=x.sort(()=>Math.random()-.5).slice(0,4);return y.push(y[0]),{x:y.map(w=>w.x),y:y.map(w=>w.y),scale:Array(y.length).fill(1.2),transition:{duration:y.length*2,repeat:1/0,ease:[.4,0,.2,1],times:y.map((w,j)=>j/(y.length-1))}}};g.useEffect(()=>{t(window.innerWidth);const d=()=>t(window.innerWidth);return window.addEventListener("resize",d),()=>window.removeEventListener("resize",d)},[]),g.useEffect(()=>{const d=s(e);r.start(a(d))},[e,r]);const i={hidden:{opacity:0,scale:.95},visible:{opacity:1,scale:1,transition:{duration:.5}}},o={hidden:{y:20,opacity:0},visible:d=>({y:0,opacity:1,transition:{delay:d*.1,duration:.4}})},l={animate:{boxShadow:["0 0 20px rgba(59, 130, 246, 0.2)","0 0 35px rgba(59, 130, 246, 0.4)","0 0 20px rgba(59, 130, 246, 0.2)"],scale:[1,1.1,1],transition:{duration:1,repeat:1/0,ease:"easeInOut"}}},c=s(e);return n.jsx(ut.div,{className:"w-full mx-auto p-6",variants:i,initial:"hidden",animate:"visible",children:n.jsxs("div",{className:"relative overflow-hidden rounded-lg bg-gradient-to-br from-gray-50 to-gray-100 p-8",children:[n.jsx(ut.div,{className:"absolute z-10 pointer-events-none",animate:r,style:{left:24,top:24},children:n.jsx(ut.div,{className:"bg-blue-500/20 p-3 rounded-full backdrop-blur-sm",variants:l,animate:"animate",children:n.jsx("svg",{className:"w-6 h-6 text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})})}),n.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:[...Array(c.numCards)].map((d,u)=>n.jsxs(ut.div,{variants:o,initial:"hidden",animate:"visible",custom:u,whileHover:{scale:1.02},className:"bg-white/80 rounded-lg p-4",children:[n.jsx(ut.div,{className:"h-32 bg-gray-200/90 rounded-md mb-3",animate:{background:["#f3f4f6","#e5e7eb","#f3f4f6"]},transition:{duration:1.5,repeat:1/0}}),n.jsx(ut.div,{className:"h-3 w-3/4 bg-gray-200/90 rounded mb-2",animate:{background:["#f3f4f6","#e5e7eb","#f3f4f6"]},transition:{duration:1.5,repeat:1/0}}),n.jsx(ut.div,{className:"h-3 w-1/2 bg-gray-200/90 rounded",animate:{background:["#f3f4f6","#e5e7eb","#f3f4f6"]},transition:{duration:1.5,repeat:1/0}})]},u))})]})})};function zle({featureName:e,description:t,className:r=""}){const s=xr(),a=`The ${e} feature is not available on your current plan. Upgrade to a higher tier plan to access this feature.`;return n.jsxs("div",{className:"relative min-h-[600px] w-full",children:[n.jsx("div",{className:"absolute inset-0 w-full h-full flex items-center justify-center overflow-hidden",children:n.jsx("div",{className:"w-full transform scale-110",children:n.jsx(kgt,{})})}),n.jsx("div",{className:"absolute inset-0 bg-white/20 backdrop-blur-sm"}),n.jsx("div",{className:"relative z-10",children:n.jsxs(Te,{className:`w-full max-w-3xl mx-auto my-12 bg-white ${r}`,children:[n.jsxs(st,{children:[n.jsx(ot,{className:"text-2xl",children:"Feature Not Available"}),n.jsxs(Wr,{children:["Upgrade required to access ",e]})]}),n.jsx(Re,{children:n.jsxs("div",{className:"space-y-4",children:[n.jsx("p",{children:t||a}),n.jsxs("div",{className:"bg-muted p-4 rounded-md mt-4",children:[n.jsx("h3",{className:"font-medium mb-2",children:"Why upgrade?"}),n.jsxs("ul",{className:"list-disc pl-5 space-y-1",children:[n.jsxs("li",{children:["Access to premium features like ",e]}),n.jsx("li",{children:"Higher usage limits for campaigns and brands"}),n.jsx("li",{children:"Priority customer support"}),n.jsx("li",{children:"Advanced analytics and reporting"})]})]})]})}),n.jsx(uo,{children:n.jsx(te,{onClick:()=>s("/settings"),children:"View Subscription Options"})})]})})]})}function Egt(){const e=()=>{const l=window.location.hash.replace("#","");return["subscription","billing","team"].includes(l)?l:"subscription"},[t,r]=g.useState(e()),{isFeatureAvailable:s,loading:a}=lC(),i=!a&&s("teams"),o=l=>{r(l),window.location.hash=l};return g.useEffect(()=>{const l=()=>{const c=window.location.hash.replace("#","");["subscription","billing","team"].includes(c)&&r(c)};return window.addEventListener("hashchange",l),()=>window.removeEventListener("hashchange",l)},[]),n.jsxs("div",{className:"container p-6",children:[n.jsxs("div",{className:"mb-6",children:[n.jsx("h1",{className:"text-3xl font-bold",children:"Subscription & Billing Settings"}),n.jsx("p",{className:"text-muted-foreground",children:"Manage your subscription, billing, and team settings"})]}),n.jsxs(Cs,{value:t,onValueChange:o,className:"space-y-4",children:[n.jsxs(ps,{children:[n.jsx(pt,{value:"subscription",children:"Subscription"}),n.jsx(pt,{value:"billing",children:"Billing"})]}),n.jsx(Ct,{value:"subscription",children:n.jsx(Te,{className:"p-6",children:n.jsx(vle,{})})}),n.jsx(Ct,{value:"billing",children:n.jsx(Te,{className:"p-6",children:n.jsx(Qle,{})})}),n.jsx(Ct,{value:"team",children:n.jsx(Te,{className:"p-6",children:i?n.jsx(Hle,{}):n.jsx(zle,{featureName:"Team Management",description:"The Team Management feature allows you to invite team members to collaborate on your brands and campaigns. Upgrade your plan to access this feature."})})})]})]})}function k_(){const e=xr(),[t]=Bi(),[r]=g.useState(null),[s,a]=g.useState(!1),[i]=g.useState(!1),[o,l]=g.useState(!1),{toast:c}=sn(),{register:d,handleSubmit:u,formState:{isSubmitting:h}}=Cd(),{refresh:m}=o0(),f=t.get("skipBilling")==="true",p=g.useRef(!1);g.useEffect(()=>{a(!0);const v=async()=>{try{const{data:{session:j}}=await de.auth.getSession();if(j!=null&&j.user){const{error:N}=await de.schema("marketing_and_customer_success").from("profiles").update({onboarding_completed:!0}).eq("id",j.user.id);N?console.error("[PurchaseSuccess] Error marking onboarding complete:",N):console.log("[PurchaseSuccess] Successfully marked onboarding as complete")}}catch(j){console.error("[PurchaseSuccess] Exception marking onboarding complete:",j)}},x=async()=>
1927{if(f){a(!1);return}const j=await de.auth.getSession();if(!j.data.session)throw new Error("No session found");const N="https://worker.rainfactory.ai";try{(await fetch(`${N}/billing-functions/clean_cache`,{method:"POST",headers:{Authorization:`Bearer ${j.data.session.access_token}`},keepalive:!0})).ok||console.error("Failed to clean billing cache")}catch(_){console.error("Error cleaning billing cache:",_)}},b=async(j=0)=>{if(f)return!0;const N=5,_=2e3;try{const S=await de.auth.getSession();if(!S.data.session)throw new Error("No session found");const C="https://worker.rainfactory.ai";console.log(`[PurchaseSuccess] Syncing billing data (attempt ${j+1}/${N+1})`);const E=t.get("session_id");E||console.log("[PurchaseSuccess] Warning: No session_id found in URL params, sync will use fallback methods");const T=E?`${C}/billing-functions/customer_sync?session_id=${E}&force_refresh=true`:`${C}/billing-functions/customer_sync?force_refresh=true`,B=await fetch(T,{method:"POST",headers:{Authorization:`Bearer ${S.data.session.access_token}`},keepalive:!0});if(!B.ok)throw console.error("[PurchaseSuccess] Failed to sync billing data:",B.status),new Error("Sync failed");const{data:L}=await de.schema("basejump").from("billing_subscriptions").select("*").single();if(!L&&j<N)return console.log("[PurchaseSuccess] No subscription found yet, retrying..."),await new Promise(P=>setTimeout(P,_)),b(j+1);console.log("[PurchaseSuccess] Billing sync successful, subscription:",L==null?void 0:L.id),console.log("[PurchaseSuccess] Refreshing account status...");try{await m(),console.log("[PurchaseSuccess] Account status refreshed")}catch(P){console.error("[PurchaseSuccess] Error refreshing account status:",P)}return!0}catch(S){return console.error("[PurchaseSuccess] Error syncing billing data:",S),j<N?(console.log(`[PurchaseSuccess] Retrying sync in ${_}ms...`),await new Promise(C=>setTimeout(C,_)),b(j+1)):!1}};v(),x(),(async()=>{if(f){p.current||(p.current=!0,e("/dashboard",{replace:!0}));return}const j=t.get("session_id");console.log("[PurchaseSuccess] Session ID from URL:",j),console.log("[PurchaseSuccess] Full URL:",window.location.href),await b(),p.current||(p.current=!0,e("/dashboard",{replace:!0})),j?console.log("[PurchaseSuccess] Session ID passed to sync:",j):console.log("[PurchaseSuccess] No session_id in URL, but sync attempted anyway")})(),(async()=>{const N=`brand_processing_${t.get("session_id")||"default"}`;if(localStorage.getItem(N)==="completed"){console.log("🔍 DEBUG: Brand processing already triggered, skipping duplicate call");return}try{console.log("🔍 DEBUG: Initiating brand processing in PurchaseSuccess");const{data:{session:_}}=await de.auth.getSession();if(!_){console.error("🔍 DEBUG: No active session found when trying to trigger brand processing");return}console.log("🔍 DEBUG: Got active session, user ID:",_.user.id);const{data:S,error:C}=await de.from("brands").select("id, brand_name, status").eq("status","ACTIVE").limit(1);if(C){console.error("🔍 DEBUG: Error finding active brand:",C);return}if(!S||S.length===0){console.log("🔍 DEBUG: No active brands found to process. Checking for any brands...");const{data:P,error:F}=await de.from("brands").select("id, brand_name, status").limit(5);if(F){console.error("🔍 DEBUG: Error finding any brands:",F);return}if(P&&P.length>0){console.log("🔍 DEBUG: Found brands but none are active:",P.map(M=>({id:M.id,name:M.brand_name,status:M.status})));return}console.log("🔍 DEBUG: No brands found at all for this user");return}const E=S[0].id;console.log("🔍 DEBUG: Found active brand to process:",S[0].brand_name,"ID:",E),localStorage.setItem(N,"started");const T="https://worker.rainfactory.ai";console.log("🔍 DEBUG: Worker URL:",T);const B=await fetch(`${T}/rainfactory/brand-genius/process_updated_brand`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${_.access_token}`},keepalive:!0,body:JSON.stringify({brandId:E,userId:_.user.id,source:"purchase_success_page"})});if(!B.ok){const P=await B.text();console.error("🔍 DEBUG: Failed to trigger brand processing:",B.status,P);return}const L=await B.json();console.log("🔍 DEBUG: Brand processing initiated successfully:",L),localStorage.setItem(N,"completed")}catch(_){console.error("🔍 DEBUG: Error triggering brand processing:",_)}finally{}})()},[t,f]);const A=async v=>{try{const{data:{user:x}}=await de.auth.getUser();if(!x)return;const{error:b}=await de.schema("marketing_and_customer_success").from("user_events").insert({user_id:x.id,event_type:"CANCELLATION_FEEDBACK",event_data:{feedback:v.feedback},function_name:"web_cancellation_feedback"});if(b)throw b;
1927l(!0),c({title:"Thank you for your feedback",description:"We appreciate you taking the time to help us improve."})}catch(x){console.error("Error submitting feedback:",x),c({title:"Error submitting feedback",description:"Please try again later.",variant:"destructive"})}};return s?n.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 via-white to-blue-50/30 relative overflow-hidden",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsx("div",{className:"relative container mx-auto flex items-center justify-center min-h-screen p-4",children:n.jsxs("div",{className:"relative overflow-hidden bg-white/60 backdrop-blur-sm rounded-2xl border border-white/50 shadow-lg p-8",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-blue-50/30 via-transparent to-indigo-50/20"}),n.jsxs("div",{className:"relative text-center space-y-4",children:[n.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 bg-gradient-to-br from-blue-100 to-indigo-200 rounded-2xl shadow-sm",children:n.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-2 border-blue-600 border-t-transparent"})}),n.jsx("h2",{className:"text-xl font-semibold bg-gradient-to-r from-blue-700 to-indigo-700 bg-clip-text text-transparent",children:"Setting up your success..."}),n.jsx("p",{className:"text-gray-600",children:"Please wait while we finalize your account"})]})]})})]}):n.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 via-white to-blue-50/30 relative overflow-hidden",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsx("div",{className:"relative container mx-auto flex items-center justify-center min-h-screen p-6 max-w-6xl",children:n.jsxs("div",{className:"w-full max-w-4xl",children:[n.jsxs("div",{className:"relative overflow-hidden bg-gradient-to-br from-white via-blue-50/30 to-indigo-50/40 rounded-2xl border border-blue-200/50 shadow-lg mb-8 p-8 text-center",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsx("div",{className:"absolute top-0 right-0 w-40 h-40 bg-gradient-to-br from-blue-200/20 to-transparent rounded-full -translate-y-20 translate-x-20"}),n.jsx("div",{className:"absolute bottom-0 left-0 w-32 h-32 bg-gradient-to-tr from-indigo-100/30 to-transparent rounded-full translate-y-16 -translate-x-16"}),n.jsxs("div",{className:"relative",children:[n.jsx("div",{className:"flex justify-center mb-6",children:i?n.jsx("div",{className:"p-4 bg-red-50 rounded-2xl shadow-sm",children:n.jsx(Rl,{className:"h-16 w-16 text-red-500"})}):n.jsxs("div",{className:"relative",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-green-200/30 to-blue-200/30 rounded-2xl blur-xl scale-110"}),n.jsx("div",{className:"relative p-4 bg-white/80 backdrop-blur-sm rounded-2xl shadow-lg",children:n.jsx(qt,{className:"h-16 w-16 text-green-600"})}),n.jsx("div",{className:"absolute -top-2 -right-2 p-2 bg-gradient-to-br from-blue-100 to-indigo-200 rounded-xl shadow-sm animate-pulse",children:n.jsx(mr,{className:"h-6 w-6 text-blue-600"})})]})}),n.jsx("h1",{className:"text-5xl font-bold bg-gradient-to-r from-blue-700 via-indigo-700 to-purple-700 bg-clip-text text-transparent mb-4",children:i?"Subscription Cancelled":f?"Setup Complete!":"Welcome Aboard!"}),i?n.jsx("p",{className:"text-gray-600 text-lg leading-relaxed max-w-2xl mx-auto",children:"We're sorry to see you go. Your subscription has been cancelled and will remain active until the end of your current billing period."}):f?n.jsx("p",{className:"text-gray-600 text-lg leading-relaxed max-w-2xl mx-auto",children:"Your brand foundation is ready. The next step is to build your brand campaign so Rainfactory can start creating content that matches your unique voice."}):n.jsx("p",{className:"text-gray-600 text-lg leading-relaxed max-w-2xl mx-auto",children:"Your subscription is now active! The next step is to build your brand campaign so Rainfactory can start creating content that matches your unique voice."})]})]}),n.jsx("div",{children:i?o?n.jsxs("div",{className:"relative overflow-hidden bg-gradient-to-br from-green-50/80 via-emerald-50/60 to-white rounded-2xl border border-green-200/60 shadow-lg",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-green-50/30 via-trans
1927parent to-emerald-50/20"}),n.jsx("div",{className:"absolute top-0 right-0 w-32 h-32 bg-gradient-to-br from-green-200/30 to-transparent rounded-full -translate-y-16 translate-x-16"}),n.jsxs("div",{className:"relative p-8 text-center",children:[n.jsxs("div",{className:"mb-6",children:[n.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 bg-gradient-to-br from-green-100 to-emerald-200 rounded-2xl shadow-sm mb-4",children:n.jsx(qt,{className:"h-8 w-8 text-green-600"})}),n.jsx("h2",{className:"text-2xl font-bold bg-gradient-to-r from-green-800 to-emerald-700 bg-clip-text text-transparent mb-2",children:"Thank You!"}),n.jsx("p",{className:"text-gray-600 mb-6",children:"Your feedback has been received and will help us improve our service."})]}),n.jsxs("div",{className:"group relative overflow-hidden bg-gradient-to-br from-gray-500/90 to-slate-600/90 backdrop-blur-sm rounded-xl shadow-lg hover:shadow-xl transition-all duration-300 transform hover:-translate-y-1 max-w-sm mx-auto",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-white/10 via-trans
1927parent to-white/5"}),n.jsx(te,{onClick:()=>e("/"),className:"relative h-auto p-4 w-full bg-transparent hover:bg-transparent border-0 text-white shadow-none font-semibold",children:"Return to Homepage"})]})]})]}):n.jsxs("div",{className:"relative overflow-hidden bg-gradient-to-br from-red-50/80 via-orange-50/60 to-white rounded-2xl border border-red-200/60 shadow-lg",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-red-50/30 via-transparent to-orange-50/20"}),n.jsx("div",{className:"absolute top-0 right-0 w-32 h-32 bg-gradient-to-br from-red-200/30 to-transparent rounded-full -translate-y-16 translate-x-16"}),n.jsxs("div",{className:"relative p-8",children:[n.jsxs("div",{className:"text-center mb-6",children:[n.jsx("h2",{className:"text-2xl font-bold bg-gradient-to-r from-red-800 to-orange-700 bg-clip-text text-transparent mb-2",children:"Help Us Improve"}),n.jsx("p",{className:"text-gray-600",children:"Your feedback is valuable to us"})]}),n.jsxs("form",{onSubmit:u(A),className:"space-y-6",children:[n.jsxs("div",{children:[n.jsx("label",{htmlFor:"feedback",className:"block text-sm font-medium text-gray-700 mb-3",children:"Would you mind sharing why you decided to cancel?"}),n.jsx("div",{className:"relative",children:n.jsx(Zr,{id:"feedback",placeholder:"Your feedback helps us improve our service...",...d("feedback"),className:"min-h-[120px] bg-white/80 backdrop-blur-sm border-white/50 shadow-sm focus:ring-2 focus:ring-red-500/20 focus:border-red-500/50"})})]}),n.jsxs("div",{className:"group relative overflow-hidden bg-gradient-to-br from-red-500/90 to-orange-600/90 backdrop-blur-sm rounded-xl shadow-lg hover:shadow-xl transition-all duration-300 transform hover:-translate-y-1",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-white/10 via-trans
1927parent to-white/5"}),n.jsx(te,{type:"submit",disabled:h,className:"relative h-auto p-4 w-full bg-transparent hover:bg-transparent border-0 text-white shadow-none font-semibold",children:h?n.jsxs("div",{className:"flex items-center justify-center gap-2",children:[n.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-2 border-white border-t-transparent"}),n.jsx("span",{children:"Submitting..."})]}):"Submit Feedback"})]})]})]})]}):f?n.jsxs("div",{className:"relative overflow-hidden bg-gradient-to-br from-emerald-50/80 via-green-50/60 to-white rounded-2xl border border-emerald-200/60 shadow-lg",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-emerald-50/30 via-transparent to-green-50/20"}),n.jsx("div",{className:"absolute top-0 right-0 w-32 h-32 bg-gradient-to-br from-emerald-200/30 to-transparent rounded-full -translate-y-16 translate-x-16"}),n.jsx("div",{className:"absolute bottom-0 left-0 w-24 h-24 bg-gradient-to-tr from-green-100/40 to-transparent rounded-full translate-y-12 -translate-x-12"}),n.jsxs("div",{className:"relative p-8 text-center",children:[n.jsxs("div",{className:"mb-6",children:[n.jsx("div",{className:"inline-flex items-center gap-3 mb-4",children:n.jsx("div",{className:"p-3 bg-white/80 backdrop-blur-sm rounded-2xl shadow-lg",children:n.jsx(en,{className:"h-8 w-8 text-emerald-600"})})}),n.jsx("h2",{className:"text-3xl font-bold bg-gradient-to-r from-emerald-800 to-green-700 bg-clip-text text-transparent mb-4",children:"Ready to Build Your Brand Campaign"}),n.jsx("p",{className:"text-gray-600 text-lg leading-relaxed max-w-2xl mx-auto mb-8",children:"Create your brand foundation that Rainfactory uses to generate content that perfectly matches your voice and style."})]}),n.jsxs("div",{className:"group relative overflow-hidden bg-gradient-to-br from-emerald-500/90 to-green-600/90 backdrop-blur-sm rounded-2xl shadow-xl hover:shadow-2xl transition-all duration-500 transform hover:-translate-y-2 hover:scale-105 max-w-lg mx-auto",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-white/10 via-trans
1927parent to-white/5"}),n.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-emerald-400/20 via-transparent to-green-500/20 opacity-0 group-hover:opacity-100 transition-opacity duration-300"}),n.jsx(te,{onClick:()=>e("/dashboard"),className:"relative h-auto p-8 w-full bg-transparent hover:bg-transparent border-0 text-white shadow-none text-lg font-semibold",children:n.jsxs("div",{className:"flex items-center justify-center gap-4",children:[n.jsx("span",{children:"Build Your Brand Campaign"}),n.jsx(io,{className:"h-6 w-6 group-hover:translate-x-2 transition-transform duration-300"})]})})]})]})]}):n.jsx(n.Fragment,{children:r?n.jsxs("p",{className:"text-gray-600 mb-6",children:["You are now the proud owner of the ",r.name," plan",r.interval==="month"?" (monthly)":r.interval==="year"?" (yearly)":"",". Your subscription has been successfully activated, and you now have access to all the features included in your plan."]}):n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"text-gray-600 mb-6",children:"Your subscription has been successfully activated. You now have access to all the features included in your plan."}),n.jsxs("div",{className:"relative overflow-hidden bg-gradient-to-br from-blue-50/80 via-indigo-50/60 to-white rounded-2xl border border-blue-200/60 shadow-lg",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-blue-50/30 via-transparent to-indigo-50/20"}),n.jsx("div",{className:"absolute top-0 right-0 w-32 h-32 bg-gradient-to-br from-blue-200/30 to-transparent rounded-full -translate-y-16 translate-x-16"}),n.jsx("div",{className:"absolute bottom-0 left-0 w-24 h-24 bg-gradient-to-tr from-indigo-100/40 to-transparent rounded-full translate-y-12 -translate-x-12"}),n.jsxs("div",{className:"relative p-8 text-center",children:[n.jsxs("div",{className:"mb-6",children:[n.jsx("div",{className:"inline-flex items-center gap-3 mb-4",children:n.jsx("div",{className:"p-3 bg-white/80 backdrop-blur-sm rounded-2xl shadow-lg",children:n.jsx(en,{className:"h-8 w-8 text-blue-600"})})}),n.jsx("h2",{className:"text-3xl font-bold bg-gradient-to-r from-blue-800 to-indigo-700 bg-clip-text text-transparent mb-4",children:"Ready to Build Your Brand Campaign"}),n.jsx("p",{className:"text-gray-600 text-lg leading-relaxed max-w-2xl mx-auto mb-8",children:"Create your brand foundation that Rainfactory uses to generate content that perfectly matches your voice and style."})]}),n.jsxs("div",{className:"group relative overflow-hidden bg-gradient-to-br from-blue-500/90 to-indigo-600/90 backdrop-blur-sm rounded-2xl shadow-xl hover:shadow-2xl transition-all duration-500 transform hover:-translate-y-2 hover:scale-105 max-w-lg mx-auto",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-white/10 via-trans
1927parent to-white/5"}),n.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-blue-400/20 via-transparent to-indigo-500/20 opacity-0 group-hover:opacity-100 transition-opacity duration-300"}),n.jsx(te,{onClick:()=>e("/dashboard"),className:"relative h-auto p-8 w-full bg-transparent hover:bg-transparent border-0 text-white shadow-none text-lg font-semibold",children:n.jsxs("div",{className:"flex items-center justify-center gap-4",children:[n.jsx("span",{children:"Build Your Brand Campaign"}),n.jsx(io,{className:"h-6 w-6 group-hover:translate-x-2 transition-transform duration-300"})]})})]})]})]})]})})})]})})]})}function Bgt(){const{balance:e}=Fc(),[t,r]=g.useState(!1),[s,a]=g.useState(!1);if(g.useEffect(()=>{e&&e.total_credits<100&&!t?a(!0):a(!1)},[e,t]),!s)return null;const i=((e==null?void 0:e.total_credits)??0)<=10,o=i?"border-red-500 bg-red-50":"border-orange-500 bg-orange-50",l=i?"text-red-600":"text-orange-600",c=i?"text-red-800":"text-orange-800";return n.jsxs(Ar,{className:`mb-4 ${o} relative`,children:[n.jsx(nr,{className:`h-4 w-4 ${l}`}),n.jsx(gr,{className:`${c} pr-8`,children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex-1",children:[n.jsx("strong",{className:"block mb-1",children:i?"⚠️ Credits Depleted":`⚡ Low Credits: ${e==null?void 0:e.total_credits} remaining`}),n.jsx("p",{className:"text-sm",children:i?"Content generation has been paused. Add credits to resume automated posting.":"You're running low on credits. Add more to ensure uninterrupted content generation."})]}),n.jsx(Ir,{to:"/settings/billing",className:"ml-4 flex-shrink-0",children:n.jsx(te,{size:"sm",variant:i?"destructive":"default",children:"Add Credits"})})]})}),n.jsx("button",{onClick:()=>r(!0),className:`absolute top-2 right-2 ${c} hover:opacity-70 transition-opacity`,"aria-label":"Dismiss alert",children:n.jsx(kr,{className:"h-4 w-4"})})]})}function Tgt({show:e,onHide:t,icon:r,title:s,action:a,learnMoreUrl:i}){return e?n.jsxs("div",{className:"relative isolate flex flex-col justify-between gap-3 overflow-hidden rounded-lg border border-green-600/15 bg-gradient-to-r from-lime-100/80 to-emerald-100/80 py-3 pl-4 pr-12 sm:flex-row sm:items-center sm:py-2",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[r&&n.jsx("div",{className:"hidden rounded-full border border-green-600/50 bg-white/50 p-1 shadow-[inset_0_0_1px_1px_#fff] sm:block",children:r}),n.jsxs("p",{className:"text-sm text-gray-900",children:[s,i&&n.jsxs(n.Fragment,{children:[" ",n.jsx("a",{href:i,target:"_blank",className:"text-gray-700 underline transition-colors hover:text-black",children:"Learn more"})]})]})]}),a&&n.jsx("div",{className:"flex items-center sm:-my-1",children:n.jsx("button",{type:"button",className:"whitespace-nowrap rounded-md border border-green-700/50 px-3 py-1 text-sm text-gray-800 transition-colors hover:bg-green-500/10",onClick:a.onClick,children:a.label})}),n.jsx("button",{type:"button",className:"absolute inset-y-0 right-2.5 p-1 text-sm text-green-700 underline transition-colors hover:text-green-900",onClick:t,children:n.jsx(kr,{className:"h-[18px] w-[18px]"})})]}):null}const Vle=e=>{const[t,r]=g.useState(null),[s,a]=g.useState(!0);g.useEffect(()=>{if(!e){a(!1);return}(async()=>{try{a(!0);const{data:c,error:d}=await de.from("brand_autopost_settings").select("*").eq("brand_id",e).single();if(d){if(d.code!=="PGRST116")throw d;r(null);return}r({...c,config:c.config})}catch(c){console.error("Error fetching brand autopost settings:",c),He({title:"Error",description:"Failed to load brand autopost settings",variant:"destructive"}),r(null)}finally{a(!1)}})()},[e]);const i=async l=>{var c;if(e)try{if(t){let d={...l,updated_at:new Date().toISOString()};l.config!==void 0&&(d.config={...t.config||{},...l.config});const{data:u,error:h}=await de.from("brand_autopost_settings").update(d).eq("id",t.id).select().single();if(h)throw h;r({...u,config:u.config}),He({title:"Settings Updated",description:"Brand autopost settings have been updated successfully",variant:"default",className:"bg-green-50 dark:bg-green-900/10 border-green-200 dark:border-green-900/50"})}else{if(!((c=(await de.auth.getSession()).data.session)==null?void 0:c.user.id))throw new Error("User ID not available. Please log in again.");const h={brand_id:e,autopost_enabled:l.autopost_enabled!==void 0?l.auto
1927post_enabled:!1,create_campaigns_automatically:l.create_campaigns_automatically!==void 0?l.create_campaigns_automatically:!0,autopost_campaign_prefix:l.autopost_campaign_prefix||"Auto: ",config:l.config||{image_generation_enabled:!0,video_generation_enabled:!0},metadata:null,created_at:new Date().toISOString(),updated_at:new Date().toISOString()},{data:m,error:f}=await de.from("brand_autopost_settings").insert(h).select().single();if(f)throw f;r({...m,config:m.config}),He({title:"Settings Created",description:"Brand autopost settings have been created successfully",variant:"default",className:"bg-green-50 dark:bg-green-900/10 border-green-200 dark:border-green-900/50"})}}catch(d){console.error("Error updating brand autopost settings:",d),He({title:"Error",description:"Failed to update brand autopost settings",variant:"destructive"})}};return{brandAutopostSettings:t,loading:s,updateBrandAutopostSettings:i,updateConfig:async l=>i({config:l})}};function kV({onDismiss:e}={}){const{selectedBrand:t}=mn(),[r,s]=g.useState(!0),[a,i]=g.useState(null),{brandAutopostSettings:o,loading:l}=Vle(t==null?void 0:t.id),{platforms:c,platformSettings:d,loading:u}=N6(t==null?void 0:t.id),[h,m]=g.useState(new Set),f=[{id:"configure-automation",title:"Configure Automation",description:"Set up automated content creation and posting preferences",icon:fs,link:"/automation",completed:!1,extraContent:n.jsx("div",{className:"p-4 bg-gradient-to-br from-indigo-50 via-blue-50/50 to-purple-50 rounded-xl border border-indigo-200/50",children:n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx("div",{className:"p-2 bg-indigo-100 rounded-lg",children:n.jsx(fs,{className:"h-5 w-5 text-indigo-600"})}),n.jsxs("div",{className:"flex-1",children:[n.jsx("p",{className:"text-sm font-medium text-indigo-900 mb-1",children:"Fine-tune Your Automation"}),n.jsx("p",{className:"text-sm text-indigo-700",children:"This is where you can customize your automation settings to match your workflow. Control posting schedules, content frequency, approval processes, and more."})]})]})})},{id:"brand-genius-2",title:"Brand Genius Part 2",description:"Teach Rainfactory more so it better understands your brand and your business. Get your completion status to 80%< for a strong brand.",icon:en,link:t?`/brands/${t.id}`:"/brand/genius",completed:!1}];g.useEffect(()=>{async function x(){if(!t){s(!1);return}try{s(!0);const b=new Set;o!=null&&o.autogenerate_enabled&&c.some(N=>{var _;return((_=d[N.id])==null?void 0:_.autogenerate_enabled)===!0})&&b.add("configure-automation"),t.elevator_pitch&&t.target_market&&t.brand_voice&&b.add("brand-genius-2"),(()=>{if(!t)return 0;const j=Object.keys(cs).filter(S=>{const C=cs[S];return!(C!=null&&C.hidden)&&S!=="status"}),N=j.length;return j.filter(S=>{const C=t[S];return C!=null&&C!==""}).length/N*100})()>=80&&b.add("brand-genius-2"),m(b)}catch(b){console.error("Error checking completed steps:",b)}finally{s(!1)}}x()},[t,o,l,c,d,u]);const A=(()=>{if(a){const b=f.find(y=>y.id===a);if(b)return b}return f.find(b=>!h.has(b.id))||f[0]})(),v=h.size===f.length;return r||l||u?n.jsxs("div",{className:"bg-white rounded-lg border shadow-sm overflow-hidden",children:[n.jsx("div",{className:"p-4 border-b bg-gradient-to-r from-amber-50 to-orange-50 dark:from-amber-950/20 dark:to-orange-950/20",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-10 h-10 bg-gradient-to-br from-amber-500 to-orange-600 rounded-full flex items-center justify-center shadow-lg",children:n.jsx(ui,{className:"h-5 w-5 text-white"})}),n.jsxs("div",{children:[n.jsx("h2",{className:"text-lg font-semibold text-amber-900 dark:text-amber-100 flex items-center gap-2",children:"Next Steps for Success"}),n.jsx("p",{className:"text-sm text-amber-700 dark:text-amber-200",children:"Complete these steps to maximize your brand's potential"})]})]}),n.jsx("span",{className:"text-sm text-amber-700 dark:text-amber-300 font-medium",children:"Loading..."})]})}),n.jsx("div",{className:"flex items-center justify-center h-48",children:n.jsx("div",{className:"w-8 h-8 border-4 border-amber-500 border-t-transparent roun
1927ded-full animate-spin"})}),n.jsx("div",{className:"h-2 bg-gradient-to-r from-amber-200 via-orange-200 to-red-200 dark:from-amber-800 dark:via-orange-800 dark:to-red-800"})]}):v?n.jsxs("div",{className:"bg-white rounded-lg border shadow-sm overflow-hidden",children:[n.jsx("div",{className:"p-4 border-b bg-gradient-to-r from-green-50 to-emerald-50 dark:from-green-950/20 dark:to-emerald-950/20",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-10 h-10 bg-gradient-to-br from-green-500 to-emerald-600 rounded-full flex items-center justify-center shadow-lg",children:n.jsx(qt,{className:"h-5 w-5 text-white"})}),n.jsxs("div",{children:[n.jsx("h2",{className:"text-lg font-semibold text-green-900 dark:text-green-100 flex items-center gap-2",children:"🎉 All Set Up!"}),n.jsx("p",{className:"text-sm text-green-700 dark:text-green-200",children:"You've completed all essential setup steps"})]})]}),e&&n.jsx("button",{onClick:e,className:"text-green-600 hover:text-green-800 dark:text-green-300 dark:hover:text-green-200 transition-colors",title:"Hide Next Steps",children:n.jsx(kr,{className:"h-5 w-5"})})]})}),n.jsx("div",{className:"p-4",children:n.jsxs("div",{className:"flex items-center gap-2 text-green-700 dark:text-green-300",children:[n.jsx(mr,{className:"h-4 w-4"}),n.jsx("span",{className:"text-sm font-medium",children:"Congratulations! Your brand is ready to shine."})]})}),n.jsx("div",{className:"h-2 bg-gradient-to-r from-green-200 via-emerald-200 to-teal-200 dark:from-green-800 dark:via-emerald-800 dark:to-teal-800"})]}):n.jsxs("div",{className:"bg-white rounded-lg border shadow-sm overflow-hidden",children:[n.jsx("div",{className:"p-4 border-b bg-gradient-to-r from-amber-50 to-orange-50 dark:from-amber-950/20 dark:to-orange-950/20",children:n.jsxs("div",{className:"flex items-center justify-between gap-3",children:[n.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[n.jsx("div",{className:"w-10 h-10 bg-gradient-to-br from-amber-500 to-orange-600 rounded-full flex items-center justify-center shadow-lg flex-shrink-0",children:n.jsx(ui,{className:"h-5 w-5 text-white"})}),n.jsxs("div",{className:"min-w-0",children:[n.jsx("h2",{className:"text-base sm:text-lg font-semibold text-amber-900 dark:text-amber-100",children:"Next Steps for Success"}),n.jsx("p",{className:"text-xs sm:text-sm text-amber-700 dark:text-amber-200 truncate",children:"Complete these steps to maximize your brand's potential"})]})]}),n.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[n.jsxs("span",{className:"text-xs sm:text-sm text-amber-700 dark:text-amber-300 font-medium",children:[h.size,"/",f.length]}),e&&n.jsx("button",{onClick:e,className:"text-amber-600 hover:text-amber-800 dark:text-amber-300 dark:hover:text-amber-200 transition-colors",title:"Hide Next Steps",children:n.jsx(kr,{className:"h-5 w-5"})})]})]})}),n.jsx("div",{className:"flex flex-col",children:n.jsxs("div",{className:"border-b border-gray-200",children:[n.jsx("div",{className:"p-3 sm:p-4 bg-gray-50/50",children:n.jsx("span",{className:"text-sm font-medium text-gray-700",children:"Progress Overview"})}),n.jsx("div",{className:"divide-y divide-gray-100",children:f.map((x,b)=>{const y=h.has(x.id),w=A.id===x.id,j=x.icon;return n.jsxs("div",{className:"flex flex-col",children:[n.jsx("button",{onClick:()=>i(x.id),className:`w-full text-left p-3 sm:p-4 hover:bg-gray-50 transition-colors ${w?"bg-blue-50 border-l-4 border-blue-500":""}`,children:n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx("div",{className:"flex items-center justify-center mt-1 flex-shrink-0",children:y?n.jsx("div",{className:"w-6 h-6 flex items-center justify-center bg-green-100 rounded-full",children:n.jsx(Gn,{className:"h-4 w-4 text-green-600"})}):n.jsx("div",{className:"w-6 h-6 rounded-full bg-primary/10 flex items-center justify-center text-primary text-xs font-semibold",children:b+1})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[n.jsx(j,{className:"h-4 w-4 text-gray-500 flex-shrink-0"}),n.jsx("h3",{className:`text-sm font-medium ${y?"text-green-900":"text-gray-900"} ${w?"text-blue-900":""}`,children:x.title}),y&&n.jsx("span",{className:"text-xs text-green-600 ml-auto",children:"Completed"})]}),n.jsx("p",{className:"text-xs text-gray-600 mt-1 line-clamp-2",children:x.description})]}),n.jsx(_s,{className:`h-5 w-5 text-gray-400 flex-shrink-0 transition-transform ${w?"rotate-90":""}`})]})}),w&&n.jsx("div",{className:"border-t border-gray-100 bg-gradient-to-br from-slate-50 via-blue-50/30 to-indigo-50/50",children:n.jsx("div",{className:"p-4 sm:p-6",children:n.jsxs("div",{className:"space-y-4",children:[A.id==="brand-genius-2"&&n.jsx("div",{children:n.jsx(ty,{brand:t,showLink:!1,className:"bg-white border shadow-sm"})}),A.extraContent&&n.jsx("div",{children:A.extraContent}),n.jsx("div",{className:"flex gap-3 pt-2",children:A.link==="#"?n.jsx("div",{className:"text-sm text-muted-foreground italic",children:"This step requires interaction"}):n.jsxs(Ir,{to:A.link,className:`inline-flex items-center gap-2 px-4 sm:px-6 py-2 sm:py-3 rounded-lg text-sm font-medium transition-colors w-full sm:w-auto justify-center ${h.has(A.id)?"bg-green-100 text-green-700 hover:bg-green-200":"bg-primary text-primary-foreground hover:bg-primary/90"}`,children:[h.has(A.id)?"View Details":"Get Started",n.jsx(_s,{className:"h-4 w-4"})]})})]})})})]},x.id)})})]})}),n.jsx("div",{className:"h-2 bg-gradient-to-r from-amber-200 via-orange-200 to-red-200 dark:from-amber-800 dark:via-orange-800 dark:to-red-800"})]})}function Pgt({className:e=""}){const{selectedBrand:t}=mn();if(!t)return null;const r=[{id:"brand-analysis",title:"Brand Analysis",description:"Dive deep into your brand insights and performance metrics",icon:sl,link:`/brands/${t.id}/analysis`,color:"from-purple-500 to-indigo-600",hoverColor:"hover:from-purple-600 hover:to-indigo-700",emoji:"📊",subtitle:"Get the data story"},{id:"brand-kit",title:"Brand Kit",description:"Access your complete brand guidelines and visual assets",
1927icon:W_,link:"/brand/guide",color:"from-pink-500 to-rose-600",hoverColor:"hover:from-pink-600 hover:to-rose-700",emoji:"🎨",subtitle:"Style & consistency"}];return n.jsx(Te,{className:`shadow-sm overflow-hidden ${e}`,children:n.jsx(Re,{className:"p-0",children:n.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 divide-y md:divide-y-0 md:divide-x divide-gray-200 dark:divide-gray-700",children:r.map(s=>{const a=s.icon;return n.jsx(Ir,{to:s.link,className:"group relative overflow-hidden transition-all duration-300 ease-out hover:bg-gray-50/50 dark:hover:bg-gray-800/50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-purple-500","aria-label":`Explore ${s.title}: ${s.description}`,children:n.jsxs("div",{className:"p-5 sm:p-6 min-h-[200px] sm:min-h-[220px] flex flex-col",children:[n.jsx("div",{className:`absolute inset-0 bg-gradient-to-br ${s.color} opacity-0 group-hover:opacity-[0.03] dark:group-hover:opacity-[0.08] transition-opacity duration-500 ease-out`}),n.jsxs("div",{className:"relative z-10 flex-1 flex flex-col",children:[n.jsxs("div",{className:"flex items-start justify-between mb-4",children:[n.jsx("div",{className:`w-11 h-11 sm:w-12 sm:h-12 bg-gradient-to-br ${s.color} rounded-xl flex items-center justify-center shadow-md group-hover:shadow-lg transform group-hover:rotate-6 group-hover:scale-110 transition-all duration-300 ease-out`,children:n.jsx(a,{className:"h-5 w-5 sm:h-6 sm:w-6 text-white"})}),n.jsx("div",{className:"text-2xl sm:text-3xl opacity-40 group-hover:opacity-60 transition-opacity duration-300 leading-none",children:s.emoji})]}),n.jsx("h3",{className:"text-base sm:text-lg font-semibold text-gray-900 dark:text-gray-100 mb-1.5 leading-tight group-hover:text-gray-800 dark:group-hover:text-gray-50 transition-colors duration-200",children:s.title}),n.jsx("p",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 mb-3 uppercase tracking-wider leading-tight",children:s.subtitle}),n.jsx("p",{className:"text-sm leading-relaxed text-gray-600 dark:text-gray-300 mb-5 flex-1 group-hover:text-gray-700 dark:group-hover:text-gray-200 transition-colors duration-200",children:s.description}),n.jsxs("div",{className:"flex items-center justify-between mt-auto",children:[n.jsxs("span",{className:`inline-flex items-center gap-2 px-4 py-2 rounded-lg bg-gradient-to-r ${s.color} text-white text-sm font-medium transform group-hover:scale-105 group-hover:shadow-lg transition-all duration-300 ease-out shadow-md`,children:[n.jsx(en,{className:"h-4 w-4"}),n.jsx("span",{children:"Explore"})]}),n.jsx(io,{className:"h-5 w-5 text-gray-400 dark:text-gray-500 group-hover:text-gray-600 dark:group-hover:text-gray-300 transform group-hover:translate-x-1.5 transition-all duration-300 ease-out"})]})]}),n.jsx("div",{className:"absolute top-3 right-3 opacity-20 group-hover:opacity-40 transition-opacity duration-500",children:n.jsxs("div",{className:"relative",children:[n.jsx(mr,{className:"h-4 w-4 text-yellow-400 animate-pulse"}),n.jsx("div",{className:"absolute -top-1 -right-1 w-2 h-2 bg-yellow-300 rounded-full opacity-75 animate-ping"})]})})]})},s.id)})})})})}function TL({widget:e,isExpanded:t,onToggle:r}){return n.jsxs(Te,{className:"bg-white rounded-lg border shadow-sm overflow-hidden transition-all duration-300 hover:shadow-md",children:[n.jsx("div",{className:`p-3 md:p-4 border-b bg-gradient-to-r ${e.gradient} cursor-pointer`,onClick:r,children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-2 md:gap-3",children:[n.jsx("div",{className:`w-8 h-8 md:w-10 md:h-10 bg-gradient-to-br ${e.iconGradient} rounded-full flex items-center justify-center shadow-lg`,children:n.jsx(e.icon,{className:"h-4 w-4 md:h-5 md:w-5 text-white"})}),n.jsxs("div",{className:"flex-1",children:[n.jsx("h3",{className:`text-base md:text-lg font-semibold ${e.textColor} mb-1`,children:e.title}),n.jsx("p",{className:`text-sm ${e.subtextColor}
1927 mb-2`,children:e.subtitle}),e.description&&n.jsx("p",{className:`text-sm ${e.subtextColor}`,children:e.description})]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[!t&&e.actionButtons&&n.jsx("div",{className:"flex items-center gap-2",onClick:s=>s.stopPropagation(),children:e.actionButtons}),t?n.jsx(Un,{className:"h-5 w-5 text-muted-foreground transition-transform"}):n.jsx(_s,{className:"h-5 w-5 text-muted-foreground transition-transform"})]})]})}),n.jsx("div",{className:`overflow-hidden transition-all duration-500 ease-in-out ${t?"max-h-[1000px] opacity-100":"max-h-0 opacity-0"}`,children:t&&n.jsx("div",{className:"p-6",children:e.content})}),n.jsx("div",{className:`h-2 bg-gradient-to-r ${e.bottomGradient}`})]})}function EV({isExpanded:e,onToggle:t}){const r={id:"content",icon:Xr,title:"Recent Content",subtitle:"Your latest content",description:"",gradient:"from-green-50 to-emerald-50 dark:from-green-950/20 dark:to-emerald-950/20",iconGradient:"from-green-500 to-emerald-600",textColor:"text-green-900 dark:text-green-100",subtextColor:"text-green-700 dark:text-green-200",bottomGradient:"from-green-200 via-emerald-200 to-teal-200 dark:from-green-800 dark:via-emerald-800 dark:to-teal-800",content:n.jsx(Igt,{})};return n.jsx(TL,{widget:r,isExpanded:e,onToggle:t})}function BV({isExpanded:e,onToggle:t}){const r={id:"content-chart",icon:a0e,title:"Content Produced",subtitle:"Creation activity over time",description:"Track your content production by type and time period",gradient:"from-orange-50 to-red-50 dark:from-orange-950/20 dark:to-red-950/20",iconGradient:"from-orange-500 to-red-600",textColor:"text-orange-900 dark:text-orange-100",subtextColor:"text-orange-700 dark:text-orange-200",bottomGradient:"from-orange-200 via-red-200 to-pink-200 dark:from-orange-800 dark:via-red-800 dark:to-pink-800",content:n.jsx(Ogt,{})};return n.jsx(TL,{widget:r,isExpanded:e,onToggle:t})}function Igt(){const{selectedBrand:e}=mn(),[t,r]=g.useState([]),[s,a]=g.useState(!0),i=xr();return g.useEffect(()=>{async function o(){if(e)try{a(!0);const{data:l,error:c}=await de.from("content_management_view").select("*").eq("brand_id",e.id).order("created_at",{ascending:!1}).limit(12);if(c)throw c;const d=(l||[]).map(u=>({...u,title:u.name,platform:u.platform_key,campaign:u.campaign_name?{id:u.campaign_id,name:u.campaign_name,image_url:u.campaign_image_url}:null,campaigns:u.campaign_name?{id:u.campaign_id,name:u.campaign_name,image_url:u.campaign_image_url}:null}));r(d)}catch(l){console.error("Error fetching recent content:",l)}finally{a(!1)}}o()},[e]),n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsx("div",{className:"flex items-center gap-2",children:n.jsx("h3",{className:"text-base md:text-lg font-medium",children:"Recent Content"})}),n.jsx(Ir,{to:"/content",className:"text-sm text-green-600 hover:text-green-800 hover:underline font-medium",children:"View All"})]}),n.jsx(FF,{contents:t,loading:s,emptyMessage:"No content found. Create your first content to get started.",onContentClick:o=>i(`/content/${o.id}`),showCampaign:!0})]})}function Ogt(){const{selectedBrand:e}=mn(),[t,r]=g.useState([]),[s,a]=g.useState(!0),[i,o]=g.useState("daily"),l={landing_page:"#3b82f6",blog_post:"#10b981",social_post:"#f97316",ad_group:"#8b5cf6",javascript_tool:"#f43f5e",email:"#facc15"},c=m=>m?m.replace(/_/g," ").split(" ").map(f=>f.charAt(0).toUpperCase()+f.slice(1)).join(" "):"";g.useEffect(()=>{async function m(){if(e)try{a(!0);const{data:f,error:p}=await de.from("current_content_versions").select("id, content_type, created_at").eq("brand_id",e.id).order("created_at",{ascending:!0});if(p)throw p;if(f){const A=d(f,i);r(A)}}catch(f){console.error("Failed to fetch content creation data:",f)}finally{a(!1)}}m()},[e,i]);const d=(m,f)=>{const p=new Map;return m.forEach(v=>{const x=new Date(v.created_at);let b;if(f==="weekly"){const j=x.getDay(),N=j===0?6:j-1,_=new Date(x);_.setDate(x.getDate()-N),b=_.toISOString().split("T")[0]}else b=x.toISOString().split("T")[0];p.has(b)||p.set(b,{period:b,landing_page:0,blog_post:0,social_post:0,ad_group:0,javascript_tool:0,email:0,total:0});const y=p.get(b),w=v.content_type||"unknown";y[w]!==void 0&&(y[w]++,y.total++)}),Array.from(p.values()).sort((v,x)=>v.period.localeCompare(x.period)).slice(-12)},u=m=>i==="weekly"?new Date(m).toLocaleDateString("en-US",{month:"short",day:"numeric"}):new Date(m).toLocaleDateString("en-US",{month:"short",day:"numeric"}),h=g.useMemo(()=>["landing_page","blog_post","social_post","ad_group","javascript_tool","email"].filter(f=>t.some(p=>p[f]>0)),[t]);return s?n.jsxs("div",{className:"bg-white rounded-lg border shadow-sm",children:[n.jsxs("div",{className:"p-4 border-b",children:[n.jsx("h2",{className:"text-base md:text-lg font-semibold",children:"Content Produced"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Number of content pieces created by type"})]}),n.jsx("div",{className:"flex items-center justify-center h-48",children:n.jsx("div",{className:"w-8 h-8 border-4 border-primary border-t-transparent roun
1927ded-full animate-spin"})})]}):n.jsxs("div",{className:"space-y-4",children:[n.jsx(Cs,{value:i,onValueChange:m=>o(m),className:"w-full px-4",children:n.jsxs(ps,{className:"grid grid-cols-2 w-full",children:[n.jsx(pt,{value:"daily",children:"Daily"}),n.jsx(pt,{value:"weekly",children:"Weekly"})]})}),n.jsx("div",{className:"bg-white rounded-lg border shadow-sm overflow-hidden",children:n.jsx("div",{className:"w-full h-[300px] px-4 py-4",children:n.jsx(Sl,{width:"100%",height:"100%",children:n.jsxs(Jx,{data:t,margin:{top:20,right:10,left:10,bottom:20},barCategoryGap:8,children:[n.jsx(au,{strokeDasharray:"3 3",vertical:!1,opacity:.3}),n.jsx(zo,{dataKey:"period",tickFormatter:u,fontSize:10,tickLine:!1,axisLine:!0,height:40}),n.jsx(so,{allowDecimals:!1,fontSize:10,tickLine:!1,axisLine:!1,width:30}),n.jsx(Mi,{formatter:m=>c(m),iconSize:10,fontSize:10,wrapperStyle:{fontSize:"12px",paddingTop:"10px"}}),n.jsx(Aa,{formatter:(m,f)=>[m,c(f)],labelFormatter:u}),h.map(m=>n.jsx(vc,{dataKey:m,stackId:"stack",fill:l[m]||"#777",radius:[0,0,0,0],name:m},m))]})})})})]})}function TV(){const[e,t]=g.useState(0),[r,s]=g.useState([]),{selectedBrand:a}=mn(),[i,o]=g.useState(new Set),[l,c]=g.useState(()=>sessionStorage.getItem("nextStepsForSuccessDismissed")==="true"),[d,u]=g.useState(new Set),h=g.useMemo(()=>["market trends","brand growth","customer engagement","viral content","AI insights"],[]);g.useEffect(()=>{const v=setTimeout(()=>{e===h.length-1?t(0):t(e+1)},2e3);return()=>clearTimeout(v)},[e,h]),g.useEffect(()=>{(async()=>{var _,S;const x=await de.auth.getSession();if(!((S=(_=x==null?void 0:x.data.session)==null?void 0:_.user)!=null&&S.id))return;const{data:b,error:y}=await de.schema("marketing_and_customer_success").from("user_message_views").select("message_id").eq("user_id",x.data.session.user.id);if(y){console.error("Error fetching viewed messages:",y);return}const w=new Set((b==null?void 0:b.map(C=>C.message_id))||[]),{data:j,error:N}=await de.schema("marketing_and_customer_success").from("marketing_messages").select("*").eq("active",!0).order("priority",{ascending:!1}).order("start_date",{ascending:!0}).limit(3);if(N&&N.code!=="PGRST116"){console.error("Error fetching marketing messages:",N);return}if(j){const C=j.filter(E=>!w.has(E.id));s(C)}})()},[]);const m=async(v,x)=>{var y,w;const b=await de.auth.getSession();if((w=(y=b==null?void 0:b.data.session)==null?void 0:y.user)!=null&&w.id)try{const{error:j}=await de.schema("marketing_and_customer_success").from("user_message_views").upsert({message_id:v,viewed_at:new Date().toISOString(),action_taken:!0,action_taken_at:new Date().toISOString(),user_id:b.data.session.user.id},{onConflict:"user_id,message_id"});if(j)throw j;x&&window.open(x,"_blank")}catch(j){console.error("Error handling message action:",j)}},f=async v=>{var b,y;const x=await de.auth.getSession();if((y=(b=x==null?void 0:x.data.session)==null?void 0:b.user)!=null&&y.id)try{const{error:w}=await de.schema("marketing_and_customer_success").from("user_message_views").upsert({message_id:v,viewed_at:new Date().toISOString(),action_taken:!1,user_id:x.data.session.user.id},{onConflict:"user_id,message_id"});if(w)throw w;o(j=>new Set([...j,v]))}catch(w){console.error("Error logging message dismissal:",w)}},p=()=>{sessionStorage.setItem("nextStepsForSuccessDismissed","true"),c(!0)},A=v=>{u(x=>{const b=new Set(x);return b.has(v)?b.delete(v):b.add(v),b})};return n.jsx(QS,{brandId:(a==null?void 0:a.id)||"",contentType:"landing-page",children:n.jsxs("div",{className:"flex flex-col min-w-0",children:[n.jsx("div",{className:"px-4 sm:px-6 lg:px-8 pt-4",children:n.jsx(Bgt,{})}),n.jsx("div",{className:"px-4 sm:px-6 lg:px-4 pt-4 md:pt-4 pb-4 md:pb-6",children:n.jsxs("div",{className:"relative overflow-hidden bg-gradient-to-br from-white via-blue-50/30 to-indigo-50/40 rounded-2xl border border-blue-200/50 shadow-sm p-4 md:p-8",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsx("div",{className:"absolute top-0 right-0 w-40 h-40 bg-gradient-to-br from-blue-200/20 to-transparent rounded-full -translate-y-20 translate-x-20"}),n.jsx("div",{className:"relative",children:n.jsx("div",{className:"flex items-center gap-2 md:gap-4",children:n.jsx("div",{className:"flex-1",children:n.jsxs("div",{className:"flex items-center gap-2 mb-1 md:mb-2",children:[n.jsxs("h1",{className:"text-2xl md:text-4xl font-bold bg-gradient-to-r from-blue-700 via-indigo-700 to-purple-700 bg-clip-text text-transparent",children:[a==null?void 0:a.brand_name," Dashboard"]}),n.jsx(Ya,{delayDuration:200,children:n.jsxs(Hs,{children:[n.jsx(zs,{asChild:!0,children:n.jsx("button",{type:"button",className:"p-1.5 rounded-full hover:bg-blue-100/50 transition-colors flex-shrink-0","aria-label":"Dashboard information",children:n.jsx(qi,{className:"h-4 w-4 md:h-5 md:w-5 text-blue-600"})})}),n.jsx(Vn,{side:"bottom",className:"max-w-xs p-3",children:n.jsx("p",{className:"text-sm leading-relaxed",children:"Monitor your brand's performance and discover opportunities to amplify your market presence through data-driven insights."})})]})})]})})})})]})}),r.length>0&&(()=>{const v=r.filter(x=>!i.has(x.id))[0];return v?n.jsx("div",{className:"px-4 sm:px-6 lg:px-8 pb-6",children:n.jsx(Tgt,{show:!0,icon:n.jsx(qi,{className:"h-5 w-5 text-green-700"}),title:n.jsxs("span",{children:[n.jsx("span",{className:"font-semibold",children:v.title})," - ",v.message]}),action:v.action_text&&v.action_url?{label:v.action_text,onClick:()=>m(v.id,v.action_url)}:void 0,onHide:()=>f(v.id),learnMoreUrl:v.action_url||void 0},v.id)}):null})(),n.jsx("section",{className:"px-4 sm:px-6 lg:px-8 pb-6",children:n.jsxs("div",{className:"mx-auto",children:[n.jsxs("div",{className:"lg:hidden space-y-6",children:[n.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-gray-200 overflow-hidden",children:[n.jsx("div",{className:"p-3 md:p-4 border-b border-gray-200 bg-gradient-to-r from-purple-50 to-violet-50",children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(sa,{className:"h-4 w-4 md:h-5 md:w-5 text-purple-600"}),n.jsx("h2",{className:"text-base md:text-lg font-bold text-purple-900",children:"Trending Convergences"})]})}),n.jsx("div",{className:"max-h-[80vh] overflow-y-auto",children:n.jsx(tT,{})})]}),!l&&n.jsx("div",{children:n.jsx(kV,{onDismiss:p})}),n.jsx("div",{children:n.jsx(ey,{placement:"header",showCurrentTime:!0,compact:!1,className:"bg-muted/20 rounded-lg"})}),n.jsxs("div",{className:"space-y-4",children:[n.jsx(PV,{isExpanded:d.has("goodies"),onToggle:()=>A("goodies")}),n.jsx(BV,{isExpanded:d.has("content-chart"),onToggle:()=>A("content-chart")}),n.jsx(EV,{isExpanded:d.has("content"),onToggle:()=>A("content")})]})]}),n.jsxs("div",{className:"hidden lg:grid lg:grid-cols-12 lg:gap-6",children:[n.jsx("div",{className:"lg:col-span-8",children:n.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-gray-200 overflow-hidden",children:[n.jsxs("div",{className:"p-4 border-b border-gray-200 bg-gradient-to-r from-purple-50 to-violet-50",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(sa,{className:"h-5 w-5 text-purple-600"}),n.jsx("h2",{className:"text-base md:text-lg font-bold text-purple-900",children:"Trending Convergences"})]}),n.jsx("p",{className:"text-sm text-purple-700 mt-1",children:"Your latest topical opportunities"})]}),n.jsx("div",{className:"max-h-[calc(100vh-200px)] overflow-y-auto",children:n.jsx(tT,{})})]})}),n.jsx("div",{className:"lg:col-span-4 space-y-6",children:n.jsxs("div",{className:"sticky top-6 space-y-6",children:[n.jsx(ey,{placement:"header",showCurrentTime:!0,compact:!1,className:"bg-muted/20 rounded-lg"}),!l&&n.jsx(kV,{onDismiss:p}),n.jsx(PV,{isExpanded:d.has("goodies"),onToggle:()=>A("goodies")}),n.jsx(BV,{isExpanded:d.has("content-chart"),onToggle:()=>A("content-chart")}),n.jsx(EV,{isExpanded:d.has("content"),onToggle:()=>A("content")})]})})]})]})})]})})}function PV({isExpanded:e,onToggle:t}
1927){const r={id:"goodies",icon:ixe,title:"Goodies & Resources",subtitle:"Access helpful tools, templates, and resources for your brand",description:"",gradient:"from-pink-50 to-rose-50 dark:from-pink-950/20 dark:to-rose-950/20",iconGradient:"from-pink-500 to-rose-600",textColor:"text-pink-900 dark:text-pink-100",subtextColor:"text-pink-700 dark:text-pink-200",bottomGradient:"from-pink-200 via-rose-200 to-red-200 dark:from-pink-800 dark:via-rose-800 dark:to-red-800",content:n.jsx(Pgt,{})};return n.jsx(TL,{widget:r,isExpanded:e,onToggle:t})}function Gle(){const e=()=>{for(const t in localStorage)(t.includes("supabase.auth")||t.includes("sb-"))&&localStorage.removeItem(t);document.cookie.split(";").forEach(t=>{const[r]=t.trim().split("=");r.includes("sb-")&&(document.cookie=`${r}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`)})};return g.useEffect(()=>{async function t(){try{const{data:r}=await de.auth.getSession();r.session&&await de.auth.signOut({scope:"global"}),e(),window.location.href="/?forceLogout="+Date.now()}catch(r){console.error("Error during logout:",r),e(),window.location.href="/?forceLogout="+Date.now()}}t()},[]),n.jsx("div",{className:"min-h-screen flex items-center justify-center",children:n.jsxs("div",{className:"text-center space-y-4",children:[n.jsx(kt,{className:"h-8 w-8 animate-spin mx-auto"}),n.jsx("p",{className:"text-lg",children:"Logging out..."})]})})}const Fgt=()=>{console.log("[AcceptInvitation Debug] Component rendering");const[e]=Bi(),r=Ei().token||"",s=e.get("token")||"",a=r||s;console.log("[AcceptInvitation Debug] Token from path:",r,"Token from query:",s);const[i,o]=g.useState(a),[l,c]=g.useState(null),[d,u]=g.useState(!1),[h,m]=g.useState(null),[f,p]=g.useState("signup");console.log(f);const A=xr(),{toast:v}=sn(),x=g.useCallback(async w=>{console.log("[AcceptInvitation Debug] Looking up invitation with token:",w),u(!0);try{const{data:j,error:N}=await de.rpc("lookup_brand_invitation",{lookup_token:w});if(N){console.error("[AcceptInvitation Debug] Error looking up invitation:",N),v({title:"Error",description:"Failed to look up invitation. "+N.message,variant:"destructive"});return}console.log("[AcceptInvitation Debug] Invitation lookup result:",j),c(j)}catch(j){console.error("[AcceptInvitation Debug] Error in lookupInvitation:",j)}finally{u(!1)}},[v]);g.useEffect(()=>{(async()=>{console.log("[AcceptInvitation Debug] Checking session");const{data:N}=await de.auth.getSession();console.log("[AcceptInvitation Debug] Session data:",N),m(N.session),N.session&&i&&(console.log("[AcceptInvitation Debug] Have session and token, looking up invitation"),x(i))})();const{data:j}=de.auth.onAuthStateChange((N,_)=>{console.log("[AcceptInvitation Debug] Auth state changed:",N),m(_),_&&i&&(console.log("[AcceptInvitation Debug] New session detected with token, looking up invitation"),x(i))});return()=>{console.log("[AcceptInvitation Debug] Cleaning up auth listener"),j.subscription.unsubscribe()}},[i,x]),g.useEffect(()=>{console.log("[AcceptInvitation Debug] Token effect running, token:",i),i&&x(i)},[i,x]);const b=w=>{o(w.target.value),c(null)},y=async()=>{if(console.log("[AcceptInvitation Debug] Starting invitation acceptance process"),!(l!=null&&l.active)){console.log("[AcceptInvitation Debug] Invitation is not active"),v({title:"Error",description:"This invitation is not valid or has expired.",variant:"destructive"});return}if(!h){console.log("[AcceptInvitation Debug] User is not authenticated"),v({title:"Authentication Required",description:"Please sign in or create an account to accept this invitation.",variant:"default"}),p("login");return}console.log("[AcceptInvitation Debug] User authenticated, current user:",h.user.id),u(!0);try{console.log("[AcceptInvitation Debug] Calling accept_brand_invitation RPC with token:",i);const{data:w,error:j}=await de.rpc("accept_brand_invitation",{invitation_token:i});if(console.log("[AcceptInvitation Debug] RPC response:",{data:w,error:j}),j){console.error("Error accepting invitation:",j),v({title:"Error",description:"Failed to accept invitation. "+j.message,variant:"destructive"});return}console.log("[AcceptInvitation Debug] Invitation accepted successfully:",w),v({title:"Success",description:`You have been added to ${l.brand_name}. You can now access all team resources.`,duration:5e3}),setTimeout(()=>{A("/brands")},1500)}catch(w){console.error("Error in acceptInvitation:",w),v({title:"Error",description:"An unexpected error occurred. Please try again.",variant:"destructive"})}finally{u(!1)}};return n.jsx("div",{className:"flex pt-16",children:n.jsxs(Te,{className:"mx-auto w-full max-w-md",children:[n.jsxs(st,{children:[n.jsx(ot,{children:"Join Your Team"}),n.jsx(Wr,{children:i?"Accept an invitation to join a team":"Enter your invitation token"})]}),n.jsx(Re,{children:h?n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"token",children:"Invitation Token"}),n.jsx(qe,{id:"token",placeholder:"Enter your invitation token",value:i,onChange:b})]}),i&&!d&&!l&&n.jsx(te,{variant:"outline",onClick:()=>x(i),disabled:!i||d,className:"w-full",children:"Verify Token"}),l&&n.jsxs("div",{className:"p-4 rounded-md border mt-4",children:[n.jsx("h3",{className:"font-medium",children:"Invitation Details"}),l.active?n.jsxs("div",{className:"mt-2",children:[n.jsxs("p",{children:["You've been invited to join ",l.brand_name]}),n.jsx("p",{className:"text-sm text-green-600 mt-1",children:"This invitation is active"})]}):n.jsx("p",{className:"text-sm text-red-600 mt-2",children:"This invitation is not val
1927id or has expired"})]})]}):n.jsxs("div",{className:"space-y-4",children:[l&&n.jsxs("div",{className:"rounded-md border bg-muted/50 p-4",children:[n.jsx("h3",{className:"font-medium",children:"Invitation Details"}),l.active?n.jsxs("div",{className:"mt-2",children:[n.jsxs("p",{children:["You've been invited to join ",l.brand_name]}),n.jsx("p",{className:"mt-1 text-sm text-green-600",children:"This invitation is active"}),n.jsx("p",{className:"mt-2 text-sm",children:"Please sign in or create an account to accept this invitation."})]}):n.jsx("p",{className:"mt-2 text-sm text-red-600",children:"This invitation is not valid or has expired"})]}),!l&&n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"token",children:"Invitation Token"}),n.jsx(qe,{id:"token",placeholder:"Enter your invitation token",value:i,onChange:b})]}),i&&!d&&n.jsx(te,{variant:"outline",onClick:()=>x(i),disabled:!i||d,className:"w-full",children:"Verify Token"})]}),(l==null?void 0:l.active)&&n.jsx(w2,{view:"invite",redirectTo:`/process-invitation?invitation_token=${i}`,hideLabels:!0})]})}),n.jsx(uo,{className:"flex justify-end",children:h&&n.jsx(te,{onClick:y,disabled:d||!(l!=null&&l.active),className:"w-full",children:d?"Processing...":"Accept Invitation"})})]})})};function ZP(){var v;const{token:e}=Ei(),t=xr(),{session:r}=wa(),{toast:s}=sn(),[a,i]=g.useState(!0),[o,l]=g.useState(!1),[c,d]=g.useState(null),[u,h]=g.useState(!1);g.useEffect(()=>{e&&m()},[e]);const m=async()=>{try{const{createClient:x}=await hs(async()=>{const{createClient:j}=await Promise.resolve().then(()=>lR);return{createClient:j}},void 0),b=x("https://olgnnenccqwwbahcpsgn.supabase.co","eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im9sZ25uZW5jY3F3d2JhaGNwc2duIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MjQxNjUyMDksImV4cCI6MjAzOTc0MTIwOX0.qUa9W4vEYLC7LaUPczpqHA9tp8NSiWB7POqOWEvJpYQ"),{data:y,error:w}=await b.rpc("get_brand_invitation_details",{p_token:e});if(w)throw console.error("Error fetching invitation:",w),new Error(w.message);d(y)}catch(x){console.error("Error fetching invitation:",x),d({valid:!1,error:"Failed to load invitation details"})}finally{i(!1)}},f=async()=>{if(!r){s({title:"Authentication Required",description:"Please sign in or create an account to accept this invitation.",variant:"default"});return}if(!e){s({title:"Error",description:"No invitation token found.",variant:"destructive"});return}l(!0);try{const{createClient:x}=await hs(async()=>{const{createClient:j}=await Promise.resolve().then(()=>lR);return{createClient:j}},void 0),b=x("https://olgnnenccqwwbahcpsgn.supabase.co","eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im9sZ25uZW5jY3F3d2JhaGNwc2duIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MjQxNjUyMDksImV4cCI6MjAzOTc0MTIwOX0.qUa9W4vEYLC7LaUPczpqHA9tp8NSiWB7POqOWEvJpYQ",{auth:{persistSession:!1},global:{headers:{Authorization:`Bearer ${r.access_token}`}}}),{data:y,error:w}=await b.rpc("accept_brand_invitation",{invitation_token:e});if(w)throw new Error(w.message||"Failed to accept invitation");h(!0);try{const{error:j}=await b.schema("marketing_and_customer_success").from("profiles").update({onboarding_completed:!0}).eq("id",r.user.id);j?console.error("[AcceptBrandInvitation] Error updating profile:",j):console.log("[AcceptBrandInvitation] Set onboarding_completed to true")}catch(j){console.error("[AcceptBrandInvitation] Error updating onboarding status:",j)}s({title:"Success!",description:`You now have ${y.access_level} access to ${y.brand_name}`}),setTimeout(()=>{t("/brands")},2e3)}catch(x){console.error("Error accepting invitation:",x),s({title:"Error",description:x instanceof Error?x.message:"Failed to accept invitation",variant:"destructive"})}finally{l(!1)}},p=x=>{switch(x){case"owner":return"Full administrative access including managing other users";case"editor":return"Create and edit content, campaigns, and resources";case"viewer":return"View-only access to all brand content";default:return x}},A=x=>{switch(x){case"owner":return"bg-purple-100 text-purple-800";case"editor":return"bg-blue-100 text-blue-800";case"viewer":return"bg-gray-100 text-gray-800";default:return"bg-gray-100 text-gray-800"}};return a?n.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50",children:n.jsx(Te,{className:"w-full max-w-md",children:n.jsxs(Re,{className:"flex flex-col items-center py-12",children:[n.jsx(kt,{className:"h-8 w-8 animate-spin text-primary mb-4"}),n.jsx("p",{className:"text-muted-foreground",children:"Loading invitation details..."})]})})}):c!=null&&c.valid?u?n.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50",children:n.jsxs(Te,{className:"w-full max-w-md",children:[n.jsx(st,{children:n.jsxs("div",{className:"flex items-center space-x-2",children:[n.jsx(qt,{className:"h-6 w-6 text-green-500"}),n.jsx(ot,{children:"Invitation Accepted!"})]})}),n.jsx(Re,{children:n.jsxs("p",{className:"text-muted-foreground",children:["You now have access to ",n.jsx("span",{className:"font-semibold",children:c.brand_name}),". Redirecting you to your brands..."]})})]})}):n.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50 p-4",children:n.jsxs(Te,{className:"w-full max-w-lg",children:[n.jsxs(st,{className:"text-center",children:[n.jsx(ot,{className:"text-2xl",children:"Brand Access Invitation"}),n.jsx(Wr,{children:"You've been invited to collaborate on Rainfactory"})]}),n.jsxs(Re,{className:"space-y-6",children:[n.jsxs("div",{className:"bg-gray-50 rounded-lg p-4 space-y-3",children:[n.jsxs("div",{className:"flex items-start space-x-3",children:[n.jsx(zh,{className:"h-5 w-5 text-gray-500 mt-0.5"}),n.jsxs("div",{className:"flex-1",children:[n.jsx("p",{className:"text-sm text-gray-500",children:"Brand"}),n.jsx("p",{className:"font-semibold text-lg",children:c.brand_name})]})]}),n.jsxs("div",{className:"flex items-start space-x-3",children:[n.jsx(li,{className:"h-5 w-5 text-gray-500 mt-0.5"}),n.jsxs("div",{className:"flex-1",children:[n.jsx("p",{className:"text-sm text-gray-500",children:"Invited by"}),n.jsx("p",{className:"font-medium",children:c.invited_by})]})]}),n.jsxs("div",{className:"flex items-start space-x-3",children:[n.jsx(Cu,{className:"h-5 w-5 text-gray-500 mt-0.5"}),n.jsxs("div",{className:"flex-1",children:[n.jsx("p",{className:"text-sm text-gray-500",children:"Invitation for"}),n.jsx("p",{className:"font-medium",children:c.email})]})]}),n.jsxs("div",{className:"flex items-start space-x-3",children:[n.jsx(Kn,{className:"h-5 w-5 text-gray-500 mt-0.5"}),n.jsxs("div",{className:"flex-1",children:[n.jsx("p",{className:"text-sm text-gray-500",children:"Expires"}),n.jsx("p",{className:"font-medium",children:c.expires_at?nn(new Date(c.expires_at),"PPP"):"Never"})]})]})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("p",{className:"text-sm font-medium",children:"Access Level"}),n.jsxs("div",{className:"flex items-center space-x-2",children:[n.jsx(Be,{className:A(c.access_level||""),children:c.access_level?c.access_level.charAt(0).toUpperCase()+c.access_level.slice(1):""}),n.jsx("span",{className:"text-sm text-muted-foreground",children:p(c.access_level||"")})]})]}),c.message&&n.jsxs("div",{className:"space-y-2",children:[n.jsxs("p",{className:"text-sm font-medium",children:["Message from ",c.invited_by]}),n.jsx("div",{className:"bg-yellow-50 border border-yellow-200 rounded-md p-3",children:n.jsx("p",{className:"text-sm",children:c.message})})]}),r&&((v=r.user)==null?void 0:v.email)!==c.email&&n.jsx("div",{className:"bg-amber-50 border border-amber-200 rounded-md p-3",children:n.jsxs("p",{className:"text-sm text-amber-800",children:[n.jsx("strong",{children:"Note:"})," You're logged in as ",r.user.email,", but this invitation is for ",c.email,". You may need to log in with the correct account."]})}),!r&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"border-t pt-4",children:n.jsx("p",{className:"text-sm text-muted-foreground text-center mb-4",children:"Please sign in or create an account to accept this invitation"})}
1927),n.jsx(w2,{view:"invite",redirectTo:`/process-invitation?invitation_token=${e}`,hideLabels:!0})]})]}),r&&n.jsxs(uo,{className:"flex gap-2",children:[n.jsx(te,{variant:"outline",onClick:()=>t("/"),className:"flex-1",children:"Cancel"}),n.jsx(te,{onClick:f,disabled:o,className:"flex-1",children:o?n.jsxs(n.Fragment,{children:[n.jsx(kt,{className:"mr-2 h-4 w-4 animate-spin"}),"Accepting..."]}):"Accept Invitation"})]})]})}):n.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50",children:n.jsxs(Te,{className:"w-full max-w-md",children:[n.jsx(st,{children:n.jsxs("div",{className:"flex items-center space-x-2",children:[n.jsx(Rl,{className:"h-6 w-6 text-red-500"}),n.jsx(ot,{children:"Invalid Invitation"})]})}),n.jsx(Re,{children:n.jsx("p",{className:"text-muted-foreground",children:(c==null?void 0:c.error)||"This invitation is invalid or has expired."})}),n.jsx(uo,{children:n.jsx(te,{onClick:()=>t("/"),variant:"outline",className:"w-full",children:"Go to Home"})})]})})}function Lgt(){const[e,t]=g.useState(0),[r,s]=g.useState({}),a=[{id:"business_account",question:"Is your Instagram account already a Business Account?",description:"Instagram Business accounts have access to analytics and can be connected to Facebook pages.",instructions:n.jsxs("div",{className:"space-y-4",children:[n.jsx("h3",{className:"font-semibold text-lg",children:"How to switch to a Business Account"}),n.jsxs(Ar,{className:"bg-amber-50 border-amber-200",children:[n.jsx(hn,{className:"h-4 w-4 text-amber-600"}),n.jsxs(gr,{className:"text-amber-800",children:[n.jsx("strong",{children:"Use Your Phone!"})," These steps cannot be done on desktop in a browser."]})]}),n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx(Be,{className:"bg-blue-600 mt-0.5",children:"1"}),n.jsx("span",{children:"Open the Instagram app"})]}),n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx(Be,{className:"bg-blue-600 mt-0.5",children:"2"}),n.jsx("span",{children:"Go to your Profile"})]}),n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx(Be,{className:"bg-blue-600 mt-0.5",children:"3"}),n.jsx("span",{children:"Tap the menu (≡) → Account type and tools"})]}),n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx(Be,{className:"bg-blue-600 mt-0.5",children:"4"}),n.jsxs("div",{children:[n.jsxs("span",{children:["Tap ",n.jsx("strong",{children:"Switch to professional account"})]}),n.jsxs(Ar,{className:"mt-2 bg-red-50 border-red-200",children:[n.jsx(hn,{className:"h-4 w-4 text-red-600"}),n.jsxs(gr,{className:"text-red-800",children:["You must select ",n.jsx("strong",{children:'"Business"'}),' NOT "Creator" (creator accounts do not get prompted to connect to a Facebook page)']})]})]})]})]})]})},{id:"facebook_page",question:"Do you have a Facebook Page for your business?",description:"A Facebook Page is required to connect Instagram Business accounts.",instructions:n.jsxs("div",{className:"space-y-4",children:[n.jsx("h3",{className:"font-semibold text-lg",children:"How to create a Facebook Page"}),n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx(Be,{className:"bg-blue-600 mt-0.5",children:"1"}),n.jsxs("span",{children:["Go to ",n.jsx("a",{href:"https://www.facebook.com/business/tools/facebook-pages",target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:underline",children:"facebook.com/business/tools/facebook-pages"})]})]}),n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx(Be,{className:"bg-blue-600 mt-0.5",children:"2"}),n.jsx("span",{children:"Fill out the form as best you can"})]}),n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx(Be,{className:"bg-blue-600 mt-0.5",children:"3"}),n.jsx("span",{children:"Click 'Create Page'"})]}),n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx(Be,{className:"bg-blue-600 mt-0.5",children:"4"}),n.jsx("span",{children:"Fill out more information if you want (optional)"})]}),n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx(Be,{className:"bg-blue-600 mt-0.5",children:"5"}),n.jsx("span",{children:"Continue through the wizard process until done"})]})]}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Your page is now ready to connect!"})]})},{id:"instagram_facebook_connected",question:"Is your Instagram Business Account connected to your Facebook Page?",description:"This connection verifies ownership and enables scheduling features.",instructions:n.jsxs("div",{className:"space-y-4",children:[n.jsx("h3",{className:"font-semibold text-lg",children:"How to verify ownership with Facebook"}),n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx(Be,{className:"bg-blue-600 mt-0.5",children:"1"}),n.jsxs("span",{children:["Go to ",n.jsx("a",{href:"https://business.facebook.com/",target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:underline",children:"business.facebook.com"})]})]}),n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx(Be,{className:"bg-blue-600 mt-0.5",children:"2"}),n.jsx("span",{children:"Log in"})]}),n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx(Be,{className:"bg-blue-600 mt-0.5",children:"3"}),n.jsx("span",{children:"Click Settings"})]}),n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx(Be,{className:"bg-blue-600 mt-0.5",children:"4"}),n.jsx("span",{children:"Click 'Add Instagram'"})]}),n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx(Be,{className:"bg-blue-600 mt-0.5",children:"5"}),n.jsx("span",{children:"Login to Instagram with your Instagram Business account"})]})]}),n.jsx(Ar,{className:"mt-4",children:n.jsxs(gr,{children:["You'll be redirected to a random page, but it did work! To verify the connection:",n.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[n.jsxs("li",{children:["Go back to ",n.jsx("a",{href:"https://business.facebook.com/",target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:underline",children:"business.facebook.com"})]}),n.jsx("li",{children:'Click "Settings" in the left nav menu'}),n.jsx("li",{children:'Click "Add Instagram"'}),n.jsx("li",{children:'There should be a green checkmark next to "Add an Instagram Profile"'})]})]})}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Note: The Facebook UI might continue to prompt you to add a Facebook page for a while. That's ok - Facebook needs to up their game here! 😅"})]})}],i=m=>{s({...r,[a[e].id]:m==="yes"})},o=()=>r[a[e].id]!==void 0,l=()=>Object.keys(r).length/a.length*100,c=()=>a.filter(m=>r[m.id]===!1),d=()=>Object.keys(r).length===a.length&&Object.values(r).every(m=>m===!0),u=a[e],h=r[u.id];if(Object.keys(r).length===a.length){const m=c();return n.jsxs("div",{className:"space-y-6",children:[n.jsx(Ou,{value:100,className:"h-2"}),d()?n.jsx(Te,{className:"bg-green-50 border-green-200",children:n.jsxs(Re,{className:"pt-6",children:[n.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[n.jsx(qt,{className:"h-6 w-6 text-green-600"}),n.jsx("h3",{className:"text-lg font-semibold text-green-800",children:"All prerequisites completed!"})]}),n.jsx("p",{className:"text-green-700",children:"You're ready to connect your Instagram Business Account to Rainfactory. Continue with the integration steps below."})]})}):n.jsxs(n.Fragment,{children:[n.jsxs(Ar,{className:"bg-amber-50 border-amber-200",children:[n.jsx(hn,{className:"h-4 w-4 text-amber-600"}),n.jsxs(gr,{className:"text-amber-800",children:[n.jsx("strong",{children:"Setup Required:"})," You need to complete ",m.length," prerequisite",m.length>
19271?"s":""," before connecting to Rainfactory."]})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsx("h3",{className:"font-semibold",children:"Complete these steps:"}),m.map((f,p)=>n.jsx(Te,{children:n.jsx(Re,{className:"pt-6",children:n.jsxs("div",{className:"flex items-start gap-3 mb-4",children:[n.jsx(Be,{variant:"outline",className:"mt-0.5",children:p+1}),n.jsxs("div",{className:"flex-1",children:[n.jsx("h4",{className:"font-medium mb-2",children:f.question.replace("?","")}),f.instructions]})]})})},f.id))]}),n.jsx("div",{className:"flex justify-between",children:n.jsxs(te,{variant:"outline",onClick:()=>{s({}),t(0)},children:[n.jsx(Nu,{className:"h-4 w-4 mr-2"}),"Start Over"]})})]})]})}return n.jsxs("div",{className:"space-y-6",children:[n.jsx(Ou,{value:l(),className:"h-2"}),n.jsx(Te,{children:n.jsx(Re,{className:"pt-6",children:n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"text-lg font-semibold mb-2",children:u.question}),u.description&&n.jsx("p",{className:"text-muted-foreground text-sm",children:u.description})]}),n.jsxs(BL,{value:h===void 0?"":h?"yes":"no",onValueChange:i,children:[n.jsxs("div",{className:"flex items-center space-x-2",children:[n.jsx(S_,{value:"yes",id:"yes"}),n.jsx(ze,{htmlFor:"yes",children:"Yes, I have this set up"})]}),n.jsxs("div",{className:"flex items-center space-x-2",children:[n.jsx(S_,{value:"no",id:"no"}),n.jsx(ze,{htmlFor:"no",children:"No, I need to set this up"})]})]}),h===!1&&u.instructions&&n.jsxs(n.Fragment,{children:[n.jsx(xn,{className:"my-4"}),u.instructions]})]})})}),n.jsxs("div",{className:"flex justify-between",children:[n.jsxs(te,{variant:"outline",onClick:()=>t(e-1),disabled:e===0,children:[n.jsx(Nu,{className:"h-4 w-4 mr-2"}),"Previous"]}),n.jsxs("span",{className:"text-sm text-muted-foreground self-center",children:["Step ",e+1," of ",a.length]}),n.jsxs(te,{onClick:()=>t(e+1),disabled:!o()||e===a.length-1,children:["Next",n.jsx(_s,{className:"h-4 w-4 ml-2"})]})]})]})}function Dgt({onBack:e}){return n.jsxs("div",{className:"max-w-4xl mx-auto p-6 space-y-8",children:[n.jsxs("div",{className:"flex items-center gap-4",children:[e&&n.jsxs(te,{variant:"outline",size:"sm",onClick:e,children:[n.jsx(Yo,{className:"h-4 w-4 mr-2"}),"Back"]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"h-12 w-12 rounded-full bg-gradient-to-br from-pink-500 via-red-500 to-yellow-500 flex items-center justify-center",children:n.jsx(Vh,{className:"h-6 w-6 text-white"})}),n.jsxs("div",{children:[n.jsx("h1",{className:"text-3xl font-bold",children:"How to Integrate Instagram with Rainfactory"}),n.jsx("p",{className:"text-muted-foreground",children:"Connect your Instagram Business account to schedule and publish content"})]})]})]}),n.jsxs(Ar,{className:"bg-yellow-50 border-yellow-200",children:[n.jsx(hn,{className:"h-4 w-4 text-yellow-600"}),n.jsxs(gr,{className:"text-yellow-800",children:[n.jsx("strong",{children:"Important:"})," Instagram scheduling only works with ",n.jsx("strong",{children:"Instagram Business Accounts"})," linked to a ",n.jsx("strong",{children:"Facebook Page"}),"."]})]}),n.jsxs(Te,{children:[n.jsx(st,{children:n.jsxs(ot,{className:"flex items-center gap-2",children:[n.jsx(qt,{className:"h-5 w-5 text-green-600"}),"Prerequisite Wizard"]})}),n.jsxs(Re,{children:[n.jsxs("p",{className:"mb-4 text-muted-foreground",children:["This wizard will help you check and set up the prerequisites needed to connect Instagram to Rainfactory. It takes about ",n.jsx("strong",{children:"15 minutes"})," if you need to complete all steps."]}),n.jsx(Lgt,{})]})]}),n.jsxs(Te,{children:[n.jsx(st,{children:n.jsxs(ot,{className:"flex items-center gap-2",children:[n.jsx(ho,{className:"h-5 w-5 text-blue-600"}),"Integration Steps"]})}),n.jsxs(Re,{className:"space-y-6",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(Be,{className:"bg-blue-600",children:"1"}),n.jsx("h3",{className:"font-semibold",children:"Open Rainfactory"})]}),n.jsxs("p",{className:"ml-8 text-muted-foreground",children:["Navigate to your ",n.jsx("strong",{children:"Rainfactory homepage"}),"."]})]}),n.jsx(xn,{}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(Be,{className:"bg-blue-600",children:"2"}),n.jsx("h3",{className:"font-semibold",children:"Go to Brand Settings"})]}),n.jsxs("div",{className:"ml-8 space-y-2",children:[n.jsx("p",{className:"text-muted-foreground",children:"Navigate to your brand's settings page."}),n.jsxs("p",{className:"text-muted-foreground",children:["Find ",n.jsx("strong",{children:"Instagram Business"}),"."]}),n.jsxs("p",{className:"text-muted-foreground",children:["Click ",n.jsx("strong",{children:"Connect"}),"."]})]})]}),n.jsx(xn,{}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(Be,{className:"bg-blue-600",children:"3"}),n.jsx("h3",{className:"font-semibold",children:"Log in to Facebook"})]}),n.jsxs("div",{className:"ml-8 space-y-2",children:[n.jsx("p",{className:"text-muted-foreground",children:"If you're not already logged in to Facebook, you'll be prompted to log in."}),n.jsx("p",{className:"text-muted-foreground",children:"Continue as your personal Facebook account."})]})]}),n.jsx(xn,{}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(Be,{className:"bg-blue-600",children:"4"}),n.jsx("h3",{className:"font-semibold",children:"Log in to Instagram"})]}),n.jsx("p",{className:"ml-8 text-muted-foreground",children:"Enter your Instagram Business account credentials."})]}),n.jsx(xn,{}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(Be,{className:"bg-blue-600",children:"5"}),n.jsx("h3",{className:"font-semibold",children:"Set Permissions"})]}),n.jsxs("div",{className:"ml-8 space-y-3",children:[n.jsx("p",{className:"text-muted-foreground",children:"Select:"}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(qt,{className:"h-4 w-4 text-green-600"}),n.jsx("span",{className:"text-sm",children:"Opt into all current and future businesses"})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(qt,{className:"h-4 w-4 text-green-600"}),n.jsx("span",{className:"text-sm",children:"Opt into all current and future Facebook pages"})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(qt,{className:"h-4 w-4 text-green-600"}),n.jsx("span",{className:"text-sm",children:"Opt into all current and future Instagram accounts"})]})]}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"These permissions simplify setup and reduce errors."})]})]}),n.jsx(xn,{}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(Be,{className:"bg-blue-600",children:"6"}),n.jsx("h3",{className:"font-semibold",children:"Review and Confirm"})]}),n.jsxs("div",{className:"ml-8 space-y-2",children:[n.jsx("p",{className:"text-muted-foreground",children:"Review the permissions you've granted Rainfactory."}),n.jsxs("p",{className:"text-muted-foreground",children:["Click ",n.jsx("strong",{children:"Save"}),"."]})]})]})]})]}),n.jsxs(Te,{children:[n.jsx(st,{children:n.jsxs(ot,{className:"flex items-center gap-2",children:[n.jsx(_u,{className:"h-5 w-5 text-blue-600"}),"Finalize the Connection in Rainfactory"]})}),n.jsxs(Re,{className:"space-y-3",children:[n.jsxs("p",{children:["Return to ",n.jsx("strong",{children:"Rainfactory"}),"."]}),n.jsxs("p",{children:["Select the specific ",n.jsx("strong",{children:"Instagram Business Account"})," you want to connect."]}),n.jsxs("p",{children:["Click ",n.jsx("strong",{children:"Connect"}),"."]}),n.jsxs("p",{className:"text-sm text-muted-foreground",children:["Example: Connect your account like ",n.jsx("code",{className:"bg-gray-100 px-1 rounded",children:"@AIforMarketers"}),"."]})]})]}),n.jsx(Te,{className:"bg-green-50 border-green-200",children:n.jsxs(Re,{className:"pt-6",children:[n.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[n.jsx(qt,{className:"h-6 w-6 text-green-600"}),n.jsx("h3",{className:"text-lg font-semibold text-green-800",children:"You're Done!"})]}),n.jsx("p",{className:"text-green-700 mb-3",children:"You can now:"}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(qt,{className:"h-4 w-4 text-green-600"}),n.jsx("span",{className:"text-green-700",children:n.jsx("strong",{children:"Create Instagram content in Rainfactory"})})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(qt,{className:"h-4 w-4 text-green-600"}),n.jsx("span",{className:"text-green-700",children:n.jsx("strong",{children:"Schedule or publish posts directly from Rainfactory"})})]})]})]})}),n.jsxs(Te,{children:[n.jsx(st,{children:n.jsxs(ot,{className:"flex items-center gap-2",children:[n.jsx(hn,{className:"h-5 w-5 text-amber-600"}),"Troubleshooting Tips"]})}),n.jsxs(Re,{children:[n.jsx("p",{className:"mb-4",children:"If something isn't working, check:"}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(qt,{className:"h-4 w-4 text-green-600"}),n.jsxs("span",{children:["Is your Instagram account a ",n.jsx("strong",{children:"Business Account"}),"?"]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(qt,{className:"h-4 w-4 text-green-600"}),n.jsxs("span",{children:["Is it properly ",n.jsx("strong",{children:"connected to a Facebook Page"}),"?"]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(qt,{className:"h-4 w-4 text-green-600"}),n.jsxs("span",{children:["Are all ",n.jsx("strong",{children:"permissions granted"})," through your Meta Business account?"]})]})]})]})]}),n.jsx(Te,{className:"bg-blue-50 border-blue-200",children:n.jsxs(Re,{className:"pt-6",children:[n.jsx("h3",{className:"text-lg font-semibold mb-3",children:"Still need help?"}),n.jsxs("p",{className:"text-gray-700",children:["If you still need assistance with the Instagram integration, click the ",n.jsx("strong",{children:"'Help'"})," button in the nav menu and send us a note. We're happy to help!"]})]})})]})}function Rgt({onBack:e}){return n.jsxs("div",{className:"max-w-4xl mx-auto p-6 space-y-8",children:[n.jsxs("div",{className:"flex items-center gap-4",children:[e&&n.jsxs(te,{variant:"outline",size:"sm",onClick:e,children:[n.jsx(Yo,{className:"h-4 w-4 mr-2"}),"Back"]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"h-12 w-12 rounded-full bg-blue-600 flex items-center justify-center",children:n.jsx(_u,{className:"h-6 w-6 text-white"})}),n.jsxs("div",{children:[n.jsx("h1",{className:"text-3xl font-bold",children:"How to Connect Rainfactory with Your Facebook Page"}),n.jsx("p",{className:"text-muted-foreground",children:"Set up Facebook integration to publish directly to your Facebook Page"})]})]})]}),n.jsxs(Ar,{className:"bg-yellow-50 border-yellow-200",children:[n.jsx(hn,{className:"h-4 w-4 text-yellow-600"}),n.jsxs(gr,{className:"text-yellow-800",children:[n.jsx("strong",{children:"Important:"})," Facebook publishing requires proper ",n.jsx("strong",{children:"Business Portfolio"})," setup and ",n.jsx("strong",{children:"admin rights"})," to your Facebook Page."]})]}),n.jsxs(Te,{children:[n.jsx(st,{children:n.jsxs(ot,{className:"flex items-center gap-2",children:[n.jsx(qt,{className:"h-5 w-5 text-green-600"}),"Prerequisites"]})}),n.jsxs(Re,{className:"space-y-4",children:[n.jsx("p",{children:"Before integrating with Rainfactory, ensure the following:"}),n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(Be,{variant:"outline",className:"bg-green-50 text-green-700 border-green-200",children:"1"}),n.jsxs("span",{children:["You are an ",n.jsx("strong",{children:"admin of the Facebook Page"})," you're connecting"]})]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(Be,{variant:"outline",className:"bg-green-50 text-green-700 border-green-200",children:"2"}),n.jsxs("span",{children:["The Facebook Page is part of a ",n.jsx("strong",{children:"Business Portfolio"})," (formerly Facebook Business Manager)"]})]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(Be,{variant:"outline",className:"bg-green-50 text-green-700 border-green-200",children:"3"}),n.jsxs("span",{children:["Your ",n.jsx("strong",{children:"personal Facebook account"})," has ",n.jsx("strong",{children:"admin rights"})," to that Business Portfolio"]})]})]}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"📘 Make sure you have the proper permissions before starting the integration process."})]})]}),n.jsxs(Te,{children:[n.jsx(st,{children:n.jsxs(ot,{className:"flex items-center gap-2",children:[n.jsx(ho,{className:"h-5 w-5 text-blue-600"}),"Integration Steps"]})}),n.jsxs(Re,{className:"space-y-6",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(Be,{className:"bg-blue-600",children:"1"}),n.jsx("h3",{className:"font-semibold",children:"Open Rainfactory"})]}),n.jsxs("p",{className:"ml-8 text-muted-foreground",children:["Navigate to your ",n.jsx("strong",{children:"Rainfactory homepage"}),"."]})]}),n.jsx(xn,{}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(Be,{className:"bg-blue-600",children:"2"}),n.jsx("h3",{className:"font-semibold",children:"Go to Brand Settings"})]}),n.jsxs("div",{className:"ml-8 space-y-2",children:[n.jsx("p",{className:"text-muted-foreground",children:"Navigate to your brand's settings page."}),n.jsxs("p",{className:"text-muted-foreground",children:["Find the ",n.jsx("strong",{children:"Facebook"})," card."]}),n.jsxs("p",{className:"text-muted-foreground",children:["Click ",n.jsx("strong",{children:"Connect"}),"."]})]})]}),n.jsx(xn,{}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(Be,{className:"bg-blue-600",children:"3"}),n.jsx("h3",{className:"font-semibold",children:"Go to Facebook Business"})]}),n.jsxs("div",{className:"ml-8 space-y-2",children:[n.jsxs("p",{className:"text-muted-foreground",children:["Click ",n.jsx("strong",{children:"Go to Facebook Business"})," in the prompt."]}),n.jsxs("p",{className:"text-muted-foreground",children:["Select the ",n.jsx("strong",{children:"Business Portfolio"})," you want to connect to Rainfactory."]}),n.jsxs("p",{className:"text-muted-foreground",children:["Click ",n.jsx("strong",{children:"Continue"}),"."]})]})]}),n.jsx(xn,{}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(Be,{className:"bg-blue-600",children:"4"}),n.jsx("h3",{className:"font-semibold",children:"Select Facebook Page(s)"})]}),n.jsxs("div",{className:"ml-8 space-y-2",children:[n.jsx("p",{className:"text-muted-foreground",children:"Choose the Facebook Page(s) you want Rainfactory to manage."}),n.jsxs("p",{className:"text-muted-foreground",children:["Example: ✅ ",n.jsx("code",{className:"bg-gray-100 px-1 rounded",children:"Urban Roosters"})]}),n.jsxs("p",{className:"text-muted-foreground",children:["Click ",n.jsx("strong",{children:"Save"}),"."]})]})]})]})]}),n.jsxs(Te,{children:[n.jsx(st,{children:n.jsxs(ot,{className:"flex items-center gap-2",children:[n.jsx(Gh,{className:"h-5 w-5 text-green-600"}),"Confirm Connection in Rainfactory"]})}),n.jsxs(Re,{className:"space-y-3",children:[n.jsxs("p",{children:["Return to ",n.jsx("strong",{children:"Rainfactory"}),"."]}),n.jsxs("p",{children:["Select the Facebook Page you just added (e.g., ",n.jsx("code",{className:"bg-gray-100 px-1 rounded",children:"Urban Rooster"}),")."]}),n.jsxs("p",{children:["The ",n.jsx("strong",{children:"Facebook card"})," will now appear under a section labeled ",n.jsx("strong",{children:"Connected"})," with a ✅ green checkmark."]})]})]}),n.jsx(Te,{className:"bg-green-50 border-green-200",children:n.jsxs(Re,{className:"pt-6",children:[n.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[n
1927.jsx(qt,{className:"h-6 w-6 text-green-600"}),n.jsx("h3",{className:"text-lg font-semibold text-green-800",children:"You're Done!"})]}),n.jsx("p",{className:"text-green-700 mb-3",children:"You can now:"}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(qt,{className:"h-4 w-4 text-green-600"}),n.jsx("span",{className:"text-green-700",children:n.jsx("strong",{children:"Create posts in Rainfactory"})})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(qt,{className:"h-4 w-4 text-green-600"}),n.jsx("span",{className:"text-green-700",children:n.jsx("strong",{children:"Preview how they will appear on your Facebook Page"})})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(qt,{className:"h-4 w-4 text-green-600"}),n.jsxs("span",{className:"text-green-700",children:[n.jsx("strong",{children:"Schedule posts for future"})," or ",n.jsx("strong",{children:"publish immediately"})]})]})]}),n.jsxs("p",{className:"text-sm text-green-600 mt-4",children:["Example: Posts created in Rainfactory are published instantly to your ",n.jsx("strong",{children:"Facebook Page"}),"."]})]})}),n.jsxs(Te,{children:[n.jsx(st,{children:n.jsxs(ot,{className:"flex items-center gap-2",children:[n.jsx(hn,{className:"h-5 w-5 text-amber-600"}),"Troubleshooting Tips"]})}),n.jsxs(Re,{children:[n.jsx("p",{className:"mb-4",children:"If something isn't working, check:"}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(qt,{className:"h-4 w-4 text-green-600"}),n.jsxs("span",{children:["Are you an ",n.jsx("strong",{children:"admin of the Facebook Page"}),"?"]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(qt,{className:"h-4 w-4 text-green-600"}),n.jsxs("span",{children:["Is the Facebook Page part of a ",n.jsx("strong",{children:"Business Portfolio"}),"?"]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(qt,{className:"h-4 w-4 text-green-600"}),n.jsxs("span",{children:["Does your personal account have ",n.jsx("strong",{children:"admin rights"})," to the Business Portfolio?"]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(qt,{className:"h-4 w-4 text-green-600"}),n.jsxs("span",{children:["Are all ",n.jsx("strong",{children:"permissions granted"})," through your Meta Business account?"]})]})]})]})]})]})}function Ugt({onBack:e}){return n.jsxs("div",{className:"max-w-4xl mx-auto p-6 space-y-8",children:[n.jsxs("div",{className:"flex items-center gap-4",children:[e&&n.jsxs(te,{variant:"outline",size:"sm",onClick:e,children:[n.jsx(Yo,{className:"h-4 w-4 mr-2"}),"Back"]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"h-12 w-12 rounded-full bg-purple-600 flex items-center justify-center",children:n.jsx(J_,{className:"h-6 w-6 text-white"})}),n.jsxs("div",{children:[n.jsx("h1",{className:"text-3xl font-bold",children:"Webhook Integration Guide"}),n.jsx("p",{className:"text-muted-foreground",children:"Send published content to your external systems via HTTP webhooks"})]})]})]}),n.jsxs(Te,{children:[n.jsx(st,{children:n.jsxs(ot,{className:"flex items-center gap-2",children:[n.jsx(Is,{className:"h-5 w-5 text-blue-600"}),"What Are Webhooks in Rainfactory?"]})}),n.jsxs(Re,{className:"space-y-4",children:[n.jsx("p",{children:"Webhooks allow Rainfactory to automatically send data to your external systems in real-time when specific events occur. Think of webhooks as a notification system that pushes information to your applications instantly."}),n.jsxs("div",{className:"bg-blue-50 border-l-4 border-blue-600 p-4 rounded",children:[n.jsx("h4",{className:"font-semibold mb-2",children:"When Are Webhooks Triggered?"}),n.jsxs("p",{className:"text-sm",children:["Rainfactory sends a webhook notification every time content is ",n.jsx("strong",{children:"published"}),' to a platform. This happens automatically when you click "Publish" on any content item.']})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("h4",{className:"font-semibold",children:"Common Use Cases:"}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(qt,{className:"h-4 w-4 text-green-600"}),n.jsxs("span",{children:[n.jsx("strong",{children:"Zapier Integration:"})," Trigger automated workflows when content is published"]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(qt,{className:"h-4 w-4 text-green-600"}),n.jsxs("span",{children:[n.jsx("strong",{children:"Custom CMS:"})," Automatically sync published content to your website"]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(qt,{className:"h-4 w-4 text-green-600"}),n.jsxs("span",{children:[n.jsx("strong",{children:"Slack Notifications:"})," Get instant alerts when new content goes live"]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(qt,{className:"h-4 w-4 text-green-600"}),n.jsxs("span",{children:[n.jsx("strong",{children:"Analytics Systems:"})," Track content publishing events in your analytics platform"]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(qt,{className:"h-4 w-4 text-green-600"}),n.jsxs("span",{children:[n.jsx("strong",{children:"Content Backup:"})," Automatically archive published content to your storage"]})]})]})]})]})]}),n.jsxs(Te,{children:[n.jsx(st,{children:n.jsxs(ot,{className:"flex items-center gap-2",children:[n.jsx(ho,{className:"h-5 w-5 text-blue-600"}),"Setup Guide"]})}),n.jsxs(Re,{className:"space-y-6",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(Be,{className:"bg-blue-600",children:"1"}),n.jsx("h3",{className:"font-semibold",children:"Navigate to Social Automation Agents"})]}),n.jsxs("div",{className:"ml-8 space-y-2",children:[n.jsxs("p",{className:"text-muted-foreground",children:["From your Rainfactory dashboard, go to the ",n.jsx("strong",{children:"Social Automation Agents"})," page."]}),n.jsx("p",{className:"text-muted-foreground",children:"This is where you manage all your platform connections and integrations."})]})]}),n.jsx(xn,{}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(Be,{className:"bg-blue-600",children:"2"}),n.jsx("h3",{className:"font-semibold",children:"Find the Webhook Platform Card"})]}),n.jsxs("div",{className:"ml-8 space-y-2",children:[n.jsxs("p",{className:"text-muted-foreground",children:["Scroll to find the ",n.jsx("strong",{children:"Webhook"}
vendor: 6,110 bytes, lines 1927-1928
1927)," card in the list of available platforms."]}),n.jsx("p",{className:"text-muted-foreground",children:"It will have a purple webhook icon."})]})]}),n.jsx(xn,{}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(Be,{className:"bg-blue-600",children:"3"}),n.jsx("h3",{className:"font-semibold",children:"Enter Your Webhook URL"})]}),n.jsxs("div",{className:"ml-8 space-y-2",children:[n.jsxs("p",{className:"text-muted-foreground",children:["In the ",n.jsx("strong",{children:"Webhook URL"})," field, enter the full HTTPS URL where you want to receive webhook notifications."]}),n.jsx("div",{className:"bg-gray-100 p-3 rounded font-mono text-sm",children:"https://your-domain.com/webhooks/rainfactory"}),n.jsxs(Ar,{className:"bg-yellow-50 border-yellow-200",children:[n.jsx(hn,{className:"h-4 w-4 text-yellow-600"}),n.jsxs(gr,{className:"text-yellow-800",children:[n.jsx("strong",{children:"HTTPS Required:"})," Webhook URLs must use HTTPS for security. HTTP URLs are not supported."]})]})]})]}),n.jsx(xn,{}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(Be,{className:"bg-blue-600",children:"4"}),n.jsx("h3",{className:"font-semibold",children:"Choose Authentication Method"})]}),n.jsxs("div",{className:"ml-8 space-y-3",children:[n.jsx("p",{className:"text-muted-foreground",children:"Select how Rainfactory should authenticate requests to your webhook endpoint:"}),n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"border rounded p-3",children:[n.jsx("h4",{className:"font-semibold text-sm mb-1",children:"None"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"No authentication headers will be sent. Use this for testing or public endpoints."})]}),n.jsxs("div",{className:"border rounded p-3",children:[n.jsx("h4",{className:"font-semibold text-sm mb-1",children:"Bearer Token"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Send a bearer token in the Authorization header. Most common for API authentication."})]}),n.jsxs("div",{className:"border rounded p-3",children:[n.jsx("h4",{className:"font-semibold text-sm mb-1",children:"API Key"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Send a custom API key in a specified header name."})]}),n.jsxs("div",{className:"border rounded p-3",children:[n.jsx("h4",{className:"font-semibold text-sm mb-1",children:"Basic Auth"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Traditional username and password authentication."})]})]})]})]}),n.jsx(xn,{}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(Be,{className:"bg-blue-600",children:"5"}),n.jsx("h3",{className:"font-semibold",children:"Configure Advanced Settings (Optional)"})]}),n.jsxs("div",{className:"ml-8 space-y-3",children:[n.jsx("p",{className:"text-muted-foreground",children:"Optionally configure these advanced settings:"}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx(fs,{className:"h-4 w-4 text-gray-600 mt-1"}),n.jsxs("div",{children:[n.jsx("span",{className:"font-semibold text-sm",children:"Timeout:"}),n.jsx("span",{className:"text-sm text-muted-foreground ml-2",children:"How long to wait for a response (default: 30 seconds)"})]})]}),n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx(Es,{className:"h-4 w-4 text-gray-600 mt-1"}),n.jsxs("div",{children:[n.jsx("span",{className:"font-semibold text-sm",children:"Max Retries:"}),n.jsx("span",{className:"text-sm text-muted-foreground ml-2",children:"Number of retry attempts on failure (default: 3)"})]})]}),n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx(m2,{className:"h-4 w-4 text-gray-600 mt-1"}),n.jsxs("div",{children:[n.jsx("span",{className:"font-semibold text-sm",children:"SSL Verification:"}),n.jsx("span",{className:"text-sm text-muted-foreground ml-2",children:"Verify SSL certificates (recommended: enabled)"})]})]})]})]})]}),n.jsx(xn,{}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(Be,{className:"bg-blue-600",children:"6"}),n.jsx("h3",{className:"font-semibold",children:"Test Your Webhook"})]}),n.jsxs("div",{className:"ml-8 space-y-2",children:[n.jsxs("p",{className:"text-muted-foreground",children:["Click the ",n.jsx("strong",{children:"Test Connection"})," button to send a test webhook to your endpoint."]}),n.jsx("p",{className:"text-muted-foreground",children:"Rainfactory will send a sample payload and verify that your endpoint responds with a 2xx status code."}),n.jsx("div",{className:"bg-green-50 border-l-4 border-green-600 p-3 rounded",children:n.jsx("p",{className:"text-sm text-green-800",children:"If the test succeeds, you'll see a success message confirming your webhook is working correctly."})})]})]}),n.jsx(xn,{}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(Be,{className:"bg-blue-600",children:"7"}),n.jsx("h3",{className:"font-semibold",children:"Save Configuration"})]}),n.jsxs("div",{className:"ml-8 space-y-2",children:[n.jsxs("p",{className:"text-muted-foreground",children:["Once testing is successful, click ",n.jsx("strong",{children:"Save"})," to activate your webhook integration."]}),n.jsx("p",{className:"text-muted-foreground",children:"Rainfactory will now send webhook notifications every time content is published."})]})]})]})]}),n.jsxs(Te,{children:[n.jsx(st,{children:n.jsxs(ot,{className:"flex items-center gap-2",children:[n.jsx(ng,{className:"h-5 w-5 text-purple-600"}),"Webhook Payload Reference"]})}),n.jsxs(Re,{className:"space-y-4",children:[n.jsx("p",{children:"When content is published, Rainfactory sends a POST request to your webhook URL with the following JSON payload:"}),n.jsx("div",{className:"bg-gray-900 text-gray-100 p-4 rounded-lg overflow-x-auto",children:n.jsx("pre",{className:"text-sm font-mono",children:`{
1928  "event": "content.published",
1929  "timestamp": "2025-12-03T12:00:00Z",
1930  "delivery_id": "550e8400-e29b-41d4-a716-446655440000",
1931  "brand": {
1932    "id": "123e4567-e89b-12d3-a456-426614174000",
1933    "name": "Your Brand Name"
1934  },
1935  "content": {
1936    "id": "987fcdeb-51a2-43f7-8d9e-123456789abc",
1937    "type": "social_post",
1938    "title": "Amazing New Product Launch",
1939    "body": "Full content body text here...",
1940    "excerpt": "Short excerpt or preview text",
1941    "url": "https://rainfactory.ai/content/987fcdeb..."
1942  },
1943  "post": {
1944    "id": "456e7890-ab12-34cd-ef56-789012345678",
1945    "text": "Formatted post text ready for social media",
1946    "media": [
1947      {
1948        "url": "https://storage.example.com/image.jpg",
1949        "type": "image",
1950        "alt_text": "Product photo showing features"
1951      }
1952    ],
1953    "hashtags": ["ProductLaunch", "Innovation", "Tech"],
1954    "platform_post_type": "single"
1955  },
1956  "campaign": {
1957    "id": "321f6789-cd23-45ef-ab67-890123456789",
1958    "name": "Q4 Product Launch Campaign"
1959  },
1960  "convergence": {
1961    "id": "654a3210-fe98-76ba-54cd-321098765432",
1962    "title": "Product Launch Strategy"
1963  }
1964}`})}),n.jsxs("div",{className:"space-y-3 mt-6",children:[n.jsx("h4",{className:"font-semibold",children:"Field Descriptions:"}),n.jsx("div",{className:"border rounded-lg overflow-hidden",children:n.jsxs("table",{className:"w-full text-sm",children:[n.jsx("thead",{className:"bg-gray-50",children:n.jsxs("tr",{children:[n.jsx("th",{className:"text-left p-3 font-semibold",children:"Field"}),n.jsx("th",{className:"text-left p-3 font-semibold",children:"Type"}),n.jsx("th",{className:"text-left p-3 font-semibold",children:"Description"})]})}),n.jsxs("tbody",{className:"divide-y",children:[n.jsxs("tr",{children:[n.jsx("td",{className:"p-3 font-mono text-xs",children:"event"}),n.jsx("td",{className:"p-3",children:"string"}),n.jsxs("td",{className:"p-3",children:["Event type, always ",n.jsx("code",{className:"bg-gray-100 px-1 rounded",children:"content.published"})]})]}),n.jsxs("tr",{children:[n.jsx("td",{className:"p-3 font-mono text-xs",children:"timestamp"}),n.jsx("td",{className:"p-3",children:"string"}),n.jsx("td",{className:"p-3",children:"ISO 8601 timestamp when the event occurred"})]}),n.jsxs("tr",{children:[n.jsx("td",{className:"p-3 font-mono text-xs",children:"delivery_id"}),n.jsx("td",{className:"p-3",children:"string"}),n.jsx("td",{className:"p-3",children:"Unique UUID for this webhook delivery (for tracking/debugging)"})]}),n.jsxs("tr",{children:[n.jsx("td",{className:"p-3 font-mono text-xs",children:"brand.id"}),n.jsx("td",{className:"p-3",children:"string"}),n.jsx("td",{className:"p-3",children:"UUID of the brand that published the content"})]}),n.jsxs("tr",{children:[n.jsx("td",{className:"p-3 font-mono text-xs",children:"brand.name"}),n.jsx("td",{className:"p-3",children:"string"}),n.jsx("td",{className:"p-3",children:"Name of the brand"})]}),n.jsxs("tr",{children:[n.jsx("td",{className:"p-3 font-mono text-xs",children:"content.id"}),n.jsx("td",{className:"p-3",children:"string"}),n.jsx("td",{className:"p-3",children:"UUID of the content item"})]}),n.jsxs("tr",{children:[n.jsx("td",{className:"p-3 font-mono text-xs",children:"content.type"}),n.jsx("td",{className:"p-3",children:"string"}),n.jsx("td",{className:"p-3",children:"Type of content (e.g., social_post, blog_post)"})]}),n.jsxs("tr",{children:[n.jsx("td",{className:"p-3 font-mono text-xs",children:"content.title"}),n.jsx("td",{className:"p-3",children:"string"}),n.jsx("td",{className:"p-3",children:"Title of the content"})]}),n.jsxs("tr",{children:[n.jsx("td",{className:"p-3 font-mono text-xs",children:"content.body"}),n.jsx("td",{className:"p-3",children:"string"}),n.jsx("td",{className:"p-3",children:"Full content body text"})]}),n.jsxs("tr",{children:[n.jsx("td",{className:"p-3 font-mono text-xs",children:"content.excerpt"}),n.jsx("td",{className:"p-3",children:"string"}),n.jsx("td",{className:"p-3",children:"Short preview or excerpt"})]}),n.jsxs("tr",{children:[n.jsx("td",{className:"p-3 font-mono text-xs",children:"content.url"}),n.jsx("td",{className:"p-3",children:"string"}),n.jsx("td",{className:"p-3",children:"URL to view the content in Rainfactory"})]}),n.jsxs("tr",{children:[n.jsx("td",{className:"p-3 font-mono text-xs",children:"post.id"}),n.jsx("td",{className:"p-3",children:"string"}),n.jsx("td",{className:"p-3",children:"UUID of the post instance"})]}),n.jsxs("tr",{children:[n.jsx("td",{className:"p-3 font-mono text-xs",children:"post.text"}),n.jsx("td",{className:"p-3",children:"string"}),n.jsx("td",{className:"p-3",children:"Formatted text ready for posting"})]}),n.jsxs("tr",{children:[n.jsx("td",{className:"p-3 font-mono text-xs",children:"post.media"}),n.jsx("td",{className:"p-3",children:"array"}),n.jsx("td",{className:"p-3",children:"Array of media objects (images/videos)"})]}),n.jsxs("tr",{children:[n.jsx("td",{className:"p-3 font-mono text-xs",children:"post.hashtags"}),n.jsx("td",{className:"p-3",children:"array"}),n.jsx("td",{className:"p-3",children:"Array of hashtags (without # symbol)"})]}),n.jsxs("tr",{children:[n.jsx("td",{className:"p-3 font-mono text-xs",children:"post.platform_post_type"}),n.jsx("td",{className:"p-3",children:"string"}),n.jsx("td",{className:"p-3",children:"Post format: single, carousel, or thread"})]}),n.jsxs("tr",{children:[n.jsx("td",{className:"p-3 font-mono text-xs",children:"campaign.id"}),n.jsx("td",{className:"p-3",children:"string"}),n.jsx("td",{className:"p-3",children:"UUID of the associated campaign (if any)"})]}),n.jsxs("tr",{children:[n.jsx("td",{className:"p-3 font-mono text-xs",children:"campaign.name"}),n.jsx("td",{className:"p-3",children:"string"}),n.jsx("td",{className:"p-3",children:"Name of the campaign"})]}),n.jsxs("tr",{children:[n.jsx("td",{className:"p-3 font-mono text-xs",children:"convergence.id"}),n.jsx("td",{className:"p-3",children:"string"}),n.jsx("td",{className:"p-3",children:"UUID of the convergence (if any)"})]}),n.jsxs("tr",{children:[n.jsx("td",{className:"p-3 font-mono text-xs",children:"convergence.title"}),n.jsx("td",{className:"p-3",children:"string"}),n.jsx("td",{className:"p-3",children:"Title of the convergence"})]})]})]})})]})]})]}),n.jsxs(Te,{children:[n.jsx(st,{children:n.jsxs(ot,{className:"flex items-center gap-2",children:[n.jsx(m2,{className:"h-5 w-5 text-green-600"}),"Authentication Methods"]})}),n.jsxs(Re,{className:"space-y-4",children:[n.jsx("p",{children:"Rainfactory supports multiple authentication methods to secure your webhook endpoint:"}),n.jsxs("div",{className:"border rounded-lg p-4 space-y-2",children:[n.jsx("h4",{className:"font-semibold",children:"None"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"No authentication headers are sent with the request."}),n.jsxs("div",{className:"bg-gray-100 p-3 rounded font-mono text-xs",children:["POST /webhook HTTP/1.1",n.jsx("br",{}),"Host: your-domain.com",n.jsx("br",{}),"Content-Type: application/json"]}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"Use for testing or public endpoints that don't require authentication."})]}),n.jsxs("div",{className:"border rounded-lg p-4 space-y-2",children:[n.jsx("h4",{className:"font-semibold",children:"Bearer Token"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Sends your token in the standard Authorization header."}),n.jsxs("div",{className:"bg-gray-100 p-3 rounded font-mono text-xs",children:["POST /webhook HTTP/1.1",n.jsx("br",{}),"Host: your-domain.com",n.jsx("br",{}),"Authorization: Bearer your-secret-token",n.jsx("br",{}),"Content-Type: application/json"]}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"Most common authentication method for modern APIs."})]}),n.jsxs("div",{className:"border rounded-lg p-4 space-y-2",children:[n.jsx("h4",{className:"font-semibold",children:"API Key"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Sends your API key in a custom header that you specify."}),n.jsxs("div",{className:"bg-gray-100 p-3 rounded font-mono text-xs",children:["POST /webhook HTTP/1.1",n.jsx("br",{}),"Host: your-domain.com",n.jsx("br",{}),"X-API-Key: your-api-key-value",n.jsx("br",{}),"Content-Type: application/json"]}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"You specify the header name (e.g., X-API-Key, API-Key, etc.)."})]}),n.jsxs("div",{className:"border rounded-lg p-4 space-y-2",children:[n.jsx("h4",{className:"font-semibold",children:"Basic Auth"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Traditional username and password authentication using Base64 encoding."}),n.jsxs("div",{className:"bg-gray-100 p-3 rounded font-mono text-xs",children:["POST /webhook HTTP/1.1",n.jsx("br",{}),"Host: your-domain.com",n.jsx("br",{}),"Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=",n.jsx("br",{}),"Content-Type: application/json"]}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"The value is Base64(username:password)."})]})]})]}),n.jsxs(Te,{children:[n.jsx(st,{children:n.jsxs(ot,{className:"flex items-center gap-2",children:[n.jsx(qt,{className:"h-5 w-5 text-green-600"}),"Response Requirements"]})}),n.jsxs(Re,{className:"space-y-4",children:[n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx(qt,{className:"h-5 w-5 text-green-600 mt-0.5"}),n.jsxs("div",{children:[n.jsx("h4",{className:"font-semibold",children:"Success Response Codes"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Your endpoint should respond with any 2xx HTTP status code (200, 201, 202, 204, etc.) to indicate successful receipt."})]})]}),n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx(fs,{className:"h-5 w-5 text-blue-600 mt-0.5"}),n.jsxs("div",{children:[n.jsx("h4",{className:"font-semibold",children:"Timeout Behavior"}),n.jsxs("p",{className:"text-sm text-muted-foreground",children:["The default timeout is ",n.jsx("strong",{children:"30 seconds"}),". If your endpoint doesn't respond within this time, the delivery is considered failed and will be retried."]})]})]}),n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx(Es,{className:"h-5 w-5 text-orange-600 mt-0.5"}),n.jsxs("div",{children:[n.jsx("h4",{className:"font-semibold",children:"Retry Policy"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Rainfactory will automatically retry failed deliveries:"}),n.jsxs("ul",{className:"list-disc list-inside text-sm text-muted-foreground ml-4 mt-2 space-y-1",children:[n.jsxs("li",{children:["Maximum of ",n.jsx("strong",{children:"3 retry attempts"})]}),n.jsx("li",{children:"Retries occur for 5xx server errors and timeouts"}),n.jsx("li",{children:"Exponential backoff between retries"}),n.jsx("li",{children:"4xx client errors are not retried (fix your endpoint first)"})]})]})]}),n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx(pd,{className:"h-5 w-5 text-purple-600 mt-0.5"}),n.jsxs("div",{children:[n.jsx("h4",{className:"font-semibold",children:"Response Body"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Your endpoint can return any response body. Rainfactory only checks the HTTP status code to determine success."})]})]})]}),n.jsx(Ar,{className:"bg-blue-50 border-blue-200",children:n.jsxs(gr,{className:"text-blue-800",children:[n.jsx("strong",{children:"Best Practice:"})," Keep your webhook handler fast (under 5 seconds). If you need to do heavy processing, acknowledge the webhook quickly and process the data asynchronously."]})})]})]}),n.jsxs(Te,{children:[n.jsx(st,{children:n.jsxs(ot,{className:"flex items-center gap-2",children:[n.jsx(ng,{className:"h-5 w-5 text-indigo-600"}),"Example Integrations"]})}),n.jsxs(Re,{className:"space-y-4",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx("h4",{className:"font-semibold",children:"Zapier Webhooks"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:`Use Zapier's "Catch Hook" trigger to receive Rainfactory webhooks:`}),n.jsxs("ol",{className:"list-decimal list-inside text-sm text-muted-foreground ml-4 space-y-1",children:[n.jsx("li",{children:"Create a new Zap"}),n.jsx("li",{children:'Choose "Webhooks by Zapier" as the trigger'}),n.jsx("li",{children:'Select "Catch Hook"'}),n.jsx("li",{children:"Copy the webhook URL Zapier provides"}),n.jsx("li",{children:"Paste it into your Rainfactory webhook configuration"}),n.jsx("li",{children:"Test the connection to send sample data to Zapier"})]})]}),n.jsx(xn,{}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("h4",{className:"font-semibold",children:"Make (Integromat)"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Use Make's webhook trigger:"}),n.jsxs("ol",{className:"list-decimal list-inside text-sm text-muted-foreground ml-4 space-y-1",children:[n.jsx("li",{children:"Create a new scenario"}),n.jsx("li",{children:'Add a "Webhooks" module'}),n.jsx("li",{children:'Choose "Custom webhook"'}),n.jsx("li",{children:"Create a new webhook and copy the URL"}),n.jsx("li",{children:"Configure Rainfactory to send to this URL"})]})]}),n.jsx(xn,{}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("h4",{className:"font-semibold",children:"n8n"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Use n8n's webhook node:"}),n.jsxs("ol",{className:"list-decimal list-inside text-sm text-muted-foreground ml-4 space-y-1",children:[n.jsx("li",{children:'Add a "Webhook" node to your workflow'}),n.jsx("li",{children:'Set HTTP Method to "POST"'}),n.jsx("li",{children:"Copy the webhook URL"}),n.jsx("li",{children:"Configure authentication if needed"}),n.jsx("li",{children:"Add your processing nodes after the webhook trigger"})]})]}),n.jsx(xn,{}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("h4",{className:"font-semibold",children:"Node.js / Express Example"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Simple E
1964xpress server to receive webhooks:"}),n.jsx("div",{className:"bg-gray-900 text-gray-100 p-4 rounded-lg overflow-x-auto",children:n.jsx("pre",{className:"text-xs font-mono",children:`const express = require('express');
1965const app = express();
1966
1967app.use(express.json());
1968
1969// Webhook endpoint
1970app.post('/webhooks/rainfactory', (req, res) => {
1971  const payload = req.body;
1972
1973  console.log('Received webhook:', payload.event);
1974  console.log('Content ID:', payload.content.id);
1975  console.log('Brand:', payload.brand.name);
1976
1977  // Process the webhook data here
1978  // e.g., save to database, send notification, etc.
1979
1980  // Respond quickly with success
1981  res.status(200).json({ received: true });
1982});
1983
1984app.listen(3000, () => {
1985  console.log('Webhook server listening on port 3000');
1986});`})})]})]})]}),n.jsxs(Te,{children:[n.jsx(st,{children:n.jsxs(ot,{className:"flex items-center gap-2",children:[n.jsx(hn,{className:"h-5 w-5 text-amber-600"}),"Troubleshooting"]})}),n.jsxs(Re,{children:[n.jsx("p",{className:"mb-4",children:"Common issues and their solutions:"}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"border-l-4 border-red-500 pl-4",children:[n.jsx("h4",{className:"font-semibold text-sm mb-1",children:'Error: "Connection refused" or "Could not connect"'}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Your webhook URL is not accessible from the internet."}),n.jsxs("ul",{className:"list-disc list-inside text-sm text-muted-foreground ml-4 mt-1 space-y-1",children:[n.jsx("li",{children:"Check that your URL is correct and publicly accessible"}),n.jsx("li",{children:"Verify your firewall isn't blocking incoming requests"}),n.jsx("li",{children:"Ensure your server is running and listening on the correct port"}),n.jsx("li",{children:"Use a service like ngrok for local development testing"})]})]}),n.jsxs("div",{className:"border-l-4 border-amber-500 pl-4",children:[n.jsx("h4",{className:"font-semibold text-sm mb-1",children:'Error: "401 Unauthorized" or "403 Forbidden"'}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Authentication is failing."}),n.jsxs("ul",{className:"list-disc list-inside text-sm text-muted-foreground ml-4 mt-1 space-y-1",children:[n.jsx("li",{children:"Double-check your authentication credentials"}),n.jsx("li",{children:"Verify the authentication method matches what your endpoint expects"}),n.jsx("li",{children:"For API keys, ensure the header name matches exactly"}),n.jsx("li",{children:"For Basic Auth, verify username and password are correct"})]})]}),n.jsxs("div",{className:"border-l-4 border-orange-500 pl-4",children:[n.jsx("h4",{className:"font-semibold text-sm mb-1",children:'Error: "Timeout"'}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Your endpoint is taking too long to respond."}),n.jsxs("ul",{className:"list-disc list-inside text-sm text-muted-foreground ml-4 mt-1 space-y-1",children:[n.jsx("li",{children:"Optimize your webhook handler to respond quickly"}),n.jsx("li",{children:"Process heavy tasks asynchronously after acknowledging the webhook"}),n.jsx("li",{children:"Increase the timeout setting if your processing legitimately needs more time"}),n.jsx("li",{children:"Check for database or network issues causing delays"})]})]}),n.jsxs("div",{className:"border-l-4 border-purple-500 pl-4",children:[n.jsx("h4",{className:"font-semibold text-sm mb-1",children:'Error: "SSL certificate verification failed"'}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"SSL certificate issues."}),n.jsxs("ul",{className:"list-disc list-inside text-sm text-muted-foreground ml-4 mt-1 space-y-1",children:[n.jsx("li",{children:"Ensure your SSL certificate is valid and not expired"}),n.jsx("li",{children:"Check that your certificate chain is complete"}),n.jsx("li",{children:"Verify your domain name matches the certificate"}),n.jsx("li",{children:"Only disable SSL verification if absolutely necessary (not recommended for production)"})]})]})]}),n.jsx(Ar,{className:"bg-blue-50 border-blue-200 mt-4",children:n.jsxs(gr,{className:"text-blue-800",children:[n.jsx("strong",{children:"Testing Tip:"}),' Use the "Test Connection" button to send test webhooks and diagnose issues before going live.']})})]})]}),n.jsxs(Te,{children:[n.jsx(st,{children:n.jsxs(ot,{className:"flex items-center gap-2",children:[n.jsx(pd,{className:"h-5 w-5 text-blue-600"}),"Delivery History & Debugging"]})}),n.jsxs(Re,{className:"space-y-3",children:[n.jsx("p",{children:"Every webhook delivery is logged in the Rainfactory database for debugging and monitoring purposes."}),n.jsxs("div",{className:"bg-gray-50 border rounded p-4 space-y-2",children:[n.jsx("h4",{className:"font-semibold text-sm",children:"Logged Information Includes:"}),n.jsxs("ul",{className:"list-disc list-inside text-sm text-muted-foreground ml-4 space-y-1",children:[n.jsx("li",{children:"Delivery ID (unique identifier for each attempt)"}),n.jsx("li",{children:"Timestamp of delivery attempt"}),n.jsx("li",{children:"HTTP status code received"}),n.jsx("li",{children:"Response body from your endpoint"}),n.jsx("li",{children:"Error messages if delivery failed"}),n.jsx("li",{children:"Number of retry attempts made"})]})]}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"These logs help you debug webhook delivery issues and verify that webhooks are being sent and received correctly. Contact support if you need help accessing webhook delivery logs."})]})]}),n.jsx(Te,{className:"bg-green-50 border-green-200",children:n.jsxs(Re,{className:"pt-6",children:[n.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[n.jsx(qt,{className:"h-6 w-6 text-green-600"}),n.jsx("h3",{className:"text-lg font-semibold text-green-800",children:"Ready to Go!"})]}),n.jsx("p",{className:"text-green-700 mb-3",children:"Once configured, your webhook integration will automatically:"}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(qt,{className:"h-4 w-4 text-green-600"}),n.jsxs("span",{className:"text-green-700",children:[n.jsx("strong",{children:"Send notifications"})," every time content is published"]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(qt,{className:"h-4 w-4 text-green-600"}),n.jsxs("span",{className:"text-green-700",children:[n.jsx("strong",{children:"Include complete content data"})," in each webhook payload"]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(qt,{className:"h-4 w-4 text-green-600"}),n.jsxs("span",{className:"text-green-700",children:[n.jsx("strong",{children:"Retry failed deliveries"})," automatically"]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(qt,{className:"h-4 w-4 text-green-600"}),n.jsxs("span",{className:"text-green-700",children:[n.jsx("strong",{children:"Log all deliveries"})," for debugging and monitoring"]})]})]})]})}),n.jsx(Te,{className:"bg-blue-50 border-blue-200",children:n.jsxs(Re,{className:"pt-6",children:[n.jsx("h3",{className:"text-lg font-semibold mb-3",children:"Need Help?"}),n.jsxs("p",{className:"text-gray-700",children:["If you need assistance setting up webhooks or troubleshooting delivery issues, click the ",n.jsx("strong",{children:"Help"})," button in the nav menu and send us a message. We're here to help you get your integration working smoothly!"]})]})})]})}function Mgt(){const[e,t]=g.useState("main");g.useEffect(()=>{const o=window.location.hash.substring(1);o==="instagram-guide"?t("instagram-guide"):o==="facebook-guide"?t("facebook-guide"):o==="webhook-guide"&&t("webhook-guide")},[]);const r=()=>{t("main"),window.history.pushState({},"",window.location.pathname)},s=()=>{t("instagram-guide"),window.history.pushState({},"",window.location.pathname+"#instagram-guide")},a=()=>{t("facebook-guide"),window.history.pushState({},"",window.location.pathname+"#facebook-guide")},i=()=>{t("webhook-guide"),window.history.pushState({},"",window.location.pathname+"#webhook-guide")};return e==="instagram-guide"?n.jsx(Dgt,{onBack:r}):e==="facebook-guide"?n.jsx(Rgt,{onBack:r}):e==="webhook-guide"?n.jsx(Ugt,{onBack:r}):n.jsxs("div",{className:"p-6 space-y-8",children:[n.jsx(i0,{title:"Help & Support",description:"Get help with using Rainfactory AI and find answers to common questions.",icon:n.jsx(Xm,{className:"h-6 w-6"})}),n.jsxs("div",{className:"space-y-4",children:[n.jsx("h2",{className:"text-2xl font-semibold",children:"Integration Guides"}),n.jsx("p",{className:"text-muted-foreground",children:"Step-by-step guides to connect your social media accounts with Rainfactory."}),n.jsxs("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:[n.jsxs(Te,{className:"cursor-pointer hover:shadow-md transition-shadow",children:[n.jsx(st,{className:"pb-3",children:n.jsxs(ot,{className:"flex items-center gap-3",children:[n.jsx("div",{className:"h-8 w-8 rounded-full bg-gradient-to-br from-pink-500 via-red-500 to-yellow-500 flex items-center justify-center",children:n.jsx(Vh,{
1986className:"h-4 w-4 text-white"})}),"Instagram Business"]})}),n.jsxs(Re,{className:"space-y-4",children:[n.jsx("p",{className:"text-sm text-muted-foreground",children:"Connect your Instagram Business account to schedule and publish posts automatically."}),n.jsxs(te,{variant:"outline",className:"w-full justify-between",onClick:s,children:["View Guide",n.jsx(io,{className:"h-4 w-4"})]})]})]}),n.jsxs(Te,{className:"cursor-pointer hover:shadow-md transition-shadow",children:[n.jsx(st,{className:"pb-3",children:n.jsxs(ot,{className:"flex items-center gap-3",children:[n.jsx("div",{className:"h-8 w-8 rounded-full bg-blue-600 flex items-center justify-center",children:n.jsx(_u,{className:"h-4 w-4 text-white"})}),"Facebook Business"]})}),n.jsxs(Re,{className:"space-y-4",children:[n.jsx("p",{className:"text-sm text-muted-foreground",children:"Connect your Facebook Business Page to schedule and publish posts directly."}),n.jsxs(te,{variant:"outline",className:"w-full justify-between",onClick:a,children:["View Guide",n.jsx(io,{className:"h-4 w-4"})]})]})]}),n.jsxs(Te,{className:"cursor-pointer hover:shadow-md transition-shadow",children:[n.jsx(st,{className:"pb-3",children:n.jsxs(ot,{className:"flex items-center gap-3",children:[n.jsx("div",{className:"h-8 w-8 rounded-full bg-purple-600 flex items-center justify-center",children:n.jsx(J_,{className:"h-4 w-4 text-white"})}),"Webhook Integration"]})}),n.jsxs(Re,{className:"space-y-4",children:[n.jsx("p",{className:"text-sm text-muted-foreground",children:"Send published content to your external systems via HTTP webhooks."}),n.jsxs(te,{variant:"outline",className:"w-full justify-between",onClick:i,children:["View Guide",n.jsx(io,{className:"h-4 w-4"})]})]})]}),n.jsxs(Te,{className:"opacity-60",children:[n.jsx(st,{className:"pb-3",children:n.jsxs(ot,{className:"flex items-center gap-3",children:[n.jsx("div",{className:"h-8 w-8 rounded-full bg-blue-600 flex items-center justify-center",children:n.jsx(ky,{className:"h-4 w-4 text-white"})}),"LinkedIn"]})}),n.jsxs(Re,{className:"space-y-4",children:[n.jsx("p",{className:"text-sm text-muted-foreground",children:"Connect your LinkedIn profile and company pages."}),n.jsx(te,{variant:"outline",className:"w-full",disabled:!0,children:"Coming Soon"})]})]}),n.jsxs(Te,{className:"opacity-60",children:[n.jsx(st,{className:"pb-3",children:n.jsxs(ot,{className:"flex items-center gap-3",children:[n.jsx("div",{className:"h-8 w-8 rounded-full bg-black flex items-center justify-center",children:n.jsx(Zve,{className:"h-4 w-4 text-white"})}),"X (Twitter)"]})}),n.jsxs(Re,{className:"space-y-4",children:[n.jsx("p",{className:"text-sm text-muted-foreground",children:"Connect your X account to share content and engage with your audience."}),n.jsx(te,{variant:"outline",className:"w-full",disabled:!0,children:"Coming Soon"})]})]})]})]})]})}function $gt(){const{featureName:e}=Ei(),t=e?e.replace(/-/g," ").split(" ").map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join(" "):"This feature";return n.jsx("div",{className:"container py-8",children:n.jsx(zle,{featureName:t})})}const fj=["#10b981","#3b82f6","#f59e0b","#ef4444","#8b5cf6"];function Qgt(){const{balance:e,fetchTransactions:t,getUsageSummary:r}=Fc(),[s,a]=g.useState("month"),[i,o]=g.useState([]),[l,c]=g.useState(0),[d,u]=g.useState(null),[h,m]=g.useState(!0),[f,p]=g.useState(0),A=20;g.useEffect(()=>{(async()=>{m(!0);try{const _=await t({limit:A,offset:f*A});o(_.transactions),c(_.total);const S=await r(s);u(S)}catch(_){console.error("Error fetching credit data:",_)}finally{m(!1)}})()},[s,f,t,r]);const v=(e==null?void 0:e.total_credits)||0,x=v-(((e==null?void 0:e.plan_credits)||0)+((e==null?void 0:e.purchased_credits)||0)),b=v>0?x/v*100:0,y=d!=null&&d.byCategory?Object.entries(d.byCategory).map(([N,_])=>({name:N.replace(/_/g," ").replace(/\b\w/g,S=>S.toUpperCase()),value:_})):[],w=(d==null?void 0:d.byDay)||[],j=()=>{const N=[["Date","Type","Category","Amount","Balance After","Description"],...i.map(E=>[DR(E.created_at),E.type,E.category||"other",E.amount,E.balance_after,E.description])].map(E=>E.join(",")).join(`
1987`),_=new Blob([N],{type:"text/csv"}),S=URL.createObjectURL(_),C=document.createElement("a");C.href=S,C.download=`credit-usage-${new Date().toISOString().split("T")[0]}.csv`,C.click()};return h&&!e?n.jsx("div",{className:"flex items-center justify-center p-8",children:n.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})}):n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsx("h2",{className:"text-3xl font-bold",children:"Credit Usage Dashboard"}),n.jsx("p",{className:"text-muted-foreground",children:"Monitor your credit consumption and purchase history"})]}),n.jsxs(te,{onClick:j,variant:"outline",children:[n.jsx(Ad,{className:"mr-2 h-4 w-4"}),"Export Data"]})]}),n.jsxs("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:[n.jsxs(Te,{children:[n.jsxs(st,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[n.jsx(ot,{className:"text-sm font-medium",children:"Total Credits"}),n.jsx(en,{className:"h-4 w-4 text-muted-foreground"})]}),n.jsxs(Re,{children:[n.jsx("div",{className:"text-2xl font-bold",children:Li(v)}),n.jsxs("div",{className:"flex items-center text-xs text-muted-foreground",children:[n.jsxs("span",{children:[Li((e==null?void 0:e.plan_credits)||0)," plan"]}),((e==null?void 0:e.purchased_credits)||0)>0&&n.jsxs("span",{className:"ml-2",children:["+ ",Li((e==null?void 0:e.purchased_credits)||0)," purchased"]})]})]})]}),n.jsxs(Te,{children:[n.jsxs(st,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[n.jsx(ot,{className:"text-sm font-medium",children:"Credits Used"}),n.jsx(f2,{className:"h-4 w-4 text-muted-foreground"})]}),n.jsxs(Re,{children:[n.jsx("div",{className:"text-2xl font-bold",children:Li(x)}),n.jsx(Ou,{value:b,className:"mt-2 h-2"}),n.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[Math.round(b),"% of total"]})]})]}),n.jsxs(Te,{children:[n.jsxs(st,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[n.jsxs(ot,{className:"text-sm font-medium",children:["This ",s]}),n.jsx(Kn,{className:"h-4 w-4 text-muted-foreground"})]}),n.jsxs(Re,{children:[n.jsx("div",{className:"text-2xl font-bold",children:Li((d==null?void 0:d.totalConsumed)||0)}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"credits consumed"})]})]}),n.jsxs(Te,{children:[n.jsxs(st,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[n.jsx(ot,{className:"text-sm font-medium",children:"Available"}),n.jsx(CI,{className:"h-4 w-4 text-muted-foreground"})]}),n.jsxs(Re,{children:[n.jsx("div",{className:ye("text-2xl font-bold",b>=95&&"text-red-600",b>=80&&b<95&&"text-yellow-600"),children:Li(v-x)}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"credits remaining"})]})]})]}),n.jsxs(Cs,{defaultValue:"usage",className:"space-y-4",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs(ps,{children:[n.jsx(pt,{value:"usage",children:"Usage Trends"}),n.jsx(pt,{value:"breakdown",children:"Category Breakdown"}),n.jsx(pt,{value:"transactions",children:"Transactions"})]}),n.jsxs(ur,{value:s,onValueChange:N=>a(N),children:[n.jsx(or,{className:"w-32",children:n.jsx(hr,{})}),n.jsxs(lr,{children:[n.jsx(Fe,{value:"day",children:"Today"}),n.jsx(Fe,{value:"week",children:"This Week"}),n.jsx(Fe,{value:"month",children:"This Month"})]})]})]}),n.jsx(Ct,{value:"usage",className:"space-y-4",children:n.jsxs(Te,{children:[n.jsxs(st,{children:[n.jsx(ot,{children:"Daily Usage Trend"}),n.jsx(Wr,{children:"Credit consumption over the selected period"})]}),n.jsx(Re,{children:n.jsx(Sl,{width:"100%",height:300,children:n.jsxs(Mte,{data:w,children:[n.jsx(au,{strokeDasharray:"3 3"}),n.jsx(zo,{dataKey:"date",tickFormatter:N=>new Date(N).toLocaleDateString("en-US",{month:"short",day:"numeric"})}),n.jsx(so,{}),n.jsx(Aa,{formatter:N=>Li(N),labelFormatter:N=>new Date(N).toLocaleDateString()}),n.jsx(Vm,{type:"monotone",dataKey:"amount",stroke:"#3b82f6",strokeWidth:2,dot:{fill:"#3b82f6"}})]})})})]})}),n.jsx(Ct,{value:"breakdown",className:"space-y-4",children:n.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[n.jsxs(Te,{children:[n.jsxs(st,{children:[n.jsx(ot,{children:"Usage by Category"}),n.jsx(Wr,{children:"How credits are being consumed"})]}),n.jsx(Re,{children:n.jsx(Sl,{width:"100%",height:300,children:n.jsxs(I3,{children:[n.jsx(Sc,{data:y,cx:"50%",cy:"50%",labelLine:!1,outerRadius:80,fill:"#8884d8",dataKey:"value",label:({name:N,percent:_})=>`${N}: ${(_*100).toFixed(0)}%`,children:y.map((N,_)=>n.jsx(yg,{fill:fj[_%fj.length]},`cell-${_}`))}),n.jsx(Aa,{formatter:N=>Li(N)})]})})})]}),n.jsxs(Te,{children:[n.jsxs(st,{children:[n.jsx(ot,{children:"Category Details"}),n.jsx(Wr,{children:"Credit usage breakdown"})]}),n.jsx(Re,{children:n.jsx("div",{className:"space-y-4",children:y.map((N,_)=>n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:fj[_%fj.length]}}),n.jsx("span",{className:"text-sm font-medium",children:N.name})]}),n.jsxs("span",{className:"text-sm text-muted-foreground",children:[Li(N.value)," credits"]})]},N.name))})})]})]})}),n.jsx(Ct,{value:"transactions",className:"space-y-4",children:n.jsxs(Te,{children:[n.jsxs(st,{children:[n.jsx(ot,{children:"Recent Transactions"}),n.jsx(Wr,{children:"Detailed credit transaction history"})]}),n.jsxs(Re,{children:[n.jsx("div",{className:"space-y-4",children:i.map(N=>n.jsxs("div",{className:"flex items-center justify-between py-3 border-b last:border-0",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsx("p",{className:"text-sm font-medium",children:N.description}),n.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[n.jsx(Be,{variant:"outline",className:"text-xs",children:N.type.replace(/_/g," ")}),N.category&&n.jsx(Be,{variant:"secondary",className:"text-xs",children:N.category.replace(/_/g," ")}),n.jsx("span",{children:DR(N.created_at)})]})]}),n.jsxs("div",{className:"text-right",children:[n.jsxs("p",{className:ye("text-sm font-medium",N.amount>0?"text-green-600":"text-red-600"),children:[N.amount>0?"+":"",Li(Math.abs(N.amount))]}),n.jsxs("p",{className:"text-xs text-muted-foreground",children:["Balance: ",Li(N.balance_after)]})]})]},N.id))}),l>A&&n.jsxs("div",{className:"flex items-center justify-between mt-4",children:[n.jsxs("p",{className:"text-sm text-muted-foreground",children:["Showing ",f*A+1," to ",Math.min((f+1)*A,l)," of ",l]}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx(te,{variant:"outline",size:"sm",onClick:()=>p(N=>
1987Math.max(0,N-1)),disabled:f===0,children:"Previous"}),n.jsx(te,{variant:"outline",size:"sm",onClick:()=>p(N=>N+1),disabled:(f+1)*A>=l,children:"Next"})]})]})]})]})})]}),b>=80&&n.jsxs(Te,{className:"border-yellow-200 bg-yellow-50 dark:border-yellow-900 dark:bg-yellow-950",children:[n.jsxs(st,{children:[n.jsxs(ot,{className:"flex items-center gap-2",children:[n.jsx(Bve,{className:"h-5 w-5"}),"Running Low on Credits"]}),n.jsxs(Wr,{children:["You've used ",Math.round(b),"% of your credits. Consider purchasing more to continue using all features."]})]}),n.jsx(Re,{children:n.jsx(te,{onClick:()=>window.location.href="/billing",children:"Purchase Credits"})})]})]})}function Hgt(){const{fetchTransactions:e}=Fc(),[t,r]=g.useState([]),[s,a]=g.useState(!0),[i,o]=g.useState({type:"all",category:"all",search:""}),[l,c]=g.useState("desc"),[d,u]=g.useState(0),[h,m]=g.useState(!0),f=50,p=async()=>{a(!0);try{const j=await e({limit:f,offset:d*f,type:i.type!=="all"?i.type:void 0,category:i.category!=="all"?i.category:void 0});r(j.transactions),m(j.transactions.length===f)}catch(j){console.error("Failed to load transactions:",j)}finally{a(!1)}};g.useEffect(()=>{p()},[d,i.type,i.category]);const A=j=>{switch(j){case"consumption":return n.jsx(Fge,{className:"w-4 h-4 text-red-500"});case"plan_allocation":case"purchase":return n.jsx(Ww,{className:"w-4 h-4 text-green-500"});case"refund":return n.jsx(Ww,{className:"w-4 h-4 text-blue-500"});default:return n.jsx(ju,{className:"w-4 h-4 text-gray-500"})}},v=j=>{const N={consumption:"destructive",plan_allocation:"default",purchase:"secondary",refund:"outline",adjustment:"outline"};return n.jsx(Be,{variant:N[j]||"default",className:"capitalize",children:j.replace("_"," ")})},x=j=>j?n.jsx(Be,{variant:"outline",className:"capitalize text-xs",children:j.replace("_"," ")}):null,y=[...t.filter(j=>{if(i.search){const N=i.search.toLowerCase();return j.description.toLowerCase().includes(N)}return!0})].sort((j,N)=>{const _=new Date(j.created_at).getTime(),S=new Date(N.created_at).getTime();return l==="desc"?S-_:_-S}),w=()=>{const j=[["Date","Type","Category","Description","Amount","Balance After"],...y.map(C=>[nn(new Date(C.created_at),"yyyy-MM-dd HH:mm:ss"),C.type,C.category||"",C.description,C.amount.toString(),C.balance_after.toString()])].map(C=>C.join(",")).join(`
1988`),N=new Blob([j],{type:"text/csv"}),_=URL.createObjectURL(N),S=document.createElement("a");S.href=_,S.download=`credit-transactions-${nn(new Date,"yyyy-MM-dd")}.csv`,document.body.appendChild(S),S.click(),document.body.removeChild(S),URL.revokeObjectURL(_)};return n.jsxs(Te,{className:"bg-white rounded-xl border border-gray-200/50 shadow-sm overflow-hidden transition-all duration-300 hover:shadow-md",children:[n.jsx("div",{className:"p-6 border-b bg-gradient-to-r from-blue-50 to-indigo-50 dark:from-blue-950/20 dark:to-indigo-950/20",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-10 h-10 bg-gradient-to-br from-blue-500 to-indigo-600 rounded-full flex items-center justify-center shadow-lg",children:n.jsx(ag,{className:"h-5 w-5 text-white"})}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-lg font-semibold text-blue-900 dark:text-blue-100 mb-1",children:"Transaction History"}),n.jsx("p",{className:"text-sm text-blue-700 dark:text-blue-200",children:"View all your credit transactions and activity with detailed filtering"})]})]}),n.jsxs(te,{onClick:w,variant:"outline",size:"sm",className:"bg-white/80 backdrop-blur-sm border-blue-200 hover:bg-blue-50 hover:border-blue-300 transition-all duration-200",children:[n.jsx(Ad,{className:"w-4 h-4 mr-2"}),"Export CSV"]})]})}),n.jsxs(Re,{className:"p-6",children:[n.jsxs("div",{className:"space-y-4 mb-6",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[n.jsx(Ns,{className:"w-4 h-4 text-blue-500"}),n.jsx("h4",{className:"font-semibold text-gray-900 dark:text-gray-100",children:"Search & Filter Transactions"})]}),n.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[n.jsx("div",{className:"flex-1",children:n.jsx(qe,{placeholder:"Search transactions...",value:i.search,onChange:j=>o({...i,search:j.target.value}),className:"w-full bg-gradient-to-r from-gray-50 to-gray-100 dark:from-gray-800 dark:to-gray-700 border-gray-200 dark:border-gray-600 focus:border-blue-400 transition-colors"})}),n.jsxs(ur,{value:i.type,onValueChange:j=>o({...i,type:j}),children:[n.jsxs(or,{className:"w-[180px] bg-gradient-to-r from-gray-50 to-gray-100 dark:from-gray-800 dark:to-gray-700 border-gray-200 dark:border-gray-600",children:[n.jsx(IA,{className:"w-4 h-4 mr-2"}),n.jsx(hr,{placeholder:"Filter by type"})]}),n.jsxs(lr,{children:[n.jsx(Fe,{value:"all",children:"All Types"}),n.jsx(Fe,{value:"consumption",children:"Consumption"}),n.jsx(Fe,{value:"plan_allocation",children:"Plan Allocation"}),n.jsx(Fe,{value:"purchase",children:"Purchase"}),n.jsx(Fe,{value:"refund",children:"Refund"}),n.jsx(Fe,{value:"adjustment",children:"Adjustment"})]})]}),n.jsxs(ur,{value:i.category,onValueChange:j=>o({...i,category:j}),children:[n.jsx(or,{className:"w-[180px] bg-gradient-to-r from-gray-50 to-gray-100 dark:from-gray-800 dark:to-gray-700 border-gray-200 dark:border-gray-600",children:n.jsx(hr,{placeholder:"Filter by category"})}),n.jsxs(lr,{children:[n.jsx(Fe,{value:"all",children:"All Categories"}),n.jsx(Fe,{value:"content_generation",children:"Content Generation"}),n.jsx(Fe,{value:"image_processing",children:"Image Processing"}),n.jsx(Fe,{value:"video_processing",children:"Video Processing"}),n.jsx(Fe,{value:"other",children:"Other"})]})]}),n.jsx(te,{variant:"outline",size:"icon",onClick:()=>c(l==="desc"?"asc":"desc"),className:"bg-gradient-to-r from-gray-50 to-gray-100 dark:from-gray-800 dark:to-gray-700 border-gray-200 dark:border-gray-600 hover:from-blue-50 hover:to-indigo-50 hover:border-blue-300 transition-all duration-200",children:n.jsx(Ige,{className:"w-4 h-4"})})]})]}),s?n.jsxs("div",{className:"text-center py-12",children:[n.jsx("div",{className:"w-8 h-8 border-4 border-blue-500 border-t-transparent roun
1988ded-full animate-spin mx-auto mb-4"}),n.jsx("p",{className:"text-muted-foreground font-medium",children:"Loading transactions..."})]}):y.length===0?n.jsxs("div",{className:"text-center py-12",children:[n.jsx(ag,{className:"w-12 h-12 mx-auto text-gray-400 mb-4"}),n.jsx("h3",{className:"text-lg font-semibold text-gray-600 mb-2",children:"No transactions found"}),n.jsx("p",{className:"text-muted-foreground",children:"Try adjusting your search filters"})]}):n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"rounded-xl border border-gray-200/50 bg-gradient-to-br from-white to-gray-50/30 dark:from-gray-900 dark:to-gray-800/30 overflow-hidden shadow-sm",children:n.jsxs(po,{children:[n.jsx(Ao,{children:n.jsxs(Yr,{className:"bg-gradient-to-r from-gray-50 to-gray-100 dark:from-gray-800 dark:to-gray-700 border-b border-gray-200/50",children:[n.jsx($t,{className:"font-semibold text-gray-700 dark:text-gray-200",children:"Date"}),n.jsx($t,{className:"font-semibold text-gray-700 dark:text-gray-200",children:"Type"}),n.jsx($t,{className:"font-semibold text-gray-700 dark:text-gray-200",children:"Description"}),n.jsx($t,{className:"text-right font-semibold text-gray-700 dark:text-gray-200",children:"Amount"}),n.jsx($t,{className:"text-right font-semibold text-gray-700 dark:text-gray-200",children:"Balance After"})]})}),n.jsx(go,{children:y.map(j=>n.jsxs(Yr,{className:"hover:bg-gradient-to-r hover:from-blue-50/50 hover:to-indigo-50/50 dark:hover:from-blue-900/10 dark:hover:to-indigo-900/10 transition-colors duration-200 border-b border-gray-100/50 dark:border-gray-700/50",children:[n.jsx(mt,{className:"font-medium text-gray-900 dark:text-gray-100",children:nn(new Date(j.created_at),"MMM d, yyyy HH:mm")}),n.jsx(mt,{children:n.jsxs("div",{className:"flex flex-col gap-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[A(j.type),v(j.type)]}),x(j.category)]})}),n.jsx(mt,{className:"text-gray-700 dark:text-gray-300 max-w-xs",children:n.jsx("div",{className:"truncate",title:j.description,children:j.description})}),n.jsxs(mt,{className:`text-right font-bold ${j.amount<0?"text-red-600 dark:text-red-400":"text-green-600 dark:text-green-400"}`,children:[j.amount>0?"+":"",j.amount.toLocaleString()]}),n.jsx(mt,{className:"text-right font-bold text-gray-900 dark:text-gray-100",children:j.balance_after.toLocaleString()})]},j.id))})]})}),n.jsxs("div",{className:"flex items-center justify-between mt-6 p-4 bg-gradient-to-r from-gray-50 to-gray-100 dark:from-gray-800 dark:to-gray-700 rounded-lg",children:[n.jsxs("p",{className:"text-sm font-medium text-gray-600 dark:text-gray-300",children:["Showing ",n.jsx("span",{className:"text-blue-600 dark:text-blue-400 font-bold",children:y.length})," transactions"]}),n.jsxs("div",{className:"flex gap-2",children:[n.jsxs(te,{variant:"outline",size:"sm",onClick:()=>u(d-1),disabled:d===0,className:"bg-white/80 dark:bg-gray-900/80 hover:bg-blue-50 hover:border-blue-300 transition-colors",children:[n.jsx(Ww,{className:"w-4 h-4 mr-1 rotate-[-90deg]"}),"Previous"]}),n.jsxs(te,{variant:"outline",size:"sm",onClick:()=>u(d+1),disabled:!h,className:"bg-white/80 dark:bg-gray-900/80 hover:bg-blue-50 hover:border-blue-300 transition-colors",children:["Next",n.jsx(Ww,{className:"w-4 h-4 ml-1 rotate-[90deg]"})]})]})]})]})]}),n.jsx("div",{className:"h-2 bg-gradient-to-r from-blue-200 via-indigo-200 to-purple-200 dark:from-blue-800 dark:via-indigo-800 dark:to-purple-800"})]})}const qj=g.forwardRef(({className:e,...t},r)=>n.jsxs(mk,{ref:r,className:ye("relative flex w-full touch-none select-none items-center",e),...t,children:[n.jsx(kie,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:n.jsx(Eie,{className:"absolute h-full bg-primary"})}),n.jsx(Bie,{className:"block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"})]}));qj.displayName=mk.displayName;function zgt(){const{costs:e}=Fc(),[t,r]=g.useState({postsPerDay:3,platforms:2,contentTypes:{socialPost:!0,blogPost:!1,email:!1,adCopy:!1},features:{imageGeneration:!1,imageSearch:!0,videoGeneration:!1,hashtags:!0,audienceAnalysis:!1,trendAnalysis:!1},improvements:20}),[s,a]=g.useState({daily:0,weekly:0,monthly:0,yearly:0}
1988);if(g.useEffect(()=>{if(!e)return;let l=0;const c=e.costs.content.content_types,d=Object.entries(t.contentTypes).filter(([m,f])=>f).map(([m])=>m),u=t.postsPerDay*t.platforms;d.forEach(m=>{const f=c[m]||e.costs.content.base_generation;l+=u*f});const h=u*(t.improvements/100);l+=h*e.costs.content.improvement,t.features.imageGeneration?l+=u*e.costs.media.image.ai_generate:t.features.imageSearch&&(l+=u*e.costs.media.image.stock_search),t.features.videoGeneration&&(l+=u*.2*e.costs.media.video.ai_generate),t.features.hashtags&&(l+=u*e.costs.processing.hashtag_generation),t.features.audienceAnalysis&&(l+=e.costs.processing.audience_analysis/7),t.features.trendAnalysis&&(l+=e.costs.features.trend_analysis),a({daily:Math.round(l),weekly:Math.round(l*7),monthly:Math.round(l*30),yearly:Math.round(l*365)})},[t,e]),!e)return n.jsx("div",{children:"Loading cost information..."});const i=l=>l.toLocaleString(),o=()=>{const l=[],c=e.costs.content.content_types,d=t.postsPerDay*t.platforms;if(Object.entries(t.contentTypes).forEach(([u,h])=>{if(h){const m=c[u]||e.costs.content.base_generation;l.push({name:u.replace(/([A-Z])/g," $1").trim(),dailyCost:d*m,unitCost:m})}}),t.improvements>0){const u=d*(t.improvements/100);l.push({name:"Content Improvements",dailyCost:u*e.costs.content.improvement,unitCost:e.costs.content.improvement})}return t.features.imageGeneration?l.push({name:"AI Image Generation",dailyCost:d*e.costs.media.image.ai_generate,unitCost:e.costs.media.image.ai_generate}):t.features.imageSearch&&l.push({name:"Stock Image Search",dailyCost:d*e.costs.media.image.stock_search,unitCost:e.costs.media.image.stock_search}),t.features.hashtags&&l.push({name:"Hashtag Generation",dailyCost:d*e.costs.processing.hashtag_generation,unitCost:e.costs.processing.hashtag_generation}),l};return n.jsxs("div",{className:"space-y-6",children:[n.jsxs(Te,{className:"bg-white rounded-xl border border-gray-200/50 shadow-sm overflow-hidden transition-all duration-300 hover:shadow-md",children:[n.jsx("div",{className:"p-6 border-b bg-gradient-to-r from-emerald-50 to-green-50 dark:from-emerald-950/20 dark:to-green-950/20",children:n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-10 h-10 bg-gradient-to-br from-emerald-500 to-green-600 rounded-full flex items-center justify-center shadow-lg",children:n.jsx(pK,{className:"h-5 w-5 text-white"})}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-lg font-semibold text-emerald-900 dark:text-emerald-100 mb-1",children:"Credit Cost Calculator"}),n.jsx("p",{className:"text-sm text-emerald-700 dark:text-emerald-200",children:"Estimate your credit usage based on your content creation patterns"})]})]})}),n.jsxs(Re,{className:"p-6 space-y-8",children:[n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[n.jsx(Kn,{className:"w-5 h-5 text-blue-500"}),n.jsx("h4",{className:"font-semibold text-gray-900 dark:text-gray-100",children:"Publishing Schedule"})]}),n.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[n.jsxs("div",{className:"p-4 bg-gradient-to-br from-blue-50 to-indigo-50 dark:from-blue-900/20 dark:to-indigo-900/20 rounded-lg border border-blue-200/50",children:[n.jsxs(ze,{htmlFor:"posts-per-day",className:"flex items-center justify-between mb-4",children:[n.jsx("span",{className:"font-medium text-blue-900 dark:text-blue-100",children:"Posts per day"}),n.jsx(Be,{variant:"outline",className:"bg-white/80 text-blue-700 border-blue-200",children:t.postsPerDay})]}),n.jsx(qj,{id:"posts-per-day",min:1,max:20,step:1,value:[t.postsPerDay],onValueChange:([l])=>r({...t,postsPerDay:l}),className:"w-full"})]}),n.jsxs("div",{className:"p-4 bg-gradient-to-br from-purple-50 to-violet-50 dark:from-purple-900/20 dark:to-violet-900/20 rounded-lg border border-purple-200/50",children:[n.jsxs(ze,{htmlFor:"platforms",className:"flex items-center justify-between mb-4",children:[n.jsx("span",{className:"font-medium text-purple-900 dark:text-purple-100",children:"Number of platforms"}),n.jsx(Be,{variant:"outline",className:"bg-white/80 text-purple-700 border-purple-200",children:t.platforms})]}),n.jsx(qj,{id:"platforms",min:1,max:10,step:1,value:[t.platforms],onValueChange:([l])=>r({...t,platforms:l}),className:"w-full"})]})]})]}),n.jsx("div",{className:"border-t border-gradient-to-r from-transparent via-gray-200 to-transparent"}),n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[n.jsx(Xr,{className:"w-5 h-5 text-indigo-500"}),n.jsx("h4",{className:"font-semibold text-gray-900 dark:text-gray-100",children:"Content Types"})]}),n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[n.jsx("div",{className:"p-4 bg-gradient-to-br from-orange-50 to-red-50 dark:from-orange-900/20 dark:to-red-900/20 rounded-lg border border-orange-200/50 transition-all duration-200 hover:shadow-sm",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx(ze,{htmlFor:"social-post",className:"cursor-pointer font-medium text-orange-900 dark:text-orange-100",children:"Social Posts"}),n.jsx(ns,{id:"social-post",checked:t.contentTypes.socialPost,onCheckedChange:l=>r({...t,contentTypes:{...t.contentTypes,socialPost:l}}),className:"data-[state=checked]:bg-orange-500"})]})}),n.jsx("div",{className:"p-4 bg-gradient-to-br from-green-50 to-emerald-50 dark:from-green-900/20 dark:to-emerald-900/20 rounded-lg border border-green-200/50 transition-all duration-200 hover:shadow-sm",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx(ze,{htmlFor:"blog-post",className:"cursor-pointer font-medium text-green-900 dark:text-green-100",children:"Blog Posts"}),n.jsx(ns,{id:"blog-post",checked:t.contentTypes.blogPost,onCheckedChange:l=>r({...t,contentTypes:{...t.contentTypes,blogPost:l}}),className:"data-[state=checked]:bg-green-500"})]})}),n.jsx("div",{className:"p-4 bg-gradient-to-br from-blue-50 to-cyan-50 dark:from-blue-900/20 dark:to-cyan-900/20 rounded-lg border border-blue-200/50 transition-all duration-200 hover:shadow-sm",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx(ze,{htmlFor:"email",className:"cursor-pointer font-medium text-blue-900 dark:text-blue-100",children:"Email Campaigns"}),n.jsx(ns,{id:"email",checked:t.contentTypes.email,onCheckedChange:l=>r({...t,contentTypes:{...t.contentTypes,email:l}}),className:"data-[state=checked]:bg-blue-500"})]})}),n.jsx("div",{className:"p-4 bg-gradient-to-br from-purple-50 to-violet-50 dark:from-purple-900/20 dark:to-violet-900/20 rounded-lg border border-purple-200/50 transition-all duration-200 hover:shadow-sm",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx(ze,{htmlFor:"ad-copy",className:"cursor-pointer font-medium text-purple-900 dark:text-purple-100",children:"Ad Copy"}),n.jsx(ns,{id:"ad-copy",checked:t.contentTypes.adCopy,onCheckedChange:l=>r({...t,contentTypes:{...t.contentTypes,adCopy:l}}),className:"data-[state=checked]:bg-purple-500"})]})})]})]}),n.jsx("div",{className:"border-t border-gradient-to-r from-transparent via-gray-200 to-transparent"}),n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[n.jsx(mr,{className:"w-5 h-5 text-yellow-500"}),n.jsx("h4",{className:"font-semibold text-gray-900 dark:text-gray-100",children:"Additional Features"})]}),n.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[n.jsx("div",{className:"p-4 bg-gradient-to-br from-pink-50 to-rose-50 dark:from-pink-900/20 dark:to-rose-900/20 rounded-lg border border-pink-200/50 transition-all duration-200 hover:shadow-sm",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs(ze,{htmlFor:"image-gen",className:"cursor-pointer flex items-center gap-2 font-medium text-pink-900 dark:text-pink-100",children:[n.jsx(Ra,{className:"w-4 h-4"}),"AI Image Generation"]}),n.jsx(ns,{id:"image-gen",checked:t.features.imageGeneration,onCheckedChange:l=>r({...t,features:{...t.features,imageGeneration:l,imageSearch:l?!1:t.features.imageSearch}}),className:"data-[state=checked]:bg-pink-500"})]})}),n.jsx("div",{className:"p-4 bg-gradient-to-br from-cyan-50 to-teal-50 dark:from-cyan-900/20 dark:to-teal-900/20 rounded-lg border border-cyan-200/50 transition-all duration-200 hover:shadow-sm",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs(ze,{htmlFor:"image-search",className:"cursor-pointer flex items-center gap-2 font-medium text-cyan-900 dark:text-cyan-100",children:[n.jsx(Ra,{className:"w-4 h-4"}),"Stock Image Search"]}),n.jsx(ns,{id:"image-search",checked:t.features.imageSearch,onCheckedChange:l=>r({...t,features:{...t.features,imageSearch:l,imageGeneration:l?!1:t.features.imageGeneration}}),className:"data-[state=checked]:bg-cyan-500"})]})}),n.jsx("div",{className:"p-4 bg-gradient-to-br from-red-50 to-pink-50 dark:from-red-900/20 dark:to-pink-900/20 rounded-lg border border-red-200/50 transition-all duration-200 hover:shadow-sm",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs(ze,{htmlFor:"video-gen",className:"cursor-pointer flex items-center gap-2 font-medium text-red-900 dark:text-red-100",children:[n.jsx(fi,{className:"w-4 h-4"}),"AI Video Generation"]}),n.jsx(ns,{id:"video-gen",checked:t.features.videoGeneration,onCheckedChange:l=>r({...t,features:{...t.features,videoGeneration:l}}),className:"data-[state=checked]:bg-red-500"})]})}),n.jsx("div",{className:"p-4 bg-gradient-to-br from-amber-50 to-yellow-50 dark:from-amber-900/20 dark:to-yellow-900/20 rounded-lg border border-amber-200/50 transition-all duration-200 hover:shadow-sm",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx(ze,{htmlFor:"hashtags",className:"cursor-pointer font-medium text-amber-900 dark:text-amber-100",children:"Hashtag Generation"}),n.jsx(ns,{id:"hashtags",checked:t.features.hashtags,onCheckedChange:l=>r({...t,features:{...t.features,hashtags:l}}),className:"data-[state=checked]:bg-amber-500"})]})}),n.jsx("div",{className:"p-4 bg-gradient-to-br from-violet-50 to-purple-50 dark:from-violet-900/20 dark:to-purple-900/20 rounded-lg border border-violet-200/50 transition-all duration-200 hover:shadow-sm",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx(ze,{htmlFor:"audience",className:"cursor-pointer font-medium text-violet-900 dark:text-violet-100",children:"Audience Analysis"}),n.jsx(ns,{id:"audience",checked:t.features.audienceAnalysis,onCheckedChange:l=>r({...t,features:{...t.features,audienceAnalysis:l}}),className:"data-[state=checked]:bg-violet-500"})]})}),n.jsx("div",{className:"p-4 bg-gradient-to-br from-indigo-50 to-blue-50 dark:from-indigo-900/20 dark:to-blue-900/20 rounded-lg border border-indigo-200/50 transition-all duration-200 hover:shadow-sm",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx(ze,{htmlFor:"trends",className:"cursor-pointer font-medium text-indigo-900 dark:text-indigo-100",children:"Trend Analysis"}),n.jsx(ns,{id:"trends",checked:t.features.trendAnalysis,onCheckedChange:l=>r({...t,features:{...t.features,trendAnalysis:l}}),className:"data-[state=checked]:bg-indigo-500"})]})})]})]}),n.jsx("div",{className:"border-t border-gradient-to-r from-transparent via-gray-200 to-transparent"}),n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[n.jsx(Qxe,{className:"w-5 h-5 text-orange-500"}),n.jsx("h4",{className:"font-semibold text-gray-900 dark:text-gray-100",children:"Content Optimization"})]}),n.jsxs("div",{className:"p-6 bg-gradient-to-br from-orange-50 to-amber-50 dark:from-orange-900/20 dark:to-amber-900/20 rounded-lg border border-orange-200/50",children:[n.jsxs(ze,{htmlFor:"improvements",className:"flex items-center justify-between mb-4",children:[n.jsx("span",{className:"font-medium text-orange-900 dark:text-orange-100",children:"Content improvements"}),n.jsxs(Be,{variant:"outline",className:"bg-white/80 text-orange-700 border-orange-200",children:[t.improvements,"%"]})]}),n.jsx(qj,{id:"improvements",min:0,max:100,step:5,value:[t.improvements],onValueChange:([l])=>r({...t,improvements:l}),className:"w-full mb-3"}),n.jsx("p",{className:"text-xs text-orange-700 dark:text-orange-300 bg-white/60 dark:bg-orange-900/20 p-2 rounded",children:"Percentage of posts that will be refined/improved after initial generation"})]})]})]})]}),n.jsxs(Te,{className:"bg-white rounded-xl border border-gray-200/50 shadow-sm overflow-hidden transition-all duration-300 hover:shadow-md",children:[n.jsx("div",{className:"p-6 border-b bg-gradient-to-r from-blue-50 to-indigo-50 dark:from-blue-950/20 dark:to-indigo-950/20",children:n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-10 h-10 bg-gradient-to-br from-blue-500 to-indigo-600 rounded-full flex items-center justify-center shadow-lg",children:n.jsx(q_,{className:"h-5 w-5 text-white"})}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-lg font-semibold text-blue-900 dark:text-blue-100 mb-1",children:"Estimated Credit Usage"}),n.jsx("p",{className:"text-sm text-blue-700 dark:text-blue-200",children:"Based on your selected content creation patterns"})]})]})}),n.jsxs(Re,{className:"p-6 space-y-6",children:[n.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[n.jsxs("div",{className:"p-4 bg-gradient-to-br from-green-50 to-emerald-50 dark:from-green-900/20 dark:to-emerald-900/20 rounded-lg border border-green-200/50 text-center",children:[n.jsx("p",{className:"text-sm font-medium text-green-700 dark:text-green-300 mb
1988-1",children:"Daily"}),n.jsx("p",{className:"text-2xl font-bold text-green-900 dark:text-green-100",children:i(s.daily)}),n.jsx("p",{className:"text-xs text-green-600 dark:text-green-400",children:"credits/day"})]}),n.jsxs("div",{className:"p-4 bg-gradient-to-br from-blue-50 to-cyan-50 dark:from-blue-900/20 dark:to-cyan-900/20 rounded-lg border border-blue-200/50 text-center",children:[n.jsx("p",{className:"text-sm font-medium text-blue-700 dark:text-blue-300 mb-1",children:"Weekly"}),n.jsx("p",{className:"text-2xl font-bold text-blue-900 dark:text-blue-100",children:i(s.weekly)}),n.jsx("p",{className:"text-xs text-blue-600 dark:text-blue-400",children:"credits/week"})]}),n.jsxs("div",{className:"p-4 bg-gradient-to-br from-purple-50 to-violet-50 dark:from-purple-900/20 dark:to-violet-900/20 rounded-lg border border-purple-200/50 text-center relative",children:[n.jsx("div",{className:"absolute -top-2 left-1/2 transform -translate-x-1/2",children:n.jsx(Be,{className:"bg-purple-500 text-white text-xs",children:"Popular"})}),n.jsx("p",{className:"text-sm font-medium text-purple-700 dark:text-purple-300 mb-1",children:"Monthly"}),n.jsx("p",{className:"text-2xl font-bold text-purple-900 dark:text-purple-100",children:i(s.monthly)}),n.jsx("p",{className:"text-xs text-purple-600 dark:text-purple-400",children:"credits/month"})]}),n.jsxs("div",{className:"p-4 bg-gradient-to-br from-orange-50 to-red-50 dark:from-orange-900/20 dark:to-red-900/20 rounded-lg border border-orange-200/50 text-center",children:[n.jsx("p",{className:"text-sm font-medium text-orange-700 dark:text-orange-300 mb-1",children:"Yearly"}),n.jsx("p",{className:"text-2xl font-bold text-orange-900 dark:text-orange-100",children:i(s.yearly)}),n.jsx("p",{className:"text-xs text-orange-600 dark:text-orange-400",children:"credits/year"})]})]}),n.jsx(xn,{}),n.jsxs("div",{children:[n.jsx("h4",{className:"font-semibold mb-3",children:"Daily Cost Breakdown"}),n.jsx("div",{className:"space-y-2",children:o().map((l,c)=>n.jsxs("div",{className:"flex justify-between items-center text-sm",children:[n.jsx("span",{className:"capitalize",children:l.name}),n.jsxs("div",{className:"flex items-center gap-4",children:[n.jsxs(Be,{variant:"outline",className:"font-mono",children:[l.unitCost," per unit"]}),n.jsx("span",{className:"font-medium text-right w-20",children:i(Math.round(l.dailyCost))})]})]},c))})]}),e.packages&&e.packages.length>0&&n.jsxs(n.Fragment,{children:[n.jsx(xn,{}),n.jsxs("div",{children:[n.jsx("h4",{className:"font-semibold mb-3",children:"Recommended Credit Package"}),n.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:e.packages.map(l=>{const c=l.credits/s.monthly,d=c>=1&&c<=3;return n.jsxs(Te,{className:Vgt("relative",d?"border-primary":""),children:[l.popular&&n.jsx(Be,{className:"absolute -top-2 -right-2",variant:"default",children:"Popular"}),n.jsxs(Re,{className:"p-4 text-center",children:[n.jsx("p",{className:"font-bold",children:l.label}),n.jsxs("p",{className:"text-2xl font-bold mt-1",children:["$",l.price]}),n.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["~",c.toFixed(1)," months"]})]})]},l.credits)})})]})]})]}),n.jsx("div",{className:"h-2 bg-gradient-to-r from-blue-200 via-indigo-200 to-purple-200 dark:from-blue-800 dark:via-indigo-800 dark:to-purple-800"})]})]})}function Vgt(...e){return e.filter(Boolean).join(" ")}function Ggt(e,t){const r=i=>i.replace(/_/g," ").replace(/\b\w/g,o=>o.toUpperCase()),s=i=>i===0?"Free":`${i} credits`;let a=`# Credit Cost Structure
1989
1990`;return a+=`Complete breakdown of credit costs for all platform operations and features.
1991
1992`,e.content&&(a+=`## Content Generation
1993
1994`,a+=`### Base Operations
1995
1996`,e.content.base_generation!==void 0&&(a+=`- **Base Generation**: ${s(e.content.base_generation)}
1997`),e.content.manual_generation!==void 0&&(a+=`- **Manual Generation**: ${s(e.content.manual_generation)}
1998`),e.content.improvement!==void 0&&(a+=`- **Content Improvement**: ${s(e.content.improvement)}
1999`),e.content.content_types&&Object.keys(e.content.content_types).length>0&&(a+=`
2000### Content Types
2001
2002`,a+=`| Content Type | Credits |
2003`,a+=`|--------------|----------|
2004`,Object.entries(e.content.content_types).forEach(([i,o])=>{a+=`| ${r(i)} | ${s(o)} |
2005`})),a+=`
2006`),e.media&&(a+=`## Media Operations
2007
2008`,e.media.image&&Object.keys(e.media.image).length>0&&(a+=`### Image Operations
2009
2010`,a+=`| Operation | Credits |
2011`,a+=`|-----------|----------|
2012`,Object.entries(e.media.image).forEach(([i,o])=>{a+=`| ${r(i)} | ${s(o)} |
2013`}),a+=`
2014`),e.media.video&&Object.keys(e.media.video).length>0&&(a+=`### Video Operations
2015
2016`,a+=`| Operation | Credits |
2017`,a+=`|-----------|----------|
2018`,Object.entries(e.media.video).forEach(([i,o])=>{a+=`| ${r(i)} | ${s(o)} |
2019`}),a+=`
2020`),e.media.audio&&Object.keys(e.media.audio).length>0&&(a+=`### Audio Operations
2021
2022`,a+=`| Operation | Credits |
2023`,a+=`|-----------|----------|
2024`,Object.entries(e.media.audio).forEach(([i,o])=>{a+=`| ${r(i)} | ${s(o)} |
2025`}),a+=`
2026`)),e.processing&&Object.keys(e.processing).length>0&&(a+=`## Data Processing
2027
2028`,a+=`Costs for data processing and analysis operations.
2029
2030`,a+=`| Operation | Credits |
2031`,a+=`|-----------|----------|
2032`,Object.entries(e.processing).forEach(([i,o])=>{a+=`| ${r(i)} | ${s(o)} |
2033`}),a+=`
2034`),e.api&&(a+=`## API Operations
2035
2036`,a+=`Costs for API calls and external service integrations.
2037
2038`,e.api.standard_call!==void 0&&(a+=`- **Standard Call**: ${s(e.api.standard_call)}
2039`),e.api.bulk_operation!==void 0&&(a+=`- **Bulk Operation**: ${s(e.api.bulk_operation)}
2040`),e.api.webhook_call!==void 0&&(a+=`- **Webhook Call**: ${s(e.api.webhook_call)}
2041`),e.api.llm_call&&Object.keys(e.api.llm_call).length>0&&(a+=`
2042### LLM API Calls
2043
2044`,a+=`| Service | Credits |
2045`,a+=`|---------|----------|
2046`,Object.entries(e.api.llm_call).forEach(([i,o])=>{a+=`| ${r(i)} | ${s(o)} |
2047`})),a+=`
2048`),e.features&&Object.keys(e.features).length>0&&(a+=`## Advanced Features
2049
2050`,a+=`Costs for advanced platform features and automation.
2051
2052`,a+=`| Feature | Credits |
2053`,a+=`|---------|----------|
2054`,Object.entries(e.features).forEach(([i,o])=>{a+=`| ${r(i)} | ${s(o)} |
2055`}),a+=`
2056`),t&&t.length>0&&(a+=`## Credit Packages
2057
2058`,a+=`Available credit packages for purchase.
2059
2060`,a+=`| Package | Credits | Price | Rate per 1k Credits |
2061`,a+=`|---------|---------|-------|-----------------------|
2062`,t.forEach(i=>{const o=(i.price/i.credits*1e3).toFixed(1),l=i.popular?" ⭐":"";a+=`| ${i.label}${l} | ${i.credits.toLocaleString()} | $${i.price} | $${o} |
2063`}),a+=`
2064`,t.some(i=>i.popular)&&(a+=`*⭐ = Popular choice*
2065
2066`)),a+=`---
2067
2068`,a+=`*Generated on ${new Date().toLocaleDateString()} at ${new Date().toLocaleTimeString()}*
2069`,a}function qgt(){const[e,t]=g.useState(null),[r,s]=g.useState([]),[a,i]=g.useState(!0),[o,l]=g.useState(null),[c,d]=g.useState(new Set(["content"])),u=g.useMemo(()=>e?Ggt(e,r):"",[e,r]);if(g.useEffect(()=>{async function x(){try{const{data:{session:b}}=await de.auth.getSession();if(!b)throw new Error("No authentication session found");const w=await fetch("https://worker.rainfactory.ai/api/credits/costs",{method:"GET",headers:{Authorization:`Bearer ${b.access_token}`}});if(!w.ok)throw new Error("Failed to fetch credit costs");const j=await w.json();t(j.costs),s(j.packages)}catch(b){console.error("Error fetching credit costs:",b),l(b instanceof Error?b.message:"Unknown error occurred")}finally{i(!1)}}x()},[]),a)return n.jsx("div",{className:"space-y-6",children:n.jsxs(Te,{children:[n.jsxs(st,{children:[n.jsx(Lt,{className:"h-6 w-48"}),n.jsx(Lt,{className:"h-4 w-96"})]}),n.jsx(Re,{className:"space-y-4",children:Array.from({length:4}).map((x,b)=>n.jsx(Lt,{className:"h-20 w-full"},b))})]})});if(o||!e)return n.jsxs(Ar,{variant:"destructive",children:[n.jsx(nr,{className:"h-4 w-4"}),n.jsxs(gr,{children:["Failed to load credit structure: ",o||"Unknown error"]})]});const h=x=>x.replace(/_/g," ").replace(/\b\w/g,b=>b.toUpperCase()),m=x=>{switch(x){case"content":return n.jsx(Xr,{className:"w-5 h-5"});case"media":return n.jsx(Ra,{className:"w-5 h-5"});case"processing":return n.jsx(T0e,{className:"w-5 h-5"});case"api":return n.jsx(en,{className:"w-5 h-5"});case"features":return n.jsx(Fm,{className:"w-5 h-5"});default:return n.jsx(fs,{className:"w-5 h-5"})}},f=x=>{switch(x){case"image":return n.jsx(Ra,{className:"w-4 h-4"});case"video":return n.jsx(fi,{className:"w-4 h-4"});case"audio":return n.jsx(fxe,{className:"w-4 h-4"});case"content_types":return n.jsx(Xr,{className:"w-4 h-4"});case"llm_call":return n.jsx(mr,{className:"w-4 h-4"});default:return null}},p=(x,b,y=0)=>{const w=y===0?"":y===1?"ml-4":"ml-8";return n.jsxs("div",{className:`flex justify-between items-center py-2 ${w}`,children:[n.jsxs("div",{className:"flex items-center gap-2",children:[y===1&&f(x),n.jsx("span",{className:`${y===0?"font-medium":y===1?"font-normal":"text-muted-foreground"}`,children:h(x)})]}),n.jsx(Be,{variant:b===0?"secondary":"default",className:"font-mono",children:b===0?"Free":`${b} credits`})]},x)},A=(x,b=0)=>Object.entries(x).map(([y,w])=>typeof w=="object"&&w!==null?n.jsxs("div",{children:[n.jsxs("div",{className:`flex items-center gap-2 py-2 font-medium ${b===0?"text-base":"text-sm"} ${b>0?"ml-4":""}`,children:[b===1&&f(y),h(y)]}),n.jsx("div",{className:b===0?"ml-4":"ml-8",children:A(w,b+1)}),b===0&&n.jsx(xn,{className:"my-3"})]}
2069,y):typeof w=="number"?p(y,w,b):null).filter(Boolean),v=x=>{d(b=>{const y=new Set(b);return y.has(x)?y.delete(x):y.add(x),y})};return n.jsxs("div",{className:"space-y-6",children:[n.jsxs(Te,{className:"bg-white rounded-xl border border-gray-200/50 shadow-sm overflow-hidden transition-all duration-300 hover:shadow-md",children:[n.jsx("div",{className:"p-6 border-b bg-gradient-to-r from-purple-50 to-violet-50 dark:from-purple-950/20 dark:to-violet-950/20",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-10 h-10 bg-gradient-to-br from-purple-500 to-violet-600 rounded-full flex items-center justify-center shadow-lg",children:n.jsx(sa,{className:"h-5 w-5 text-white"})}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-lg font-semibold text-purple-900 dark:text-purple-100 mb-1",children:"Credit Cost Structure"}),n.jsx("p",{className:"text-sm text-purple-700 dark:text-purple-200",children:"Complete breakdown of credit costs for all platform operations and features"})]})]}),e&&n.jsxs("div",{className:"flex gap-2",children:[n.jsx(Dv,{text:u,variant:"button",labelText:"Export as Markdown",className:"bg-white/80 backdrop-blur-sm border-purple-200 hover:bg-purple-50 hover:border-purple-300 transition-all duration-200"}),n.jsx(te,{variant:"outline",size:"sm",className:"bg-white/80 backdrop-blur-sm border-purple-200 hover:bg-purple-50 hover:border-purple-300 transition-all duration-200",onClick:()=>{const x=Object.keys(e);c.size===x.length?d(new Set):d(new Set(x))},children:c.size===Object.keys(e).length?"Collapse All":"Expand All"})]})]})}),n.jsx("div",{className:"h-2 bg-gradient-to-r from-purple-200 via-violet-200 to-indigo-200 dark:from-purple-800 dark:via-violet-800 dark:to-indigo-800"})]}),n.jsx("div",{className:"grid gap-6",children:Object.entries(e).map(([x,b])=>{const y=c.has(x),w={content:{gradient:"from-blue-50 to-indigo-50 dark:from-blue-950/20 dark:to-indigo-950/20",iconGradient:"from-blue-500 to-indigo-600",textColor:"text-blue-900 dark:text-blue-100",subtextColor:"text-blue-700 dark:text-blue-200",bottomGradient:"from-blue-200 via-indigo-200 to-purple-200 dark:from-blue-800 dark:via-indigo-800 dark:to-purple-800"},media:{gradient:"from-green-50 to-emerald-50 dark:from-green-950/20 dark:to-emerald-950/20",iconGradient:"from-green-500 to-emerald-600",textColor:"text-green-900 dark:text-green-100",subtextColor:"text-green-700 dark:text-green-200",bottomGradient:"from-green-200 via-emerald-200 to-teal-200 dark:from-green-800 dark:via-emerald-800 dark:to-teal-800"},processing:{gradient:"from-orange-50 to-red-50 dark:from-orange-950/20 dark:to-red-950/20",iconGradient:"from-orange-500 to-red-600",textColor:"text-orange-900 dark:text-orange-100",subtextColor:"text-orange-700 dark:text-orange-200",bottomGradient:"from-orange-200 via-red-200 to-pink-200 dark:from-orange-800 dark:via-red-800 dark:to-pink-800"},api:{gradient:"from-cyan-50 to-teal-50 dark:from-cyan-950/20 dark:to-teal-950/20",iconGradient:"from-cyan-500 to-teal-600",textColor:"text-cyan-900 dark:text-cyan-100",subtextColor:"text-cyan-700 dark:text-cyan-200",bottomGradient:"from-cyan-200 via-teal-200 to-emerald-200 dark:from-cyan-800 dark:via-teal-800 dark:to-emerald-800"},features:{gradient:"from-purple-50 to-violet-50 dark:from-purple-950/20 dark:to-violet-950/20",iconGradient:"from-purple-500 to-violet-600",textColor:"text-purple-900 dark:text-purple-100",subtextColor:"text-purple-700 dark:text-purple-200",bottomGradient:"from-purple-200 via-violet-200 to-indigo-200 dark:from-purple-800 dark:via-violet-800 dark:to-indigo-800"}},j=w[x]||w.content;return n.jsxs(Te,{className:"bg-white rounded-xl border border-gray-200/50 shadow-sm overflow-hidden transition-all duration-300 hover:shadow-md",children:[n.jsx("div",{className:`p-6 border-b bg-gradient-to-r ${j.gradient} cursor-pointer transition-all duration-200`,onClick:()=>v(x),children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:`w-10 h-10 bg-gradient-to-br ${j.iconGradient} rounded-full flex items-center justify-center shadow-lg`,children:m(x)}),n.jsxs("div",{children:[n.jsx("h3",{className:`text-lg font-semibold ${j.textColor} mb-1 capitalize`,children:h(x)}),n.jsxs("p",{className:`text-sm ${j.subtextColor}`,children:[x==="content"&&"Costs for generating and managing content across all types",x==="media"&&"Costs for image, video, and audio operations",x==="processing"&&"Costs for data processing and analysis operations",x==="api"&&"Costs for API calls and external service integrations",x==="features"&&"Costs for advanced platform features and automation"]})]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs(Be,{variant:"outline",className:`bg-white/80 ${j.textColor.replace("dark:text-","border-").replace("text-","border-")}-200`,children:[Object.keys(b).length," items"]}),y?n.jsx(Un,{className:"h-5 w-5 text-muted-foreground transition-transform"}):n.jsx(_s,{className:"h-5 w-5 text-muted-foreground transition-transform"})]})]})}),n.jsx("div",{className:`overflow-hidden transition-all duration-500 ease-in-out ${y?"max-h-[2000px] opacity-100":"max-h-0 opacity-0"}`,children:n.jsx(Re,{className:"p-6",children:n.jsx("div",{className:"space-y-1",children:A(b)})})}),n.jsx("div",{className:`h-2 bg-gradient-to-r ${j.bottomGradient}`})]},x)})}),r.length>0&&n.jsxs(Te,{className:"bg-white rounded-xl border border-gray-200/50 shadow-sm overflow-hidden transition-all duration-300 hover:shadow-md",children:[n.jsx("div",{className:"p-6 border-b bg-gradient-to-r from-pink-50 to-rose-50 dark:from-pink-950/20 dark:to-rose-950/20",children:n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-10 h-10 bg-gradient-to-br from-pink-500 to-rose-600 rounded-full flex items-center justify-center shadow-lg",children:n.jsx(Ka,{className:"h-5 w-5 text-white"})}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-lg font-semibold text-pink-900 dark:text-pink-100 mb-1",children:"Credit Packages"}),n.jsx("p",{className:"text-sm text-pink-700 dark:text-pink-200",children:"Available credit packages for purchase with competitive pricing"})]})]})}),n.jsx(Re,{className:"p-6",children:n.jsx("div",{className:"grid gap-6 md:grid-cols-2 lg:grid-cols-4",children:r.map((x,b)=>{const y=x.credits/1e4;return n.jsxs("div",{className:`relative p-6 rounded-xl border-2 transition-all duration-300 hover:shadow-lg ${x.popular?"border-pink-300 bg-gradient-to-br from-pink-50 to-rose-50 dark:from-pink-900/20 dark:to-rose-900/20 shadow-md":"border-gray-200 bg-gradient-to-br from-white to-gray-50 dark:from-gray-900 dark:to-gray-800 hover:border-pink-200"}`,children:[x.popular&&n.jsx("div",{className:"absolute -top-3 left-1/2 transform -translate-x-1/2",children:n.jsx(Be,{className:"bg-pink-500 text-white px-3 py-1 text-xs font-semibold",children:"Most Popular"})}),n.jsxs("div",{className:"text-center space-y-3",children:[n.jsx("div",{className:"font-bold text-xl text-gray-900 dark:text-gray-100",children:x.label}),n.jsxs("div",{className:"text-3xl font-bold text-pink-600 dark:text-pink-400",children:["$",x.price]}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"text-sm font-medium text-gray-600 dark:text-gray-300",children:[x.credits.toLocaleStr
2069ing()," credits"]}),n.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:["$",(x.price/x.credits*1e3).toFixed(1),"/1k credits"]}),n.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400 bg-gray-100 dark:bg-gray-800 rounded px-2 py-1",children:["~",y.toFixed(1)," months average"]})]})]})]},b)})})}),n.jsx("div",{className:"h-2 bg-gradient-to-r from-pink-200 via-rose-200 to-red-200 dark:from-pink-800 dark:via-rose-800 dark:to-red-800"})]})]})}const B4={content_generation:"#3b82f6",image_processing:"#10b981",video_processing:"#f59e0b",other:"#8b5cf6",api:"#ef4444",features:"#06b6d4"};function Kgt(){const{fetchTransactions:e}=Fc(),{toast:t}=sn(),[r,s]=g.useState("30"),[a,i]=g.useState([]),[o,l]=g.useState(!0),[c,d]=g.useState(null),u=g.useMemo(()=>{const b=new Date,y=Xq(b);let w;switch(r){case"7":w=BA(Fh(b,7));break;case"30":w=BA(Fh(b,30));break;case"90":w=BA(Fh(b,90));break;case"all":default:w=new Date("2020-01-01");break}return{startDate:w,endDate:y}},[r]),h=g.useCallback(async()=>{l(!0),d(null);try{const b=await e({limit:1e3,offset:0,type:"consumption",startDate:r!=="all"?u.startDate.toISOString():void 0,endDate:r!=="all"?u.endDate.toISOString():void 0});i(b.transactions||[])}catch(b){console.error("Failed to load transactions for analytics:",b),d("Failed to load transaction data")}finally{l(!1)}},[e,r,u]);g.useEffect(()=>{h()},[h]);const m=g.useMemo(()=>{if(!a.length)return[];const b=a.filter(_=>{const S=new Date(_.created_at);return EAe(S,{start:u.startDate,end:u.endDate})}),y=new Map;b.forEach(_=>{const S=nn(new Date(_.created_at),"yyyy-MM-dd");y.has(S)||y.set(S,[]),y.get(S).push(_)});const w=[],j=Array.from(y.keys()).sort();let N=0;return j.forEach(_=>{const S=y.get(_),C={content_generation:0,image_processing:0,video_processing:0,other:0,api:0,features:0};let E=0;S.forEach(T=>{const B=Math.abs(T.amount),L=T.category||"other";L in C?C[L]+=B:C.other+=B,E+=B}),N+=E,w.push({date:_,formattedDate:nn(new Date(_),"MMM d"),...C,total:E,cumulative:N})}),w},[a,u]),f=({active:b,payload:y})=>{if(b&&y&&y.length){const w=y[0].payload;return n.jsxs("div",{className:"bg-background border border-border rounded-lg shadow-lg p-3",children:[n.jsx("p",{className:"font-medium",children:nn(new Date(w.date),"MMM d, yyyy")}),n.jsxs("div",{className:"mt-2 space-y-1",children:[Object.entries(B4).map(([j,N])=>{const _=w[j];return _>0?n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:N}}),n.jsx("span",{className:"text-sm capitalize",children:j.replace("_"," ")})]}),n.jsx("span",{className:"text-sm font-medium",children:_.toLocaleString()})]},j):null}),n.jsx("div",{className:"border-t pt-1 mt-2",children:n.jsxs("div",{className:"flex justify-between font-medium",children:[n.jsx("span",{children:"Total:"}),n.jsxs("span",{children:[w.total.toLocaleString()," credits"]})]})})]})]})}return null},p=g.useCallback(()=>{const b=["Date","Content Generation","Image Processing","Video Processing","API","Features","Other","Daily Total","Cumulative Total"],y=m.map(w=>[w.date,w.content_generation.toString(),w.image_processing.toString(),w.video_processing.toString(),w.api.toString(),w.features.toString(),w.other.toString(),w.total.toString(),w.cumulative.toString()]);return[b,...y].map(w=>w.join(",")).join(`
2070`)},[m]),A=g.useCallback(()=>{try{const b=p(),y=new Blob([b],{type:"text/csv;charset=utf-8;"}),w=document.createElement("a"),j=URL.createObjectURL(y);w.setAttribute("href",j),w.setAttribute("download",`credit-usage-analytics-${nn(new Date,"yyyy-MM-dd")}.csv`),w.style.visibility="hidden",document.body.appendChild(w),w.click(),document.body.removeChild(w),URL.revokeObjectURL(j),t({title:"Export successful",description:"Usage analytics data exported to CSV file"})}catch(b){console.error("Error exporting CSV:",b),t({title:"Export failed",description:"Failed to export usage data",variant:"destructive"})}},[p,t]),v=g.useCallback(async()=>{try{const b=p();await navigator.clipboard.writeText(b),t({title:"Copied to clipboard",description:"Usage analytics data copied as CSV format"})}catch(b){console.error("Error copying to clipboard:",b),t({title:"Copy failed",description:"Failed to copy data to clipboard",variant:"destructive"})}},[p,t]),x=g.useMemo(()=>{const b=m.reduce((j,N)=>j+N.total,0),y=m.length>0?b/m.length:0,w=m.reduce((j,N)=>N.total>j.total?N:j,{total:0,date:""});return{totalCredits:b,avgDaily:y,peakDay:w,daysWithUsage:m.filter(j=>j.total>0).length}},[m]);return o?n.jsx(Te,{children:n.jsx(Re,{className:"flex items-center justify-center py-8",children:n.jsx("div",{className:"text-center text-muted-foreground",children:"Loading usage analytics..."})})}):c?n.jsx(Te,{children:n.jsx(Re,{className:"flex items-center justify-center py-8",children:n.jsx("div",{className:"text-center text-destructive",children:c})})}):n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"grid gap-4 md:grid-cols-4",children:[n.jsx(Te,{className:"bg-gradient-to-br from-blue-50 to-indigo-50 dark:from-blue-900/20 dark:to-indigo-900/20 border-blue-200/50 hover:shadow-md transition-all duration-300",children:n.jsx(Re,{className:"pt-6",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsx("div",{className:"text-2xl font-bold text-blue-900 dark:text-blue-100",children:x.totalCredits.toLocaleStr
2070ing()}),n.jsx("p",{className:"text-xs text-blue-600 dark:text-blue-400 font-medium",children:"Total Credits Used"})]}),n.jsx("div",{className:"w-10 h-10 bg-gradient-to-br from-blue-500 to-indigo-600 rounded-full flex items-center justify-center",children:n.jsx(sa,{className:"h-5 w-5 text-white"})})]})})}),n.jsx(Te,{className:"bg-gradient-to-br from-green-50 to-emerald-50 dark:from-green-900/20 dark:to-emerald-900/20 border-green-200/50 hover:shadow-md transition-all duration-300",children:n.jsx(Re,{className:"pt-6",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsx("div",{className:"text-2xl font-bold text-green-900 dark:text-green-100",children:Math.round(x.avgDaily).toLocaleString()}),n.jsx("p",{className:"text-xs text-green-600 dark:text-green-400 font-medium",children:"Avg Daily Usage"})]}),n.jsx("div",{className:"w-10 h-10 bg-gradient-to-br from-green-500 to-emerald-600 rounded-full flex items-center justify-center",children:n.jsx(sl,{className:"h-5 w-5 text-white"})})]})})}),n.jsx(Te,{className:"bg-gradient-to-br from-orange-50 to-red-50 dark:from-orange-900/20 dark:to-red-900/20 border-orange-200/50 hover:shadow-md transition-all duration-300",children:n.jsx(Re,{className:"pt-6",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsx("div",{className:"text-2xl font-bold text-orange-900 dark:text-orange-100",children:x.peakDay.total.toLocaleString()}),n.jsx("p",{className:"text-xs text-orange-600 dark:text-orange-400 font-medium",children:"Peak Day Usage"})]}),n.jsx("div",{className:"w-10 h-10 bg-gradient-to-br from-orange-500 to-red-600 rounded-full flex items-center justify-center",children:n.jsx(f2,{className:"h-5 w-5 text-white"})})]})})}),n.jsx(Te,{className:"bg-gradient-to-br from-purple-50 to-violet-50 dark:from-purple-900/20 dark:to-violet-900/20 border-purple-200/50 hover:shadow-md transition-all duration-300",children:n.jsx(Re,{className:"pt-6",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsx("div",{className:"text-2xl font-bold text-purple-900 dark:text-purple-100",children:x.daysWithUsage}),n.jsx("p",{className:"text-xs text-purple-600 dark:text-purple-400 font-medium",children:"Active Days"})]}),n.jsx("div",{className:"w-10 h-10 bg-gradient-to-br from-purple-500 to-violet-600 rounded-full flex items-center justify-center",children:n.jsx(Kn,{className:"h-5 w-5 text-white"})})]})})})]}),n.jsxs(Te,{className:"bg-white rounded-xl border border-gray-200/50 shadow-sm overflow-hidden transition-all duration-300 hover:shadow-md",children:[n.jsx("div",{className:"p-6 border-b bg-gradient-to-r from-cyan-50 to-teal-50 dark:from-cyan-950/20 dark:to-teal-950/20",children:n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-10 h-10 bg-gradient-to-br from-cyan-500 to-teal-600 rounded-full flex items-center justify-center shadow-lg",children:n.jsx(sa,{className:"h-5 w-5 text-white"})}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-lg font-semibold text-cyan-900 dark:text-cyan-100 mb-1",children:"Usage Analytics"}),n.jsx("p",{className:"text-sm text-cyan-700 dark:text-cyan-200",children:"Credit consumption over time by category with interactive controls"})]})]}),n.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[n.jsxs(ur,{value:r,onValueChange:b=>s(b),children:[n.jsxs(or,{className:"w-[180px] bg-white/80 backdrop-blur-sm border-cyan-200 hover:border-cyan-300 transition-colors",children:[n.jsx(Kn,{className:"w-4 h-4 mr-2"}),n.jsx(hr,{placeholder:"Select time range"})]}),n.jsxs(lr,{children:[n.jsx(Fe,{value:"7",children:"Last 7 days"}),n.jsx(Fe,{value:"30",children:"Last 30 days"}),n.jsx(Fe,{value:"90",children:"Last 90 days"}),n.jsx(Fe,{value:"all",children:"All time"})]})]}),n.jsxs("div",{className:"flex gap-2",children:[n.jsxs(te,{variant:"outline",size:"sm",onClick:v,disabled:m.length===0,className:"bg-white/80 backdrop-blur-sm border-cyan-200 hover:bg-cyan-50 hover:border-cyan-300 transition-all duration-200",children:[n.jsx(Cn,{className:"w-4 h-4 mr-2"}),"Copy CSV"]}),n.jsxs(te,{variant:"outline",size:"sm",onClick:A,disabled:m.length===0,className:"bg-white/80 backdrop-blur-sm border-cyan-200 hover:bg-cyan-50 hover:border-cyan-300 transition-all duration-200",children:[n.jsx(Ad,{className:"w-4 h-4 mr-2"}),"Export CSV"]})]})]})]})}),n.jsx(Re,{className:"p-6",children:m.length===0?n.jsxs("div",{className:"flex flex-col items-center justify-center py-12",children:[n.jsx("div",{className:"w-16 h-16 bg-gradient-to-br from-gray-100 to-gray-200 dark:from-gray-700 dark:to-gray-600 rounded-full flex items-center justify-center mb-4",children:n.jsx(sl,{className:"w-8 h-8 text-gray-400"})}),n.jsx("h3",{className:"text-lg font-semibold text-gray-600 dark:text-gray-300 mb-2",children:"No usage data available"}),n.jsx("p",{className:"text-muted-foreground text-center max-w-sm",children:"No usage data found for the selected time range. Try adjusting your time range or check back later."})]}):n.jsx("div",{className:"space-y-4",children:n.jsx("div",{className:"bg-gradient-to-br from-gray-50 to-gray-100 dark:from-gray-800 dark:to-gray-700 rounded-lg p-4",children:n.jsx("div",{className:"h-[400px] w-full",children:n.jsx(Sl,{width:"100%",height:"100%",children:n.jsxs(RKe,{data:m,margin:{top:10,right:30,left:2
20700,bottom:5},children:[n.jsx("defs",{children:Object.entries(B4).map(([b,y])=>n.jsxs("linearGradient",{id:`gradient-${b}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[n.jsx("stop",{offset:"5%",stopColor:y,stopOpacity:.9}),n.jsx("stop",{offset:"95%",stopColor:y,stopOpacity:.2})]},b))}),n.jsx(au,{strokeDasharray:"3 3",className:"opacity-20",stroke:"#e5e7eb"}),n.jsx(zo,{dataKey:"formattedDate",tick:{fontSize:11,fill:"#6b7280"},tickLine:!1,axisLine:{stroke:"#e5e7eb",strokeWidth:1}}),n.jsx(so,{tick:{fontSize:11,fill:"#6b7280"},tickLine:!1,axisLine:!1}),n.jsx(Aa,{content:n.jsx(f,{})}),n.jsx(Mi,{wrapperStyle:{paddingTop:"20px"},iconType:"rect",iconSize:12}),Object.entries(B4).map(([b,y])=>n.jsx(ff,{type:"monotone",dataKey:b,stackId:"1",stroke:y,fill:`url(#gradient-${b})`,strokeWidth:2,name:b.replace("_"," ").replace(/\b\w/g,w=>w.toUpperCase())},b))]})})})})})}),n.jsx("div",{className:"h-2 bg-gradient-to-r from-cyan-200 via-teal-200 to-emerald-200 dark:from-cyan-800 dark:via-teal-800 dark:to-emerald-800"})]})]})}function Wgt(){const{balance:e,usage:t,loading:r,error:s}=Fc(),[a,i]=g.useState("history");return g.useEffect(()=>{console.log("[Credits Page] Data state:",{balance:e,usage:t,loading:r,error:s})},[e,t,r,s]),n.jsxs("div",{className:"flex flex-col min-w-0 space-y-6",children:[n.jsx("div",{className:"px-4 sm:px-6 lg:px-8 pt-8",children:n.jsxs("div",{className:"relative overflow-hidden bg-gradient-to-br from-white via-purple-50/30 to-indigo-50/40 rounded-2xl border border-purple-200/50 shadow-sm p-8",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsx("div",{className:"absolute top-0 right-0 w-40 h-40 bg-gradient-to-br from-purple-200/20 to-transparent rounded-full -translate-y-20 translate-x-20"}),n.jsx("div",{className:"absolute bottom-0 left-0 w-32 h-32 bg-gradient-to-tr from-indigo-200/20 to-transparent rounded-full translate-y-16 -translate-x-16"}),n.jsx("div",{className:"relative",children:n.jsxs("div",{className:"flex items-center gap-4",children:[n.jsx("div",{className:"p-3 bg-white/80 backdrop-blur-sm rounded-2xl shadow-lg",children:n.jsx(en,{className:"h-8 w-8 text-purple-600"})}),n.jsxs("div",{children:[n.jsx("h1",{className:"text-4xl font-bold bg-gradient-to-r from-purple-700 via-indigo-700 to-blue-700 bg-clip-text text-transparent mb-2",children:"Credits Management"}),n.jsx("p",{className:"text-gray-600 text-lg leading-relaxed",children:"Track your credit usage, view transaction history, and estimate costs for your content creation needs with comprehensive analytics and insights."})]})]})})]})}),n.jsx("div",{className:"px-4 sm:px-6 lg:px-8",children:n.jsxs("div",{className:"relative overflow-hidden bg-gradient-to-r from-blue-50 via-indigo-50 to-purple-50 dark:from-blue-950/20 dark:via-indigo-950/20 dark:to-purple-950/20 rounded-xl border border-blue-200/50 dark:border-blue-800/50 p-4",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-blue-100/20 to-purple-100/20 dark:from-blue-900/10 dark:to-purple-900/10"}),n.jsxs("div",{className:"relative flex items-start gap-3",children:[n.jsx("div",{className:"p-2 bg-blue-100 dark:bg-blue-900/30 rounded-lg",children:n.jsx(qi,{className:"h-5 w-5 text-blue-600 dark:text-blue-400"})}),n.jsxs("div",{children:[n.jsx("h3",{className:"font-semibold text-blue-900 dark:text-blue-100 mb-1",children:"Personal Account Credits"}),n.jsx("p",{className:"text-blue-800 dark:text-blue-200 text-sm leading-relaxed",children:"The credits and transactions shown here are for your personal account only. Team and organization accounts that you've been invited to have separate credit systems managed independently by their owners. Each user manages their own credits across all accounts they access."})]})]})]})}),n.jsx("div",{className:"px-4 sm:px-6 lg:px-8",children:n.jsxs(Te,{className:"bg-white rounded-xl border border-gray-200/50 shadow-sm overflow-hidden transition-all duration-300 hover:shadow-md",children:[n.jsx("div",{className:"p-6 border-b bg-gradient-to-r from-emerald-50 to-green-50 dark:from-emerald-950/20 dark:to-green-950/20",children:n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-10 h-10 bg-gradient-to-br from-emerald-500 to-green-600 rounded-full flex items-center justify-center shadow-lg",children:n.jsx(q_,{className:"h-5 w-5 text-white"})}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-lg font-semibold text-emerald-900 dark:text-emerald-100 mb-1",children:"Current Balance"}),n.jsx("p",{className:"text-sm text-emerald-700 dark:text-emerald-200",children:"Your available credits and monthly usage overview"})]})]})}),n.jsx(Re,{className:"p-6",children:n.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[n.jsxs("div",{className:"space-y-4",children:[n.jsx(kL,{showDetail
2070s:!0,className:"w-full"}),e&&n.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[n.jsxs("div",{className:"space-y-1 p-4 bg-gradient-to-br from-gray-50 to-gray-100 dark:from-gray-900 dark:to-gray-800 rounded-lg",children:[n.jsx("p",{className:"text-muted-foreground font-medium",children:"Plan Credits"}),n.jsx("p",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100",children:e.plan_credits.toLocaleString()})]}),n.jsxs("div",{className:"space-y-1 p-4 bg-gradient-to-br from-blue-50 to-indigo-100 dark:from-blue-900/20 dark:to-indigo-900/20 rounded-lg",children:[n.jsx("p",{className:"text-muted-foreground font-medium",children:"Purchased Credits"}),n.jsx("p",{className:"text-2xl font-bold text-blue-600 dark:text-blue-400",children:e.purchased_credits.toLocaleString()})]})]})]}),(t==null?void 0:t.month)&&n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[n.jsx(mr,{className:"w-4 h-4 text-purple-500"}),n.jsx("h4",{className:"font-semibold text-gray-900 dark:text-gray-100",children:"This Month's Usage by Category"})]}),n.jsxs("div",{className:"space-y-3",children:[Object.entries(t.month.byCategory).map(([o,l])=>n.jsxs("div",{className:"flex justify-between items-center p-3 bg-gradient-to-r from-gray-50 to-gray-100 dark:from-gray-800 dark:to-gray-700 rounded-lg hover:shadow-sm transition-shadow duration-200",children:[n.jsx("span",{className:"text-sm capitalize text-muted-foreground font-medium",children:o.replace("_"," ")}),n.jsxs("span",{className:"font-bold text-gray-900 dark:text-gray-100",children:[l.toLocaleString()," credits"]})]},o)),Object.keys(t.month.byCategory).length===0&&n.jsxs("div",{className:"text-center p-6 bg-gradient-to-br from-gray-50 to-gray-100 dark:from-gray-800 dark:to-gray-700 rounded-lg",children:[n.jsx(sa,{className:"w-8 h-8 mx-auto text-gray-400 mb-2"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"No usage this month"})]})]})]})]})}),n.jsx("div",{className:"h-2 bg-gradient-to-r from-emerald-200 via-green-200 to-teal-200 dark:from-emerald-800 dark:via-green-800 dark:to-teal-800"})]})}),n.jsx("div",{className:"px-4 sm:px-6 lg:px-8",children:n.jsxs(Cs,{value:a,onValueChange:i,className:"space-y-6",children:[n.jsx("div",{className:"flex justify-center",children:n.jsxs(ps,{className:"grid w-full grid-cols-4 max-w-4xl bg-gradient-to-r from-white to-gray-50 dark:from-gray-900 dark:to-gray-800 border shadow-sm p-1",children:[n.jsxs(pt,{value:"history",className:"flex items-center gap-2 data-[state=active]:bg-gradient-to-r data-[state=active]:from-blue-500 data-[state=active]:to-indigo-600 data-[state=active]:text-white transition-all duration-200",children:[n.jsx(ag,{className:"w-4 h-4"}),n.jsx("span",{className:"hidden sm:inline",children:"Transaction History"}),n.jsx("span",{className:"sm:hidden",children:"History"})]}),n.jsxs(pt,{value:"calculator",className:"flex items-center gap-2 data-[state=active]:bg-gradient-to-r data-[state=active]:from-emerald-500 data-[state=active]:to-green-600 data-[state=active]:text-white transition-all duration-200",children:[n.jsx(pK,{className:"w-4 h-4"}),n.jsx("span",{className:"hidden sm:inline",children:"Cost Calculator"}),n.jsx("span",{className:"sm:hidden",children:"Calculator"})]}),n.jsxs(pt,{value:"structure",className:"flex items-center gap-2 data-[state=active]:bg-gradient-to-r data-[state=active]:from-purple-500 data-[state=active]:to-violet-600 data-[state=active]:text-white transition-all duration-200",children:[n.jsx(sa,{className:"w-4 h-4"}),n.jsx("span",{className:"hidden sm:inline",children:"Credits Structure"}),n.jsx("span",{className:"sm:hidden",children:"Structure"})]}),n.jsxs(pt,{value:"analytics",className:"flex items-center gap-2 data-[state=active]:bg-gradient-to-r data-[state=active]:from-orange-500 data-[state=active]:to-red-600 data-[state=active]:text-white transition-all duration-200",children:[n.jsx(sl,{className:"w-4 h-4"}),n.jsx("span",{className:"hidden sm:inline",children:"Usage Analytics"}),n.jsx("span",{className:"sm:hidden",children:"Analytics"})]})]})}
2070),n.jsx(Ct,{value:"history",className:"space-y-4 mt-6",children:n.jsx(Hgt,{})}),n.jsx(Ct,{value:"calculator",className:"space-y-4 mt-6",children:n.jsx(zgt,{})}),n.jsx(Ct,{value:"structure",className:"space-y-4 mt-6",children:n.jsx(qgt,{})}),n.jsx(Ct,{value:"analytics",className:"space-y-4 mt-6",children:n.jsx(Kgt,{})})]})})]})}function Ygt({brandId:e,showQuickActions:t=!0,onSave:r,className:s=""}){const[a,i]=g.useState({weekly_review:!1,new_convergences:!1,autopost_content_ready:!1,autopost_publish_success:!1,autopost_publish_failure:!1,subscription_changes:!1}),[o,l]=g.useState(!0),[c,d]=g.useState(!1),[u,h]=g.useState(!1),{toast:m}=sn();g.useEffect(()=>{f()},[e]);const f=async()=>{try{l(!0);const b=await de.auth.getSession();if(!b.data.session)return;const y=await fetch(`https://worker.rainfactory.ai/rainfactory/brands/${e}/notification-preferences`,{headers:{Authorization:`Bearer ${b.data.session.access_token}`}});if(!y.ok)throw new Error("Failed to fetch notification preferences");const w=await y.json();w.preferences&&i(w.preferences)}catch(b){console.error("Error fetching notification preferences:",b),m({title:"Error",description:"Failed to load notification preferences",variant:"destructive"})}finally{l(!1)}},p=b=>{i(y=>({...y,[b]:!y[b]})),h(!0)},A=async()=>{try{d(!0);const b=await de.auth.getSession();if(!b.data.session)return;if(!(await fetch(`https://worker.rainfactory.ai/rainfactory/brands/${e}/notification-preferences`,{method:"PUT",headers:{Authorization:`Bearer ${b.data.session.access_token}`,"Content-Type":"application/json"},body:JSON.stringify({preferences:a})})).ok)throw new Error("Failed to save notification preferences");m({title:"Success",description:"Notification preferences saved successfully"}),h(!1),r==null||r()}catch(b){console.error("Error saving notification preferences:",b),m({title:"Error",description:"Failed to save notification preferences",variant:"destructive"})}finally{d(!1)}};if(o)return n.jsx("div",{className:`flex items-center justify-center py-6 ${s}`,children:n.jsx(kt,{className:"h-6 w-6 animate-spin text-indigo-500"})});const v=Object.values(a).every(b=>b),x=Object.values(a).every(b=>!b);return n.jsxs("div",{className:`space-y-4 ${s}`,children:[u&&n.jsx("div",{className:"flex justify-end",children:n.jsxs(te,{onClick:A,disabled:c,size:"sm",children:[c?n.jsx(kt,{className:"mr-2 h-4 w-4 animate-spin"}):n.jsx(ld,{className:"mr-2 h-4 w-4"}),"Save Changes"]})}),t&&n.jsxs("div",{className:"flex gap-2 flex-wrap",children:[n.jsxs(te,{variant:"outline",size:"sm",onClick:()=>{i({weekly_review:!0,new_convergences:!0,autopost_content_ready:!0,autopost_publish_success:!0,autopost_publish_failure:!0,subscription_changes:!0}),h(!0)},disabled:v,className:"flex-1 sm:flex-none",children:[n.jsx(Gge,{className:"mr-2 h-4 w-4"}),"Enable All"]}),n.jsxs(te,{variant:"outline",size:"sm",onClick:()=>{i({weekly_review:!1,new_convergences:!1,autopost_content_ready:!1,autopost_publish_success:!1,autopost_publish_failure:!1,subscription_changes:!1}),h(!0)},disabled:x,className:"flex-1 sm:flex-none",children:[n.jsx(zge,{className:"mr-2 h-4 w-4"}),"Disable All"]})]}),n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"space-y-0.5",children:[n.jsx(ze,{htmlFor:"weekly_review",children:"Weekly Review"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Receive weekly summaries of brand activity"})]}),n.jsx(ns,{id:"weekly_review",checked:a.weekly_review,onCheckedChange:()=>p("weekly_review")})]}),n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"space-y-0.5",children:[n.jsx(ze,{htmlFor:"new_convergences",children:"New Convergences"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Get notified about new content opportunities"})]}),n.jsx(ns,{id:"new_convergences",checked:a.new_convergences,onCheckedChange:()=>p("new_convergences")})]}),n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"space-y-0.5",children:[n.jsx(ze,{htmlFor:"autopost_content_ready",children:"Content Ready"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Notification when autopost content is ready for review"})]}),n.jsx(ns,{id:"autopost_content_ready",checked:a.autopost_content_ready,onCheckedChange:()=>p("autopost_content_ready")})]}),n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"space-y-0.5",children:[n.jsx(ze,{htmlFor:"autopost_publish_success",children:"Publishing Success"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Confirmation when content is successfully published"})]}),n.jsx(ns,{id:"autopost_publish_success",checked:a.autopost_publish_success,onCheckedChange:()=>p("autopost_publish_success")})]}),n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"space-y-0.5",children:[n.jsx(ze,{htmlFor:"autopost_publish_failure",children:"Publishing Failures"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Alerts when content publishing fails"})]}),n.jsx(ns,{id:"autopost_publish_failure",checked:a.autopost_publish_failure,onCheckedChange:()=>p("autopost_publish_failure")})]}),n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"space-y-0.5",children:[n.jsx(ze,{htmlFor:"subscription_changes",children:"Subscription Changes"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Updates about billing and subscription status"})]}),n.jsx(ns,{id:"subscription_changes",checked:a.subscription_changes,onCheckedChange:()=>p("subscription_changes")}
2070)]})]})]})}const Jgt=()=>{const[e,t]=g.useState("status"),[r,s]=g.useState(!1),{selectedBrand:a}=mn(),{session:i}=wa(),{timezone:o,formatDate:l}=Gl(),c=xr(),[d,u]=g.useState([]),[h,m]=g.useState(!0),f=Z6(),[p,A]=g.useState(new Date),[v,x]=g.useState(f.calendarDateType),{fetchContentsByBrand:b}=sw();console.log("[Automation Debug] Component mounted with:",{selectedBrand:a,hasSelectedBrand:!!a,session:!!i,timezone:o});const[y,w]=g.useState(!0),[j,N]=g.useState(!0),{brandAutopostSettings:_,loading:S,updateBrandAutopostSettings:C}=Vle(a==null?void 0:a.id),E=fie({onRefresh:T,currentMonth:p});g.useEffect(()=>{(async()=>{try{N(!0);const{data:M}=await de.rpc("get_personal_account");if(!(M!=null&&M.account_id)){console.error("No account found");return}const{data:I,error:$}=await de.schema("marketing_and_customer_success").from("profiles").select("notificationPreferences").eq("id",M.account_id).single();if($){console.error("Error fetching profile:",$);return}const V=typeof I.notificationPreferences=="string"?JSON.parse(I.notificationPreferences):I.notificationPreferences;w((V==null?void 0:V.emailNotifications)??!0)}catch(M){console.error("Error in fetchProfileData:",M)}finally{N(!1)}})()},[]),g.useEffect(()=>{a!=null&&a.id&&T()},[a==null?void 0:a.id]),g.useEffect(()=>{nu({calendarDateType:v})},[v]),g.useEffect(()=>{window.scrollTo({top:0,behavior:"smooth"})},[e]),g.useEffect(()=>{console.log("[Automation Debug] selectedBrand changed:",{selectedBrand:a,hasId:!!(a!=null&&a.id),brandName:a==null?void 0:a.brand_name,status:a==null?void 0:a.status})},[a]);async function T(){if(a!=null&&a.id)try{m(!0),console.log("Loading contents for brand:",a.id);const F=await b(a.id);console.log("Fetched contents:",F==null?void 0:F.length),u(F||[])}catch(F){console.error("Error loading contents:",F)}finally{m(!1)}}const B=F=>{c(`/content/${F}`)},L=(F,M)=>{F.stopPropagation(),!(!(a!=null&&a.id)||!M)&&c(`/brands/${a.id}/connections`,{state:{highlightPlatform:M}})},P=()=>n.jsx(Zt,{open:r,onOpenChange:s,children:n.jsxs(Jt,{className:"max-w-3xl max-h-[80vh] overflow-y-auto",children:[n.jsxs(_r,{children:[n.jsx(tr,{children:"How Automation Works"}),n.jsx(Hr,{children:"Step-by-step process of how content is automatically created and posted"})]}),n.jsxs("div",{className:"space-y-6 mt-4",children:[n.jsxs("div",{className:"bg-blue-50/50 rounded-lg p-4 mb-6 border border-blue-100",children:[n.jsxs("h4",{className:"font-semibold text-blue-800 mb-2 flex items-center gap-2",children:[n.jsx(Vr,{className:"h-4 w-4"}),"Hourly Autopost System"]}),n.jsx("p",{className:"text-sm text-blue-700 leading-relaxed",children:"The autopost worker runs every hour to check which brands need content based on their frequency settings. This ensures timely, consistent content delivery that respects your scheduling preferences."})]}),n.jsxs("div",{className:"flex items-start gap-4",children:[n.jsx("div",{className:"flex-shrink-0 w-10 h-10 rounded-full bg-primary/10 flex items-center justify-center",children:n.jsx("span",{className:"text-sm font-semibold",children:"1"})}),n.jsxs("div",{className:"flex-1",children:[n.jsx("h4",{className:"font-semibold mb-1",children:"Convergence Detection"}),n.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"News content is analyzed and convergences are identified based on your brand's focus areas."}),n.jsx(Be,{variant:"secondary",children:"Continuous Monitoring"})]})]}),n.jsxs("div",{className:"flex items-start gap-4",children:[n.jsx("div",{className:"flex-shrink-0 w-10 h-10 rounded-full bg-primary/10 flex items-center justify-center",children:n.jsx("span",{className:"text-sm font-semibold",children:"2"})}),n.jsxs("div",{className:"flex-1",children:[n.jsx("h4",{className:"font-semibold mb-1",children:"Relevance Ranking"}),n.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"Convergences are ranked by relevance to your brand. You'll receive notifications for highly relevant convergences."}),n.jsx(Be,{variant:"secondary",children:"AI-Powered Analysis"})]})]}),n.jsxs("div",{className:"flex items-start gap-4",children:[n.jsx("div",{className:"flex-shrink-0 w-10 h-10 rounded-full bg-primary/10 flex items-center justify-center",children:n.jsx("span",{className:"text-sm font-semibold",children:"3"})}),n.jsxs("div",{className:"flex-1",children:[n.jsx("h4",{className:"font-semibold mb-1",children:"Campaign Creation"}),n.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"A new campaign is automatically created for the convergence with your configured prefix."}),n.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[n.jsx(Be,{variant:"secondary",children:"Automatic Organization"}),n.jsx(te,{asChild:!0,size:"sm",variant:"outline",children:n.jsx(Ir,{to:"/campaigns",children:"View Campaigns"})})]})]})]}),n.jsxs("div",{className:"flex items-start gap-4",children:[n.jsx("div",{className:"flex-shrink-0 w-10 h-10 rounded-full bg-primary/10 flex items-center justify-center",children:n.jsx("span",{className:"text-sm font-semibold",children:"4"})}),n.jsxs("div",{className:"flex-1",children:[n.jsx("h4",{className:"font-semibold mb-1",children:"Content Generation"}),n.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"Content is generated for each enabled platform based on your brand voice."}),n.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[n.jsx(Be,{variant:"secondary",children:"Platform-Specific"}),n.jsx(te,{asChild:!0,size:"sm",variant:"outline",children:n.jsx(Ir,{to:"/content",children:"View Content"})})]})]})]}),n.jsxs("div",{className:"flex items-start gap-4",children:[n.jsx("div",{className:"flex-shrink-0 w-10 h-10 rounded-full bg-primary/10 flex items-center justify-center",children:n.jsx("span",{className:"text-sm font-semibold",children:"5"})}),n.jsxs("div",{className:"flex-1",children:[n.jsx("h4",{className:"font-semibold mb-1",children:"Smart Post Scheduling"}),n.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"Content is intelligently sc
2070heduled based on your platform frequency settings. The system automatically finds the next available time slot if your preferred time is occupied, preventing conflicts."}),n.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[n.jsx(Be,{variant:"secondary",children:"Frequency-Aware"}),n.jsx(Be,{variant:"secondary",children:"Conflict-Free"})]})]})]}),n.jsxs("div",{className:"flex items-start gap-4",children:[n.jsx("div",{className:"flex-shrink-0 w-10 h-10 rounded-full bg-primary/10 flex items-center justify-center",children:n.jsx("span",{className:"text-sm font-semibold",children:"6"})}),n.jsxs("div",{className:"flex-1",children:[n.jsx("h4",{className:"font-semibold mb-1",children:"Notification"}),n.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"You receive an email notification when content is ready for review (if enabled)."}),n.jsx(Be,{variant:"secondary",children:"Optional Alerts"})]})]})]})]})});return n.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 via-white to-blue-50/30 relative overflow-hidden",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsxs("div",{className:"relative container mx-auto p-6 max-w-6xl",children:[n.jsx(P,{}),n.jsxs("div",{className:"relative overflow-hidden bg-gradient-to-br from-white via-blue-50/30 to-indigo-50/40 rounded-2xl border border-blue-200/50 shadow-sm mb-6 md:mb-8 p-4 md:p-8",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsx("div",{className:"absolute top-0 right-0 w-40 h-40 bg-gradient-to-br from-blue-200/20 to-transparent rounded-full -translate-y-20 translate-x-20"}),n.jsx("div",{className:"relative",children:n.jsx("div",{className:"flex items-start justify-between",children:n.jsxs("div",{className:"flex items-center gap-2 md:gap-4",children:[n.jsx("div",{className:"p-2 md:p-3 bg-white/80 backdrop-blur-sm rounded-xl md:rounded-2xl shadow-lg",children:n.jsx(en,{className:"h-5 w-5 md:h-8 md:w-8 text-blue-600"})}),n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-1 md:mb-2",children:[n.jsx("h1",{className:"text-2xl md:text-4xl font-bold bg-gradient-to-r from-blue-700 via-indigo-700 to-purple-700 bg-clip-text text-transparent",children:"Automation"}),n.jsx(Ya,{delayDuration:200,children:n.jsxs(Hs,{children:[n.jsx(zs,{asChild:!0,children:n.jsx("button",{type:"button",className:"p-1.5 rounded-full hover:bg-blue-100/50 transition-colors flex-shrink-0","aria-label":"Automation information",children:n.jsx(qi,{className:"h-4 w-4 md:h-5 md:w-5 text-blue-600"})})}),n.jsx(Vn,{side:"bottom",className:"max-w-xs p-3",children:n.jsx("p",{className:"text-sm leading-relaxed",children:"Understand how Rainfactory AI automates your content creation and posting through intelligent convergence detection, content generation, and smart scheduling."})})]})})]}),n.jsx("p",{className:"text-gray-600 text-base md:text-lg leading-relaxed hidden md:block",children:"Understand how Rainfactory AI automates your content creation and posting"})]})]})})})]}),n.jsxs(Cs,{value:e,onValueChange:t,className:"space-y-8",children:[n.jsxs("div",{className:"relative overflow-hidden bg-white/60 backdrop-blur-sm rounded-xl border border-white/50 shadow-sm p-1",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-blue-50/30 via-transparent to-purple-50/30"}),n.jsxs(ps,{className:"relative grid w-full grid-cols-3 bg-transparent border-0 gap-1",children:[n.jsx(pt,{value:"status",className:"relative bg-white/40 data-[state=active]:bg-gradient-to-r data-[state=active]:from-cyan-500 data-[state=active]:to-blue-600 data-[state=active]:text-white data-[state=active]:shadow-md hover:bg-white/60 transition-all duration-300 font-medium",children:"Current Status"}),n.jsx(pt,{value:"calendar",className:"relative bg-white/40 data-[state=active]:bg-gradient-to-r data-[state=active]:from-indigo-500 data-[state=active]:to-purple-600 data-[state=active]:text-white data-[state=active]:shadow-md hover:bg-white/60 transition-all duration-300 font-medium",children:"Calendar"}),n.jsx(pt,{value:"notifications",className:"relative bg-white/40 data-[state=active]:bg-gradient-to-r data-[state=active]:from-orange-500 data-[state=active]:to-amber-600 data-[state=active]:text-white data-[state=active]:shadow-md hover:bg-white/60 transition-all duration-300 font-medium",children:"Notifications"})]})]}),n.jsxs(Ct,{value:"status",className:"space-y-6",children:[!j&&(_==null?void 0:_.autogenerate_enabled)===!1&&n.jsxs(Ar,{variant:"destructive",className:"border-red-300 bg-red-50",children:[n.jsx(nr,{className:"h-5 w-5 text-red-600"}),n.jsx(Wa,{className:"text-red-900 font-semibold",children:"Brand Level auto-content generation is not enabled"}),n.jsx(gr,{className:"text-red-800",children:n.jsx("p",{children:"The system will not generate content automatically. Enable auto generation using the Brand Automation Master Control below."})})]}),!j&&!y&&n.jsxs(Ar,{className:"border-amber-300 bg-amber-50",children:[n.jsx(hn,{className:"h-5 w-5 text-amber-600"}),n.jsx(Wa,{className:"text-amber-900 font-semibold",children:"Email Notifications not enabled!"}),n.jsxs(gr,{className:"text-amber-800",children:[n.jsx("p",{className:"mb-3",children:"You won't be receiving any emails about automated content unless you enable email notifications in your profile settings."}),n.jsx(te,{variant:"outline",size:"sm",asChild:!0,className:"bg-white hover:bg-amber-50 border-amber-300 text-amber-700 hover:text-amber-900",children:n.jsx(Ir,{to:"/profile",children:"Edit Profile Settings"})})]})]}),n.jsxs("div",{className:"relative overflow-hidden bg-gradient-to-br from-white via-blue-50/30 to-indigo-50/40 rounded-2xl border border-blue-200/50 shadow-lg",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsx("div",{className:"relative p-6",children:n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsx("h3",{className:"text-lg md:text-xl font-bold bg-gradient-to-r from-blue-700 to-indigo-700 bg-clip-text text-transparent",children:"Brand Automation Master Control"}),n.jsxs("p",{className:"text-gray-600 text-sm",children:["Enable or disable all automation features for ",(a==null?void 0:a.brand_name)||"this brand"]})]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(ns,{checked:(_==null?void 0:_.autogenerate_enabled)||!1,onCheckedChange:F=>C({autogenerate_enabled:F}),"aria-label":"Enable automation for brand",className:"data-[state=checked]:bg-green-500 data-[state=checked]:hover:bg-green-600",disabled:S}),n.jsx("span",{className:"font-medium text-gray-700",children:_!=null&&_.autogenerate_enabled?"Enabled":"Disabled"})]})]})})]}),(a==null?void 0:a.id)&&n.jsx("div",{className:"space-y-4",children:n.jsx(iae,{brandId:a.id})})]}),n.jsx(Ct,{value:"calendar",className:"space-y-6",children:h?n.jsx("div",{className:"flex items-center justify-center py-12",children:n.jsx(kt,{className:"h-8 w-8 animate-spin text-blue-600"})}):n.jsxs("div",{className:"relative overflow-hidden bg-white/60 backdrop-blur-sm rounded-xl border border-white/50 shadow-sm",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-blue-50/20 via-trans
2070parent to-purple-50/20"}),n.jsx("div",{className:"relative",children:n.jsx(uie,{contents:d,currentMonth:p,onCurrentMonthChange:A,dateType:v,onDateTypeChange:x,dragOverDay:E.dragOverDay,onDragStart:E.handleDragStart,onDragEnd:E.handleDragEnd,onDragOver:E.handleDragOver,onDragLeave:E.handleDragLeave,onDrop:E.handleDrop,isContentDraggable:E.isContentDraggable,onViewEdit:B,onPlatformIconClick:L,formatDateInUserTimezone:l})})]})}),n.jsx(Ct,{value:"notifications",className:"space-y-6",children:n.jsxs(Te,{children:[n.jsxs(st,{children:[n.jsx(ot,{children:"Notification Preferences"}),n.jsxs(Wr,{children:["Manage your email notification preferences for ",(a==null?void 0:a.brand_name)||"this brand"]})]}),n.jsx(Re,{children:a!=null&&a.id?n.jsx(Ygt,{brandId:a.id}):n.jsxs(Ar,{children:[n.jsx(qi,{className:"h-4 w-4"}),n.jsx(gr,{children:"Please select a brand to manage notification preferences."})]})})]})})]})]})]})};async function T4(){const{data:{session:e}}=await de.auth.getSession();return{"Content-Type":"application/json",Authorization:`Bearer ${e==null?void 0:e.access_token}`}}function Xgt(e){const[t,r]=g.useState(null),[s,a]=g.useState([]),[i,o]=g.useState(!1),[l,c]=g.useState(!1),[d,u]=g.useState(!1),[h,m]=g.useState(null),f=Xf(),p=g.useCallback(async()=>{if(e){u(!0),m(null);try{const j=await T4(),_=await(await fetch(`${f}/rainfactory/content-functions/get-cross-link-report`,{method:"POST",headers:j,body:JSON.stringify({brand_id:e})})).json();_.success&&_.data?(r(_.data.report),a(_.data.opportunities||[])):(r(null),a([]))}catch(j){console.error("Error fetching cross-link report:",j),m("Failed to fetch report")}finally{u(!1)}}},[e,f]),A=g.useCallback(async j=>{if(e){o(!0),m(null);try{const N=await T4(),S=await(await fetch(`${f}/rainfactory/content-functions/generate-cross-link-report`,{method:"POST",headers:N,body:JSON.stringify({brand_id:e,keywords_override:j==null?void 0:j.keywordsOverride,max_posts:j==null?void 0:j.maxPosts,max_opportunities:j==null?void 0:j.maxOpportunities,max_pairs_to_llm:j==null?void 0:j.maxPairsToLLM})})).json();S.success?await p():m(S.error||"Failed to generate report")}catch(N){console.error("Error generating cross-link report:",N),m("Failed to generate report")}finally{o(!1)}}},[e,f,p]),v=g.useCallback(async(j,N)=>{try{const{error:_}=await de.from("cross_link_opportunities").update({status:N}).eq("id",j);if(_)throw _;if(a(S=>S.map(C=>C.id===j?{...C,status:N}:C)),t){const S=s.filter(C=>C.id===j?N==="APPROVED":C.status==="APPROVED").length;r(C=>C?{...C,approved_count:S}:null)}}catch(_){console.error("Error updating opportunity status:",_),m("Failed to update opportunity")}},[s,t]),x=g.useCallback(async j=>{await v(j,"APPROVED")},[v]),b=g.useCallback(async j=>{await v(j,"REJECTED")},[v]),y=g.useCallback(async(j,N)=>{try{const{error:_}=await de.from("cross_link_opportunities").update({status:N}).in("id",j);if(_)throw _;a(S=>S.map(C=>j.includes(C.id)?{...C,status:N}:C))}catch(_){console.error("Error bulk updating opportunities:",_),m("Failed to update opportunities")}},[]),w=g.useCallback(async(j=!1)=>{if(!t)return null;c(!0),m(null);try{const N=await T4(),S=await(await fetch(`${f}/rainfactory/content-functions/apply-cross-links`,{method:"POST",headers:N,body:JSON.stringify({report_id:t.id,dry_run:j,batch_size:5})})).json();return S.success&&S.data?(j||await p(),S.data):(m(S.error||"Failed to apply cross-links"),null)}catch(N){return console.error("Error applying cross-links:",N),m("Failed to apply cross-links"),null}finally{c(!1)}},[t,f,p]);return{report:t,opportunities:s,isGenerating:i,isApplying:l,isLoading:d,error:h,fetchReport:p,generateReport:A,approveOpportunity:x,rejectOpportunity:b,bulkUpdateStatus:y,applyApproved:w}}function Zgt(e){return e>=.7?"bg-green-100 text-green-800":e>=.4?"bg-yellow-100 text-yellow-800":"bg-red-100 text-red-800"}function e0t(e){switch(e){case"PENDING":return n.jsx(Be,{variant:"secondary",children:"Pending"});case"APPROVED":return n.jsx(Be,{className:"bg-blue-100 text-blue-800",children:"Approved"});case"REJECTED":return n.jsx(Be,{variant:"destructive",children:"Rejected"});case"APPLIED":return n.jsx(Be,{className:"bg-green-100 text-green-800",children:"Applied"});case"SKIPPED":return n.jsx(Be,{variant:"outline",children:"Skipped"});default:return n.jsx(Be,{variant:"outline",children:e})}}function t0t(){const{selectedBrand:e}=mn(),t=e==null?void 0:e.id,{report:r,opportunities:s,isGenerating:a,isApplying:i,isLoading:o,error:l,fetchReport:c,generateReport:d,approveOpportunity:u,rejectOpportunity:h,bulkUpdateStatus:m,applyApproved:f}=Xgt(t),[p,A]=g.useState([{id:"relevance_score",desc:!0}]),[v,x]=g.useState({}),[b,y]=g.useState(new Set),[w,j]=g.useState(!1);g.useEffect(()=>{t&&c()},[t,c]);const N=T=>{y(B=>{const L=new Set(B);return L.has(T)?L.delete(T):L.add(T),L})},_=g.useMemo(()=>[{id:"select",header:({table:T})=>n.jsx(Xo,{checked:T.getIsAllPageRowsSelected(),onCheckedChange:B=>T.toggleAllPageRowsSelected(!!B),"aria-label":"Select all"}),cell:({row:T})=>n.jsx(Xo,{checked:T.getIsSelected(),onCheckedChange:B=>T.toggleSelected(!!B),"aria-label":"Select row"}),enableSorting:!1},{accessorKey:"source_url",header:"Source Post",cell:({row:T})=>{const B=T.original.source_url,L=(B==null?void 0:B.split("/").pop())||"Source Post";return n.jsx("a",{href:B,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:underline text-sm max-w-[200px] truncate block",title:B,children:L})}},{accessorKey:"target_url",header:"Target Post",cell:({row:T})=>{const B=T.original.target_url,L=(B==null?void 0:B.split("/").pop())||"Target Post";return n.jsx("a",{href:B,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:underline text-sm max-w-[200px] truncate block",title:B,children:L})}},{accessorKey:"anchor_text",header:"Anchor Text",cell:({row:T})=>n.jsxs("span",{className:"text-sm font-medium text-gray-700 max-w-[180px] truncate block",title:T.original.anchor_text,children:['"',T.original.anchor_text,'"']})},{accessorKey:"relevance_score",header:"Score",cell:({row:T})=>{const B=Number(T.original.relevance_score);return n.jsx("span",{className:`px-2 py-1 rounded text-xs font-medium ${Zgt(B)}`,children:B.toFixed(2)})}},{accessorKey:"status",header:"Status",cell:({row:T})=>e0t(T.original.status)},{id:"expand",header:"",cell:({row:T})=>n.jsx(te,{variant:"ghost",size:"sm",onClick:()=>N(T.original.id),children:b.has(T.original.id)?n.jsx(Fu,{className:"h-4 w-4"}):n.jsx(Un,{className:"h-4 w-4"})})},{id:"actions",header:"Actions",cell:({row:T})=>{const B=T.original;return B.status==="APPLIED"||B.status==="SKIPPED"?null:n.jsxs("div",{className:"flex gap-1",children:[n.jsx(te,{variant:"ghost",size:"sm",onClick:()=>u(B.id),disabled:B.status==="APPROVED",className:"text-green-600 hover:text-green-700",children:n.jsx(Gn,{className:"h-4 w-4"})}),n.jsx(te,{variant:"ghost",size:"sm",onClick:()=>h(B.id),disabled:B.status==="REJECTED",className:"text-red-600 hover:text-red-700",children:n.jsx(kr,{className:"h-4 w-4"})})]})}}],[b,u,h]),S=NL({data:s,columns:_,getCoreRowModel:wL(),getSortedRowModel:jL(),state:{sorting:p,rowSelection:v},onSortingChange:A,onRowSelectionChange:x,enableRowSelection:!0}
2070),C=Object.keys(v).filter(T=>v[T]).map(T=>{var B;return(B=s[parseInt(T)])==null?void 0:B.id}).filter(Boolean),E=s.filter(T=>T.status==="APPROVED").length;return e?n.jsxs("div",{className:"container mx-auto p-6 space-y-6",children:[n.jsx("div",{className:"bg-gradient-to-r from-blue-600 to-indigo-600 rounded-2xl p-6 text-white",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(QR,{className:"h-8 w-8"}),n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-bold",children:"Cross-Linking"}),n.jsx("p",{className:"text-blue-100",children:"Discover and apply internal links between your blog posts"})]})]}),n.jsx(te,{onClick:()=>d(),disabled:a,className:"bg-white text-blue-600 hover:bg-blue-50",children:a?n.jsxs(n.Fragment,{children:[n.jsx(Es,{className:"h-4 w-4 mr-2 animate-spin"}),"Generating..."]}):n.jsxs(n.Fragment,{children:[n.jsx(ho,{className:"h-4 w-4 mr-2"}),"Generate Report"]})})]})}),l&&n.jsx("div",{className:"bg-red-50 border border-red-200 rounded-lg p-4 text-red-700",children:l}),r&&n.jsx("div",{className:"bg-white rounded-2xl border p-6 backdrop-blur-sm",children:n.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-4",children:[n.jsxs("div",{children:[n.jsx("p",{className:"text-sm text-gray-500",children:"Status"}),n.jsx("p",{className:"font-semibold",children:r.status})]}),n.jsxs("div",{children:[n.jsx("p",{className:"text-sm text-gray-500",children:"Opportunities"}),n.jsx("p",{className:"font-semibold",children:r.total_opportunities})]}),n.jsxs("div",{children:[n.jsx("p",{className:"text-sm text-gray-500",children:"Approved"}),n.jsx("p",{className:"font-semibold",children:r.approved_count})]}),n.jsxs("div",{children:[n.jsx("p",{className:"text-sm text-gray-500",children:"Applied"}),n.jsx("p",{className:"font-semibold",children:r.applied_count})]}),n.jsxs("div",{children:[n.jsx("p",{className:"text-sm text-gray-500",children:"Generated"}),n.jsx("p",{className:"font-semibold text-sm",children:new Date(r.created_at).toLocaleDateString()})]})]})}),(C.length>0||E>0)&&n.jsxs("div",{className:"bg-white rounded-xl border p-4 flex items-center gap-3 flex-wrap",children:[C.length>0&&n.jsxs(n.Fragment,{children:[n.jsxs("span",{className:"text-sm text-gray-600",children:[C.length," selected"]}),n.jsxs(te,{size:"sm",variant:"outline",onClick:()=>m(C,"APPROVED"),className:"text-green-600",children:[n.jsx(Gn,{className:"h-4 w-4 mr-1"}),"Approve Selected"]}),n.jsxs(te,{size:"sm",variant:"outline",onClick:()=>m(C,"REJECTED"),className:"text-red-600",children:[n.jsx(kr,{className:"h-4 w-4 mr-1"}),"Reject Selected"]}),n.jsx("div",{className:"w-px h-6 bg-gray-300"})]}),E>0&&n.jsxs(n.Fragment,{children:[n.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[n.jsx(Xo,{checked:w,onCheckedChange:T=>j(!!T)}),"Dry Run"]}),n.jsx(te,{size:"sm",onClick:()=>f(w),disabled:i,className:"bg-blue-600 text-white hover:bg-blue-700",children:i?n.jsxs(n.Fragment,{children:[n.jsx(Es,{className:"h-4 w-4 mr-1 animate-spin"}),"Applying..."]}):n.jsxs(n.Fragment,{children:[n.jsx(ho,{className:"h-4 w-4 mr-1"}),"Apply ",E," Approved Link",E!==1?"s":""]})})]})]}),o?n.jsx("div",{className:"bg-white rounded-2xl border p-12 text-center text-gray-500",children:"Loading..."}):s.length===0?n.jsxs("div",{className:"bg-white rounded-2xl border p-12 text-center text-gray-500",children:[n.jsx(QR,{className:"h-12 w-12 mx-auto mb-4 text-gray-300"}),n.jsx("p",{className:"text-lg font-medium",children:"No cross-linking opportunities yet"}),n.jsx("p",{className:"text-sm mt-1",children:"Generate a report to discover linking opportunities"})]}):n.jsx("div",{className:"bg-white rounded-2xl border overflow-hidden",children:n.jsxs(po,{children:[n.jsx(Ao,{children:S.getHeaderGroups().map(T=>n.jsx(Yr,{children:T.headers.map(B=>n.jsx($t,{className:"cursor-pointer select-none",onClick:B.column.getToggleSortingHandler(),children:Yg(B.column.columnDef.header,B.getContext())},B.id))},T.id))}),n.jsx(go,{children:S.getRowModel().rows.map(T=>{var B;return n.jsxs(n.Fragment,{children:[n.jsx(Yr,{children:T.getVisibleCells().map(L=>n.jsx(mt,{children:Yg(L.column.columnDef.cell,L.getContext())},L.id))},T.id),b.has(T.original.id)&&n.jsx(Yr,{children:n.jsx(mt,{colSpan:_.length,className:"bg-gray-50 p-4",children:n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{children:[n.jsx("span",{className:"font-medium text-sm text-gray-600",children:"Reasoning:"}),n.jsx("p",{className:"text-sm text-gray-800 mt-1",children:T.original.reasoning})]}),T.original.suggested_insertion_context&&n.jsxs("div",{children:[n.jsx("span",{className:"font-medium text-sm text-gray-600",children:"Insertion Context:"}),n.jsxs("p",{className:"text-sm text-gray-800 mt-1 italic",children:['"',T.original.suggested_insertion_context,'"']})]}),n.jsxs("div",{className:"flex gap-4 text-xs text-gray-500",children:[n.jsxs("span",{children:["Section Index: ",T.original.suggested_section_index]}),((B=T.original.metadata)==null?void 0:B.algorithmic_score)&&n.jsxs("span",{children:["Algorithmic Score: ",T.original.metadata.algorithmic_score.toFixed(2)]})]})]})})},`${T.id}-expanded`)]})})})]})})]}):n.jsx(ep,{})}
2070const r0t=["id","name","trend","trend_analysis","virality_score","virality_explanation","primary_keyword","longevity_in_days","enrichment_status","comparable_trends","business_opportunities_analysis","related_news_and_data","authoritative_urls","created_at"].join(", ");function n0t(e){const[t,r]=g.useState([]),[s,a]=g.useState(0),[i,o]=g.useState(!1),[l,c]=g.useState(null),d=g.useCallback(async()=>{o(!0),c(null);try{const{search:u,viralityMin:h,viralityMax:m,enrichmentStatus:f,dateFrom:p,dateTo:A,sortField:v,sortDir:x,page:b,pageSize:y}=e;let w=de.from("news_contents").select(r0t,{count:"exact"});if(u.trim()){const E=`%${u.trim()}%`;w=w.or(`name.ilike.${E},trend.ilike.${E},primary_keyword.ilike.${E}`)}if(h>0&&(w=w.gte("virality_score",h)),m<10&&(w=w.lte("virality_score",m)),f&&f!=="all"&&(w=w.eq("enrichment_status",f)),p&&(w=w.gte("created_at",p)),A){const E=new Date(A);E.setDate(E.getDate()+1),w=w.lt("created_at",E.toISOString())}w=w.order(v,{ascending:x==="asc"});const j=b*y,N=j+y-1;w=w.range(j,N);const{data:_,error:S,count:C}=await w;if(S)throw S;r(_||[]),a(C||0)}catch(u){console.error("[useTrends] Error fetching trends:",u),c(u instanceof Error?u.message:"Failed to fetch trends"),r([]),a(0)}finally{o(!1)}},[e.search,e.viralityMin,e.viralityMax,e.enrichmentStatus,e.dateFrom,e.dateTo,e.sortField,e.sortDir,e.page,e.pageSize]);return g.useEffect(()=>{d()},[d]),{trends:t,totalCount:s,isLoading:i,error:l,refetch:d}}async function s0t(){const{data:{session:e}}=await de.auth.getSession();return{"Content-Type":"application/json",Authorization:`Bearer ${e==null?void 0:e.access_token}`}}function a0t(){const[e,t]=g.useState(!1),[r,s]=g.useState(null),[a,i]=g.useState(null),o=g.useCallback(async(c,d)=>{var u;if(d.length!==0){t(!0),i(null),s(null);try{const h=Xf(),m=await s0t(),f=await fetch(`${h}/rainfactory/trend-navigator/${c}`,{method:"POST",headers:m,body:JSON.stringify({trendIds:d})});if(!f.ok){const A=await f.text();throw new Error(`Analysis failed (${f.status}): ${A}`)}const p=await f.json();if(p.success&&((u=p.data)!=null&&u.analysis))s(p.data.analysis);else{if(p.error)throw new Error(p.error);s(JSON.stringify(p,null,2))}}catch(h){console.error("[useTrendAnalysis] Error running analysis:",h),i(h instanceof Error?h.message:"Analysis failed")}finally{t(!1)}}},[]),l=g.useCallback(()=>{s(null),i(null)},[]);return{analyze:o,isAnalyzing:e,result:r,error:a,clearResult:l}}function i0t(e){if(!e)return"_None_";if(Array.isArray(e)){const t=e.filter(r=>typeof r=="string"&&r.trim()!=="").map(r=>`- [${r}](${r})`);return t.length>0?t.join(`
2071`):"_None_"}return typeof e=="string"&&e.trim()?`- [${e}](${e})`:`\`\`\`json
2072${JSON.stringify(e,null,2)}
2073\`\`\``}function o0t(e){return e?typeof e=="string"&&e.trim()?e:typeof e=="object"?`\`\`\`json
2074${JSON.stringify(e,null,2)}
2075\`\`\``:String(e):"_None_"}function l0t(e){const t=new Date(e.created_at).toISOString().slice(0,10),r=e.virality_score!==null?`${e.virality_score}/10${e.virality_explanation?` — ${e.virality_explanation}`:""}`:"_Not scored_",s=[`## ${e.name}`,"",`**Date:** ${t}`,`**Virality Score:** ${r}`,`**Longevity:** ${e.longevity_in_days!==null?`${e.longevity_in_days} days`:"_Unknown_"}`,`**Primary Keyword:** ${e.primary_keyword||"_None_"}`,`**Enrichment Status:** ${e.enrichment_status||"_Unknown_"}`,""];return e.trend&&s.push("### Trend Description","",e.trend,""),e.trend_analysis&&s.push("### Trend Analysis","",e.trend_analysis,""),e.business_opportunities_anal
2075ysis&&s.push("### Business Opportunities","",e.business_opportunities_analysis,""),e.comparable_trends&&s.push("### Comparable Trends","",e.comparable_trends,""),s.push("### Related News & Data","",o0t(e.related_news_and_data),"","### Authoritative URLs","",i0t(e.authoritative_urls),"","---",""),s.join(`
2076`)}function c0t(e){if(e.length===0)return;const t=new Date().toISOString().slice(0,10),r=`# Trend Export — ${t}
2077
2078_Exported ${e.length} trend${e.length!==1?"s":""}_
2079
2080---
2081
2082`,s=e.map(l0t).join(`
2083`),a=r+s,i=new Blob([a],{type:"text/markdown;charset=utf-8"}),o=URL.createObjectURL(i),l=document.createElement("a");l.href=o,l.download=`trend-export-${t}.md`,document.body.appendChild(l),l.click(),document.body.removeChild(l),setTimeout(()=>URL.revokeObjectURL(o),1e3)}const d0t=[{value:"all",label:"All Statuses"},{value:"NONE",label:"None"},{value:"IN_PROGRESS",label:"In Progress"},{value:"COMPLETED",label:"Completed"},{value:"FAILED",label:"Failed"}];function u0t({filters:e,onFiltersChange:t,onClearFilters:r}){function s(a,i){t({...e,[a]:i})}return n.jsxs("div",{className:"bg-white rounded-xl border p-3 flex flex-wrap gap-3 items-end",children:[n.jsxs("div",{className:"flex flex-col gap-1 min-w-[180px] flex-1",children:[n.jsx(ze,{className:"text-xs text-gray-500",children:"Search"}),n.jsx(qe,{type:"text",placeholder:"Name, trend, or keyword...",value:e.search,onChange:a=>s("search",a.target.value),className:"h-8 text-sm"})]}),n.jsxs("div",{className:"flex flex-col gap-1 w-[90px]",children:[n.jsx(ze,{className:"text-xs text-gray-500",children:"Virality Min"}),n.jsx(qe,{type:"number",min:0,max:10,step:1,value:e.viralityMin,onChange:a=>s("viralityMin",Number(a.target.value)),className:"h-8 text-sm"})]}),n.jsxs("div",{className:"flex flex-col gap-1 w-[90px]",children:[n.jsx(ze,{className:"text-xs text-gray-500",children:"Virality Max"}),n.jsx(qe,{type:"number",min:0,max:10,step:1,value:e.viralityMax,onChange:a=>s("viralityMax",Number(a.target.value)),className:"h-8 text-sm"})]}),n.jsxs("div",{className:"flex flex-col gap-1 w-[150px]",children:[n.jsx(ze,{className:"text-xs text-gray-500",children:"Status"}),n.jsxs(ur,{value:e.enrichmentStatus,onValueChange:a=>s("enrichmentStatus",a),children:[n.jsx(or,{className:"h-8 text-sm",children:n.jsx(hr,{placeholder:"All Statuses"})}),n.jsx(lr,{children:d0t.map(a=>n.jsx(Fe,{value:a.value,children:a.label},a.value))})]})]}),n.jsxs("div",{className:"flex flex-col gap-1 w-[140px]",children:[n.jsx(ze,{className:"text-xs text-gray-500",children:"From Date"}),n.jsx(qe,{type:"date",value:e.dateFrom,onChange:a=>s("dateFrom",a.target.value),className:"h-8 text-sm"})]}),n.jsxs("div",{className:"flex flex-col gap-1 w-[140px]",children:[n.jsx(ze,{className:"text-xs text-gray-500",children:"To Date"}),n.jsx(qe,{type:"date",value:e.dateTo,onChange:a=>s("dateTo",a.target.value),className:"h-8 text-sm"})]}),n.jsxs(te,{variant:"ghost",size:"sm",onClick:r,className:"h-8 text-xs text-gray-500 hover:text-gray-700 gap-1",children:[n.jsx(kr,{className:"h-3 w-3"}),"Clear"]})]})}function h0t(e,t){const r={};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const f0t=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,m0t=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,p0t={};function IV(e,t){return(p0t.jsx?m0t:f0t).test(e)}const A0t=/[ \t\n\f\r]/g;function g0t(e){return typeof e=="object"?e.type==="text"?OV(e.value):!1:OV(e)}function OV(e){return e.replace(A0t,"")===""}class iw{constructor(t,r,s){this.normal=r,this.property=t,s&&(this.space=s)}}iw.prototype.normal={};iw.prototype.property={};iw.prototype.space=void 0;function qle(e,t){const r={},s={};for(const a of e)Object.assign(r,a.property),Object.assign(s,a.normal);return new iw(r,s,t)}function eI(e){return e.toLowerCase()}class wo{constructor(t,r){this.attribute=r,this.property=t}}wo.prototype.attribute="";wo.prototype.booleanish=!1;wo.prototype.boolean=!1;wo.prototype.commaOrSpaceSeparated=!1;wo.prototype.commaSeparated=!1;wo.prototype.defined=!1;wo.prototype.mustUseProperty=!1;wo.prototype.number=!1;wo.prototype.overloadedBoolean=!1;wo.prototype.property="";wo.prototype.spaceSeparated=!1;wo.prototype.space=void 0;let x0t=0;
vendor: 4,646 bytes, line 2083
2083const Mr=hp(),fa=hp(),tI=hp(),ct=hp(),es=hp(),qA=hp(),Fo=hp();function hp(){return 2**++x0t}const rI=Object.freeze(Object.defineProperty({__proto__:null,boolean:Mr,booleanish:fa,commaOrSpaceSeparated:Fo,commaSeparated:qA,number:ct,overloadedBoolean:tI,spaceSeparated:es},Symbol.toStringTag,{value:"Module"})),P4=Object.keys(rI);class PL extends wo{constructor(t,r,s,a){let i=-1;if(super(t,r),FV(this,"space",a),typeof s=="number")for(;++i<P4.length;){const o=P4[i];FV(this,P4[i],(s&rI[o])===rI[o])}}}PL.prototype.defined=!0;function FV(e,t,r){r&&(e[t]=r)}function I0(e){const t={},r={};for(const[s,a]of Object.entries(e.properties)){const i=new PL(s,e.transform(e.attributes||{},s),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(i.mustUseProperty=!0),t[s]=i,r[eI(s)]=s,r[eI(i.attribute)]=s}return new iw(t,r,e.space)}const Kle=I0({properties:{ariaActiveDescendant:null,ariaAtomic:fa,ariaAutoComplete:null,ariaBusy:fa,ariaChecked:fa,ariaColCount:ct,ariaColIndex:ct,ariaColSpan:ct,ariaControls:es,ariaCurrent:null,ariaDescribedBy:es,ariaDetails:null,ariaDisabled:fa,ariaDropEffect:es,ariaErrorMessage:null,ariaExpanded:fa,ariaFlowTo:es,ariaGrabbed:fa,ariaHasPopup:null,ariaHidden:fa,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:es,ariaLevel:ct,ariaLive:null,ariaModal:fa,ariaMultiLine:fa,ariaMultiSelectable:fa,ariaOrientation:null,ariaOwns:es,ariaPlaceholder:null,ariaPosInSet:ct,ariaPressed:fa,ariaReadOnly:fa,ariaRelevant:null,ariaRequired:fa,ariaRoleDescription:es,ariaRowCount:ct,ariaRowIndex:ct,ariaRowSpan:ct,ariaSelected:fa,ariaSetSize:ct,ariaSort:null,ariaValueMax:ct,ariaValueMin:ct,ariaValueNow:ct,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Wle(e,t){return t in e?e[t]:t}function Yle(e,t){return Wle(e,t.toLowerCase())}const v0t=I0({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:qA,acceptCharset:es,accessKey:es,action:null,allow:null,allowFullScreen:Mr,allowPaymentRequest:Mr,allowUserMedia:Mr,alt:null,as:null,async:Mr,autoCapitalize:null,autoComplete:es,autoFocus:Mr,autoPlay:Mr,blocking:es,capture:null,charSet:null,checked:Mr,cite:null,className:es,cols:ct,colSpan:null,content:null,contentEditable:fa,controls:Mr,controlsList:es,coords:ct|qA,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Mr,defer:Mr,dir:null,dirName:null,disabled:Mr,download:tI,draggable:fa,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Mr,formTarget:null,headers:es,height:ct,hidden:tI,high:ct,href:null,hrefLang:null,htmlFor:es,httpEquiv:es,id:null,imageSizes:null,imageSrcSet:null,inert:Mr,inputMode:null,integrity:null,is:null,isMap:Mr,itemId:null,itemProp:es,itemRef:es,itemScope:Mr,itemType:es,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Mr,low:ct,manifest:null,max:null,maxLength:ct,media:null,method:null,min:null,minLength:ct,multiple:Mr,muted:Mr,name:null,nonce:null,noModule:Mr,noValidate:Mr,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Mr,optimum:ct,pattern:null,ping:es,placeholder:null,playsInl
2083ine:Mr,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Mr,referrerPolicy:null,rel:es,required:Mr,reversed:Mr,rows:ct,rowSpan:ct,sandbox:es,scope:null,scoped:Mr,seamless:Mr,selected:Mr,shadowRootClonable:Mr,shadowRootDelegatesFocus:Mr,shadowRootMode:null,shape:null,size:ct,sizes:null,slot:null,span:ct,spellCheck:fa,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ct,step:null,style:null,tabIndex:ct,target:null,title:null,translate:null,type:null,typeMustMatch:Mr,useMap:null,value:fa,width:ct,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:es,axis:null,background:null,bgColor:null,border:ct,borderColor:null,bottomMargin:ct,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Mr,declare:Mr,event:null,face:null,frame:null,frameBorder:null,hSpace:ct,leftMargin:ct,link:null,longDesc:null,lowSrc:null,marginHeight:ct,marginWidth:ct,noResize:Mr,noHref:Mr,noShade:Mr,noWrap:Mr,object:null,profile:null,prompt:null,rev:null,rightMargin:ct,rules:null,scheme:null,scrolling:fa,standby:null,summary:null,text:null,topMargin:ct,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ct,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Mr,disableRemotePlayback:Mr,prefix:null,property:null,results:ct,security:null,unselectable:null},space:"html",transform:Yle}),b0t=I0({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav
2083-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Fo,accentHeight:ct,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ct,amplitude:ct,arabicForm:null,ascent:ct,attributeName:null,attributeType:null,azimuth:ct,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ct,by:null,calcMode:null,capHeight:ct,className:es,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:ct,diffuseConstant:ct,direction:null,display:null,dur:null,divisor:ct,dominantBaseline:null,download:Mr,dx:null,dy:null,edgeMode:null,editable:null,elevation:ct,enableBackground:null,end:null,event:null,exponent:ct,externalResourcesRequired:null,fill:null,fillOpacity:ct,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:qA,g2:qA,glyphName:qA,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ct,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ct,horizOriginX:ct,horizOriginY:ct,id:null,ideographic:ct,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ct,k:ct,k1:ct,k2:ct,k3:ct,k4:ct,kernelMatrix:Fo,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ct,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ct,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,on
vendor: 5,355 bytes, lines 2083-2084
2083Zoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:ct,overlineThickness:ct,paintOrder:null,panose1:null,path:null,pathLength:ct,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:es,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ct,pointsAtY:ct,pointsAtZ:ct,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Fo,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Fo,rev:Fo,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Fo,requiredFeatures:Fo,requiredFonts:Fo,requiredFormats:Fo,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:ct,specularExponent:ct,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ct,strikethroughThickness:ct,string:null,stroke:null,strokeDashArray:Fo,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ct,strokeOpacity:ct,strokeWidth:null,style:null,surfaceScale:ct,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Fo,tabIndex:ct,tableValues:null,target:null,targetX:ct,targetY:ct,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Fo,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ct,underlineThickness:ct,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ct,values:null,vAlphabetic:ct,vMathematical:ct,vectorEffect:null,vHanging:ct,vIdeographic:ct,version:null,vertAdvY:ct,vertOriginX:ct,vertOriginY:ct,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ct,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Wle}),Jle=I0({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),Xle=I0({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Yle}),Zle=I0({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),y0t={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},w0t=/[A-Z]/g,LV=/-[a-z]/g,j0t=/^data[-\w.:]+$/i;function N0t(e,t){const r=eI(t);let s=t,a=wo;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&j0t.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(LV,C0t);s="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!LV.test(i)){let o=i.replace(w0t,_0t);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}a=PL}return new a(s,t)}function _0t(e){return"-"+e.toLowerCase()}function C0t(e){return e.charAt(1).toUpperCase()}const S0t=qle([Kle,v0t,Jle,Xle,Zle],"html"),IL=qle([Kle,b0t,Jle,Xle,Zle],"svg");function k0t(e){return e.join(" ").trim()}var OL={},DV=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,E0t=/\n/g,B0t=/^\s*/,T0t=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,P0t=/^:\s*/,I0t=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,O0t=/^[;\s]*/,F0t=/^\s+|\s+$/g,L0t=`
2084`,RV="/",UV="*",am="",D0t="comment",R0t="declaration";function U0t(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var r=1,s=1;function a(p){var A=p.match(E0t);A&&(r+=A.length);var v=p.lastIndexOf(L0t);s=~v?p.length-v:s+p.length}function i(){var p={line:r,column:s};return function(A){return A.position=new o(p),d(),A}}function o(p){this.start=p,this.end={line:r,column:s},this.source=t.source}o.prototype.content=e;function l(p){var A=new Error(t.source+":"+r+":"+s+": "+p);if(A.reason=p,A.filename=t.source,A.line=r,A.column=s,A.source=e,!t.silent)throw A}function c(p){var A=p.exec(e);if(A){var v=A[0];return a(v),e=e.slice(v.length),A}}function d(){c(B0t)}function u(p){var A;for(p=p||[];A=h();)A!==!1&&p.push(A);return p}function h(){var p=i();if(!(RV!=e.charAt(0)||UV!=e.charAt(1))){for(var A=2;am!=e.charAt(A)&&(UV!=e.charAt(A)||RV!=e.charAt(A+1));)++A;if(A+=2,am===e.charAt(A-1))return l("End of comment missing");var v=e.slice(2,A-2);return s+=2,a(v),e=e.slice(A),s+=2,p({type:D0t,comment:v})}}function m(){var p=i(),A=c(T0t);if(A){if(h(),!c(P0t))return l("property missing ':'");var v=c(I0t),x=p({type:R0t,property:MV(A[0].replace(DV,am)),value:v?MV(v[0].replace(DV,am)):am});return c(O0t),x}}function f(){var p=[];u(p);for(var A;A=m();)A!==!1&&(p.push(A),u(p));return p}return d(),f()}function MV(e){return e?e.replace(F0t,am):am}var M0t=U0t,$0t=Nh&&Nh.__importDefault||function(e){return e&&e.__esMo
vendor: 3,685 bytes, line 2084
2084dule?e:{default:e}};Object.defineProperty(OL,"__esModule",{value:!0});OL.default=H0t;const Q0t=$0t(M0t);function H0t(e,t){let r=null;if(!e||typeof e!="string")return r;const s=(0,Q0t.default)(e),a=typeof t=="function";return s.forEach(i=>{if(i.type!=="declaration")return;const{property:o,value:l}=i;a?t(o,l,i):l&&(r=r||{},r[o]=l)}),r}var _k={};Object.defineProperty(_k,"__esModule",{value:!0});_k.camelCase=void 0;var z0t=/^--[a-zA-Z0-9_-]+$/,V0t=/-([a-z])/g,G0t=/^[^-]+$/,q0t=/^-(webkit|moz|ms|o|khtml)-/,K0t=/^-(ms)-/,W0t=function(e){return!e||G0t.test(e)||z0t.test(e)},Y0t=function(e,t){return t.toUpperCase()},$V=function(e,t){return"".concat(t,"-")},J0t=function(e,t){return t===void 0&&(t={}),W0t(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(K0t,$V):e=e.replace(q0t,$V),e.replace(V0t,Y0t))};_k.camelCase=J0t;var X0t=Nh&&Nh.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},Z0t=X0t(OL),ext=_k;function nI(e,t){var r={};return!e||typeof e!="string"||(0,Z0t.default)(e,function(s,a){s&&a&&(r[(0,ext.camelCase)(s,t)]=a)}),r}nI.default=nI;var txt=nI;const rxt=wn(txt),ece=tce("end"),FL=tce("start");function tce(e){return t;function t(r){const s=r&&r.position&&r.position[e]||{};if(typeof s.line=="number"&&s.line>0&&typeof s.column=="number"&&s.column>0)return{line:s.line,column:s.column,offset:typeof s.offset=="number"&&s.offset>-1?s.offset:void 0}}}function nxt(e){const t=FL(e),r=ece(e);if(t&&r)return{start:t,end:r}}function Uv(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?QV(e.position):"start"in e||"end"in e?QV(e):"line"in e||"column"in e?sI(e):""}function sI(e){return HV(e&&e.line)+":"+HV(e&&e.column)}function QV(e){return sI(e&&e.start)+"-"+sI(e&&e.end)}function HV(e){return e&&typeof e=="number"?e:1}class Ti extends Error{constructor(t,r,s){super(),typeof r=="string"&&(s=r,r=void 0);let a="",i={},o=!1;if(r&&("line"in r&&"column"in r?i={place:r}:"start"in r&&"end"in r?i={place:r}:"type"in r?i={ancestors:[r],place:r.position}:i={...r}),typeof t=="string"?a=t:!i.cause&&t&&(o=!0,a=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof s=="string"){const c=s.indexOf(":");c===-1?i.ruleId=s:(i.source=s.slice(0,c),i.ruleId=s.slice(c+1))}if(!i.place&&i.ancestors&&i.ancestors){const c=i.ancestors[i.ancestors.length-1];c&&(i.place=c.position)}const l=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=a,this.line=l?l.line:void 0,this.name=Uv(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=o&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Ti.prototype.file="";Ti.prototype.name="";Ti.prototype.reason="";Ti.prototype.message="";Ti.prototype.stack="";Ti.prototype.column=void 0;Ti.prototype.line=void 0;Ti.prototype.ancestors=void 0;Ti.prototype.cause=void 0;Ti.prototype.fatal=void 0;Ti.prototype.place=void 0;Ti.prototype.ruleId=void 0;Ti.prototype.source=void 0;const LL={}.hasOwnProperty,sxt=new Map,axt=/[A-Z]/g,ixt=new Set(["table","tbody","thead","tfoot","tr"]),oxt=new Set(["td","th"]),rce="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function lxt(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=t.filePath||void 0;let s;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");s=Axt(r,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");
vendor: 10,606 bytes, line 2084
2084if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");s=pxt(r,t.jsx,t.jsxs)}const a={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:s,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?IL:S0t,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=nce(a,e,void 0);return i&&typeof i!="string"?i:a.create(e,a.Fragment,{children:i||void 0},void 0)}function nce(e,t,r){if(t.type==="element")return cxt(e,t,r);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return dxt(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return hxt(e,t,r);if(t.type==="mdxjsEsm")return uxt(e,t);if(t.type==="root")return fxt(e,t,r);if(t.type==="text")return mxt(e,t)}function cxt(e,t,r){const s=e.schema;let a=s;t.tagName.toLowerCase()==="svg"&&s.space==="html"&&(a=IL,e.schema=a),e.ancestors.push(t);const i=ace(e,t.tagName,!1),o=gxt(e,t);let l=RL(e,t);return ixt.has(t.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!g0t(c):!0})),sce(e,o,i,t),DL(o,l),e.ancestors.pop(),e.schema=s,e.create(t,i,o,r)}function dxt(e,t){if(t.data&&t.data.estree&&e.evaluater){const s=t.data.estree.body[0];return s.type,e.evaluater.evaluateExpression(s.expression)}vy(e,t.position)}function uxt(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);vy(e,t.position)}function hxt(e,t,r){const s=e.schema;let a=s;t.name==="svg"&&s.space==="html"&&(a=IL,e.schema=a),e.ancestors.push(t);const i=t.name===null?e.Fragment:ace(e,t.name,!0),o=xxt(e,t),l=RL(e,t);return sce(e,o,i,t),DL(o,l),e.ancestors.pop(),e.schema=s,e.create(t,i,o,r)}function fxt(e,t,r){const s={};return DL(s,RL(e,t)),e.create(t,e.Fragment,s,r)}function mxt(e,t){return t.value}function sce(e,t,r,s){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(t.node=s)}function DL(e,t){if(t.length>0){const r=t.length>1?t:t[0];r&&(e.children=r)}}function pxt(e,t,r){return s;function s(a,i,o,l){const d=Array.isArray(o.children)?r:t;return l?d(i,o,l):d(i,o)}}function Axt(e,t){return r;function r(s,a,i,o){const l=Array.isArray(i.children),c=FL(s);return t(a,i,o,l,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function gxt(e,t){const r={};let s,a;for(a in t.properties)if(a!=="children"&&LL.call(t.properties,a)){const i=vxt(e,a,t.properties[a]);if(i){const[o,l]=i;e.tableCellAlignToStyle&&o==="align"&&typeof l=="string"&&oxt.has(t.tagName)?s=l:r[o]=l}}if(s){const i=r.style||(r.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return r}function xxt(e,t){const r={};for(const s of t.attributes)if(s.type==="mdxJsxExpressionAttribute")if(s.data&&s.data.estree&&e.evaluater){const i=s.data.estree.body[0];i.type;const o=i.expression;o.type;const l=o.properties[0];l.type,Object.assign(r,e.evaluater.evaluateExpression(l.argument))}else vy(e,t.position);else{const a=s.name;let i;if(s.value&&typeof s.value=="object")if(s.value.data&&s.value.data.estree&&e.evaluater){const l=s.value.data.estree.body[0];l.type,i=e.evaluater.evaluateExpression(l.expression)}else vy(e,t.position);else i=s.value===null?!0:s.value;r[a]=i}return r}function RL(e,t){const r=[];let s=-1;const a=e.passKeys?new Map:sxt;for(;++s<t.children.length;){const i=t.children[s];let o;if(e.passKeys){const c=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(c){const d=a.get(c)||0;o=c+"-"+d,a.set(c,d+1)}}const l=nce(e,i,o);l!==void 0&&r.push(l)}return r}function vxt(e,t,r){const s=N0t(e.schema,t);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=s.commaSeparated?h0t(r):k0t(r)),s.property==="style"){let a=typeof r=="object"?r:bxt(e,String(r));return e.stylePropertyNameCase==="css"&&(a=yxt(a)),["style",a]}return[e.elementAttributeNameCase==="react"&&s.space?y0t[s.property]||s.property:s.attribute,r]}}function bxt(e,t){try{return rxt(t,{reactCompat:!0})}catch(r){if(e.ignoreInvalidStyle)return{};const s=r,a=new Ti("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:s,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw a.file=e.filePath||void 0,a.url=rce+"#cannot-parse-style-attribute",a}}function ace(e,t,r){let s;if(!r)s={type:"Literal",value:t};else if(t.includes(".")){const a=t.split(".");let i=-1,o;for(;++i<a.length;){const l=IV(a[i])?{type:"Identifier",name:a[i]}:{type:"Literal",value:a[i]};o=o?{type:"MemberExpression",object:o,property:l,computed:!!(i&&l.type==="Literal"),optional:!1}:l}s=o}else s=IV(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(s.type==="Literal"){const a=s.value;return LL.call(e.components,a)?e.components[a]:a}if(e.evaluater)return e.evaluater.evaluateExpression(s);vy(e)}function vy(e,t){const r=new Ti("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=rce+"#cannot-handle-mdx-estrees-without-createevaluater",r}function yxt(e){const t={};let r;for(r in e)LL.call(e,r)&&(t[wxt(r)]=e[r]);return t}function wxt(e){let t=e.replace(axt,jxt);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function jxt(e){return"-"+e.toLowerCase()}const I4={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},Nxt={};function _xt(e,t){const r=Nxt,s=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,a=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return ice(e,s,a)}function ice(e,t,r){if(Cxt(e)){if("value"in e)return e.type==="html"&&!r?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return zV(e.children,t,r)}return Array.isArray(e)?zV(e,t,r):""}function zV(e,t,r){const s=[];let a=-1;for(;++a<e.length;)s[a]=ice(e[a],t,r);return s.join("")}function Cxt(e){return!!(e&&typeof e=="object")}const VV=document.createElement("i");function UL(e){const t="&"+e+";";VV.innerHTML=t;const r=VV.textContent;return r.charCodeAt(r.length-1)===59&&e!=="semi"||r===t?!1:r}function bd(e,t,r,s){const a=e.length;let i=0,o;if(t<0?t=-t>a?0:a+t:t=t>a?a:t,r=r>0?r:0,s.length<1e4)o=Array.from(s),o.unshift(t,r),e.splice(...o);else for(r&&e.splice(t,r);i<s.length;)o=s.slice(i,i+1e4),o.unshift(t,0),e.splice(...o),i+=1e4,t+=1e4}function Pl(e,t){return e.length>0?(bd(e,e.length,0,t),e):t}const GV={}.hasOwnProperty;function Sxt(e){const t={};let r=-1;for(;++r<e.length;)kxt(t,e[r]);return t}function kxt(e,t){let r;for(r in t){const a=(GV.call(e,r)?e[r]:void 0)||(e[r]={}),i=t[r];let o;if(i)for(o in i){GV.call(a,o)||(a[o]=[]);const l=i[o];Ext(a[o],Array.isArray(l)?l:l?[l]:[])}}}function Ext(e,t){let r=-1;const s=[];for(;++r<t.length;)(t[r].add==="after"?e:s).push(t[r]);bd(e,0,0,s)}function oce(e,t){const r=Number.parseInt(e,t);return r<9||r===11||r>13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"�":String.fromCodePoint(r)}function KA(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const td=pf(/[A-Za-z]/),Ko=pf(/[\dA-Za-z]/),Bxt=pf(/[#-'*+\--9=?A-Z^-~]/);function aI(e){return e!==null&&(e<32||e===127)}const iI=pf(/\d/),Txt=pf(/[\dA-Fa-f]/),Pxt=pf(/[!-/:-@[-`{-~]/);function Nr(e){return e!==null&&e<-2}function oo(e){return e!==null&&(e<0||e===32)}function vn(e){return e===-2||e===-1||e===32}const Ixt=pf(new RegExp("\\p{P}|\\p{S}","u")),Oxt=pf(/\s/);function pf(e){return t;function t(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function O0(e){const t=[];let r=-1,s=0,a=0;for(;++r<e.length;){const i=e.charCodeAt(r);let o="";if(i===37&&Ko(e.charCodeAt(r+1))&&Ko(e.charCodeAt(r+2)))a=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(o=String.fromCharCode(i));else if(i>55295&&i<57344){const l=e.charCodeAt(r+1);i<56320&&l>56319&&l<57344?(o=String.fromCharCode(i,l),a=1):o="�"}else o=String.fromCharCode(i);o&&(t.push(e.slice(s,r),encodeURIComponent(o)),s=r+a+1,o=""),a&&(r+=a,a=0)}return t.join("")+e.slice(s)}function as(e,t,r,s){const a=s?s-1:Number.POSITIVE_INFINITY;let i=0;return o;function o(c){return vn(c)?(e.enter(r),l(c)):t(c)}function l(c){return vn(c)&&i++<a?(e.consume(c),l):(e.exit(r),t(c))}}const Fxt={tokenize:Lxt};function Lxt(e){const t=e.attempt(this.parser.constructs.contentInitial,s,a);let r;return t;function s(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),as(e,t,"linePrefix")}function a(l){return e.enter("paragraph"),i(l)}function i(l){const c=e.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=c),r=c,o(l)}function o(l){if(l===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(l);return}return Nr(l)?(e.consume(l),e.exit("chunkText"),i):(e.consume(l),o)}}const Dxt={tokenize:Rxt},qV={tokenize:Uxt};function Rxt(e){const t=this,r=[];let s=0,a,i,o;return l;function l(y){if(s<r.length){const w=r[s];return t.containerState=w[1],e.attempt(w[0].continuation,c,d)(y)}return d(y)}function c(y){if(s++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&b();const w=t.events.length;let j=w,N;for(;j--;)if(t.events[j][0]==="exit"&&t.events[j][1].type==="chunkFlow"){N=t.events[j][1].end;break}x(s);let _=w;for(;_<t.events.length;)t.events[_][1].end={...N},_++;return bd(t.events,j+1,0,t.events.slice(w)),t.events.length=_,d(y)}return l(y)}function d(y){if(s===r.length){if(!a)return m(y);if(a.currentConstruct&&a.currentConstruct.concrete)return p(y);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(qV,u,h)(y)}function u(y){return a&&b(),x(s),m(y)}function h(y){return t.parser.lazy[t.now().line]=s!==r.length,o=t.now().offset,p(y)}function m(y){return t.containerState={},e.attempt(qV,f,p)(y)}function f(y){return s++,r.push([t.currentConstruct,t.containerState]),m(y)}function p(y){if(y===null){a&&b(),x(0),e.consume(y);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:a,contentType:"flow",previous:i}),A(y)}function A(y){if(y===null){v(e.exit("chunkFlow"),!0),x(0),e.consume(y);return}return Nr(y)?(e.consume(y),v(e.exit("chunkFlow")),s=0,t.interrupt=void 0,l):(e.consume(y),A)}function v(y,w){const j=t.sliceStream(y);
vendor: 6,685 bytes, line 2084
2084if(w&&j.push(null),y.previous=i,i&&(i.next=y),i=y,a.defineSkip(y.start),a.write(j),t.parser.lazy[y.start.line]){let N=a.events.length;for(;N--;)if(a.events[N][1].start.offset<o&&(!a.events[N][1].end||a.events[N][1].end.offset>o))return;const _=t.events.length;let S=_,C,E;for(;S--;)if(t.events[S][0]==="exit"&&t.events[S][1].type==="chunkFlow"){if(C){E=t.events[S][1].end;break}C=!0}for(x(s),N=_;N<t.events.length;)t.events[N][1].end={...E},N++;bd(t.events,S+1,0,t.events.slice(_)),t.events.length=N}}function x(y){let w=r.length;for(;w-- >y;){const j=r[w];t.containerState=j[1],j[0].exit.call(t,e)}r.length=y}function b(){a.write([null]),i=void 0,a=void 0,t.containerState._closeFlow=void 0}}function Uxt(e,t,r){return as(e,e.attempt(this.parser.constructs.document,t,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function KV(e){if(e===null||oo(e)||Oxt(e))return 1;if(Ixt(e))return 2}function ML(e,t,r){const s=[];let a=-1;for(;++a<e.length;){const i=e[a].resolveAll;i&&!s.includes(i)&&(t=i(t,r),s.push(i))}return t}const oI={name:"attention",resolveAll:Mxt,tokenize:$xt};function Mxt(e,t){let r=-1,s,a,i,o,l,c,d,u;for(;++r<e.length;)if(e[r][0]==="enter"&&e[r][1].type==="attentionSequence"&&e[r][1]._close){for(s=r;s--;)if(e[s][0]==="exit"&&e[s][1].type==="attentionSequence"&&e[s][1]._open&&t.sliceSerialize(e[s][1]).charCodeAt(0)===t.sliceSerialize(e[r][1]).charCodeAt(0)){if((e[s][1]._close||e[r][1]._open)&&(e[r][1].end.offset-e[r][1].start.offset)%3&&!((e[s][1].end.offset-e[s][1].start.offset+e[r][1].end.offset-e[r][1].start.offset)%3))continue;c=e[s][1].end.offset-e[s][1].start.offset>1&&e[r][1].end.offset-e[r][1].start.offset>1?2:1;const h={...e[s][1].end},m={...e[r][1].start};WV(h,-c),WV(m,c),o={type:c>1?"strongSequence":"emphasisSequence",start:h,end:{...e[s][1].end}},l={type:c>1?"strongSequence":"emphasisSequence",start:{...e[r][1].start},end:m},i={type:c>1?"strongText":"emphasisText",start:{...e[s][1].end},end:{...e[r][1].start}},a={type:c>1?"strong":"emphasis",start:{...o.start},end:{...l.end}},e[s][1].end={...o.start},e[r][1].start={...l.end},d=[],e[s][1].end.offset-e[s][1].start.offset&&(d=Pl(d,[["enter",e[s][1],t],["exit",e[s][1],t]])),d=Pl(d,[["enter",a,t],["enter",o,t],["exit",o,t],["enter",i,t]]),d=Pl(d,ML(t.parser.constructs.insideSpan.null,e.slice(s+1,r),t)),d=Pl(d,[["exit",i,t],["enter",l,t],["exit",l,t],["exit",a,t]]),e[r][1].end.offset-e[r][1].start.offset?(u=2,d=Pl(d,[["enter",e[r][1],t],["exit",e[r][1],t]])):u=0,bd(e,s-1,r-s+3,d),r=s+d.length-u-2;break}}for(r=-1;++r<e.length;)e[r][1].type==="attentionSequence"&&(e[r][1].type="data");return e}function $xt(e,t){const r=this.parser.constructs.attentionMarkers.null,s=this.previous,a=KV(s);let i;return o;function o(c){return i=c,e.enter("attentionSequence"),l(c)}function l(c){if(c===i)return e.consume(c),l;const d=e.exit("attentionSequence"),u=KV(c),h=!u||u===2&&a||r.includes(c),m=!a||a===2&&u||r.includes(s);return d._open=!!(i===42?h:h&&(a||!m)),d._close=!!(i===42?m:m&&(u||!h)),t(c)}}function WV(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const Qxt={name:"autolink",tokenize:Hxt};function Hxt(e,t,r){let s=0;return a;function a(f){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(f){return td(f)?(e.consume(f),o):f===64?r(f):d(f)}function o(f){return f===43||f===45||f===46||Ko(f)?(s=1,l(f)):d(f)}function l(f){return f===58?(e.consume(f),s=0,c):(f===43||f===45||f===46||Ko(f))&&s++<32?(e.consume(f),l):(s=0,d(f))}function c(f){return f===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.exit("autolink"),t):f===null||f===32||f===60||aI(f)?r(f):(e.consume(f),c)}function d(f){return f===64?(e.consume(f),u):Bxt(f)?(e.consume(f),d):r(f)}function u(f){return Ko(f)?h(f):r(f)}function h(f){return f===46?(e.consume(f),s=0,u):f===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.exit("autolink"),t):m(f)}function m(f){if((f===45||Ko(f))&&s++<63){const p=f===45?m:h;return e.consume(f),p}return r(f)}}const Ck={partial:!0,tokenize:zxt};function zxt(e,t,r){return s;function s(i){return vn(i)?as(e,a,"linePrefix")(i):a(i)}function a(i){return i===null||Nr(i)?t(i):r(i)}}const lce={continuation:{tokenize:Gxt},exit:qxt,name:"blockQuote",tokenize:Vxt};function Vxt(e,t,r){const s=this;return a;function a(o){if(o===62){const l=s.containerState;return l.open||(e.enter("blockQuote",{_container:!0}),l.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),i}return r(o)}function i(o){return vn(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function Gxt(e,t,r){const s=this;return a;function a(o){return vn(o)?as(e,i,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):i(o)}function i(o){return e.attempt(lce,t,r)(o)}}function qxt(e){e.exit("blockQuote")}const cce={name:"characterEscape",tokenize:Kxt};function Kxt(e,t,r){return s;function s(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),a}function a(i){return Pxt(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):r(i)}}const dce={name:"characterReference",tokenize:Wxt};function Wxt(e,t,r){const s=this;let a=0,i,o;return l;function l(h){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),c}function c(h){return h===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(h),e.exit("characterReferenceMarkerNumeric"),d):(e.enter("characterReferenceValue"),i=31,o=Ko,u(h))}function d(h){return h===88||h===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(h),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,o=Txt,u):(e.enter("characterReferenceValue"),i=7,o=iI,u(h))}function u(h){if(h===59&&a){const m=e.exit("characterReferenceValue");return o===Ko&&!UL(s.sliceSerialize(m))?r(h):(e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(h)&&a++<i?(e.consume(h),u):r(h)}}const YV={partial:!0,tokenize:Jxt},JV={concrete:!0,name:"codeFenced",tokenize:Yxt};function Yxt(e,t,r){const s=this,a={partial:!0,tokenize:j};let i=0,o=0,l;return c;function c(N){return d(N)}function d(N){const _=s.events[s.events.length-1];return i=_&&_[1].type==="linePrefix"?_[2].sliceSerialize(_[1],!0).length:0,l=N,e.enter("co
2084deFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),u(N)}function u(N){return N===l?(o++,e.consume(N),u):o<3?r(N):(e.exit("codeFencedFenceSequence"),vn(N)?as(e,h,"whitespace")(N):h(N))}function h(N){return N===null||Nr(N)?(e.exit("codeFencedFence"),s.interrupt?t(N):e.check(YV,A,w)(N)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),m(N))}function m(N){return N===null||Nr(N)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),h(N)):vn(N)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),as(e,f,"whitespace")(N)):N===96&&N===l?r(N):(e.consume(N),m)}function f(N){return N===null||Nr(N)?h(N):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),p(N))}function p(N){return N===null||Nr(N)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),h(N)):N===96&&N===l?r(N):(e.consume(N),p)}function A(N){return e.attempt(a,w,v)(N)}function v(N){return e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),x}function x(N){return i>0&&vn(N)?as(e,b,"linePrefix",i+1)(N):b(N)}function b(N){return N===null||Nr(N)?e.check(YV,A,w)(N):(e.enter("codeFlowValue"),y(N))}function y(N){return N===null||Nr(N)?(e.exit("codeFlowValue"),b(N)):(e.consume(N),y)}function w(N){return e.exit("codeFenced"),t(N)}function j(N,_,S){let C=0;return E;function E(F){return N.enter("lineEnding"),N.consume(F),N.exit("lineEnding"),T}function T(F){return N.enter("codeFencedFence"),vn(F)?as(N,B,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(F):B(F)}function B(F){return F===l?(N.enter("codeFencedFenceSequence"),L(F)):S(F)}function L(F){return F===l?(C++,N.consume(F),L):C>=o?(N.exit("codeFencedFenceSequence"),vn(F)?as(N,P,"whitespace")(F):P(F)):S(F)}function P(F){return F===null||Nr(F)?(N.exit("codeFencedFence"),_(F)):S(F)}}}function Jxt(e,t,r){const s=this;return a;function a(o){return o===null?r(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i)}function i(o){return s.parser.lazy[s.now().line]?r(o):t(o)}}const O4={name:"codeIndented",tokenize:Zxt},Xxt={partial:!0,tokenize:evt};function Zxt(e,t,r){const s=this;return a;function a(d){return e.enter("codeIndented"),as(e,i,"linePrefix",5)(d)}function i(d){const u=s.events[s.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?o(d):r(d)}function o(d){return d===null?c(d):Nr(d)?e.attempt(Xxt,o,c)(d):(e.enter("codeFlowValue"),l(d))}function l(d){return d===null||Nr(d)?(e.exit("codeFlowValue"),o(d)):(e.consume(d),l)}function c(d){return e.exit("codeIndented"),t(d)}}function evt(e,t,r){const s=this;return a;function a(o){return s.parser.lazy[s.now().line]?r(o):Nr(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),a):as(e,i,"linePrefix",5)(o)}function i(o){const l=s.events[s.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(o):Nr(o)?a(o):r(o)}}const tvt={name:"codeText",previous:nvt,resolve:rvt,tokenize:svt};function rvt(e){let t=e.length-4,r=3,s,a;if((e[r][1].type==="lineEnding"||e[r][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(s=r;++s<t;)if(e[s][1].type==="codeTextData"){e[r][1].type="codeTextPadding",e[t][1].type="codeTextPadding",r+=2,t-=2;break}}for(s=r-1,t++;++s<=t;)a===void 0?s!==t&&e[s][1].type!=="lineEnding"&&(a=s):(s===t||e[s][1].type==="lineEnding")&&(e[a][1].type="codeTextData",s!==a+2&&(e[a][1].end=e[s-1][1].end,e.splice(a+2,s-a-2),t-=s-a-2,s=a+2),a=void 0);return e}function nvt(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function svt(e,t,r){let s=0,a,i;return o;function o(h){return e.enter("codeText"),e.enter("codeTextSequence"),l(h)}function l(h){return h===96?(e.consume(h),s++,l):(e.exit("codeTextSequence"),c(h))}function c(h){return h===null?r(h):h===32?(e.enter("space"),e.consume(h),e.exit("space"),c):h===96?(i=e.enter("codeTextSequence"),a=0,u(h)):Nr(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),c):(e.enter("codeTextData"),d(h))}function d(h){return h===null||h===32||h===96||Nr(h)?(e.exit("codeTextData"),c(h)):(e.consume(h),d)}function u(h){return h===96?(e.consume(h),a++,u):a===s?(e.exit("codeTextSequence"),e.exit("codeText"),t(h)):(i.type="codeTextData",d(h))}}class avt{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,r){const s=r??Number.POSITIVE_INFINITY;return s<this.left.length?this.left.slice(t,s):t>this.left.length?this.right.slice(this.right.length-s+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-s+this.left.length).reverse())}splice(t,r,s){const a=r||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return s&&Rx(this.left,s),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Rx(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Rx(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const r=this.left.splice(t,Number.POSITIVE_INFINITY);Rx(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Rx(this.left,r.reverse())}}}function Rx(e,t){let r=0;if(t.length<1e4)e.push(...t);else for(;r<t.length;)e.push(...t.slice(r,r+1e4)),r+=1e4}function uce(e){const t={};let r=-1,s,a,i,o,l,c,d;const u=new avt(e);for(;++r<u.length;){for(;r in t;)r=t[r];if(s=u.get(r),r&&s[1].type==="chunkFlow"&&u.get(r-1)[1].type==="listItemPrefix"&&(c=s[1]._tokenizer.events,i=0,i<c.length&&c[i][1].type==="lineEndingBlank"&&(i+=2),i<c.length&&c[i][1].type==="content"))for(;++i<c.length&&c[i][1].type!=="content";)c[i][1].type==="chunkText"&&(c[i][1]._isInFirstContentOfListItem=!0,i++);if(s[0]==="enter")s[1].contentType&&(Object.assign(t,ivt(u,r)),r=t[r],d=!0);else if(s[1]._container){for(i=r,a=void 0;i--;)if(o=u.get(i),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(a&&(u.get(a)[1].type="lineEndingBlank"),o[1].type="lineEnding",a=i);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;a&&(s[1].end={...u.get(a)[1].start},l=u.slice(a,r),l.unshift(s),u.splice(a,r-a+1,l))}}return bd(e,0,Number.POSITIVE_INFINITY,u.slice(0)),!d}function ivt(e,t){const r=e.get(t)[1],s=e.get(t)[2];let a=t-1;const i=[];let o=r._tokenizer;o||(o=s.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const l=o.events,c=[],d={};let u,h,m=-1,f=r,p=0,A=0;const v=[A];for(;f;){for(;e.get(++a)[1]!==f;);i.push(a),f._tokenizer||(u=s.sliceStream(f),f.next||u.push(null),h&&o.defineSki
vendor: 22,855 bytes, line 2084
2084p(f.start),f._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),f._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),h=f,f=f.next}for(f=r;++m<l.length;)l[m][0]==="exit"&&l[m-1][0]==="enter"&&l[m][1].type===l[m-1][1].type&&l[m][1].start.line!==l[m][1].end.line&&(A=m+1,v.push(A),f._tokenizer=void 0,f.previous=void 0,f=f.next);for(o.events=[],f?(f._tokenizer=void 0,f.previous=void 0):v.pop(),m=v.length;m--;){const x=l.slice(v[m],v[m+1]),b=i.pop();c.push([b,b+x.length-1]),e.splice(b,2,x)}for(c.reverse(),m=-1;++m<c.length;)d[p+c[m][0]]=p+c[m][1],p+=c[m][1]-c[m][0]-1;return d}const ovt={resolve:cvt,tokenize:dvt},lvt={partial:!0,tokenize:uvt};function cvt(e){return uce(e),e}function dvt(e,t){let r;return s;function s(l){return e.enter("content"),r=e.enter("chunkContent",{contentType:"content"}),a(l)}function a(l){return l===null?i(l):Nr(l)?e.check(lvt,o,i)(l):(e.consume(l),a)}function i(l){return e.exit("chunkContent"),e.exit("content"),t(l)}function o(l){return e.consume(l),e.exit("chunkContent"),r.next=e.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,a}}function uvt(e,t,r){const s=this;return a;function a(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),as(e,i,"linePrefix")}function i(o){if(o===null||Nr(o))return r(o);const l=s.events[s.events.length-1];return!s.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(o):e.interrupt(s.parser.constructs.flow,r,t)(o)}}function hce(e,t,r,s,a,i,o,l,c){const d=c||Number.POSITIVE_INFINITY;let u=0;return h;function h(x){return x===60?(e.enter(s),e.enter(a),e.enter(i),e.consume(x),e.exit(i),m):x===null||x===32||x===41||aI(x)?r(x):(e.enter(s),e.enter(o),e.enter(l),e.enter("chunkString",{contentType:"string"}),A(x))}function m(x){return x===62?(e.enter(i),e.consume(x),e.exit(i),e.exit(a),e.exit(s),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),f(x))}function f(x){return x===62?(e.exit("chunkString"),e.exit(l),m(x)):x===null||x===60||Nr(x)?r(x):(e.consume(x),x===92?p:f)}function p(x){return x===60||x===62||x===92?(e.consume(x),f):f(x)}function A(x){return!u&&(x===null||x===41||oo(x))?(e.exit("chunkString"),e.exit(l),e.exit(o),e.exit(s),t(x)):u<d&&x===40?(e.consume(x),u++,A):x===41?(e.consume(x),u--,A):x===null||x===32||x===40||aI(x)?r(x):(e.consume(x),x===92?v:A)}function v(x){return x===40||x===41||x===92?(e.consume(x),A):A(x)}}function fce(e,t,r,s,a,i){const o=this;let l=0,c;return d;function d(f){return e.enter(s),e.enter(a),e.consume(f),e.exit(a),e.enter(i),u}function u(f){return l>999||f===null||f===91||f===93&&!c||f===94&&!l&&"_hiddenFootnoteSupport"in o.parser.constructs?r(f):f===93?(e.exit(i),e.enter(a),e.consume(f),e.exit(a),e.exit(s),t):Nr(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),u):(e.enter("chunkString",{contentType:"string"}),h(f))}function h(f){return f===null||f===91||f===93||Nr(f)||l++>999?(e.exit("chunkString"),u(f)):(e.consume(f),c||(c=!vn(f)),f===92?m:h)}function m(f){return f===91||f===92||f===93?(e.consume(f),l++,h):h(f)}}function mce(e,t,r,s,a,i){let o;return l;function l(m){return m===34||m===39||m===40?(e.enter(s),e.enter(a),e.consume(m),e.exit(a),o=m===40?41:m,c):r(m)}function c(m){return m===o?(e.enter(a),e.consume(m),e.exit(a),e.exit(s),t):(e.enter(i),d(m))}function d(m){return m===o?(e.exit(i),c(o)):m===null?r(m):Nr(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),as(e,d,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),u(m))}function u(m){return m===o||m===null||Nr(m)?(e.exit("chunkString"),d(m)):(e.consume(m),m===92?h:u)}function h(m){return m===o||m===92?(e.consume(m),u):u(m)}}function Mv(e,t){let r;return s;function s(a){return Nr(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),r=!0,s):vn(a)?as(e,s,r?"linePrefix":"lineSuffix")(a):t(a)}}const hvt={name:"definition",tokenize:mvt},fvt={partial:!0,tokenize:pvt};function mvt(e,t,r){const s=this;let a;return i;function i(f){return e.enter("definition"),o(f)}function o(f){return fce.call(s,e,l,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(f)}function l(f){return a=KA(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),f===58?(e.enter("definitionMarker"),e.consume(f),e.exit("definitionMarker"),c):r(f)}function c(f){return oo(f)?Mv(e,d)(f):d(f)}function d(f){return hce(e,u,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(f)}function u(f){return e.attempt(fvt,h,h)(f)}function h(f){return vn(f)?as(e,m,"whitespace")(f):m(f)}function m(f){return f===null||Nr(f)?(e.exit("definition"),s.parser.defined.push(a),t(f)):r(f)}}function pvt(e,t,r){return s;function s(l){return oo(l)?Mv(e,a)(l):r(l)}function a(l){return mce(e,i,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function i(l){return vn(l)?as(e,o,"whitespace")(l):o(l)}function o(l){return l===null||Nr(l)?t(l):r(l)}}const Avt={name:"hardBreakEscape",tokenize:gvt};function gvt(e,t,r){return s;function s(i){return e.enter("hardBreakEscape"),e.consume(i),a}function a(i){return Nr(i)?(e.exit("hardBreakEscape"),t(i)):r(i)}}const xvt={name:"headingAtx",resolve:vvt,tokenize:bvt};function vvt(e,t){let r=e.length-2,s=3,a,i;return e[s][1].type==="whitespace"&&(s+=2),r-2>s&&e[r][1].type==="whitespace"&&(r-=2),e[r][1].type==="atxHeadingSequence"&&(s===r-1||r-4>s&&e[r-2][1].type==="whitespace")&&(r-=s+1===r?2:4),r>s&&(a={type:"atxHeadingText",start:e[s][1].start,end:e[r][1].end},i={type:"chunkText",start:e[s][1].start,end:e[r][1].end,contentType:"text"},bd(e,s,r-s+1,[["enter",a,t],["enter",i,t],["exit",i,t],["exit",a,t]])),e}function bvt(e,t,r){let s=0;return a;function a(u){return e.enter("atxHeading"),i(u)}function i(u){return e.enter("atxHeadingSequence"),o(u)}function o(u){return u===35&&s++<6?(e.consume(u),o):u===null||oo(u)?(e.exit("atxHeadingSequence"),l(u)):r(u)}function l(u){return u===35?(e.enter("atxHeadingSequence"),c(u)):u===null||Nr(u)?(e.exit("atxHeading"),t(u)):vn(u)?as(e,l,"whitespace")(u):(e.enter("atxHeadingText"),d(u))}function c(u){return u===35?(e.consume(u),c):(e.exit("atxHeadingSequence"),l(u))}function d(u){return u===null||u===35||oo(u)?(e.exit("atxHeadingText"),l(u)):(e.consume(u),d)}}const yvt=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],XV=["pre","script","style","textarea"],wvt={concrete:!0,name:"htmlFlow",resolveTo:_vt,tokenize:Cvt},jvt={partial:!0,tokenize:kvt},Nvt={partial:!0,tokenize:Svt};function _vt(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function Cvt(e,t,r){const s=this;let a,i,o,l,c;return d;function d(D){return u(D)}function u(D){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(D),h}function h(D){return D===33?(e.consume(D),m):D===47?(e.consume(D),i=!0,A):D===63?(e.consume(D),a=3,s.interrupt?t:R):td(D)?(e.consume(D),o=String.fromCharCode(D),v):r(D)}function m(D){return D===45?(e.consume(D),a=2,f):D===91?(e.consume(D),a=5,l=0,p):td(D)?(e.consume(D),a=4,s.interrupt?t:R):r(D)}function f(D){return D===45?(e.consume(D),s.interrupt?t:R):r(D)}function p(D){const q="CDATA[";return D===q.charCodeAt(l++)?(e.consume(D),l===q.length?s.interrupt?t:B:p):r(D)}function A(D){return td(D)?(e.consume(D),o=String.fromCharCode(D),v):r(D)}function v(D){if(D===null||D===47||D===62||oo(D)){const q=D===47,G=o.toLowerCase();return!q&&!i&&XV.includes(G)?(a=1,s.interrupt?t(D):B(D)):yvt.includes(o.toLowerCase())?(a=6,q?(e.consume(D),x):s.interrupt?t(D):B(D)):(a=7,s.interrupt&&!s.parser.lazy[s.now().line]?r(D):i?b(D):y(D))}return D===45||Ko(D)?(e.consume(D),o+=String.fromCharCode(D),v):r(D)}function x(D){return D===62?(e.consume(D),s.interrupt?t:B):r(D)}function b(D){return vn(D)?(e.consume(D),b):E(D)}function y(D){return D===47?(e.consume(D),E):D===58||D===95||td(D)?(e.consume(D),w):vn(D)?(e.consume(D),y):E(D)}function w(D){return D===45||D===46||D===58||D===95||Ko(D)?(e.consume(D),w):j(D)}function j(D){return D===61?(e.consume(D),N):vn(D)?(e.consume(D),j):y(D)}function N(D){return D===null||D===60||D===61||D===62||D===96?r(D):D===34||D===39?(e.consume(D),c=D,_):vn(D)?(e.consume(D),N):S(D)}function _(D){return D===c?(e.consume(D),c=null,C):D===null||Nr(D)?r(D):(e.consume(D),_)}function S(D){return D===null||D===34||D===39||D===47||D===60||D===61||D===62||D===96||oo(D)?j(D):(e.consume(D),S)}function C(D){return D===47||D===62||vn(D)?y(D):r(D)}function E(D){return D===62?(e.consume(D),T):r(D)}function T(D){return D===null||Nr(D)?B(D):vn(D)?(e.consume(D),T):r(D)}function B(D){return D===45&&a===2?(e.consume(D),M):D===60&&a===1?(e.consume(D),I):D===62&&a===4?(e.consume(D),Q):D===63&&a===3?(e.consume(D),R):D===93&&a===5?(e.consume(D),V):Nr(D)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(jvt,U,L)(D)):D===null||Nr(D)?(e.exit("htmlFlowData"),L(D)):(e.consume(D),B)}function L(D){return e.check(Nvt,P,U)(D)}function P(D){return e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),F}function F(D){return D===null||Nr(D)?L(D):(e.enter("htmlFlowData"),B(D))}function M(D){return D===45?(e.consume(D),R):B(D)}function I(D){return D===47?(e.consume(D),o="",$):B(D)}function $(D){if(D===62){const q=o.toLowerCase();return XV.includes(q)?(e.consume(D),Q):B(D)}return td(D)&&o.length<8?(e.consume(D),o+=String.fromCharCode(D),$):B(D)}function V(D){return D===93?(e.consume(D),R):B(D)}function R(D){return D===62?(e.consume(D),Q):D===45&&a===2?(e.consume(D),R):B(D)}function Q(D){return D===null||Nr(D)?(e.exit("htmlFlowData"),U(D)):(e.consume(D),Q)}function U(D){return e.exit("htmlFlow"),t(D)}}function Svt(e,t,r){const s=this;return a;function a(o){return Nr(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):r(o)}function i(o){return s.parser.lazy[s.now().line]?r(o):t(o)}}function kvt(e,t,r){return s;function s(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(Ck,t,r)}}const Evt={name:"htmlText",tokenize:Bvt};function Bvt(e,t,r){const s=this;let a,i,o;return l;function l(R){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(R),c}function c(R){return R===33?(e.consume(R),d):R===47?(e.consume(R),j):R===63?(e.consume(R),y):td(R)?(e.consume(R),S):r(R)}function d(R){return R===45?(e.consume(R),u):R===91?(e.consume(R),i=0,p):td(R)?(e.consume(R),b):r(R)}function u(R){return R===45?(e.consume(R),f):r(R)}function h(R){return R===null?r(R):R===45?(e.consume(R),m):Nr(R)?(o=h,I(R)):(e.consume(R),h)}function m(R){return R===45?(e.consume(R),f):h(R)}function f(R){return R===62?M(R):R===45?m(R):h(R)}function p(R){const Q="CDATA[";return R===Q.charCodeAt(i++)?(e.consume(R),i===Q.length?A:p):r(R)}function A(R){return R===null?r(R):R===93?(e.consume(R),v):Nr(R)?(o=A,I(R)):(e.consume(R),A)}function v(R){return R===93?(e.consume(R),x):A(R)}function x(R){return R===62?M(R):R===93?(e.consume(R),x):A(R)}function b(R){return R===null||R===62?M(R):Nr(R)?(o=b,I(R)):(e.consume(R),b)}function y(R){return R===null?r(R):R===63?(e.consume(R),w):Nr(R)?(o=y,I(R)):(e.consume(R),y)}function w(R){return R===62?M(R):y(R)}function j(R){return td(R)?(e.consume(R),N):r(R)}function N(R){return R===45||Ko(R)?(e.consume(R),N):_(R)}function _(R){return Nr(R)?(o=_,I(R)):vn(R)?(e.consume(R),_):M(R)}function S(R){return R===45||Ko(R)?(e.consume(R),S):R===47||R===62||oo(R)?C(R):r(R)}function C(R){return R===47?(e.consume(R),M):R===58||R===95||td(R)?(e.consume(R),E):Nr(R)?(o=C,I(R)):vn(R)?(e.consume(R),C):M(R)}function E(R){return R===45||R===46||R===58||R===95||Ko(R)?(e.consume(R),E):T(R)}function T(R){return R===61?(e.consume(R),B):Nr(R)?(o=T,I(R)):vn(R)?(e.consume(R),T):C(R)}function B(R){return R===null||R===60||R===61||R===62||R===96?r(R):R===34||R===39?(e.consume(R),a=R,L):Nr(R)?(o=B,I(R)):vn(R)?(e.consume(R),B):(e.consume(R),P)}function L(R){return R===a?(e.consume(R),a=void 0,F):R===null?r(R):Nr(R)?(o=L,I(R)):(e.consume(R),L)}function P(R){return R===null||R===34||R===39||R===60||R===61||R===96?r(R):R===47||R===62||oo(R)?C(R):(e.consume(R),P)}function F(R){return R===47||R===62||oo(R)?C(R):r(R)}function M(R){return R===62?(e.consume(R),e.exit("htmlTextData"),e.exit("htmlText"),t):r(R)}function I(R){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),$}function $(R){return vn(R)?as(e,V,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):V(R)}function V(R){return e.enter("htmlTextData"),o(R)}}const $L={name:"labelEnd",resolveAll:Ovt,resolveTo:Fvt,tokenize:Lvt},Tvt={tokenize:Dvt},Pvt={tokenize:Rvt},Ivt={tokenize:Uvt};function Ovt(e){let t=-1;const r=[];for(;++t<e.length;){const s=e[t][1];if(r.push(e[t]),s.type==="labelImage"||s.type==="labelLink"||s.type==="labelEnd"){const a=s.type==="labelImage"?4:2;s.type="data",t+=a}}return e.length!==r.length&&bd(e,0,e.length,r),e}function Fvt(e,t){let r=e.length,s=0,a,i,o,l;for(;r--;)if(a=e[r][1],i){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;e[r][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(o){if(e[r][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(i=r,a.type!=="labelLink")){s=2;break}}else a.type==="labelEnd"&&(o=r);const c={type:e[i][1].type==="labelLink"?"link":"image",start:{...e[i][1].start},end:{...e[e.length-1][1].end}},d={type:"label",start:{...e[i][1].start},end:{...e[o][1].end}},u={type:"labelText",start:{...e[i+s+2][1].end},end:{...e[o-2][1].start}};return l=[["enter",c,t],["enter",d,t]],l=Pl(l,e.slice(i+1,i+s+3)),l=Pl(l,[["enter",u,t]]),l=Pl(l,ML(t.parser.constructs.insideSpan.null,e.slice(i+s+4,o-3),t)),l=Pl(l,[["exit",u,t],e[o-2],e[o-1],["exit",d,t]]),l=Pl(l,e.slice(o+1)),l=Pl(l,[["exit",c,t]]),bd(e,i,e.length,l),e}function Lvt(e,t,r){const s=this;let a=s.events.length,i,o;for(;a--;)if((s.events[a][1].type==="labelImage"||s.events[a][1].type==="labelLink")&&!s.events[a][1]._balanced){i=s.events[a][1];break}return l;function l(m){return i?i._inactive?h(m):(o=s.parser.defined.includes(KA(s.sliceSerialize({start:i.end,end:s.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(m),e.exit("labelMarker"),e.exit("labelEnd"),c):r(m)}function c(m){return m===40?e.attempt(Tvt,u,o?u:h)(m):m===91?e.attempt(Pvt,u,o?d:h)(m):o?u(m):h(m)}function d(m){return e.attempt(Ivt,u,h)(m)}function u(m){return t(m)}function h(m){return i._balanced=!0,r(m)}}function Dvt(e,t,r){return s;function s(h){return e.enter("resource"),e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),a}function a(h){return oo(h)?Mv(e,i)(h):i(h)}function i(h){return h===41?u(h):hce(e,o,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function o(h){return oo(h)?Mv(e,c)(h):u(h)}function l(h){return r(h)}function c(h){return h===34||h===39||h===40?mce(e,d,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):u(h)}function d(h){return oo(h)?Mv(e,u)(h):u(h)}function u(h){return h===41?(e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),e.exit("resource"),t):r(h)}}function Rvt(e,t,r){const s=this;return a;function a(l){return fce.call(s,e,i,o,"reference","referenceMarker","referenceString")(l)}function i(l){return s.parser.defined.includes(KA(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?t(l):r(l)}function o(l){return r(l)}}function Uvt(e,t,r){return s;function s(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),a}function a(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):r(i)}}const Mvt={name:"labelStartImage",resolveAll:$L.resolveAll,tokenize:$vt};function $vt(e,t,r){const s=this;return a;function a(l){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(l),e.exit("labelImageMarker"),i}function i(l){return l===91?(e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelImage"),o):r(l)}function o(l){return l===94&&"_hiddenFootnoteSupport"in s.parser.constructs?r(l):t(l)}}const Qvt={name:"labelStartLink",resolveAll:$L.resolveAll,tokenize:Hvt};function Hvt(e,t,r){const s=this;return a;function a(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),i}function i(o){return o===94&&"_hiddenFootnoteSupport"in s.parser.constructs?r(o):t(o)}}const F4={name:"lineEnding",tokenize:zvt};function zvt(e,t){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),as(e,t,"linePrefix")}}const Kj={name:"thematicBreak",tokenize:Vvt};function Vvt(e,t,r){let s=0,a;return i;function i(d){return e.enter("thematicBreak"),o(d)}function o(d){return a=d,l(d)}function l(d){return d===a?(e.enter("thematicBreakSequence"),c(d)):s>=3&&(d===null||Nr(d))?(e.exit("thematicBreak"),t(d)):r(d)}function c(d){return d===a?(e.consume(d),s++,c):(e.exit("thematicBreakSequence"),vn(d)?as(e,l,"whitespace")(d):l(d))}}const Xi={continuation:{tokenize:Wvt},exit:Jvt,name:"list",tokenize:Kvt},Gvt={partial:!0,tokenize:Xvt},qvt={partial:!0,tokenize:Yvt};function Kvt(e,t,r){const s=this,a=s.events[s.events.length-1];let i=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,o=0;return l;function l(f){const p=s.containerState.type||(f===42||f===43||f===45?"listUnordered":"listOrdered");if(p==="listUnordered"?!s.containerState.marker||f===s.containerState.marker:iI(f)){if(s.containerState.type||(s.containerState.type=p,e.enter(p,{_container:!0})),p==="listUnordered")return e.enter("listItemPrefix"),f===42||f===45?e.check(Kj,r,d)(f):d(f);if(!s.interrupt||f===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(f)}return r(f)}function c(f){return iI(f)&&++o<10?(e.consume(f),c):(!s.interrupt||o<2)&&(s.containerState.marker?f===s.containerState.marker:f===41||f===46)?(e.exit("listItemValue"),d(f)):r(f)}function d(f){return e.enter("listItemMarker"),e.consume(f),e.exit("listItemMarker"),s.containerState.marker=s.containerState.marker||f,e.check(Ck,s.interrupt?r:u,e.attempt(Gvt,m,h))}function u(f){return s.containerState.initialBlankLine=!0,i++,m(f)}function h(f){return vn(f)?(e.enter("listItemPrefixWhitespace"),e.consume(f),e.exit("listItemPrefixWhitespace"),m):r(f)}function m(f){return s.containerState.size=i+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(f)}}function Wvt(e,t,r){const s=this;return s.containerState._closeFlow=void 0,e.check(Ck,a,i);function a(l){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,as(e,t,"listItemIndent",s.containerState.size+1)(l)}function i(l){return s.containerState.furtherBlankLines||!vn(l)?(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,o(l)):(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,e.attempt(qvt,t,o)(l))}function o(l){return s.containerState._closeFlow=!0,s.interrupt=void 0,as(e,e.attempt(Xi,t,r),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function Yvt(e,t,r){const s=this;return as(e,a,"listItemIndent",s.containerState.size+1);function a(i){const o=s.events[s.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===s.containerState.size?t(i):r(i)}}function Jvt(e){e.exit(this.containerState.type)}function Xvt(e,t,r){const s=this;return as(e,a,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(i){const o=s.events[s.events.length-1];return!vn(i)&&o&&o[1].type==="listItemPrefixWhitespace"?t(i):r(i)}}const ZV={name:"setextUnderline",resolveTo:Zvt,tokenize:ebt};function Zvt(e,t){let r=e.length,s,a,i;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){s=r;break}e[r][1].type==="paragraph"&&(a=r)}else e[r][1].type==="content"&&e.splice(r,1),!i&&e[r][1].type==="definition"&&(i=r);const o={type:"setextHeading",start:{...e[s][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type="setextHeadingText",i?(e.splice(a,0,["enter",o,t]),e.splice(i+1,0,["exit",e[s][1],t]),e[s][1].end={...e[i][1].end}):e[s][1]=o,e.push(["exit",o,t]),e}function ebt(e,t,r){const s=this;let a;return i;function i(d){let u=s.events.length,h;for(;u--;)if(s.events[u][1].type!=="lineEnding"&&s.events[u][1].type!=="linePrefix"&&s.events[u][1].type!=="content"){h=s.events[u][1].type==="paragraph";break}return!s.parser.lazy[s.now().line]&&(s.interrupt||h)?(e.enter("setextHeadingLine"),a=d,o(d)):r(d)}function o(d){return e.enter("setextHeadingLineSequence"),l(d)}function l(d){return d===a?(e.consume(d),l):(e.exit("setextHeadingLineSequence"),vn(d)?as(e,c,"lineSuffix")(d):c(d))}function c(d){return d===null||Nr(d)?(e.exit("setextHeadingLine"),t(d)):r(d)}}const tbt={tokenize:rbt};function rbt(e){const t=this,r=e.attempt(Ck,s,e.attempt(this.parser.constructs.flowInitial,a,as(e,e.attempt(this.parser.constructs.flow,a,e.attempt(ovt,a)),"linePrefix")));return r;function s(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,r}function a(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,r}}const nbt={resolveAll:Ace()},sbt=pce("string"),abt=pce("text");function pce(e){return{resolveAll:Ace(e==="text"?ibt:void 0),tokenize:t};function t(r){const s=this,a=this.parser.constructs[e],i=r.attempt(a,o,l);return o;function o(u){return d(u)?i(u):l(u)}function l(u){if(u===null){r.consume(u);return}return r.enter("data"),r.consume(u),c}function c(u){return d(u)?(r.exit("data"),i(u)):(r.consume(u),c)}function d(u){if(u===null)return!0;const h=a[u];let m=-1;if(h)for(;++m<h.length;){const f=h[m];if(!f.previous||f.previous.call(s,s.previous))return!0}return!1}}}function Ace(e){return t;function t(r,s){let a=-1,i;for(;++a<=r.length;)i===void 0?r[a]&&r[a][1].type==="data"&&(i=a,a++):(!r[a]||r[a][1].type!=="data")&&(a!==i+2&&(r[i][1].end=r[a-1][1].end,r.splice(i+2,a-i-2),a=i+2),i=void 0);return e?e(r,s):r}}function ibt(e,t){let r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type==="lineEnding")&&e[r-1][1].type==="data"){const s=e[r-1][1],a=t.sliceStream(s);let i=a.length,o=-1,l=0,c;for(;i--;){const d=a[i];
vendor: 2,553 bytes, line 2084
2084if(typeof d=="string"){for(o=d.length;d.charCodeAt(o-1)===32;)l++,o--;if(o)break;o=-1}else if(d===-2)c=!0,l++;else if(d!==-1){i++;break}}if(t._contentTypeTextTrailing&&r===e.length&&(l=0),l){const d={type:r===e.length||c||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?o:s.start._bufferIndex+o,_index:s.start._index+i,line:s.end.line,column:s.end.column-l,offset:s.end.offset-l},end:{...s.end}};s.end={...d.start},s.start.offset===s.end.offset?Object.assign(s,d):(e.splice(r,0,["enter",d,t],["exit",d,t]),r+=2)}r++}return e}const obt={42:Xi,43:Xi,45:Xi,48:Xi,49:Xi,50:Xi,51:Xi,52:Xi,53:Xi,54:Xi,55:Xi,56:Xi,57:Xi,62:lce},lbt={91:hvt},cbt={[-2]:O4,[-1]:O4,32:O4},dbt={35:xvt,42:Kj,45:[ZV,Kj],60:wvt,61:ZV,95:Kj,96:JV,126:JV},ubt={38:dce,92:cce},hbt={[-5]:F4,[-4]:F4,[-3]:F4,33:Mvt,38:dce,42:oI,60:[Qxt,Evt],91:Qvt,92:[Avt,cce],93:$L,95:oI,96:tvt},fbt={null:[oI,nbt]},mbt={null:[42,95]},pbt={null:[]},Abt=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:mbt,contentInitial:lbt,disable:pbt,document:obt,flow:dbt,flowInitial:cbt,insideSpan:fbt,string:ubt,text:hbt},Symbol.toStringTag,{value:"Module"}));function gbt(e,t,r){let s={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0};const a={},i=[];let o=[],l=[];const c={attempt:_(j),check:_(N),consume:b,enter:y,exit:w,interrupt:_(N,{interrupt:!0})},d={code:null,containerState:{},defineSkip:A,events:[],now:p,parser:e,previous:null,sliceSerialize:m,sliceStream:f,write:h};let u=t.tokenize.call(d,c);return t.resolveAll&&i.push(t),d;function h(T){return o=Pl(o,T),v(),o[o.length-1]!==null?[]:(S(t,0),d.events=ML(i,d.events,d),d.events)}function m(T,B){return vbt(f(T),B)}function f(T){return xbt(o,T)}function p(){const{_bufferIndex:T,_index:B,line:L,column:P,offset:F}=s;return{_bufferIndex:T,_index:B,line:L,column:P,offset:F}}function A(T){a[T.line]=T.column,E()}function v(){let T;for(;s._index<o.length;){const B=o[s._index];if(typeof B=="string")for(T=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===T&&s._bufferIndex<B.length;)x(B.charCodeAt(s._bufferIndex));else x(B)}}function x(T){u=u(T)}function b(T){Nr(T)?(s.line++,s.column=1,s.offset+=T===-3?2:1,E()):T!==-1&&(s.column++,s.offset++),s._bufferIndex<0?s._index++:(s._bufferIndex++,s._bufferIndex===o[s._index].length&&(s._bufferIndex=-1,s._index++)),d.previous=T}function y(T,B){const L=B||{};return L.type=T,L.start=p(),d.events.push(["enter",L,d]),l.push(L),L}function w(T){const B=l.pop();return B.end=p(),d.events.push(["exit",B,d]),B}function j(T,B){S(T,B.from)}
vendor: 11,247 bytes, lines 2084-2086
2084function N(T,B){B.restore()}function _(T,B){return L;function L(P,F,M){let I,$,V,R;return Array.isArray(P)?U(P):"tokenize"in P?U([P]):Q(P);function Q(Y){return K;function K(X){const ne=X!==null&&Y[X],ae=X!==null&&Y.null,J=[...Array.isArray(ne)?ne:ne?[ne]:[],...Array.isArray(ae)?ae:ae?[ae]:[]];return U(J)(X)}}function U(Y){return I=Y,$=0,Y.length===0?M:D(Y[$])}function D(Y){return K;function K(X){return R=C(),V=Y,Y.partial||(d.currentConstruct=Y),Y.name&&d.parser.constructs.disable.null.includes(Y.name)?G():Y.tokenize.call(B?Object.assign(Object.create(d),B):d,c,q,G)(X)}}function q(Y){return T(V,R),F}function G(Y){return R.restore(),++$<I.length?D(I[$]):M}}}function S(T,B){T.resolveAll&&!i.includes(T)&&i.push(T),T.resolve&&bd(d.events,B,d.events.length-B,T.resolve(d.events.slice(B),d)),T.resolveTo&&(d.events=T.resolveTo(d.events,d))}function C(){const T=p(),B=d.previous,L=d.currentConstruct,P=d.events.length,F=Array.from(l);return{from:P,restore:M};function M(){s=T,d.previous=B,d.currentConstruct=L,d.events.length=P,l=F,E()}}function E(){s.line in a&&s.column<2&&(s.column=a[s.line],s.offset+=a[s.line]-1)}}function xbt(e,t){const r=t.start._index,s=t.start._bufferIndex,a=t.end._index,i=t.end._bufferIndex;let o;if(r===a)o=[e[r].slice(s,i)];else{if(o=e.slice(r,a),s>-1){const l=o[0];typeof l=="string"?o[0]=l.slice(s):o.shift()}i>0&&o.push(e[a].slice(0,i))}return o}function vbt(e,t){let r=-1;const s=[];let a;for(;++r<e.length;){const i=e[r];let o;if(typeof i=="string")o=i;else switch(i){case-5:{o="\r";break}case-4:{o=`
2085`;break}case-3:{o=`\r
2086`;break}case-2:{o=t?" ":"	";break}case-1:{if(!t&&a)continue;o=" ";break}default:o=String.fromCharCode(i)}a=i===-2,s.push(o)}return s.join("")}function bbt(e){const s={constructs:Sxt([Abt,...(e||{}).extensions||[]]),content:a(Fxt),defined:[],document:a(Dxt),flow:a(tbt),lazy:{},string:a(sbt),text:a(abt)};return s;function a(i){return o;function o(l){return gbt(s,i,l)}}}function ybt(e){for(;!uce(e););return e}const eG=/[\0\t\n\r]/g;function wbt(){let e=1,t="",r=!0,s;return a;function a(i,o,l){const c=[];let d,u,h,m,f;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(o||void 0).decode(i)),h=0,t="",r&&(i.charCodeAt(0)===65279&&h++,r=void 0);h<i.length;){if(eG.lastIndex=h,d=eG.exec(i),m=d&&d.index!==void 0?d.index:i.length,f=i.charCodeAt(m),!d){t=i.slice(h);break}if(f===10&&h===m&&s)c.push(-3),s=void 0;else switch(s&&(c.push(-5),s=void 0),h<m&&(c.push(i.slice(h,m)),e+=m-h),f){case 0:{c.push(65533),e++;break}case 9:{for(u=Math.ceil(e/4)*4,c.push(-2);e++<u;)c.push(-1);break}case 10:{c.push(-4),e=1;break}default:s=!0,e=1}h=m+1}return l&&(s&&c.push(-5),t&&c.push(t),c.push(null)),c}}const jbt=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Nbt(e){return e.replace(jbt,_bt)}function _bt(e,t,r){if(t)return t;if(r.charCodeAt(0)===35){const a=r.charCodeAt(1),i=a===120||a===88;return oce(r.slice(i?2:1),i?16:10)}return UL(r)||e}const gce={}.hasOwnProperty;function Cbt(e,t,r){return t&&typeof t=="object"&&(r=t,t=void 0),Sbt(r)(ybt(bbt(r).document().write(wbt()(e,t,!0))))}function Sbt(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(pe),autolinkProtocol:C,autolinkEmail:C,atxHeading:i(ee),blockQuote:i(ae),characterEscape:C,characterReference:C,codeFenced:i(J),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:i(J,o),codeText:i(W,o),codeTextData:C,data:C,codeFlowValue:C,definition:i(ie),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:i(he),hardBreakEscape:i(xe),hardBreakTrailing:i(xe),htmlFlow:i(we,o),htmlFlowData:C,htmlText:i(we,o),htmlTextData:C,image:i(Se),label:o,link:i(pe),listItem:i(re),listItemValue:m,listOrdered:i(Ce,h),listUnordered:i(Ce),paragraph:i(se),reference:D,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:i(ee),strong:i(Ae),thematicBreak:i(Oe)},exit:{atxHeading:c(),atxHeadingSequence:j,autolink:c(),autolinkEmail:ne,autolinkProtocol:X,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:G,characterReferenceMarkerNumeric:G,characterReferenceValue:Y,characterReference:K,codeFenced:c(v),codeFencedFence:A,codeFencedFenceInfo:f,codeFencedFenceMeta:p,codeFlowValue:E,codeIndented:c(x),codeText:c(F),codeTextData:E,data:E,definition:c(),definitionDestinationString:w,definitionLabelString:b,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(B),hardBreakTrailing:c(B),htmlFlow:c(L),htmlFlowData:E,htmlText:c(P),htmlTextData:E,image:c(I),label:V,labelText:$,lineEnding:T,link:c(M),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:q,resourceDestinationString:R,resourceTitleString:Q,resource:U,setextHeading:c(S),setextHeadingLineSequence:_,setextHeadingText:N,strong:c(),thematicBreak:c()}};xce(t,(e||{}).mdastExtensions||[]);const r={};return s;function s(be){let ue={type:"root",children:[]};const Ee={stack:[ue],tokenStack:[],config:t,enter:l,exit:d,buffer:o,resume:u,data:r},De=[];let Ge=-1;for(;++Ge<be.length;)if(be[Ge][1].type==="listOrdered"||be[Ge][1].type==="listUnordered")if(be[Ge][0]==="enter")De.push(Ge);else{const Ye=De.pop();Ge=a(be,Ye,Ge)}for(Ge=-1;++Ge<be.length;){const Ye=t[be[Ge][0]];gce.call(Ye,be[Ge][1].type)&&Ye[be[Ge][1].type].call(Object.assign({sliceSerialize:be[Ge][2].sliceSerialize},Ee),be[Ge][1])}if(Ee.tokenStack.length>0){const Ye=Ee.tokenStack[Ee.tokenStack.length-1];(Ye[1]||tG).call(Ee,void 0,Ye[0])}for(ue.position={start:ch(be.length>0?be[0][1].start:{line:1,column:1,offset:0}),end:ch(be.length>0?be[be.length-2][1].end:{line:1,column:1,offset:0})},Ge=-1;++Ge<t.transforms.length;)ue=t.transforms[Ge](ue)||ue;return ue}function a(be,ue,Ee){let De=ue-1,Ge=-1,Ye=!1,Tt,Nt,Pt,_t;for(;++De<=Ee;){const zt=be[De];switch(zt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{zt[0]==="enter"?Ge++:Ge--,_t=void 0;break}case"lineEndingBlank":{zt[0]==="enter"&&(Tt&&!_t&&!Ge&&!Pt&&(Pt=De),_t=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:_t=void 0}if(!Ge&&zt[0]==="enter"&&zt[1].type==="listItemPrefix"||Ge===-1&&zt[0]==="exit"&&(zt[1].type==="listUnordered"||zt[1].type==="listOrdered")){if(Tt){let vt=De;for(Nt=void 0;vt--;){const vr=be[vt];if(vr[1].type==="lineEnding"||vr[1].type==="lineEndingBlank"){if(vr[0]==="exit")continue;Nt&&(be[Nt][1].type="lineEndingBlank",Ye=!0),vr[1].type="lineEnding",Nt=vt}else if(!(vr[1].type==="linePrefix"||vr[1].type==="blockQuotePrefix"||vr[1].type==="blockQuotePrefixWhitespace"||vr[1].type==="blockQuoteMarker"||vr[1].type==="listItemIndent"))break}Pt&&(!Nt||Pt<Nt)&&(Tt._spread=!0),Tt.end=Object.assign({},Nt?be[Nt][1].start:zt[1].end),be.splice(Nt||De,0,["exit",Tt,zt[2]]),De++,Ee++}if(zt[1].type==="listItemPrefix"){const vt={type:"listItem",_spread:!1,start:Object.assign({},zt[1].start),end:void 0};Tt=vt,be.splice(De,0,["enter",vt,zt[2]]),De++,Ee++,Pt=void 0,_t=!0}}}return be[ue][1]._spread=Ye,Ee}function i(be,ue){return Ee;function Ee(De){l.call(this,be(De),De),ue&&ue.call(this,De)}}function o(){this.stack.push({type:"fragment",children:[]})}function l(be,ue,Ee){this.stack[this.stack.length-1].children.push(be),this.stack.push(be),this.tokenStack.push([ue,Ee||void 0]),be.position={start:ch(ue.start),end:void 0}}function c(be){return ue;function ue(Ee){be&&be.call(this,Ee),d.call(this,Ee)}}function d(be,ue){const Ee=this.stack.pop(),De=this.tokenStack.pop();if(De)De[0].type!==be.type&&(ue?ue.call(this,be,De[0]):(De[1]||tG).call(this,be,De[0]));else throw new Error("Cannot close `"+be.type+"` ("+Uv({start:be.start,end:be.end})+"): it’s not open");Ee.position.end=ch(be.end)}function u(){return _xt(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function m(be){if(this.data.expectingFirstListItemValue){const ue=this.stack[this.stack.length-2];ue.start=Number.parseInt(this.sliceSerialize(be),10),this.data.expectingFirstListItemValue=void 0}}function f(){const be=this.resume(),ue=this.stack[this.stack.length-1];ue.lang=be}function p(){const be=this.resume(),ue=this.stack[this.stack.length-1];ue.meta=be}function A(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function v(){const be=this.resume(),ue=this.stack[this.stack.length-1];ue.value=be.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function x(){const be=this.resume(),ue=this.stack[this.stack.length-1];ue.value=be.replace(/(\r?\n|\r)$/g,"")}function b(be){const ue=this.resume(),Ee=this.stack[this.stack.length-1];Ee.label=ue,Ee.identifier=KA(this.sliceSerialize(be)).toLowerCase()}function y(){const be=this.resume(),ue=this.stack[this.stack.length-1];ue.title=be}function w(){const be=this.resume(),ue=this.stack[this.stack.length-1];ue.url=be}function j(be){const ue=this.stack[this.stack.length-1];if(!ue.depth){const Ee=this.sliceSerialize(be).length;ue.depth=Ee}}function N(){this.data.setextHeadingSlurpLineEnding=!0}function _(be){const ue=this.stack[this.stack.length-1];ue.depth=this.sliceSerialize(be).codePointAt(0)===61?1:2}function S(){this.data.setextHeadingSlurpLineEnding=void 0}function C(be){const Ee=this.stack[this.stack.length-1].children;let De=Ee[Ee.length-1];(!De||De.type!=="text")&&(De=Pe(),De.position={start:ch(be.start),end:void 0},Ee.push(De)),this.stack.push(De)}function E(be){const ue=this.stack.pop();ue.value+=this.sliceSerialize(be),ue.position.end=ch(be.end)}function T(be){const ue=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Ee=ue.children[ue.children.length-1];Ee.position.end=ch(be.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ue.type)&&(C.call(this,be),E.call(this,be))}function B(){this.data.atHardBreak=!0}function L(){const be=this.resume(),ue=this.stack[this.stack.length-1];ue.value=be}function P(){const be=this.resume(),ue=this.stack[this.stack.length-1];ue.value=be}function F(){const be=this.resume(),ue=this.stack[this.stack.length-1];ue.value=be}function M(){const be=this.stack[this.stack.length-1];if(this.data.inReference){const ue=this.data.referenceType||"shortcut";be.type+="Reference",be.referenceType=ue,delete be.url,delete be.title}else delete be.identifier,delete be.label;this.data.referenceType=void 0}function I(){const be=this.stack[this.stack.length-1];if(this.data.inReference){const ue=this.data.referenceType||"shortcut";be.type+="Reference",be.referenceType=ue,delete be.url,delete be.title}else delete be.identifier,delete be.label;this.data.referenceType=void 0}function $(be){const ue=this.sliceSerialize(be),Ee=this.stack[this.stack.length-2];Ee.label=Nbt(ue),Ee.identifier=KA(ue).toLowerCase()}function V(){const be=this.stack[this.stack.length-1],ue=this.resume(),Ee=this.stack[this.stack.length-1];if(this.data.inReference=!0,Ee.type==="link"){const De=be.children;Ee.children=De}else Ee.alt=ue}function R(){const be=this.resume(),ue=this.stack[this.stack.length-1];ue.url=be}function Q(){const be=this.resume(),ue=this.stack[this.stack.length-1];ue.title=be}function U(){this.data.inReference=void 0}function D(){this.data.referenceType="collapsed"}function q(be){const ue=this.resume(),Ee=this.stack[this.stack.length-1];
vendor: 11,154 bytes, lines 2086-2090
2086Ee.label=ue,Ee.identifier=KA(this.sliceSerialize(be)).toLowerCase(),this.data.referenceType="full"}function G(be){this.data.characterReferenceType=be.type}function Y(be){const ue=this.sliceSerialize(be),Ee=this.data.characterReferenceType;let De;Ee?(De=oce(ue,Ee==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):De=UL(ue);const Ge=this.stack[this.stack.length-1];Ge.value+=De}function K(be){const ue=this.stack.pop();ue.position.end=ch(be.end)}function X(be){E.call(this,be);const ue=this.stack[this.stack.length-1];ue.url=this.sliceSerialize(be)}function ne(be){E.call(this,be);const ue=this.stack[this.stack.length-1];ue.url="mailto:"+this.sliceSerialize(be)}function ae(){return{type:"blockquote",children:[]}}function J(){return{type:"code",lang:null,meta:null,value:""}}function W(){return{type:"inlineCode",value:""}}function ie(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function he(){return{type:"emphasis",children:[]}}function ee(){return{type:"heading",depth:0,children:[]}}function xe(){return{type:"break"}}function we(){return{type:"html",value:""}}function Se(){return{type:"image",title:null,url:"",alt:null}}function pe(){return{type:"link",title:null,url:"",children:[]}}function Ce(be){return{type:"list",ordered:be.type==="listOrdered",start:null,spread:be._spread,children:[]}}function re(be){return{type:"listItem",spread:be._spread,checked:null,children:[]}}function se(){return{type:"paragraph",children:[]}}function Ae(){return{type:"strong",children:[]}}function Pe(){return{type:"text",value:""}}function Oe(){return{type:"thematicBreak"}}}function ch(e){return{line:e.line,column:e.column,offset:e.offset}}function xce(e,t){let r=-1;for(;++r<t.length;){const s=t[r];Array.isArray(s)?xce(e,s):kbt(e,s)}}function kbt(e,t){let r;for(r in t)if(gce.call(t,r))switch(r){case"canContainEols":{const s=t[r];s&&e[r].push(...s);break}case"transforms":{const s=t[r];s&&e[r].push(...s);break}case"enter":case"exit":{const s=t[r];s&&Object.assign(e[r],s);break}}}function tG(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Uv({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Uv({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Uv({start:t.start,end:t.end})+") is still open")}function Ebt(e){const t=this;t.parser=r;function r(s){return Cbt(s,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function Bbt(e,t){const r={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,r),e.applyData(t,r)}function Tbt(e,t){const r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,r),[e.applyData(t,r),{type:"text",value:`
2087`}]}function Pbt(e,t){const r=t.value?t.value+`
2088`:"",s={},a=t.lang?t.lang.split(/\s+/):[];a.length>0&&(s.className=["language-"+a[0]]);let i={type:"element",tagName:"code",properties:s,children:[{type:"text",value:r}]};return t.meta&&(i.data={meta:t.meta}),e.patch(t,i),i=e.applyData(t,i),i={type:"element",tagName:"pre",properties:{},children:[i]},e.patch(t,i),i}function Ibt(e,t){const r={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Obt(e,t){const r={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Fbt(e,t){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(t.identifier).toUpperCase(),a=O0(s.toLowerCase()),i=e.footnoteOrder.indexOf(s);let o,l=e.footnoteCounts.get(s);l===void 0?(l=0,e.footnoteOrder.push(s),o=e.footnoteOrder.length):o=i+1,l+=1,e.footnoteCounts.set(s,l);const c={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+a,id:r+"fnref-"+a+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(t,c);const d={type:"element",tagName:"sup",properties:{},children:[c]};return e.patch(t,d),e.applyData(t,d)}function Lbt(e,t){const r={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Dbt(e,t){if(e.options.allowDangerousHtml){const r={type:"raw",value:t.value};return e.patch(t,r),e.applyData(t,r)}}function vce(e,t){const r=t.referenceType;let s="]";if(r==="collapsed"?s+="[]":r==="full"&&(s+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+s}];const a=e.all(t),i=a[0];i&&i.type==="text"?i.value="["+i.value:a.unshift({type:"text",value:"["});const o=a[a.length-1];return o&&o.type==="text"?o.value+=s:a.push({type:"text",value:s}),a}function Rbt(e,t){const r=String(t.identifier).toUpperCase(),s=e.definitionById.get(r);if(!s)return vce(e,t);const a={src:O0(s.url||""),alt:t.alt};s.title!==null&&s.title!==void 0&&(a.title=s.title);const i={type:"element",tagName:"img",properties:a,children:[]};return e.patch(t,i),e.applyData(t,i)}function Ubt(e,t){const r={src:O0(t.url)};t.alt!==null&&t.alt!==void 0&&(r.alt=t.alt),t.title!==null&&t.title!==void 0&&(r.title=t.title);const s={type:"element",tagName:"img",properties:r,children:[]};return e.patch(t,s),e.applyData(t,s)}function Mbt(e,t){const r={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,r);const s={type:"element",tagName:"code",properties:{},children:[r]};return e.patch(t,s),e.applyData(t,s)}function $bt(e,t){const r=String(t.identifier).toUpperCase(),s=e.definitionById.get(r);if(!s)return vce(e,t);const a={href:O0(s.url||"")};s.title!==null&&s.title!==void 0&&(a.title=s.title);const i={type:"element",tagName:"a",properties:a,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function Qbt(e,t){const r={href:O0(t.url)};t.title!==null&&t.title!==void 0&&(r.title=t.title);const s={type:"element",tagName:"a",properties:r,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function Hbt(e,t,r){const s=e.all(t),a=r?zbt(r):bce(t),i={},o=[];if(typeof t.checked=="boolean"){const u=s[0];let h;u&&u.type==="element"&&u.tagName==="p"?h=u:(h={type:"element",tagName:"p",properties:{},children:[]},s.unshift(h)),h.children.length>0&&h.children.unshift({type:"text",value:" "}),h.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let l=-1;for(;++l<s.length;){const u=s[l];(a||l!==0||u.type!=="element"||u.tagName!=="p")&&o.push({type:"text",value:`
2089`}),u.type==="element"&&u.tagName==="p"&&!a?o.push(...u.children):o.push(u)}const c=s[s.length-1];c&&(a||c.type!=="element"||c.tagName!=="p")&&o.push({type:"text",value:`
2090`});const d={type:"element",tagName:"li",properties:i,children:o};return e.patch(t,d),e.applyData(t,d)}function zbt(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const r=e.children;let s=-1;for(;!t&&++s<r.length;)t=bce(r[s])}return t}function bce(e){const t=e.spread;return t??e.children.length>1}function Vbt(e,t){const r={},s=e.all(t);let a=-1;for(typeof t.start=="number"&&t.start!==1&&(r.start=t.start);++a<s.length;){const o=s[a];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){r.className=["contains-task-list"];break}}const i={type:"element",tagName:t.ordered?"ol":"ul",properties:r,children:e.wrap(s,!0)};return e.patch(t,i),e.applyData(t,i)}function Gbt(e,t){const r={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function qbt(e,t){const r={type:"root",children:e.wrap(e.all(t))};return e.patch(t,r),e.applyData(t,r)}function Kbt(e,t){const r={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Wbt(e,t){const r=e.all(t),s=r.shift(),a=[];if(s){const o={type:"element",tagName:"thead",properties:{},children:e.wrap([s],!0)};e.patch(t.children[0],o),a.push(o)}if(r.length>0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(r,!0)},l=FL(t.children[1]),c=ece(t.children[t.children.length-1]);l&&c&&(o.position={start:l,end:c}),a.push(o)}const i={type:"element",tagName:"table",properties:{},children:e.wrap(a,!0)};return e.patch(t,i),e.applyData(t,i)}function Ybt(e,t,r){const s=r?r.children:void 0,i=(s?s.indexOf(t):1)===0?"th":"td",o=r&&r.type==="table"?r.align:void 0,l=o?o.length:t.children.length;let c=-1;const d=[];for(;++c<l;){const h=t.children[c],m={},f=o?o[c]:void 0;f&&(m.align=f);let p={type:"element",tagName:i,properties:m,children:[]};h&&(p.children=e.all(h),e.patch(h,p),p=e.applyData(h,p)),d.push(p)}const u={type:"element",tagName:"tr",properties:{},children:e.wrap(d,!0)};return e.patch(t,u),e.applyData(t,u)}function Jbt(e,t){const r={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}const rG=9,nG=32;function Xbt(e){const t=String(e),r=/\r?\n|\r/g;let s=r.exec(t),a=0;const i=[];for(;s;)i.push(sG(t.slice(a,s.index),a>0,!0),s[0]),a=s.index+s[0].length,s=r.exec(t);return i.push(sG(t.slice(a),a>0,!1)),i.join("")}function sG(e,t,r){let s=0,a=e.length;if(t){let i=e.codePointAt(s);for(;i===rG||i===nG;)s++,i=e.codePointAt(s)}if(r){let i=e.codePointAt(a-1);for(;i===rG||i===nG;)a--,i=e.codePointAt(a-1)}return a>s?e.slice(s,a):""}function Zbt(e,t){const r={type:"text",value:Xbt(String(t.value))};return e.patch(t,r),e.applyData(t,r)}function eyt(e,t){const r={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,r),e.applyData(t,r)}const tyt={blockquote:Bbt,break:Tbt,code:Pbt,delete:Ibt,emphasis:Obt,footnoteReference:Fbt,heading:Lbt,html:Dbt,imageReference:Rbt,image:Ubt,inlineCode:Mbt,linkReference:$bt,link:Qbt,listItem:Hbt,list:Vbt,paragraph:Gbt,root:qbt,strong:Kbt,table:Wbt,tableCell:Jbt,tableRow:Ybt,text:Zbt,thematicBreak:eyt,toml:mj,yaml:mj,definition:mj,footnoteDefinition:mj};function mj(){}const yce=-1,Sk=0,$v=1,E_=2,QL=3,HL=4,zL=5,VL=6,wce=7,jce=8,aG=typeof self=="object"?self:globalThis,ryt=(e,t)=>{const r=(a,i)=>(e.set(i,a),a),s=a=>{if(e.has(a))return e.get(a);const[i,o]=t[a];switch(i){case Sk:case yce:return r(o,a);case $v:{const l=r([],a);for(const c of o)l.push(s(c));return l}case E_:{const l=r({},a);for(const[c,d]of o)l[s(c)]=s(d);return l}case QL:return r(new Date(o),a);case HL:{const{source:l,flags:c}=o;return r(new RegExp(l,c),a)}case zL:{const l=r(new Map,a);for(const[c,d]of o)l.set(s(c),s(d));return l}case VL:{const l=r(new Set,a);for(const c of o)l.add(s(c));return l}case wce:{const{name:l,message:c}=o;return r(new aG[l](c),a)}case jce:return r(BigInt(o),a);case"BigInt":return r(Object(BigInt(o)),a);case"ArrayBuffer":return r(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:l}=new Uint8Array(o);return r(new DataView(l),o)}}return r(new aG[i](o),a)};return s},iG=e=>ryt(new Map,e)(0),eA="",{toString:nyt}={},{keys:syt}=Object,Ux=e=>{const t=typeof e;if(t!=="object"||!e)return[Sk,t];const r=nyt.call(e).slice(8,-1);switch(r){case"Array":return[$v,eA];case"Object":return[E_,eA];case"Date":return[QL,eA];case"RegExp":return[HL,eA];case"Map":return[zL,eA];case"Set":return[VL,eA];case"DataView":return[$v,r]}
vendor: 4,665 bytes, lines 2090-2092
2090return r.includes("Array")?[$v,r]:r.includes("Error")?[wce,r]:[E_,r]},pj=([e,t])=>e===Sk&&(t==="function"||t==="symbol"),ayt=(e,t,r,s)=>{const a=(o,l)=>{const c=s.push(o)-1;return r.set(l,c),c},i=o=>{if(r.has(o))return r.get(o);let[l,c]=Ux(o);switch(l){case Sk:{let u=o;switch(c){case"bigint":l=jce,u=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);u=null;break;case"undefined":return a([yce],o)}return a([l,u],o)}case $v:{if(c){let m=o;return c==="DataView"?m=new Uint8Array(o.buffer):c==="ArrayBuffer"&&(m=new Uint8Array(o)),a([c,[...m]],o)}const u=[],h=a([l,u],o);for(const m of o)u.push(i(m));return h}case E_:{if(c)switch(c){case"BigInt":return a([c,o.toString()],o);case"Boolean":case"Number":case"String":return a([c,o.valueOf()],o)}if(t&&"toJSON"in o)return i(o.toJSON());const u=[],h=a([l,u],o);for(const m of syt(o))(e||!pj(Ux(o[m])))&&u.push([i(m),i(o[m])]);return h}case QL:return a([l,o.toISOString()],o);case HL:{const{source:u,flags:h}=o;return a([l,{source:u,flags:h}],o)}case zL:{const u=[],h=a([l,u],o);for(const[m,f]of o)(e||!(pj(Ux(m))||pj(Ux(f))))&&u.push([i(m),i(f)]);return h}case VL:{const u=[],h=a([l,u],o);for(const m of o)(e||!pj(Ux(m)))&&u.push(i(m));return h}}const{message:d}=o;return a([l,{name:c,message:d}],o)};return i},oG=(e,{json:t,lossy:r}={})=>{const s=[];return ayt(!(t||r),!!t,new Map,s)(e),s},B_=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?iG(oG(e,t)):structuredClone(e):(e,t)=>iG(oG(e,t));function iyt(e,t){const r=[{type:"text",value:"↩"}];return t>1&&r.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),r}function oyt(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function lyt(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=e.options.footnoteBackContent||iyt,s=e.options.footnoteBackLabel||oyt,a=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let c=-1;for(;++c<e.footnoteOrder.length;){const d=e.footnoteById.get(e.footnoteOrder[c]);if(!d)continue;const u=e.all(d),h=String(d.identifier).toUpperCase(),m=O0(h.toLowerCase());let f=0;const p=[],A=e.footnoteCounts.get(h);for(;A!==void 0&&++f<=A;){p.length>0&&p.push({type:"text",value:" "});let b=typeof r=="string"?r:r(c,f);typeof b=="string"&&(b={type:"text",value:b}),p.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+m+(f>1?"-"+f:""),dataFootnoteBackref:"",ariaLabel:typeof s=="string"?s:s(c,f),className:["data-footnote-backref"]},children:Array.isArray(b)?b:[b]})}const v=u[u.length-1];if(v&&v.type==="element"&&v.tagName==="p"){const b=v.children[v.children.length-1];b&&b.type==="text"?b.value+=" ":v.children.push({type:"text",value:" "}),v.children.push(...p)}else u.push(...p);const x={type:"element",tagName:"li",properties:{id:t+"fn-"+m},children:e.wrap(u,!0)};e.patch(d,x),l.push(x)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...B_(o),id:"footnote-label"},children:[{type:"text",value:a}]},{type:"text",value:`
2091`},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:`
2092`}]}}const Nce=function(e){if(e==null)return hyt;if(typeof e=="function")return kk(e);if(typeof e=="object")return Array.isArray(e)?cyt(e):dyt(e);if(typeof e=="string")return uyt(e);throw new Error("Expected function, string, or object as test")};function cyt(e){const t=[];let r=-1;for(;++r<e.length;)t[r]=Nce(e[r]);return kk(s);function s(...a){let i=-1;for(;++i<t.length;)if(t[i].apply(this,a))return!0;return!1}}function dyt(e){const t=e;return kk(r);function r(s){const a=s;let i;for(i in e)if(a[i]!==t[i])return!1;return!0}}function uyt(e){return kk(t);function t(r){return r&&r.type===e}}function kk(e){return t;function t(r,s,a){return!!(fyt(r)&&e.call(this,r,typeof s=="number"?s:void 0,a||void 0))}}function hyt(){return!0}function fyt(e){return e!==null&&typeof e=="object"&&"type"in e}const _ce=[],myt=!0,lG=!1,pyt="skip";function Ayt(e,t,r,s){let a;typeof t=="function"&&typeof r!="function"?(s=r,r=t):a=t;const i=Nce(a),o=s?-1:1;l(e,void 0,[])();function l(c,d,u){const h=c&&typeof c=="object"?c:{};if(typeof h.type=="string"){const f=typeof h.tagName=="string"?h.tagName:typeof h.name=="string"?h.name:void 0;Object.defineProperty(m,"name",{value:"node ("+(c.type+(f?"<"+f+">":""))+")"})}return m;function m(){let f=_ce,p,A,v;if((!t||i(c,d,u[u.length-1]||void 0))&&(f=gyt(r(c,u)),f[0]===lG))return f;if("children"in c&&c.children){const x=c;
vendor: 17,518 bytes, lines 2092-2096
2092if(x.children&&f[0]!==pyt)for(A=(s?x.children.length:-1)+o,v=u.concat(x);A>-1&&A<x.children.length;){const b=x.children[A];if(p=l(b,A,v)(),p[0]===lG)return p;A=typeof p[1]=="number"?p[1]:A+o}}return f}}}function gyt(e){return Array.isArray(e)?e:typeof e=="number"?[myt,e]:e==null?_ce:[e]}function Cce(e,t,r,s){let a,i,o;typeof t=="function"&&typeof r!="function"?(i=void 0,o=t,a=r):(i=t,o=r,a=s),Ayt(e,i,l,a);function l(c,d){const u=d[d.length-1],h=u?u.children.indexOf(c):void 0;return o(c,h,u)}}const lI={}.hasOwnProperty,xyt={};function vyt(e,t){const r=t||xyt,s=new Map,a=new Map,i=new Map,o={...tyt,...r.handlers},l={all:d,applyData:yyt,definitionById:s,footnoteById:a,footnoteCounts:i,footnoteOrder:[],handlers:o,one:c,options:r,patch:byt,wrap:jyt};return Cce(e,function(u){if(u.type==="definition"||u.type==="footnoteDefinition"){const h=u.type==="definition"?s:a,m=String(u.identifier).toUpperCase();h.has(m)||h.set(m,u)}}),l;function c(u,h){const m=u.type,f=l.handlers[m];if(lI.call(l.handlers,m)&&f)return f(l,u,h);if(l.options.passThrough&&l.options.passThrough.includes(m)){if("children"in u){const{children:A,...v}=u,x=B_(v);return x.children=l.all(u),x}return B_(u)}return(l.options.unknownHandler||wyt)(l,u,h)}function d(u){const h=[];if("children"in u){const m=u.children;let f=-1;for(;++f<m.length;){const p=l.one(m[f],u);if(p){if(f&&m[f-1].type==="break"&&(!Array.isArray(p)&&p.type==="text"&&(p.value=cG(p.value)),!Array.isArray(p)&&p.type==="element")){const A=p.children[0];A&&A.type==="text"&&(A.value=cG(A.value))}Array.isArray(p)?h.push(...p):h.push(p)}}}return h}}function byt(e,t){e.position&&(t.position=nxt(e))}function yyt(e,t){let r=t;if(e&&e.data){const s=e.data.hName,a=e.data.hChildren,i=e.data.hProperties;if(typeof s=="string")if(r.type==="element")r.tagName=s;else{const o="children"in r?r.children:[r];r={type:"element",tagName:s,properties:{},children:o}}r.type==="element"&&i&&Object.assign(r.properties,B_(i)),"children"in r&&r.children&&a!==null&&a!==void 0&&(r.children=a)}return r}function wyt(e,t){const r=t.data||{},s="value"in t&&!(lI.call(r,"hProperties")||lI.call(r,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function jyt(e,t){const r=[];let s=-1;for(t&&r.push({type:"text",value:`
2093`});++s<e.length;)s&&r.push({type:"text",value:`
2094`}),r.push(e[s]);return t&&e.length>0&&r.push({type:"text",value:`
2095`}),r}function cG(e){let t=0,r=e.charCodeAt(t);for(;r===9||r===32;)t++,r=e.charCodeAt(t);return e.slice(t)}function dG(e,t){const r=vyt(e,t),s=r.one(e,void 0),a=lyt(r),i=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return a&&i.children.push({type:"text",value:`
2096`},a),i}function Nyt(e,t){return e&&"run"in e?async function(r,s){const a=dG(r,{file:s,...t});await e.run(a,s)}:function(r,s){return dG(r,{file:s,...e||t})}}function uG(e){if(e)throw e}var Wj=Object.prototype.hasOwnProperty,Sce=Object.prototype.toString,hG=Object.defineProperty,fG=Object.getOwnPropertyDescriptor,mG=function(t){return typeof Array.isArray=="function"?Array.isArray(t):Sce.call(t)==="[object Array]"},pG=function(t){if(!t||Sce.call(t)!=="[object Object]")return!1;var r=Wj.call(t,"constructor"),s=t.constructor&&t.constructor.prototype&&Wj.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!r&&!s)return!1;var a;for(a in t);return typeof a>"u"||Wj.call(t,a)},AG=function(t,r){hG&&r.name==="__proto__"?hG(t,r.name,{enumerable:!0,configurable:!0,value:r.newValue,writable:!0}):t[r.name]=r.newValue},gG=function(t,r){if(r==="__proto__")if(Wj.call(t,r)){if(fG)return fG(t,r).value}else return;return t[r]},_yt=function e(){var t,r,s,a,i,o,l=arguments[0],c=1,d=arguments.length,u=!1;for(typeof l=="boolean"&&(u=l,l=arguments[1]||{},c=2),(l==null||typeof l!="object"&&typeof l!="function")&&(l={});c<d;++c)if(t=arguments[c],t!=null)for(r in t)s=gG(l,r),a=gG(t,r),l!==a&&(u&&a&&(pG(a)||(i=mG(a)))?(i?(i=!1,o=s&&mG(s)?s:[]):o=s&&pG(s)?s:{},AG(l,{name:r,newValue:e(u,o,a)})):typeof a<"u"&&AG(l,{name:r,newValue:a}));return l};const L4=wn(_yt);function cI(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function Cyt(){const e=[],t={run:r,use:s};return t;function r(...a){let i=-1;const o=a.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);l(null,...a);function l(c,...d){const u=e[++i];let h=-1;if(c){o(c);return}for(;++h<a.length;)(d[h]===null||d[h]===void 0)&&(d[h]=a[h]);a=d,u?Syt(u,l)(...d):o(null,...d)}}function s(a){if(typeof a!="function")throw new TypeError("Expected `middelware` to be a function, not "+a);return e.push(a),t}}function Syt(e,t){let r;return s;function s(...o){const l=e.length>o.length;let c;l&&o.push(a);try{c=e.apply(this,o)}catch(d){const u=d;if(l&&r)throw u;return a(u)}l||(c&&c.then&&typeof c.then=="function"?c.then(i,a):c instanceof Error?a(c):i(c))}function a(o,...l){r||(r=!0,t(o,...l))}function i(o){a(null,o)}}const Yc={basename:kyt,dirname:Eyt,extname:Byt,join:Tyt,sep:"/"};function kyt(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');ow(e);let r=0,s=-1,a=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;a--;)if(e.codePointAt(a)===47){if(i){r=a+1;break}}else s<0&&(i=!0,s=a+1);return s<0?"":e.slice(r,s)}if(t===e)return"";let o=-1,l=t.length-1;for(;a--;)if(e.codePointAt(a)===47){if(i){r=a+1;break}}else o<0&&(i=!0,o=a+1),l>-1&&(e.codePointAt(a)===t.codePointAt(l--)?l<0&&(s=a):(l=-1,s=o));return r===s?s=o:s<0&&(s=e.length),e.slice(r,s)}function Eyt(e){if(ow(e),e.length===0)return".";let t=-1,r=e.length,s;for(;--r;)if(e.codePointAt(r)===47){if(s){t=r;break}}else s||(s=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function Byt(e){ow(e);let t=e.length,r=-1,s=0,a=-1,i=0,o;for(;t--;){const l=e.codePointAt(t);if(l===47){if(o){s=t+1;break}continue}r<0&&(o=!0,r=t+1),l===46?a<0?a=t:i!==1&&(i=1):a>-1&&(i=-1)}return a<0||r<0||i===0||i===1&&a===r-1&&a===s+1?"":e.slice(a,r)}function Tyt(...e){let t=-1,r;for(;++t<e.length;)ow(e[t]),e[t]&&(r=r===void 0?e[t]:r+"/"+e[t]);return r===void 0?".":Pyt(r)}function Pyt(e){ow(e);const t=e.codePointAt(0)===47;let r=Iyt(e,!t);return r.length===0&&!t&&(r="."),r.length>0&&e.codePointAt(e.length-1)===47&&(r+="/"),t?"/"+r:r}function Iyt(e,t){let r="",s=0,a=-1,i=0,o=-1,l,c;for(;++o<=e.length;){if(o<e.length)l=e.codePointAt(o);else{if(l===47)break;l=47}if(l===47){if(!(a===o-1||i===1))if(a!==o-1&&i===2){if(r.length<2||s!==2||r.codePointAt(r.length-1)!==46||r.codePointAt(r.length-2)!==46){if(r.length>2){if(c=r.lastIndexOf("/"),c!==r.length-1){c<0?(r="",s=0):(r=r.slice(0,c),s=r.length-1-r.lastIndexOf("/")),a=o,i=0;continue}}else if(r.length>0){r="",s=0,a=o,i=0;continue}}t&&(r=r.length>0?r+"/..":"..",s=2)}else r.length>0?r+="/"+e.slice(a+1,o):r=e.slice(a+1,o),s=o-a-1;a=o,i=0}else l===46&&i>-1?i++:i=-1}return r}function ow(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Oyt={cwd:Fyt};function Fyt(){return"/"}function dI(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function Lyt(e){if(typeof e=="string")e=new URL(e);else if(!dI(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return Dyt(e)}function Dyt(e){if(e.hostname!==""){const s=new TypeError('File URL host must be "localhost" or empty on darwin');throw s.code="ERR_INVALID_FILE_URL_HOST",s}const t=e.pathname;let r=-1;for(;++r<t.length;)if(t.codePointAt(r)===37&&t.codePointAt(r+1)===50){const s=t.codePointAt(r+2);if(s===70||s===102){const a=new TypeError("File URL path must not include encoded / characters");throw a.code="ERR_INVALID_FILE_URL_PATH",a}}return decodeURIComponent(t)}const D4=["history","path","basename","stem","extname","dirname"];class kce{constructor(t){let r;t?dI(t)?r={path:t}:typeof t=="string"||Ryt(t)?r={value:t}:r=t:r={},this.cwd="cwd"in r?"":Oyt.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<D4.length;){const i=D4[s];i in r&&r[i]!==void 0&&r[i]!==null&&(this[i]=i==="history"?[...r[i]]:r[i])}let a;for(a in r)D4.includes(a)||(this[a]=r[a])}get basename(){return typeof this.path=="string"?Yc.basename(this.path):void 0}set basename(t){U4(t,"basename"),R4(t,"basename"),this.path=Yc.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Yc.dirname(this.path):void 0}set dirname(t){xG(this.basename,"dirname"),this.path=Yc.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Yc.extname(this.path):void 0}set extname(t){if(R4(t,"extname"),xG(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Yc.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){dI(t)&&(t=Lyt(t)),U4(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Yc.basename(this.path,this.extname):void 0}set stem(t){U4(t,"stem"),R4(t,"stem"),this.path=Yc.join(this.dirname||"",t+(this.extname||""))}fail(t,r,s){const a=this.message(t,r,s);throw a.fatal=!0,a}info(t,r,s){const a=this.message(t,r,s);return a.fatal=void 0,a}message(t,r,s){const a=new Ti(t,r,s);return this.path&&(a.name=this.path+":"+a.name,a.file=this.path),a.fatal=!1,this.messages.push(a),a}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function R4(e,t){if(e&&e.includes(Yc.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Yc.sep+"`")}function U4(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function xG(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function Ryt(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Uyt=function(e){const s=this.constructor.prototype,a=s[e],i=function(){return a.apply(i,arguments)};return Object.setPrototypeOf(i,s),i},Myt={}.hasOwnProperty;class GL extends Uyt{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=Cyt()}copy(){const t=new GL;let r=-1;for(;++r<this.attachers.length;){const s=this.attachers[r];t.use(...s)}return t.data(L4(!0,{},this.namespace)),t}data(t,r){return typeof t=="string"?arguments.length===2?(Q4("data",this.frozen),this.namespace[t]=r,this):Myt.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Q4("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[r,...s]=this.attachers[this.freezeIndex];if(s[0]===!1)continue;s[0]===!0&&(s[0]=void 0);const a=r.call(t,...s);typeof a=="function"&&this.transformers.use(a)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const r=Aj(t),s=this.parser||this.Parser;return M4("parse",s),s(String(r),r)}process(t,r){const s=this;return this.freeze(),M4("process",this.parser||this.Parser),$4("process",this.compiler||this.Compiler),r?a(void 0,r):new Promise(a);function a(i,o){const l=Aj(t),c=s.parse(l);s.run(c,l,function(u,h,m){if(u||!h||!m)return d(u);const f=h,p=s.stringify(f,m);Hyt(p)?m.value=p:m.result=p,d(u,m)});function d(u,h){u||!h?o(u):i?i(h):r(void 0,h)}}}processSync(t){let r=!1,s;return this.freeze(),M4("processSync",this.parser||this.Parser),$4("processSync",this.compiler||this.Compiler),this.process(t,a),bG("processSync","process",r),s;function a(i,o){r=!0,uG(i),s=o}}run(t,r,s){vG(t),this.freeze();const a=this.transformers;return!s&&typeof r=="function"&&(s=r,r=void 0),s?i(void 0,s):new Promise(i);function i(o,l){const c=Aj(r);a.run(t,c,d);function d(u,h,m){const f=h||t;u?l(u):o?o(f):s(void 0,f,m)}}}runSync(t,r){let s=!1,a;return this.run(t,r,i),bG("runSync","run",s),a;function i(o,l){uG(o),a=l,s=!0}}stringify(t,r){this.freeze();const s=Aj(r),a=this.compiler||this.Compiler;return $4("stringify",a),vG(t),a(t,s)}use(t,...r){const s=this.attachers,a=this.namespace;if(Q4("use",this.frozen),t!=null)if(typeof t=="function")c(t,r);else if(typeof t=="object")Array.isArray(t)?l(t):o(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(d){if(typeof d=="function")c(d,[]);else if(typeof d=="object")if(Array.isArray(d)){const[u,...h]=d;c(u,h)}else o(d);else throw new TypeError("Expected usable value, not `"+d+"`")}function o(d){if(!("plugins"in d)&&!("settings"in d))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");l(d.plugins),d.settings&&(a.settings=L4(!0,a.settings,d.settings))}function l(d){let u=-1;if(d!=null)if(Array.isArray(d))for(;++u<d.length;){const h=d[u];i(h)}else throw new TypeError("Expected a list of plugins, not `"+d+"`")}function c(d,u){let h=-1,m=-1;for(;++h<s.length;)if(s[h][0]===d){m=h;break}if(m===-1)s.push([d,...u]);else if(u.length>0){let[f,...p]=u;const A=s[m][1];cI(A)&&cI(f)&&(f=L4(!0,A,f)),s[m]=[d,f,...p]}}}}const $yt=new GL().freeze();function M4(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function $4(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Q4(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function vG(e){if(!cI(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function bG(e,t,r){if(!r)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Aj(e){return Qyt(e)?e:new kce(e)}function Qyt(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Hyt(e){return typeof e=="string"||zyt(e)}function zyt(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Vyt="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",yG=[],wG={allowDangerousHtml:!0},Gyt=/^(https?|ircs?|mailto|xmpp)$/i,qyt=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Kyt(e){const t=Wyt(e),r=Yyt(e);return Jyt(t.runSync(t.parse(r),r),e)}function Wyt(e){const t=e.rehypePlugins||yG,r=e.remarkPlugins||yG,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...wG}:wG;return $yt().use(Ebt).use(r).use(Nyt,s).use(t)}function Yyt(e){const t=e.children||"",r=new kce;return typeof t=="string"&&(r.value=t),r}function Jyt(e,t){const r=t.allowedElements,s=t.allowElement,a=t.components,i=t.disallowedElements,o=t.skipHtml,l=t.unwrapDisallowed,c=t.urlTransform||Xyt;for(const u of qyt)Object.hasOwn(t,u.from)&&(""+u.from+(u.to?"use `"+u.to+"` instead":"remove it")+Vyt+u.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),Cce(e,d),lxt(e,{Fragment:n.Fragment,components:a,ignoreInvalidStyle:!0,jsx:n.jsx,jsxs:n.jsxs,passKeys:!0,passNode:!0});function d(u,h,m){if(u.type==="raw"&&m&&typeof h=="number")return o?m.children.splice(h,1):m.children[h]={type:"text",value:u.value},h;if(u.type==="element"){let f;for(f in I4)if(Object.hasOwn(I4,f)&&Object.hasOwn(u.properties,f)){const p=u.properties[f],A=I4[f];(A===null||A.includes(u.tagName))&&(u.properties[f]=c(String(p||""),f,u))}}if(u.type==="element"){let f=r?!r.includes(u.tagName):i?i.includes(u.tagName):!1;if(!f&&s&&typeof h=="number"&&(f=!s(u,h,m)),f&&m&&typeof h=="number")return l&&u.children?m.children.splice(h,1,...u.children):m.children.splice(h,1),h}}}function Xyt(e){const t=e.indexOf(":"),r=e.indexOf("?"),s=e.indexOf("#"),a=e.indexOf("/");return t===-1||a!==-1&&t>a||r!==-1&&t>r||s!==-1&&t>s||Gyt.test(e.slice(0,t))?e:""}function Zyt({isOpen:e,onClose:t,title:r,content:s,isLoading:a}){const[i,o]=g.useState(!1);async function l(){try{await navigator.clipboard.writeText(s),o(!0),setTimeout(()=>
2096o(!1),2e3)}catch(c){console.error("[TrendAnalysisModal] Failed to copy to clipboard:",c)}}return n.jsx(Zt,{open:e,onOpenChange:c=>!c&&t(),children:n.jsxs(Jt,{className:"max-w-4xl max-h-[80vh] flex flex-col",children:[n.jsxs(_r,{children:[n.jsx(tr,{className:"flex items-center gap-2",children:r}),n.jsx(Hr,{children:"AI-generated analysis based on selected trends"})]}),n.jsx("div",{className:"flex-1 overflow-y-auto min-h-0 mt-2",children:a?n.jsxs("div",{className:"flex flex-col items-center justify-center h-48 gap-3 text-gray-500",children:[n.jsx(kt,{className:"h-8 w-8 animate-spin text-orange-500"}),n.jsx("p",{className:"text-sm",children:"Analyzing trends..."})]}):s?n.jsx("div",{className:"prose prose-sm max-w-none prose-headings:text-gray-800 prose-p:text-gray-700 prose-li:text-gray-700",children:n.jsx(Kyt,{children:s})}):n.jsx("div",{className:"text-center text-gray-400 py-12",children:"No analysis available yet."})}),!a&&s&&n.jsxs("div",{className:"flex justify-end gap-2 pt-3 border-t mt-3",children:[n.jsx(te,{variant:"outline",size:"sm",onClick:l,className:"gap-2",children:i?n.jsxs(n.Fragment,{children:[n.jsx(Gn,{className:"h-4 w-4 text-green-600"}),"Copied"]}):n.jsxs(n.Fragment,{children:[n.jsx(Cn,{className:"h-4 w-4"}),"Copy to Clipboard"]})}),n.jsx(te,{variant:"ghost",size:"sm",onClick:t,children:"Close"})]})]})})}const ewt=[25,50,100,250,500],twt=25,jG={search:"",viralityMin:0,viralityMax:10,enrichmentStatus:"all",dateFrom:"",dateTo:""},rwt=[{type:"macro-trends",label:"Identify Macro Trends"},{type:"startup-opportunities",label:"Find Startup Opportunities"},{type:"cluster-trends",label:"Cluster Trends"},{type:"competitive-gaps",label:"Find Competitive Gaps"}];function nwt(e){const t=new Date(e),s=new Date().getTime()-t.getTime(),a=Math.floor(s/(1e3*60*60*24));return a===0?"Today":a===1?"Yesterday":a<7?`${a}d ago`:a<30?`${Math.floor(a/7)}w ago`:t.toLocaleDateString()}function swt(e){return e===null?"text-gray-400":e>=7?"text-green-700 bg-green-100 px-2 py-0.5 rounded text-xs font-medium":e>=4?"text-yellow-700 bg-yellow-100 px-2 py-0.5 rounded text-xs font-medium":"text-red-700 bg-red-100 px-2 py-0.5 rounded text-xs font-medium"}function awt(e){switch(e){case"COMPLETED":return n.jsx(Be,{className:"bg-green-100 text-green-800",children:"Completed"});case"IN_PROGRESS":return n.jsx(Be,{className:"bg-blue-100 text-blue-800",children:"In Progress"});case"FAILED":return n.jsx(Be,{variant:"destructive",children:"Failed"});case"NONE":default:return n.jsx(Be,{variant:"secondary",children:"None"})}}function iwt(){var ne,ae;const[e,t]=g.useState(jG),[r,s]=g.useState([{id:"created_at",desc:!0}]),[a,i]=g.useState({}),[o,l]=g.useState(new Map),[c,d]=g.useState(new Set),[u,h]=g.useState(0),[m,f]=g.useState(twt),[p,A]=g.useState(!1),[v,x]=g.useState(""),b=((ne=r[0])==null?void 0:ne.id)??"created_at",y=((ae=r[0])==null?void 0:ae.desc)===!1?"asc":"desc",{trends:w,totalCount:j,isLoading:N,error:_}=n0t({...e,sortField:b,sortDir:y,page:u,pageSize:m}),{analyze:S,isAnalyzing:C,result:E,error:T,clearResult:B}=a0t(),L=g.useCallback(J=>{i(W=>{const ie=typeof J=="function"?J(W):J;return l(he=>{const ee=new Map(he),xe=new Map(w.map(we=>[we.id,we]));for(const we of Object.keys(ie))if(ie[we]){const Se=xe.get(we);Se&&ee.set(we,Se)}else ee.delete(we);for(const we of Array.from(ee.keys()))(!(we in ie)||!ie[we])&&ee.delete(we);return ee}),ie})},[w]),P=g.useMemo(()=>Object.keys(a).filter(J=>a[J]),[a]),F=g.useMemo(()=>{const J=new Map(w.map(W=>[W.id,W]));return P.map(W=>J.get(W)??o.get(W)).filter(W=>W!==void 0)},[P,w,o]),M=g.useMemo(()=>w.filter(J=>a[J.id]).length,[w,a]),I=g.useCallback(J=>{d(W=>{const ie=new Set(W);return ie.has(J)?ie.delete(J):ie.add(J),ie})},[]);function $(J){t(J),h(0),R()}function V(){t(jG),h(0),R()}function R(){i({}),l(new Map)}function Q(J){f(Number(J)),h(0)}function U(){c0t(F.map(J=>({id:J.id,name:J.name,trend:J.trend,trend_analysis:J.trend_analysis,virality_score:J.virality_score,virality_explanation:J.virality_explanation,primary_keyword:J.primary_keyword,longevity_in_days:J.longevity_in_days,comparable_trends:J.comparable_trends,business_opportunities_anal
2096ysis:J.business_opportunities_analysis,related_news_and_data:J.related_news_and_data,authoritative_urls:J.authoritative_urls,created_at:J.created_at,enrichment_status:J.enrichment_status})))}async function D(J,W){x(W),B(),A(!0),await S(J,P)}function q(J){const W=typeof J=="function"?J(r):J;s(W),h(0)}const G=g.useMemo(()=>[{id:"select",header:({table:J})=>n.jsx(Xo,{checked:J.getIsAllPageRowsSelected(),onCheckedChange:W=>J.toggleAllPageRowsSelected(!!W),"aria-label":"Select all"}),cell:({row:J})=>n.jsx(Xo,{checked:J.getIsSelected(),onCheckedChange:W=>J.toggleSelected(!!W),"aria-label":"Select row"}),enableSorting:!1},{accessorKey:"name",header:"Trend Name",enableSorting:!0,cell:({row:J})=>n.jsx("span",{className:"text-sm font-medium text-gray-800 max-w-[200px] truncate block",title:J.original.name,children:J.original.name})},{accessorKey:"trend",header:"Trend",enableSorting:!1,cell:({row:J})=>n.jsx("span",{className:"text-sm text-gray-600 max-w-[200px] truncate block",title:J.original.trend??"",children:J.original.trend??"—"})},{accessorKey:"virality_score",header:"Virality",enableSorting:!0,cell:({row:J})=>{const W=J.original.virality_score;return n.jsx("span",{className:swt(W),children:W!==null?W:"—"})}},{accessorKey:"longevity_in_days",header:"Longevity",enableSorting:!0,cell:({row:J})=>{const W=J.original.longevity_in_days;return n.jsx("span",{className:"text-sm text-gray-600",children:W!==null?`${W}d`:"—"})}},{accessorKey:"primary_keyword",header:"Keyword",enableSorting:!0,cell:({row:J})=>n.jsx("span",{className:"text-sm text-gray-700",children:J.original.primary_keyword??"—"})},{accessorKey:"enrichment_status",header:"Status",enableSorting:!0,cell:({row:J})=>awt(J.original.enrichment_status)},{accessorKey:"created_at",header:"Created",enableSorting:!0,cell:({row:J})=>n.jsx("span",{className:"text-xs text-gray-500",title:new Date(J.original.created_at).toLocaleString(),children:nwt(J.original.created_at)})},{id:"expand",header:"",enableSorting:!1,cell:({row:J})=>n.jsx(te,{variant:"ghost",size:"sm",onClick:()=>I(J.original.id),"aria-label":c.has(J.original.id)?"Collapse row":"Expand row",children:c.has(J.original.id)?n.jsx(Fu,{className:"h-4 w-4"}):n.jsx(Un,{className:"h-4 w-4"})})}],[c,I]),Y=NL({data:w,columns:G,getCoreRowModel:wL(),getSortedRowModel:jL(),getRowId:J=>J.id,state:{sorting:r,rowSelection:a},onSortingChange:q,onRowSelectionChange:L,enableRowSelection:!0,manualSorting:!0}),K=u*m+1,X=Math.min((u+1)*m,j);return n.jsxs("div",{className:"container mx-auto p-6 space-y-4",children:[n.jsx("div",{className:"bg-gradient-to-r from-orange-500 to-amber-600 rounded-2xl p-6 text-white",children:n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(sa,{className:"h-8 w-8"}),n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-bold",children:"Trend Navigator"}),n.jsx("p",{className:"text-orange-100",children:"Browse, filter, and analyze trends across all sources"})]})]})}),_&&n.jsx("div",{className:"bg-red-50 border border-red-200 rounded-lg p-4 text-red-700 text-sm",children:_}),n.jsx(u0t,{filters:e,onFiltersChange:$,onClearFilters:V}),P.length>0&&n.jsxs("div",{className:"bg-white rounded-xl border p-3 flex items-center gap-3 flex-wrap",children:[n.jsxs(Be,{variant:"secondary",className:"text-sm",children:[P.length," selected",P.length!==M&&n.jsxs("span",{className:"ml-1 text-gray-400",children:["(",M," on this page)"]})]}),n.jsxs(te,{variant:"ghost",size:"sm",onClick:R,className:"gap-1 text-gray-500 hover:text-gray-700",children:[n.jsx(kr,{className:"h-3 w-3"}),"Clear"]}),n.jsx("div",{className:"w-px h-6 bg-gray-200"}),n.jsxs(te,{variant:"outline",size:"sm",onClick:U,className:"gap-2",children:[n.jsx(Ad,{className:"h-4 w-4"}),"Export to Markdown"]}),n.jsxs(ll,{children:[n.jsx(cl,{asChild:!0,children:n.jsxs(te,{size:"sm",className:"bg-orange-500 hover:bg-orange-600 text-white gap-2",disabled:C,children:[C?n.jsx(kt,{className:"h-4 w-4 animate-spin"}):n.jsx(Gi,{className:"h-4 w-4"}),"AI Analysis",n.jsx(Un,{className:"h-3 w-3 ml-1"})]})}),n.jsx(fo,{align:"start",children:rwt.map(J=>n.jsx(Fr,{onClick:()=>D(J.type,J.label),children:J.label},J.type))})]})]}),N?n.jsxs("div",{className:"bg-white rounded-2xl border p-12 text-center text-gray-500",children:[n.jsx(kt,{className:"h-8 w-8 animate-spin mx-auto mb-3 text-orange-400"}),n.jsx("p",{children:"Loading trends..."})]}):w.length===0?n.jsxs("div",{className:"bg-white rounded-2xl border p-12 text-center text-gray-500",children:[n.jsx(sa,{className:"h-12 w-12 mx-auto mb-4 text-gray-300"}),n.jsx("p",{className:"text-lg font-medium",children:"No trends found"}),n.jsx("p",{className:"text-sm mt-1",children:"Try adjusting your filters"}),n.jsx(te,{variant:"outline",size:"sm",className:"mt-4",onClick:V,children:"Clear Filters"})]}):n.jsx("div",{className:"bg-white rounded-2xl border overflow-hidden",children:n.jsxs(po,{children:[n.jsx(Ao,{children:Y.getHeaderGroups().map(J=>n.jsx(Yr,{children:J.headers.map(W=>n.jsx($t,{className:W.column.getCanSort()?"cursor-pointer select-none hover:bg-gray-50":"",onClick:W.column.getToggleSortingHandler(),children:n.jsxs("div",{className:"flex items-center gap-1",children:[Yg(W.column.columnDef.header,W.getContext()),W.column.getCanSort()&&n.jsx("span",{className:"text-gray-400 text-xs",children:W.column.getIsSorted()==="asc"?"â
2096†‘":W.column.getIsSorted()==="desc"?"↓":""})]})},W.id))},J.id))}),n.jsx(go,{children:Y.getRowModel().rows.map(J=>n.jsxs(n.Fragment,{children:[n.jsx(Yr,{"data-state":J.getIsSelected()?"selected":void 0,children:J.getVisibleCells().map(W=>n.jsx(mt,{children:Yg(W.column.columnDef.cell,W.getContext())},W.id))},J.id),c.has(J.original.id)&&n.jsx(Yr,{children:n.jsx(mt,{colSpan:G.length,className:"bg-orange-50/30 p-4",children:n.jsxs("div",{className:"space-y-3 text-sm",children:[J.original.trend_analysis&&n.jsxs("div",{children:[n.jsx("span",{className:"font-semibold text-gray-600 text-xs uppercase tracking-wide",children:"Trend Analysis"}),n.jsx("p",{className:"text-gray-800 mt-1 whitespace-pre-wrap",children:J.original.trend_analysis})]}),J.original.virality_explanation&&n.jsxs("div",{children:[n.jsx("span",{className:"font-semibold text-gray-600 text-xs uppercase tracking-wide",children:"Virality Explanation"}),n.jsx("p",{className:"text-gray-800 mt-1",children:J.original.virality_explanation})]}),J.original.business_opportunities_anal
2096ysis&&n.jsxs("div",{children:[n.jsx("span",{className:"font-semibold text-gray-600 text-xs uppercase tracking-wide",children:"Business Opportunities"}),n.jsx("p",{className:"text-gray-800 mt-1 whitespace-pre-wrap",children:J.original.business_opportunities_analysis})]}),J.original.comparable_trends&&n.jsxs("div",{children:[n.jsx("span",{className:"font-semibold text-gray-600 text-xs uppercase tracking-wide",children:"Comparable Trends"}),n.jsx("p",{className:"text-gray-800 mt-1 whitespace-pre-wrap",children:J.original.comparable_trends})]}),J.original.related_news_and_data&&n.jsxs("div",{children:[n.jsx("span",{className:"font-semibold text-gray-600 text-xs uppercase tracking-wide",children:"Related News & Data"}),n.jsx("pre",{className:"text-gray-700 mt-1 text-xs bg-white border rounded p-2 overflow-auto max-h-48",children:typeof J.original.related_news_and_data=="string"?J.original.related_news_and_data:JSON.stringify(J.original.related_news_and_data,null,2)})]}),J.original.authoritative_urls&&n.jsxs("div",{children:[n.jsx("span",{className:"font-semibold text-gray-600 text-xs uppercase tracking-wide",children:"Authoritative URLs"}),n.jsx("div",{className:"mt-1",children:Array.isArray(J.original.authoritative_urls)?J.original.authoritative_urls.map((W,ie)=>n.jsx("a",{href:W,target:"_blank",rel:"noopener noreferrer",className:"block text-blue-600 hover:underline text-sm truncate",children:W},ie)):n.jsx("pre",{className:"text-xs text-gray-600 bg-white border rounded p-2",children:JSON.stringify(J.original.authoritative_urls,null,2)})})]})]})})},`${J.id}-expanded`)]}))})]})}),j>0&&n.jsxs("div",{className:"flex items-center justify-between text-sm text-gray-600",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs("span",{children:["Showing ",K,"–",X," of ",j," trends"]}),n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"text-xs text-gray-400",children:"Per page:"}),n.jsxs(ur,{value:String(m),onValueChange:Q,children:[n.jsx(or,{className:"h-7 w-[70px] text-xs",children:n.jsx(hr,{})}),n.jsx(lr,{children:ewt.map(J=>n.jsx(Fe,{value:String(J),children:J},J))})]})]})]}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx(te,{variant:"outline",size:"sm",onClick:()=>h(J=>Math.max(0,J-1)),disabled:u===0||N,children:"Previous"}),n.jsx(te,{variant:"outline",size:"sm",onClick:()=>h(J=>J+1),disabled:X>=j||N,children:"Next"})]})]}),n.jsx(Zyt,{isOpen:p,onClose:()=>{A(!1),B()},title:v,content:T?`**Error:** ${T}`:E??"",isLoading:C})]})}const owt=[{path:"/brands",element:wNe},{path:"/brands/:id",element:q3},{path:"/brands/:id/analysis",element:Elt},{path:"/brands/:id/consultant",element:But},{path:"/brands/:id/settings",element:lH},{path:"/brands/:id/resources",element:oy},{path:"/brands/:id/theme",element:K3},{path:"/brands/:id/connections",element:Nz},{path:"/brands/:id/connections/:platformId/settings",element:Rdt},{path:"/brands/:id/rss-feed",element:Udt},{path:"/brands/:id/blog",element:Mdt},{path:"/brands/:id/blog/:postId",element:jut},{path:"/feed",element:tT},{path:"/convergences",element:sCe},{path:"/convergences/:id",element:ZKe},{path:"/campaigns",element:Rut},{path:"/campaigns/new",element:Vut},{path:"/campaigns/:id",element:Uut},{path:"/campaigns/:id/edit",element:ZAt},{path:"/content",element:oht},{path:"/content/create",element:Die},{path:"/content/:id",element:pV},{path:"/content/:id/improve",element:pV},{path:"/cross-linking",element:t0t},{path:"/trends",element:iwt},{path:"/social-platform-automation",element:Nz},{path:"/dashboard",element:TV},{path:"/profile",element:Npt},{path:"/account",element:jNe},{path:"/auth/callback",element:GB},{path:"/auth/linkedin/callback",element:NY},{path:"/auth/twitter/callback",element:_Y},{path:"/auth/instagram/callback",element:_Ne},{path:"/admin",element:XAt},{path:"/brand-genius",element:q3},{path:"/brand/settings",element:lH},{path:"/brand/resources",element:oy},{path:"/brand/theme",element:K3},{path:"/brand/guide",element:Clt},{path:"/settings",element:Egt},{path:"/settings/subscription",element:vle},{path:"/settings/billing",element:Qle},{path:"/settings/billing/credits",element:Qgt},{path:"/settings/team",element:Sgt},{path:"/credits",element:Wgt},{path:"/purchase-success",element:k_},{path:"/checkout/success",element:k_},{path:"/logout",element:Gle},{path:"/help",element:Mgt},{path:"/automation",element:Jgt},{path:"/invitations/accept",element:Fgt},{path:"/invitations/brand/:token",element:ZP},{path:"/process-invitation",element:qB},{path:"/plan-upgrade/:featureName",element:$gt},{path:"/",element:TV}];function lwt({onComplete:e,onPrevious:t,existingBrandId:r,onBrandUpdate:s,skipBilling:a}){const[i]=g.useState(!1),[o,l]=g.useState(0),[c,d]=g.useState([]),[u,h]=g.useState(""),[m,f]=g.useState(!1),[p,A]=g.useState(!1),[v,x]=g.useState("brand_name"),[b,y]=g.useState(!1),[w,j]=g.useState(!1),[N,_]=g.useState({}),[S,C]=g.useState(!1),[E,T]=g.useState(""),[B,L]=g.useState(""),[P,F]=g.useState(!1),{register:M,setValue:I,watch:$}=Cd({defaultValues:{},mode:"onChange"}),V=c[o],R=V?V[0]:null,Q=R?$(R):null;g.useEffect(()=>{R&&c.length>0&&(console.log(`[DEBUG BrandWizardStep] Current field: ${R}, Value: ${Q||"(empty)"}`),console.log(`[DEBUG BrandWizardStep] Current step: ${o}/${c.length-1}`))},[R,Q,o]),g.useEffect(()=>{if(R&&Q!==void 0&&Q!==null){const W={...N,[R]:Q};_(W);const ie=c.slice(0,o+1).reduce((he,[ee])=>{if(ee===R)he[ee]=Q;else{const xe=N[ee];xe!=null&&xe!==""&&(he[ee]=xe)}return he},{});console.log(`Field ${R} changed to:`,typeof Q=="string"&&Q.length>20?Q.substring(0,20)+"...":Q),delete ie.id,s(ie)}},[Q,R]),g.useEffect(()=>{const W=Object.entries(cs).filter(([ie,he])=>he.keyField&&!he.hidden).sort((ie,he)=>ie[1].group.localeCompare(he[1].group));d(W)},[]),g.useEffect(()=>{var ie;if(r&&b){if(console.log("existingBrandId changed to:",r),console.log("Current brandId in component state:",u),r===u){console.log("existingBrandId matches current brandId - skipping reinitialization");return}const he=(ie=c[o])==null?void 0:ie[0],ee=he?$(he):null;if(ee!=null&&ee!==""){console.log("Active field edit detected - preserving current state and skipping reinitialization");return}console.log("Resetting initialization status to reinitialize with new ID"),y(!1),j(!1);return}(async()=>{var he,ee;if(!(w||b)){j(!0);try{const{data:{session:xe}}=await de.auth.getSession();if(!xe)return;let we;if(r){console.log("Using existing brand ID from props:",r);const{data:Se,error:pe}=await de.from("brands").select("*, web_site_scraping_status").eq("id",r).single();if(pe){console.error("Error loading brand:",pe);return}
2096Se.web_site_scraping_status==="COMPLETED"&&console.log("This is a web-scraped brand with completed scraping"),console.log("Loaded brand details:",{id:Se.id,name:Se.brand_name,url:Se.url,scrape_status:Se.web_site_scraping_status,status:Se.status}),console.log("[DEBUG] Full brand data loaded:",Se),we=Se}else{const{data:Se,error:pe}=await de.schema("basejump").rpc("get_accounts_with_role");if(pe||!Se||Se.length===0){console.error("Error fetching user accounts:",pe);return}const{data:Ce}=await de.from("brands").select("*").in("account_id",Se);if(console.log("Found brands for accounts:",Ce==null?void 0:Ce.map(re=>({id:re.id,status:re.status,scrape_status:re.web_site_scraping_status,name:re.brand_name,updated_at:re.updated_at}))),Ce&&Ce.length>0){const re=Ce.find(se=>se.web_site_scraping_status==="COMPLETED");if(re)console.log("Using web-scraped brand with ID:",re.id),we=re;else{const se=Ce.find(Ae=>Ae.status==="DRAFT");if(se)console.log("Using existing DRAFT brand:",se.id),we=se;else{const Ae=[...Ce].sort((Pe,Oe)=>new Date(Oe.updated_at||0).getTime()-new Date(Pe.updated_at||0).getTime());console.log("Using most recent brand:",Ae[0].id),we=Ae[0]}}}else{console.log("No existing brands found, creating new brand");const{data:re,error:se}=await de.schema("basejump").rpc("get_accounts_with_role");
2096if(se||!re||re.length===0){console.error("Error fetching user accounts:",se),console.error("User does not have any accounts. This should not happen."),console.error("User ID:",xe.user.id),console.error("Accounts returned:",re);const{data:ue,error:Ee}=await de.schema("basejump").from("accounts").select("*").eq("id",xe.user.id).eq("personal_account",!0);console.error("Personal account check:",ue,Ee);return}const Ae=re[0];console.log("Using account ID:",Ae);const Pe={account_id:Ae,status:"DRAFT",id:crypto.randomUUID(),brand_name:"",idea:"",url:"",default_landing_page:"",priority:100,convergence_check_frequency:"1 hour"},{data:Oe,error:be}=await de.from("brands").insert(Pe).select().single();if(be)if(be.code==="23505"){const{data:ue}=await de.from("brands").select("*").eq("status","DRAFT").eq("account_id",Ae).single();we=ue}else{console.error("Error creating brand:",be),console.error("Error details:",be);return}else we=Oe}}we&&(h(we.id),_(we),console.log("[DEBUG] Initialized fieldValues with brand data"),Object.keys(cs).forEach(Se=>{const pe=we[Se]||"";I(Se,pe),(Se==="brand_name"||Se==="url"||Se==="elevator_pitch"||Se==="target_market")&&console.log(`[DEBUG] Setting form field '${Se}' to value:`,pe)}),setTimeout(()=>{console.log("[DEBUG] Verifying form values after setting:"),["brand_name","elevator_pitch","target_market","url"].forEach(Se=>{const pe=$(Se);console.log(`  - ${Se}: ${pe||"(empty)"}`)})},100),console.log("[DEBUG] Sending FULL brand data to parent:",{id:we.id,brand_name:we.brand_name,url:we.url,elevator_pitch:((he=we.elevator_pitch)==null?void 0:he.substring(0,50))+"...",target_market:((ee=we.target_market)==null?void 0:ee.substring(0,50))+"..."}),s(we),y(!0))}finally{j(!1)}}})()},[r,cs,I,s]);const U=async()=>{if(!u)return;const W=c[o][0],ie=$(W);if(!ie||typeof ie=="string"&&ie.trim()===""){L(`${q[1].name} is required before you can continue.`),F(!0);const he=document.querySelector(`[name="${W}"]`);he&&he.focus(),setTimeout(()=>F(!1),500);return}L("");try{const he={...N,[W]:ie,status:o>=c.length-1?"ACTIVE":"DRAFT"};if(W==="url"&&ie&&(he.default_landing_page=ie),he.status==="DRAFT"){const{data:pe,error:Ce}=await de.from("brands").select("status").eq("id",u).single();if(Ce)throw Ce.code==="PGRST116"?new Error("Brand not found"):Ce;if(pe.status==="ACTIVE"){const{data:re}=await de.auth.getSession();if(!re||!re.session)throw new Error("No active session");const{data:se}=await de.from("brands").select("id").eq("status","DRAFT").eq("account_id",re.session.user.id);se&&se.length>0&&(he.status="ACTIVE")}}const{error:ee}=await de.from("brands").update(he).eq("id",u);if(ee)if(ee.code==="23505"&&ee.message.includes("idx_one_draft_brand_per_account")){console.log("Constraint violation detected, changing status to ACTIVE"),he.status="ACTIVE";const{error:pe}=await de.from("brands").update(he).eq("id",u);if(pe)throw pe}else throw ee;_(he);const xe=o+1;if(o>=c.length-1){if(console.log("Final step reached, calling onComplete callback"),console.log("Brand data at completion:",he),console.log("skipBilling value in BrandWizardStep:",a),he.status!=="ACTIVE"){console.log("Ensuring brand is ACTIVE before completion");const{error:pe}=await de.from("brands").update({status:"ACTIVE"}).eq("id",u);if(pe){console.error("Error activating brand:",pe);return}he.status="ACTIVE"}s(he),e();return}if(xe<c.length){const pe=c[xe][0],Ce=he[pe];Ce!==void 0&&I(pe,Ce)}l(xe);const Se=c.slice(0,xe+1).reduce((pe,[Ce])=>{const re=he[Ce];return re!=null&&re!==""&&(pe[Ce]=re),pe},{});s(Se)}catch(he){console.error("Error updating brand:",he)}};g.useEffect(()=>{B&&L("")},[Q]);const D=()=>{if(o>0){const W=c[o][0],ie=$(W);if(ie){const Se={...N,[W]:ie};_(Se)}const he=o-1;l(he);const ee=c[he][0],xe=N[ee];xe!==void 0&&I(ee,xe);const we=c.slice(0,he+1).reduce((Se,[pe])=>{const Ce=N[pe];return Ce!=null&&Ce!==""&&(Se[pe]=Ce),Se},{});s(we)}else t()};g.useEffect(()=>{var ie;const W=document.querySelector(`[name="${(ie=c[o])==null?void 0:ie[0]}"]`);W&&setTimeout(()=>{W.focus()},100)},[o,c]);const q=c[o];if(!q)return null;const[G,Y]=q,K=G,X=W=>{W.key==="Enter"&&!W.shiftKey&&(W.preventDefault(),U())},ae=(W=>{const ie={brand_name:li,elevator_pitch:Cc,target_market:ui,url:Is,brand_personality:W_,customer_avatar:Ka,default:ig};return ie[W]||ie.default})(G),J=(o+1)/c.length*100;return n.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 via-blue-50/30 to-indigo-50/40",children:[n.jsx("div",{className:"container mx-auto px-4 py-8 max-w-4xl",children:n.jsxs("div",{className:"relative overflow-hidden bg-white/80 backdrop-blur-sm rounded-3xl border border-blue-200/50 shadow-xl",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsx("div",{className:"absolute top-0 right-0 w-32 h-32 bg-gradient-to-br from-blue-200/20 to-transparent roun
2096ded-full -translate-y-16 translate-x-16"}),n.jsx("div",{className:"absolute bottom-0 left-0 w-24 h-24 bg-gradient-to-tr from-indigo-200/20 to-transparent rounded-full translate-y-12 -translate-x-12"}),n.jsxs("div",{className:"relative p-8",children:[n.jsxs("div",{className:"mb-8",children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"p-2 bg-gradient-to-br from-blue-500 to-indigo-600 rounded-xl shadow-lg",children:n.jsx(ae,{className:"h-5 w-5 text-white"})}),n.jsxs("div",{children:[n.jsxs("p",{className:"text-sm font-medium text-blue-600",children:["Step ",o+1," of ",c.length]}),n.jsxs("div",{className:"flex items-center gap-2",children:[c.slice(0,o).map((W,ie)=>n.jsx(qt,{className:"h-4 w-4 text-green-500"},ie)),n.jsx("div",{className:"h-4 w-4 rounded-full bg-gradient-to-r from-blue-500 to-indigo-600 flex items-center justify-center",children:n.jsx("div",{className:"h-2 w-2 bg-white rounded-full"})}),c.slice(o+1).map((W,ie)=>n.jsx("div",{className:"h-4 w-4 rounded-full border-2 border-gray-200"},o+1+ie))]})]})]}),n.jsxs("div",{className:"text-right",children:[n.jsxs("div",{className:"text-2xl font-bold bg-gradient-to-r from-blue-600 to-indigo-600 bg-clip-text text-transparent",children:[Math.round(J),"%"]}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"Complete"})]})]}),n.jsx(Ou,{value:J,className:"h-2 bg-blue-100"})]}),n.jsxs("div",{className:"mb-8",children:[n.jsx("h2",{className:"text-3xl font-bold bg-gradient-to-r from-blue-700 via-indigo-700 to-purple-700 bg-clip-text text-transparent mb-3",children:Y.name}),n.jsx("p",{className:"text-gray-600 text-lg leading-relaxed",children:Y.howItsUsed})]}),n.jsxs("div",{className:ye("relative p-6 bg-white/60 backdrop-blur-sm rounded-2xl border border-blue-200/30 transition-all duration-300",B&&"border-red-300",P&&"animate-shake"),children:[Y.inputControl==="Textarea"?n.jsxs("div",{className:"space-y-3",children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:Y.name}),n.jsx(Zr,{...M(K),placeholder:Y.example.toString(),className:ye("min-h-[200px] bg-white/80 backdrop-blur-sm border-blue-200/50 focus:border-blue-400 focus:ring-2 focus:ring-blue-200 resize-none transition-all duration-200",B&&"border-red-300 focus:border-red-400 focus:ring-red-200"),onKeyDown:W=>{W.key==="Enter"&&(W.ctrlKey||W.metaKey)&&(W.preventDefault(),U())}}),B&&n.jsxs("div",{className:"flex items-center gap-2 p-3 bg-gradient-to-r from-red-50 to-red-100/50 rounded-lg border border-red-200 animate-in slide-in-from-top-2",children:[n.jsx(nr,{size:16,className:"text-red-500"}),n.jsx("span",{className:"text-red-700 text-sm font-medium",children:B})]})]}):Y.options&&Y.options.length>0?n.jsxs("div",{className:"space-y-3",children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:Y.name}),n.jsx(d6,{value:$(K)||"",onValueChange:W=>I(K,W),className:"w-full grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-2",children:Y.options.map(W=>n.jsxs(u6,{value:W,className:ye("relative p-4 text-left transition-all duration-200 hover:shadow-md","border-2 rounded-xl font-medium",$(K)===W?"border-blue-400 bg-gradient-to-br from-blue-50 to-indigo-50 text-blue-700 shadow-md":"border-gray-200 bg-white/80 hover:border-blue-300 hover:bg-blue-50/50"),children:[W,$(K)===W&&n.jsx(qt,{className:"absolute top-2 right-2 h-4 w-4 text-blue-600"})]},W))}),B&&n.jsxs("div",{className:"flex items-center gap-2 p-3 bg-gradient-to-r from-red-50 to-red-100/50 rounded-lg border border-red-200 animate-in slide-in-from-top-2",children:[n.jsx(nr,{size:16,className:"text-red-500"}),n.jsx("span",{className:"text-red-700 text-sm font-medium",children:B})]})]}):n.jsxs("div",{className:"space-y-3",children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:Y.name}),n.jsx(qe,{...M(K),type:"text",placeholder:Y.example.toString(),className:ye("h-12 bg-white/80 backdrop-blur-sm border-blue-200/50 focus:border-blue-400 focus:ring-2 focus:ring-blue-200 transition-all duration-200",B&&"border-red-300 focus:border-red-400 focus:ring-red-200"),onKeyDown:X}),B&&n.jsxs("div",{className:"flex items-center gap-2 p-3 bg-gradient-to-r from-red-50 to-red-100/50 rounded-lg border border-red-200 animate-in slide-in-from-top-2",children:[n.jsx(nr,{size:16,className:"text-red-500"}),n.jsx("span",{className:"text-red-700 text-sm font-medium",children:B})]})]}),Y.inputControl!=="Textarea"&&n.jsx("div",{className:"flex justify-center mt-4",children:n.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-500",children:[n.jsx("span",{children:"Press"}),n.jsx("kbd",{className:"px-2 py-1 bg-gray-100 rounded border text-xs",children:"Enter"}),n.jsx("span",{children:"to continue"})]})})]}),Y.bestPractices&&n.jsx("div",{className:"mt-6 p-4 bg-gradient-to-r from-blue-50/80 to-indigo-50/80 backdrop-blur-sm rounded-2xl border border-blue-200/30 shadow-sm",children:n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx("div",{className:"p-2 bg-gradient-to-br from-blue-500 to-indigo-600 rounded-lg shadow-sm",children:n.jsx(ig,{className:"h-4 w-4 text-white"})}),n.jsxs("div",{className:"flex-1",children:[n.jsx("h4",{className:"font-semibold text-blue-900 mb-2",children:"Best Practices"}),n.jsx("p",{className:"text-blue-800 text-sm leading-relaxed",children:Y.bestPractices})]})]})}),Y.allowAiGeneration&&n.jsxs("div",{className:"mt-6 p-4 bg-gradient-to-r from-purple-50/80 to-pink-50/80 backdrop-blur-sm rounded-2xl border border-purple-200/30 shadow-sm",children:[n.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[n.jsx("div",{className:"p-2 bg-gradient-to-br from-purple-500 to-pink-600 rounded-lg shadow-sm",children:n.jsx(mr,{className:"h-4 w-4 text-white"})}),n.jsxs("div",{children:[n.jsx("h4",{className:"font-semibold text-purple-900",children:"AI Assistant"}),n.jsx("p",{className:"text-purple-700 text-sm",children:"Let Brand Genius help you craft the perfect response"})]})]}),n.jsxs(c6,{onClick:()=>{x(K);const W=$(K);W&&String(W).trim()!==""?A(!0):(C(!1),f(!0))},className:"w-full shadow-lg hover:shadow-xl transition-all duration-200",children:[n.jsx(KN,{className:"mr-2"}),"Ask Brand Genius"]}
2096)]}),n.jsxs("div",{className:"flex justify-between items-center pt-8 mt-8 border-t border-blue-200/30",children:[n.jsxs(te,{variant:"outline",onClick:D,className:"px-6 py-3 bg-white/80 backdrop-blur-sm border-blue-200/50 hover:bg-blue-50 hover:border-blue-300 transition-all duration-200 shadow-sm hover:shadow-md",children:[n.jsx(Nu,{className:"mr-2",size:16}),"Previous"]}),n.jsxs(te,{onClick:U,disabled:i,className:ye("px-6 py-3 bg-gradient-to-r from-blue-600 to-indigo-600 hover:from-blue-700 hover:to-indigo-700 text-white shadow-lg hover:shadow-xl transition-all duration-200 border-0",P&&"animate-bounce"),children:[o===c.length-1?"Complete Setup":"Next Step",n.jsx(_s,{className:"ml-2",size:16})]})]})]})]})}),m&&n.jsx(MF,{fieldName:v,brand:$(),defaultInstructions:Y.bestPractices,fieldMetadata:Y,existingValue:S?$(v):void 0,initialFeedback:S?E:"",onApply:(W,ie)=>{I(W,ie),s({[W]:ie}),f(!1),C(!1),T("")},onClose:()=>{f(!1),C(!1),T("")}}),p&&n.jsx(Zt,{open:p,onOpenChange:A,children:n.jsxs(Jt,{className:"sm:max-w-[550px] p-8 bg-gradient-to-br from-white via-blue-50/30 to-indigo-50/40 backdrop-blur-sm border border-blue-200/50 shadow-2xl",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsxs("div",{className:"relative",children:[n.jsxs(_r,{className:"text-center mb-6",children:[n.jsx("div",{className:"mx-auto mb-4 p-3 bg-gradient-to-br from-purple-500 to-pink-600 rounded-2xl shadow-lg w-fit",children:n.jsx(mr,{className:"h-6 w-6 text-white"})}),n.jsx(tr,{className:"text-2xl font-bold bg-gradient-to-r from-purple-700 via-indigo-700 to-blue-700 bg-clip-text text-transparent",children:"How would you like Brand Genius to help?"}),n.jsx(Hr,{className:"text-gray-600 text-base mt-2",children:"Choose how you want Brand Genius to assist with this field."})]}),n.jsxs("div",{className:"grid gap-4 py-4",children:[n.jsx(te,{onClick:()=>{A(!1),C(!1),f(!0)},className:"w-full p-6 h-auto bg-gradient-to-r from-blue-600 to-indigo-600 hover:from-blue-700 hover:to-indigo-700 text-white shadow-lg hover:shadow-xl transition-all duration-200 text-left",children:n.jsxs("div",{className:"flex items-center",children:[n.jsx("div",{className:"p-2 bg-white/20 rounded-lg mr-4",children:n.jsx(KN,{className:"h-5 w-5"})}),n.jsxs("div",{children:[n.jsx("div",{className:"font-semibold text-lg",children:"Generate New Content"}),n.jsx("div",{className:"text-blue-100 text-sm",children:"Let Brand Genius create a fresh response for you"})]})]})}),n.jsx(te,{onClick:()=>{A(!1),C(!0),T(""),f(!0)},variant:"outline",className:"w-full p-6 h-auto bg-white/80 backdrop-blur-sm border-purple-200 hover:bg-purple-50 hover:border-purple-300 transition-all duration-200 text-left",children:n.jsxs("div",{className:"flex items-center",children:[n.jsx("div",{className:"p-2 bg-gradient-to-br from-purple-500 to-pink-600 rounded-lg mr-4",children:n.jsx(mr,{className:"h-5 w-5 text-white"})}),n.jsxs("div",{children:[n.jsx("div",{className:"font-semibold text-lg text-gray-900",children:"Improve Current Answer"}),n.jsx("div",{className:"text-gray-600 text-sm",children:"Give feedback to enhance your existing response"})]})]})})]})]})]})})]})}const cwt=({text:e,colors:t={first:"#9E7AFF",second:"#FE8BBB"},className:r,sparklesCount:s=10,...a})=>{const[i,o]=g.useState([]);return g.useEffect(()=>{const l=()=>{const h=`${Math.random()*100}%`,m=`${Math.random()*100}%`,f=Math.random()>.5?t.first:t.second,p=Math.random()*2,A=Math.random()*1+.3,v=Math.random()*10+5;return{id:`${h}-${m}-${Date.now()}`,x:h,y:m,color:f,delay:p,scale:A,lifespan:v}},c=()=>{const h=Array.from({length:s},l);o(h)},d=()=>{o(h=>h.map(m=>m.lifespan<=0?l():{...m,lifespan:m.lifespan-.1}))};c();const u=setInterval(d,100);return()=>clearInterval(u)},[t.first,t.second]),n.jsx("div",{className:ye("text-6xl font-bold",r),...a,style:{"--sparkles-first-color":`${t.first}`,"--sparkles-second-color":`${t.second}`},children:n.jsxs("span",{className:"relative inline-block",children:[i.map(l=>n.jsx(dwt,{...l},l.id)),n.jsx("strong",{children:e})]})})},dwt=({id:e,x:t,y:r,color:s,delay:a,scale:i})=>n.jsx(ut.svg,{className:"pointer-events-none absolute z-20",initial:{opacity:0,left:t,top:r}
2096,animate:{opacity:[0,1,0],scale:[0,i,0],rotate:[75,120,150]},transition:{duration:.8,repeat:1/0,delay:a},width:"21",height:"21",viewBox:"0 0 21 21",children:n.jsx("path",{d:"M9.82531 0.843845C10.0553 0.215178 10.9446 0.215178 11.1746 0.843845L11.8618 2.72026C12.4006 4.19229 12.3916 6.39157 13.5 7.5C14.6084 8.60843 16.8077 8.59935 18.2797 9.13822L20.1561 9.82534C20.7858 10.0553 20.7858 10.9447 20.1561 11.1747L18.2797 11.8618C16.8077 12.4007 14.6084 12.3916 13.5 13.5C12.3916 14.6084 12.4006 16.8077 11.8618 18.2798L11.1746 20.1562C10.9446 20.7858 10.0553 20.7858 9.82531 20.1562L9.13819 18.2798C8.59932 16.8077 8.60843 14.6084 7.5 13.5C6.39157 12.3916 4.19225 12.4007 2.72023 11.8618L0.843814 11.1747C0.215148 10.9447 0.215148 10.0553 0.843814 9.82534L2.72023 9.13822C4.19225 8.59935 6.39157 8.60843 7.5 7.5C8.60843 6.39157 8.59932 4.19229 9.13819 2.72026L9.82531 0.843845Z",fill:s})},e),uwt=e=>(t,r=!1)=>{t.id||r?(console.log("[DEBUG] Sending significant brand update:",t),e(t)):(console.log("[DEBUG] Sending non-significant form update:",Object.keys(t)),console.log("[DEBUG] Form field edit detected - This should NOT cause a state reset"),e(t))};function hwt({onComplete:e,onBrandUpdate:t,skipBilling:r=!1,existingBrandId:s=null}){const[a,i]=g.useState(""),[o,l]=g.useState(!1),[c,d]=g.useState("NOT_STARTED"),[u,h]=g.useState(null),[m,f]=g.useState(s),[p,A]=g.useState(null),[v,x]=g.useState(null),[b,y]=g.useState(!0),[w,j]=g.useState(!1),[N]=Bi(),_=xr(),{status:S,loading:C}=o0(),E=g.useRef(uwt(t)).current;g.useEffect(()=>{(async()=>{var F,M;if(!C&&S&&!(((F=S.personalAccount)==null?void 0:F.status)==="active"||((M=S.personalAccount)==null?void 0:M.status)==="trialing"||S.effectiveStatus==="active")&&!r){try{const{data:{session:$}}=await de.auth.getSession();if($!=null&&$.user){const{data:V}=await de.schema("marketing_and_customer_success").from("profiles").select("onboarding_completed").eq("id",$.user.id).single();if(V&&V.onboarding_completed===!1){console.log("[HelpWizardStep] User in initial onboarding, not redirecting to billing");return}}}catch($){console.error("[HelpWizardStep] Error checking onboarding status:",$)}console.log("[HelpWizardStep] No active account found, redirecting to billing"),_("/settings/billing")}})()},[S,C,_,r]),g.useEffect(()=>{s&&(console.log("[DEBUG] HelpWizardStep received existingBrandId:",s),f(s))},[s]),g.useEffect(()=>{async function P(){try{const F=N.get("brandId");if(F&&F!==s){console.log("[DEBUG] Found brandId from URL:",F),f(F),E({id:F},!0);const{data:I,error:$}=await de.from("brands").select("id, url, web_site_scraping_status, status").eq("id",F).single();$?console.error("[ERROR] Failed to get claimed brand details:",$):I&&(console.log("[DEBUG] Found claimed brand details:",I),I.url&&I.web_site_scraping_status==="COMPLETED"&&(x(I.url),i(I.url)));return}const M=VB();if(M&&!s){console.log("[DEBUG] Found stored claim session token, attempting to fetch anonymous brand data:",M);try{const I=await NNe(M);console.log("[DEBUG] Retrieved anonymous brand data:",I),I.url&&(console.log("[DEBUG] Setting website URL from anonymous brand:",I.url),i(I.url))}catch(I){console.error("[DEBUG] Failed to fetch anonymous brand data:",I),localStorage.removeItem("brand_claim_session_token")}}}catch(F){console.error("[ERROR] Exception checking claimed brand:",F)}}P()},[s,N,E]),g.useEffect(()=>{async function P(){try{if(s){console.log("[DEBUG] Using existingBrandId from props:",s);const{data:R,error:Q}=await de.from("brands").select("id, url, web_site_scraping_status, status").eq("id",s).single();Q?console.error("[ERROR] Failed to get brand details:",Q):R&&(console.log("[DEBUG] Found brand details:",R),R.url&&R.web_site_scraping_status==="COMPLETED"&&x(R.url),f(R.id),E({id:R.id},!0)),y(!1);return}const{data:F,error:M}=await de.rpc("get_personal_account");if(M||!(F!=null&&F.account_id)){console.error("[ERROR] Failed to get personal account:",M),y(!1);return}const{data:I,error:$}=await de.from("brands").select("id, url, web_site_scraping_status, status").eq("account_id",F.account_id);$&&console.error("[ERROR] Error checking existing brands:",$),console.log("[DEBUG] Found brands during initialization:",I==null?void 0:I.map(R=>({id:R.id,url:R.url,scrape_status:R.web_site_scraping_status,status:R.status})));const V=I==null?void 0:I.find(R=>R.web_site_scraping_status==="COMPLETED");V&&(console.log("[DEBUG] Found brand with completed scraping:",V.id),x(V.url),f(V.id),E({id:V.id},!0))}catch(F){console.error("[ERROR] Exception checking existing brand:",F)}finally{y(!1)}}P()},[s,E]),g.useEffect(()=>{console.log("brandId",m)},[m]);const T=async P=>{if(P.preventDefault(),!a){h("Please enter a valid website URL");return}try{let F=a;!F.startsWith("http://")&&!F.startsWith("https://")&&(F="https://"+F),new URL(F),l(!0),d("PROCESSING"),h(null);try{const M=await de.auth.getSession();if(!M.data.session)throw new Error("No session found");const I="https://worker.rainfactory.ai";console.log(`[DEBUG] Checking if URL is reachable: ${F}`);const $=await fetch(`${I}
2096/rainfactory/web-site-scraper/check-url`,{method:"POST",headers:{Authorization:`Bearer ${M.data.session.access_token}`,"Content-Type":"application/json"},body:JSON.stringify({url:F})});if(!$.ok)throw new Error(`Failed to check URL: ${$.status}`);const V=await $.json();if(console.log("[DEBUG] URL reachability check result:",V),!V.success){d("FAILED"),h(`Website is not reachable: ${V.message}`);return}const{data:R,error:Q}=await de.rpc("get_personal_account");if(Q)throw new Error("Failed to get personal account: "+Q.message);if(!(R!=null&&R.account_id))throw new Error("No personal account found");const U=R.account_id;let D;if(console.log("[DEBUG] Determining which brand to use for scraping"),console.log("[DEBUG] existingBrandId from props:",s),console.log("[DEBUG] brandId from state:",m),s){console.log("[DEBUG] Using brand ID passed from wizard:",s),D=s;const{error:Y}=await de.from("brands").update({web_site_scraping_status:"NOT_STARTED",url:F}).eq("id",D);if(Y)throw console.error("[ERROR] Error updating existing brand:",Y),new Error("Failed to update existing brand: "+Y.message);d("NOT_STARTED");const K=await fetch(`${I}/rainfactory/web-site-scraper/scrape`,{method:"POST",headers:{Authorization:`Bearer ${M.data.session.access_token}`,"Content-Type":"application/json"},body:JSON.stringify({brandId:D,url:F})});if(console.log("[DEBUG] Worker response status for existing brand:",K.status),!K.ok){const ne=await K.text();throw console.error("[ERROR] Worker response error:",ne),new Error(`Failed to scrape website: ${K.status} ${ne}`)}const X=await K.json();if(console.log("[DEBUG] Worker response data for existing brand:",X),X.success)console.log("[DEBUG] Setting PROCESSING status after worker call for existing brand"),d("PROCESSING");else if(X.error)throw new Error(X.error)}else{const{data:Y,error:K}=await de.from("brands").select("id, web_site_scraping_status").eq("account_id",U).single();if(K&&K.code!=="PGRST116")throw new Error(K.message);if(Y){console.log("[DEBUG] Using existing brand from database:",Y.id),D=Y.id;const{error:X}=await de.from("brands").update({web_site_scraping_status:"NOT_STARTED",url:F}).eq("id",D);if(X)throw console.error("[ERROR] Error updating existing brand:",X),new Error("Failed to update existing brand: "+X.message);d("NOT_STARTED")}else{console.log("[DEBUG] Creating new brand as no existing brand was found");const{data:X,error:ne}=await de.from("brands").insert({url:F,status:"ACTIVE",web_site_scraping_status:"NOT_STARTED",brand_name:F.replace(/^https?:\/\//,"").split("/")[0],account_id:U}).select().single();if(ne)throw new Error(ne.message);D=X.id,f(D),console.log("[DEBUG] Created new brand with ID:",D)}}f(D),console.log("[DEBUG] Web scraping using brand with ID:",D),E({id:D},!0);const{data:q}=await de.from("brands").select("web_site_scraping_status").eq("id",D).single();if(!(q!=null&&q.web_site_scraping_status)||q.web_site_scraping_status==="NOT_STARTED"||q.web_site_scraping_status==="FAILED"){const Y=await fetch(`${I}/rainfactory/web-site-scraper/scrape`,{method:"POST",headers:{Authorization:`Bearer ${M.data.session.access_token}`,"Content-Type":"application/json"},body:JSON.stringify({brandId:D,url:F})});if(console.log("[DEBUG] Worker response status:",Y.status),!Y.ok){const X=await Y.text();throw console.error("[ERROR] Worker response error:",X),new Error(`Failed to scrape website: ${Y.status} ${X}`)}const K=await Y.json();if(console.log("[DEBUG] Worker response data:",K),K.success)console.log("[DEBUG] Maintaining PROCESSING status after worker call");else if(K.error)throw new Error(K.error)}else if(q.web_site_scraping_status==="COMPLETED"){setTimeout(()=>{l(!1),e()},1e3);return}const G=setInterval(async()=>{try{const Y=m||D;if(!Y){console.error("[ERROR] No brand ID available for polling"),clearInterval(G),A(null);return}if(w){console.log("[DEBUG] Cancellation in progress, stopping polling"),clearInterval(G),A(null);return}console.log("[DEBUG] Polling for brand status update, brandId:",Y);const{data:K,error:X}=await de.from("brands").select("web_site_scraping_status, web_site_scraping_results").eq("id",Y).single();if(X){console.error("[ERROR] Error polling for scraping status:",X),clearInterval(G),d("FAILED"),h("Error checking scraping status: "+X.message);return}if(!K){console.error("[ERROR] No data returned when polling for brand status");return}const ne=K.web_site_scraping_status;if(console.log("[DEBUG] Current scraping status:",ne),d(ne),ne==="FAILED"&&K.web_site_scraping_results){const ae=K.web_site_scraping_results;ae.error&&h(ae.error)}if((ne==="COMPLETED"||ne==="FAILED")&&(console.log("[DEBUG] Scraping process finished with status:",ne),clearInterval(G),A(null),j(!1),ne==="COMPLETED")){const{data:ae,error:J}=await de.from("brands").select("*").eq("id",Y).single();if(J){console.error("[ERROR] Failed to refresh brand data:",J),h("Failed to load updated brand information");return}if(!ae){console.error("[ERROR] No brand data found after refresh"),h("Failed to load updated brand information");return}console.log("[DEBUG] Refreshed brand data:",ae),await de.from("brands").upsert(ae),ae.id=Y,console.log("Updating brand data after scraping completion:",ae),E(ae,!0),setTimeout(()=>{l(!1),e()},1500)}}catch(Y){console.error("[ERROR] Exception during status polling:",Y),clearInterval(G),d("FAILED"),h("Error checking scraping status: "+(Y instanceof Error?Y.message:"Unknown error"))}},2e3);A(G)}catch(M){console.error("Error during web scraping:",M),d("FAILED"),h(M instanceof Error?M.message:"Unknown error occurred")}}catch{h("Please enter a valid website URL")}},B=async()=>
2096{if(c!=="PROCESSING"&&c!=="NOT_STARTED"){l(!1);return}const P=m;if(P)try{console.log("[DEBUG] Canceling scraping process for brandId:",P),j(!0),p&&(clearInterval(p),A(null)),d("FAILED"),h("Scraping canceled by user");const{error:F}=await de.from("brands").update({web_site_scraping_status:"FAILED",web_site_scraping_results:{error:"Scraping canceled by user",timestamp:new Date().toISOString()}}).eq("id",P);F&&console.error("[ERROR] Failed to cancel scraping:",F);try{const M=await de.auth.getSession();if(M.data.session){const I="https://worker.rainfactory.ai";console.log("[DEBUG] Attempting to send cancel signal to worker"),await fetch(`${I}/rainfactory/web-site-scraper/cancel`,{method:"POST",headers:{Authorization:`Bearer ${M.data.session.access_token}`,"Content-Type":"application/json"},body:JSON.stringify({brandId:P})}).catch($=>{console.log("[DEBUG] Cancel endpoint not implemented or failed:",$)})}}catch(M){console.error("[DEBUG] Error sending cancel signal to worker:",M)}}catch(F){console.error("[ERROR] Exception when canceling scraping:",F)}else p&&(clearInterval(p),A(null));l(!1)},L=()=>{x(null),i(""),h(null),d("NOT_STARTED")};return C&&!r?n.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:n.jsx(ov,{color:"#9E7AFF",size:15,margin:4,speedMultiplier:.8})}):n.jsxs("div",{className:"bg-gradient-to-br from-purple-50 via-white to-pink-50 relative flex items-start justify-start px-0 py-0",children:[n.jsx("div",{className:"absolute inset-0 overflow-hidden",children:n.jsxs("div",{className:"absolute -inset-[10px]",children:[n.jsx("div",{className:"absolute top-0 -left-4 w-48 sm:w-72 h-48 sm:h-72 bg-purple-300 rounded-full mix-blend-multiply filter blur-xl opacity-20 animate-blob"}),n.jsx("div",{className:"absolute top-0 -right-4 w-48 sm:w-72 h-48 sm:h-72 bg-yellow-300 rounded-full mix-blend-multiply filter blur-xl opacity-20 animate-blob animation-delay-2000"}),n.jsx("div",{className:"absolute -bottom-8 left-20 w-48 sm:w-72 h-48 sm:h-72 bg-pink-300 rounded-full mix-blend-multiply filter blur-xl opacity-20 animate-blob animation-delay-4000"}),n.jsx("div",{className:"absolute bottom-0 right-20 w-48 sm:w-72 h-48 sm:h-72 bg-blue-300 rounded-full mix-blend-multiply filter blur-xl opacity-20 animate-blob animation-delay-6000"})]})}),n.jsx("style",{children:`
2097        @keyframes blob {
2098          0% { transform: translate(0px, 0px) scale(1); }
2099          33% { transform: translate(30px, -50px) scale(1.1); }
2100          66% { transform: translate(-20px, 20px) scale(0.9); }
2101          100% { transform: translate(0px, 0px) scale(1); }
2102        }
2103        .animate-blob { animation: blob 7s infinite; }
2104        .animation-delay-2000 { animation-delay: 2s; }
2105        .animation-delay-4000 { animation-delay: 4s; }
2106        .animation-delay-6000 { animation-delay: 6s; }
2107      `}),n.jsx("div",{className:"relative w-full max-w-3xl mx-auto z-10",children:n.jsx("div",{className:"bg-white/95 backdrop-blur-xl rounded-3xl overflow-hidden",children:n.jsxs("div",{className:"relative px-6 py-10 sm:px-10 sm:py-14 md:px-14 md:py-16",children:[n.jsxs("div",{className:"text-center mb-8",children:[n.jsxs("div",{className:"relative inline-flex items-center justify-center mb-6",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-purple-400 to-pink-400 rounded-2xl blur-lg opacity-40 animate-pulse"}),n.jsx("div",{className:"relative inline-flex items-center justify-center w-16 h-16 bg-gradient-to-br from-purple-500 via-pink-500 to-blue-500 rounded-2xl shadow-lg transform hover:scale-110 transition-transform duration-300",children:n.jsx("svg",{className:"w-8 h-8 text-white",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2.5,d:"M13 10V3L4 14h7v7l9-11h-7z"})})})]}),n.jsxs("h1",{className:"text-3xl sm:text-4xl md:text-5xl font-black mb-3 tracking-tight",children:[n.jsx("span",{className:"block bg-gradient-to-r from-gray-900 to-gray-700 bg-clip-text text-transparent",children:r?"Let's Build":"Welcome to"}),n.jsx("span",{className:"block bg-gradient-to-r from-gray-900 to-gray-700 bg-clip-text text-transparent",children:r?"Something":""}),n.jsx("span",{className:"block mt-2 bg-gradient-to-r from-purple-600 via-pink-600 to-blue-600 bg-clip-text text-transparent",children:r?"Extraordinary":epe})]}),!r&&n.jsx("div",{className:"mt-6 inline-block",children:n.jsxs("div",{className:"relative group",children:[n.jsx("div",{className:"absolute -inset-0.5 bg-gradient-to-r from-purple-400 to-pink-400 rounded-xl blur opacity-30 group-hover:opacity-50 transition duration-300"}),n.jsxs("div",{className:"relative px-6 py-3 bg-gradient-to-r from-purple-50 to-pink-50 rounded-xl border border-purple-200/50",children:[n.jsx("p",{className:"text-sm text-purple-700 mb-1 font-medium",children:"Let's start something"}),n.jsx(cwt,{text:"Amazing",className:"text-2xl sm:text-3xl font-bold",colors:{first:"#9333EA",second:"#EC4899"}})]})]})})]}),n.jsx("div",{className:"relative mt-8 mb-8",children:n.jsxs("div",{className:"bg-gradient-to-br from-purple-50/50 to-pink-50/50 rounded-2xl p-6 border border-purple-100/30",children:[n.jsxs("p",{className:"text-gray-700 leading-relaxed text-center",children:[n.jsx("span",{className:"block mb-3 text-xl font-bold text-gray-900",children:"Let's get you started"}),n.jsx("span",{className:"text-sm sm:text-base",children:"The first step is to provide our system with some important information about your brand s
2107o that it can start creating content for you."}),n.jsx("span",{className:"block mt-2 text-purple-600 font-medium text-sm",children:"Don't worry, this will be quick and fun!"})]}),n.jsxs("div",{className:"mt-6 flex flex-col gap-3",children:[n.jsx("div",{className:"relative bg-white rounded-lg p-4 border border-gray-200 shadow-sm",children:n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-8 h-8 bg-gradient-to-br from-purple-500 to-blue-500 rounded-lg flex items-center justify-center flex-shrink-0",children:n.jsx("svg",{className:"w-4 h-4 text-white",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2.5,d:"M5 3v4M3 5h4M6 17v4m-2-2h4m5-16l2.286 6.857L21 12l-5.714 2.143L13 21l-2.286-6.857L5 12l5.714-2.143L13 3z"})})}),n.jsxs("div",{className:"flex-1",children:[n.jsx("p",{className:"font-bold text-gray-900 text-sm sm:text-base",children:"Have a Website?"}),n.jsx("p",{className:"text-xs sm:text-sm text-gray-600 leading-relaxed mt-0.5",children:"We'll analyze it to extract key information automatically"})]})]})}),n.jsx("div",{className:"relative bg-white rounded-lg p-4 border border-gray-200 shadow-sm",children:n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-8 h-8 bg-gradient-to-br from-pink-500 to-purple-500 rounded-lg flex items-center justify-center flex-shrink-0",children:n.jsx("svg",{className:"w-4 h-4 text-white",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2.5,d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})})}),n.jsxs("div",{className:"flex-1",children:[n.jsx("p",{className:"font-bold text-gray-900 text-sm sm:text-base",children:"No Website?"}),n.jsx("p",{className:"text-xs sm:text-sm text-gray-600 leading-relaxed mt-0.5",children:"You can manually enter the details in the next steps"})]})]})})]})]})}),b?n.jsx("div",{className:"flex justify-center py-6",children:n.jsxs("div",{className:"relative",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-purple-400 to-pink-400 rounded-full blur-lg opacity-40 animate-pulse"}),n.jsx(ov,{color:"#9333EA",size:10,margin:3,speedMultiplier:.8})]})}):v?n.jsxs("div",{className:"space-y-4 max-w-lg mx-auto",children:[n.jsx("div",{className:"bg-green-50 border border-green-200 rounded-xl p-4",children:n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-10 h-10 bg-gradient-to-br from-green-500 to-emerald-500 rounded-lg flex items-center justify-center flex-shrink-0",children:n.jsx("svg",{className:"w-5 h-5 text-white",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:3,d:"M5 13l4 4L19 7"})})}),n.jsxs("div",{className:"flex-1",children:[n.jsx("p",{className:"text-green-700 font-semibold text-sm",children:"Website Already Analyzed!"}),n.jsx("p",{className:"text-gray-700 font-medium",children:v.replace(/^https?:\/\//,"")})]})]})}),n.jsx("div",{className:"flex justify-center",children:n.jsxs(te,{onClick:L,variant:"outline",className:"border-gray-300 text-gray-700 hover:bg-gray-50 px-4 py-2 rounded-lg font-medium text-sm",children:[n.jsx(g2,{className:"h-4 w-4 mr-2"}),"Try a different website"]})})]}):n.jsx("form",{onSubmit:T,className:"space-y-4 max-w-lg mx-auto",children:n.jsxs("div",{className:"flex flex-col space-y-3",children:[n.jsx("label",{htmlFor:"website-url",className:"text-sm font-semibold text-gray-700 text-center",children:"Your Website URL"}),n.jsxs("div",{className:"relative group",children:[n.jsx("div",{className:"absolute -inset-0.5 bg-gradient-to-r from-purple-400 to-pink-400 rounded-lg blur opacity-0 group-hover:opacity-20 transition duration-300"}),n.jsx(qe,{id:"website-url",type:"text",placeholder:"example.com",value:a,onChange:P=>i(P.target.value),className:"relative w-full bg-white border-gray-200 text-gray-900 placeholder:text-gray-400 py-3 px-4 text-base rounded-lg focus:ring-2 focus:ring-purple-500 focus:border-transparent transition-all duration-200"})]}),n.jsx("div",{className:"flex justify-center mt-4",children:n.jsx(te,{type:"submit",className:"bg-gradient-to-r from-purple-500 to-blue-500 hover:from-purple-600 hover:to-blue-600 text-white px-6 py-2.5 rounded-lg font-semibold transform hover:scale-105 transition-all duration-200 shadow-md hover:shadow-lg",disabled:c==="PROCESSING",children:c==="PROCESSING"?n.jsx(ov,{color:"white",size:8,margin:3,speedMultiplier:.8}):n.jsxs(n.Fragment,{children:[n.jsx("svg",{className:"w-4 h-4 mr-2",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2.5,d:"M5 3v4M3 5h4M6 17v4m-2-2h4m5-16l2.286 6.857L21 12l-5.714 2.143L13 21l-2.286-6.857L5 12l5.714-2.143L13 3z"})}),"Scan my Website"]})})}),u&&n.jsx("div",{className:"mt-3",children:n.jsx("div",{className:"bg-red-50 border border-red-200 rounded-lg p-3",children:n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx(nr,{className:"h-4 w-4 text-red-500 flex-shrink-0 mt-0.5"}),n.jsx("p",{className:"text-red-700 text-sm leading-relaxed",children:u!=null&&u.includes("500")?"We're having trouble accessing your website at the moment.":u!=null&&u.includes("timeout")?"Your website is taking longer than expected to respond.":u!=null&&u.includes("not reachable")||u!=null&&u.includes("No content returned")?"We couldn't reach your website or extract content. Please make sure the URL is correct and 
2107your website is accessible.":u||"We encountered an unexpected issue while analyzing your website."})]})})})]})}),n.jsx("div",{className:"text-center mt-6 sm:mt-8",children:v?n.jsxs(te,{onClick:e,className:"bg-gradient-to-r from-green-600 to-emerald-600 hover:from-green-700 hover:to-emerald-700 text-white px-8 py-3 rounded-lg font-semibold transform hover:scale-105 transition-all duration-200 shadow-md hover:shadow-lg",size:"lg",children:["Continue to Next Step",n.jsx("svg",{className:"w-4 h-4 ml-2 inline",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 7l5 5m0 0l-5 5m5-5H6"})})]}):n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center gap-3 justify-center my-4",children:[n.jsx("div",{className:"h-px bg-gray-300 flex-1 max-w-[60px]"}),n.jsx("p",{className:"text-xs text-gray-500 font-medium uppercase tracking-wide",children:"or"}),n.jsx("div",{className:"h-px bg-gray-300 flex-1 max-w-[60px]"})]}),n.jsxs(te,{onClick:e,variant:"outline",className:"border-pink-300 bg-gradient-to-r from-pink-500/10 to-purple-500/10 text-pink-700 hover:from-pink-500/20 hover:to-purple-500/20 hover:border-pink-400 px-6 py-2.5 rounded-lg font-medium transform hover:scale-105 transition-all duration-200 shadow-sm hover:shadow-md",children:[n.jsx("svg",{className:"w-4 h-4 mr-2 inline",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2.5,d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})}),"Continue without website"]})]})}),n.jsx(AY,{isOpen:o&&(c==="PROCESSING"||c==="NOT_STARTED")&&!w,onClose:B,websiteUrl:a,onComplete:()=>{},duration:12e4}),o&&(c==="FAILED"||c==="COMPLETED"||w)&&n.jsx(Zt,{open:!0,onOpenChange:l,children:n.jsxs(Jt,{className:"sm:max-w-md",children:[n.jsx(tr,{children:c==="COMPLETED"?"Analysis Complete!":w?"Cancelling...":"Analysis Issue"}),n.jsx(Hr,{children:c==="COMPLETED"?"We've successfully analyzed your website.":w?"Stopping the analysis process...":"We encountered an issue during analysis."}),n.jsxs("div",{className:"py-6",children:[w&&n.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[n.jsx(ov,{color:"#FF5252",size:15,margin:4,speedMultiplier:.8,className:"my-4"}),n.jsx("p",{className:"text-center text-sm text-muted-foreground",children:"Cancelling operation..."})]}),c==="COMPLETED"&&n.jsx(Ar,{className:"bg-green-50 dark:bg-green-900/20 border-green-200 dark:border-green-900",children:n.jsx(gr,{className:"text-green-800 dark:text-green-300",children:"Analysis complete! We've extracted key information about your brand. Continuing to the next step..."})}),c==="FAILED"&&!w&&n.jsxs("div",{className:"space-y-4",children:[n.jsxs(Ar,{variant:"destructive",className:"bg-red-50 dark:bg-red-900/20 border-red-200 dark:border-red-800",children:[n.jsx(nr,{className:"h-5 w-5 text-red-600 dark:text-red-400"}),n.jsx(Wa,{className:"text-red-800 dark:text-red-300 font-medium",children:"We ran into a small hiccup"}),n.jsx(gr,{className:"text-red-700 dark:text-red-200",children:u!=null&&u.includes("500")?"We're having trouble accessing your website at the moment. This could be due to high traffic or temporary connectivity issues.":u!=null&&u.includes("timeout")?"Your website is taking longer than expected to respond. This might be due to its size or current traffic.":u!=null&&u.includes("not reachable")||u!=null&&u.includes("No content returned")?"We couldn't reach your website or extract content. Please make sure the URL is correct and 
2107your website is accessible.":u||"We encountered an unexpected issue while analyzing your website."})]}),n.jsx("div",{className:"flex items-center justify-between px-1",children:n.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[n.jsx(g2,{className:"h-4 w-4"}),n.jsx("span",{children:"You can try again or continue manually"})]})})]}),n.jsxs("div",{className:"flex justify-center gap-4 mt-8",children:[(c==="FAILED"||c==="COMPLETED")&&n.jsx(te,{variant:"outline",onClick:B,disabled:w,className:"px-6 py-3 bg-white/80 backdrop-blur-sm border-gray-300/50 hover:bg-gray-50 hover:border-gray-400 transition-all duration-200 shadow-sm hover:shadow-md",children:w?"Cancelling...":"Close"}),c==="FAILED"&&!w&&n.jsx(te,{onClick:e,className:"px-6 py-3 bg-gradient-to-r from-blue-600 to-indigo-600 hover:from-blue-700 hover:to-indigo-700 text-white shadow-lg hover:shadow-xl transition-all duration-200 border-0",children:"Continue Manually"})]})]})]})})]})})})]})}const fwt=(e=[])=>{const t={};return e.forEach(r=>{const s=r.product_name.toLowerCase().split("_")[0],a=r.interval==="year";t[s]||(t[s]={name:s.charAt(0).toUpperCase()+s.slice(1),description:r.product_description||`${s.charAt(0).toUpperCase()+s.slice(1)} plan with essential features`,monthlyPrice:0,yearlyPrice:0,monthlyPlanId:"",yearlyPlanId:"",isEnterprise:s==="enterprise",features:[]}),a?(t[s].yearlyPrice=r.price/100/12,t[s].yearlyPlanId=r.id,t[s].features.length||(t[s].features=r.features||[])):(t[s].monthlyPrice=r.price/100,t[s].monthlyPlanId=r.id,t[s].features.length||(t[s].features=r.features||[]))}),Object.values(t).sort((r,s)=>r.monthlyPrice-s.monthlyPrice)};function mwt({onComplete:e}){const[t,r]=g.useState([]),[s,a]=g.useState(!0),[i,o]=g.useState(!1),[l,c]=g.useState(null),[d,u]=g.useState("monthly");g.useEffect(()=>{(async()=>{try{a(!0);const{data:p}=await de.rpc("get_personal_account");if(!(p!=null&&p.account_id))throw new Error("No account found");const A=await de.auth.getSession();if(!A.data.session)throw new Error("No session found");const x=await fetch("https://worker.rainfactory.ai/billing-functions/get_plans",{method:"POST",headers:{Authorization:`Bearer ${A.data.session.access_token}`},body:JSON.stringify({account_id:p.account_id})});if(!x.ok)throw new Error("Failed to fetch plans");const y=(await x.json()).map(w=>({id:w.id,product_name:w.product_name,product_description:w.product_description,price:w.price,currency:w.currency,interval:w.interval==="month"?"month":"year",features:Array.isArray(w.features)?w.features.map(j=>typeof j=="string"?{name:j}:j):[]}));r(y)}catch(p){console.error("Error fetching plans:",p),He({title:"Error",description:"Failed to load subscription plans",variant:"destructive"})}finally{a(!1)}})()},[]);const h=fwt(t),m=async f=>{try{c(f),o(!0);const p=await de.auth.getSession();if(!p.data.session)throw new Error("No session found");const{data:A}=await de.rpc("get_personal_account");if(!(A!=null&&A.account_id))throw new Error("No account found");const x=await fetch("https://worker.rainfactory.ai/billing-functions/create_checkout",{method:"POST",headers:{Authorization:`Bearer ${p.data.session.access_token}`},body:JSON.stringify({account_id:A.account_id,plan_id:f,billing_interval:d,success_url:`${window.location.origin}/checkout/success?session_id={CHECKOUT_SESSION_ID}`,cancel_url:`${window.location.origin}/onboarding?step=plan`})});if(!x.ok)throw new Error("Failed to create checkout session");const{session_id:b,url:y}=await x.json();console.log("session_id",b),y&&(window.location.href=y),e&&e()}catch(p){console.error("Error selecting plan:",p),He({title:"Error",description:"Failed to process plan selection",variant:"destructive"})}finally{o(!1),c(null)}};return s?n.jsx("div",{className:"flex justify-center items-center p-8",children:n.jsx(kt,{className:"h-8 w-8 animate-spin"})}):n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"text-center",children:[n.jsx("h2",{className:"text-2xl font-bold",children:"Choose Your Plan"}),n.jsx("p",{className:"text-gray-600 mt-2",children:"Select the plan that best fits your needs. All plans include a 14-day free trial."})]}),n.jsxs("div",{className:"flex justify-center gap-2 mb-8",children:[n.jsx(te,{variant:d==="monthly"?"default":"outline",onClick:()=>u("monthly"),children:"Monthly"}),n.jsxs(te,{variant:d==="yearly"?"default":"outline",onClick:()=>u("yearly"),children:["Yearly",n.jsx("span",{className:"ml-2 text-xs bg-primary-foreground text-primary px-2 py-0.5 rounded-full",children:"Save 20%"})]})]}),n.jsx("div",{className:"grid grid-cols-1 gap-6 max-w-md mx-auto",children:h.map(f=>n.jsxs(Te,{className:`p-6 relative ${f.isEnterprise?"border-primary":""}`,children:[f.isEnterprise&&n.jsx("div",{className:"absolute -top-3 left-1/2 transform -translate-x-1/2",children:n.jsx("span",{className:"bg-primary text-white px-3 py-1 rounded-full text-sm",children:"Recommended"})}),n.jsxs("div",{className:"text-center mb-6",children:[n.jsx("h3",{className:"text-xl font-bold",children:f.name}),n.jsx("p",{className:"text-gray-600 text-sm mt-2",children:f.description}),n.jsxs("div",{className:"mt-4",children:[n.jsx("span",{className:"text-3xl font-bold",children:fK(d==="monthly"?f.monthlyPrice:f.yearlyPrice)}),n.jsx("span",{className:"text-gray-600",children:"/month"})]})]}),n.jsx("ul",{className:"space-y-3 mb-6",children:f.features.map((p,A)=>n.jsxs("li",{className:"flex items-center gap-2",children:[n.jsx(Gn,{className:"text-green-500 h-5 w-5"}),n.jsx("span",{className:"text-sm",children:p.name})]},A))}),n.jsx(te,{className:"w-full",variant:f.isEnterprise?"default":"outline",onClick:()=>m(d==="monthly"?f.monthlyPlanId:f.yearlyPlanId),disabled:i||l===(d==="monthly"?f.monthlyPlanId:f.yearlyPlanId),children:i&&l===(d==="monthly"?f.monthlyPlanId:f.yearlyPlanId)?n.jsxs(n.Fragment,{children:[n.jsx(kt,{className:"mr-2 h-4 w-4 animate-spin"}),"Processing..."]}):f.isEnterprise?"Contact Sales":"Select Plan"})]},f.name))}),n.jsx("div",{className:"text-center text-sm text-gray-600 mt-8",children:n.jsxs("p",{children:["All plans include a 14-day free trial.",n.jsx("br",{}),"Questions? Contact our sales team."]})})]})}function pwt({keyFields:e,getCurrentValue:t,formValues:r}){const s=t("brand_name")||"Your Brand Name",[a,i]=g.useState([]);g.useEffect(()=>{var f;const m=[];
2107if(r.metadata&&typeof r.metadata=="object"){const p=r.metadata;p.images&&Array.isArray(p.images)&&p.images.forEach(A=>{A.url&&m.push({url:A.url,description:A.description})})}if(r.web_site_scraping_results&&typeof r.web_site_scraping_results=="object"){const p=r.web_site_scraping_results;(f=p.extracted_info)!=null&&f.images&&Array.isArray(p.extracted_info.images)&&p.extracted_info.images.forEach(A=>{A.url&&!m.some(v=>v.url===A.url)&&m.push({url:A.url,description:A.description})})}i(m.slice(0,4))},[r]);const o=e.reduce((m,[f,p])=>{if(f==="brand_name")return m;const A=t(f);return A&&(m[p.group]||(m[p.group]=new Map),m[p.group].has(f)||m[p.group].set(f,{value:A,metadata:p})),m},{}),l=t("niche"),c=t("target_geography"),d=t("elevator_pitch"),u=t("url"),h=typeof u=="string"?u:null;return n.jsx(Te,{className:"relative overflow-hidden bg-white shadow-xl",children:n.jsxs(ol,{className:"h-[calc(100vh-8rem)]",children:[n.jsxs("div",{className:"relative px-8 pt-8 pb-6",children:[n.jsxs("div",{className:"text-xs text-zinc-500 font-semibold tracking-[0.2em] uppercase text-center mb-4",children:[n.jsx(mr,{className:"inline w-3 h-3 mr-1"}),"BRAND PREVIEW"]}),n.jsx(ut.h1,{className:"text-4xl md:text-5xl lg:text-6xl font-bold text-center text-zinc-900 mb-8",initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.6},children:s}),a.length>0&&n.jsx(ut.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.6,delay:.2},className:"mb-8",children:n.jsx("div",{className:`grid gap-4 ${a.length===1?"grid-cols-1 max-w-md mx-auto":a.length===2?"grid-cols-2 max-w-2xl mx-auto":a.length===3?"grid-cols-3 max-w-4xl mx-auto":"grid-cols-4 max-w-5xl mx-auto"}`,children:a.map((m,f)=>n.jsxs(ut.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},transition:{duration:.4,delay:.3+f*.1},className:"relative group",children:[n.jsxs("div",{className:"relative overflow-hidden rounded-lg shadow-lg",children:[n.jsx("img",{src:m.url,alt:m.description||`${s} image ${f+1}`,className:"w-full h-48 object-cover group-hover:scale-105 transition-transform duration-500"}),n.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/20 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-300"})]}),n.jsx("div",{className:"relative h-24 mt-1 overflow-hidden opacity-30",children:n.jsx("img",{src:m.url,alt:"",className:"w-full h-48 object-cover transform rotate-180 -translate-y-24",style:{maskImage:"linear-gradient(to bottom, transparent 0%, rgba(0,0,0,0.4) 100%)",WebkitMaskImage:"linear-gradient(to bottom, transparent 0%, rgba(0,0,0,0.4) 100%)"}})})]},f))})}),n.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-3",children:[l&&n.jsxs(ut.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},transition:{delay:.6},className:"px-4 py-2 bg-blue-100 text-blue-700 rounded-full text-sm font-medium",children:[n.jsx(ui,{className:"inline w-3 h-3 mr-1"}),l]}),c&&n.jsxs(ut.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},transition:{delay:.7},className:"px-4 py-2 bg-purple-100 text-purple-700 rounded-full text-sm font-medium",children:[n.jsx(sb,{className:"inline w-3 h-3 mr-1"}),c]}),h&&n.jsxs(ut.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},transition:{delay:.8},className:"px-4 py-2 bg-emerald-100 text-emerald-700 rounded-full text-sm font-medium",children:[n.jsx(Is,{className:"inline w-3 h-3 mr-1"}),h.replace(/^https?:\/\//,"").replace(/\/$/,"")]})]}),d&&n.jsx(ut.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.9},className:"mt-6 max-w-3xl mx-auto",children:n.jsxs("p",{className:"text-zinc-600 text-base leading-relaxed text-center italic",children:['"',d,'"']})})]}),n.jsx("div",{className:"px-8 pb-8",children:n.jsx(qh,{mode:"wait",children:n.jsx(ut.div,{className:"space-y-4",initial:{opacity:0}
2107,animate:{opacity:1},transition:{duration:.3,delay:1},children:Object.entries(o).map(([m,f],p)=>n.jsx(ut.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.3,delay:1+p*.1},children:n.jsxs("div",{className:"bg-zinc-50 rounded-lg p-4",children:[n.jsx("h3",{className:"font-medium text-zinc-600 text-sm mb-3",children:m}),n.jsx("div",{className:"space-y-3",children:Array.from(f.entries()).map(([A,{value:v,metadata:x}],b)=>n.jsxs("div",{children:[b>0&&n.jsx("div",{className:"h-px bg-zinc-200 my-3"}),n.jsxs("div",{children:[n.jsx("div",{className:"text-xs text-zinc-500 mb-1",children:x.description.split(".")[0]}),n.jsx("div",{className:"text-zinc-900 text-sm",children:v})]})]},A))})]})},m))})})})]})})}const Awt={help:0,brand:33,plan:66,success:100},gwt={help:0,brand:50,success:100},$f=["help","brand","plan","success"],NG=Object.entries(cs).filter(([e,t])=>t.keyField&&!t.hidden).sort((e,t)=>e[1].group.localeCompare(t[1].group));function xwt(){const[e,t]=g.useState("help"),[r,s]=g.useState(!0),[a,i]=g.useState(null),[o,l]=g.useState({}),c=xr(),{trackEvent:d,events:u}=Lu(),[h]=Bi(),m=h.get("skipBilling")==="true",f=h.get("brandId"),{setSelectedBrand:p}=mn();g.useEffect(()=>{if(e==="success"&&m){console.log("Success step reached with skipBilling=true, preparing to redirect");const w=setTimeout(async()=>{console.log("Executing redirect to purchase success page"),d(u.USER_ONBOARDING_COMPLETED,{brand_id:o.id,brand_name:o.brand_name,time_to_complete:new Date().getTime()-new Date(o.created_at||Date.now()).getTime(),industry:o.brand_inspiration});const{data:{session:j}}=await de.auth.getSession();if(j)try{await de.schema("marketing_and_customer_success").from("profiles").update({onboarding_completed:!0}).eq("id",j.user.id),console.log("Onboarding completed flag set to true (auto-redirect)")}catch(N){console.error("Error updating onboarding status:",N)}c("/settings/purchase-success?skipBilling=true")},1e3);return()=>clearTimeout(w)}},[e,m,o,c,d]),g.useEffect(()=>{(async()=>{var C,E;console.log("loadOnboardingState called. skipBilling:",m,"urlBrandId:",f);const j=h.get("step"),N=j==="brand";j&&$f.includes(j)&&t(j);const{data:{session:_}}=await de.auth.getSession();if(!_){c("/login");return}if(f){console.log("[WizardLayout] 🎯 Brand ID found in URL:",f),console.log("[WizardLayout] skipBilling mode:",m),console.log("[WizardLayout] Using provided brand ID without skipping initial step"),i(f);const{data:T,error:B}=await de.from("brands").select("*").eq("id",f).single();B?console.error("[WizardLayout] ❌ Error fetching claimed brand from URL:",B):T?(console.log("[WizardLayout] ✅ Successfully loaded claimed brand data:",{id:T.id,name:T.brand_name,status:T.status,url:T.url,elevator_pitch:((C=T.elevator_pitch)==null?void 0:C.substring(0,50))+"...",target_market:((E=T.target_market)==null?void 0:E.substring(0,50))+"...",web_site_scraping_status:T.web_site_scraping_status}),console.log("[DEBUG] Key fields in loaded brand:"),NG.forEach(([L])=>{const P=T[L];P&&console.log(`  - ${L}: ${String(P).substring(0,50)}${String(P).length>50?"...":""}`)}),l(T)):console.warn("[WizardLayout] ⚠️ No brand data returned for URL brand ID:",f),s(!1);return}if(!m){const{data:T}=await de.schema("marketing_and_customer_success").from("profiles").select("onboarding_completed").eq("id",_.user.id).limit(1).single();if(console.log("onboardingStatus",T),T!=null&&T.onboarding_completed&&!N){console.log("[WizardLayout] User has completed onboarding and no brandId in URL, redirecting to dashboard"),
2107c("/dashboard");return}else T!=null&&T.onboarding_completed&&N&&(console.log("[WizardLayout Debug] Onboarding completed but user needs to create a brand"),t("brand"))}const{data:S}=await de.from("brands").select("*").eq("account_id",_.user.id);if(console.log("Found brands for current user:",S==null?void 0:S.map(T=>({id:T.id,status:T.status,scrape_status:T.web_site_scraping_status,name:T.brand_name}))),S!=null&&S.length){const T=S.find(F=>F.web_site_scraping_status==="COMPLETED"),B=S.find(F=>F.status==="DRAFT"),L=[...S].sort((F,M)=>new Date(M.updated_at||0).getTime()-new Date(F.updated_at||0).getTime()),P=T||B||L[0];console.log("Selected brand based on priority:",P.id,T?"(web-scraped)":B?"(draft)":"(most recent)"),i(P.id),l(P)}else console.log("No brands found");s(!1)})()},[m,f]);const A=async w=>{const{data:{session:j}}=await de.auth.getSession();if(!j)return;const N=$f.indexOf(e),_=$f.indexOf(w);if(d(u.FEATURE_USED,{feature:"onboarding_step_change",previous_step:e,next_step:w,direction:_>N?"forward":"backward",user_id:j.user.id}),_>N+1){console.log("Cannot skip steps"),d(u.ERROR_OCCURRED,{error_type:"step_skip_attempt",current_step:e,attempted_step:w});return}if(_>N){if(e==="brand"&&w==="plan"){const{data:S}=await de.from("brands").select("*").eq("status","ACTIVE").limit(1);if(!(S!=null&&S.length)){console.error("No active brand found. Please complete brand setup first."),d(u.ERROR_OCCURRED,{error_type:"missing_active_brand",current_step:e,attempted_step:w});return}if(l(S[0]),d(u.BRAND_CREATED,{brand_id:S[0].id,brand_name:S[0].brand_name,industry:S[0].brand_inspiration}),m){t("success");return}}if(w==="success"){const{data:S}=await de.from("brands").select("*").eq("status","ACTIVE").limit(1);if(!(S!=null&&S.length)){console.error("No active brand found"),d(u.ERROR_OCCURRED,{error_type:"missing_active_brand_at_success",current_step:e});return}l(S[0])}}t(w)},v=w=>{console.log(`Step ${w} completed. skipBilling:`,m);const j=$f[$f.indexOf(w)+1];if(console.log(`Next step should be: ${j}`),h.get("step")==="brand"&&w==="brand"){console.log("[WizardLayout Debug] Post-onboarding brand creation completed, ensuring brand is active"),o!=null&&o.id?x(o.id).then(async()=>{console.log("[WizardLayout Debug] Brand activated, ensuring onboarding is marked complete");const{data:{session:S}}=await de.auth.getSession();if(S)try{await de.schema("marketing_and_customer_success").from("profiles").update({onboarding_completed:!0}).eq("id",S.user.id),console.log("[WizardLayout Debug] Ensured onboarding_completed is true")}catch(C){console.error("[WizardLayout Debug] Error updating onboarding status:",C)}
2107console.log("[WizardLayout Debug] Redirecting to dashboard"),c("/dashboard")}).catch(S=>{console.error("[WizardLayout Debug] Failed to activate brand:",S),c("/dashboard")}):(console.log("[WizardLayout Debug] No brand ID available, redirecting to dashboard anyway"),c("/dashboard"));return}if(m&&w==="brand"){console.log("🔍 DEBUG: skipBilling=true and brand step completed - will trigger convergence processing"),console.log("Moving to success step immediately"),t("success"),o.id?(console.log("🔍 DEBUG: Processing brand in background:",o.id),setTimeout(()=>{console.log("🔍 DEBUG: Starting background process for brand:",o.id),x(o.id).then(()=>{console.log("🔍 DEBUG: Brand activated successfully, now triggering convergence processing"),o.id&&(console.log("🔍 DEBUG: Triggering brand processing because skipBilling=true"),b(o.id).catch(S=>{console.error("🔍 DEBUG: Brand processing failed, but continuing onboarding:",S)}))}).catch(S=>{console.error("🔍 DEBUG: Failed to set brand as active, but continuing onboarding:",S)})},100)):console.error("🔍 DEBUG: No brand ID available for processing");return}else w==="brand"&&console.log("🔍 DEBUG: Brand step completed but skipBilling=false - NOT triggering convergence processing");j&&A(j)},x=async w=>{try{console.log("Ensuring brand is active:",w);const{data:j,error:N}=await de.from("brands").update({status:"ACTIVE",updated_at:new Date().toISOString()}).eq("id",w).select().single();N?console.error("Failed to update brand status:",N):(console.log("Brand status updated to ACTIVE"),l(_=>({..._,status:"ACTIVE"})),j&&p(j))}catch(j){console.error("Error updating brand status:",j)}},b=async w=>{try{console.log("🔍 DEBUG: Triggering brand processing for brand:",w),console.log("🔍 DEBUG: Current step:",e,"skipBilling:",m),console.log("🔍 DEBUG: Brand data:",JSON.stringify(o));const{data:{session:j}}=await de.auth.getSession();if(!j){console.error("🔍 DEBUG: No active session found when trying to trigger brand processing");return}
2107console.log("🔍 DEBUG: Session user ID:",j.user.id);const N=new Promise((E,T)=>{setTimeout(()=>T(new Error("Brand processing request timed out")),5e3)}),_="https://worker.rainfactory.ai/rainfactory/brand-genius/process_updated_brand";console.log("🔍 DEBUG: Calling API endpoint:",_);const S=fetch(_,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${j.access_token}`,apikey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im9sZ25uZW5jY3F3d2JhaGNwc2duIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MjQxNjUyMDksImV4cCI6MjAzOTc0MTIwOX0.qUa9W4vEYLC7LaUPczpqHA9tp8NSiWB7POqOWEvJpYQ"},body:JSON.stringify({brandId:w,userId:j.user.id})}),C=await Promise.race([S,N]);if(C.ok){const E=await C.json();console.log("🔍 DEBUG: Brand processing response:",JSON.stringify(E)),console.log("🔍 DEBUG: Brand processing triggered successfully")}else throw console.error("🔍 DEBUG: API response not OK:",C.status,C.statusText),new Error(`Failed to trigger brand processing: ${C.statusText}`)}catch(j){throw console.error("🔍 DEBUG: Error triggering brand processing:",j),j}},y=w=>{var j;if(console.log("Brand data update received:",w.id?`ID: ${w.id}`:"No ID"),console.log("[DEBUG handleBrandUpdate] Full data received:",{id:w.id,brand_name:w.brand_name,elevator_pitch:((j=w.elevator_pitch)==null?void 0:j.substring(0,50))+"...",url:w.url,keyCount:Object.keys(w).length}),w.id||console.log("Field update contains these properties:",Object.keys(w).join(", ")),e==="help"&&w.id===void 0&&Object.keys(w).some(N=>["brand_name","brand_description","product_description","target_audience"].includes(N))){console.log("Skipping form field update from HelpWizardStep to prevent circular updates"),l(N=>({...N,...w}));return}if(e==="brand"&&w.id===void 0&&!w.status&&Object.keys(w).every(N=>["brand_name","brand_description","product_description","target_audience","competitors","customer_challenges","unique_value_proposition","brand_story","brand_mission","brand_values"].includes(N))){console.log("Handling form field update from BrandWizardStep - updating preview only"),l(N=>({...N,...w}));return}if(w.web_site_scraping_status&&console.log("Received brand update with scraping status:",w.web_site_scraping_status),l(N=>({...N,...w})),w.id){if(console.log("Setting existingBrandId from brand update:",w.id),a&&a!==w.id){if(console.log("WARNING: Brand ID changed from",a,"to",w.id),console.log("Current step:",e,"skipBilling:",m),o.web_site_scraping_status==="COMPLETED"){console.log("Current brand has completed web scraping - preserving it");return}if(m&&f&&f!==w.id){console.log("In skipBilling mode - prioritizing URL brand ID:",f),console.log("Ignoring new brand update with ID:",w.id),i(f);return}}i(w.id),m&&w.id&&(console.log("Setting selected brand in localStorage:",w.id),localStorage.setItem("selectedBrandId",w.id))}};return r?n.jsx("div",{className:"flex items-center justify-center min-h-screen bg-gradient-to-br from-purple-50 via-white to-pink-50",children:n.jsxs("div",{className:"relative",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-purple-400 to-pink-400 rounded-full blur-lg opacity-40 animate-pulse"}),n.jsx("div",{className:"relative bg-white rounded-xl p-8 shadow-xl",children:n.jsxs("div",{className:"flex flex-col items-center gap-4",children:[n.jsx("div",{className:"w-12 h-12 bg-gradient-to-br from-purple-500 to-pink-500 rounded-xl animate-spin",style:{animationDuration:"3s"}}),n.jsx("p",{className:"text-gray-600 font-medium",children:"Loading your experience..."})]})})]})}):n.jsxs("div",{className:"relative min-h-screen bg-gradient-to-br from-purple-50 via-white to-pink-50",children:[n.jsxs("div",{className:"absolute inset-0 overflow-hidden",children:[n.jsx("div",{className:"absolute -top-40 -right-40 w-80 h-80 bg-purple-200 rounded-full mix-blend-multiply filter blur-xl opacity-30 animate-blob"}),n.jsx("div",{className:"absolute -bottom-40 -left-40 w-80 h-80 bg-pink-200 rounded-full mix-blend-multiply filter blur-xl opacity-30 animate-blob animation-delay-2000"}),n.jsx("div",{className:"absolute top-40 left-40 w-72 h-72 bg-yellow-200 rounded-full mix-blend-multiply filter blur-xl opacity-20 animate-blob animation-delay-4000"})]}),n.jsx("style",{children:`
2108        @keyframes blob {
2109          0% { transform: translate(0px, 0px) scale(1); }
2110          33% { transform: translate(30px, -50px) scale(1.1); }
2111          66% { transform: translate(-20px, 20px) scale(0.9); }
2112          100% { transform: translate(0px, 0px) scale(1); }
2113        }
2114        .animate-blob { animation: blob 7s infinite; }
2115        .animation-delay-2000 { animation-delay: 2s; }
2116        .animation-delay-4000 { animation-delay: 4s; }
2117      `}),n.jsx("div",{className:"container mx-auto p-4 sm:p-6 lg:p-8 min-h-screen relative z-10",children:n.jsxs("div",{className:"flex flex-col lg:grid lg:grid-cols-[45%_55%] ga
2117p-6 max-w-7xl mx-auto",children:[n.jsx("div",{children:n.jsxs(Te,{className:"relative bg-white/95 backdrop-blur-xl shadow-xl border border-purple-100/50 rounded-2xl overflow-hidden",children:[n.jsx("div",{className:"absolute top-0 inset-x-0 h-1 bg-gradient-to-r from-purple-400 via-pink-400 to-blue-400"}),n.jsx("div",{className:"p-6 sm:p-8",children:n.jsxs(Cs,{value:e,className:"w-full",children:[n.jsxs(ol,{children:[n.jsxs(ps,{className:ye("grid w-full mb-4 bg-gray-50/50 p-1 rounded-xl",m?"grid-cols-3":"grid-cols-4"),children:[n.jsx(pt,{value:"help",disabled:e!=="help"&&e==="success",onClick:()=>A("help"),className:"group relative rounded-lg transition-all duration-200 data-[state=active]:bg-white data-[state=active]:shadow-md data-[state=active]:text-purple-700 py-2.5",children:n.jsxs("div",{className:"flex items-center justify-center gap-1.5",children:[n.jsx(Xm,{className:"opacity-60 group-data-[state=active]:opacity-100 group-data-[state=active]:text-purple-600",size:16,strokeWidth:2}),e==="help"&&n.jsx("span",{className:"hidden sm:inline font-medium",children:"Welcome"}),n.jsx(Be,{className:ye("ml-1.5 transition-all",e==="help"?"bg-gradient-to-r from-purple-500 to-pink-500 text-white border-0":"bg-gray-100 text-gray-600"),children:"1"})]})}),n.jsx(pt,{value:"brand",disabled:e!=="brand"&&$f.indexOf(e)>1,onClick:()=>A("brand"),className:"group relative rounded-lg transition-all duration-200 data-[state=active]:bg-white data-[state=active]:shadow-md data-[state=active]:text-purple-700 py-2.5",children:n.jsxs("div",{className:"flex items-center justify-center gap-1.5",children:[n.jsx(zh,{className:"opacity-60 group-data-[state=active]:opacity-100 group-data-[state=active]:text-purple-600",size:16,strokeWidth:2}),e==="brand"&&n.jsx("span",{className:"hidden sm:inline font-medium",children:"Brand"}),n.jsx(Be,{className:ye("ml-1.5 transition-all",e==="brand"?"bg-gradient-to-r from-purple-500 to-pink-500 text-white border-0":"bg-gray-100 text-gray-600"),children:"2"})]})}),!m&&n.jsx(pt,{value:"plan",disabled:e!=="plan"&&$f.indexOf(e)>2,onClick:()=>A("plan"),className:"group relative rounded-lg transition-all duration-200 data-[state=active]:bg-white data-[state=active]:shadow-md data-[state=active]:text-purple-700 py-2.5",children:n.jsxs("div",{className:"flex items-center justify-center gap-1.5",children:[n.jsx(sg,{className:"opacity-60 group-data-[state=active]:opacity-100 group-data-[state=active]:text-purple-600",size:16,strokeWidth:2}),e==="plan"&&n.jsx("span",{className:"hidden sm:inline font-medium",children:"Plan"}),n.jsx(Be,{className:ye("ml-1.5 transition-all",e==="plan"?"bg-gradient-to-r from-purple-500 to-pink-500 text-white border-0":"bg-gray-100 text-gray-600"),children:"3"})]})}),n.jsx(pt,{value:"success",disabled:e!=="success",onClick:()=>A("success"),className:"group relative rounded-lg transition-all duration-200 data-[state=active]:bg-white data-[state=active]:shadow-md data-[state=active]:text-purple-700 py-2.5",children:n.jsxs("div",{className:"flex items-center justify-center gap-1.5",children:[n.jsx(di,{className:"opacity-60 group-data-[state=active]:opacity-100 group-data-[state=active]:text-purple-600",size:16,strokeWidth:2}),e==="success"&&n.jsx("span",{className:"hidden sm:inline font-medium",children:"Start Creating"}),n.jsx(Be,{className:ye("ml-1.5 transition-all",e==="success"?"bg-gradient-to-r from-green-500 to-emerald-500 text-white border-0":"bg-gray-100 text-gray-600"),children:m?"3":"4"})]})})]}),n.jsx(_O,{orientation:"horizontal"})]}),n.jsxs("div",{className:"relative mt-6 mb-8",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-purple-200 to-pink-200 rounded-full blur opacity-30"}),n.jsx(Ou,{value:m&&e!=="plan"?gwt[e]:Awt[e],className:"relative h-2 bg-gray-100"})]}),n.jsxs("div",{className:"mt-6",children:[n.jsx(Ct,{value:"help",className:"animate-fadeIn",children:n.jsx(hwt,{onComplete:()=>v("help"),onBrandUpdate:y,skipBilling:m,existingBrandId:a})}),n.jsx(Ct,{value:"brand",className:"animate-fadeIn",children:n.jsx(lwt,{onComplete:()=>v("brand"),onPrevious:()=>A("help"),existingBrandId:a||null,onBrandUpdate:y,skipBilling:m})}),n.jsx(Ct,{value:"plan",className:"animate-fadeIn",children:n.jsx(mwt,{onComplete:()=>v("plan")})}),n.jsx(Ct,{value:"success",className:"animate-fadeIn",children:n.jsxs("div",{className:"text-center py-12",children:[n.jsxs("div",{className:"relative inline-flex items-center justify-center mb-6",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-green-400 to-emerald-400 rounded-full blur-xl opacity-40 animate-pulse"}),n.jsx("div",{className:"relative w-20 h-20 bg-gradient-to-br from-green-500 to-emerald-500 rounded-full flex items-center justify-center shadow-xl",children:n.jsx(di,{className:"w-10 h-10 text-white"})})]}),n.jsx("h2",{className:"text-3xl font-bold mb-3 bg-gradient-to-r from-gray-900 to-gray-700 bg-clip-text text-transparent",children:"Setup Complete!"}),n.jsx("p",{className:"text-gray-600 mb-8 text-lg",children:"Your brand is ready to start growing."}),n.jsx("button",{onClick:()=>{console.log("Success step button clicked. skipBilling:",m),d(u.USER_ONBOARDING_COMPLETED,{brand_id:o.id,brand_name:o.brand_name,time_to_complete:new Date().getTime()-new Date(o.created_at||Date.now()).getTime(),industry:o.brand_inspiration}
2117),(async()=>{try{const{data:{session:j}}=await de.auth.getSession();if(!j)return;await de.schema("marketing_and_customer_success").from("profiles").update({onboarding_completed:!0}).eq("id",j.user.id),console.log("Onboarding completed flag set to true"),m?(console.log("Redirecting to purchase success page"),c("/settings/purchase-success?skipBilling=true")):c("/dashboard")}catch(j){console.error("Error updating onboarding status:",j),c(m?"/settings/purchase-success?skipBilling=true":"/dashboard")}})()},className:"bg-gradient-to-r from-purple-600 to-pink-600 hover:from-purple-700 hover:to-pink-700 text-white px-8 py-3 rounded-xl font-semibold transform hover:scale-105 transition-all duration-200 shadow-lg hover:shadow-xl",children:n.jsxs("span",{className:"flex items-center gap-2",children:[m?"Continue to Brand Campaign":"Go to Dashboard",n.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 7l5 5m0 0l-5 5m5-5H6"})})]})})]})})]})]})}),n.jsx("style",{children:`
2118                @keyframes fadeIn {
2119                  from { opacity: 0; transform: translateY(10px); }
2120                  to { opacity: 1; transform: translateY(0); }
2121                }
2122                .animate-fadeIn { animation: fadeIn 0.3s ease-out; }
2123              `})]})}),n.jsx("div",{children:n.jsx(pwt,{keyFields:NG,formValues:o,currentStep:0,getCurrentValue:w=>{const j=o[w]||"";return(w==="brand_name"||w==="elevator_pitch"||w==="url")&&console.log(`[DEBUG BrandPreview] Getting field '${w}':`,j||"(empty)"),j}})})]})})]})}const H4=768;function vwt(){const[e,t]=g.useState(void 0);return g.useEffect(()=>{const r=window.matchMedia(`(max-width: ${H4-1}px)`),s=()=>{t(window.innerWidth<H4)};return r.addEventListener("change",s),t(window.innerWidth<H4),()=>r.removeEventListener("change",s)},[]),!!e}const Ece=hI,bwt=uI,Bce=g.forwardRef(({className:e,...t},r)=>n.jsx(by,{className:ye("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",e),...t,ref:r}));Bce.displayName=by.displayName;const ywt=Jm("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{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"}}),qL=g.forwardRef(({side:e="right",className:t,children:r,...s},a)=>n.jsxs(bwt,{children:[n.jsx(Bce,{}),n.jsxs(yy,{ref:a,className:ye(ywt({side:e}),t),...s,children:[r,n.jsxs(P_,{className:"absolute right-4 top-4 roun
2123ded-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:[n.jsx(kr,{className:"h-4 w-4"}),n.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));qL.displayName=yy.displayName;const wwt=g.forwardRef(({className:e,...t},r)=>n.jsx(wy,{ref:r,className:ye("text-lg font-semibold text-foreground",e),...t}));wwt.displayName=wy.displayName;const jwt=g.forwardRef(({className:e,...t},r)=>n.jsx(jy,{ref:r,className:ye("text-sm text-muted-foreground",e),...t}));jwt.displayName=jy.displayName;const _G="sidebar:state",Nwt=60*60*24*7,_wt="16rem",Cwt="18rem",Swt="3rem",kwt="b",Tce=g.createContext(null);function Ek(){const e=g.useContext(Tce);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}const Pce=g.forwardRef(({defaultOpen:e=!0,open:t,onOpenChange:r,className:s,style:a,children:i,...o},l)=>{const c=vwt(),[d,u]=g.useState(!1),[h,m]=g.useState(()=>{if(typeof document>"u")return e;const b=document.cookie.split("; ").find(y=>y.startsWith(_G));return b?b.split("=")[1]==="true":e}),f=t??h,p=g.useCallback(b=>{if(r)return r==null?void 0:r(typeof b=="function"?b(f):b);m(b),document.cookie=`${_G}=${f}; path=/; max-age=${Nwt}`},[r,f]),A=g.useCallback(()=>c?u(b=>!b):p(b=>!b),[c,p,u]);g.useEffect(()=>{const b=y=>{y.key===kwt&&(y.metaKey||y.ctrlKey)&&(y.preventDefault(),A())};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[A]);const v=f?"expanded":"collapsed",x=g.useMemo(()=>({state:v,open:f,setOpen:p,isMobile:c,openMobile:d,setOpenMobile:u,toggleSidebar:A}),[v,f,p,c,d,u,A]);return n.jsx(Tce.Provider,{value:x,children:n.jsx(Ya,{delayDuration:0,children:n.jsx("div",{style:{"--sidebar-width":_wt,"--sidebar-width-icon":Swt,...a},className:ye("group/sidebar-wrapper flex min-h-svh text-sidebar-foreground has-[[data-variant=inset]]:bg-sidebar",s),ref:l,...o,children:i})})})});Pce.displayName="SidebarProvider";const Ice=g.forwardRef(({side:e="left",variant:t="sidebar",collapsible:r="offcanvas",className:s,children:a,...i},o)=>{const{isMobile:l,state:c,openMobile:d,setOpenMobile:u}=Ek();return r==="none"?n.jsx("div",{className:ye("flex h-full w-[--sidebar-width] flex-col bg-sidebar text-sidebar-foreground",s),ref:o,...i,children:a}):l?n.jsx(Ece,{open:d,onOpenChange:u,...i,children:n.jsx(qL,{"data-sidebar":"sidebar","data-mobile":"true",className:"w-[--sidebar-width] bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",style:{"--sidebar-width":Cwt},side:e,children:n.jsx("div",{className:"flex h-full w-full flex-col",children:a})})}):n.jsxs("div",{ref:o,className:"group peer hidden md:block","data-state":c,"data-collapsible":c==="collapsed"?r:"","data-variant":t,"data-side":e,children:[n.jsx("div",{className:ye("duration-200 relative h-svh w-[--sidebar-width] bg-transparent transition-[width] ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",t==="floating"||t==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]":"group-data-[collapsible=icon]:w-[--sidebar-width-icon]")}),n.jsx("div",{className:ye("duration-200 fixed inset-y-0 z-10 hidden h-svh w-[--sidebar-width] transition-[left,right,width] ease-linear md:flex",e==="left"?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",t==="floating"||t==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4)_+2px)]":"group-data-[collapsible=icon]:w-[--sidebar-width-icon] group-data-[side=left]:border-r group-data-[side=right]:border-l",s),...i,children:n.jsx("div",{"data-sidebar":"sidebar",className:"flex h-full w-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow",children:a})})]})});Ice.displayName="Sidebar";const Ewt=g.forwardRef(({className:e,onClick:t,...r},s)=>{const{toggleSidebar:a}=Ek();return n.jsxs(te,{ref:s,"data-sidebar":"trigger",variant:"ghost",size:"icon",className:ye("h-7 w-7",e),onClick:i=>{t==null||t(i),a()},...r,children:[n.jsx(eve,{}),n.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})});Ewt.displayName="SidebarTrigger";const Bwt=g.forwardRef(({className:e,...t},r)=>{const{toggleSidebar:s}=Ek();return n.jsx("button",{ref:r,"data-sidebar":"rail","aria-label":"Toggle Sidebar",tabIndex:-1,onClick:s,title:"Toggle Sidebar",className:ye("absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] hover:after:bg-sidebar-border group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex","[[data-side=left]_&]:cursor-w-resize [[data-side=right]_&]:cursor-e-resize","[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize","group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full group-data-[collapsible=offcanvas]:hover:bg-sidebar","[[data-side=left][data-collapsible=offcanvas]_&]:-right-2","[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",e),...t})});Bwt.displayName="SidebarRail";const Twt=g.forwardRef(({className:e,...t},r)=>n.jsx("main",{ref:r,className:ye("relative flex min-h-svh flex-1 flex-col bg-background","peer-data-[variant=inset]:min-
2123h-[calc(100svh-theme(spacing.4))] md:peer-data-[variant=inset]:m-2 md:peer-data-[state=collapsed]:peer-data-[variant=inset]:ml-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow",e),...t}));Twt.displayName="SidebarInset";const Pwt=g.forwardRef(({className:e,...t},r)=>n.jsx(qe,{ref:r,"data-sidebar":"input",className:ye("h-8 w-full bg-background shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring",e),...t}));Pwt.displayName="SidebarInput";const Oce=g.forwardRef(({className:e,...t},r)=>n.jsx("div",{ref:r,"data-sidebar":"header",className:ye("flex flex-col gap-2 p-2",e),...t}));Oce.displayName="SidebarHeader";const Fce=g.forwardRef(({className:e,...t},r)=>n.jsx("div",{ref:r,"data-sidebar":"footer",className:ye("flex flex-col gap-2 p-2",e),...t}));Fce.displayName="SidebarFooter";const Iwt=g.forwardRef(({className:e,...t},r)=>n.jsx(xn,{ref:r,"data-sidebar":"separator",className:ye("mx-2 w-auto bg-sidebar-border",e),...t}));Iwt.displayName="SidebarSeparator";const Lce=g.forwardRef(({className:e,...t},r)=>n.jsx("div",{ref:r,"data-sidebar":"content",className:ye("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",e),...t}));Lce.displayName="SidebarContent";const Owt=g.forwardRef(({className:e,...t},r)=>n.jsx("div",{ref:r,"data-sidebar":"group",className:ye("relative flex w-full min-w-0 flex-col p-2",e),...t}));Owt.displayName="SidebarGroup";const Fwt=g.forwardRef(({className:e,asChild:t=!1,...r},s)=>{const a=t?tp:"div";return n.jsx(a,{ref:s,"data-sidebar":"group-label",className:ye("duration-200 flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 outline-none ring-sidebar-ring transition-[margin,opa] ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",e),...r})});Fwt.displayName="SidebarGroupLabel";const Lwt=g.forwardRef(({className:e,asChild:t=!1,...r},s)=>{const a=t?tp:"button";return n.jsx(a,{ref:s,"data-sidebar":"group-action",className:ye("absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 after:md:hidden","group-data-[collapsible=icon]:hidden",e),...r})});Lwt.displayName="SidebarGroupAction";const Dwt=g.forwardRef(({className:e,...t},r)=>n.jsx("div",{ref:r,"data-sidebar":"group-content",className:ye("w-full text-sm",e),...t}));Dwt.displayName="SidebarGroupContent";const Yj=g.forwardRef(({className:e,...t},r)=>n.jsx("ul",{ref:r,"data-sidebar":"menu",className:ye("flex w-full min-w-0 flex-col gap-1",e),...t}));Yj.displayName="SidebarMenu";const uA=g.forwardRef(({className:e,...t},r)=>n.jsx("li",{ref:r,"data-sidebar":"menu-item",className:ye("group/menu-item relative",e),...t}));uA.displayName="SidebarMenuItem";const Rwt=Jm("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:!p-0"}},defaultVariants:{variant:"default",size:"default"}}),hA=g.forwardRef(({asChild:e=!1,isActive:t=!1,variant:r="default",size:s="default",tooltip:a,className:i,...o},l)=>{const c=e?tp:"button",{isMobile:d,state:u}=Ek(),h=n.jsx(c,{ref:l,"data-sidebar":"menu-button","data-size":s,"data-active":t,className:ye(Rwt({variant:r,size:s}),i),...o});
2123return a?(typeof a=="string"&&(a={children:a}),n.jsxs(Hs,{children:[n.jsx(zs,{asChild:!0,children:h}),n.jsx(Vn,{side:"right",align:"center",hidden:u!=="collapsed"||d,...a})]})):h});hA.displayName="SidebarMenuButton";const Uwt=g.forwardRef(({className:e,asChild:t=!1,showOnHover:r=!1,...s},a)=>{const i=t?tp:"button";return n.jsx(i,{ref:a,"data-sidebar":"menu-action",className:ye("absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 peer-hover/menu-button:text-sidebar-accent-foreground [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 after:md:hidden","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",r&&"group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0",e),...s})});Uwt.displayName="SidebarMenuAction";const Mwt=g.forwardRef(({className:e,...t},r)=>n.jsx("div",{ref:r,"data-sidebar":"menu-badge",className:ye("absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums text-sidebar-foreground select-none pointer-events-none","peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",e),...t}));Mwt.displayName="SidebarMenuBadge";const $wt=g.forwardRef(({className:e,showIcon:t=!1,...r},s)=>{const a=g.useMemo(()=>`${Math.floor(Math.random()*40)+50}%`,[]);return n.jsxs("div",{ref:s,"data-sidebar":"menu-skeleton",className:ye("rounded-md h-8 flex gap-2 px-2 items-center",e),...r,children:[t&&n.jsx(Lt,{className:"size-4 rounded-md","data-sidebar":"menu-skeleton-icon"}),n.jsx(Lt,{className:"h-4 flex-1 max-w-[--skeleton-width]","data-sidebar":"menu-skeleton-text",style:{"--skeleton-width":a}})]})});$wt.displayName="SidebarMenuSkeleton";const Dce=g.forwardRef(({className:e,...t},r)=>n.jsx("ul",{ref:r,"data-sidebar":"menu-sub",className:ye("mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5","group-data-[collapsible=icon]:hidden",e),...t}));Dce.displayName="SidebarMenuSub";const Rce=g.forwardRef(({...e},t)=>n.jsx("li",{ref:t,...e}));Rce.displayName="SidebarMenuSubItem";const Uce=g.forwardRef(({asChild:e=!1,size:t="md",isActive:r,className:s,...a},i)=>{const o=e?tp:"a";return n.jsx(o,{ref:i,"data-sidebar":"menu-sub-button","data-size":t,"data-active":r,className:ye("flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground outline-none ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground","data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",t==="sm"&&"text-xs",t==="md"&&"text-sm","group-data-[collapsible=icon]:hidden",s),...a})});Uce.displayName="SidebarMenuSubButton";const Qwt=()=>[{name:"Automation",icon:en,href:"/automation"},{name:"Convergences",icon:mr,href:"/convergences"},{name:"Trends",icon:sa,href:"/trends"},{name:"Content",icon:Xr,href:"/content"}],Hwt=e=>[{name:"Brand Genius",icon:Gi,href:e?`/brands/${e}`:"/brand-genius"},{name:"Brand Analysis",icon:sl,href:e?`/brands/${e}/analysis`:"/brand-genius"},{name:"Brand Settings",icon:x2,href:e?`/brands/${e}/settings`:"/brand/settings"},{name:"Brand Resources",icon:Sxe,href:e?`/brands/${e}/resources`:"/brand/resources"},{name:"RSS Feed",icon:Ey,href:e?`/brands/${e}/rss-feed`:"/brands/rss-feed"}],zwt=[{name:"Brands",icon:_I,href:"/brands"},{name:"Team",icon:Ka,href:"/settings/team"},{name:"Subscription & Billing",icon:fs,href:"/settings"},{name:"Guides",icon:Xm,href:"/help"}],z4="selectedBrandId",Vwt=({className:e})=>{const{brands:t,selectedBrand:r,setSelectedBrand:s}=mn(),a=xr(),{isAdmin:i}=rp(),o=Gs(),[l,c]=g.useState(!1),[d,u]=g.useState(!1),h=g.useRef(null),m=w=>{if(w==="/automation")return o.pathname==="/automation"||/^\/brands\/[^\/]+\/connections$/.test(o.pathname)||/^\/brands\/[^\/]+\/connections\/[^\/]+\/settings$/.test(o.pathname);if(w==="/campaigns")return o.pathname.startsWith("/campaigns");if(w==="/convergences")return o.pathname.startsWith("/convergences");if(w==="/content")return o.pathname.startsWith("/content");
2123if(w==="/trends")return o.pathname.startsWith("/trends");if(w==="/brands")return!/^\/brands\/[^\/]+\/connections/.test(o.pathname)&&(o.pathname==="/brands"||o.pathname.startsWith("/brands/"));if(w==="/settings/team")return o.pathname==="/settings/team";if(w==="/settings")return o.pathname.startsWith("/settings")&&o.pathname!=="/settings/team";if(w==="/help")return o.pathname==="/help";if(w==="/admin")return o.pathname.startsWith("/admin");if(r&&w.includes("/brands/")){if(w.includes(`/brands/${r.id}`))return o.pathname===w;const j=w.replace("/brands/",`/brands/${r.id}/`);return o.pathname===j}return o.pathname===w},f=()=>{if(!r)return!1;const w=`/brands/${r.id}`;return!/^\/brands\/[^\/]+\/connections/.test(o.pathname)&&o.pathname.startsWith(w)&&o.pathname!==w},p=Qwt(),A=r&&r.status==="ACTIVE"?Hwt(r.id):[],v=[...t].filter(w=>w.status==="ACTIVE").sort((w,j)=>w.brand_name.localeCompare(j.brand_name));g.useEffect(()=>{r&&r.status==="DELETED"&&(console.log("LeftSidebar - selected brand is deleted, clearing selection:",r),s(null),localStorage.removeItem(z4))},[r,s]),g.useEffect(()=>{v.length===0&&r&&(console.log("LeftSidebar - no ACTIVE brands available, clearing selection"),s(null),localStorage.removeItem(z4))},[v,r,s]),g.useEffect(()=>{(!r||r.status!=="ACTIVE")&&(c(!1),u(!1))},[r]),g.useEffect(()=>{r&&r.status==="ACTIVE"&&f()&&!d&&c(!0)},[o.pathname,r]),g.useEffect(()=>()=>{h.current&&clearTimeout(h.current)},[]);const x=async w=>{if(w.status!=="ACTIVE"){console.warn("Attempted to select non-ACTIVE brand:",w);return}s(w),localStorage.setItem(z4,w.id),u(!1);const j=window.location.pathname;if(/^\/brands\/[^\/]+/.test(j)){const _=j.replace(/^\/brands\/[^\/]+/,`/brands/${w.id}`),S=window.location.search;a(_+S)}},b=async()=>{try{a("/logout")}catch(w){console.error("Error during logout:",w)}},y=[...i?[{name:"Superadmin",icon:wB,href:"/admin"}]:[],...zwt];return n.jsxs("aside",{className:ye("w-64 shrink-0 flex flex-col h-screen relative overflow-hidden",e),children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-slate-50 via-white to-blue-50/30"}),n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsx(Pce,{defaultOpen:!0,children:n.jsxs(Ice,{className:"flex flex-col h-full relative bg-transparent border-r border-white/50 shadow-lg hover:shadow-xl transition-all duration-300 backdrop-blur-sm",variant:"sidebar",collapsible:"none",children:[n.jsxs(Oce,{className:"border-b border-white/50 flex-shrink-0 relative overflow-hidden shadow-sm",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-white via-blue-50/30 to-indigo-50/40"}),n.jsx("div",{className:"absolute top-0 right-0 w-20 h-20 bg-gradient-to-br from-blue-200/20 to-transparent rounded-full -translate-y-10 translate-x-10"}),n.jsx("div",{className:"relative w-full flex justify-center px-4 py-3 backdrop-blur-sm",children:n.jsxs(Ir,{to:"/",className:"text-xl font-bold flex flex-col items-center gap-2 group transition-all duration-300 hover:scale-105",children:[n.jsx("div",{className:"p-2 bg-white/80 backdrop-blur-sm rounded-xl shadow-lg group-hover:shadow-xl transition-all duration-300",children:n.jsx("img",{src:Kg,alt:"Rainfactory AI",className:"w-12"})}),n.jsx("span",{className:"bg-gradient-to-r from-blue-700 via-indigo-700 to-purple-700 bg-clip-text text-transparent group-hover:from-blue-600 group-hover:via-indigo-600 group-hover:to-purple-600 transition-all duration-300",children:"Rainfactory AI"})]})}),n.jsx(Yj,{children:n.jsx(uA,{children:v.length>0?n.jsxs(ll,{children:[n.jsx(cl,{asChild:!0,children:n.jsxs(hA,{className:"h-auto min-h-[2.5rem] py-2",children:[n.jsx("span",{className:"text-lg font-medium line-clamp-2 max-w-[180px] leading-tight",children:r&&r.status==="ACTIVE"?r.brand_name:"Select a brand"}),n.jsx(Un,{className:"ml-auto h-4 w-4 flex-shrink-0"})]})}),n.jsx(fo,{className:"w-[--radix-popper-anchor-width] z-[110]",children:v.filter(w=>w.status==="ACTIVE").map(w=>n.jsxs(Fr,{onClick:()=>x(w),className:"flex items-center justify-between",children:[n.jsx("span",{className:"truncate mr-2",children:w.brand_name}),w.access_source==="direct"&&n.jsx(Ka,{className:"h-3 w-3 text-muted-foreground flex-shrink-0"})]},w.id))})]}):n.jsxs(Ir,{to:"/onboarding",className:"flex items-center justify-center gap-2 px-4 py-2 w-full text-primary hover:bg-primary/10 rounded-md transition-colors",children:[n.jsx(La,{className:"h-5 w-5"}),n.jsx("span",{children:"Set up your brand"})]})})})]}),n.jsx(Lce,{className:"flex-1",children:n.jsxs(Yj,{children:[p.map(w=>{const j=m(w.href);return n.jsx(uA,{children:n.jsx(hA,{asChild:!0,children:n.jsxs(Ir,{to:w.href,className:ye("flex items-center gap-3 transition-all duration-300 group relative overflow-hidden",j?"bg-gradient-to-r from-blue-500/90 to-indigo-600/90 text-white shadow-lg hover:shadow-xl transform hover:scale-105 hover:-translate-y-0.5":"hover:bg-gradient-to-r hover:from-blue-50/80 hover:to-indigo-50/60 hover:scale-105 hover:shadow-md hover:-translate-y-0.5"),children:[n.jsx("div",{className:ye("absolute inset-0 bg-gradient-to-r transition-opacity duration-300",j?"from-white/10 via-trans
2123parent to-white/5 opacity-100":"from-blue-50/30 via-transparent to-indigo-50/20 opacity-0 group-hover:opacity-100")}),n.jsx(w.icon,{className:ye("h-5 w-5 relative z-10 transition-all duration-300",j?"text-white drop-shadow-sm":"group-hover:text-blue-600 group-hover:scale-110")}),n.jsx("span",{className:ye("relative z-10 font-medium transition-all duration-300",j?"text-white drop-shadow-sm bg-gradient-to-r from-white to-blue-100 bg-clip-text text-transparent":"group-hover:text-blue-700 group-hover:font-semibold"),children:w.name})]})})},w.name)}),n.jsxs(uA,{children:[n.jsxs(hA,{className:ye("flex items-center gap-3 w-full justify-between transition-all duration-300 group relative overflow-hidden focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",r&&r.status==="ACTIVE"?f()?"bg-gradient-to-r from-emerald-500/90 to-teal-600/90 text-white shadow-lg hover:shadow-xl transform hover:scale-105 hover:-translate-y-0.5":"hover:bg-gradient-to-r hover:from-emerald-50/80 hover:to-teal-50/60 hover:scale-105 hover:shadow-md hover:-translate-y-0.5 active:scale-95":"opacity-50 cursor-not-allowed hover:opacity-50 focus:opacity-50 active:scale-100"),onClick:()=>{r&&r.status==="ACTIVE"&&(c(!l),u(!0),h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{u(!1)},3e4))},disabled:!r||r.status!=="ACTIVE","aria-label":r&&r.status==="ACTIVE"?"Brand menu":"No active brand available",tabIndex:r&&r.status==="ACTIVE"?0:-1,role:"button","aria-expanded":l,"aria-haspopup":"true","aria-controls":"brand-setup-submenu","data-testid":"brand-setup-menu-button","data-brand-status":(r==null?void 0:r.status)||"none","data-brand-id":(r==null?void 0:r.id)||"none","data-brand-name":(r==null?void 0:r.brand_name)||"none",title:r&&r.status==="ACTIVE"?"Click to open brand menu":"No active brand available",onKeyDown:w=>{(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),r&&r.status==="ACTIVE"&&(c(!l),u(!0),h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{u(!1)},3e4)))},children:[n.jsx("div",{className:ye("absolute inset-0 bg-gradient-to-r transition-opacity duration-300",r&&r.status==="ACTIVE"&&f()?"from-white/10 via-trans
2123parent to-white/5 opacity-100":"from-emerald-50/30 via-transparent to-teal-50/20 opacity-0 group-hover:opacity-100")}),n.jsxs("div",{className:"flex items-center gap-3 relative z-10",children:[r&&r.status==="ACTIVE"?n.jsx(wB,{className:ye("h-5 w-5 transition-all duration-300",f()?"text-white drop-shadow-sm":"group-hover:text-emerald-600 group-hover:scale-110")}):n.jsx(Xm,{className:"h-5 w-5 text-muted-foreground"}),n.jsx("span",{className:ye("font-medium transition-all duration-300",r&&r.status==="ACTIVE"?f()?"text-white drop-shadow-sm bg-gradient-to-r from-white to-emerald-100 bg-clip-text text-transparent":"group-hover:text-emerald-700 group-hover:font-semibold":"text-muted-foreground"),children:r&&r.status==="ACTIVE"?"Brand":"No Active Brand"})]}),r&&r.status==="ACTIVE"&&n.jsx(Un,{className:ye("h-4 w-4 relative z-10 transition-all duration-300",l?"transform rotate-0":"transform -rotate-90",f()?"text-white drop-shadow-sm":"group-hover:text-emerald-600")})]}),l&&r&&r.status==="ACTIVE"&&n.jsx(Dce,{id:"brand-setup-submenu",children:A.map(w=>{const j=m(w.href);return n.jsx(Rce,{children:n.jsx(Uce,{asChild:!0,children:n.jsxs(Ir,{to:w.href,className:ye("flex items-center gap-3 transition-all duration-300 group relative overflow-hidden rounded-lg ml-4",j?"bg-gradient-to-r from-emerald-500/80 to-teal-600/80 text-white shadow-md hover:shadow-lg transform hover:scale-105":"hover:bg-gradient-to-r hover:from-emerald-50/60 hover:to-teal-50/40 hover:scale-105 hover:shadow-sm"),children:[n.jsx("div",{className:ye("absolute inset-0 bg-gradient-to-r transition-opacity duration-300",j?"from-white/10 via-trans
2123parent to-white/5 opacity-100":"from-emerald-50/30 via-transparent to-teal-50/20 opacity-0 group-hover:opacity-100")}),n.jsx(w.icon,{className:ye("h-5 w-5 relative z-10 transition-all duration-300",j?"text-white drop-shadow-sm":"group-hover:text-emerald-600 group-hover:scale-110")}),n.jsx("span",{className:ye("relative z-10 text-sm font-medium transition-all duration-300",j?"text-white drop-shadow-sm":"group-hover:text-emerald-700 group-hover:font-semibold"),children:w.name})]})})},w.name)})})]})]})}),r&&r.status==="ACTIVE"&&n.jsx("div",{className:"px-4 py-3 border-b",children:n.jsx(kL,{showDetails:!0})}),n.jsx(Fce,{className:"flex-shrink-0 border-t border-white/50 mt-auto shadow-sm",children:n.jsxs(Yj,{children:[y.map(w=>{const j=m(w.href);return n.jsx(uA,{children:n.jsx(hA,{asChild:!0,children:n.jsxs(Ir,{to:w.href,className:ye("flex items-center gap-3 transition-all duration-300 group relative overflow-hidden",j?"bg-gradient-to-r from-purple-500/90 to-indigo-600/90 text-white shadow-lg hover:shadow-xl transform hover:scale-105 hover:-translate-y-0.5":"hover:bg-gradient-to-r hover:from-purple-50/80 hover:to-indigo-50/60 hover:scale-105 hover:shadow-md hover:-translate-y-0.5"),children:[n.jsx("div",{className:ye("absolute inset-0 bg-gradient-to-r transition-opacity duration-300",j?"from-white/10 via-trans
2123parent to-white/5 opacity-100":"from-purple-50/30 via-transparent to-indigo-50/20 opacity-0 group-hover:opacity-100")}),n.jsx(w.icon,{className:ye("h-5 w-5 relative z-10 transition-all duration-300",j?"text-white drop-shadow-sm":"group-hover:text-purple-600 group-hover:scale-110")}),n.jsx("span",{className:ye("relative z-10 font-medium transition-all duration-300",j?"text-white drop-shadow-sm bg-gradient-to-r from-white to-purple-100 bg-clip-text text-transparent":"group-hover:text-purple-700 group-hover:font-semibold"),children:w.name})]})})},w.name)}),n.jsx(uA,{children:n.jsxs(hA,{onClick:b,className:"flex items-center gap-3 transition-all duration-300 group relative overflow-hidden hover:bg-gradient-to-r hover:from-red-50/80 hover:to-pink-50/60 hover:scale-105 hover:shadow-md hover:-translate-y-0.5",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-red-50/30 via-transparent to-pink-50/20 opacity-0 group-hover:opacity-100 transition-opacity duration-300"}),n.jsx(NK,{className:"h-5 w-5 relative z-10 transition-all duration-300 group-hover:text-red-600 group-hover:scale-110"}),n.jsx("span",{className:"relative z-10 font-medium transition-all duration-300 group-hover:text-red-700 group-hover:font-semibold",children:"Log Out"})]})})]})})]})})]})};function Gwt({open:e,onOpenChange:t}){const{session:r}=wa(),{selectedBrand:s}=mn(),a=Gs(),[i,o]=g.useState(""),[l,c]=g.useState(!1),[d,u]=g.useState(!1),h=async f=>{var p,A,v,x;f.preventDefault(),c(!0);try{const b={userEmail:((p=r==null?void 0:r.user)==null?void 0:p.email)||"Unknown",userId:((A=r==null?void 0:r.user)==null?void 0:A.id)||"Unknown",brandName:(s==null?void 0:s.brand_name)||"No brand selected",brandId:(s==null?void 0:s.id)||"None",currentPage:a.pathname,currentUrl:window.location.href,timestamp:new Date().toISOString(),userAgent:navigator.userAgent},y=`
2124USER FEEDBACK/QUESTION:
2125${i}
2126
2127---
2128CONTEXT INFORMATION:
2129- User Email: ${b.userEmail}
2130- User ID: ${b.userId}
2131- Brand: ${b.brandName} (${b.brandId})
2132- Current Page: ${b.currentPage}
2133- Full URL: ${b.currentUrl}
2134- Timestamp: ${b.timestamp}
2135- User Agent: ${b.userAgent}
2136      `.trim();if(!(await fetch("https://worker.rainfactory.ai/marketing-functions/submit_contact",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:((v=r==null?void 0:r.user)==null?void 0:v.email)||"Anonymous User",email:((x=r==null?void 0:r.user)==null?void 0:x.email)||"[email protected]",company:(s==null?void 0:s.brand_name)||"N/A",interest:"support",message:y})})).ok)throw new Error("Failed to submit feedback");u(!0),o("")}catch(b){console.error("Error submitting feedback:",b)}finally{c(!1)}},m=()=>{u(!1),o(""),t(!1)};return n.jsx(Zt,{open:e,onOpenChange:t,children:n.jsxs(Jt,{className:"sm:max-w-[600px]",children:[n.jsxs(_r,{children:[n.jsxs(tr,{className:"flex items-center gap-3 text-2xl",children:[n.jsx("div",{className:"p-2 bg-gradient-to-br from-blue-100 to-indigo-200 rounded-xl shadow-sm",children:n.jsx(Om,{className:"h-5 w-5 text-blue-600"})}),"Help & Feedback"]}),n.jsx(Hr,{className:"text-base",children:"Have a question or feedback? Let us know and we'll get back to you as soon as possible."})]}),d?n.jsxs(ut.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},transition:{duration:.6},className:"text-center py-8",children:[n.jsxs(ut.div,{initial:{scale:0},animate:{scale:1},transition:{delay:.2,type:"spring",stiffness:200},className:"relative inline-flex h-20 w-20 items-center justify-center rounded-full bg-gradient-to-br from-green-100 to-emerald-200 mb-6 shadow-lg",children:[n.jsx("div",{className:"absolute inset-0 bg-green-500/20 rounded-full animate-ping"}),n.jsx(di,{className:"h-10 w-10 text-green-600 relative z-10"})]}),n.jsxs(ut.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.4},children:[n.jsx("h3",{className:"text-2xl font-bold mb-3 bg-gradient-to-r from-green-700 to-emerald-600 bg-clip-text text-transparent",children:"Message Sent Successfully!"}),n.jsx("p",{className:"text-gray-600 mb-6 leading-relaxed",children:"Thank you for your feedback! We've received your message and will get back to you shortly."}),n.jsx(te,{onClick:m,variant:"default",children:"Close"})]})]}):n.jsxs("form",{onSubmit:h,className:"space-y-6",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"feedback-message",className:"text-sm font-medium text-gray-700",children:"Your Question or Feedback"}),n.jsx(Zr,{id:"feedback-message",placeholder:"Please provide as much detail as possible about your question or feedback. Include any specific features, pages, or behaviors you're asking about...",value:i,onChange:f=>o(f.target.value),rows:8,className:"resize-none",required:!0}),n.jsx("p",{className:"text-xs text-gray-500",children:"We'll automatically include information about your current session to help us assist you better."})]}),n.jsxs("div",{className:"flex justify-end gap-3",children:[n.jsx(te,{type:"button",variant:"outline",onClick:m,disabled:l,children:"Cancel"}),n.jsx(te,{type:"submit",disabled:l,className:"bg-gradient-to-r from-blue-600 via-purple-600 to-indigo-600 hover:from-blue-700 hover:via-purple-700 hover:to-indigo-700 text-white",children:l?n.jsxs(ut.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},className:"flex items-center gap-2",children:[n.jsx(mr,{className:"h-4 w-4"}),"Sending..."]}):n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Om,{className:"h-4 w-4"}),"Send Feedback"]})})]})]})]})})}function qwt(e,t){if(e==null)return{};var r={},s=Object.keys(e),a,i;for(i=0;i<s.length;i++)a=s[i],!(t.indexOf(a)>=0)&&(r[a]=e[a]);return r}var Kwt=["color"],Wwt=g.forwardRef(function(e,t){var r=e.color,s=r===void 0?"currentColor":r,a=qwt(e,Kwt);return g.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a,{ref:t}),g.createElement("path",{d:"M6.1584 3.13508C6.35985 2.94621 6.67627 2.95642 6.86514 3.15788L10.6151 7.15788C10.7954 7.3502 10.7954 7.64949 10.6151 7.84182L6.86514 11.8418C6.67627 12.0433 6.35985 12.0535 6.1584 11.8646C5.95694 11.6757 5.94673 11.3593 6.1356 11.1579
2136L9.565 7.49985L6.1356 3.84182C5.94673 3.64036 5.95694 3.32394 6.1584 3.13508Z",fill:s,fillRule:"evenodd",clipRule:"evenodd"}))});const Mce=g.forwardRef(({...e},t)=>n.jsx("nav",{ref:t,"aria-label":"breadcrumb",...e}));Mce.displayName="Breadcrumb";const $ce=g.forwardRef(({className:e,...t},r)=>n.jsx("ol",{ref:r,className:ye("flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5",e),...t}));$ce.displayName="BreadcrumbList";const Qce=g.forwardRef(({className:e,...t},r)=>n.jsx("li",{ref:r,className:ye("inline-flex items-center gap-1.5",e),...t}));Qce.displayName="BreadcrumbItem";const Hce=g.forwardRef(({asChild:e,className:t,...r},s)=>{const a=e?tp:"a";return n.jsx(a,{ref:s,className:ye("transition-colors hover:text-foreground",t),...r})});Hce.displayName="BreadcrumbLink";const zce=g.forwardRef(({className:e,...t},r)=>n.jsx("span",{ref:r,role:"link","aria-disabled":"true","aria-current":"page",className:ye("text-foreground",e),...t}));zce.displayName="BreadcrumbPage";const Vce=({children:e,className:t,...r})=>n.jsx("li",{role:"presentation","aria-hidden":"true",className:t,...r,children:e??n.jsx(Wwt,{className:"h-4 w-4"})});Vce.displayName="BreadcrumbSeparator";function Ywt(){const e=Gs(),[t,r]=g.useState([]),[s,a]=g.useState(null);return g.useEffect(()=>{let i=!0;async function o(){var l,c;try{const d=e.pathname.split("/").filter(Boolean),u=[{href:"/dashboard",label:"Home",icon:!0}],h={campaigns:"Campaigns",content:"Content",convergences:"Convergences","brand-genius":"Brand Genius",settings:"Settings",admin:"Admin",help:"Help",connections:"Connections"},m=d.length>=3&&d[0]==="brands"&&d[2]==="connections";for(let f=0;f<d.length;f++){const p=d[f],A=`/${d.slice(0,f+1).join("/")}`;if(f===0&&p==="brands")continue;if(f===1&&d[0]==="brands"&&/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(p))try{const{data:b,error:y}=await de.from("brands").select("brand_name").eq("id",p).single();let w=p;!y&&(b!=null&&b.brand_name)&&(w=b.brand_name),u.push({href:A,label:w,current:f===d.length-1});continue}catch(b){console.error("Error fetching brand name:",b)}if(m&&p==="connections"){f+1<d.length&&d[f+1]!=="settings"&&f++,u.push({href:`/${d.slice(0,3).join("/")}`,label:"Social Automation Agents",current:f===d.length-1});continue}if(h[p]){u.push({href:A,label:h[p],current:f===d.length-1});continue}if(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(p)){let x=p;const b=d[f-1];if(b)try{let y;switch(b){case"campaigns":const{data:w,error:j}=await de.from("campaigns").select("name").eq("id",p).single();if(j)throw j;y=w;break;case"content":const{data:N,error:_}=await de.from("current_content_versions").select("name").eq("id",p).single();if(_)throw _;y=N;break;case"convergences":const{data:S,error:C}=await de.from("convergences").select("name, trend").eq("id",p).single();if(C)throw C;S&&(x=S.name||S.trend),y=S;break;case"brands":const{data:E,error:T}=await de.from("brands").select("brand_name").eq("id",p).single();if(T)throw T;E&&(x=E.brand_name);break;case"connections":const{data:B,error:L}=await de.from("platform_brand_settings").select(`
2137                                                connection_details,
2138                                                platforms!platform_brand_settings_platform_id_fkey (
2139                                                    name,
2140                                                    platform_key
2141                                                )
2142                                            `).eq("id",p).single();if(L&&L.code==="PGRST116"?console.debug("Platform connection record not found for breadcrumb:",p):L&&console.error("Error fetching platform connection for breadcrumb:",L),!L&&B){const P=((l=B.platforms)==null?void 0:l.name)||((c=B.platforms)==null?void 0:c.platform_key),F=B.connection_details;let M=P;if(F){const I=F.username||F.screen_name||F.account_username,$=F.name||F.display_name||F.account_name;I?M=`${P} (@${I})`:$&&(M=`${P} (${$})`)}x=M||"Connection"}else x=p.substring(0,8)+"...";break}(y!=null&&y.name||y!=null&&y.brand_name)&&(x=(y==null?void 0:y.brand_name)||(y==null?void 0:y.name))}catch(y){console.error("Error fetching entity name:",y),a(y)}u.push({href:A,label:x,current:f===d.length-1});continue}u.push({href:A,label:p.charAt(0).toUpperCase()+p.slice(1),current:f===d.length-1})}i&&r(u)}catch(d){console.error("Error in generateBreadcrumbs:",d),i&&a(d)}}return o(),()=>{i=!1}},[e.pathname]),s&&console.error("useBreadcrumbs error:",s),t}function Jwt(){var a,i,o,l,c,d;const{session:e}=wa(),t=e==null?void 0:e.user;if(!t)return null;const r=()=>{for(const u in localStorage)(u.includes("supabase.auth")||u.includes("sb-"))&&localStorage.removeItem(u);document.cookie.split(";").forEach(u=>{const[h]=u.trim().split("=");h.includes("sb-")&&(document.cookie=`${h}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`)})},s=async()=>{try{const{data:u}=await de.auth.getSession();u.session&&await de.auth.signOut({scope:"global"}),r(),window.location.href="/?forceLogout="+Date.now()}catch(u){console.error("Error signing out:",u),r(),window.location.href="/?forceLogout="+Date.now()}};return n.jsxs(ll,{children:[n.jsx(cl,{asChild:!0,children:n.jsxs(te,{variant:"outline",className:"gap-2 px-2",children:[n.jsxs(y_,{className:"h-8 w-8 rounded-lg",children:[n.jsx(w_,{src:(a=t.user_metadata)==null?void 0:a.avatar_url,alt:((i=t.user_metadata)==null?void 0:i.full_name)||t.email}),n.jsx(j_,{className:"rounded-lg",children:n.jsx(li,{className:"h-5 w-5"})})]}),n.jsx("div",{className:"truncate hidden md:block",children:((o=t.user_metadata)==null?void 0:o.full_name)||t.email}),n.jsx(Un,{className:"ml-auto size-4"})]})}),n.jsxs(fo,{className:"w-[--radix-dropdown-menu-trigger-width] min-w-56 rounded-lg",align:"end",sideOffset:4,children:[n.jsx(Am,{className:"p-0 font-normal",children:n.jsxs("div",{className:"flex items-center gap-2 px-1 py-1.5 text-left text-sm",children:[n.jsxs(y_,{className:"h-8 w-8 rounded-lg",children:[n.jsx(w_,{src:(l=t.user_metadata)==null?void 0:l.avatar_url,alt:((c=t.user_metadata)==null?void 0:c.full_name)||t.email}),n.jsx(j_,{className:"rounded-lg",children:n.jsx(li,{className:"h-5 w-5"})})]}),n.jsxs("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[n.jsx("span",{className:"truncate font-semibold",children:((d=t.user_metadata)==null?void 0:d.full_name)||t.email}),n.jsx("span",{className:"truncate text-xs text-muted-foreground",children:t.email})]})]})}),n.jsx(Mo,{}),n.jsx(CQ,{children:n.jsx(Fr,{asChild:!0,children:n.jsxs(Ir,{to:"/settings/subscription",children:[n.jsx(mr,{className:"size-4 me-2"}),"Upgrade"]})})}),n.jsx(Mo,{}),n.jsxs(CQ,{children:[n.jsx(Fr,{asChild:!0,children:n.jsxs(Ir,{to:"/profile",children:[n.jsx(Qge,{className:"size-4 me-2"}),"Account"]})}),n.jsx(Fr,{asChild:!0,children:n.jsxs(Ir,{to:"/settings/billing",children:[n.jsx(sg,{className:"size-4 me-2"}),"Billing"]})})]}),n.jsx(Mo,{}),n.jsxs(Fr,{className:"text-red-700 cursor-pointer",onClick:s,children:[n.jsx(NK,{className:"size-4 me-2"}),"Log out"]})]})]})}const Xwt=Ir;function Gce({showProfile:e=!0,className:t,onMenuClick:r}){const{session:s}=wa(),a=s==null?void 0:s.user,i=Gs(),o=Ywt(),[l,c]=g.useState(!1);return n.jsxs("div",{className:ye("flex h-16 items-center bg-background border-b w-full z-50 sticky top-0",t),children:[a&&r&&n.jsx(te,{variant:"ghost",size:"icon",className:"md:hidden ml-2 shrink-0",onClick:r,"aria-label":"Toggle menu",children:n.jsx(_K,{className:"h-5 w-5"})}),!a&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"flex-1 md:hidden flex justify-center items-center px-3",children:n.jsx(Qa,{to:"/",className:"font-semibold text-base hover:text-foreground
2142/80 transition-colors",children:"Rainfactory AI"})}),n.jsx("div",{className:"md:hidden",children:n.jsx(Qa,{to:"/",className:"flex items-center",children:n.jsx("img",{src:Kg,alt:"Rainfactory Logo",className:"h-8 w-auto"})})})]}),!a&&n.jsxs("div",{className:"hidden md:flex items-center gap-6 px-4",children:[n.jsxs(Qa,{to:"/",className:"mr-8 font-semibold text-base hover:text-foreground/80 transition-colors flex items-center",children:[n.jsx("img",{src:Kg,alt:"Rainfactory Logo",className:"h-8 w-auto mr-2"}),"Rainfactory AI"]}),n.jsxs("div",{className:"flex items-center gap-6",children:[n.jsx(Qa,{to:"/products",className:ye("font-medium transition-colors hover:text-foreground/80",i.pathname==="/products"?"text-foreground":"text-foreground/60"),children:"Product"}),n.jsx(Qa,{to:"/pricing",className:ye("font-medium transition-colors hover:text-foreground/80",i.pathname==="/pricing"?"text-foreground":"text-foreground/60"),children:"Pricing"}),n.jsx(Qa,{to:"/blog",className:ye("font-medium transition-colors hover:text-foreground/80",i.pathname==="/blog"?"text-foreground":"text-foreground/60"),children:"Blog"}),n.jsx(Qa,{to:"/about",className:ye("font-medium transition-colors hover:text-foreground/80",i.pathname==="/about"?"text-foreground":"text-foreground/60"),children:"About"}),n.jsx(Qa,{to:"/contact",className:ye("font-medium transition-colors hover:text-foreground/80",i.pathname==="/contact"?"text-foreground":"text-foreground/60"),children:"Contact"})]})]}),a&&o.length>0&&n.jsx("div",{className:"hidden md:flex flex-1 min-w-0 overflow-hidden px-3 md:px-4 justify-start items-center",children:n.jsx(Mce,{className:"w-full flex",children:n.jsx($ce,{className:"flex items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5 min-w-0 justify-start",children:o.map((d,u)=>n.jsxs(g.Fragment,{children:[n.jsx(Qce,{className:"min-w-0 shrink-0",children:d.current?n.jsx(zce,{className:"flex items-center",children:d.icon?n.jsx($R,{size:16,strokeWidth:2,"aria-hidden":"true",className:"shrink-0"}):n.jsx("span",{className:"truncate text-sm font-medium max-w-[120px] md:max-w-[200px]",title:d.label,children:d.label})}):n.jsx(Hce,{asChild:!0,children:n.jsx(Xwt,{to:d.href||"#",className:"flex items-center hover:text-foreground transition-colors",children:d.icon?n.jsx($R,{size:16,strokeWidth:2,"aria-hidden":"true",className:"shrink-0"}):n.jsx("span",{className:"truncate text-sm max-w-[120px] md:max-w-[200px]",title:d.label,children:d.label})})})}),u<o.length-1&&n.jsx(Vce,{className:"shrink-0 text-muted-foreground",children:" / "})]},u))})})}),a&&o.length===0&&n.jsx("div",{className:"flex-1 md:hidden"}),n.jsxs("div",{className:"flex items-center gap-2 md:gap-4 shrink-0 pr-3 md:pr-4 ml-auto",children:[a&&n.jsxs(te,{variant:"outline",size:"sm",onClick:()=>c(!0),className:"flex items-center gap-2",children:[n.jsx(Cc,{className:"h-4 w-4"}),n.jsx("span",{className:"hidden md:inline",children:"Help & Feedback"})]}),a&&e?n.jsx(Jwt,{}):a?null:n.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[n.jsx(Qa,{to:"/signup",className:"hidden md:block",children:n.jsx(te,{size:"sm",className:"bg-gradient-to-r from-blue-500 to-indigo-600 hover:from-blue-600 hover:to-indigo-700 text-white shadow-lg hover:shadow-xl transition-all duration-300 border-0",children:"Start your free trial"})}),n.jsx(Qa,{to:"/login",className:"hidden md:block",children:n.jsx(te,{variant:"outline",size:"sm",children:"Log In"})})]})]}),n.jsx(Gwt,{open:l,onOpenChange:c})]})}const Ji=Qa;function qce(){const[e,t]=g.useState(!1),{user:r}=wa();return g.useEffect(()=>{const s=document.documentElement.classList.contains("dark");t(s)},[]),g.useEffect(()=>{e?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")},[e]),r?null:n.jsx("footer",{className:"relative border-t bg-background text-foreground transition-colors duration-300",children:n.jsxs("div",{className:"container mx-auto max-w-5xl px-4 py-8 md:px-6 lg:px-8",children:[n.jsxs("div",{className:"grid gap-8 sm:grid-cols-2 lg:grid-cols-4",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"mb-3 text-lg font-semibold",children:"Qu
2142ick Links"}),n.jsxs("nav",{className:"space-y-1.5 text-sm",children:[n.jsx(Ji,{to:"/",className:"block transition-colors hover:text-primary",children:"Home"}),n.jsx(Ji,{to:"/about",className:"block transition-colors hover:text-primary",children:"About Us"}),n.jsx(Ji,{to:"/services",className:"block transition-colors hover:text-primary",children:"Services"}),n.jsx(Ji,{to:"/products",className:"block transition-colors hover:text-primary",children:"Products"}),n.jsx(Ji,{to:"/careers",className:"block transition-colors hover:text-primary",children:"Careers"}),n.jsx(Ji,{to:"/contact",className:"block transition-colors hover:text-primary",children:"Contact"})]})]}),n.jsxs("div",{children:[n.jsx("h3",{className:"mb-3 text-lg font-semibold",children:"Features"}),n.jsxs("nav",{className:"space-y-1.5 text-sm",children:[n.jsx(Ji,{to:"/ai-social-media-content-generator",className:"block transition-colors hover:text-primary",children:"AI Content Generator"}),n.jsx(Ji,{to:"/automated-social-media-posting",className:"block transition-colors hover:text-primary",children:"Automated Posting"}),n.jsx(Ji,{to:"/social-media-scheduler",className:"block transition-colors hover:text-primary",children:"Social Media Scheduler"}),n.jsx(Ji,{to:"/pricing",className:"block transition-colors hover:text-primary",children:"Pricing"}),n.jsx(Ji,{to:"/blog",className:"block transition-colors hover:text-primary",children:"Blog"})]})]}),n.jsxs("div",{children:[n.jsx("h3",{className:"mb-3 text-lg font-semibold",children:"Contact Us"}),n.jsxs("address",{className:"space-y-1.5 text-sm not-italic",children:[n.jsx("p",{children:"P.O. Box 435"}),n.jsx("p",{children:"Lisle, IL 60532"}),n.jsx("p",{children:"Email: [email protected]"})]})]}),n.jsxs("div",{children:[n.jsx("h3",{className:"mb-3 text-lg font-semibold",children:"Follow Us"}),n.jsxs("div",{className:"mb-4 flex space-x-2",children:[n.jsx(Ya,{children:n.jsxs(Hs,{children:[n.jsx(zs,{asChild:!0,children:n.jsx("a",{href:"https://x.com/RainfactoryAI",target:"_blank",rel:"noopener noreferrer",children:n.jsxs(te,{variant:"outline",size:"icon",className:"h-8 w-8 rounded-full",children:[n.jsx(kr,{className:"h-4 w-4"}),n.jsx("span",{className:"sr-only",children:"X (formerly Twitter)"})]})})}),n.jsx(Vn,{children:n.jsx("p",{children:"Follow us on X"})})]})}),n.jsx(Ya,{children:n.jsxs(Hs,{children:[n.jsx(zs,{asChild:!0,children:n.jsx("a",{href:"https://www.linkedin.com/company/rainfactory-ai/about/",target:"_blank",rel:"noopener noreferrer",children:n.jsxs(te,{variant:"outline",size:"icon",className:"h-8 w-8 rounded-full",children:[n.jsx(ky,{className:"h-4 w-4"}),n.jsx("span",{className:"sr-only",children:"LinkedIn"})]})})}),n.jsx(Vn,{children:n.jsx("p",{children:"Connect with us on LinkedIn"})})]})})]}),n.jsxs("div",{children:[n.jsx("h3",{className:"mb-2 text-sm font-semibold",children:"Stay Connected"}),n.jsxs("form",{className:"relative max-w-xs",children:[n.jsx(qe,{type:"email",placeholder:"Enter your email",className:"pr-12 h-9 text-sm"}),n.jsxs(te,{type:"submit",size:"icon",className:"absolute right-1 top-1 h-7 w-7 rounded-full bg-primary text-primary-foreground",children:[n.jsx(Om,{className:"h-3.5 w-3.5"}),n.jsx("span",{className:"sr-only",children:"Subscribe"})]})]})]})]})]}),n.jsxs("div",{className:"mt-6 flex flex-col items-center justify-between gap-3 border-t pt-4 text-center md:flex-row",children:[n.jsx("p",{className:"text-xs text-muted-foreground",children:"© 2025 Rainfactory, Ltd. All rights reserved."}),n.jsxs("nav",{className:"flex gap-4 text-xs",children:[n.jsx(Ji,{to:"/privacy-policy",className:"transition-colors hover:text-primary",children:"Privacy Policy"}),n.jsx(Ji,{to:"/terms-of-service",className:"transition-colors hover:text-primary",children:"Terms of Service"}),n.jsx(Ji,{to:"/cookie-settings",className:"transition-colors hover:text-primary",children:"Cookie Settings"})]})]})]})})}const Zwt={initial:{opacity:0,scale:.98,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.98,y:-10}},e1t={type:"tween",duration:.3,ease:[.25,.25,.25,1]};function Kce({children:e,className:t=""}){const r=Gs();return n.jsx(qh,{mode:"wait",initial:!1,children:n.jsx(ut.div,{initial:"initial",animate:"animate",exit:"exit",variants:Zwt,transition:e1t,className:`w-full h-full ${t}`,style:{transformOrigin:"center top",backfaceVisibility:"hidden"},children:e},r.pathname)})}function Kr({message:e="Loading..."}){return n.jsx(ut.div,{initial:{opacity:0,scale:.95}
2142,animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},transition:{duration:.2},className:"flex items-center justify-center min-h-[200px] p-8",children:n.jsxs("div",{className:"flex flex-col items-center gap-4",children:[n.jsx(ut.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},className:"rounded-full h-8 w-8 border-2 border-primary border-t-transparent"}),n.jsx(ut.p,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.1},className:"text-sm text-muted-foreground",children:e})]})})}function t1t(){const[e,t]=g.useState(!1);return n.jsxs("div",{className:"flex min-h-screen bg-background",children:[n.jsx("div",{className:ye("fixed inset-0 bg-black/50 z-40 md:hidden","transition-opacity duration-300",e?"opacity-100":"opacity-0 pointer-events-none"),onClick:()=>t(!1)}),n.jsx("div",{className:ye("fixed md:sticky top-0 left-0 h-screen w-64 flex-shrink-0","transform transition-transform duration-300 ease-in-out z-50",e?"translate-x-0":"-translate-x-full md:translate-x-0"),children:n.jsx(Vwt,{className:"h-full"})}),n.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[n.jsx(Gce,{className:"sticky top-0 z-40",onMenuClick:()=>t(!e)}),n.jsx("main",{className:"flex-1",children:n.jsx(Kce,{className:"w-full h-full",children:n.jsx(mq,{})})}),n.jsx(qce,{})]}),n.jsx(kK,{showToast:!0,showCustomNotification:!0,autoTrigger:!0})]})}const r1t={theme:"system",setTheme:()=>null},Wce=g.createContext(r1t);function n1t({children:e,defaultTheme:t="dark",storageKey:r="vite-ui-theme",...s}){const[a,i]=g.useState(()=>typeof window<"u"&&localStorage.getItem(r)||t);g.useEffect(()=>{if(typeof window>"u")return;const l=window.document.documentElement;if(l.classList.remove("light","dark"),a==="system"){const c=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";l.classList.add(c);return}l.classList.add(a)},[a]);const o={theme:a,setTheme:l=>{typeof window<"u"&&localStorage.setItem(r,l),i(l)}};return n.jsx(Wce.Provider,{value:o,...s,children:e})}const s1t=()=>{const e=g.useContext(Wce);if(e===void 0)throw new Error("useTheme must be used within a ThemeProvider");return e};function a1t({className:e}){const{theme:t,setTheme:r}=s1t(),s=t==="dark";return n.jsx("div",{className:ye("flex w-16 h-8 p-1 rounded-full cursor-pointer transition-all duration-300",s?"bg-zinc-950 border border-zinc-800":"bg-white border border-zinc-200",e),onClick:()=>r(s?"light":"dark"),role:"button",tabIndex:0,children:n.jsxs("div",{className:"flex justify-between items-center w-full",children:[n.jsx("div",{className:ye("flex justify-center items-center w-6 h-6 rounded-full transition-transform duration-300",s?"transform translate-x-0 bg-zinc-800":"transform translate-x-8 bg-gray-200"),children:s?n.jsx(zR,{className:"w-4 h-4 text-white",strokeWidth:1.5}):n.jsx(qR,{className:"w-4 h-4 text-gray-700",strokeWidth:1.5})}),n.jsx("div",{className:ye("flex justify-center items-center w-6 h-6 rounded-full transition-transform duration-300",s?"bg-transparent":"transform -translate-x-8"),children:s?n.jsx(qR,{className:"w-4 h-4 text-gray-500",strokeWidth:1.5}):n.jsx(zR,{className:"w-4 h-4 text-black",strokeWidth:1.5})})]})})}function i1t(){const e=Gs(),[t,r]=g.useState(!1),s=["/login","/auth/callback","/onboarding"],a=["/lander1"],i=[{name:"Product",path:"/products"},{name:"Pricing",path:"/pricing"},{name:"Blog",path:"/blog"},{name:"About",path:"/about"},{name:"Contact",path:"/contact"}],o=!s.some(c=>e.pathname.startsWith(c)),l=a.some(c=>e.pathname.startsWith(c));return n.jsxs("div",{className:"min-h-[100dvh] flex flex-col",children:[o&&!l&&n.jsxs(n.Fragment,{children:[n.jsx(te,{variant:"ghost",size:"icon",className:"fixed top-4 left-4 z-[60] md:hidden bg-background/80 backdrop-blur-sm border shadow-sm",onClick:()=>r(!0),children:n.jsx(_K,{className:"h-5 w-5"})}),n.jsx(Ece,{open:t,onOpenChange:r,children:n.jsx(qL,{side:"left",className:"p-0 border-r",children:n.jsxs("div",{className:"flex flex-col p-6 space-y-6",children:[n.jsx("div",{className:"flex items-center mb-2",children:n.jsxs(Qa,{to:"/",className:"flex items-center",onClick:()=>r(!1),children:[n.jsx("img",{src:Kg,alt:"Rainfactory Logo",className:"h-8 w-auto mr-2"}),n.jsx("span",{className:"font-semibold text-lg",children:"Rainfactory AI"})]})}),n.jsx("nav",{className:"space-y-2",children:i.map(c=>n.jsx(Qa,{to:c.path,className:ye("block w-full font-medium text-lg py-3 px-3 transition-colors hover:text-foreground
2142/80 hover:bg-muted rounded-md",e.pathname===c.path?"text-foreground bg-muted":"text-foreground/60"),onClick:()=>r(!1),children:c.name},c.path))}),n.jsx("div",{className:"pt-4 border-t",children:n.jsx(Qa,{to:"/login",onClick:()=>r(!1),children:n.jsx(te,{className:"w-full py-5 text-base",children:"Log In"})})}),n.jsx("div",{className:"pt-4 border-t flex justify-center",children:n.jsx(a1t,{})})]})})}),n.jsx(Gce,{showProfile:!1,className:ye("sticky top-0 z-50 bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60",t?"md:block hidden":"")})]}),n.jsx("main",{className:`flex-grow ${o&&!l?"pt-0":""}`,children:n.jsx(Kce,{children:n.jsx(mq,{})})}),o&&n.jsx(qce,{})]})}function o1t(){const[e,t]=g.useState("monthly"),[r,s]=g.useState([]),[a,i]=g.useState(!0),o=xr(),{trackEvent:l,events:c}=Lu();IK({title:"Pricing - AI Social Media Marketing Automation Plans",description:"Choose the perfect Rainfactory plan for AI social media marketing automation. Flexible monthly and yearly pricing for AI content generation, automated posting, and Brand Voice AI. Start your free trial today.",keywords:"social media marketing automation pricing, ai content generation plans, social media scheduler pricing, automated social media posting pricing, Rainfactory pricing",url:"https://rainfactory.ai/pricing",type:"website",image:"https://rainfactory.ai/og-image.png",breadcrumbs:[{name:"Home",url:"https://rainfactory.ai/"},{name:"Pricing",url:"https://rainfactory.ai/pricing"}]}),g.useEffect(()=>{l(c.SUBSCRIPTION_VIEWED,{page:"pricing",referrer:document.referrer}),(async()=>{try{i(!0);const m=await fetch("https://worker.rainfactory.ai/billing-functions/get_plans_public",{method:"POST",body:JSON.stringify({account_id:"public"})});if(!m.ok)throw new Error("Failed to fetch plans");const f=await m.json(),p=f.map(A=>({id:A.id,product_name:A.product_name,product_description:A.product_description,price:A.price,currency:A.currency,interval:A.interval==="month"?"month":"year",features:A.features,structured_features:A.structured_features||{}}));l(c.FEATURE_USED,{feature:"plans_loaded",plan_count:f.length,has_monthly:f.some(A=>A.interval==="month"),has_yearly:f.some(A=>A.interval==="year")}),s(p)}catch(h){console.error("Error fetching plans:",h),l("error_occurred",{error_type:"plans_fetch_error",error_message:h instanceof Error?h.message:String(h)})}finally{i(!1)}})()},[l,c]);const d=(u,h,m,f)=>{f?(l(c.CHECKOUT_STARTED,{plan_id:"enterprise",plan_name:"Enterprise",plan_price:"custom",billing_interval:e}),cg(lg.BEGIN_CHECKOUT,void 0,{plan_id:"enterprise",plan_name:"Enterprise",value_type:"custom",billing_interval:e}),o("/contact?topic=Pricing%20Information")):(l(c.CHECKOUT_STARTED,{plan_id:u,plan_name:h,plan_price:m,billing_interval:e}),cg(lg.BEGIN_CHECKOUT,m,{plan_id:u,plan_name:h,currency:"USD",billing_interval:e}),o(`/login?flow=signup&plan=${u}`))};return a?n.jsx("div",{className:"flex justify-center items-center p-8",children:n.jsx(kt,{className:"h-8 w-8 animate-spin"})}):n.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 via-white to-blue-50/30 relative overflow-hidden",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsxs("div",{className:"relative",children:[n.jsxs("div",{className:"relative overflow-hidden bg-gradient-to-br from-white via-blue-50/30 to-indigo-50/40 border-b border-blue-200/50 shadow-sm",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsx("div",{className:"absolute top-0 right-0 w-40 h-40 bg-gradient-to-br from-blue-200/20 to-transparent rounded-full -translate-y-20 translate-x-20"}),n.jsx("div",{className:"absolute bottom-0 left-0 w-32 h-32 bg-gradient-to-tr from-indigo-100/40 to-transparent rounded-full translate-y-16 -translate-x-16"}),n.jsx("div",{className:"relative max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-16 sm:py-20",children:n.jsxs("div",{className:"text-center space-y-8",children:[n.jsx("h1",{className:"text-4xl md:text-5xl lg:text-6xl font-bold bg-gradient-to-r from-blue-700 via-indigo-700 to-purple-700 bg-clip-text text-transparent leading-tight pb-2",children:"Plans to maximize your growth"}),n.jsx("p",{className:"text-gray-600 max-w-3xl mx-auto text-lg md:text-xl leading-relaxed",children:"Choose the perfect plan for your needs. All plans include a 14-day free trial."})]})})]}),n.jsx("div",{className:"relative max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12 sm:py-16 pt-16",children:n.jsx(xle,{plans:r,billingInterval:e,onBillingIntervalChange:u=>{l(c.FEATURE_USED,{feature:"billing_interval_changed",previous:e,new:u}),t(u)},onPlanSelect:d,loading:a,showComparisonTable:!0,variant:"public",className:"pt-6"})}),n.jsx("div",{className:"relative max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 pb-12 sm:pb-16",children:n.jsx("div",{className:"text-center space-y-6 sm:space-y-8",children:n.jsxs("div",{className:"relative overflow-hidden bg-white/60 backdrop-blur-sm rounded-2xl border border-white/50 shadow-sm p-6 sm:p-8",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-blue-50/20 via-trans
2142parent to-purple-50/20"}),n.jsxs("div",{className:"relative",children:[n.jsx("p",{className:"text-base sm:text-lg text-gray-600 mb-6 sm:mb-8",children:"Welcome to the growing list of companies growing with Rainfactory"}),n.jsx(AO,{})]})]})})})]})]})}function l1t(){const[e]=Bi();return g.useEffect(()=>{const t=e.get("code"),r=e.get("state"),s=e.get("error"),a=e.get("error_description");console.log("Facebook OAuth callback received",{code:t,state:r,error:s,errorDescription:a}),window.opener?(window.opener.postMessage({type:"facebook_auth_callback",code:t,state:r,error:s,errorDescription:a},window.location.origin),window.close()):(console.error("Facebook callback opened directly, not in popup window"),document.body.innerHTML=`
2143        <div style="text-align:center; padding: 2rem;">
2144          <h1>Facebook Authentication</h1>
2145          <p>${s?"Authentication failed: "+a:"Authentication successful"}</p>
2146          <p>You can close this window now and return to the application.</p>
2147        </div>
2148      `)},[e]),n.jsxs("div",{className:"flex flex-col items-center justify-center min-h-screen p-4",children:[n.jsx("h1",{className:"text-2xl font-bold mb-4",children:"Facebook Authentication"}),n.jsx("p",{className:"text-center mb-4",children:"Processing your authentication..."}),n.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-t-2 border-b-2 border-gray-900"})]})}class c1t extends oe.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,r){this.props.analytics&&this.props.analytics.track({name:this.props.analytics.events.ERROR_OCCURRED,properties:{error_message:t.message,error_name:t.name,error_stack:t.stack,component_stack:r.componentStack,url:window.location.href,path:window.location.pathname}}),this.props.onError&&this.props.onError(t,r),console.error("Uncaught error:",t,r)}render(){return this.state.hasError?this.props.fallback||n.jsxs("div",{className:"flex flex-col items-center justify-center p-8 text-center",children:[n.jsx("h2",{className:"text-2xl font-bold text-red-600 mb-4",children:"Something went wrong"}),n.jsx("p",{className:"text-gray-600 mb-4",children:"We apologize for the inconvenience. Please try refreshing the page."}),n.jsx("button",{onClick:()=>window.location.reload(),className:"px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700 transition-colors",children:"Refresh Page"}),this.state.error&&n.jsx("div",{className:"mt-6 p-4 bg-gray-100 rounded-lg text-left text-sm text-gray-800 w-full max-w-xl",children:n.jsxs("p",{className:"font-medium",children:["Error: ",this.state.error.message]})})]}):this.props.children}}function d1t({className:e="",onSuccess:t,submitLabel:r="Send Magic Link"}){const[s,a]=g.useState(""),[i,o]=g.useState(!1),[l,c]=g.useState(null),[d,u]=g.useState(!1),{signInWithEmail:h}=wa(),m=async f=>{f.preventDefault(),o(!0),c(null);try{await h(s),u(!0),t&&t()}catch(p){c(p instanceof Error?p.message:"Failed to send magic link"),console.error("Email signup error:",p)}finally{o(!1)}};return n.jsxs("form",{onSubmit:m,className:`space-y-4 ${e}`,children:[l&&n.jsxs("div",{className:"p-3 rounded-md bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 text-red-800 dark:text-red-300 flex items-start gap-2 text-sm",children:[n.jsx(nr,{className:"h-5 w-5 shrink-0 mt-0.5"}),n.jsx("span",{children:l})]}),d?n.jsxs("div",{className:"p-4 rounded-md bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 text-green-800 dark:text-green-300 flex items-start gap-2",children:[n.jsx(di,{className:"h-5 w-5 shrink-0 mt-0.5"}),n.jsxs("div",{children:[n.jsx("p",{className:"font-medium",children:"Check your email"}),n.jsxs("p",{className:"text-sm mt-1",children:["We've sent a magic link to ",s,". Click the link to sign in."]})]})]}):n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"email",children:"Email"}),n.jsx(qe,{id:"email",type:"email",value:s,onChange:f=>a(f.target.value),placeholder:"Enter your email",required:!0,autoComplete:"email",className:"w-full"})]}),n.jsx(te,{type:"submit",className:"w-full",disabled:i,children:i?"Sending...":r})]})]})}const u1t=sf({email:ys().email("Please enter a valid email address"),password:ys().min(8,"Password must be at least 8 characters")});function h1t({mode:e,onSuccess:t,inviteId:r,claimBrandId:s}){const a=xr(),{toast:i}=sn(),{track:o}=Lu(),[l,c]=g.useState(!1),[d,u]=g.useState(!1),{register:h,handleSubmit:m,formState:{errors:f}}=Cd({resolver:up(u1t)}),p=async A=>{var v,x,b;c(!0);try{if(e==="signup"){const{data:y,error:w}=await de.auth.signUp({email:A.email,password:A.password,options:{data:{invite_id:r,claim_brand_id:s}}});if(w)throw w;o({name:"user_signed_up",properties:{method:"password",email:A.email}}),i({title:"Account created!",description:"Please check your email to verify your account."}),y.user&&y.session&&a("/onboarding")}else{const{data:y,error:w}=await de.auth.signInWithPassword({email:A.email,password:A.password});if(w)throw w;if(o({name:"user_logged_in",properties:{method:"password",email:A.email}}),i({title:"Welcome back!",description:"You have successfully logged in."}),y.user){const{data:j}=await de.schema("marketing_and_customer_success").from("profiles").select("onboarding_completed").eq("id",y.user.id).single();j&&!j.onboarding_completed?a("/onboarding"):a("/dashboard")}}t==null||t()}catch(y){console.error("Authentication error:",y);let w="An error occurred during authentication";(v=y.message)!=null&&v.includes("Invalid login credentials")?w="Invalid email or password":(x=y.message)!=null&&x.includes("Email not confirmed")?w="Please verify your email before logging in":(b=y.message)!=null&&b.includes("User already registered")&&(w="An account with this email already exists"),i({title:"Authentication failed",description:w,variant:"destructive"})}finally{c(!1)}};return n.jsxs("form",{onSubmit:m(p),className:"space-y-4",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"email",children:"Email"}),n.jsx(qe,{...h("email"),id:"email",type:"email",placeholder:"[email protected]",autoComplete:"email",disabled:l}),f.email&&n.jsx("p",{className:"text-sm text-destructive",children:f.email.message})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"password",children:"Password"}),n.jsxs("div",{className:"relative",children:[n.jsx(qe,{...h("password"),id:"password",type:d?"text":"password",placeholder:"••••••••",autoComplete:e==="signup"?"new-password":"current-password",disabled:l}),n.jsx(te,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",onClick:()=>u(!d),disabled:l,children:d?n.jsx(nb,{className:"h-4 w-4 text-muted-foreground"}):n.jsx(gd,{className:"h-4 w-4 text-muted-foreground"})})]}),f.password&&n.jsx("p",{className:"text-sm text-destructive",children:f.password.message}),e==="signup"&&n.jsx("p",{className:"text-xs text-muted-foreground",children:"Must be at least 8 characters long"})]}),e==="login"&&n.jsx("div",{className:"flex items-center justify-end",children:n.jsx(te,{type:"button",variant:"link",className:"px-0 font-normal",onClick:()=>a("/reset-password"),children:"Forgot your password?"})}),n.jsxs(te,{type:"submit",className:"w-full",disabled:l,children:[l&&n.jsx(kt,{className:"mr-2 h-4 w-4 animate-spin"}),e==="signup"?"Create account":"Sign in"]})]})}const f1t=()=>n.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 48 48",width:"18px",height:"18px",className:"mr-2",children:[n.jsx("path",{fill:"#FFC107",d:"M43.611,20.083H42V20H24v8h11.303c-1.649,4.657-6.08,8-11.303,8c-6.627,0-12-5.373-12-12c0-6.627,5.373-12,12-12c3.059,0,5.842,1.154,7.961,3.039l5.657-5.657C34.046,6.053,29.268,4,24,4C12.955,4,4,12.955,4,24c0,11.045,8.955,20,20,20c11.045,0,20-8.955,20-20C44,22.659,43.862,21.35,43.611,20.083z"}),n.jsx("path",{fill:"#FF3D00",d:"M6.306,14.691l6.571,4.819C14.655,15.108,18.961,12,24,12c3.059,0,5.842,1.154,7.961,3.039l5.657-5.657C34.046,6.053,29.268,4,24,4C16.318,4,9.656,8.337,6.306,14.691z"}),n.jsx("path",{fill:"#4CAF50",d:"M24,44c5.166,0,9.86-1.977,13.409-5.192l-6.19-5.238C29.211,35.091,26.715,36,24,36c-5.202,0-9.619-3.317-11.283-7.946l-6.522,5.025C9.505,39.556,16.227,44,24,44z"}),n.jsx("path",{fill:"#1976D2",d:"M43.611,20.083H42V20H24v8h11.303c-0.792,2.237-2.231,4.166-4.087,5.5
214874l6.19,5.238C39.71,35.96,44,30.607,44,24C44,22.659,43.862,21.35,43.611,20.083z"})]}),m1t=()=>n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-4 h-4 mr-2",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21.75 6.75v10.5a2.25 2.25 0 0 1-2.25 2.25h-15a2.25 2.25 0 0 1-2.25-2.25V6.75m19.5 0A2.25 2.25 0 0 0 19.5 4.5h-15a2.25 2.25 0 0 0-2.25 2.25m19.5 0v.243a2.25 2.25 0 0 1-1.07 1.916l-7.5 4.615a2.25 2.25 0 0 1-2.36 0L3.32 8.91a2.25 2.25 0 0 1-1.07-1.916V6.75"})}),gj=Qa;function Yce({mode:e="signup",showLoginLink:t=!0,showTermsFooter:r=!0,onSuccess:s,className:a=""}){const[i,o]=g.useState(!1),{signInWithGoogle:l}=wa(),c=async()=>{try{await l(),s&&s()}catch(f){console.error("Google auth error:",f)}},d=()=>{o(!0)},u=e==="login",h=u?"Log in to your account":"Sign up for a free 14-day trial",m=u?"Log in with email":"Sign up with email";return n.jsx("div",{className:`flex flex-col ${a}`,children:i?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"mb-4 text-center",children:n.jsx("h2",{className:"text-2xl font-bold mb-4",children:m})}),n.jsxs(te,{variant:"ghost",className:"mb-4 flex items-center gap-1 w-fit",onClick:()=>o(!1),children:[n.jsx(Yo,{className:"h-4 w-4"})," Back"]}),n.jsxs(Cs,{defaultValue:"password",className:"w-full",children:[n.jsxs(ps,{className:"grid w-full grid-cols-2 mb-4",children:[n.jsxs(pt,{value:"password",className:"flex items-center gap-2",children:[n.jsx(m2,{className:"h-4 w-4"}),"Password"]}),n.jsxs(pt,{value:"magic-link",className:"flex items-center gap-2",children:[n.jsx(Cu,{className:"h-4 w-4"}),"Magic Link"]})]}),n.jsx(Ct,{value:"password",children:n.jsx(h1t,{mode:e,onSuccess:s})}),n.jsx(Ct,{value:"magic-link",children:n.jsx(d1t,{onSuccess:s})})]})]}):n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"mb-4 text-center",children:n.jsx("h2",{className:"text-2xl font-bold mb-4",children:h})}),n.jsxs("div",{className:"space-y-3 flex flex-col items-center w-full max-w-xs mx-auto",children:[t&&!u&&n.jsx(gj,{to:"/login",children:n.jsxs(te,{variant:"gooeyRight",className:"w-full justify-center py-3 border-gray-300 dark:border-gray-700 bg-background dark:bg-gray-900 hover:bg-gray-100 dark:hover:bg-gray-800 text-foreground",children:["Already have an account?  ",n.jsx("span",{className:"font-medium text-blue-500 hover:underline",children:"Login"})]})}),t&&u&&n.jsx(gj,{to:"/signup",children:n.jsxs(te,{variant:"gooeyRight",className:"w-full justify-center py-3 border-gray-300 dark:border-gray-700 bg-background dark:bg-gray-900 hover:bg-gray-100 dark:hover:bg-gray-800 text-foreground",children:["Don't have an account?  ",n.jsx("span",{className:"font-medium text-blue-500 hover:underline",children:"Sign up"})]})}),n.jsxs(te,{variant:"outline",className:"w-full justify-center py-3 border-gray-300 dark:border-gray-700 bg-background dark:bg-gray-900 hover:bg-gray-100 dark:hover:bg-gray-800 text-foreground",onClick:c,children:[n.jsx(f1t,{})," Continue with Google"]}),n.jsxs(te,{variant:"outline",className:"w-full justify-center py-3 border-gray-300 dark:border-gray-700 bg-background dark:bg-gray-900 hover:bg-gray-100 dark:hover:bg-gray-800 text-foreground",onClick:d,children:[n.jsx(m1t,{})," Continue with Email"]})]}),r&&n.jsx("div",{className:"mt-auto pt-4",children:n.jsxs("p",{className:"text-xs text-muted-foreground text-center w-full leading-relaxed",children:["By continuing, you agree to Rainfactory's"," ",n.jsx(gj,{to:"/terms",className:"underline hover:text-primary",children:"Terms of Service"})," ","and"," ",n.jsx(gj,{to:"/privacy",className:"underline hover:text-primary",children:"Privacy Policy"}),"."]})})]})})}function p1t(){return n.jsxs("div",{className:"min-h-[calc(100vh-64px)] bg-gradient-to-br from-slate-50 via-white to-blue-50/30 relative overflow-hidden",children:[n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),n.jsx("div",{className:"absolute top-20 right-20 w-64 h-64 bg-gradient-to-br from-blue-200/40 to-indigo-300/30 rounded-full blur-3xl op
2148acity-50 animate-pulse"}),n.jsx("div",{className:"absolute bottom-20 left-20 w-48 h-48 bg-gradient-to-tr from-purple-200/40 to-pink-300/30 rounded-full blur-3xl opacity-50 animate-pulse",style:{animationDelay:"1s"}}),n.jsx("div",{className:"absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 w-96 h-96 bg-gradient-to-br from-cyan-200/20 to-blue-300/20 rounded-full blur-3xl opacity-30"}),n.jsx("div",{className:"absolute top-32 left-1/4 w-2 h-2 bg-blue-400 rounded-full animate-bounce opacity-60",style:{animationDelay:"0.5s"}}),n.jsx("div",{className:"absolute bottom-32 right-1/4 w-1.5 h-1.5 bg-indigo-400 rounded-full animate-bounce opacity-60",style:{animationDelay:"1.5s"}}),n.jsx("div",{className:"absolute top-1/2 right-1/3 w-1 h-1 bg-purple-400 rounded-full animate-bounce opacity-60",style:{animationDelay:"2s"}}),n.jsxs("div",{className:"relative flex flex-col items-center justify-center min-h-[calc(100vh-64px)] px-4 py-12",children:[n.jsxs(ut.div,{initial:{opacity:0,y:-20},animate:{opacity:1,y:0},transition:{duration:.8,ease:"easeOut"},className:"mb-8 text-center",children:[n.jsxs("div",{className:"relative inline-block",children:[n.jsxs("div",{className:"p-4 bg-gradient-to-br from-white via-blue-50 to-indigo-50 rounded-3xl shadow-2xl border border-blue-100/50 backdrop-blur-sm relative overflow-hidden group",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-blue-500/10 via-trans
2148parent to-indigo-500/10 opacity-0 group-hover:opacity-100 transition-opacity duration-500"}),n.jsxs("div",{className:"relative",children:[n.jsx(mr,{className:"h-8 w-8 text-blue-600 mx-auto mb-2 group-hover:scale-110 transition-transform duration-300"}),n.jsx("h1",{className:"text-2xl font-bold bg-gradient-to-r from-blue-700 via-indigo-700 to-purple-700 bg-clip-text text-transparent",children:"Rainfactory"})]})]}),n.jsx("div",{className:"absolute -top-2 -right-2 w-4 h-4 bg-gradient-to-br from-yellow-400 to-orange-500 rounded-full animate-bounce opacity-80",style:{animationDelay:"0.5s"}}),n.jsx("div",{className:"absolute -bottom-1 -left-1 w-3 h-3 bg-gradient-to-br from-green-400 to-emerald-500 rounded-full animate-bounce opacity-80",style:{animationDelay:"1s"}})]}),n.jsxs(ut.div,{initial:{opacity:0},animate:{opacity:1},transition:{delay:.3,duration:.6},className:"mt-6",children:[n.jsx("h2",{className:"text-xl font-semibold text-gray-800 mb-2",children:"Welcome back"}),n.jsx("p",{className:"text-gray-600 text-sm max-w-md mx-auto leading-relaxed",children:"Sign in to access your AI-powered marketing suite and continue growing your business."})]})]}),n.jsxs(ut.div,{initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1},transition:{delay:.2,duration:.8,ease:"easeOut"},className:"group relative w-full max-w-md",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-blue-500/20 via-indigo-500/20 to-purple-500/20 rounded-3xl blur-xl opacity-0 group-hover:opacity-100 transition-opacity duration-500 transform scale-105"}),n.jsxs("div",{className:"relative overflow-hidden bg-white/70 backdrop-blur-md rounded-3xl border border-white/50 shadow-2xl hover:shadow-3xl transition-all duration-500 hover:scale-[1.02]",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-white/80 via-blue-50/40 to-indigo-50/60 rounded-3xl"}),n.jsx("div",{className:"absolute inset-[1px] bg-white/60 backdrop-blur-md rounded-3xl"}),n.jsx("div",{className:"absolute top-0 right-0 w-32 h-32 bg-gradient-to-br from-blue-200/30 to-transparent rounded-full -translate-y-16 translate-x-16"}),n.jsx("div",{className:"absolute bottom-0 left-0 w-24 h-24 bg-gradient-to-tr from-indigo-100/40 to-transparent rounded-full translate-y-12 -translate-x-12"}),n.jsx("div",{className:"absolute inset-0 bg-grid-pattern opacity-3"}),n.jsxs("div",{className:"relative p-8",children:[n.jsxs("div",{className:"absolute top-4 right-4 flex gap-2",children:[n.jsx(ut.div,{animate:{y:[0,-5,0]},transition:{duration:2,repeat:1/0,ease:"easeInOut"},className:"p-1.5 bg-gradient-to-br from-green-100 to-emerald-200 rounded-lg shadow-sm",children:n.jsx(Gh,{className:"h-3 w-3 text-green-600"})}),n.jsx(ut.div,{animate:{y:[0,-5,0]},transition:{duration:2,repeat:1/0,ease:"easeInOut",delay:.5},className:"p-1.5 bg-gradient-to-br from-blue-100 to-cyan-200 rounded-lg shadow-sm",children:n.jsx(en,{className:"h-3 w-3 text-blue-600"})})]}),n.jsx(Yce,{mode:"login",showLoginLink:!0,showTermsFooter:!0})]})]})]}),n.jsxs(ut.div,{initial:{opacity:0}
2148,animate:{opacity:1},transition:{delay:.6,duration:.6},className:"mt-8 flex items-center justify-center gap-6 text-xs text-gray-500",children:[n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx(Gh,{className:"h-3.5 w-3.5 text-green-500"}),n.jsx("span",{children:"Secure & Encrypted"})]}),n.jsx("div",{className:"w-1 h-1 bg-gray-300 rounded-full"}),n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx(en,{className:"h-3.5 w-3.5 text-blue-500"}),n.jsx("span",{children:"Lightning Fast"})]})]})]})]})}function A1t(){return n.jsx("div",{className:"flex min-h-[calc(100vh-64px)] flex-col items-center justify-center px-4 py-12",children:n.jsx("div",{className:"w-full max-w-md rounded-lg border bg-card p-8 shadow-sm",children:n.jsx(Yce,{mode:"signup",showLoginLink:!0,showTermsFooter:!0})})})}const g1t=sf({email:ys().email("Please enter a valid email address")});function x1t(){const e=xr(),{toast:t}=sn(),[r,s]=g.useState(!1),[a,i]=g.useState(!1),{register:o,handleSubmit:l,formState:{errors:c},getValues:d}=Cd({resolver:up(g1t)}),u=async h=>{s(!0);try{const{error:m}=await de.auth.resetPasswordForEmail(h.email,{redirectTo:`${window.location.origin}/reset-password/confirm`});if(m)throw m;i(!0),t({title:"Password reset email sent",description:"Please check your email for instructions to reset your password."})}catch(m){console.error("Password reset error:",m),t({title:"Failed to send reset email",description:m.message||"Please try again later.",variant:"destructive"})}finally{s(!1)}};return a?n.jsx("div",{className:"flex min-h-screen items-center justify-center px-4",children:n.jsxs(Te,{className:"w-full max-w-md",children:[n.jsxs(st,{children:[n.jsx(ot,{children:"Check your email"}),n.jsxs(Wr,{children:["We've sent password reset instructions to ",d("email")]})]}),n.jsxs(Re,{className:"space-y-4",children:[n.jsx("p",{className:"text-sm text-muted-foreground",children:"Click the link in the email to reset your password. If you don't see the email, check your spam folder."}),n.jsx(te,{variant:"outline",className:"w-full",onClick:()=>e("/login"),children:"Back to login"})]})]})}):n.jsx("div",{className:"flex min-h-screen items-center justify-center px-4",children:n.jsxs(Te,{className:"w-full max-w-md",children:[n.jsxs(st,{children:[n.jsx(ot,{children:"Reset your password"}),n.jsx(Wr,{children:"Enter your email address and we'll send you instructions to reset your password."})]}),n.jsx(Re,{children:n.jsxs("form",{onSubmit:l(u),className:"space-y-4",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"email",children:"Email"}),n.jsx(qe,{...o("email"),id:"email",type:"email",placeholder:"[email protected]",autoComplete:"email",disabled:r}),c.email&&n.jsx("p",{className:"text-sm text-destructive",children:c.email.message})]}),n.jsxs(te,{type:"submit",className:"w-full",disabled:r,children:[r&&n.jsx(kt,{className:"mr-2 h-4 w-4 animate-spin"}),"Send reset instructions"]}),n.jsxs(te,{type:"button",variant:"ghost",className:"w-full flex items-center justify-center gap-2",onClick:()=>e("/login"),disabled:r,children:[n.jsx(Yo,{className:"h-4 w-4"}),"Back to login"]})]})})]})})}const v1t=sf({password:ys().min(8,"Password must be at least 8 characters").regex(/[A-Z]/,"Password must contain at least one uppercase letter").regex(/[a-z]/,"Password must contain at least one lowercase letter").regex(/[0-9]/,"Password must contain at least one number"),confirmPassword:ys()}).refine(e=>e.password===e.confirmPassword,{message:"Passwords don't match",path:["confirmPassword"]});function b1t(e){let t=0;return e.length>=8&&(t+=25),e.length>=12&&(t+=25),/[a-z]/.test(e)&&(t+=12.5),/[A-Z]/.test(e)&&(t+=12.5),/[0-9]/.test(e)&&(t+=12.5),/[^A-Za-z0-9]/.test(e)&&(t+=12.5),t}function y1t(){const e=xr(),{toast:t}=sn(),[r,s]=g.useState(!1),[a,i]=g.useState(!1),[o,l]=g.useState(!1),[c,d]=g.useState(!1),[u,h]=g.useState(0),{register:m,handleSubmit:f,formState:{errors:p},watch:A}=Cd({resolver:up(v1t)}),v=A("password","");g.useEffect(()=>{h(b1t(v))},[v]);const x=async b=>{s(!0);try{const{error:y}=await de.auth.updateUser({password:b.password});if(y)throw y;d(!0),t({title:"Password updated successfully",description:"You can now log in with your new password."}),setTimeout(()=>{e("/login")},2e3)}catch(y){console.error("Password update error:",y),t({title:"Failed to update password",description:y.message||"Please try again.",variant:"destructive"})}finally{s(!1)}};return c?n.jsx("div",{className:"flex min-h-screen items-center justify-center px-4",children:n.jsx(Te,{className:"w-full max-w-md",children:n.jsx(Re,{className:"pt-6",children:n.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[n.jsx(di,{className:"h-12 w-12 text-green-500"}),n.jsx("h2",{className:"text-2xl font-bold",children:"Password Updated!"}),n.jsx("p",{className:"text-center text-muted-foreground",children:"Your password has been successfully updated. Redirecting to login..."})]})})})}):n.jsx("div",{className:"flex min-h-screen items-center justify-center px-4",children:n.jsxs(Te,{className:"w-full max-w-md",children:[n.jsxs(st,{children:[n.jsx(ot,{children:"Set new password"}),n.jsx(Wr,{children:"Enter your new password below. Make sure it's strong and unique."})]}),n.jsx(Re,{children:n.jsxs("form",{onSubmit:f(x),className:"space-y-4",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"password",children:"New Password"}),n.jsxs("div",{className:"relative",children:[n.jsx(qe,{...m("password"),id:"password",type:a?"text":"password",placeholder:"••••••••",autoComplete:"new-password",disabled:r}),n.jsx(te,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",onClick:()=>i(!a),disabled:r,children:a?n.jsx(nb,{className:"h-4 w-4 text-muted-foreground"}):n.jsx(gd,{className:"h-4 w-4 text-muted-foreground"})})]}),p.password&&n.jsx("p",{className:"text-sm text-destructive",children:p.password.message}),v&&n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex items-center justify-between text-sm",children:[n.jsx("span",{className:"text-muted-foreground",children:"Password strength"}),n.jsx("span",{className:`font-medium ${u<50?"text-red-500":u<75?"text-yellow-500":"text-green-500"}`,children:u<50?"Weak":u<75?"Good":"Strong"})]}),n.jsx(Ou,{value:u,className:"h-2"})]})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"confirmPassword",children:"Confirm Password"}),n.jsxs("div",{className:"relative",children:[n.jsx(qe,{...m("confirmPassword"),id:"confirmPassword",type:o?"text":"password",placeholder:"••••••••",autoComplete:"new-password",disabled:r}),n.jsx(te,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",onClick:()=>l(!o),disabled:r,children:o?n.jsx(nb,{className:"h-4 w-4 text-muted-foreground"}):n.jsx(gd,{className:"h-4 w-4 text-muted-foreground"})})]}),p.confirmPassword&&n.jsx("p",{className:"text-sm text-destructive",children:p.confirmPassword.message})]}),n.jsxs("div",{className:"text-sm text-muted-foreground space-y-1",children:[n.jsx("p",{className:"font-medium",children:"Password requirements:"}),n.jsxs("ul",{className:"list-disc list-inside space-y-1",children:[n.jsx("li",{children:"At least 8 characters long"}),n.jsx("li",{children:"Contains uppercase and lowercase letters"}),n.jsx("li",{children:"Contains at least one number"})]})]}),n.jsxs(te,{type:"submit",className:"w-full",disabled:r,children:[r&&n.jsx(kt,{className:"mr-2 h-4 w-4 animate-spin"}),"Update password"]})]})})]})})}function w1t({brand:e}){const t=xr();return n.jsx("div",{className:"container mx-auto p-8 max-w-2xl",children:n.jsxs(Te,{className:"border-orange-200 bg-orange-50/50",children:[n.jsx(st,{children:n.jsxs(ot,{className:"flex items-center gap-2 text-orange-900",children:[n.jsx(nr,{className:"h-5 w-5"}),"Brand Currently Inactive"]})}),n.jsxs(Re,{className:"space-y-4",children:[n.jsxs("p",{className:"text-orange-900",children:["The brand ",n.jsxs("strong",{children:['"',e.brand_name,'"']})," is currently inactive because the account owner's subscription has expired or been canceled."]}),n.jsxs("div",{className:"bg-white p-4 rounded-lg border border-orange-200",children:[n.jsx("p",{className:"text-sm font-medium mb-1",children:"What this means:"}),n.jsxs("ul",{className:"list-disc list-inside text-sm text-muted-foreground space-y-1",children:[n.jsx("li",{children:"You cannot create or edit content for this brand"}),n.jsx("li",{children:"Existing content remains saved but cannot be published"}),n.jsx("li",{children:"Brand settings and data are preserved"})]})]}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Please contact the brand owner to request they reactivate their subscription. Once reactivated, you'll regain full access to this brand."}),n.jsxs("div",{className:"flex gap-2 pt-2",children:[n.jsx(te,{onClick:()=>t("/brands"),children:"View Other Brands"}),n.jsx(te,{variant:"outline",onClick:()=>t("/profile"),children:"Go to Profile"})]})]})]})})}function j1t({children:e}){const{status:t,loading:r}=o0(),s=Gs(),a=xr(),o=["/profile","/settings","/logout","/onboarding","/checkout/success"].some(l=>s.pathname.startsWith(l));if(r)return n.jsx("div",{className:"min-h-screen flex items-center justify-center",children:n.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})});if(o)return n.jsx(n.Fragment,{children:e});if(!t)return n.jsx(pu,{to:"/settings"});switch(t.effectiveStatus){case"active":const l=s.pathname.match(/\/brands\/([^\/]+)/);if(l){const c=l[1],d=t.brandAccess.find(u=>u.brand.id===c);if(d&&d.accountStatus==="inactive"||(d==null?void 0:d.accountStatus)==="canceled")return n.jsx(w1t,{brand:d.brand})}return n.jsx(n.Fragment,{children:e});case"needs_billing":return sessionStorage.setItem("billing_redirect",s.pathname),n.jsx(pu,{to:"/settings/billing",replace:!0});case"inactive_brands_only":return n.jsxs("div",{className:"container mx-auto p-8 max-w-2xl",children:[n.jsxs(Ar,{className:"mb-6 border-blue-200 bg-blue-50 dark:border-blue-800 dark:bg-blue-950",children:[n.jsx(qi,{className:"h-4 w-4"}),n.jsxs(gr,{children:[n.jsx("strong",{children:"Recently purchased a plan?"}
2148)," If you just purchased a subscription and are still seeing this message, please reach out to ",n.jsx("a",{href:"mailto:[email protected]",className:"text-blue-600 hover:text-blue-800 underline",children:"[email protected]"})," and let them know your billing plan is failing to sync."]})]}),n.jsxs(Te,{children:[n.jsx(st,{children:n.jsx(ot,{children:"No Active Brands Available"})}),n.jsxs(Re,{className:"space-y-4",children:[n.jsx("p",{children:"All brands you have access to are currently inactive because their subscriptions have expired."}),n.jsxs("div",{className:"bg-muted p-4 rounded-lg",children:[n.jsx("p",{className:"text-sm font-medium mb-2",children:"Inactive brands you have access to:"}),n.jsx("ul",{className:"list-disc list-inside text-sm text-muted-foreground",children:t.brandAccess.map(c=>n.jsxs("li",{children:[c.brand.brand_name," (",c.accessLevel," access)"]},c.brand.id))})]}),n.jsx("p",{className:"text-muted-foreground",children:"To regain access, the brand owners need to reactivate their subscriptions."}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx(te,{onClick:()=>a("/profile"),children:"Go to Profile"}),n.jsx(te,{variant:"outline",onClick:()=>a("/settings"),children:"Account Settings"})]})]})]})]});default:return n.jsx(pu,{to:"/settings"})}}const N1t=()=>{const e=window.location.hostname,t=window.location.protocol;return e==="localhost"||e==="127.0.0.1"||e.startsWith("192.168.")||e.startsWith("10.")||t==="file:"?"local":e.includes("dev")||e.includes("staging")||e.includes("test")||e.includes("preview")?"dev":"production"},_1t=async e=>{const r=new TextEncoder().encode(e),s=await crypto.subtle.digest("SHA-256",r);return Array.from(new Uint8Array(s)).map(i=>i.toString(16).padStart(2,"0")).join("")},C1t="539406a4bf6f5d22633bfbfc43db1448350135e9385d2b8d2137904e0702c3bf",Jce="rainfactory_dev_authenticated",S1t=({onAuthenticated:e})=>{const[t,r]=g.useState(""),[s,a]=g.useState(!1),[i,o]=g.useState(!1),{toast:l}=sn(),c=async d=>{if(d.preventDefault(),!t.trim()){l({title:"Password required",description:"Please enter the dev environment password",variant:"destructive"});return}o(!0);try{await _1t(t.trim())===C1t?(sessionStorage.setItem(Jce,"true"),e(),l({title:"Access granted",description:"Welcome to the dev environment"})):(l({title:"Access denied",description:"Incorrect password",variant:"destructive"}),r(""))}catch(u){console.error("Password verification error:",u),l({title:"Error",description:"Failed to verify password",variant:"destructive"})}finally{o(!1)}};return n.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-slate-50 to-slate-100 p-4",children:n.jsxs(Te,{className:"w-full max-w-md",children:[n.jsxs(st,{className:"text-center",children:[n.jsx("div",{className:"mx-auto w-16 h-16 bg-primary/10 rounded-full flex items-center justify-center mb-4",children:n.jsx(m2,{className:"w-8 h-8 text-primary"})}),n.jsx(ot,{className:"text-2xl font-bold",children:"Dev Environment Access"}),n.jsx(Wr,{children:"This is a protected development environment. Please enter the password to continue."})]}),n.jsxs(Re,{children:[n.jsxs("form",{onSubmit:c,className:"space-y-4",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"password",children:"Password"}),n.jsxs("div",{className:"relative",children:[n.jsx(qe,{id:"password",type:s?"text":"password",value:t,onChange:d=>r(d.target.value),placeholder:"Enter development password",disabled:i,className:"pr-10",autoComplete:"off",autoFocus:!0}),n.jsx("button",{type:"button",onClick:()=>a(!s),className:"absolute right-3 top-1/2 -translate-y-1/2 text-slate-500 hover:text-slate-700",disabled:i,children:s?n.jsx(nb,{className:"w-4 h-4"}):n.jsx(gd,{className:"w-4 h-4"})})]})]}),n.jsx(te,{type:"submit",className:"w-full",disabled:i||!t.trim(),children:i?"Verifying...":"Access Environment"})]}),n.jsx("div",{className:"mt-6 text-center",children:n.jsxs("p",{className:"text-sm text-slate-600",children:["Environment: ",n.jsx("span",{className:"font-semibold text-orange-600",children:"Development"})]})})]})]})})},k1t=({children:e})=>{const[t,r]=g.useState(null);return g.useEffect(()=>{if(N1t()!=="dev"){r(!0);return}const a=sessionStorage.getItem(Jce);r(a==="true")},[]),t===null?n.jsx("div",{className:"min-h-screen flex items-center justify-center",children:n.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})}):t?n.jsx(n.Fragment,{children:e}):n.jsx(S1t,{onAuthenticated:()=>r(!0)})},E1t=g.lazy(()=>hs(()=>import("./AnonymousOnboarding-BsMewnS4.js"),__vite__mapDeps([2,1])
2148)),CG=g.lazy(()=>hs(()=>import("./AboutUs-DZXFekXQ.js"),__vite__mapDeps([3,1,4]))),SG=g.lazy(()=>hs(()=>import("./Services-D7FFSJJv.js"),__vite__mapDeps([5,1]))),kG=g.lazy(()=>hs(()=>import("./Products-Be6dNP1R.js"),__vite__mapDeps([6,1,7]))),EG=g.lazy(()=>hs(()=>import("./Contact-DPk9iSEL.js"),__vite__mapDeps([8,1]))),BG=g.lazy(()=>hs(()=>import("./Careers-CwKRq27E.js"),__vite__mapDeps([9,1]))),TG=g.lazy(()=>hs(()=>import("./PrivacyPolicy-Dq0i-2Oi.js"),__vite__mapDeps([10,1]))),PG=g.lazy(()=>hs(()=>import("./TermsOfService-sNyUvB4K.js"),__vite__mapDeps([11,1]))),IG=g.lazy(()=>hs(()=>import("./CookieSettings-CwZy0-dk.js"),__vite__mapDeps([12,1]))),B1t=g.lazy(()=>hs(()=>import("./Lander1-DVkMx8XC.js"),__vite__mapDeps([13,1,14,4]))),OG=g.lazy(()=>hs(()=>import("./Blog-DQOs4I6E.js"),__vite__mapDeps([15,1,16]))),xj=g.lazy(()=>hs(()=>import("./BlogPost-bGJhnP_H.js"),__vite__mapDeps([17,1,18,16]))),FG=g.lazy(()=>hs(()=>import("./LandingPage-BddiSiVP.js"),__vite__mapDeps([19,1,14,4]))),LG=g.lazy(()=>hs(()=>import("./BrandPreview-D1OVqlFF.js"),__vite__mapDeps([20,1]))),DG=g.lazy(()=>hs(()=>import("./PublicContentView-De3RIqkd.js"),__vite__mapDeps([21,1,18]))),RG=g.lazy(()=>hs(()=>import("./AiSocialMediaContentGenerator-C7tLDuup.js"),__vite__mapDeps([22,1]))),UG=g.lazy(()=>hs(()=>import("./AutomatedSocialMediaPosting-CNYvjJ5t.js"),__vite__mapDeps([23,1,7]))),MG=g.lazy(()=>hs(()=>import("./SocialMediaScheduler-DPACB536.js"),__vite__mapDeps([24,1,7])));function T1t(){let e;try{e=new Ibe}catch(t){console.debug("Failed to initialize analytics adapter:",t),e={initialize:()=>{},identify:()=>{},track:()=>{},page:()=>{},reset:()=>{},enable:()=>{},disable:()=>{}}}return n.jsx(k1t,{children:n.jsx(Yue,{children:n.jsx($Ae,{children:n.jsx(c1t,{fallback:n.jsxs("div",{className:"flex flex-col items-center justify-center min-h-screen p-8 text-center",children:[n.jsx("h2",{className:"text-2xl font-bold mb-4",children:"We're having trouble loading analytics"}),n.jsx("p",{className:"mb-4",children:"The application will continue to work without analytics."}),n.jsx($G,{})]}),children:n.jsx(Tbe,{adapter:e,options:{apiKey:"phc_eSValYV8cK6wEKbQB5OPWi2tq1P3roP9u2GzVWnaOOP",apiHost:"https://us.i.posthog.com"},children:n.jsx($G,{})})})})})})}function $G(){const{session:e,loading:t}=wa(),{identify:r,enabled:s}=Lu(),a=Gs(),i=xr(),[o,l]=g.useState(!1);return g.useEffect(()=>{var c;console.log("[AppContent] Component rendered/re-rendered",{sessionId:(c=e==null?void 0:e.user)==null?void 0:c.id,loading:t,pathname:a.pathname,timestamp:new Date().toISOString()})}),g.useEffect(()=>{e!=null&&e.user&&s&&r({id:e.user.id,traits:{email:e.user.email,last_login:new Date().toISOString()}})},[e,r,s]),g.useEffect(()=>{Obe(a.pathname+a.search,document.title)},[a]),g.useEffect(()=>{(async()=>{if(!(!(e!=null&&e.user)||["/onboarding","/settings","/auth/","/invitations/","/process-invitation","/logout","/checkout","/purchase-success"].some(u=>a.pathname.includes(u)))){l(!0);try{const{data:u,error:h}=await de.schema("marketing_and_customer_success").from("profiles").select("onboarding_completed").eq("id",e.user.id).single();!h&&u&&u.onboarding_completed===!1&&(console.log("[App] User onboarding not completed, redirecting to /onboarding"),i("/onboarding"))}catch(u){console.error("[App] Error checking onboarding status:",u)}finally{l(!1)}}})()},[e,a.pathname,i]),t||o?n.jsx("div",{className:"min-h-screen",children:n.jsx(Kr,{message:t?"Loading application...":"Checking your settings..."})}):e?n.jsx(xbe,{children:n.jsxs(yNe,{children:[n.jsxs(UD,{children:[n.jsx(Et,{path:"/auth/callback",element:n.jsx(GB,{})}),n.jsx(Et,{path:"/auth/linkedin/callback",element:n.jsx(NY,{})}),n.jsx(Et,{path:"/auth/twitter/callback",element:n.jsx(_Y,{})}),n.jsx(Et,{path:"/auth/facebook/callback",element:n.jsx(l1t,{})}),n.jsx(Et,{path:"/invitations/brand/:token",element:n.jsx(ZP,{})}),n.jsx(Et,{path:"/process-invitation",element:n.jsx(qB,{})}),n.jsx(Et,{path:"/onboarding",element:n.jsx(Of,{requireBrands:!1,children:n.jsx(xwt,{})})}),n.jsx(Et,{path:"/logout",element:n.jsx(Of,{requireBrands:!1,children:n.jsx(Gle,{})})}),n.jsx(Et,{path:"/checkout/success",element:n.jsx(Of,{requireBrands:!1,children:n.jsx(k_,{})})}),n.jsx(Et,{path:"/purchase-success",element:n.jsx(Of,{requireBrands:!1,children:n.jsx(k_,{})})}),n.jsxs(Et,{element:n.jsx(j1t,{children:n.jsx(t1t,{})}),children:[n.jsx(Et,{path:"/landing",element:n.jsx(g.Suspense,{fallback:n.jsx(Kr,{message:"Loading landing page..."}),children:n.jsx(FG,{})})}),n.jsx(Et,{path:"/preview/:slug",element:n.jsx(g.Suspense,{fallback:n.jsx(Kr,{message:"Loading brand preview..."}),children:n.jsx(LG,{})})}),n.jsx(Et,{path:"/about",element:n.jsx(g.Suspense,{fallback:n.jsx(Kr,{message:"Loading about page..."}),children:n.jsx(CG,{})})}),n.jsx(Et,{path:"/services",element:n.jsx(g.Suspense,{fallback:n.jsx(Kr,{message:"Loading services..."}),children:n.jsx(SG,{})})}),n.jsx(Et,{path:"/products",element:n.jsx(g.Suspense,{fallback:n.jsx(Kr,{message:"Loading products..."}),children:n.jsx(kG,{})})}),n.jsx(Et,{path:"/contact",element:n.jsx(g.Suspense,{fallback:n.jsx(Kr,{message:"Loading contact page..."}),children:n.jsx(EG,{})})}),n.jsx(Et,{path:"/careers",element:n.jsx(g.Suspense,{fallback:n.jsx(Kr,{message:"Loading c
2148areers page..."}),children:n.jsx(BG,{})})}),n.jsx(Et,{path:"/privacy-policy",element:n.jsx(g.Suspense,{fallback:n.jsx(Kr,{message:"Loading privacy policy..."}),children:n.jsx(TG,{})})}),n.jsx(Et,{path:"/terms-of-service",element:n.jsx(g.Suspense,{fallback:n.jsx(Kr,{message:"Loading terms of service..."}),children:n.jsx(PG,{})})}),n.jsx(Et,{path:"/cookie-settings",element:n.jsx(g.Suspense,{fallback:n.jsx(Kr,{message:"Loading cookie settings..."}),children:n.jsx(IG,{})})}),n.jsx(Et,{path:"/blog",element:n.jsx(g.Suspense,{fallback:n.jsx(Kr,{message:"Loading blog..."}),children:n.jsx(OG,{})})}),n.jsx(Et,{path:"/blog/:guid",element:n.jsx(g.Suspense,{fallback:n.jsx(Kr,{message:"Loading blog post..."}),children:n.jsx(xj,{})})}),n.jsx(Et,{path:"/blog/:guid/:slug",element:n.jsx(g.Suspense,{fallback:n.jsx(Kr,{message:"Loading blog post..."}),children:n.jsx(xj,{})})}),n.jsx(Et,{path:"/ai-social-media-content-generator",element:n.jsx(g.Suspense,{fallback:n.jsx(Kr,{message:"Loading..."}),children:n.jsx(RG,{})})}),n.jsx(Et,{path:"/automated-social-media-posting",element:n.jsx(g.Suspense,{fallback:n.jsx(Kr,{message:"Loading..."}),children:n.jsx(UG,{})})}),n.jsx(Et,{path:"/social-media-scheduler",element:n.jsx(g.Suspense,{fallback:n.jsx(Kr,{message:"Loading..."}),children:n.jsx(MG,{})})}),owt.map(c=>n.jsx(Et,{path:c.path,element:n.jsx(Of,{children:n.jsx(c.element,{session:e})})},c.path)),n.jsx(Et,{path:"/brand-genius",element:n.jsx(Of,{children:n.jsx(q3,{})})}),n.jsx(Et,{path:"/content/create",element:n.jsx(Of,{children:n.jsx(Die,{})})}),n.jsx(Et,{path:"/public/content/:contentId",element:n.jsx(g.Suspense,{fallback:n.jsx(Kr,{message:"Loading content..."}),children:n.jsx(DG,{})})}),n.jsx(Et,{path:"/",element:n.jsx(pu,{to:"/dashboard",replace:!0})}),n.jsx(Et,{path:"*",element:n.jsx(pu,{to:"/dashboard",replace:!0})})]})]}),n.jsx(kK,{showToast:!0,showCustomNotification:!1,autoTrigger:!0})]})}):n.jsxs(UD,{children:[n.jsx(Et,{path:"/auth/callback",element:n.jsx(GB,{})}),n.jsxs(Et,{element:n.jsx(i1t,{}),children:[n.jsx(Et,{path:"/",element:n.jsx(fNe,{})}),n.jsx(Et,{path:"/pricing",element:n.jsx(o1t,{})}),n.jsx(Et,{path:"/landing",element:n.jsx(g.Suspense,{fallback:n.jsx(Kr,{message:"Loading landing page..."}),children:n.jsx(FG,{})})}),n.jsx(Et,{path:"/preview/:slug",element:n.jsx(g.Suspense,{fallback:n.jsx(Kr,{message:"Loading brand preview..."}),children:n.jsx(LG,{})})}),n.jsx(Et,{path:"/auth",element:n.jsx(w2,{})}),n.jsx(Et,{path:"/login",element:n.jsx(w2,{})}),n.jsx(Et,{path:"/login-new",element:n.jsx(p1t,{})}),n.jsx(Et,{path:"/signup",element:n.jsx(A1t,{})}),n.jsx(Et,{path:"/reset-password",element:n.jsx(x1t,{})}),n.jsx(Et,{path:"/reset-password/confirm",element:n.jsx(y1t,{})}),n.jsx(Et,{path:"/onboarding/help-wizard",element:n.jsx(g.Suspense,{fallback:n.jsx(Kr,{message:"Loading onboarding wizard..."}),children:n.jsx(E1t,{})})}),n.jsx(Et,{path:"/lander1",element:n.jsx(g.Suspense,{fallback:n.jsx(Kr,{message:"Loading page..."}),children:n.jsx(B1t,{})})}),n.jsx(Et,{path:"/invitations/brand/:token",element:n.jsx(ZP,{})}),n.jsx(Et,{path:"/process-invitation",element:n.jsx(qB,{})}),n.jsx(Et,{path:"/about",element:n.jsx(g.Suspense,{fallback:n.jsx(Kr,{message:"Loading about page..."}),children:n.jsx(CG,{})})}),n.jsx(Et,{path:"/services",element:n.jsx(g.Suspense,{fallback:n.jsx(Kr,{message:"Loading services..."}),children:n.jsx(SG,{})})}),n.jsx(Et,{path:"/products",element:n.jsx(g.Suspense,{fallback:n.jsx(Kr,{message:"Loading products..."}),children:n.jsx(kG,{})})}),n.jsx(Et,{path:"/contact",element:n.jsx(g.Suspense,{fallback:n.jsx(Kr,{message:"Loading contact page..."}),children:n.jsx(EG,{})})}),n.jsx(Et,{path:"/careers",element:n.jsx(g.Suspense,{fallback:n.jsx(Kr,{message:"Loading careers page..."}),children:n.jsx(BG,{})})}),n.jsx(Et,{path:"/privacy-policy",element:n.jsx(g.Suspense,{fallback:n.jsx(Kr,{message:"Loading privacy policy..."}),children:n.jsx(TG,{})})}),n.jsx(Et,{path:"/terms-of-service",element:n.jsx(g.Suspense,{fallback:n.jsx(Kr,{message:"Loading terms of service..."}),children:n.jsx(PG,{})})}),n.jsx(Et,{path:"/cookie-settings",element:n.jsx(g.Suspense,{fallback:n.jsx(Kr,{message:"Loading cookie settings..."}),children:n.jsx(IG,{})})}),n.jsx(Et,{path:"/public/content/:contentId",element:n.jsx(g.Suspense,{fallback:n.jsx(Kr,{message:"Loading content..."}),children:n.jsx(DG,{})})}),n.jsx(Et,{path:"/blog",element:n.jsx(g.Suspense,{fallback:n.jsx(Kr,{message:"Loading blog..."}),children:n.jsx(OG,{})})}),n.jsx(Et,{path:"/blog/:guid",element:n.jsx(g.Suspense,{fallback:n.jsx(Kr,{message:"Loading blog post..."}),children:n.jsx(xj,{})})}),n.jsx(Et,{path:"/blog/:guid/:slug",element:n.jsx(g.Suspense,{fallback:n.jsx(Kr,{message:"Loading blog post..."}),children:n.jsx(xj,{})})}),n.jsx(Et,{path:"/ai-social-media-content-generator",element:n.jsx(g.Suspense,{fallback:n.jsx(Kr,{message:"Loading..."}),children:n.jsx(RG,{})})}),n.jsx(Et,{path:"/automated-social-media-posting",element:n.jsx(g.Suspense,{fallback:n.jsx(Kr,{message:"Loading..."}),children:n.jsx(UG,{})})}),n.jsx(Et,{path:"/social-media-scheduler",element:n.jsx(g.Suspense,{fallback:n.jsx(Kr,{message:"Loading..."}),children:n.jsx(MG,{})})}),n.jsx(Et,{path:"*",element:n.jsx(gbe,{to:"/",replace:!0})})]})]})}G4.createRoot(document.getElementById("root")).render(n.jsx(oe.StrictMode,{children:n.jsx(n1t,{defaultTheme:"light",storageKey:"app-theme",children:n.jsx(T1t,{})})}));export{Fe as $,io as A,Be as B,Te as C,f2e as D,m2e as E,hNe as F,Is as G,pxe as H,Om as I,ze as J,li as K,kt as L,HR as M,qe as N,Cu as O,ho as P,ih as Q,c6 as R,mr as S,sa as T,Ka as U,v2e as V,ur as W,or as X,hr as Y,en as Z,lr as _,xr as a,Zr as a0,sb as a1,Fu as a2,Un as a3,qh as a4,Zve as a5,ky as a6,cg as a7,lg as a8,ns as a9,Qxe as aA,CK as aB,_u as aC,Vh as aD,Ey as aE,Rl as aF,Gge as aG,Es as aH,On as aI,xn as aa,He as ab,yWe as ac,Zt as ad,Jt as ae,sl as af,AO as ag,Ei as ah,Yo as ai,bn as aj,Gs as ak,wi as al,g2e as am,Yce as an,Gn as ao,Cc as ap,Vs as aq,gd as ar,Kn as as,Ar as at,gr as au,Wa as av,Xr as aw,nL as ax,og as ay,fi as az,Re as b,nr as c,te as d,klt as e,di as f,$e as g,IK as h,Vr as i,ui as j,ng as k,Zw as l,ut as m,Gi as n,Gh as o,Fm as p,Qa as q,st as r,ot as s,Wr as t,Bi as u,uo as v,ig as w,Nxe as x,ye as y,qt as z};
2149//# sourceMappingURL=index-DVqYXXq7.js.map

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.