@kite-copilot/chat-panel 0.2.45 → 0.2.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/auto.cjs CHANGED
@@ -1023,7 +1023,7 @@ function TypingIndicator({ className = "" }) {
1023
1023
 
1024
1024
  // src/ChatPanel.tsx
1025
1025
  var import_jsx_runtime10 = require("react/jsx-runtime");
1026
- var CHAT_PANEL_VERSION = true ? "0.2.45" : "dev";
1026
+ var CHAT_PANEL_VERSION = true ? "0.2.46" : "dev";
1027
1027
  var DEFAULT_AGENT_URL = "http://localhost:5002";
1028
1028
  var PANEL_WIDTH = 340;
1029
1029
  function unescapeJsonString(str) {
@@ -1502,32 +1502,32 @@ function ChatPanel({
1502
1502
  if (!effectiveProductBackendUrl || orgConfigState.status !== "success") {
1503
1503
  return;
1504
1504
  }
1505
- const testUserSiteEndpoint = async () => {
1506
- const url = `${effectiveProductBackendUrl}/userSite`;
1507
- console.log("[KiteChat TEST] Testing GET /userSite endpoint...");
1505
+ const testProductBackendEndpoint = async () => {
1506
+ const url = `${effectiveProductBackendUrl}/getDocument/snowkite/categories/`;
1507
+ console.log("[KiteChat TEST] Testing product backend connectivity...");
1508
1508
  console.log("[KiteChat TEST] URL:", url);
1509
1509
  try {
1510
1510
  const response = await fetch(url, {
1511
1511
  method: "GET",
1512
- credentials: "include",
1512
+ // Note: not using credentials: 'include' to avoid CORS issues with wildcard
1513
1513
  headers: {
1514
1514
  "Accept": "application/json"
1515
1515
  }
1516
1516
  });
1517
- console.log("[KiteChat TEST] /userSite response status:", response.status);
1518
- console.log("[KiteChat TEST] /userSite response ok:", response.ok);
1517
+ console.log("[KiteChat TEST] Response status:", response.status);
1518
+ console.log("[KiteChat TEST] Response ok:", response.ok);
1519
1519
  if (response.ok) {
1520
1520
  const data = await response.json();
1521
- console.log("[KiteChat TEST] /userSite SUCCESS - data:", data);
1521
+ console.log("[KiteChat TEST] SUCCESS - product backend reachable, data:", data);
1522
1522
  } else {
1523
1523
  const errorText = await response.text();
1524
- console.log("[KiteChat TEST] /userSite FAILED - status:", response.status, "body:", errorText);
1524
+ console.log("[KiteChat TEST] FAILED - status:", response.status, "body:", errorText);
1525
1525
  }
1526
1526
  } catch (error) {
1527
- console.error("[KiteChat TEST] /userSite ERROR:", error);
1527
+ console.error("[KiteChat TEST] ERROR:", error);
1528
1528
  }
1529
1529
  };
1530
- testUserSiteEndpoint();
1530
+ testProductBackendEndpoint();
1531
1531
  }, [effectiveProductBackendUrl, orgConfigState.status]);
1532
1532
  const effectiveUser = React6.useMemo(() => {
1533
1533
  if (authState.status === "authenticated") {
package/dist/auto.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createKiteChat
3
- } from "./chunk-262FS4KW.js";
3
+ } from "./chunk-4HIWUL6E.js";
4
4
 
5
5
  // src/auto.ts
6
6
  function mountKiteChat(config) {
@@ -1024,7 +1024,7 @@ function TypingIndicator({ className = "" }) {
1024
1024
 
1025
1025
  // src/ChatPanel.tsx
1026
1026
  import { Fragment as Fragment2, jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
1027
- var CHAT_PANEL_VERSION = true ? "0.2.45" : "dev";
1027
+ var CHAT_PANEL_VERSION = true ? "0.2.46" : "dev";
1028
1028
  var DEFAULT_AGENT_URL = "http://localhost:5002";
1029
1029
  var PANEL_WIDTH = 340;
1030
1030
  function unescapeJsonString(str) {
@@ -1503,32 +1503,32 @@ function ChatPanel({
1503
1503
  if (!effectiveProductBackendUrl || orgConfigState.status !== "success") {
1504
1504
  return;
1505
1505
  }
1506
- const testUserSiteEndpoint = async () => {
1507
- const url = `${effectiveProductBackendUrl}/userSite`;
1508
- console.log("[KiteChat TEST] Testing GET /userSite endpoint...");
1506
+ const testProductBackendEndpoint = async () => {
1507
+ const url = `${effectiveProductBackendUrl}/getDocument/snowkite/categories/`;
1508
+ console.log("[KiteChat TEST] Testing product backend connectivity...");
1509
1509
  console.log("[KiteChat TEST] URL:", url);
1510
1510
  try {
1511
1511
  const response = await fetch(url, {
1512
1512
  method: "GET",
1513
- credentials: "include",
1513
+ // Note: not using credentials: 'include' to avoid CORS issues with wildcard
1514
1514
  headers: {
1515
1515
  "Accept": "application/json"
1516
1516
  }
1517
1517
  });
1518
- console.log("[KiteChat TEST] /userSite response status:", response.status);
1519
- console.log("[KiteChat TEST] /userSite response ok:", response.ok);
1518
+ console.log("[KiteChat TEST] Response status:", response.status);
1519
+ console.log("[KiteChat TEST] Response ok:", response.ok);
1520
1520
  if (response.ok) {
1521
1521
  const data = await response.json();
1522
- console.log("[KiteChat TEST] /userSite SUCCESS - data:", data);
1522
+ console.log("[KiteChat TEST] SUCCESS - product backend reachable, data:", data);
1523
1523
  } else {
1524
1524
  const errorText = await response.text();
1525
- console.log("[KiteChat TEST] /userSite FAILED - status:", response.status, "body:", errorText);
1525
+ console.log("[KiteChat TEST] FAILED - status:", response.status, "body:", errorText);
1526
1526
  }
1527
1527
  } catch (error) {
1528
- console.error("[KiteChat TEST] /userSite ERROR:", error);
1528
+ console.error("[KiteChat TEST] ERROR:", error);
1529
1529
  }
1530
1530
  };
1531
- testUserSiteEndpoint();
1531
+ testProductBackendEndpoint();
1532
1532
  }, [effectiveProductBackendUrl, orgConfigState.status]);
1533
1533
  const effectiveUser = React6.useMemo(() => {
1534
1534
  if (authState.status === "authenticated") {
@@ -20,11 +20,11 @@ Error generating stack: `+n.message+`
20
20
  top: ${l}px !important;
21
21
  left: ${u}px !important;
22
22
  }
23
- `),()=>{document.head.removeChild(d)}},[t]),(0,HS.jsx)(kg,{isPresent:t,childRef:r,sizeRef:o,children:qc.cloneElement(e,{ref:r})})}var GS=({children:e,initial:t,isPresent:a,onExitComplete:r,custom:o,presenceAffectsLayout:n,mode:s})=>{let i=Os(YR),l=(0,pn.useId)(),u=(0,pn.useCallback)(c=>{i.set(c,!0);for(let f of i.values())if(!f)return;r&&r()},[i,r]),d=(0,pn.useMemo)(()=>({id:l,initial:t,isPresent:a,custom:o,onExitComplete:u,register:c=>(i.set(c,!1),()=>i.delete(c))}),n?[Math.random(),u]:[a,u]);return(0,pn.useMemo)(()=>{i.forEach((c,f)=>i.set(f,!1))},[a]),WS.useEffect(()=>{!a&&!i.size&&r&&r()},[a]),s==="popLayout"&&(e=(0,Pg.jsx)($S,{isPresent:a,children:e})),(0,Pg.jsx)(no.Provider,{value:d,children:e})};function YR(){return new Map}var so=N(W(),1);function zc(e=!0){let t=(0,so.useContext)(no);if(t===null)return[!0,null];let{isPresent:a,onExitComplete:r,register:o}=t,n=(0,so.useId)();(0,so.useEffect)(()=>{e&&o(n)},[e]);let s=(0,so.useCallback)(()=>e&&r&&r(n),[n,r,e]);return!a&&r?[!1,s]:[!0]}var Hc=N(W(),1),ou=e=>e.key||"";function Tg(e){let t=[];return Hc.Children.forEach(e,a=>{(0,Hc.isValidElement)(a)&&t.push(a)}),t}var $c=N(W(),1);var Bs=typeof window<"u";var Wc=Bs?$c.useLayoutEffect:$c.useEffect;var Ag=({children:e,custom:t,initial:a=!0,onExitComplete:r,presenceAffectsLayout:o=!0,mode:n="sync",propagate:s=!1})=>{let[i,l]=zc(s),u=(0,ja.useMemo)(()=>Tg(e),[e]),d=s&&!i?[]:u.map(ou),c=(0,ja.useRef)(!0),f=(0,ja.useRef)(u),g=Os(()=>new Map),[x,w]=(0,ja.useState)(u),[L,y]=(0,ja.useState)(u);Wc(()=>{c.current=!1,f.current=u;for(let S=0;S<L.length;S++){let I=ou(L[S]);d.includes(I)?g.delete(I):g.get(I)!==!0&&g.set(I,!1)}},[L,d.length,d.join("-")]);let h=[];if(u!==x){let S=[...u];for(let I=0;I<L.length;I++){let P=L[I],R=ou(P);d.includes(R)||(S.splice(I,0,P),h.push(P))}n==="wait"&&h.length&&(S=h),y(Tg(S)),w(u);return}let{forceRender:m}=(0,ja.useContext)(Ns);return(0,nu.jsx)(nu.Fragment,{children:L.map(S=>{let I=ou(S),P=s&&!i?!1:u===L||d.includes(I),R=()=>{if(g.has(I))g.set(I,!0);else return;let A=!0;g.forEach(V=>{V||(A=!1)}),A&&(m?.(),y(f.current),s&&l?.(),r&&r())};return(0,nu.jsx)(GS,{isPresent:P,initial:!c.current||a?void 0:!1,custom:P?void 0:t,presenceAffectsLayout:o,mode:n,onExitComplete:P?void 0:R,children:S},I)})})};var ge=e=>e;var gr=ge,Ta=ge;function mn(e){let t;return()=>(t===void 0&&(t=e()),t)}var Zt=(e,t,a)=>{let r=t-e;return r===0?1:(a-e)/r};var Ve=e=>e*1e3,dt=e=>e/1e3;var Us={skipAnimations:!1,useManualTiming:!1};function KS(e){let t=new Set,a=new Set,r=!1,o=!1,n=new WeakSet,s={delta:0,timestamp:0,isProcessing:!1};function i(u){n.has(u)&&(l.schedule(u),e()),u(s)}let l={schedule:(u,d=!1,c=!1)=>{let g=c&&r?t:a;return d&&n.add(u),g.has(u)||g.add(u),u},cancel:u=>{a.delete(u),n.delete(u)},process:u=>{if(s=u,r){o=!0;return}r=!0,[t,a]=[a,t],t.forEach(i),t.clear(),r=!1,o&&(o=!1,l.process(u))}};return l}var Gc=["read","resolveKeyframes","update","preRender","render","postRender"],ZR=40;function Kc(e,t){let a=!1,r=!0,o={delta:0,timestamp:0,isProcessing:!1},n=()=>a=!0,s=Gc.reduce((y,h)=>(y[h]=KS(n),y),{}),{read:i,resolveKeyframes:l,update:u,preRender:d,render:c,postRender:f}=s,g=()=>{let y=Us.useManualTiming?o.timestamp:performance.now();a=!1,o.delta=r?1e3/60:Math.max(Math.min(y-o.timestamp,ZR),1),o.timestamp=y,o.isProcessing=!0,i.process(o),l.process(o),u.process(o),d.process(o),c.process(o),f.process(o),o.isProcessing=!1,a&&t&&(r=!1,e(g))},x=()=>{a=!0,r=!0,o.isProcessing||e(g)};return{schedule:Gc.reduce((y,h)=>{let m=s[h];return y[h]=(S,I=!1,P=!1)=>(a||x(),m.schedule(S,I,P)),y},{}),cancel:y=>{for(let h=0;h<Gc.length;h++)s[Gc[h]].cancel(y)},state:o,steps:s}}var{schedule:Z,cancel:ea,state:je,steps:Xc}=Kc(typeof requestAnimationFrame<"u"?requestAnimationFrame:ge,!0);var XS=N(W(),1),Qc=(0,XS.createContext)({strict:!1});var QS={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"]},yr={};for(let e in QS)yr[e]={isEnabled:t=>QS[e].some(a=>!!t[a])};function JS(e){for(let t in e)yr[t]={...yr[t],...e[t]}}var e_=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 su(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||e_.has(e)}var YS=e=>!su(e);function t_(e){e&&(YS=t=>t.startsWith("on")?!su(t):e(t))}try{t_(Ok("@emotion/is-prop-valid").default)}catch{}function ZS(e,t,a){let r={};for(let o in e)o==="values"&&typeof e.values=="object"||(YS(o)||a===!0&&su(o)||!t&&!su(o)||e.draggable&&o.startsWith("onDrag"))&&(r[o]=e[o]);return r}function eL(e){if(typeof Proxy>"u")return e;let t=new Map,a=(...r)=>e(...r);return new Proxy(a,{get:(r,o)=>o==="create"?e:(t.has(o)||t.set(o,e(o)),t.get(o))})}var af=N(le(),1);var qs=N(W(),1);var tL=N(W(),1),io=(0,tL.createContext)({});var Zc=N(W(),1);function xr(e){return typeof e=="string"||Array.isArray(e)}function lo(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}var Jc=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],iu=["initial",...Jc];function hn(e){return lo(e.animate)||iu.some(t=>xr(e[t]))}function Yc(e){return!!(hn(e)||e.variants)}function aL(e,t){if(hn(e)){let{initial:a,animate:r}=e;return{initial:a===!1||xr(a)?a:void 0,animate:xr(r)?r:void 0}}return e.inherit!==!1?t:{}}function oL(e){let{initial:t,animate:a}=aL(e,(0,Zc.useContext)(io));return(0,Zc.useMemo)(()=>({initial:t,animate:a}),[rL(t),rL(a)])}function rL(e){return Array.isArray(e)?e.join(" "):e}var nL=Symbol.for("motionComponentSymbol");var sL=N(W(),1);function vr(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function iL(e,t,a){return(0,sL.useCallback)(r=>{r&&e.onMount&&e.onMount(r),t&&(r?t.mount(r):t.unmount()),a&&(typeof a=="function"?a(r):vr(a)&&(a.current=r))},[t])}var Ut=N(W(),1);var Vs=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase();var a_="framerAppearId",ef="data-"+Vs(a_);var{schedule:js,cancel:BU}=Kc(queueMicrotask,!1);var lL=N(W(),1),tf=(0,lL.createContext)({});function uL(e,t,a,r,o){var n,s;let{visualElement:i}=(0,Ut.useContext)(io),l=(0,Ut.useContext)(Qc),u=(0,Ut.useContext)(no),d=(0,Ut.useContext)(Fs).reducedMotion,c=(0,Ut.useRef)(null);r=r||l.renderer,!c.current&&r&&(c.current=r(e,{visualState:t,parent:i,props:a,presenceContext:u,blockInitialAnimation:u?u.initial===!1:!1,reducedMotionConfig:d}));let f=c.current,g=(0,Ut.useContext)(tf);f&&!f.projection&&o&&(f.type==="html"||f.type==="svg")&&r_(c.current,a,o,g);let x=(0,Ut.useRef)(!1);(0,Ut.useInsertionEffect)(()=>{f&&x.current&&f.update(a,u)});let w=a[ef],L=(0,Ut.useRef)(!!w&&!(!((n=window.MotionHandoffIsComplete)===null||n===void 0)&&n.call(window,w))&&((s=window.MotionHasOptimisedAnimation)===null||s===void 0?void 0:s.call(window,w)));return Wc(()=>{f&&(x.current=!0,window.MotionIsMounted=!0,f.updateFeatures(),js.render(f.render),L.current&&f.animationState&&f.animationState.animateChanges())}),(0,Ut.useEffect)(()=>{f&&(!L.current&&f.animationState&&f.animationState.animateChanges(),L.current&&(queueMicrotask(()=>{var y;(y=window.MotionHandoffMarkAsComplete)===null||y===void 0||y.call(window,w)}),L.current=!1))}),f}function r_(e,t,a,r){let{layoutId:o,layout:n,drag:s,dragConstraints:i,layoutScroll:l,layoutRoot:u}=t;e.projection=new a(e.latestValues,t["data-framer-portal-id"]?void 0:dL(e.parent)),e.projection.setOptions({layoutId:o,layout:n,alwaysMeasureLayout:!!s||i&&vr(i),visualElement:e,animationType:typeof n=="string"?n:"both",initialPromotionConfig:r,layoutScroll:l,layoutRoot:u})}function dL(e){if(e)return e.options.allowProjection!==!1?e.projection:dL(e.parent)}function cL({preloadedFeatures:e,createVisualElement:t,useRender:a,useVisualState:r,Component:o}){var n,s;e&&JS(e);function i(u,d){let c,f={...(0,qs.useContext)(Fs),...u,layoutId:o_(u)},{isStatic:g}=f,x=oL(u),w=r(u,g);if(!g&&Bs){n_(f,e);let L=s_(f);c=L.MeasureLayout,x.visualElement=uL(o,w,f,t,L.ProjectionNode)}return(0,af.jsxs)(io.Provider,{value:x,children:[c&&x.visualElement?(0,af.jsx)(c,{visualElement:x.visualElement,...f}):null,a(o,u,iL(w,x.visualElement,d),w,g,x.visualElement)]})}i.displayName=`motion.${typeof o=="string"?o:`create(${(s=(n=o.displayName)!==null&&n!==void 0?n:o.name)!==null&&s!==void 0?s:""})`}`;let l=(0,qs.forwardRef)(i);return l[nL]=o,l}function o_({layoutId:e}){let t=(0,qs.useContext)(Ns).id;return t&&e!==void 0?t+"-"+e:e}function n_(e,t){let a=(0,qs.useContext)(Qc).strict}function s_(e){let{drag:t,layout:a}=yr;if(!t&&!a)return{};let r={...t,...a};return{MeasureLayout:t?.isEnabled(e)||a?.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}var fL=["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 zs(e){return typeof e!="string"||e.includes("-")?!1:!!(fL.indexOf(e)>-1||/[A-Z]/u.test(e))}var Rg=N(W(),1);function pL(e){let t=[{},{}];return e?.values.forEach((a,r)=>{t[0][r]=a.get(),t[1][r]=a.getVelocity()}),t}function Hs(e,t,a,r){if(typeof t=="function"){let[o,n]=pL(r);t=t(a!==void 0?a:e.custom,o,n)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){let[o,n]=pL(r);t=t(a!==void 0?a:e.custom,o,n)}return t}var lu=e=>Array.isArray(e);var mL=e=>!!(e&&typeof e=="object"&&e.mix&&e.toValue),hL=e=>lu(e)?e[e.length-1]||0:e;var Se=e=>!!(e&&e.getVelocity);function $s(e){let t=Se(e)?e.get():e;return mL(t)?t.toValue():t}function i_({scrapeMotionValuesFromProps:e,createRenderState:t,onUpdate:a},r,o,n){let s={latestValues:l_(r,o,n,e),renderState:t()};return a&&(s.onMount=i=>a({props:r,current:i,...s}),s.onUpdate=i=>a(i)),s}var rf=e=>(t,a)=>{let r=(0,Rg.useContext)(io),o=(0,Rg.useContext)(no),n=()=>i_(e,t,r,o);return a?n():Os(n)};function l_(e,t,a,r){let o={},n=r(e,{});for(let f in n)o[f]=$s(n[f]);let{initial:s,animate:i}=e,l=hn(e),u=Yc(e);t&&u&&!l&&e.inherit!==!1&&(s===void 0&&(s=t.initial),i===void 0&&(i=t.animate));let d=a?a.initial===!1:!1;d=d||s===!1;let c=d?i:s;if(c&&typeof c!="boolean"&&!lo(c)){let f=Array.isArray(c)?c:[c];for(let g=0;g<f.length;g++){let x=Hs(e,f[g]);if(x){let{transitionEnd:w,transition:L,...y}=x;for(let h in y){let m=y[h];if(Array.isArray(m)){let S=d?m.length-1:0;m=m[S]}m!==null&&(o[h]=m)}for(let h in w)o[h]=w[h]}}}return o}var qa=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Vt=new Set(qa);var gL=e=>t=>typeof t=="string"&&t.startsWith(e),of=gL("--"),u_=gL("var(--"),Ws=e=>u_(e)?d_.test(e.split("/*")[0].trim()):!1,d_=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;var nf=(e,t)=>t&&typeof e=="number"?t.transform(e):e;var ct=(e,t,a)=>a>t?t:a<e?e:a;var za={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},wr={...za,transform:e=>ct(0,1,e)},uu={...za,default:1};var du=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Ha=du("deg"),Tt=du("%"),z=du("px"),yL=du("vh"),xL=du("vw"),_g={...Tt,parse:e=>Tt.parse(e)/100,transform:e=>Tt.transform(e*100)};var vL={borderWidth:z,borderTopWidth:z,borderRightWidth:z,borderBottomWidth:z,borderLeftWidth:z,borderRadius:z,radius:z,borderTopLeftRadius:z,borderTopRightRadius:z,borderBottomRightRadius:z,borderBottomLeftRadius:z,width:z,maxWidth:z,height:z,maxHeight:z,top:z,right:z,bottom:z,left:z,padding:z,paddingTop:z,paddingRight:z,paddingBottom:z,paddingLeft:z,margin:z,marginTop:z,marginRight:z,marginBottom:z,marginLeft:z,backgroundPositionX:z,backgroundPositionY:z};var wL={rotate:Ha,rotateX:Ha,rotateY:Ha,rotateZ:Ha,scale:uu,scaleX:uu,scaleY:uu,scaleZ:uu,skew:Ha,skewX:Ha,skewY:Ha,distance:z,translateX:z,translateY:z,translateZ:z,x:z,y:z,z,perspective:z,transformPerspective:z,opacity:wr,originX:_g,originY:_g,originZ:z};var Eg={...za,transform:Math.round};var Gs={...vL,...wL,zIndex:Eg,size:z,fillOpacity:wr,strokeOpacity:wr,numOctaves:Eg};var c_={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},f_=qa.length;function CL(e,t,a){let r="",o=!0;for(let n=0;n<f_;n++){let s=qa[n],i=e[s];if(i===void 0)continue;let l=!0;if(typeof i=="number"?l=i===(s.startsWith("scale")?1:0):l=parseFloat(i)===0,!l||a){let u=nf(i,Gs[s]);if(!l){o=!1;let d=c_[s]||s;r+=`${d}(${u}) `}a&&(t[s]=u)}}return r=r.trim(),a?r=a(t,o?"":r):o&&(r="none"),r}function Ks(e,t,a){let{style:r,vars:o,transformOrigin:n}=e,s=!1,i=!1;for(let l in t){let u=t[l];if(Vt.has(l)){s=!0;continue}else if(of(l)){o[l]=u;continue}else{let d=nf(u,Gs[l]);l.startsWith("origin")?(i=!0,n[l]=d):r[l]=d}}if(t.transform||(s||a?r.transform=CL(t,e.transform,a):r.transform&&(r.transform="none")),i){let{originX:l="50%",originY:u="50%",originZ:d=0}=n;r.transformOrigin=`${l} ${u} ${d}`}}var p_={offset:"stroke-dashoffset",array:"stroke-dasharray"},m_={offset:"strokeDashoffset",array:"strokeDasharray"};function SL(e,t,a=1,r=0,o=!0){e.pathLength=1;let n=o?p_:m_;e[n.offset]=z.transform(-r);let s=z.transform(t),i=z.transform(a);e[n.array]=`${s} ${i}`}function LL(e,t,a){return typeof e=="string"?e:z.transform(t+a*e)}function IL(e,t,a){let r=LL(t,e.x,e.width),o=LL(a,e.y,e.height);return`${r} ${o}`}function Xs(e,{attrX:t,attrY:a,attrScale:r,originX:o,originY:n,pathLength:s,pathSpacing:i=1,pathOffset:l=0,...u},d,c){if(Ks(e,u,c),d){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};let{attrs:f,style:g,dimensions:x}=e;f.transform&&(x&&(g.transform=f.transform),delete f.transform),x&&(o!==void 0||n!==void 0||g.transform)&&(g.transformOrigin=IL(x,o!==void 0?o:.5,n!==void 0?n:.5)),t!==void 0&&(f.x=t),a!==void 0&&(f.y=a),r!==void 0&&(f.scale=r),s!==void 0&&SL(f,s,i,l,!1)}var Qs=()=>({style:{},transform:{},transformOrigin:{},vars:{}});var sf=()=>({...Qs(),attrs:{}});var Js=e=>typeof e=="string"&&e.toLowerCase()==="svg";function lf(e,{style:t,vars:a},r,o){Object.assign(e.style,t,o&&o.getProjectionStyles(r));for(let n in a)e.style.setProperty(n,a[n])}var uf=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 df(e,t,a,r){lf(e,t,void 0,r);for(let o in t.attrs)e.setAttribute(uf.has(o)?o:Vs(o),t.attrs[o])}var Ys={};function bL(e){Object.assign(Ys,e)}function cf(e,{layout:t,layoutId:a}){return Vt.has(e)||e.startsWith("origin")||(t||a!==void 0)&&(!!Ys[e]||e==="opacity")}function Zs(e,t,a){var r;let{style:o}=e,n={};for(let s in o)(Se(o[s])||t.style&&Se(t.style[s])||cf(s,e)||((r=a?.getValue(s))===null||r===void 0?void 0:r.liveStyle)!==void 0)&&(n[s]=o[s]);return n}function ff(e,t,a){let r=Zs(e,t,a);for(let o in e)if(Se(e[o])||Se(t[o])){let n=qa.indexOf(o)!==-1?"attr"+o.charAt(0).toUpperCase()+o.substring(1):o;r[n]=e[o]}return r}function h_(e,t){try{t.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{t.dimensions={x:0,y:0,width:0,height:0}}}var kL=["x","y","width","height","cx","cy","r"],PL={useVisualState:rf({scrapeMotionValuesFromProps:ff,createRenderState:sf,onUpdate:({props:e,prevProps:t,current:a,renderState:r,latestValues:o})=>{if(!a)return;let n=!!e.drag;if(!n){for(let i in o)if(Vt.has(i)){n=!0;break}}if(!n)return;let s=!t;if(t)for(let i=0;i<kL.length;i++){let l=kL[i];e[l]!==t[l]&&(s=!0)}s&&Z.read(()=>{h_(a,r),Z.render(()=>{Xs(r,o,Js(a.tagName),e.transformTemplate),df(a,r)})})}})};var TL={useVisualState:rf({scrapeMotionValuesFromProps:Zs,createRenderState:Qs})};var ei=N(W(),1);var AL=N(W(),1);function Dg(e,t,a){for(let r in t)!Se(t[r])&&!cf(r,a)&&(e[r]=t[r])}function g_({transformTemplate:e},t){return(0,AL.useMemo)(()=>{let a=Qs();return Ks(a,t,e),Object.assign({},a.vars,a.style)},[t])}function y_(e,t){let a=e.style||{},r={};return Dg(r,a,e),Object.assign(r,g_(e,t)),r}function RL(e,t){let a={},r=y_(e,t);return e.drag&&e.dragListener!==!1&&(a.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(a.tabIndex=0),a.style=r,a}var _L=N(W(),1);function EL(e,t,a,r){let o=(0,_L.useMemo)(()=>{let n=sf();return Xs(n,t,Js(r),e.transformTemplate),{...n.attrs,style:{...n.style}}},[t]);if(e.style){let n={};Dg(n,e.style,e),o.style={...n,...o.style}}return o}function DL(e=!1){return(a,r,o,{latestValues:n},s)=>{let l=(zs(a)?EL:RL)(r,n,s,a),u=ZS(r,typeof a=="string",e),d=a!==ei.Fragment?{...u,...l,ref:o}:{},{children:c}=r,f=(0,ei.useMemo)(()=>Se(c)?c.get():c,[c]);return(0,ei.createElement)(a,{...d,children:f})}}function ML(e,t){return function(r,{forwardMotionProps:o}={forwardMotionProps:!1}){let s={...zs(r)?PL:TL,preloadedFeatures:e,useRender:DL(o),createVisualElement:t,Component:r};return cL(s)}}function Mg(e,t){if(!Array.isArray(t))return!1;let a=t.length;if(a!==e.length)return!1;for(let r=0;r<a;r++)if(t[r]!==e[r])return!1;return!0}function uo(e,t,a){let r=e.getProps();return Hs(r,t,a!==void 0?a:r.custom,e)}var Ng=mn(()=>window.ScrollTimeline!==void 0);var cu=class{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,a){for(let r=0;r<this.animations.length;r++)this.animations[r][t]=a}attachTimeline(t,a){let r=this.animations.map(o=>{if(Ng()&&o.attachTimeline)return o.attachTimeline(t);if(typeof a=="function")return a(o)});return()=>{r.forEach((o,n)=>{o&&o(),this.animations[n].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 a=0;a<this.animations.length;a++)t=Math.max(t,this.animations[a].duration);return t}runAll(t){this.animations.forEach(a=>a[t]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}};var fu=class extends cu{then(t,a){return Promise.all(this.animations).then(t).catch(a)}};function co(e,t){return e?e[t]||e.default||e:void 0}function ti(e){let t=0,a=50,r=e.next(t);for(;!r.done&&t<2e4;)t+=a,r=e.next(t);return t>=2e4?1/0:t}function fo(e){return typeof e=="function"}function pu(e,t){e.timeline=t,e.onfinish=null}var ai=e=>Array.isArray(e)&&typeof e[0]=="number";var Fg={linearEasing:void 0};function NL(e,t){let a=mn(e);return()=>{var r;return(r=Fg[t])!==null&&r!==void 0?r:a()}}var po=NL(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing");var mu=(e,t,a=10)=>{let r="",o=Math.max(Math.round(t/a),2);for(let n=0;n<o;n++)r+=e(Zt(0,o-1,n))+", ";return`linear(${r.substring(0,r.length-2)})`};function mf(e){return!!(typeof e=="function"&&po()||!e||typeof e=="string"&&(e in pf||po())||ai(e)||Array.isArray(e)&&e.every(mf))}var ri=([e,t,a,r])=>`cubic-bezier(${e}, ${t}, ${a}, ${r})`,pf={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:ri([0,.65,.55,1]),circOut:ri([.55,0,1,.45]),backIn:ri([.31,.01,.66,-.59]),backOut:ri([.33,1.53,.69,.99])};function oi(e,t){if(e)return typeof e=="function"&&po()?mu(e,t):ai(e)?ri(e):Array.isArray(e)?e.map(a=>oi(a,t)||pf.easeOut):pf[e]}var ta={x:!1,y:!1};function ni(){return ta.x||ta.y}function Bg(e,t,a){var r;if(e instanceof Element)return[e];if(typeof e=="string"){let o=document;t&&(o=t.current);let n=(r=a?.[e])!==null&&r!==void 0?r:o.querySelectorAll(e);return n?Array.from(n):[]}return Array.from(e)}function hf(e,t){let a=Bg(e),r=new AbortController,o={passive:!0,...t,signal:r.signal};return[a,o,()=>r.abort()]}function OL(e){return t=>{t.pointerType==="touch"||ni()||e(t)}}function Ug(e,t,a={}){let[r,o,n]=hf(e,a),s=OL(i=>{let{target:l}=i,u=t(i);if(typeof u!="function"||!l)return;let d=OL(c=>{u(c),l.removeEventListener("pointerleave",d)});l.addEventListener("pointerleave",d,o)});return r.forEach(i=>{i.addEventListener("pointerenter",s,o)}),n}var gf=(e,t)=>t?e===t?!0:gf(e,t.parentElement):!1;var gn=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1;var x_=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function FL(e){return x_.has(e.tagName)||e.tabIndex!==-1}var yn=new WeakSet;function BL(e){return t=>{t.key==="Enter"&&e(t)}}function Vg(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}var UL=(e,t)=>{let a=e.currentTarget;if(!a)return;let r=BL(()=>{if(yn.has(a))return;Vg(a,"down");let o=BL(()=>{Vg(a,"up")}),n=()=>Vg(a,"cancel");a.addEventListener("keyup",o,t),a.addEventListener("blur",n,t)});a.addEventListener("keydown",r,t),a.addEventListener("blur",()=>a.removeEventListener("keydown",r),t)};function VL(e){return gn(e)&&!ni()}function jg(e,t,a={}){let[r,o,n]=hf(e,a),s=i=>{let l=i.currentTarget;if(!VL(i)||yn.has(l))return;yn.add(l);let u=t(i),d=(g,x)=>{window.removeEventListener("pointerup",c),window.removeEventListener("pointercancel",f),!(!VL(g)||!yn.has(l))&&(yn.delete(l),typeof u=="function"&&u(g,{success:x}))},c=g=>{d(g,a.useGlobalTarget||gf(l,g.target))},f=g=>{d(g,!1)};window.addEventListener("pointerup",c,o),window.addEventListener("pointercancel",f,o)};return r.forEach(i=>{!FL(i)&&i.getAttribute("tabindex")===null&&(i.tabIndex=0),(a.useGlobalTarget?window:i).addEventListener("pointerdown",s,o),i.addEventListener("focus",u=>UL(u,o),o)}),n}function qg(e){return e==="x"||e==="y"?ta[e]?null:(ta[e]=!0,()=>{ta[e]=!1}):ta.x||ta.y?null:(ta.x=ta.y=!0,()=>{ta.x=ta.y=!1})}var yf=new Set(["width","height","top","left","right","bottom",...qa]);var xf;function w_(){xf=void 0}var vt={now:()=>(xf===void 0&&vt.set(je.isProcessing||Us.useManualTiming?je.timestamp:performance.now()),xf),set:e=>{xf=e,queueMicrotask(w_)}};function si(e,t){e.indexOf(t)===-1&&e.push(t)}function ii(e,t){let a=e.indexOf(t);a>-1&&e.splice(a,1)}var mo=class{constructor(){this.subscriptions=[]}add(t){return si(this.subscriptions,t),()=>ii(this.subscriptions,t)}notify(t,a,r){let o=this.subscriptions.length;if(o)if(o===1)this.subscriptions[0](t,a,r);else for(let n=0;n<o;n++){let s=this.subscriptions[n];s&&s(t,a,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}};function vf(e,t){return t?e*(1e3/t):0}var qL=30,C_=e=>!isNaN(parseFloat(e)),zL={current:void 0},zg=class{constructor(t,a={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(r,o=!0)=>{let n=vt.now();this.updatedAt!==n&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),o&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(t),this.owner=a.owner}setCurrent(t){this.current=t,this.updatedAt=vt.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=C_(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,a){this.events[t]||(this.events[t]=new mo);let r=this.events[t].add(a);return t==="change"?()=>{r(),Z.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(let t in this.events)this.events[t].clear()}attach(t,a){this.passiveEffect=t,this.stopPassiveEffect=a}set(t,a=!0){!a||!this.passiveEffect?this.updateAndNotify(t,a):this.passiveEffect(t,this.updateAndNotify)}setWithVelocity(t,a,r){this.set(a),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-r}jump(t,a=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,a&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return zL.current&&zL.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){let t=vt.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>qL)return 0;let a=Math.min(this.updatedAt-this.prevUpdatedAt,qL);return vf(parseFloat(this.current)-parseFloat(this.prevFrameValue),a)}start(t){return this.stop(),new Promise(a=>{this.hasAnimated=!0,this.animation=t(a),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 Cr(e,t){return new zg(e,t)}function S_(e,t,a){e.hasValue(t)?e.getValue(t).set(a):e.addValue(t,Cr(a))}function HL(e,t){let a=uo(e,t),{transitionEnd:r={},transition:o={},...n}=a||{};n={...n,...r};for(let s in n){let i=hL(n[s]);S_(e,s,i)}}function $L(e){return!!(Se(e)&&e.add)}function hu(e,t){let a=e.getValue("willChange");if($L(a))return a.add(t)}function wf(e){return e.props[ef]}var Cf={current:!1};var WL=(e,t,a)=>(((1-3*a+3*t)*e+(3*a-6*t))*e+3*t)*e,L_=1e-7,I_=12;function b_(e,t,a,r,o){let n,s,i=0;do s=t+(a-t)/2,n=WL(s,r,o)-e,n>0?a=s:t=s;while(Math.abs(n)>L_&&++i<I_);return s}function ho(e,t,a,r){if(e===t&&a===r)return ge;let o=n=>b_(n,0,1,e,a);return n=>n===0||n===1?n:WL(o(n),t,r)}var Sf=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2;var Lf=e=>t=>1-e(1-t);var Hg=ho(.33,1.53,.69,.99),gu=Lf(Hg),If=Sf(gu);var bf=e=>(e*=2)<1?.5*gu(e):.5*(2-Math.pow(2,-10*(e-1)));var kf=e=>1-Math.sin(Math.acos(e)),Pf=Lf(kf),Tf=Sf(kf);var Af=e=>/^0[^.\s]+$/u.test(e);function GL(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||Af(e):!0}var go=e=>Math.round(e*1e5)/1e5;var li=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function KL(e){return e==null}var XL=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu;var ui=(e,t)=>a=>!!(typeof a=="string"&&XL.test(a)&&a.startsWith(e)||t&&!KL(a)&&Object.prototype.hasOwnProperty.call(a,t)),Rf=(e,t,a)=>r=>{if(typeof r!="string")return r;let[o,n,s,i]=r.match(li);return{[e]:parseFloat(o),[t]:parseFloat(n),[a]:parseFloat(s),alpha:i!==void 0?parseFloat(i):1}};var k_=e=>ct(0,255,e),$g={...za,transform:e=>Math.round(k_(e))},$a={test:ui("rgb","red"),parse:Rf("red","green","blue"),transform:({red:e,green:t,blue:a,alpha:r=1})=>"rgba("+$g.transform(e)+", "+$g.transform(t)+", "+$g.transform(a)+", "+go(wr.transform(r))+")"};function P_(e){let t="",a="",r="",o="";return e.length>5?(t=e.substring(1,3),a=e.substring(3,5),r=e.substring(5,7),o=e.substring(7,9)):(t=e.substring(1,2),a=e.substring(2,3),r=e.substring(3,4),o=e.substring(4,5),t+=t,a+=a,r+=r,o+=o),{red:parseInt(t,16),green:parseInt(a,16),blue:parseInt(r,16),alpha:o?parseInt(o,16)/255:1}}var yu={test:ui("#"),parse:P_,transform:$a.transform};var yo={test:ui("hsl","hue"),parse:Rf("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:a,alpha:r=1})=>"hsla("+Math.round(e)+", "+Tt.transform(go(t))+", "+Tt.transform(go(a))+", "+go(wr.transform(r))+")"};var $e={test:e=>$a.test(e)||yu.test(e)||yo.test(e),parse:e=>$a.test(e)?$a.parse(e):yo.test(e)?yo.parse(e):yu.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?$a.transform(e):yo.transform(e)};var QL=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function T_(e){var t,a;return isNaN(e)&&typeof e=="string"&&(((t=e.match(li))===null||t===void 0?void 0:t.length)||0)+(((a=e.match(QL))===null||a===void 0?void 0:a.length)||0)>0}var YL="number",ZL="color",A_="var",R_="var(",JL="${}",__=/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 xn(e){let t=e.toString(),a=[],r={color:[],number:[],var:[]},o=[],n=0,i=t.replace(__,l=>($e.test(l)?(r.color.push(n),o.push(ZL),a.push($e.parse(l))):l.startsWith(R_)?(r.var.push(n),o.push(A_),a.push(l)):(r.number.push(n),o.push(YL),a.push(parseFloat(l))),++n,JL)).split(JL);return{values:a,split:i,indexes:r,types:o}}function eI(e){return xn(e).values}function tI(e){let{split:t,types:a}=xn(e),r=t.length;return o=>{let n="";for(let s=0;s<r;s++)if(n+=t[s],o[s]!==void 0){let i=a[s];i===YL?n+=go(o[s]):i===ZL?n+=$e.transform(o[s]):n+=o[s]}return n}}var E_=e=>typeof e=="number"?0:e;function D_(e){let t=eI(e);return tI(e)(t.map(E_))}var At={test:T_,parse:eI,createTransformer:tI,getAnimatableNone:D_};var M_=new Set(["brightness","contrast","saturate","opacity"]);function N_(e){let[t,a]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;let[r]=a.match(li)||[];if(!r)return e;let o=a.replace(r,""),n=M_.has(t)?1:0;return r!==a&&(n*=100),t+"("+n+o+")"}var O_=/\b([a-z-]*)\(.*?\)/gu,xu={...At,getAnimatableNone:e=>{let t=e.match(O_);return t?t.map(N_).join(" "):e}};var F_={...Gs,color:$e,backgroundColor:$e,outlineColor:$e,fill:$e,stroke:$e,borderColor:$e,borderTopColor:$e,borderRightColor:$e,borderBottomColor:$e,borderLeftColor:$e,filter:xu,WebkitFilter:xu},di=e=>F_[e];function _f(e,t){let a=di(e);return a!==xu&&(a=At),a.getAnimatableNone?a.getAnimatableNone(t):void 0}var B_=new Set(["auto","none","0"]);function aI(e,t,a){let r=0,o;for(;r<e.length&&!o;){let n=e[r];typeof n=="string"&&!B_.has(n)&&xn(n).values.length&&(o=e[r]),r++}if(o&&a)for(let n of t)e[n]=_f(a,o)}var Wg=e=>e===za||e===z,rI=(e,t)=>parseFloat(e.split(", ")[t]),oI=(e,t)=>(a,{transform:r})=>{if(r==="none"||!r)return 0;let o=r.match(/^matrix3d\((.+)\)$/u);if(o)return rI(o[1],t);{let n=r.match(/^matrix\((.+)\)$/u);return n?rI(n[1],e):0}},U_=new Set(["x","y","z"]),V_=qa.filter(e=>!U_.has(e));function nI(e){let t=[];return V_.forEach(a=>{let r=e.getValue(a);r!==void 0&&(t.push([a,r.get()]),r.set(a.startsWith("scale")?1:0))}),t}var vn={width:({x:e},{paddingLeft:t="0",paddingRight:a="0"})=>e.max-e.min-parseFloat(t)-parseFloat(a),height:({y:e},{paddingTop:t="0",paddingBottom:a="0"})=>e.max-e.min-parseFloat(t)-parseFloat(a),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:oI(4,13),y:oI(5,14)};vn.translateX=vn.x;vn.translateY=vn.y;var wn=new Set,Gg=!1,Kg=!1;function sI(){if(Kg){let e=Array.from(wn).filter(r=>r.needsMeasurement),t=new Set(e.map(r=>r.element)),a=new Map;t.forEach(r=>{let o=nI(r);o.length&&(a.set(r,o),r.render())}),e.forEach(r=>r.measureInitialState()),t.forEach(r=>{r.render();let o=a.get(r);o&&o.forEach(([n,s])=>{var i;(i=r.getValue(n))===null||i===void 0||i.set(s)})}),e.forEach(r=>r.measureEndState()),e.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}Kg=!1,Gg=!1,wn.forEach(e=>e.complete()),wn.clear()}function iI(){wn.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Kg=!0)})}function lI(){iI(),sI()}var xo=class{constructor(t,a,r,o,n,s=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...t],this.onComplete=a,this.name=r,this.motionValue=o,this.element=n,this.isAsync=s}scheduleResolve(){this.isScheduled=!0,this.isAsync?(wn.add(this),Gg||(Gg=!0,Z.read(iI),Z.resolveKeyframes(sI))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:t,name:a,element:r,motionValue:o}=this;for(let n=0;n<t.length;n++)if(t[n]===null)if(n===0){let s=o?.get(),i=t[t.length-1];if(s!==void 0)t[0]=s;else if(r&&a){let l=r.readValue(a,i);l!=null&&(t[0]=l)}t[0]===void 0&&(t[0]=i),o&&s===void 0&&o.set(t[0])}else t[n]=t[n-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),wn.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,wn.delete(this))}resume(){this.isComplete||this.scheduleResolve()}};var Ef=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);var j_=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function q_(e){let t=j_.exec(e);if(!t)return[,];let[,a,r,o]=t;return[`--${a??r}`,o]}var z_=4;function Xg(e,t,a=1){Ta(a<=z_,`Max CSS variable fallback depth detected in property "${e}". This may indicate a circular fallback dependency.`);let[r,o]=q_(e);if(!r)return;let n=window.getComputedStyle(t).getPropertyValue(r);if(n){let s=n.trim();return Ef(s)?parseFloat(s):s}return Ws(o)?Xg(o,t,a+1):o}var Df=e=>t=>t.test(e);var uI={test:e=>e==="auto",parse:e=>e};var Qg=[za,z,Tt,Ha,xL,yL,uI],Jg=e=>Qg.find(Df(e));var ci=class extends xo{constructor(t,a,r,o,n){super(t,a,r,o,n,!0)}readKeyframes(){let{unresolvedKeyframes:t,element:a,name:r}=this;if(!a||!a.current)return;super.readKeyframes();for(let l=0;l<t.length;l++){let u=t[l];if(typeof u=="string"&&(u=u.trim(),Ws(u))){let d=Xg(u,a.current);d!==void 0&&(t[l]=d),l===t.length-1&&(this.finalKeyframe=u)}}if(this.resolveNoneKeyframes(),!yf.has(r)||t.length!==2)return;let[o,n]=t,s=Jg(o),i=Jg(n);if(s!==i)if(Wg(s)&&Wg(i))for(let l=0;l<t.length;l++){let u=t[l];typeof u=="string"&&(t[l]=parseFloat(u))}else this.needsMeasurement=!0}resolveNoneKeyframes(){let{unresolvedKeyframes:t,name:a}=this,r=[];for(let o=0;o<t.length;o++)GL(t[o])&&r.push(o);r.length&&aI(t,r,a)}measureInitialState(){let{element:t,unresolvedKeyframes:a,name:r}=this;if(!t||!t.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=vn[r](t.measureViewportBox(),window.getComputedStyle(t.current)),a[0]=this.measuredOrigin;let o=a[a.length-1];o!==void 0&&t.getValue(r,o).jump(o,!1)}measureEndState(){var t;let{element:a,name:r,unresolvedKeyframes:o}=this;if(!a||!a.current)return;let n=a.getValue(r);n&&n.jump(this.measuredOrigin,!1);let s=o.length-1,i=o[s];o[s]=vn[r](a.measureViewportBox(),window.getComputedStyle(a.current)),i!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=i),!((t=this.removedTransforms)===null||t===void 0)&&t.length&&this.removedTransforms.forEach(([l,u])=>{a.getValue(l).set(u)}),this.resolveNoneKeyframes()}};var Yg=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(At.test(e)||e==="0")&&!e.startsWith("url("));function H_(e){let t=e[0];if(e.length===1)return!0;for(let a=0;a<e.length;a++)if(e[a]!==t)return!0}function dI(e,t,a,r){let o=e[0];if(o===null)return!1;if(t==="display"||t==="visibility")return!0;let n=e[e.length-1],s=Yg(o,t),i=Yg(n,t);return gr(s===i,`You are trying to animate ${t} from "${o}" to "${n}". ${o} is not an animatable value - to enable this animation set ${o} to a value animatable to ${n} via the \`style\` property.`),!s||!i?!1:H_(e)||(a==="spring"||fo(a))&&r}var $_=e=>e!==null;function vo(e,{repeat:t,repeatType:a="loop"},r){let o=e.filter($_),n=t&&a!=="loop"&&t%2===1?0:o.length-1;return!n||r===void 0?o[n]:r}var W_=40,fi=class{constructor({autoplay:t=!0,delay:a=0,type:r="keyframes",repeat:o=0,repeatDelay:n=0,repeatType:s="loop",...i}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=vt.now(),this.options={autoplay:t,delay:a,type:r,repeat:o,repeatDelay:n,repeatType:s,...i},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>W_?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&lI(),this._resolved}onKeyframesResolved(t,a){this.resolvedAt=vt.now(),this.hasAttemptedResolve=!0;let{name:r,type:o,velocity:n,delay:s,onComplete:i,onUpdate:l,isGenerator:u}=this.options;if(!u&&!dI(t,r,o,n))if(Cf.current||!s){l&&l(vo(t,this.options,a)),i&&i(),this.resolveFinishedPromise();return}else this.options.duration=0;let d=this.initPlayback(t,a);d!==!1&&(this._resolved={keyframes:t,finalKeyframe:a,...d},this.onPostResolved())}onPostResolved(){}then(t,a){return this.currentFinishedPromise.then(t,a)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(t=>{this.resolveFinishedPromise=t})}};var ie=(e,t,a)=>e+(t-e)*a;function Zg(e,t,a){return a<0&&(a+=1),a>1&&(a-=1),a<1/6?e+(t-e)*6*a:a<1/2?t:a<2/3?e+(t-e)*(2/3-a)*6:e}function cI({hue:e,saturation:t,lightness:a,alpha:r}){e/=360,t/=100,a/=100;let o=0,n=0,s=0;if(!t)o=n=s=a;else{let i=a<.5?a*(1+t):a+t-a*t,l=2*a-i;o=Zg(l,i,e+1/3),n=Zg(l,i,e),s=Zg(l,i,e-1/3)}return{red:Math.round(o*255),green:Math.round(n*255),blue:Math.round(s*255),alpha:r}}function pi(e,t){return a=>a>0?t:e}var ey=(e,t,a)=>{let r=e*e,o=a*(t*t-r)+r;return o<0?0:Math.sqrt(o)},G_=[yu,$a,yo],K_=e=>G_.find(t=>t.test(e));function fI(e){let t=K_(e);if(gr(!!t,`'${e}' is not an animatable color. Use the equivalent color code instead.`),!t)return!1;let a=t.parse(e);return t===yo&&(a=cI(a)),a}var ty=(e,t)=>{let a=fI(e),r=fI(t);if(!a||!r)return pi(e,t);let o={...a};return n=>(o.red=ey(a.red,r.red,n),o.green=ey(a.green,r.green,n),o.blue=ey(a.blue,r.blue,n),o.alpha=ie(a.alpha,r.alpha,n),$a.transform(o))};var X_=(e,t)=>a=>t(e(a)),Wa=(...e)=>e.reduce(X_);var Mf=new Set(["none","hidden"]);function pI(e,t){return Mf.has(e)?a=>a<=0?e:t:a=>a>=1?t:e}function Q_(e,t){return a=>ie(e,t,a)}function Nf(e){return typeof e=="number"?Q_:typeof e=="string"?Ws(e)?pi:$e.test(e)?ty:Z_:Array.isArray(e)?mI:typeof e=="object"?$e.test(e)?ty:J_:pi}function mI(e,t){let a=[...e],r=a.length,o=e.map((n,s)=>Nf(n)(n,t[s]));return n=>{for(let s=0;s<r;s++)a[s]=o[s](n);return a}}function J_(e,t){let a={...e,...t},r={};for(let o in a)e[o]!==void 0&&t[o]!==void 0&&(r[o]=Nf(e[o])(e[o],t[o]));return o=>{for(let n in r)a[n]=r[n](o);return a}}function Y_(e,t){var a;let r=[],o={color:0,var:0,number:0};for(let n=0;n<t.values.length;n++){let s=t.types[n],i=e.indexes[s][o[s]],l=(a=e.values[i])!==null&&a!==void 0?a:0;r[n]=l,o[s]++}return r}var Z_=(e,t)=>{let a=At.createTransformer(t),r=xn(e),o=xn(t);return r.indexes.var.length===o.indexes.var.length&&r.indexes.color.length===o.indexes.color.length&&r.indexes.number.length>=o.indexes.number.length?Mf.has(e)&&!o.values.length||Mf.has(t)&&!r.values.length?pI(e,t):Wa(mI(Y_(r,o),o.values),a):(gr(!0,`Complex values '${e}' and '${t}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`),pi(e,t))};function Of(e,t,a){return typeof e=="number"&&typeof t=="number"&&typeof a=="number"?ie(e,t,a):Nf(e)(e,t)}var eE=5;function Ff(e,t,a){let r=Math.max(t-eE,0);return vf(a-e(r),t-r)}var Pe={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};var ay=.001;function hI({duration:e=Pe.duration,bounce:t=Pe.bounce,velocity:a=Pe.velocity,mass:r=Pe.mass}){let o,n;gr(e<=Ve(Pe.maxDuration),"Spring duration must be 10 seconds or less");let s=1-t;s=ct(Pe.minDamping,Pe.maxDamping,s),e=ct(Pe.minDuration,Pe.maxDuration,dt(e)),s<1?(o=u=>{let d=u*s,c=d*e,f=d-a,g=Bf(u,s),x=Math.exp(-c);return ay-f/g*x},n=u=>{let c=u*s*e,f=c*a+a,g=Math.pow(s,2)*Math.pow(u,2)*e,x=Math.exp(-c),w=Bf(Math.pow(u,2),s);return(-o(u)+ay>0?-1:1)*((f-g)*x)/w}):(o=u=>{let d=Math.exp(-u*e),c=(u-a)*e+1;return-ay+d*c},n=u=>{let d=Math.exp(-u*e),c=(a-u)*(e*e);return d*c});let i=5/e,l=aE(o,n,i);if(e=Ve(e),isNaN(l))return{stiffness:Pe.stiffness,damping:Pe.damping,duration:e};{let u=Math.pow(l,2)*r;return{stiffness:u,damping:s*2*Math.sqrt(r*u),duration:e}}}var tE=12;function aE(e,t,a){let r=a;for(let o=1;o<tE;o++)r=r-e(r)/t(r);return r}function Bf(e,t){return e*Math.sqrt(1-t*t)}var rE=["duration","bounce"],oE=["stiffness","damping","mass"];function gI(e,t){return t.some(a=>e[a]!==void 0)}function nE(e){let t={velocity:Pe.velocity,stiffness:Pe.stiffness,damping:Pe.damping,mass:Pe.mass,isResolvedFromDuration:!1,...e};if(!gI(e,oE)&&gI(e,rE))if(e.visualDuration){let a=e.visualDuration,r=2*Math.PI/(a*1.2),o=r*r,n=2*ct(.05,1,1-(e.bounce||0))*Math.sqrt(o);t={...t,mass:Pe.mass,stiffness:o,damping:n}}else{let a=hI(e);t={...t,...a,mass:Pe.mass},t.isResolvedFromDuration=!0}return t}function Uf(e=Pe.visualDuration,t=Pe.bounce){let a=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e,{restSpeed:r,restDelta:o}=a,n=a.keyframes[0],s=a.keyframes[a.keyframes.length-1],i={done:!1,value:n},{stiffness:l,damping:u,mass:d,duration:c,velocity:f,isResolvedFromDuration:g}=nE({...a,velocity:-dt(a.velocity||0)}),x=f||0,w=u/(2*Math.sqrt(l*d)),L=s-n,y=dt(Math.sqrt(l/d)),h=Math.abs(L)<5;r||(r=h?Pe.restSpeed.granular:Pe.restSpeed.default),o||(o=h?Pe.restDelta.granular:Pe.restDelta.default);let m;if(w<1){let I=Bf(y,w);m=P=>{let R=Math.exp(-w*y*P);return s-R*((x+w*y*L)/I*Math.sin(I*P)+L*Math.cos(I*P))}}else if(w===1)m=I=>s-Math.exp(-y*I)*(L+(x+y*L)*I);else{let I=y*Math.sqrt(w*w-1);m=P=>{let R=Math.exp(-w*y*P),A=Math.min(I*P,300);return s-R*((x+w*y*L)*Math.sinh(A)+I*L*Math.cosh(A))/I}}let S={calculatedDuration:g&&c||null,next:I=>{let P=m(I);if(g)i.done=I>=c;else{let R=0;w<1&&(R=I===0?Ve(x):Ff(m,I,P));let A=Math.abs(R)<=r,V=Math.abs(s-P)<=o;i.done=A&&V}return i.value=i.done?s:P,i},toString:()=>{let I=Math.min(ti(S),2e4),P=mu(R=>S.next(I*R).value,I,30);return I+"ms "+P}};return S}function ry({keyframes:e,velocity:t=0,power:a=.8,timeConstant:r=325,bounceDamping:o=10,bounceStiffness:n=500,modifyTarget:s,min:i,max:l,restDelta:u=.5,restSpeed:d}){let c=e[0],f={done:!1,value:c},g=A=>i!==void 0&&A<i||l!==void 0&&A>l,x=A=>i===void 0?l:l===void 0||Math.abs(i-A)<Math.abs(l-A)?i:l,w=a*t,L=c+w,y=s===void 0?L:s(L);y!==L&&(w=y-c);let h=A=>-w*Math.exp(-A/r),m=A=>y+h(A),S=A=>{let V=h(A),F=m(A);f.done=Math.abs(V)<=u,f.value=f.done?y:F},I,P,R=A=>{g(f.value)&&(I=A,P=Uf({keyframes:[f.value,x(f.value)],velocity:Ff(m,A,f.value),damping:o,stiffness:n,restDelta:u,restSpeed:d}))};return R(0),{calculatedDuration:null,next:A=>{let V=!1;return!P&&I===void 0&&(V=!0,S(A),R(A)),I!==void 0&&A>=I?P.next(A-I):(!V&&S(A),f)}}}var yI=ho(.42,0,1,1),xI=ho(0,0,.58,1),Vf=ho(.42,0,.58,1);var vI=e=>Array.isArray(e)&&typeof e[0]!="number";var wI={linear:ge,easeIn:yI,easeInOut:Vf,easeOut:xI,circIn:kf,circInOut:Tf,circOut:Pf,backIn:gu,backInOut:If,backOut:Hg,anticipate:bf},oy=e=>{if(ai(e)){Ta(e.length===4,"Cubic bezier arrays must contain four numerical values.");let[t,a,r,o]=e;return ho(t,a,r,o)}else if(typeof e=="string")return Ta(wI[e]!==void 0,`Invalid easing type '${e}'`),wI[e];return e};function sE(e,t,a){let r=[],o=a||Of,n=e.length-1;for(let s=0;s<n;s++){let i=o(e[s],e[s+1]);if(t){let l=Array.isArray(t)?t[s]||ge:t;i=Wa(l,i)}r.push(i)}return r}function CI(e,t,{clamp:a=!0,ease:r,mixer:o}={}){let n=e.length;if(Ta(n===t.length,"Both input and output ranges must be the same length"),n===1)return()=>t[0];if(n===2&&t[0]===t[1])return()=>t[1];let s=e[0]===e[1];e[0]>e[n-1]&&(e=[...e].reverse(),t=[...t].reverse());let i=sE(t,r,o),l=i.length,u=d=>{if(s&&d<e[0])return t[0];let c=0;if(l>1)for(;c<e.length-2&&!(d<e[c+1]);c++);let f=Zt(e[c],e[c+1],d);return i[c](f)};return a?d=>u(ct(e[0],e[n-1],d)):u}function SI(e,t){let a=e[e.length-1];for(let r=1;r<=t;r++){let o=Zt(0,t,r);e.push(ie(a,1,o))}}function LI(e){let t=[0];return SI(t,e.length-1),t}function II(e,t){return e.map(a=>a*t)}function iE(e,t){return e.map(()=>t||Vf).splice(0,e.length-1)}function vu({duration:e=300,keyframes:t,times:a,ease:r="easeInOut"}){let o=vI(r)?r.map(oy):oy(r),n={done:!1,value:t[0]},s=II(a&&a.length===t.length?a:LI(t),e),i=CI(s,t,{ease:Array.isArray(o)?o:iE(t,o)});return{calculatedDuration:e,next:l=>(n.value=i(l),n.done=l>=e,n)}}var bI=e=>{let t=({timestamp:a})=>e(a);return{start:()=>Z.update(t,!0),stop:()=>ea(t),now:()=>je.isProcessing?je.timestamp:vt.now()}};var lE={decay:ry,inertia:ry,tween:vu,keyframes:vu,spring:Uf},uE=e=>e/100,Cn=class extends fi{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();let{onStop:l}=this.options;l&&l()};let{name:a,motionValue:r,element:o,keyframes:n}=this.options,s=o?.KeyframeResolver||xo,i=(l,u)=>this.onKeyframesResolved(l,u);this.resolver=new s(n,i,a,r,o),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(t){let{type:a="keyframes",repeat:r=0,repeatDelay:o=0,repeatType:n,velocity:s=0}=this.options,i=fo(a)?a:lE[a]||vu,l,u;i!==vu&&typeof t[0]!="number"&&(l=Wa(uE,Of(t[0],t[1])),t=[0,100]);let d=i({...this.options,keyframes:t});n==="mirror"&&(u=i({...this.options,keyframes:[...t].reverse(),velocity:-s})),d.calculatedDuration===null&&(d.calculatedDuration=ti(d));let{calculatedDuration:c}=d,f=c+o,g=f*(r+1)-o;return{generator:d,mirroredGenerator:u,mapPercentToKeyframes:l,calculatedDuration:c,resolvedDuration:f,totalDuration:g}}onPostResolved(){let{autoplay:t=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!t?this.pause():this.state=this.pendingPlayState}tick(t,a=!1){let{resolved:r}=this;if(!r){let{keyframes:A}=this.options;return{done:!0,value:A[A.length-1]}}let{finalKeyframe:o,generator:n,mirroredGenerator:s,mapPercentToKeyframes:i,keyframes:l,calculatedDuration:u,totalDuration:d,resolvedDuration:c}=r;if(this.startTime===null)return n.next(0);let{delay:f,repeat:g,repeatType:x,repeatDelay:w,onUpdate:L}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-d/this.speed,this.startTime)),a?this.currentTime=t:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(t-this.startTime)*this.speed;let y=this.currentTime-f*(this.speed>=0?1:-1),h=this.speed>=0?y<0:y>d;this.currentTime=Math.max(y,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=d);let m=this.currentTime,S=n;if(g){let A=Math.min(this.currentTime,d)/c,V=Math.floor(A),F=A%1;!F&&A>=1&&(F=1),F===1&&V--,V=Math.min(V,g+1),V%2&&(x==="reverse"?(F=1-F,w&&(F-=w/c)):x==="mirror"&&(S=s)),m=ct(0,1,F)*c}let I=h?{done:!1,value:l[0]}:S.next(m);i&&(I.value=i(I.value));let{done:P}=I;!h&&u!==null&&(P=this.speed>=0?this.currentTime>=d:this.currentTime<=0);let R=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&P);return R&&o!==void 0&&(I.value=vo(l,this.options,o)),L&&L(I.value),R&&this.finish(),I}get duration(){let{resolved:t}=this;return t?dt(t.calculatedDuration):0}get time(){return dt(this.currentTime)}set time(t){t=Ve(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){let a=this.playbackSpeed!==t;this.playbackSpeed=t,a&&(this.time=dt(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;let{driver:t=bI,onPlay:a,startTime:r}=this.options;this.driver||(this.driver=t(n=>this.tick(n))),a&&a();let o=this.driver.now();this.holdTime!==null?this.startTime=o-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=o):this.startTime=r??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";let{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)}};var kI=new Set(["opacity","clipPath","filter","transform"]);function PI(e,t,a,{delay:r=0,duration:o=300,repeat:n=0,repeatType:s="loop",ease:i="easeInOut",times:l}={}){let u={[t]:a};l&&(u.offset=l);let d=oi(i,o);return Array.isArray(d)&&(u.easing=d),e.animate(u,{delay:r,duration:o,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:n+1,direction:s==="reverse"?"alternate":"normal"})}var TI=mn(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));var jf=10,dE=2e4;function cE(e){return fo(e.type)||e.type==="spring"||!mf(e.ease)}function fE(e,t){let a=new Cn({...t,keyframes:e,repeat:0,delay:0,isGenerator:!0}),r={done:!1,value:e[0]},o=[],n=0;for(;!r.done&&n<dE;)r=a.sample(n),o.push(r.value),n+=jf;return{times:void 0,keyframes:o,duration:n-jf,ease:"linear"}}var AI={anticipate:bf,backInOut:If,circInOut:Tf};function pE(e){return e in AI}var wu=class extends fi{constructor(t){super(t);let{name:a,motionValue:r,element:o,keyframes:n}=this.options;this.resolver=new ci(n,(s,i)=>this.onKeyframesResolved(s,i),a,r,o),this.resolver.scheduleResolve()}initPlayback(t,a){let{duration:r=300,times:o,ease:n,type:s,motionValue:i,name:l,startTime:u}=this.options;if(!i.owner||!i.owner.current)return!1;if(typeof n=="string"&&po()&&pE(n)&&(n=AI[n]),cE(this.options)){let{onComplete:c,onUpdate:f,motionValue:g,element:x,...w}=this.options,L=fE(t,w);t=L.keyframes,t.length===1&&(t[1]=t[0]),r=L.duration,o=L.times,n=L.ease,s="keyframes"}let d=PI(i.owner.current,l,t,{...this.options,duration:r,times:o,ease:n});return d.startTime=u??this.calcStartTime(),this.pendingTimeline?(pu(d,this.pendingTimeline),this.pendingTimeline=void 0):d.onfinish=()=>{let{onComplete:c}=this.options;i.set(vo(t,this.options,a)),c&&c(),this.cancel(),this.resolveFinishedPromise()},{animation:d,duration:r,times:o,type:s,ease:n,keyframes:t}}get duration(){let{resolved:t}=this;if(!t)return 0;let{duration:a}=t;return dt(a)}get time(){let{resolved:t}=this;if(!t)return 0;let{animation:a}=t;return dt(a.currentTime||0)}set time(t){let{resolved:a}=this;if(!a)return;let{animation:r}=a;r.currentTime=Ve(t)}get speed(){let{resolved:t}=this;if(!t)return 1;let{animation:a}=t;return a.playbackRate}set speed(t){let{resolved:a}=this;if(!a)return;let{animation:r}=a;r.playbackRate=t}get state(){let{resolved:t}=this;if(!t)return"idle";let{animation:a}=t;return a.playState}get startTime(){let{resolved:t}=this;if(!t)return null;let{animation:a}=t;return a.startTime}attachTimeline(t){if(!this._resolved)this.pendingTimeline=t;else{let{resolved:a}=this;if(!a)return ge;let{animation:r}=a;pu(r,t)}return ge}play(){if(this.isStopped)return;let{resolved:t}=this;if(!t)return;let{animation:a}=t;a.playState==="finished"&&this.updateFinishedPromise(),a.play()}pause(){let{resolved:t}=this;if(!t)return;let{animation:a}=t;a.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();let{resolved:t}=this;if(!t)return;let{animation:a,keyframes:r,duration:o,type:n,ease:s,times:i}=t;if(a.playState==="idle"||a.playState==="finished")return;if(this.time){let{motionValue:u,onUpdate:d,onComplete:c,element:f,...g}=this.options,x=new Cn({...g,keyframes:r,duration:o,type:n,ease:s,times:i,isGenerator:!0}),w=Ve(this.time);u.setWithVelocity(x.sample(w-jf).value,x.sample(w).value,jf)}let{onStop:l}=this.options;l&&l(),this.cancel()}complete(){let{resolved:t}=this;t&&t.animation.finish()}cancel(){let{resolved:t}=this;t&&t.animation.cancel()}static supports(t){let{motionValue:a,name:r,repeatDelay:o,repeatType:n,damping:s,type:i}=t;if(!a||!a.owner||!(a.owner.current instanceof HTMLElement))return!1;let{onUpdate:l,transformTemplate:u}=a.owner.getProps();return TI()&&r&&kI.has(r)&&!l&&!u&&!o&&n!=="mirror"&&s!==0&&i!=="inertia"}};var mE={type:"spring",stiffness:500,damping:25,restSpeed:10},hE=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),gE={type:"keyframes",duration:.8},yE={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},RI=(e,{keyframes:t})=>t.length>2?gE:Vt.has(e)?e.startsWith("scale")?hE(t[1]):mE:yE;function _I({when:e,delay:t,delayChildren:a,staggerChildren:r,staggerDirection:o,repeat:n,repeatType:s,repeatDelay:i,from:l,elapsed:u,...d}){return!!Object.keys(d).length}var mi=(e,t,a,r={},o,n)=>s=>{let i=co(r,e)||{},l=i.delay||r.delay||0,{elapsed:u=0}=r;u=u-Ve(l);let d={keyframes:Array.isArray(a)?a:[null,a],ease:"easeOut",velocity:t.getVelocity(),...i,delay:-u,onUpdate:f=>{t.set(f),i.onUpdate&&i.onUpdate(f)},onComplete:()=>{s(),i.onComplete&&i.onComplete()},name:e,motionValue:t,element:n?void 0:o};_I(i)||(d={...d,...RI(e,d)}),d.duration&&(d.duration=Ve(d.duration)),d.repeatDelay&&(d.repeatDelay=Ve(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let c=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(d.duration=0,d.delay===0&&(c=!0)),(Cf.current||Us.skipAnimations)&&(c=!0,d.duration=0,d.delay=0),c&&!n&&t.get()!==void 0){let f=vo(d.keyframes,i);if(f!==void 0)return Z.update(()=>{d.onUpdate(f),d.onComplete()}),new fu([])}return!n&&wu.supports(d)?new wu(d):new Cn(d)};function xE({protectedKeys:e,needsAnimating:t},a){let r=e.hasOwnProperty(a)&&t[a]!==!0;return t[a]=!1,r}function qf(e,t,{delay:a=0,transitionOverride:r,type:o}={}){var n;let{transition:s=e.getDefaultTransition(),transitionEnd:i,...l}=t;r&&(s=r);let u=[],d=o&&e.animationState&&e.animationState.getState()[o];for(let c in l){let f=e.getValue(c,(n=e.latestValues[c])!==null&&n!==void 0?n:null),g=l[c];if(g===void 0||d&&xE(d,c))continue;let x={delay:a,...co(s||{},c)},w=!1;if(window.MotionHandoffAnimation){let y=wf(e);if(y){let h=window.MotionHandoffAnimation(y,c,Z);h!==null&&(x.startTime=h,w=!0)}}hu(e,c),f.start(mi(c,f,g,e.shouldReduceMotion&&yf.has(c)?{type:!1}:x,e,w));let L=f.animation;L&&u.push(L)}return i&&Promise.all(u).then(()=>{Z.update(()=>{i&&HL(e,i)})}),u}function zf(e,t,a={}){var r;let o=uo(e,t,a.type==="exit"?(r=e.presenceContext)===null||r===void 0?void 0:r.custom:void 0),{transition:n=e.getDefaultTransition()||{}}=o||{};a.transitionOverride&&(n=a.transitionOverride);let s=o?()=>Promise.all(qf(e,o,a)):()=>Promise.resolve(),i=e.variantChildren&&e.variantChildren.size?(u=0)=>{let{delayChildren:d=0,staggerChildren:c,staggerDirection:f}=n;return vE(e,t,d+u,c,f,a)}:()=>Promise.resolve(),{when:l}=n;if(l){let[u,d]=l==="beforeChildren"?[s,i]:[i,s];return u().then(()=>d())}else return Promise.all([s(),i(a.delay)])}function vE(e,t,a=0,r=0,o=1,n){let s=[],i=(e.variantChildren.size-1)*r,l=o===1?(u=0)=>u*r:(u=0)=>i-u*r;return Array.from(e.variantChildren).sort(wE).forEach((u,d)=>{u.notify("AnimationStart",t),s.push(zf(u,t,{...n,delay:a+l(d)}).then(()=>u.notify("AnimationComplete",t)))}),Promise.all(s)}function wE(e,t){return e.sortNodePosition(t)}function EI(e,t,a={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){let o=t.map(n=>zf(e,n,a));r=Promise.all(o)}else if(typeof t=="string")r=zf(e,t,a);else{let o=typeof t=="function"?uo(e,t,a.custom):t;r=Promise.all(qf(e,o,a))}return r.then(()=>{e.notify("AnimationComplete",t)})}var CE=iu.length;function ny(e){if(!e)return;if(!e.isControllingVariants){let a=e.parent?ny(e.parent)||{}:{};return e.props.initial!==void 0&&(a.initial=e.props.initial),a}let t={};for(let a=0;a<CE;a++){let r=iu[a],o=e.props[r];(xr(o)||o===!1)&&(t[r]=o)}return t}var SE=[...Jc].reverse(),LE=Jc.length;function IE(e){return t=>Promise.all(t.map(({animation:a,options:r})=>EI(e,a,r)))}function MI(e){let t=IE(e),a=DI(),r=!0,o=l=>(u,d)=>{var c;let f=uo(e,d,l==="exit"?(c=e.presenceContext)===null||c===void 0?void 0:c.custom:void 0);if(f){let{transition:g,transitionEnd:x,...w}=f;u={...u,...w,...x}}return u};function n(l){t=l(e)}function s(l){let{props:u}=e,d=ny(e.parent)||{},c=[],f=new Set,g={},x=1/0;for(let L=0;L<LE;L++){let y=SE[L],h=a[y],m=u[y]!==void 0?u[y]:d[y],S=xr(m),I=y===l?h.isActive:null;I===!1&&(x=L);let P=m===d[y]&&m!==u[y]&&S;if(P&&r&&e.manuallyAnimateOnMount&&(P=!1),h.protectedKeys={...g},!h.isActive&&I===null||!m&&!h.prevProp||lo(m)||typeof m=="boolean")continue;let R=bE(h.prevProp,m),A=R||y===l&&h.isActive&&!P&&S||L>x&&S,V=!1,F=Array.isArray(m)?m:[m],me=F.reduce(o(y),{});I===!1&&(me={});let{prevResolvedValues:ae={}}=h,Be={...ae,...me},Aa=Me=>{A=!0,f.has(Me)&&(V=!0,f.delete(Me)),h.needsAnimating[Me]=!0;let xe=e.getValue(Me);xe&&(xe.liveStyle=!1)};for(let Me in Be){let xe=me[Me],ot=ae[Me];if(g.hasOwnProperty(Me))continue;let oa=!1;lu(xe)&&lu(ot)?oa=!Mg(xe,ot):oa=xe!==ot,oa?xe!=null?Aa(Me):f.add(Me):xe!==void 0&&f.has(Me)?Aa(Me):h.protectedKeys[Me]=!0}h.prevProp=m,h.prevResolvedValues=me,h.isActive&&(g={...g,...me}),r&&e.blockInitialAnimation&&(A=!1),A&&(!(P&&R)||V)&&c.push(...F.map(Me=>({animation:Me,options:{type:y}})))}if(f.size){let L={};f.forEach(y=>{let h=e.getBaseTarget(y),m=e.getValue(y);m&&(m.liveStyle=!0),L[y]=h??null}),c.push({animation:L})}let w=!!c.length;return r&&(u.initial===!1||u.initial===u.animate)&&!e.manuallyAnimateOnMount&&(w=!1),r=!1,w?t(c):Promise.resolve()}function i(l,u){var d;if(a[l].isActive===u)return Promise.resolve();(d=e.variantChildren)===null||d===void 0||d.forEach(f=>{var g;return(g=f.animationState)===null||g===void 0?void 0:g.setActive(l,u)}),a[l].isActive=u;let c=s(l);for(let f in a)a[f].protectedKeys={};return c}return{animateChanges:s,setActive:i,setAnimateFunction:n,getState:()=>a,reset:()=>{a=DI(),r=!0}}}function bE(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!Mg(t,e):!1}function Sn(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function DI(){return{animate:Sn(!0),whileInView:Sn(),whileHover:Sn(),whileTap:Sn(),whileDrag:Sn(),whileFocus:Sn(),exit:Sn()}}var rt=class{constructor(t){this.isMounted=!1,this.node=t}update(){}};var Hf=class extends rt{constructor(t){super(t),t.animationState||(t.animationState=MI(t))}updateAnimationControlsSubscription(){let{animate:t}=this.node.getProps();lo(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){let{animate:t}=this.node.getProps(),{animate:a}=this.node.prevProps||{};t!==a&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),(t=this.unmountControls)===null||t===void 0||t.call(this)}};var kE=0,$f=class extends rt{constructor(){super(...arguments),this.id=kE++}update(){if(!this.node.presenceContext)return;let{isPresent:t,onExitComplete:a}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===r)return;let o=this.node.animationState.setActive("exit",!t);a&&!t&&o.then(()=>a(this.id))}mount(){let{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}};var NI={animation:{Feature:Hf},exit:{Feature:$f}};function Sr(e,t,a,r={passive:!0}){return e.addEventListener(t,a,r),()=>e.removeEventListener(t,a)}function Lr(e){return{point:{x:e.pageX,y:e.pageY}}}var OI=e=>t=>gn(t)&&e(t,Lr(t));function wo(e,t,a,r){return Sr(e,t,OI(a),r)}var FI=(e,t)=>Math.abs(e-t);function BI(e,t){let a=FI(e.x,t.x),r=FI(e.y,t.y);return Math.sqrt(a**2+r**2)}var hi=class{constructor(t,a,{transformPagePoint:r,contextWindow:o,dragSnapToOrigin:n=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let c=iy(this.lastMoveEventInfo,this.history),f=this.startEvent!==null,g=BI(c.offset,{x:0,y:0})>=3;if(!f&&!g)return;let{point:x}=c,{timestamp:w}=je;this.history.push({...x,timestamp:w});let{onStart:L,onMove:y}=this.handlers;f||(L&&L(this.lastMoveEvent,c),this.startEvent=this.lastMoveEvent),y&&y(this.lastMoveEvent,c)},this.handlePointerMove=(c,f)=>{this.lastMoveEvent=c,this.lastMoveEventInfo=sy(f,this.transformPagePoint),Z.update(this.updatePoint,!0)},this.handlePointerUp=(c,f)=>{this.end();let{onEnd:g,onSessionEnd:x,resumeAnimation:w}=this.handlers;if(this.dragSnapToOrigin&&w&&w(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let L=iy(c.type==="pointercancel"?this.lastMoveEventInfo:sy(f,this.transformPagePoint),this.history);this.startEvent&&g&&g(c,L),x&&x(c,L)},!gn(t))return;this.dragSnapToOrigin=n,this.handlers=a,this.transformPagePoint=r,this.contextWindow=o||window;let s=Lr(t),i=sy(s,this.transformPagePoint),{point:l}=i,{timestamp:u}=je;this.history=[{...l,timestamp:u}];let{onSessionStart:d}=a;d&&d(t,iy(i,this.history)),this.removeListeners=Wa(wo(this.contextWindow,"pointermove",this.handlePointerMove),wo(this.contextWindow,"pointerup",this.handlePointerUp),wo(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),ea(this.updatePoint)}};function sy(e,t){return t?{point:t(e.point)}:e}function UI(e,t){return{x:e.x-t.x,y:e.y-t.y}}function iy({point:e},t){return{point:e,delta:UI(e,VI(t)),offset:UI(e,PE(t)),velocity:TE(t,.1)}}function PE(e){return e[0]}function VI(e){return e[e.length-1]}function TE(e,t){if(e.length<2)return{x:0,y:0};let a=e.length-1,r=null,o=VI(e);for(;a>=0&&(r=e[a],!(o.timestamp-r.timestamp>Ve(t)));)a--;if(!r)return{x:0,y:0};let n=dt(o.timestamp-r.timestamp);if(n===0)return{x:0,y:0};let s={x:(o.x-r.x)/n,y:(o.y-r.y)/n};return s.x===1/0&&(s.x=0),s.y===1/0&&(s.y=0),s}var HI=1e-4,AE=1-HI,RE=1+HI,$I=.01,_E=0-$I,EE=0+$I;function ft(e){return e.max-e.min}function WI(e,t,a){return Math.abs(e-t)<=a}function jI(e,t,a,r=.5){e.origin=r,e.originPoint=ie(t.min,t.max,e.origin),e.scale=ft(a)/ft(t),e.translate=ie(a.min,a.max,e.origin)-e.originPoint,(e.scale>=AE&&e.scale<=RE||isNaN(e.scale))&&(e.scale=1),(e.translate>=_E&&e.translate<=EE||isNaN(e.translate))&&(e.translate=0)}function gi(e,t,a,r){jI(e.x,t.x,a.x,r?r.originX:void 0),jI(e.y,t.y,a.y,r?r.originY:void 0)}function qI(e,t,a){e.min=a.min+t.min,e.max=e.min+ft(t)}function GI(e,t,a){qI(e.x,t.x,a.x),qI(e.y,t.y,a.y)}function zI(e,t,a){e.min=t.min-a.min,e.max=e.min+ft(t)}function yi(e,t,a){zI(e.x,t.x,a.x),zI(e.y,t.y,a.y)}function YI(e,{min:t,max:a},r){return t!==void 0&&e<t?e=r?ie(t,e,r.min):Math.max(e,t):a!==void 0&&e>a&&(e=r?ie(a,e,r.max):Math.min(e,a)),e}function KI(e,t,a){return{min:t!==void 0?e.min+t:void 0,max:a!==void 0?e.max+a-(e.max-e.min):void 0}}function ZI(e,{top:t,left:a,bottom:r,right:o}){return{x:KI(e.x,a,o),y:KI(e.y,t,r)}}function XI(e,t){let a=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([a,r]=[r,a]),{min:a,max:r}}function eb(e,t){return{x:XI(e.x,t.x),y:XI(e.y,t.y)}}function tb(e,t){let a=.5,r=ft(e),o=ft(t);return o>r?a=Zt(t.min,t.max-r,e.min):r>o&&(a=Zt(e.min,e.max-o,t.min)),ct(0,1,a)}function ab(e,t){let a={};return t.min!==void 0&&(a.min=t.min-e.min),t.max!==void 0&&(a.max=t.max-e.min),a}var Wf=.35;function rb(e=Wf){return e===!1?e=0:e===!0&&(e=Wf),{x:QI(e,"left","right"),y:QI(e,"top","bottom")}}function QI(e,t,a){return{min:JI(e,t),max:JI(e,a)}}function JI(e,t){return typeof e=="number"?e:e[t]||0}var ob=()=>({translate:0,scale:1,origin:0,originPoint:0}),Ln=()=>({x:ob(),y:ob()}),nb=()=>({min:0,max:0}),Te=()=>({x:nb(),y:nb()});function jt(e){return[e("x"),e("y")]}function Gf({top:e,left:t,right:a,bottom:r}){return{x:{min:t,max:a},y:{min:e,max:r}}}function sb({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function ib(e,t){if(!t)return e;let a=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:a.y,left:a.x,bottom:r.y,right:r.x}}function ly(e){return e===void 0||e===1}function Kf({scale:e,scaleX:t,scaleY:a}){return!ly(e)||!ly(t)||!ly(a)}function Ir(e){return Kf(e)||uy(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function uy(e){return lb(e.x)||lb(e.y)}function lb(e){return e&&e!=="0%"}function Cu(e,t,a){let r=e-a,o=t*r;return a+o}function ub(e,t,a,r,o){return o!==void 0&&(e=Cu(e,o,r)),Cu(e,a,r)+t}function dy(e,t=0,a=1,r,o){e.min=ub(e.min,t,a,r,o),e.max=ub(e.max,t,a,r,o)}function cy(e,{x:t,y:a}){dy(e.x,t.translate,t.scale,t.originPoint),dy(e.y,a.translate,a.scale,a.originPoint)}var db=.999999999999,cb=1.0000000000001;function pb(e,t,a,r=!1){let o=a.length;if(!o)return;t.x=t.y=1;let n,s;for(let i=0;i<o;i++){n=a[i],s=n.projectionDelta;let{visualElement:l}=n.options;l&&l.props.style&&l.props.style.display==="contents"||(r&&n.options.layoutScroll&&n.scroll&&n!==n.root&&In(e,{x:-n.scroll.offset.x,y:-n.scroll.offset.y}),s&&(t.x*=s.x.scale,t.y*=s.y.scale,cy(e,s)),r&&Ir(n.latestValues)&&In(e,n.latestValues))}t.x<cb&&t.x>db&&(t.x=1),t.y<cb&&t.y>db&&(t.y=1)}function Co(e,t){e.min=e.min+t,e.max=e.max+t}function fb(e,t,a,r,o=.5){let n=ie(e.min,e.max,o);dy(e,t,a,n,r)}function In(e,t){fb(e.x,t.x,t.scaleX,t.scale,t.originX),fb(e.y,t.y,t.scaleY,t.scale,t.originY)}function fy(e,t){return Gf(ib(e.getBoundingClientRect(),t))}function mb(e,t,a){let r=fy(e,a),{scroll:o}=t;return o&&(Co(r.x,o.offset.x),Co(r.y,o.offset.y)),r}var Xf=({current:e})=>e?e.ownerDocument.defaultView:null;var DE=new WeakMap,Jf=class{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=Te(),this.visualElement=t}start(t,{snapToCursor:a=!1}={}){let{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;let o=d=>{let{dragSnapToOrigin:c}=this.getProps();c?this.pauseAnimation():this.stopAnimation(),a&&this.snapToCursor(Lr(d).point)},n=(d,c)=>{let{drag:f,dragPropagation:g,onDragStart:x}=this.getProps();if(f&&!g&&(this.openDragLock&&this.openDragLock(),this.openDragLock=qg(f),!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),jt(L=>{let y=this.getAxisMotionValue(L).get()||0;if(Tt.test(y)){let{projection:h}=this.visualElement;if(h&&h.layout){let m=h.layout.layoutBox[L];m&&(y=ft(m)*(parseFloat(y)/100))}}this.originPoint[L]=y}),x&&Z.postRender(()=>x(d,c)),hu(this.visualElement,"transform");let{animationState:w}=this.visualElement;w&&w.setActive("whileDrag",!0)},s=(d,c)=>{let{dragPropagation:f,dragDirectionLock:g,onDirectionLock:x,onDrag:w}=this.getProps();if(!f&&!this.openDragLock)return;let{offset:L}=c;if(g&&this.currentDirection===null){this.currentDirection=ME(L),this.currentDirection!==null&&x&&x(this.currentDirection);return}this.updateAxis("x",c.point,L),this.updateAxis("y",c.point,L),this.visualElement.render(),w&&w(d,c)},i=(d,c)=>this.stop(d,c),l=()=>jt(d=>{var c;return this.getAnimationState(d)==="paused"&&((c=this.getAxisMotionValue(d).animation)===null||c===void 0?void 0:c.play())}),{dragSnapToOrigin:u}=this.getProps();this.panSession=new hi(t,{onSessionStart:o,onStart:n,onMove:s,onSessionEnd:i,resumeAnimation:l},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,contextWindow:Xf(this.visualElement)})}stop(t,a){let r=this.isDragging;if(this.cancel(),!r)return;let{velocity:o}=a;this.startAnimation(o);let{onDragEnd:n}=this.getProps();n&&Z.postRender(()=>n(t,a))}cancel(){this.isDragging=!1;let{projection:t,animationState:a}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;let{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),a&&a.setActive("whileDrag",!1)}updateAxis(t,a,r){let{drag:o}=this.getProps();if(!r||!Qf(t,o,this.currentDirection))return;let n=this.getAxisMotionValue(t),s=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(s=YI(s,this.constraints[t],this.elastic[t])),n.set(s)}resolveConstraints(){var t;let{dragConstraints:a,dragElastic:r}=this.getProps(),o=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(t=this.visualElement.projection)===null||t===void 0?void 0:t.layout,n=this.constraints;a&&vr(a)?this.constraints||(this.constraints=this.resolveRefConstraints()):a&&o?this.constraints=ZI(o.layoutBox,a):this.constraints=!1,this.elastic=rb(r),n!==this.constraints&&o&&this.constraints&&!this.hasMutatedConstraints&&jt(s=>{this.constraints!==!1&&this.getAxisMotionValue(s)&&(this.constraints[s]=ab(o.layoutBox[s],this.constraints[s]))})}resolveRefConstraints(){let{dragConstraints:t,onMeasureDragConstraints:a}=this.getProps();if(!t||!vr(t))return!1;let r=t.current;Ta(r!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.");let{projection:o}=this.visualElement;if(!o||!o.layout)return!1;let n=mb(r,o.root,this.visualElement.getTransformPagePoint()),s=eb(o.layout.layoutBox,n);if(a){let i=a(sb(s));this.hasMutatedConstraints=!!i,i&&(s=Gf(i))}return s}startAnimation(t){let{drag:a,dragMomentum:r,dragElastic:o,dragTransition:n,dragSnapToOrigin:s,onDragTransitionEnd:i}=this.getProps(),l=this.constraints||{},u=jt(d=>{if(!Qf(d,a,this.currentDirection))return;let c=l&&l[d]||{};s&&(c={min:0,max:0});let f=o?200:1e6,g=o?40:1e7,x={type:"inertia",velocity:r?t[d]:0,bounceStiffness:f,bounceDamping:g,timeConstant:750,restDelta:1,restSpeed:10,...n,...c};return this.startAxisValueAnimation(d,x)});return Promise.all(u).then(i)}startAxisValueAnimation(t,a){let r=this.getAxisMotionValue(t);return hu(this.visualElement,t),r.start(mi(t,r,0,a,this.visualElement,!1))}stopAnimation(){jt(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){jt(t=>{var a;return(a=this.getAxisMotionValue(t).animation)===null||a===void 0?void 0:a.pause()})}getAnimationState(t){var a;return(a=this.getAxisMotionValue(t).animation)===null||a===void 0?void 0:a.state}getAxisMotionValue(t){let a=`_drag${t.toUpperCase()}`,r=this.visualElement.getProps(),o=r[a];return o||this.visualElement.getValue(t,(r.initial?r.initial[t]:void 0)||0)}snapToCursor(t){jt(a=>{let{drag:r}=this.getProps();if(!Qf(a,r,this.currentDirection))return;let{projection:o}=this.visualElement,n=this.getAxisMotionValue(a);if(o&&o.layout){let{min:s,max:i}=o.layout.layoutBox[a];n.set(t[a]-ie(s,i,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;let{drag:t,dragConstraints:a}=this.getProps(),{projection:r}=this.visualElement;if(!vr(a)||!r||!this.constraints)return;this.stopAnimation();let o={x:0,y:0};jt(s=>{let i=this.getAxisMotionValue(s);if(i&&this.constraints!==!1){let l=i.get();o[s]=tb({min:l,max:l},this.constraints[s])}});let{transformTemplate:n}=this.visualElement.getProps();this.visualElement.current.style.transform=n?n({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),jt(s=>{if(!Qf(s,t,null))return;let i=this.getAxisMotionValue(s),{min:l,max:u}=this.constraints[s];i.set(ie(l,u,o[s]))})}addListeners(){if(!this.visualElement.current)return;DE.set(this.visualElement,this);let t=this.visualElement.current,a=wo(t,"pointerdown",l=>{let{drag:u,dragListener:d=!0}=this.getProps();u&&d&&this.start(l)}),r=()=>{let{dragConstraints:l}=this.getProps();vr(l)&&l.current&&(this.constraints=this.resolveRefConstraints())},{projection:o}=this.visualElement,n=o.addEventListener("measure",r);o&&!o.layout&&(o.root&&o.root.updateScroll(),o.updateLayout()),Z.read(r);let s=Sr(window,"resize",()=>this.scalePositionWithinConstraints()),i=o.addEventListener("didUpdate",(({delta:l,hasLayoutChanged:u})=>{this.isDragging&&u&&(jt(d=>{let c=this.getAxisMotionValue(d);c&&(this.originPoint[d]+=l[d].translate,c.set(c.get()+l[d].translate))}),this.visualElement.render())}));return()=>{s(),a(),n(),i&&i()}}getProps(){let t=this.visualElement.getProps(),{drag:a=!1,dragDirectionLock:r=!1,dragPropagation:o=!1,dragConstraints:n=!1,dragElastic:s=Wf,dragMomentum:i=!0}=t;return{...t,drag:a,dragDirectionLock:r,dragPropagation:o,dragConstraints:n,dragElastic:s,dragMomentum:i}}};function Qf(e,t,a){return(t===!0||t===e)&&(a===null||a===e)}function ME(e,t=10){let a=null;return Math.abs(e.y)>t?a="y":Math.abs(e.x)>t&&(a="x"),a}var Yf=class extends rt{constructor(t){super(t),this.removeGroupControls=ge,this.removeListeners=ge,this.controls=new Jf(t)}mount(){let{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||ge}unmount(){this.removeGroupControls(),this.removeListeners()}};var hb=e=>(t,a)=>{e&&Z.postRender(()=>e(t,a))},Zf=class extends rt{constructor(){super(...arguments),this.removePointerDownListener=ge}onPointerDown(t){this.session=new hi(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Xf(this.node)})}createPanHandlers(){let{onPanSessionStart:t,onPanStart:a,onPan:r,onPanEnd:o}=this.node.getProps();return{onSessionStart:hb(t),onStart:hb(a),onMove:r,onEnd:(n,s)=>{delete this.session,o&&Z.postRender(()=>o(n,s))}}}mount(){this.removePointerDownListener=wo(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}};var xb=N(le(),1),Su=N(W(),1);var xi={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function gb(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}var vi={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(z.test(e))e=parseFloat(e);else return e;let a=gb(e,t.target.x),r=gb(e,t.target.y);return`${a}% ${r}%`}};var yb={correct:(e,{treeScale:t,projectionDelta:a})=>{let r=e,o=At.parse(e);if(o.length>5)return r;let n=At.createTransformer(e),s=typeof o[0]!="number"?1:0,i=a.x.scale*t.x,l=a.y.scale*t.y;o[0+s]/=i,o[1+s]/=l;let u=ie(i,l,.5);return typeof o[2+s]=="number"&&(o[2+s]/=u),typeof o[3+s]=="number"&&(o[3+s]/=u),n(o)}};var py=class extends Su.Component{componentDidMount(){let{visualElement:t,layoutGroup:a,switchLayoutGroup:r,layoutId:o}=this.props,{projection:n}=t;bL(NE),n&&(a.group&&a.group.add(n),r&&r.register&&o&&r.register(n),n.root.didUpdate(),n.addEventListener("animationComplete",()=>{this.safeToRemove()}),n.setOptions({...n.options,onExitComplete:()=>this.safeToRemove()})),xi.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){let{layoutDependency:a,visualElement:r,drag:o,isPresent:n}=this.props,s=r.projection;return s&&(s.isPresent=n,o||t.layoutDependency!==a||a===void 0?s.willUpdate():this.safeToRemove(),t.isPresent!==n&&(n?s.promote():s.relegate()||Z.postRender(()=>{let i=s.getStack();(!i||!i.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){let{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),js.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){let{visualElement:t,layoutGroup:a,switchLayoutGroup:r}=this.props,{projection:o}=t;o&&(o.scheduleCheckAfterUnmount(),a&&a.group&&a.group.remove(o),r&&r.deregister&&r.deregister(o))}safeToRemove(){let{safeToRemove:t}=this.props;t&&t()}render(){return null}};function ep(e){let[t,a]=zc(),r=(0,Su.useContext)(Ns);return(0,xb.jsx)(py,{...e,layoutGroup:r,switchLayoutGroup:(0,Su.useContext)(tf),isPresent:t,safeToRemove:a})}var NE={borderRadius:{...vi,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:vi,borderTopRightRadius:vi,borderBottomLeftRadius:vi,borderBottomRightRadius:vi,boxShadow:yb};function vb(e,t,a){let r=Se(e)?e:Cr(e);return r.start(mi("",r,t,a)),r.animation}function wb(e){return e instanceof SVGElement&&e.tagName!=="svg"}var Cb=(e,t)=>e.depth-t.depth;var tp=class{constructor(){this.children=[],this.isDirty=!1}add(t){si(this.children,t),this.isDirty=!0}remove(t){ii(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(Cb),this.isDirty=!1,this.children.forEach(t)}};function Sb(e,t){let a=vt.now(),r=({timestamp:o})=>{let n=o-a;n>=t&&(ea(r),e(n-t))};return Z.read(r,!0),()=>ea(r)}var kb=["TopLeft","TopRight","BottomLeft","BottomRight"],OE=kb.length,Lb=e=>typeof e=="string"?parseFloat(e):e,Ib=e=>typeof e=="number"||z.test(e);function Pb(e,t,a,r,o,n){o?(e.opacity=ie(0,a.opacity!==void 0?a.opacity:1,FE(r)),e.opacityExit=ie(t.opacity!==void 0?t.opacity:1,0,BE(r))):n&&(e.opacity=ie(t.opacity!==void 0?t.opacity:1,a.opacity!==void 0?a.opacity:1,r));for(let s=0;s<OE;s++){let i=`border${kb[s]}Radius`,l=bb(t,i),u=bb(a,i);if(l===void 0&&u===void 0)continue;l||(l=0),u||(u=0),l===0||u===0||Ib(l)===Ib(u)?(e[i]=Math.max(ie(Lb(l),Lb(u),r),0),(Tt.test(u)||Tt.test(l))&&(e[i]+="%")):e[i]=u}(t.rotate||a.rotate)&&(e.rotate=ie(t.rotate||0,a.rotate||0,r))}function bb(e,t){return e[t]!==void 0?e[t]:e.borderRadius}var FE=Tb(0,.5,Pf),BE=Tb(.5,.95,ge);function Tb(e,t,a){return r=>r<e?0:r>t?1:a(Zt(e,t,r))}function Ab(e,t){e.min=t.min,e.max=t.max}function aa(e,t){Ab(e.x,t.x),Ab(e.y,t.y)}function my(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function Rb(e,t,a,r,o){return e-=t,e=Cu(e,1/a,r),o!==void 0&&(e=Cu(e,1/o,r)),e}function UE(e,t=0,a=1,r=.5,o,n=e,s=e){if(Tt.test(t)&&(t=parseFloat(t),t=ie(s.min,s.max,t/100)-s.min),typeof t!="number")return;let i=ie(n.min,n.max,r);e===n&&(i-=t),e.min=Rb(e.min,t,a,i,o),e.max=Rb(e.max,t,a,i,o)}function _b(e,t,[a,r,o],n,s){UE(e,t[a],t[r],t[o],t.scale,n,s)}var VE=["x","scaleX","originX"],jE=["y","scaleY","originY"];function hy(e,t,a,r){_b(e.x,t,VE,a?a.x:void 0,r?r.x:void 0),_b(e.y,t,jE,a?a.y:void 0,r?r.y:void 0)}function Eb(e){return e.translate===0&&e.scale===1}function gy(e){return Eb(e.x)&&Eb(e.y)}function Db(e,t){return e.min===t.min&&e.max===t.max}function Nb(e,t){return Db(e.x,t.x)&&Db(e.y,t.y)}function Mb(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function yy(e,t){return Mb(e.x,t.x)&&Mb(e.y,t.y)}function xy(e){return ft(e.x)/ft(e.y)}function vy(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}var ap=class{constructor(){this.members=[]}add(t){si(this.members,t),t.scheduleRender()}remove(t){if(ii(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){let a=this.members[this.members.length-1];a&&this.promote(a)}}relegate(t){let a=this.members.findIndex(o=>t===o);if(a===0)return!1;let r;for(let o=a;o>=0;o--){let n=this.members[o];if(n.isPresent!==!1){r=n;break}}return r?(this.promote(r),!0):!1}promote(t,a){let r=this.lead;if(t!==r&&(this.prevLead=r,this.lead=t,t.show(),r)){r.instance&&r.scheduleRender(),t.scheduleRender(),t.resumeFrom=r,a&&(t.resumeFrom.preserveOpacity=!0),r.snapshot&&(t.snapshot=r.snapshot,t.snapshot.latestValues=r.animationValues||r.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);let{crossfade:o}=t.options;o===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(t=>{let{options:a,resumingFrom:r}=t;a.onExitComplete&&a.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}};function Ob(e,t,a){let r="",o=e.x.translate/t.x,n=e.y.translate/t.y,s=a?.z||0;if((o||n||s)&&(r=`translate3d(${o}px, ${n}px, ${s}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),a){let{transformPerspective:u,rotate:d,rotateX:c,rotateY:f,skewX:g,skewY:x}=a;u&&(r=`perspective(${u}px) ${r}`),d&&(r+=`rotate(${d}deg) `),c&&(r+=`rotateX(${c}deg) `),f&&(r+=`rotateY(${f}deg) `),g&&(r+=`skewX(${g}deg) `),x&&(r+=`skewY(${x}deg) `)}let i=e.x.scale*t.x,l=e.y.scale*t.y;return(i!==1||l!==1)&&(r+=`scale(${i}, ${l})`),r||"none"}var bn={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},Lu=typeof window<"u"&&window.MotionDebug!==void 0,wy=["","X","Y","Z"],qE={visibility:"hidden"},Fb=1e3,zE=0;function Cy(e,t,a,r){let{latestValues:o}=t;o[e]&&(a[e]=o[e],t.setStaticValue(e,0),r&&(r[e]=0))}function $b(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;let{visualElement:t}=e.options;if(!t)return;let a=wf(t);if(window.MotionHasOptimisedAnimation(a,"transform")){let{layout:o,layoutId:n}=e.options;window.MotionCancelOptimisedAnimation(a,"transform",Z,!(o||n))}let{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&$b(r)}function rp({attachResizeListener:e,defaultParent:t,measureScroll:a,checkIsScrollRoot:r,resetTransform:o}){return class{constructor(s={},i=t?.()){this.id=zE++,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,Lu&&(bn.totalNodes=bn.resolvedTargetDeltas=bn.recalculatedProjection=0),this.nodes.forEach(WE),this.nodes.forEach(JE),this.nodes.forEach(YE),this.nodes.forEach(GE),Lu&&window.MotionDebug.record(bn)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=s,this.root=i?i.root||i:this,this.path=i?[...i.path,i]:[],this.parent=i,this.depth=i?i.depth+1:0;for(let l=0;l<this.path.length;l++)this.path[l].shouldResetTransform=!0;this.root===this&&(this.nodes=new tp)}addEventListener(s,i){return this.eventHandlers.has(s)||this.eventHandlers.set(s,new mo),this.eventHandlers.get(s).add(i)}notifyListeners(s,...i){let l=this.eventHandlers.get(s);l&&l.notify(...i)}hasListeners(s){return this.eventHandlers.has(s)}mount(s,i=this.root.hasTreeAnimated){if(this.instance)return;this.isSVG=wb(s),this.instance=s;let{layoutId:l,layout:u,visualElement:d}=this.options;if(d&&!d.current&&d.mount(s),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),i&&(u||l)&&(this.isLayoutDirty=!0),e){let c,f=()=>this.root.updateBlockedByResize=!1;e(s,()=>{this.root.updateBlockedByResize=!0,c&&c(),c=Sb(f,250),xi.hasAnimatedSinceResize&&(xi.hasAnimatedSinceResize=!1,this.nodes.forEach(Ub))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&d&&(l||u)&&this.addEventListener("didUpdate",({delta:c,hasLayoutChanged:f,hasRelativeTargetChanged:g,layout:x})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}let w=this.options.transition||d.getDefaultTransition()||rD,{onLayoutAnimationStart:L,onLayoutAnimationComplete:y}=d.getProps(),h=!this.targetLayout||!yy(this.targetLayout,x)||g,m=!f&&g;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||m||f&&(h||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(c,m);let S={...co(w,"layout"),onPlay:L,onComplete:y};(d.shouldReduceMotion||this.options.layoutRoot)&&(S.delay=0,S.type=!1),this.startAnimation(S)}else f||Ub(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=x})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);let s=this.getStack();s&&s.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,ea(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(ZE),this.animationId++)}getTransformTemplate(){let{visualElement:s}=this.options;return s&&s.getProps().transformTemplate}willUpdate(s=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&$b(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d<this.path.length;d++){let c=this.path[d];c.shouldResetTransform=!0,c.updateScroll("snapshot"),c.options.layoutRoot&&c.willUpdate(!1)}let{layoutId:i,layout:l}=this.options;if(i===void 0&&!l)return;let u=this.getTransformTemplate();this.prevTransformTemplateValue=u?u(this.latestValues,""):void 0,this.updateSnapshot(),s&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(Bb);return}this.isUpdating||this.nodes.forEach(XE),this.isUpdating=!1,this.nodes.forEach(QE),this.nodes.forEach(HE),this.nodes.forEach($E),this.clearAllSnapshots();let i=vt.now();je.delta=ct(0,1e3/60,i-je.timestamp),je.timestamp=i,je.isProcessing=!0,Xc.update.process(je),Xc.preRender.process(je),Xc.render.process(je),je.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,js.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(KE),this.sharedNodes.forEach(eD)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Z.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Z.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 l=0;l<this.path.length;l++)this.path[l].updateScroll();let s=this.layout;this.layout=this.measure(!1),this.layoutCorrected=Te(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);let{visualElement:i}=this.options;i&&i.notify("LayoutMeasure",this.layout.layoutBox,s?s.layoutBox:void 0)}updateScroll(s="measure"){let i=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===s&&(i=!1),i){let l=r(this.instance);this.scroll={animationId:this.root.animationId,phase:s,isRoot:l,offset:a(this.instance),wasRoot:this.scroll?this.scroll.isRoot:l}}}resetTransform(){if(!o)return;let s=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,i=this.projectionDelta&&!gy(this.projectionDelta),l=this.getTransformTemplate(),u=l?l(this.latestValues,""):void 0,d=u!==this.prevTransformTemplateValue;s&&(i||Ir(this.latestValues)||d)&&(o(this.instance,u),this.shouldResetTransform=!1,this.scheduleRender())}measure(s=!0){let i=this.measurePageBox(),l=this.removeElementScroll(i);return s&&(l=this.removeTransform(l)),oD(l),{animationId:this.root.animationId,measuredBox:i,layoutBox:l,latestValues:{},source:this.id}}measurePageBox(){var s;let{visualElement:i}=this.options;if(!i)return Te();let l=i.measureViewportBox();if(!(((s=this.scroll)===null||s===void 0?void 0:s.wasRoot)||this.path.some(nD))){let{scroll:d}=this.root;d&&(Co(l.x,d.offset.x),Co(l.y,d.offset.y))}return l}removeElementScroll(s){var i;let l=Te();if(aa(l,s),!((i=this.scroll)===null||i===void 0)&&i.wasRoot)return l;for(let u=0;u<this.path.length;u++){let d=this.path[u],{scroll:c,options:f}=d;d!==this.root&&c&&f.layoutScroll&&(c.wasRoot&&aa(l,s),Co(l.x,c.offset.x),Co(l.y,c.offset.y))}return l}applyTransform(s,i=!1){let l=Te();aa(l,s);for(let u=0;u<this.path.length;u++){let d=this.path[u];!i&&d.options.layoutScroll&&d.scroll&&d!==d.root&&In(l,{x:-d.scroll.offset.x,y:-d.scroll.offset.y}),Ir(d.latestValues)&&In(l,d.latestValues)}return Ir(this.latestValues)&&In(l,this.latestValues),l}removeTransform(s){let i=Te();aa(i,s);for(let l=0;l<this.path.length;l++){let u=this.path[l];if(!u.instance||!Ir(u.latestValues))continue;Kf(u.latestValues)&&u.updateSnapshot();let d=Te(),c=u.measurePageBox();aa(d,c),hy(i,u.latestValues,u.snapshot?u.snapshot.layoutBox:void 0,d)}return Ir(this.latestValues)&&hy(i,this.latestValues),i}setTargetDelta(s){this.targetDelta=s,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(s){this.options={...this.options,...s,crossfade:s.crossfade!==void 0?s.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!==je.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(s=!1){var i;let l=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=l.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=l.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=l.isSharedProjectionDirty);let u=!!this.resumingFrom||this!==l;if(!(s||u&&this.isSharedProjectionDirty||this.isProjectionDirty||!((i=this.parent)===null||i===void 0)&&i.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;let{layout:c,layoutId:f}=this.options;if(!(!this.layout||!(c||f))){if(this.resolvedRelativeTargetAt=je.timestamp,!this.targetDelta&&!this.relativeTarget){let g=this.getClosestProjectingParent();g&&g.layout&&this.animationProgress!==1?(this.relativeParent=g,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Te(),this.relativeTargetOrigin=Te(),yi(this.relativeTargetOrigin,this.layout.layoutBox,g.layout.layoutBox),aa(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)){if(this.target||(this.target=Te(),this.targetWithTransforms=Te()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),GI(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):aa(this.target,this.layout.layoutBox),cy(this.target,this.targetDelta)):aa(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;let g=this.getClosestProjectingParent();g&&!!g.resumingFrom==!!this.resumingFrom&&!g.options.layoutScroll&&g.target&&this.animationProgress!==1?(this.relativeParent=g,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Te(),this.relativeTargetOrigin=Te(),yi(this.relativeTargetOrigin,this.target,g.target),aa(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}Lu&&bn.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||Kf(this.parent.latestValues)||uy(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 s;let i=this.getLead(),l=!!this.resumingFrom||this!==i,u=!0;if((this.isProjectionDirty||!((s=this.parent)===null||s===void 0)&&s.isProjectionDirty)&&(u=!1),l&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(u=!1),this.resolvedRelativeTargetAt===je.timestamp&&(u=!1),u)return;let{layout:d,layoutId:c}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(d||c))return;aa(this.layoutCorrected,this.layout.layoutBox);let f=this.treeScale.x,g=this.treeScale.y;pb(this.layoutCorrected,this.treeScale,this.path,l),i.layout&&!i.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(i.target=i.layout.layoutBox,i.targetWithTransforms=Te());let{target:x}=i;if(!x){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(my(this.prevProjectionDelta.x,this.projectionDelta.x),my(this.prevProjectionDelta.y,this.projectionDelta.y)),gi(this.projectionDelta,this.layoutCorrected,x,this.latestValues),(this.treeScale.x!==f||this.treeScale.y!==g||!vy(this.projectionDelta.x,this.prevProjectionDelta.x)||!vy(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",x)),Lu&&bn.recalculatedProjection++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(s=!0){var i;if((i=this.options.visualElement)===null||i===void 0||i.scheduleRender(),s){let l=this.getStack();l&&l.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Ln(),this.projectionDelta=Ln(),this.projectionDeltaWithTransform=Ln()}setAnimationOrigin(s,i=!1){let l=this.snapshot,u=l?l.latestValues:{},d={...this.latestValues},c=Ln();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!i;let f=Te(),g=l?l.source:void 0,x=this.layout?this.layout.source:void 0,w=g!==x,L=this.getStack(),y=!L||L.members.length<=1,h=!!(w&&!y&&this.options.crossfade===!0&&!this.path.some(aD));this.animationProgress=0;let m;this.mixTargetDelta=S=>{let I=S/1e3;Vb(c.x,s.x,I),Vb(c.y,s.y,I),this.setTargetDelta(c),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(yi(f,this.layout.layoutBox,this.relativeParent.layout.layoutBox),tD(this.relativeTarget,this.relativeTargetOrigin,f,I),m&&Nb(this.relativeTarget,m)&&(this.isProjectionDirty=!1),m||(m=Te()),aa(m,this.relativeTarget)),w&&(this.animationValues=d,Pb(d,u,this.latestValues,I,h,y)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=I},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(s){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(ea(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Z.update(()=>{xi.hasAnimatedSinceResize=!0,this.currentAnimation=vb(0,Fb,{...s,onUpdate:i=>{this.mixTargetDelta(i),s.onUpdate&&s.onUpdate(i)},onComplete:()=>{s.onComplete&&s.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);let s=this.getStack();s&&s.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(Fb),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){let s=this.getLead(),{targetWithTransforms:i,target:l,layout:u,latestValues:d}=s;if(!(!i||!l||!u)){if(this!==s&&this.layout&&u&&Wb(this.options.animationType,this.layout.layoutBox,u.layoutBox)){l=this.target||Te();let c=ft(this.layout.layoutBox.x);l.x.min=s.target.x.min,l.x.max=l.x.min+c;let f=ft(this.layout.layoutBox.y);l.y.min=s.target.y.min,l.y.max=l.y.min+f}aa(i,l),In(i,d),gi(this.projectionDeltaWithTransform,this.layoutCorrected,i,d)}}registerSharedNode(s,i){this.sharedNodes.has(s)||this.sharedNodes.set(s,new ap),this.sharedNodes.get(s).add(i);let u=i.options.initialPromotionConfig;i.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(i):void 0})}isLead(){let s=this.getStack();return s?s.lead===this:!0}getLead(){var s;let{layoutId:i}=this.options;return i?((s=this.getStack())===null||s===void 0?void 0:s.lead)||this:this}getPrevLead(){var s;let{layoutId:i}=this.options;return i?(s=this.getStack())===null||s===void 0?void 0:s.prevLead:void 0}getStack(){let{layoutId:s}=this.options;if(s)return this.root.sharedNodes.get(s)}promote({needsReset:s,transition:i,preserveFollowOpacity:l}={}){let u=this.getStack();u&&u.promote(this,l),s&&(this.projectionDelta=void 0,this.needsReset=!0),i&&this.setOptions({transition:i})}relegate(){let s=this.getStack();return s?s.relegate(this):!1}resetSkewAndRotation(){let{visualElement:s}=this.options;if(!s)return;let i=!1,{latestValues:l}=s;if((l.z||l.rotate||l.rotateX||l.rotateY||l.rotateZ||l.skewX||l.skewY)&&(i=!0),!i)return;let u={};l.z&&Cy("z",s,u,this.animationValues);for(let d=0;d<wy.length;d++)Cy(`rotate${wy[d]}`,s,u,this.animationValues),Cy(`skew${wy[d]}`,s,u,this.animationValues);s.render();for(let d in u)s.setStaticValue(d,u[d]),this.animationValues&&(this.animationValues[d]=u[d]);s.scheduleRender()}getProjectionStyles(s){var i,l;if(!this.instance||this.isSVG)return;if(!this.isVisible)return qE;let u={visibility:""},d=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,u.opacity="",u.pointerEvents=$s(s?.pointerEvents)||"",u.transform=d?d(this.latestValues,""):"none",u;let c=this.getLead();if(!this.projectionDelta||!this.layout||!c.target){let w={};return this.options.layoutId&&(w.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,w.pointerEvents=$s(s?.pointerEvents)||""),this.hasProjected&&!Ir(this.latestValues)&&(w.transform=d?d({},""):"none",this.hasProjected=!1),w}let f=c.animationValues||c.latestValues;this.applyTransformsToTarget(),u.transform=Ob(this.projectionDeltaWithTransform,this.treeScale,f),d&&(u.transform=d(f,u.transform));let{x:g,y:x}=this.projectionDelta;u.transformOrigin=`${g.origin*100}% ${x.origin*100}% 0`,c.animationValues?u.opacity=c===this?(l=(i=f.opacity)!==null&&i!==void 0?i:this.latestValues.opacity)!==null&&l!==void 0?l:1:this.preserveOpacity?this.latestValues.opacity:f.opacityExit:u.opacity=c===this?f.opacity!==void 0?f.opacity:"":f.opacityExit!==void 0?f.opacityExit:0;for(let w in Ys){if(f[w]===void 0)continue;let{correct:L,applyTo:y}=Ys[w],h=u.transform==="none"?f[w]:L(f[w],c);if(y){let m=y.length;for(let S=0;S<m;S++)u[y[S]]=h}else u[w]=h}return this.options.layoutId&&(u.pointerEvents=c===this?$s(s?.pointerEvents)||"":"none"),u}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(s=>{var i;return(i=s.currentAnimation)===null||i===void 0?void 0:i.stop()}),this.root.nodes.forEach(Bb),this.root.sharedNodes.clear()}}}function HE(e){e.updateLayout()}function $E(e){var t;let a=((t=e.resumeFrom)===null||t===void 0?void 0:t.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&a&&e.hasListeners("didUpdate")){let{layoutBox:r,measuredBox:o}=e.layout,{animationType:n}=e.options,s=a.source!==e.layout.source;n==="size"?jt(c=>{let f=s?a.measuredBox[c]:a.layoutBox[c],g=ft(f);f.min=r[c].min,f.max=f.min+g}):Wb(n,a.layoutBox,r)&&jt(c=>{let f=s?a.measuredBox[c]:a.layoutBox[c],g=ft(r[c]);f.max=f.min+g,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[c].max=e.relativeTarget[c].min+g)});let i=Ln();gi(i,r,a.layoutBox);let l=Ln();s?gi(l,e.applyTransform(o,!0),a.measuredBox):gi(l,r,a.layoutBox);let u=!gy(i),d=!1;if(!e.resumeFrom){let c=e.getClosestProjectingParent();if(c&&!c.resumeFrom){let{snapshot:f,layout:g}=c;if(f&&g){let x=Te();yi(x,a.layoutBox,f.layoutBox);let w=Te();yi(w,r,g.layoutBox),yy(x,w)||(d=!0),c.options.layoutRoot&&(e.relativeTarget=w,e.relativeTargetOrigin=x,e.relativeParent=c)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:a,delta:l,layoutDelta:i,hasLayoutChanged:u,hasRelativeTargetChanged:d})}else if(e.isLead()){let{onExitComplete:r}=e.options;r&&r()}e.options.transition=void 0}function WE(e){Lu&&bn.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 GE(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function KE(e){e.clearSnapshot()}function Bb(e){e.clearMeasurements()}function XE(e){e.isLayoutDirty=!1}function QE(e){let{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function Ub(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function JE(e){e.resolveTargetDelta()}function YE(e){e.calcProjection()}function ZE(e){e.resetSkewAndRotation()}function eD(e){e.removeLeadSnapshot()}function Vb(e,t,a){e.translate=ie(t.translate,0,a),e.scale=ie(t.scale,1,a),e.origin=t.origin,e.originPoint=t.originPoint}function jb(e,t,a,r){e.min=ie(t.min,a.min,r),e.max=ie(t.max,a.max,r)}function tD(e,t,a,r){jb(e.x,t.x,a.x,r),jb(e.y,t.y,a.y,r)}function aD(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}var rD={duration:.45,ease:[.4,0,.1,1]},qb=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),zb=qb("applewebkit/")&&!qb("chrome/")?Math.round:ge;function Hb(e){e.min=zb(e.min),e.max=zb(e.max)}function oD(e){Hb(e.x),Hb(e.y)}function Wb(e,t,a){return e==="position"||e==="preserve-aspect"&&!WI(xy(t),xy(a),.2)}function nD(e){var t;return e!==e.root&&((t=e.scroll)===null||t===void 0?void 0:t.wasRoot)}var Gb=rp({attachResizeListener:(e,t)=>Sr(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0});var Sy={current:void 0},op=rp({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Sy.current){let e=new Gb({});e.mount(window),e.setOptions({layoutScroll:!0}),Sy.current=e}return Sy.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"});var Kb={pan:{Feature:Zf},drag:{Feature:Yf,ProjectionNode:op,MeasureLayout:ep}};function Xb(e,t,a){let{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive("whileHover",a==="Start");let o="onHover"+a,n=r[o];n&&Z.postRender(()=>n(t,Lr(t)))}var np=class extends rt{mount(){let{current:t}=this.node;t&&(this.unmount=Ug(t,a=>(Xb(this.node,a,"Start"),r=>Xb(this.node,r,"End"))))}unmount(){}};var sp=class extends rt{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=Wa(Sr(this.node.current,"focus",()=>this.onFocus()),Sr(this.node.current,"blur",()=>this.onBlur()))}unmount(){}};function Qb(e,t,a){let{props:r}=e;e.animationState&&r.whileTap&&e.animationState.setActive("whileTap",a==="Start");let o="onTap"+(a==="End"?"":a),n=r[o];n&&Z.postRender(()=>n(t,Lr(t)))}var ip=class extends rt{mount(){let{current:t}=this.node;t&&(this.unmount=jg(t,a=>(Qb(this.node,a,"Start"),(r,{success:o})=>Qb(this.node,r,o?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}};var Iy=new WeakMap,Ly=new WeakMap,sD=e=>{let t=Iy.get(e.target);t&&t(e)},iD=e=>{e.forEach(sD)};function lD({root:e,...t}){let a=e||document;Ly.has(a)||Ly.set(a,{});let r=Ly.get(a),o=JSON.stringify(t);return r[o]||(r[o]=new IntersectionObserver(iD,{root:e,...t})),r[o]}function Jb(e,t,a){let r=lD(t);return Iy.set(e,a),r.observe(e),()=>{Iy.delete(e),r.unobserve(e)}}var uD={some:0,all:1},lp=class extends rt{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();let{viewport:t={}}=this.node.getProps(),{root:a,margin:r,amount:o="some",once:n}=t,s={root:a?a.current:void 0,rootMargin:r,threshold:typeof o=="number"?o:uD[o]},i=l=>{let{isIntersecting:u}=l;if(this.isInView===u||(this.isInView=u,n&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);let{onViewportEnter:d,onViewportLeave:c}=this.node.getProps(),f=u?d:c;f&&f(l)};return Jb(this.node.current,s,i)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;let{props:t,prevProps:a}=this.node;["amount","margin","root"].some(dD(t,a))&&this.startObserver()}unmount(){}};function dD({viewport:e={}},{viewport:t={}}={}){return a=>e[a]!==t[a]}var Yb={inView:{Feature:lp},tap:{Feature:ip},focus:{Feature:sp},hover:{Feature:np}};var Zb={layout:{ProjectionNode:op,MeasureLayout:ep}};var ok=N(W(),1);var Iu={current:null},up={current:!1};function ek(){if(up.current=!0,!!Bs)if(window.matchMedia){let e=window.matchMedia("(prefers-reduced-motion)"),t=()=>Iu.current=e.matches;e.addListener(t),t()}else Iu.current=!1}var cD=[...Qg,$e,At],tk=e=>cD.find(Df(e));var by=new WeakMap;function ak(e,t,a){for(let r in t){let o=t[r],n=a[r];if(Se(o))e.addValue(r,o);else if(Se(n))e.addValue(r,Cr(o,{owner:e}));else if(n!==o)if(e.hasValue(r)){let s=e.getValue(r);s.liveStyle===!0?s.jump(o):s.hasAnimated||s.set(o)}else{let s=e.getStaticValue(r);e.addValue(r,Cr(s!==void 0?s:o,{owner:e}))}}for(let r in a)t[r]===void 0&&e.removeValue(r);return t}var rk=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],dp=class{scrapeMotionValuesFromProps(t,a,r){return{}}constructor({parent:t,props:a,presenceContext:r,reducedMotionConfig:o,blockInitialAnimation:n,visualState:s},i={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=xo,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=()=>{let g=vt.now();this.renderScheduledAt<g&&(this.renderScheduledAt=g,Z.render(this.render,!1,!0))};let{latestValues:l,renderState:u,onUpdate:d}=s;this.onUpdate=d,this.latestValues=l,this.baseTarget={...l},this.initialValues=a.initial?{...l}:{},this.renderState=u,this.parent=t,this.props=a,this.presenceContext=r,this.depth=t?t.depth+1:0,this.reducedMotionConfig=o,this.options=i,this.blockInitialAnimation=!!n,this.isControllingVariants=hn(a),this.isVariantNode=Yc(a),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);let{willChange:c,...f}=this.scrapeMotionValuesFromProps(a,{},this);for(let g in f){let x=f[g];l[g]!==void 0&&Se(x)&&x.set(l[g],!1)}}mount(t){this.current=t,by.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((a,r)=>this.bindToMotionValue(r,a)),up.current||ek(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:Iu.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){by.delete(this.current),this.projection&&this.projection.unmount(),ea(this.notifyUpdate),ea(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(let t in this.events)this.events[t].clear();for(let t in this.features){let a=this.features[t];a&&(a.unmount(),a.isMounted=!1)}this.current=null}bindToMotionValue(t,a){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();let r=Vt.has(t),o=a.on("change",i=>{this.latestValues[t]=i,this.props.onUpdate&&Z.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0)}),n=a.on("renderRequest",this.scheduleRender),s;window.MotionCheckAppearSync&&(s=window.MotionCheckAppearSync(this,t,a)),this.valueSubscriptions.set(t,()=>{o(),n(),s&&s(),a.owner&&a.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 yr){let a=yr[t];if(!a)continue;let{isEnabled:r,Feature:o}=a;if(!this.features[t]&&o&&r(this.props)&&(this.features[t]=new o(this)),this.features[t]){let n=this.features[t];n.isMounted?n.update():(n.mount(),n.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Te()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,a){this.latestValues[t]=a}update(t,a){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=a;for(let r=0;r<rk.length;r++){let o=rk[r];this.propEventSubscriptions[o]&&(this.propEventSubscriptions[o](),delete this.propEventSubscriptions[o]);let n="on"+o,s=t[n];s&&(this.propEventSubscriptions[o]=this.on(o,s))}this.prevMotionValues=ak(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){let a=this.getClosestVariantNode();if(a)return a.variantChildren&&a.variantChildren.add(t),()=>a.variantChildren.delete(t)}addValue(t,a){let r=this.values.get(t);a!==r&&(r&&this.removeValue(t),this.bindToMotionValue(t,a),this.values.set(t,a),this.latestValues[t]=a.get())}removeValue(t){this.values.delete(t);let a=this.valueSubscriptions.get(t);a&&(a(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,a){if(this.props.values&&this.props.values[t])return this.props.values[t];let r=this.values.get(t);return r===void 0&&a!==void 0&&(r=Cr(a===null?void 0:a,{owner:this}),this.addValue(t,r)),r}readValue(t,a){var r;let o=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:(r=this.getBaseTargetFromProps(this.props,t))!==null&&r!==void 0?r:this.readValueFromInstance(this.current,t,this.options);return o!=null&&(typeof o=="string"&&(Ef(o)||Af(o))?o=parseFloat(o):!tk(o)&&At.test(a)&&(o=_f(t,a)),this.setBaseTarget(t,Se(o)?o.get():o)),Se(o)?o.get():o}setBaseTarget(t,a){this.baseTarget[t]=a}getBaseTarget(t){var a;let{initial:r}=this.props,o;if(typeof r=="string"||typeof r=="object"){let s=Hs(this.props,r,(a=this.presenceContext)===null||a===void 0?void 0:a.custom);s&&(o=s[t])}if(r&&o!==void 0)return o;let n=this.getBaseTargetFromProps(this.props,t);return n!==void 0&&!Se(n)?n:this.initialValues[t]!==void 0&&o===void 0?void 0:this.baseTarget[t]}on(t,a){return this.events[t]||(this.events[t]=new mo),this.events[t].add(a)}notify(t,...a){this.events[t]&&this.events[t].notify(...a)}};var wi=class extends dp{constructor(){super(...arguments),this.KeyframeResolver=ci}sortInstanceNodePosition(t,a){return t.compareDocumentPosition(a)&2?1:-1}getBaseTargetFromProps(t,a){return t.style?t.style[a]:void 0}removeValueFromRenderState(t,{vars:a,style:r}){delete a[t],delete r[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);let{children:t}=this.props;Se(t)&&(this.childSubscription=t.on("change",a=>{this.current&&(this.current.textContent=`${a}`)}))}};function fD(e){return window.getComputedStyle(e)}var cp=class extends wi{constructor(){super(...arguments),this.type="html",this.renderInstance=lf}readValueFromInstance(t,a){if(Vt.has(a)){let r=di(a);return r&&r.default||0}else{let r=fD(t),o=(of(a)?r.getPropertyValue(a):r[a])||0;return typeof o=="string"?o.trim():o}}measureInstanceViewportBox(t,{transformPagePoint:a}){return fy(t,a)}build(t,a,r){Ks(t,a,r.transformTemplate)}scrapeMotionValuesFromProps(t,a,r){return Zs(t,a,r)}};var fp=class extends wi{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Te}getBaseTargetFromProps(t,a){return t[a]}readValueFromInstance(t,a){if(Vt.has(a)){let r=di(a);return r&&r.default||0}return a=uf.has(a)?a:Vs(a),t.getAttribute(a)}scrapeMotionValuesFromProps(t,a,r){return ff(t,a,r)}build(t,a,r){Xs(t,a,this.isSVGTag,r.transformTemplate)}renderInstance(t,a,r,o){df(t,a,r,o)}mount(t){this.isSVGTag=Js(t.tagName),super.mount(t)}};var nk=(e,t)=>zs(e)?new fp(t):new cp(t,{allowProjection:e!==ok.Fragment});var sk=ML({...NI,...Yb,...Kb,...Zb},nk);var ky=eL(sk);var bu=N(le(),1);function ik({x:e,y:t,visible:a,onClick:r=!1}){return(0,bu.jsx)(Ag,{children:a&&(0,bu.jsx)(ky.div,{className:"fixed pointer-events-none z-[9999]",initial:{opacity:0,scale:.5},animate:{opacity:1,scale:1,x:e,y:t},exit:{opacity:0,scale:.5},transition:{type:"spring",stiffness:200,damping:20},style:{left:0,top:0},children:(0,bu.jsx)("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,bu.jsx)("path",{d:"M3 3L10.07 19.97L12.58 12.58L19.97 10.07L3 3Z",fill:"#C4B5FD"})})})})}var Ci=N(W(),1);function lk(){let[e,t]=Ci.useState({x:0,y:0,visible:!1,onClick:!1}),a=Ci.useCallback(n=>{let s=document.querySelector(n.selector);if(s){let i=s.getBoundingClientRect(),l=n.offset?.x||0,u=n.offset?.y||0;t({x:i.left+i.width/2+l,y:i.top+i.height/2+u,visible:!0,onClick:n.onClick||!1})}},[]),r=Ci.useCallback(()=>{t(n=>({...n,visible:!1}))},[]),o=Ci.useCallback(()=>{t(n=>({...n,visible:!0}))},[]);return{cursorState:e,moveTo:a,hide:r,show:o}}var br=N(W(),1);function uk({productBackendUrl:e,sessionId:t,enabled:a=!0}){let[r,o]=br.useState({status:"idle"}),n=br.useRef(null),s=br.useCallback(async()=>{if(!e||!a){console.log("[useUserAuth] Skipping auth - productBackendUrl:",e,"enabled:",a),o({status:"idle"});return}console.log("[useUserAuth] Starting auth request to product backend..."),console.log("[useUserAuth] Product backend URL:",e),console.log("[useUserAuth] Full request URL:",`${e}/users/me`),o({status:"loading"});try{let l=await fetch(`${e}/users/me`,{method:"GET",credentials:"include",headers:{Accept:"application/json"}});if(console.log("[useUserAuth] Response received - status:",l.status,"ok:",l.ok),!l.ok)throw console.log("[useUserAuth] Auth request failed with status:",l.status),l.status===401?new Error("Please log in to use the chat assistant."):l.status===403?new Error("You do not have permission to access this feature."):new Error(`Authentication failed (${l.status})`);let u=await l.json();console.log("[useUserAuth] Auth SUCCESS - parsed user data:"),console.log("[useUserAuth] id:",u.id),console.log("[useUserAuth] email:",u.email),console.log("[useUserAuth] name:",u.name),console.log("[useUserAuth] role:",u.role),console.log("[useUserAuth] isInternal:",u.isInternal),console.log("[useUserAuth] agreementsSigned:",u.agreementsSigned),console.log("[useUserAuth] lastLoginTime:",u.lastLoginTime),o({status:"authenticated",user:u})}catch(l){console.log("[useUserAuth] Auth ERROR:",l);let u=l instanceof Error?l.message:"Unable to verify your identity. Please try again.";o({status:"error",error:u})}},[e,a]);br.useEffect(()=>{t!==n.current&&(n.current=t,s())},[t,s]);let i=br.useCallback(()=>{s()},[s]);return{authState:r,retry:i}}var pp=N(W(),1);function dk({agentUrl:e,orgId:t}){let[a,r]=pp.useState({status:"idle",config:null,error:null});return pp.useEffect(()=>{if(!e||!t){console.log("[useOrgConfig] Skipping - missing agentUrl or orgId",{agentUrl:e,orgId:t});return}(async()=>{r({status:"loading",config:null,error:null});let n=`${e}/org/${t}/config`;console.log("[useOrgConfig] Fetching org config from:",n);try{let s=await fetch(n,{method:"GET",headers:{Accept:"application/json"}});if(!s.ok)throw new Error(`Failed to fetch org config (${s.status})`);let i=await s.json();console.log("[useOrgConfig] Received config:",i),r({status:"success",config:i,error:null})}catch(s){let i=s instanceof Error?s.message:"Failed to fetch org config";console.error("[useOrgConfig] Error:",i),r({status:"error",config:null,error:i})}})()},[e,t]),a}var Si=N(le(),1);function wt({className:e,...t}){return(0,Si.jsx)("div",{"data-slot":"card",className:Jt("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...t})}function Ga({className:e,...t}){return(0,Si.jsx)("div",{"data-slot":"card-header",className:Jt("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",e),...t})}function Ka({className:e,...t}){return(0,Si.jsx)("div",{"data-slot":"card-title",className:Jt("leading-none font-semibold",e),...t})}function Py({className:e,...t}){return(0,Si.jsx)("div",{"data-slot":"card-description",className:Jt("text-muted-foreground text-sm",e),...t})}function Ct({className:e,...t}){return(0,Si.jsx)("div",{"data-slot":"card-content",className:Jt("px-6",e),...t})}var C=N(le(),1),Ty=e=>new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),mp=(e,t="USD")=>new Intl.NumberFormat("en-US",{style:"currency",currency:t}).format(e),Ay=e=>{switch(e){case"Enterprise":return un;case"Professional":return ru;default:return Xl}},hp=e=>{switch(e){case"Enterprise":return"bg-purple-50 text-purple-700 border-purple-200";case"Professional":return"bg-blue-50 text-blue-700 border-blue-200";default:return"bg-gray-50 text-gray-700 border-gray-200"}};function ku({status:e,type:t="default"}){let r=(()=>{let n=e.toLowerCase();if(t==="transaction")switch(n){case"paid":return{color:"bg-emerald-50 text-emerald-700 border-emerald-200",icon:at};case"failed":return{color:"bg-red-50 text-red-700 border-red-200",icon:ka};case"pending":return{color:"bg-amber-50 text-amber-700 border-amber-200",icon:sn};case"refunded":return{color:"bg-slate-50 text-slate-700 border-slate-200",icon:Es};default:return{color:"bg-gray-50 text-gray-700 border-gray-200",icon:ba}}if(t==="subscription")switch(n){case"active":return{color:"bg-emerald-50 text-emerald-700 border-emerald-200",icon:at};case"cancelled":return{color:"bg-slate-50 text-slate-700 border-slate-200",icon:ka};case"past_due":return{color:"bg-red-50 text-red-700 border-red-200",icon:ba};case"trialing":return{color:"bg-blue-50 text-blue-700 border-blue-200",icon:sn};default:return{color:"bg-gray-50 text-gray-700 border-gray-200",icon:ba}}switch(n){case"active":return{color:"bg-emerald-50 text-emerald-700 border-emerald-200",icon:at};case"inactive":return{color:"bg-slate-50 text-slate-700 border-slate-200",icon:ka};default:return{color:"bg-gray-50 text-gray-700 border-gray-200",icon:ba}}})(),o=r.icon;return(0,C.jsxs)("span",{className:`inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium border ${r.color}`,children:[(0,C.jsx)(o,{className:"h-3 w-3"}),e]})}function pD({subscription:e}){let t=Ay(e.plan);return(0,C.jsxs)(wt,{className:"border-gray-200 shadow-sm bg-white overflow-hidden",children:[(0,C.jsx)("div",{className:`h-1 ${e.status==="active"?"bg-emerald-500":e.status==="past_due"?"bg-red-500":"bg-slate-300"}`}),(0,C.jsx)(Ga,{className:"pb-3",children:(0,C.jsxs)("div",{className:"flex items-start justify-between",children:[(0,C.jsxs)("div",{className:"space-y-1",children:[(0,C.jsxs)(Ka,{className:"text-base font-semibold text-gray-900 flex items-center gap-2",children:[(0,C.jsx)(ln,{className:"h-4 w-4 text-gray-500"}),e.id]}),e.customer_email&&(0,C.jsxs)(Py,{className:"text-sm text-gray-500 flex items-center gap-1.5",children:[(0,C.jsx)(Rs,{className:"h-3 w-3"}),e.customer_email]})]}),(0,C.jsx)(ku,{status:e.status,type:"subscription"})]})}),(0,C.jsx)(Ct,{className:"pt-0",children:(0,C.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,C.jsxs)("div",{className:"space-y-3",children:[(0,C.jsxs)("div",{children:[(0,C.jsx)("div",{className:"text-xs text-gray-500 mb-1",children:"Plan"}),(0,C.jsxs)("span",{className:`inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md text-xs font-medium border ${hp(e.plan)}`,children:[(0,C.jsx)(t,{className:"h-3 w-3"}),e.plan]})]}),(0,C.jsxs)("div",{children:[(0,C.jsx)("div",{className:"text-xs text-gray-500 mb-1",children:"Billing"}),(0,C.jsxs)("div",{className:"text-sm font-medium text-gray-900",children:[mp(e.amount,e.currency)," / ",e.billing_cycle]})]})]}),(0,C.jsxs)("div",{className:"space-y-3",children:[(0,C.jsxs)("div",{children:[(0,C.jsx)("div",{className:"text-xs text-gray-500 mb-1",children:"Current Period"}),(0,C.jsxs)("div",{className:"text-sm text-gray-700",children:[Ty(e.current_period_start)," - ",Ty(e.current_period_end)]})]}),(0,C.jsxs)("div",{children:[(0,C.jsx)("div",{className:"text-xs text-gray-500 mb-1",children:"Created"}),(0,C.jsx)("div",{className:"text-sm text-gray-700",children:Ty(e.created_at)})]})]})]})})]})}function mD({subscriptions:e,maxItems:t=5}){let a=e.slice(0,t),r=e.length>t;return e.length===0?(0,C.jsx)(wt,{className:"border-gray-200 shadow-sm bg-white",children:(0,C.jsxs)(Ct,{className:"py-8 text-center",children:[(0,C.jsx)(ln,{className:"h-10 w-10 text-gray-300 mx-auto mb-3"}),(0,C.jsx)("p",{className:"text-sm text-gray-500",children:"No subscriptions found"})]})}):(0,C.jsxs)(wt,{className:"border-gray-200 shadow-sm bg-white overflow-hidden",children:[(0,C.jsx)(Ga,{className:"pb-2 border-b border-gray-100",children:(0,C.jsxs)(Ka,{className:"text-sm font-medium text-gray-700 flex items-center gap-2",children:[(0,C.jsx)(ln,{className:"h-4 w-4"}),e.length," Subscription",e.length!==1?"s":""]})}),(0,C.jsxs)(Ct,{className:"p-0",children:[(0,C.jsx)("div",{className:"divide-y divide-gray-100",children:a.map(o=>{let n=Ay(o.plan);return(0,C.jsx)("div",{className:"px-4 py-3 hover:bg-gray-50 transition-colors",children:(0,C.jsxs)("div",{className:"flex items-center justify-between",children:[(0,C.jsxs)("div",{className:"flex items-center gap-3 min-w-0",children:[(0,C.jsx)("div",{className:`p-2 rounded-lg ${hp(o.plan).replace("text-","text-").replace("border-","bg-").split(" ")[0]}`,children:(0,C.jsx)(n,{className:"h-4 w-4"})}),(0,C.jsxs)("div",{className:"min-w-0",children:[(0,C.jsx)("div",{className:"text-sm font-medium text-gray-900 truncate",children:o.customer_email||o.customer_id}),(0,C.jsxs)("div",{className:"text-xs text-gray-500",children:[o.plan," \xB7 ",mp(o.amount,o.currency),"/",o.billing_cycle]})]})]}),(0,C.jsx)(ku,{status:o.status,type:"subscription"})]})},o.id)})}),r&&(0,C.jsx)("div",{className:"px-4 py-2 bg-gray-50 border-t border-gray-100 text-center",children:(0,C.jsxs)("span",{className:"text-xs text-gray-500",children:["+",e.length-t," more subscription",e.length-t!==1?"s":""]})})]})]})}function hD({customer:e}){let t=Ay(e.subscription);return(0,C.jsxs)(wt,{className:"border-gray-200 shadow-sm bg-white overflow-hidden",children:[(0,C.jsx)("div",{className:`h-1 ${e.status==="active"?"bg-emerald-500":"bg-slate-300"}`}),(0,C.jsx)(Ga,{className:"pb-3",children:(0,C.jsxs)("div",{className:"flex items-start justify-between",children:[(0,C.jsx)("div",{className:"flex items-center gap-3",children:(0,C.jsxs)("div",{children:[(0,C.jsx)(Ka,{className:"text-base font-semibold text-gray-900",children:e.name}),(0,C.jsxs)(Py,{className:"text-sm text-gray-500 flex items-center gap-1",children:[(0,C.jsx)(Rs,{className:"h-3 w-3"}),e.email]})]})}),(0,C.jsx)(ku,{status:e.status,type:"customer"})]})}),(0,C.jsx)(Ct,{className:"pt-0",children:(0,C.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,C.jsxs)("div",{className:"space-y-3",children:[(0,C.jsxs)("div",{children:[(0,C.jsx)("div",{className:"text-xs text-gray-500 mb-1",children:"Plan"}),(0,C.jsxs)("span",{className:`inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md text-xs font-medium border ${hp(e.subscription)}`,children:[(0,C.jsx)(t,{className:"h-3 w-3"}),e.subscription]})]}),(0,C.jsxs)("div",{children:[(0,C.jsx)("div",{className:"text-xs text-gray-500 mb-1",children:"Revenue"}),(0,C.jsxs)("div",{className:"text-sm font-medium text-gray-900 flex items-center gap-1",children:[(0,C.jsx)(dn,{className:"h-3 w-3 text-emerald-500"}),e.revenue]})]})]}),(0,C.jsxs)("div",{className:"space-y-3",children:[(0,C.jsxs)("div",{children:[(0,C.jsx)("div",{className:"text-xs text-gray-500 mb-1",children:"Location"}),(0,C.jsxs)("div",{className:"text-sm text-gray-700 flex items-center gap-1",children:[(0,C.jsx)(_s,{className:"h-3 w-3 text-gray-400"}),e.location||"Not specified"]})]}),(0,C.jsxs)("div",{children:[(0,C.jsx)("div",{className:"text-xs text-gray-500 mb-1",children:"Customer Since"}),(0,C.jsxs)("div",{className:"text-sm text-gray-700 flex items-center gap-1",children:[(0,C.jsx)(Jl,{className:"h-3 w-3 text-gray-400"}),e.joinDate]})]})]})]})})]})}function gD({customers:e,maxItems:t=5}){let a=e.slice(0,t),r=e.length>t;return e.length===0?(0,C.jsx)(wt,{className:"border-gray-200 shadow-sm bg-white",children:(0,C.jsxs)(Ct,{className:"py-8 text-center",children:[(0,C.jsx)(Ms,{className:"h-10 w-10 text-gray-300 mx-auto mb-3"}),(0,C.jsx)("p",{className:"text-sm text-gray-500",children:"No customers found"})]})}):(0,C.jsxs)(wt,{className:"border-gray-200 shadow-sm bg-white overflow-hidden",children:[(0,C.jsx)(Ga,{className:"pb-2 border-b border-gray-100",children:(0,C.jsxs)(Ka,{className:"text-sm font-medium text-gray-700 flex items-center gap-2",children:[(0,C.jsx)(Ms,{className:"h-4 w-4"}),e.length," Customer",e.length!==1?"s":""]})}),(0,C.jsxs)(Ct,{className:"p-0",children:[(0,C.jsx)("div",{className:"divide-y divide-gray-100",children:a.map(o=>(0,C.jsx)("div",{className:"px-4 py-3 hover:bg-gray-50 transition-colors",children:(0,C.jsxs)("div",{className:"flex items-center justify-between",children:[(0,C.jsx)("div",{className:"flex items-center gap-3 min-w-0",children:(0,C.jsxs)("div",{className:"min-w-0",children:[(0,C.jsx)("div",{className:"text-sm font-medium text-gray-900 truncate",children:o.name}),(0,C.jsx)("div",{className:"text-xs text-gray-500 truncate",children:o.email})]})}),(0,C.jsxs)("div",{className:"flex items-center gap-2",children:[(0,C.jsx)("span",{className:`px-2 py-0.5 rounded text-xs font-medium ${hp(o.subscription)}`,children:o.subscription}),(0,C.jsx)(ku,{status:o.status,type:"customer"})]})]})},o.id))}),r&&(0,C.jsx)("div",{className:"px-4 py-2 bg-gray-50 border-t border-gray-100 text-center",children:(0,C.jsxs)("span",{className:"text-xs text-gray-500",children:["+",e.length-t," more customer",e.length-t!==1?"s":""]})})]})]})}function ck({transactions:e,maxItems:t=5}){let a=e.slice(0,t),r=e.length>t;return e.length===0?(0,C.jsx)(wt,{className:"border-gray-200 shadow-sm bg-white",children:(0,C.jsxs)(Ct,{className:"py-8 text-center",children:[(0,C.jsx)(dn,{className:"h-10 w-10 text-gray-300 mx-auto mb-3"}),(0,C.jsx)("p",{className:"text-sm text-gray-500",children:"No transactions found"})]})}):(0,C.jsxs)(wt,{className:"border-gray-200 shadow-sm bg-white overflow-hidden",children:[(0,C.jsx)(Ga,{className:"pb-2 border-b border-gray-100",children:(0,C.jsxs)(Ka,{className:"text-sm font-medium text-gray-700 flex items-center gap-2",children:[(0,C.jsx)(dn,{className:"h-4 w-4"}),e.length," Transaction",e.length!==1?"s":""]})}),(0,C.jsxs)(Ct,{className:"p-0",children:[(0,C.jsx)("div",{className:"divide-y divide-gray-100",children:a.map(o=>(0,C.jsx)("div",{className:"px-4 py-3 hover:bg-gray-50 transition-colors",children:(0,C.jsxs)("div",{className:"flex items-center justify-between",children:[(0,C.jsxs)("div",{className:"flex items-center gap-3 min-w-0",children:[(0,C.jsx)("div",{className:`p-2 rounded-lg ${o.status==="paid"?"bg-emerald-50":o.status==="failed"?"bg-red-50":o.status==="refunded"?"bg-slate-50":"bg-amber-50"}`,children:o.status==="paid"?(0,C.jsx)(at,{className:"h-4 w-4 text-emerald-600"}):o.status==="failed"?(0,C.jsx)(ka,{className:"h-4 w-4 text-red-600"}):o.status==="refunded"?(0,C.jsx)(Es,{className:"h-4 w-4 text-slate-600"}):(0,C.jsx)(sn,{className:"h-4 w-4 text-amber-600"})}),(0,C.jsxs)("div",{className:"min-w-0",children:[(0,C.jsx)("div",{className:"text-sm font-medium text-gray-900 truncate",children:o.customer}),(0,C.jsxs)("div",{className:"text-xs text-gray-500",children:[o.date,o.decline_reason&&(0,C.jsxs)("span",{className:"text-red-500 ml-2",children:["\xB7 ",o.decline_reason]})]})]})]}),(0,C.jsxs)("div",{className:"flex items-center gap-3",children:[(0,C.jsxs)("span",{className:`text-sm font-semibold ${o.status==="paid"?"text-emerald-600":o.status==="failed"?"text-red-600":o.status==="refunded"?"text-slate-600":"text-amber-600"}`,children:[o.status==="refunded"?"-":"",o.amount]}),(0,C.jsx)(ku,{status:o.status,type:"transaction"})]})]})},o.id))}),r&&(0,C.jsx)("div",{className:"px-4 py-2 bg-gray-50 border-t border-gray-100 text-center",children:(0,C.jsxs)("span",{className:"text-xs text-gray-500",children:["+",e.length-t," more transaction",e.length-t!==1?"s":""]})})]})]})}function yD({apiKeys:e}){return e.length===0?(0,C.jsx)(wt,{className:"border-gray-200 shadow-sm bg-white",children:(0,C.jsxs)(Ct,{className:"py-8 text-center",children:[(0,C.jsx)(As,{className:"h-10 w-10 text-gray-300 mx-auto mb-3"}),(0,C.jsx)("p",{className:"text-sm text-gray-500",children:"No API keys found"})]})}):(0,C.jsxs)(wt,{className:"border-gray-200 shadow-sm bg-white overflow-hidden",children:[(0,C.jsx)(Ga,{className:"pb-2 border-b border-gray-100",children:(0,C.jsxs)(Ka,{className:"text-sm font-medium text-gray-700 flex items-center gap-2",children:[(0,C.jsx)(As,{className:"h-4 w-4"}),e.length," API Key",e.length!==1?"s":""]})}),(0,C.jsx)(Ct,{className:"p-0",children:(0,C.jsx)("div",{className:"divide-y divide-gray-100",children:e.map((t,a)=>(0,C.jsx)("div",{className:"px-4 py-3 hover:bg-gray-50 transition-colors",children:(0,C.jsxs)("div",{className:"flex items-center justify-between",children:[(0,C.jsxs)("div",{className:"min-w-0",children:[(0,C.jsx)("div",{className:"text-sm font-medium text-gray-900",children:t.name}),(0,C.jsxs)("div",{className:"text-xs text-gray-500 font-mono",children:[t.key.slice(0,12),"...",t.key.slice(-4)]})]}),(0,C.jsxs)("div",{className:"text-xs text-gray-500",children:["Last used: ",t.lastUsed]})]})},a))})})]})}function xD({sessions:e}){let t=a=>{let r=a.toLowerCase();return r.includes("mobile")||r.includes("iphone")||r.includes("android")?tu:Zl};return e.length===0?(0,C.jsx)(wt,{className:"border-gray-200 shadow-sm bg-white",children:(0,C.jsxs)(Ct,{className:"py-8 text-center",children:[(0,C.jsx)(Ds,{className:"h-10 w-10 text-gray-300 mx-auto mb-3"}),(0,C.jsx)("p",{className:"text-sm text-gray-500",children:"No active sessions"})]})}):(0,C.jsxs)(wt,{className:"border-gray-200 shadow-sm bg-white overflow-hidden",children:[(0,C.jsx)(Ga,{className:"pb-2 border-b border-gray-100",children:(0,C.jsxs)(Ka,{className:"text-sm font-medium text-gray-700 flex items-center gap-2",children:[(0,C.jsx)(Ds,{className:"h-4 w-4"}),e.length," Active Session",e.length!==1?"s":""]})}),(0,C.jsx)(Ct,{className:"p-0",children:(0,C.jsx)("div",{className:"divide-y divide-gray-100",children:e.map((a,r)=>{let o=t(a.device);return(0,C.jsx)("div",{className:"px-4 py-3 hover:bg-gray-50 transition-colors",children:(0,C.jsxs)("div",{className:"flex items-center justify-between",children:[(0,C.jsxs)("div",{className:"flex items-center gap-3",children:[(0,C.jsx)("div",{className:"p-2 rounded-lg bg-gray-100",children:(0,C.jsx)(o,{className:"h-4 w-4 text-gray-600"})}),(0,C.jsxs)("div",{children:[(0,C.jsx)("div",{className:"text-sm font-medium text-gray-900",children:a.device}),(0,C.jsxs)("div",{className:"text-xs text-gray-500 flex items-center gap-1",children:[(0,C.jsx)(_s,{className:"h-3 w-3"}),a.location]})]})]}),(0,C.jsx)("div",{className:"text-xs text-gray-500",children:a.time})]})},r)})})})]})}function vD({stats:e}){return(0,C.jsxs)(wt,{className:"border-gray-200 shadow-sm bg-white overflow-hidden",children:[(0,C.jsx)(Ga,{className:"pb-2 border-b border-gray-100",children:(0,C.jsxs)(Ka,{className:"text-sm font-medium text-gray-700 flex items-center gap-2",children:[(0,C.jsx)(au,{className:"h-4 w-4"}),"Dashboard Overview"]})}),(0,C.jsx)(Ct,{className:"p-4",children:(0,C.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[e.revenue&&(0,C.jsxs)("div",{className:"p-3 rounded-lg bg-emerald-50 border border-emerald-100",children:[(0,C.jsx)("div",{className:"text-xs text-emerald-600 font-medium mb-1",children:"Revenue"}),(0,C.jsx)("div",{className:"text-lg font-bold text-emerald-700",children:mp(e.revenue.total)}),e.revenue.change!==0&&(0,C.jsxs)("div",{className:`text-xs ${e.revenue.change>0?"text-emerald-600":"text-red-600"}`,children:[e.revenue.change>0?"+":"",e.revenue.change,"% from last period"]})]}),e.subscriptions&&(0,C.jsxs)("div",{className:"p-3 rounded-lg bg-blue-50 border border-blue-100",children:[(0,C.jsx)("div",{className:"text-xs text-blue-600 font-medium mb-1",children:"Subscriptions"}),(0,C.jsxs)("div",{className:"text-lg font-bold text-blue-700",children:[e.subscriptions.active," active"]}),(0,C.jsxs)("div",{className:"text-xs text-blue-600",children:[e.subscriptions.total," total"]})]}),e.customers&&(0,C.jsxs)("div",{className:"p-3 rounded-lg bg-purple-50 border border-purple-100",children:[(0,C.jsx)("div",{className:"text-xs text-purple-600 font-medium mb-1",children:"Customers"}),(0,C.jsx)("div",{className:"text-lg font-bold text-purple-700",children:e.customers.total}),e.customers.new>0&&(0,C.jsxs)("div",{className:"text-xs text-purple-600",children:["+",e.customers.new," new this period"]})]}),e.transactions&&(0,C.jsxs)("div",{className:"p-3 rounded-lg bg-amber-50 border border-amber-100",children:[(0,C.jsx)("div",{className:"text-xs text-amber-600 font-medium mb-1",children:"Transactions"}),(0,C.jsxs)("div",{className:"text-lg font-bold text-amber-700",children:[e.transactions.successful," successful"]}),e.transactions.failed>0&&(0,C.jsxs)("div",{className:"text-xs text-red-600",children:[e.transactions.failed," failed"]})]})]})})]})}function wD({customers:e}){return e.length===0?(0,C.jsx)(wt,{className:"border-gray-200 shadow-sm bg-white",children:(0,C.jsxs)(Ct,{className:"py-8 text-center",children:[(0,C.jsx)(un,{className:"h-10 w-10 text-gray-300 mx-auto mb-3"}),(0,C.jsx)("p",{className:"text-sm text-gray-500",children:"No top customers data"})]})}):(0,C.jsxs)(wt,{className:"border-gray-200 shadow-sm bg-white overflow-hidden",children:[(0,C.jsx)(Ga,{className:"pb-2 border-b border-gray-100",children:(0,C.jsxs)(Ka,{className:"text-sm font-medium text-gray-700 flex items-center gap-2",children:[(0,C.jsx)(un,{className:"h-4 w-4 text-amber-500"}),"Top Customers"]})}),(0,C.jsx)(Ct,{className:"p-0",children:(0,C.jsx)("div",{className:"divide-y divide-gray-100",children:e.map((t,a)=>(0,C.jsx)("div",{className:"px-4 py-3 hover:bg-gray-50 transition-colors",children:(0,C.jsxs)("div",{className:"flex items-center justify-between",children:[(0,C.jsxs)("div",{className:"flex items-center gap-3 min-w-0",children:[(0,C.jsx)("div",{className:`h-6 w-6 rounded-full flex items-center justify-center text-xs font-bold ${a===0?"bg-amber-100 text-amber-700":a===1?"bg-slate-100 text-slate-700":a===2?"bg-orange-100 text-orange-700":"bg-gray-100 text-gray-700"}`,children:a+1}),(0,C.jsxs)("div",{className:"min-w-0",children:[(0,C.jsx)("div",{className:"text-sm font-medium text-gray-900 truncate",children:t.name}),(0,C.jsx)("div",{className:"text-xs text-gray-500 truncate",children:t.email})]})]}),(0,C.jsx)("div",{className:"text-sm font-semibold text-emerald-600",children:typeof t.revenue=="number"?mp(t.revenue):t.revenue})]})},a))})})]})}function fk({type:e,data:t}){if(!t)return null;switch(e){case"subscription":return(0,C.jsx)(pD,{subscription:t});case"subscriptions":let a=t.subscriptions||t||[];return(0,C.jsx)(mD,{subscriptions:Array.isArray(a)?a:[a]});case"customer":return(0,C.jsx)(hD,{customer:t.customer||t});case"customers":let r=t.customers||t||[];return(0,C.jsx)(gD,{customers:Array.isArray(r)?r:[r]});case"transactions":let o=t.transactions||t||[];return(0,C.jsx)(ck,{transactions:Array.isArray(o)?o:[o]});case"transaction":return(0,C.jsx)(ck,{transactions:[t],maxItems:1});case"dashboard_stats":return(0,C.jsx)(vD,{stats:t});case"top_customers":let n=t.customers||t||[];return(0,C.jsx)(wD,{customers:Array.isArray(n)?n:[n]});case"api_keys":let s=t.api_keys||t||[];return(0,C.jsx)(yD,{apiKeys:Array.isArray(s)?s:[s]});case"sessions":let i=t.sessions||t||[];return(0,C.jsx)(xD,{sessions:Array.isArray(i)?i:[i]});default:return null}}var kn=N(le(),1);function pk({className:e=""}){return(0,kn.jsx)("div",{className:`flex items-center gap-1 px-4 py-3 ${e}`,children:(0,kn.jsxs)("div",{className:"flex items-center gap-1",children:[(0,kn.jsx)("span",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"0ms",animationDuration:"600ms"}}),(0,kn.jsx)("span",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"150ms",animationDuration:"600ms"}}),(0,kn.jsx)("span",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"300ms",animationDuration:"600ms"}})]})})}var p=N(le(),1),CD="0.2.45",SD="http://localhost:5002",Pu=340;function LD(e){return e.replace(/\\\\n/g,`
23
+ `),()=>{document.head.removeChild(d)}},[t]),(0,HS.jsx)(kg,{isPresent:t,childRef:r,sizeRef:o,children:qc.cloneElement(e,{ref:r})})}var GS=({children:e,initial:t,isPresent:a,onExitComplete:r,custom:o,presenceAffectsLayout:n,mode:s})=>{let i=Os(YR),l=(0,pn.useId)(),u=(0,pn.useCallback)(c=>{i.set(c,!0);for(let f of i.values())if(!f)return;r&&r()},[i,r]),d=(0,pn.useMemo)(()=>({id:l,initial:t,isPresent:a,custom:o,onExitComplete:u,register:c=>(i.set(c,!1),()=>i.delete(c))}),n?[Math.random(),u]:[a,u]);return(0,pn.useMemo)(()=>{i.forEach((c,f)=>i.set(f,!1))},[a]),WS.useEffect(()=>{!a&&!i.size&&r&&r()},[a]),s==="popLayout"&&(e=(0,Pg.jsx)($S,{isPresent:a,children:e})),(0,Pg.jsx)(no.Provider,{value:d,children:e})};function YR(){return new Map}var so=N(W(),1);function zc(e=!0){let t=(0,so.useContext)(no);if(t===null)return[!0,null];let{isPresent:a,onExitComplete:r,register:o}=t,n=(0,so.useId)();(0,so.useEffect)(()=>{e&&o(n)},[e]);let s=(0,so.useCallback)(()=>e&&r&&r(n),[n,r,e]);return!a&&r?[!1,s]:[!0]}var Hc=N(W(),1),ou=e=>e.key||"";function Tg(e){let t=[];return Hc.Children.forEach(e,a=>{(0,Hc.isValidElement)(a)&&t.push(a)}),t}var $c=N(W(),1);var Bs=typeof window<"u";var Wc=Bs?$c.useLayoutEffect:$c.useEffect;var Ag=({children:e,custom:t,initial:a=!0,onExitComplete:r,presenceAffectsLayout:o=!0,mode:n="sync",propagate:s=!1})=>{let[i,l]=zc(s),u=(0,ja.useMemo)(()=>Tg(e),[e]),d=s&&!i?[]:u.map(ou),c=(0,ja.useRef)(!0),f=(0,ja.useRef)(u),g=Os(()=>new Map),[x,w]=(0,ja.useState)(u),[L,y]=(0,ja.useState)(u);Wc(()=>{c.current=!1,f.current=u;for(let S=0;S<L.length;S++){let I=ou(L[S]);d.includes(I)?g.delete(I):g.get(I)!==!0&&g.set(I,!1)}},[L,d.length,d.join("-")]);let h=[];if(u!==x){let S=[...u];for(let I=0;I<L.length;I++){let P=L[I],R=ou(P);d.includes(R)||(S.splice(I,0,P),h.push(P))}n==="wait"&&h.length&&(S=h),y(Tg(S)),w(u);return}let{forceRender:m}=(0,ja.useContext)(Ns);return(0,nu.jsx)(nu.Fragment,{children:L.map(S=>{let I=ou(S),P=s&&!i?!1:u===L||d.includes(I),R=()=>{if(g.has(I))g.set(I,!0);else return;let A=!0;g.forEach(V=>{V||(A=!1)}),A&&(m?.(),y(f.current),s&&l?.(),r&&r())};return(0,nu.jsx)(GS,{isPresent:P,initial:!c.current||a?void 0:!1,custom:P?void 0:t,presenceAffectsLayout:o,mode:n,onExitComplete:P?void 0:R,children:S},I)})})};var ge=e=>e;var gr=ge,Ta=ge;function mn(e){let t;return()=>(t===void 0&&(t=e()),t)}var Zt=(e,t,a)=>{let r=t-e;return r===0?1:(a-e)/r};var Ve=e=>e*1e3,dt=e=>e/1e3;var Us={skipAnimations:!1,useManualTiming:!1};function KS(e){let t=new Set,a=new Set,r=!1,o=!1,n=new WeakSet,s={delta:0,timestamp:0,isProcessing:!1};function i(u){n.has(u)&&(l.schedule(u),e()),u(s)}let l={schedule:(u,d=!1,c=!1)=>{let g=c&&r?t:a;return d&&n.add(u),g.has(u)||g.add(u),u},cancel:u=>{a.delete(u),n.delete(u)},process:u=>{if(s=u,r){o=!0;return}r=!0,[t,a]=[a,t],t.forEach(i),t.clear(),r=!1,o&&(o=!1,l.process(u))}};return l}var Gc=["read","resolveKeyframes","update","preRender","render","postRender"],ZR=40;function Kc(e,t){let a=!1,r=!0,o={delta:0,timestamp:0,isProcessing:!1},n=()=>a=!0,s=Gc.reduce((y,h)=>(y[h]=KS(n),y),{}),{read:i,resolveKeyframes:l,update:u,preRender:d,render:c,postRender:f}=s,g=()=>{let y=Us.useManualTiming?o.timestamp:performance.now();a=!1,o.delta=r?1e3/60:Math.max(Math.min(y-o.timestamp,ZR),1),o.timestamp=y,o.isProcessing=!0,i.process(o),l.process(o),u.process(o),d.process(o),c.process(o),f.process(o),o.isProcessing=!1,a&&t&&(r=!1,e(g))},x=()=>{a=!0,r=!0,o.isProcessing||e(g)};return{schedule:Gc.reduce((y,h)=>{let m=s[h];return y[h]=(S,I=!1,P=!1)=>(a||x(),m.schedule(S,I,P)),y},{}),cancel:y=>{for(let h=0;h<Gc.length;h++)s[Gc[h]].cancel(y)},state:o,steps:s}}var{schedule:Z,cancel:ea,state:je,steps:Xc}=Kc(typeof requestAnimationFrame<"u"?requestAnimationFrame:ge,!0);var XS=N(W(),1),Qc=(0,XS.createContext)({strict:!1});var QS={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"]},yr={};for(let e in QS)yr[e]={isEnabled:t=>QS[e].some(a=>!!t[a])};function JS(e){for(let t in e)yr[t]={...yr[t],...e[t]}}var e_=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 su(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||e_.has(e)}var YS=e=>!su(e);function t_(e){e&&(YS=t=>t.startsWith("on")?!su(t):e(t))}try{t_(Ok("@emotion/is-prop-valid").default)}catch{}function ZS(e,t,a){let r={};for(let o in e)o==="values"&&typeof e.values=="object"||(YS(o)||a===!0&&su(o)||!t&&!su(o)||e.draggable&&o.startsWith("onDrag"))&&(r[o]=e[o]);return r}function eL(e){if(typeof Proxy>"u")return e;let t=new Map,a=(...r)=>e(...r);return new Proxy(a,{get:(r,o)=>o==="create"?e:(t.has(o)||t.set(o,e(o)),t.get(o))})}var af=N(le(),1);var qs=N(W(),1);var tL=N(W(),1),io=(0,tL.createContext)({});var Zc=N(W(),1);function xr(e){return typeof e=="string"||Array.isArray(e)}function lo(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}var Jc=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],iu=["initial",...Jc];function hn(e){return lo(e.animate)||iu.some(t=>xr(e[t]))}function Yc(e){return!!(hn(e)||e.variants)}function aL(e,t){if(hn(e)){let{initial:a,animate:r}=e;return{initial:a===!1||xr(a)?a:void 0,animate:xr(r)?r:void 0}}return e.inherit!==!1?t:{}}function oL(e){let{initial:t,animate:a}=aL(e,(0,Zc.useContext)(io));return(0,Zc.useMemo)(()=>({initial:t,animate:a}),[rL(t),rL(a)])}function rL(e){return Array.isArray(e)?e.join(" "):e}var nL=Symbol.for("motionComponentSymbol");var sL=N(W(),1);function vr(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function iL(e,t,a){return(0,sL.useCallback)(r=>{r&&e.onMount&&e.onMount(r),t&&(r?t.mount(r):t.unmount()),a&&(typeof a=="function"?a(r):vr(a)&&(a.current=r))},[t])}var Ut=N(W(),1);var Vs=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase();var a_="framerAppearId",ef="data-"+Vs(a_);var{schedule:js,cancel:BU}=Kc(queueMicrotask,!1);var lL=N(W(),1),tf=(0,lL.createContext)({});function uL(e,t,a,r,o){var n,s;let{visualElement:i}=(0,Ut.useContext)(io),l=(0,Ut.useContext)(Qc),u=(0,Ut.useContext)(no),d=(0,Ut.useContext)(Fs).reducedMotion,c=(0,Ut.useRef)(null);r=r||l.renderer,!c.current&&r&&(c.current=r(e,{visualState:t,parent:i,props:a,presenceContext:u,blockInitialAnimation:u?u.initial===!1:!1,reducedMotionConfig:d}));let f=c.current,g=(0,Ut.useContext)(tf);f&&!f.projection&&o&&(f.type==="html"||f.type==="svg")&&r_(c.current,a,o,g);let x=(0,Ut.useRef)(!1);(0,Ut.useInsertionEffect)(()=>{f&&x.current&&f.update(a,u)});let w=a[ef],L=(0,Ut.useRef)(!!w&&!(!((n=window.MotionHandoffIsComplete)===null||n===void 0)&&n.call(window,w))&&((s=window.MotionHasOptimisedAnimation)===null||s===void 0?void 0:s.call(window,w)));return Wc(()=>{f&&(x.current=!0,window.MotionIsMounted=!0,f.updateFeatures(),js.render(f.render),L.current&&f.animationState&&f.animationState.animateChanges())}),(0,Ut.useEffect)(()=>{f&&(!L.current&&f.animationState&&f.animationState.animateChanges(),L.current&&(queueMicrotask(()=>{var y;(y=window.MotionHandoffMarkAsComplete)===null||y===void 0||y.call(window,w)}),L.current=!1))}),f}function r_(e,t,a,r){let{layoutId:o,layout:n,drag:s,dragConstraints:i,layoutScroll:l,layoutRoot:u}=t;e.projection=new a(e.latestValues,t["data-framer-portal-id"]?void 0:dL(e.parent)),e.projection.setOptions({layoutId:o,layout:n,alwaysMeasureLayout:!!s||i&&vr(i),visualElement:e,animationType:typeof n=="string"?n:"both",initialPromotionConfig:r,layoutScroll:l,layoutRoot:u})}function dL(e){if(e)return e.options.allowProjection!==!1?e.projection:dL(e.parent)}function cL({preloadedFeatures:e,createVisualElement:t,useRender:a,useVisualState:r,Component:o}){var n,s;e&&JS(e);function i(u,d){let c,f={...(0,qs.useContext)(Fs),...u,layoutId:o_(u)},{isStatic:g}=f,x=oL(u),w=r(u,g);if(!g&&Bs){n_(f,e);let L=s_(f);c=L.MeasureLayout,x.visualElement=uL(o,w,f,t,L.ProjectionNode)}return(0,af.jsxs)(io.Provider,{value:x,children:[c&&x.visualElement?(0,af.jsx)(c,{visualElement:x.visualElement,...f}):null,a(o,u,iL(w,x.visualElement,d),w,g,x.visualElement)]})}i.displayName=`motion.${typeof o=="string"?o:`create(${(s=(n=o.displayName)!==null&&n!==void 0?n:o.name)!==null&&s!==void 0?s:""})`}`;let l=(0,qs.forwardRef)(i);return l[nL]=o,l}function o_({layoutId:e}){let t=(0,qs.useContext)(Ns).id;return t&&e!==void 0?t+"-"+e:e}function n_(e,t){let a=(0,qs.useContext)(Qc).strict}function s_(e){let{drag:t,layout:a}=yr;if(!t&&!a)return{};let r={...t,...a};return{MeasureLayout:t?.isEnabled(e)||a?.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}var fL=["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 zs(e){return typeof e!="string"||e.includes("-")?!1:!!(fL.indexOf(e)>-1||/[A-Z]/u.test(e))}var Rg=N(W(),1);function pL(e){let t=[{},{}];return e?.values.forEach((a,r)=>{t[0][r]=a.get(),t[1][r]=a.getVelocity()}),t}function Hs(e,t,a,r){if(typeof t=="function"){let[o,n]=pL(r);t=t(a!==void 0?a:e.custom,o,n)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){let[o,n]=pL(r);t=t(a!==void 0?a:e.custom,o,n)}return t}var lu=e=>Array.isArray(e);var mL=e=>!!(e&&typeof e=="object"&&e.mix&&e.toValue),hL=e=>lu(e)?e[e.length-1]||0:e;var Se=e=>!!(e&&e.getVelocity);function $s(e){let t=Se(e)?e.get():e;return mL(t)?t.toValue():t}function i_({scrapeMotionValuesFromProps:e,createRenderState:t,onUpdate:a},r,o,n){let s={latestValues:l_(r,o,n,e),renderState:t()};return a&&(s.onMount=i=>a({props:r,current:i,...s}),s.onUpdate=i=>a(i)),s}var rf=e=>(t,a)=>{let r=(0,Rg.useContext)(io),o=(0,Rg.useContext)(no),n=()=>i_(e,t,r,o);return a?n():Os(n)};function l_(e,t,a,r){let o={},n=r(e,{});for(let f in n)o[f]=$s(n[f]);let{initial:s,animate:i}=e,l=hn(e),u=Yc(e);t&&u&&!l&&e.inherit!==!1&&(s===void 0&&(s=t.initial),i===void 0&&(i=t.animate));let d=a?a.initial===!1:!1;d=d||s===!1;let c=d?i:s;if(c&&typeof c!="boolean"&&!lo(c)){let f=Array.isArray(c)?c:[c];for(let g=0;g<f.length;g++){let x=Hs(e,f[g]);if(x){let{transitionEnd:w,transition:L,...y}=x;for(let h in y){let m=y[h];if(Array.isArray(m)){let S=d?m.length-1:0;m=m[S]}m!==null&&(o[h]=m)}for(let h in w)o[h]=w[h]}}}return o}var qa=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Vt=new Set(qa);var gL=e=>t=>typeof t=="string"&&t.startsWith(e),of=gL("--"),u_=gL("var(--"),Ws=e=>u_(e)?d_.test(e.split("/*")[0].trim()):!1,d_=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;var nf=(e,t)=>t&&typeof e=="number"?t.transform(e):e;var ct=(e,t,a)=>a>t?t:a<e?e:a;var za={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},wr={...za,transform:e=>ct(0,1,e)},uu={...za,default:1};var du=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Ha=du("deg"),Tt=du("%"),z=du("px"),yL=du("vh"),xL=du("vw"),_g={...Tt,parse:e=>Tt.parse(e)/100,transform:e=>Tt.transform(e*100)};var vL={borderWidth:z,borderTopWidth:z,borderRightWidth:z,borderBottomWidth:z,borderLeftWidth:z,borderRadius:z,radius:z,borderTopLeftRadius:z,borderTopRightRadius:z,borderBottomRightRadius:z,borderBottomLeftRadius:z,width:z,maxWidth:z,height:z,maxHeight:z,top:z,right:z,bottom:z,left:z,padding:z,paddingTop:z,paddingRight:z,paddingBottom:z,paddingLeft:z,margin:z,marginTop:z,marginRight:z,marginBottom:z,marginLeft:z,backgroundPositionX:z,backgroundPositionY:z};var wL={rotate:Ha,rotateX:Ha,rotateY:Ha,rotateZ:Ha,scale:uu,scaleX:uu,scaleY:uu,scaleZ:uu,skew:Ha,skewX:Ha,skewY:Ha,distance:z,translateX:z,translateY:z,translateZ:z,x:z,y:z,z,perspective:z,transformPerspective:z,opacity:wr,originX:_g,originY:_g,originZ:z};var Eg={...za,transform:Math.round};var Gs={...vL,...wL,zIndex:Eg,size:z,fillOpacity:wr,strokeOpacity:wr,numOctaves:Eg};var c_={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},f_=qa.length;function CL(e,t,a){let r="",o=!0;for(let n=0;n<f_;n++){let s=qa[n],i=e[s];if(i===void 0)continue;let l=!0;if(typeof i=="number"?l=i===(s.startsWith("scale")?1:0):l=parseFloat(i)===0,!l||a){let u=nf(i,Gs[s]);if(!l){o=!1;let d=c_[s]||s;r+=`${d}(${u}) `}a&&(t[s]=u)}}return r=r.trim(),a?r=a(t,o?"":r):o&&(r="none"),r}function Ks(e,t,a){let{style:r,vars:o,transformOrigin:n}=e,s=!1,i=!1;for(let l in t){let u=t[l];if(Vt.has(l)){s=!0;continue}else if(of(l)){o[l]=u;continue}else{let d=nf(u,Gs[l]);l.startsWith("origin")?(i=!0,n[l]=d):r[l]=d}}if(t.transform||(s||a?r.transform=CL(t,e.transform,a):r.transform&&(r.transform="none")),i){let{originX:l="50%",originY:u="50%",originZ:d=0}=n;r.transformOrigin=`${l} ${u} ${d}`}}var p_={offset:"stroke-dashoffset",array:"stroke-dasharray"},m_={offset:"strokeDashoffset",array:"strokeDasharray"};function SL(e,t,a=1,r=0,o=!0){e.pathLength=1;let n=o?p_:m_;e[n.offset]=z.transform(-r);let s=z.transform(t),i=z.transform(a);e[n.array]=`${s} ${i}`}function LL(e,t,a){return typeof e=="string"?e:z.transform(t+a*e)}function IL(e,t,a){let r=LL(t,e.x,e.width),o=LL(a,e.y,e.height);return`${r} ${o}`}function Xs(e,{attrX:t,attrY:a,attrScale:r,originX:o,originY:n,pathLength:s,pathSpacing:i=1,pathOffset:l=0,...u},d,c){if(Ks(e,u,c),d){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};let{attrs:f,style:g,dimensions:x}=e;f.transform&&(x&&(g.transform=f.transform),delete f.transform),x&&(o!==void 0||n!==void 0||g.transform)&&(g.transformOrigin=IL(x,o!==void 0?o:.5,n!==void 0?n:.5)),t!==void 0&&(f.x=t),a!==void 0&&(f.y=a),r!==void 0&&(f.scale=r),s!==void 0&&SL(f,s,i,l,!1)}var Qs=()=>({style:{},transform:{},transformOrigin:{},vars:{}});var sf=()=>({...Qs(),attrs:{}});var Js=e=>typeof e=="string"&&e.toLowerCase()==="svg";function lf(e,{style:t,vars:a},r,o){Object.assign(e.style,t,o&&o.getProjectionStyles(r));for(let n in a)e.style.setProperty(n,a[n])}var uf=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 df(e,t,a,r){lf(e,t,void 0,r);for(let o in t.attrs)e.setAttribute(uf.has(o)?o:Vs(o),t.attrs[o])}var Ys={};function bL(e){Object.assign(Ys,e)}function cf(e,{layout:t,layoutId:a}){return Vt.has(e)||e.startsWith("origin")||(t||a!==void 0)&&(!!Ys[e]||e==="opacity")}function Zs(e,t,a){var r;let{style:o}=e,n={};for(let s in o)(Se(o[s])||t.style&&Se(t.style[s])||cf(s,e)||((r=a?.getValue(s))===null||r===void 0?void 0:r.liveStyle)!==void 0)&&(n[s]=o[s]);return n}function ff(e,t,a){let r=Zs(e,t,a);for(let o in e)if(Se(e[o])||Se(t[o])){let n=qa.indexOf(o)!==-1?"attr"+o.charAt(0).toUpperCase()+o.substring(1):o;r[n]=e[o]}return r}function h_(e,t){try{t.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{t.dimensions={x:0,y:0,width:0,height:0}}}var kL=["x","y","width","height","cx","cy","r"],PL={useVisualState:rf({scrapeMotionValuesFromProps:ff,createRenderState:sf,onUpdate:({props:e,prevProps:t,current:a,renderState:r,latestValues:o})=>{if(!a)return;let n=!!e.drag;if(!n){for(let i in o)if(Vt.has(i)){n=!0;break}}if(!n)return;let s=!t;if(t)for(let i=0;i<kL.length;i++){let l=kL[i];e[l]!==t[l]&&(s=!0)}s&&Z.read(()=>{h_(a,r),Z.render(()=>{Xs(r,o,Js(a.tagName),e.transformTemplate),df(a,r)})})}})};var TL={useVisualState:rf({scrapeMotionValuesFromProps:Zs,createRenderState:Qs})};var ei=N(W(),1);var AL=N(W(),1);function Dg(e,t,a){for(let r in t)!Se(t[r])&&!cf(r,a)&&(e[r]=t[r])}function g_({transformTemplate:e},t){return(0,AL.useMemo)(()=>{let a=Qs();return Ks(a,t,e),Object.assign({},a.vars,a.style)},[t])}function y_(e,t){let a=e.style||{},r={};return Dg(r,a,e),Object.assign(r,g_(e,t)),r}function RL(e,t){let a={},r=y_(e,t);return e.drag&&e.dragListener!==!1&&(a.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(a.tabIndex=0),a.style=r,a}var _L=N(W(),1);function EL(e,t,a,r){let o=(0,_L.useMemo)(()=>{let n=sf();return Xs(n,t,Js(r),e.transformTemplate),{...n.attrs,style:{...n.style}}},[t]);if(e.style){let n={};Dg(n,e.style,e),o.style={...n,...o.style}}return o}function DL(e=!1){return(a,r,o,{latestValues:n},s)=>{let l=(zs(a)?EL:RL)(r,n,s,a),u=ZS(r,typeof a=="string",e),d=a!==ei.Fragment?{...u,...l,ref:o}:{},{children:c}=r,f=(0,ei.useMemo)(()=>Se(c)?c.get():c,[c]);return(0,ei.createElement)(a,{...d,children:f})}}function ML(e,t){return function(r,{forwardMotionProps:o}={forwardMotionProps:!1}){let s={...zs(r)?PL:TL,preloadedFeatures:e,useRender:DL(o),createVisualElement:t,Component:r};return cL(s)}}function Mg(e,t){if(!Array.isArray(t))return!1;let a=t.length;if(a!==e.length)return!1;for(let r=0;r<a;r++)if(t[r]!==e[r])return!1;return!0}function uo(e,t,a){let r=e.getProps();return Hs(r,t,a!==void 0?a:r.custom,e)}var Ng=mn(()=>window.ScrollTimeline!==void 0);var cu=class{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,a){for(let r=0;r<this.animations.length;r++)this.animations[r][t]=a}attachTimeline(t,a){let r=this.animations.map(o=>{if(Ng()&&o.attachTimeline)return o.attachTimeline(t);if(typeof a=="function")return a(o)});return()=>{r.forEach((o,n)=>{o&&o(),this.animations[n].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 a=0;a<this.animations.length;a++)t=Math.max(t,this.animations[a].duration);return t}runAll(t){this.animations.forEach(a=>a[t]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}};var fu=class extends cu{then(t,a){return Promise.all(this.animations).then(t).catch(a)}};function co(e,t){return e?e[t]||e.default||e:void 0}function ti(e){let t=0,a=50,r=e.next(t);for(;!r.done&&t<2e4;)t+=a,r=e.next(t);return t>=2e4?1/0:t}function fo(e){return typeof e=="function"}function pu(e,t){e.timeline=t,e.onfinish=null}var ai=e=>Array.isArray(e)&&typeof e[0]=="number";var Fg={linearEasing:void 0};function NL(e,t){let a=mn(e);return()=>{var r;return(r=Fg[t])!==null&&r!==void 0?r:a()}}var po=NL(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing");var mu=(e,t,a=10)=>{let r="",o=Math.max(Math.round(t/a),2);for(let n=0;n<o;n++)r+=e(Zt(0,o-1,n))+", ";return`linear(${r.substring(0,r.length-2)})`};function mf(e){return!!(typeof e=="function"&&po()||!e||typeof e=="string"&&(e in pf||po())||ai(e)||Array.isArray(e)&&e.every(mf))}var ri=([e,t,a,r])=>`cubic-bezier(${e}, ${t}, ${a}, ${r})`,pf={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:ri([0,.65,.55,1]),circOut:ri([.55,0,1,.45]),backIn:ri([.31,.01,.66,-.59]),backOut:ri([.33,1.53,.69,.99])};function oi(e,t){if(e)return typeof e=="function"&&po()?mu(e,t):ai(e)?ri(e):Array.isArray(e)?e.map(a=>oi(a,t)||pf.easeOut):pf[e]}var ta={x:!1,y:!1};function ni(){return ta.x||ta.y}function Bg(e,t,a){var r;if(e instanceof Element)return[e];if(typeof e=="string"){let o=document;t&&(o=t.current);let n=(r=a?.[e])!==null&&r!==void 0?r:o.querySelectorAll(e);return n?Array.from(n):[]}return Array.from(e)}function hf(e,t){let a=Bg(e),r=new AbortController,o={passive:!0,...t,signal:r.signal};return[a,o,()=>r.abort()]}function OL(e){return t=>{t.pointerType==="touch"||ni()||e(t)}}function Ug(e,t,a={}){let[r,o,n]=hf(e,a),s=OL(i=>{let{target:l}=i,u=t(i);if(typeof u!="function"||!l)return;let d=OL(c=>{u(c),l.removeEventListener("pointerleave",d)});l.addEventListener("pointerleave",d,o)});return r.forEach(i=>{i.addEventListener("pointerenter",s,o)}),n}var gf=(e,t)=>t?e===t?!0:gf(e,t.parentElement):!1;var gn=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1;var x_=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function FL(e){return x_.has(e.tagName)||e.tabIndex!==-1}var yn=new WeakSet;function BL(e){return t=>{t.key==="Enter"&&e(t)}}function Vg(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}var UL=(e,t)=>{let a=e.currentTarget;if(!a)return;let r=BL(()=>{if(yn.has(a))return;Vg(a,"down");let o=BL(()=>{Vg(a,"up")}),n=()=>Vg(a,"cancel");a.addEventListener("keyup",o,t),a.addEventListener("blur",n,t)});a.addEventListener("keydown",r,t),a.addEventListener("blur",()=>a.removeEventListener("keydown",r),t)};function VL(e){return gn(e)&&!ni()}function jg(e,t,a={}){let[r,o,n]=hf(e,a),s=i=>{let l=i.currentTarget;if(!VL(i)||yn.has(l))return;yn.add(l);let u=t(i),d=(g,x)=>{window.removeEventListener("pointerup",c),window.removeEventListener("pointercancel",f),!(!VL(g)||!yn.has(l))&&(yn.delete(l),typeof u=="function"&&u(g,{success:x}))},c=g=>{d(g,a.useGlobalTarget||gf(l,g.target))},f=g=>{d(g,!1)};window.addEventListener("pointerup",c,o),window.addEventListener("pointercancel",f,o)};return r.forEach(i=>{!FL(i)&&i.getAttribute("tabindex")===null&&(i.tabIndex=0),(a.useGlobalTarget?window:i).addEventListener("pointerdown",s,o),i.addEventListener("focus",u=>UL(u,o),o)}),n}function qg(e){return e==="x"||e==="y"?ta[e]?null:(ta[e]=!0,()=>{ta[e]=!1}):ta.x||ta.y?null:(ta.x=ta.y=!0,()=>{ta.x=ta.y=!1})}var yf=new Set(["width","height","top","left","right","bottom",...qa]);var xf;function w_(){xf=void 0}var vt={now:()=>(xf===void 0&&vt.set(je.isProcessing||Us.useManualTiming?je.timestamp:performance.now()),xf),set:e=>{xf=e,queueMicrotask(w_)}};function si(e,t){e.indexOf(t)===-1&&e.push(t)}function ii(e,t){let a=e.indexOf(t);a>-1&&e.splice(a,1)}var mo=class{constructor(){this.subscriptions=[]}add(t){return si(this.subscriptions,t),()=>ii(this.subscriptions,t)}notify(t,a,r){let o=this.subscriptions.length;if(o)if(o===1)this.subscriptions[0](t,a,r);else for(let n=0;n<o;n++){let s=this.subscriptions[n];s&&s(t,a,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}};function vf(e,t){return t?e*(1e3/t):0}var qL=30,C_=e=>!isNaN(parseFloat(e)),zL={current:void 0},zg=class{constructor(t,a={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(r,o=!0)=>{let n=vt.now();this.updatedAt!==n&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),o&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(t),this.owner=a.owner}setCurrent(t){this.current=t,this.updatedAt=vt.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=C_(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,a){this.events[t]||(this.events[t]=new mo);let r=this.events[t].add(a);return t==="change"?()=>{r(),Z.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(let t in this.events)this.events[t].clear()}attach(t,a){this.passiveEffect=t,this.stopPassiveEffect=a}set(t,a=!0){!a||!this.passiveEffect?this.updateAndNotify(t,a):this.passiveEffect(t,this.updateAndNotify)}setWithVelocity(t,a,r){this.set(a),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-r}jump(t,a=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,a&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return zL.current&&zL.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){let t=vt.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>qL)return 0;let a=Math.min(this.updatedAt-this.prevUpdatedAt,qL);return vf(parseFloat(this.current)-parseFloat(this.prevFrameValue),a)}start(t){return this.stop(),new Promise(a=>{this.hasAnimated=!0,this.animation=t(a),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 Cr(e,t){return new zg(e,t)}function S_(e,t,a){e.hasValue(t)?e.getValue(t).set(a):e.addValue(t,Cr(a))}function HL(e,t){let a=uo(e,t),{transitionEnd:r={},transition:o={},...n}=a||{};n={...n,...r};for(let s in n){let i=hL(n[s]);S_(e,s,i)}}function $L(e){return!!(Se(e)&&e.add)}function hu(e,t){let a=e.getValue("willChange");if($L(a))return a.add(t)}function wf(e){return e.props[ef]}var Cf={current:!1};var WL=(e,t,a)=>(((1-3*a+3*t)*e+(3*a-6*t))*e+3*t)*e,L_=1e-7,I_=12;function b_(e,t,a,r,o){let n,s,i=0;do s=t+(a-t)/2,n=WL(s,r,o)-e,n>0?a=s:t=s;while(Math.abs(n)>L_&&++i<I_);return s}function ho(e,t,a,r){if(e===t&&a===r)return ge;let o=n=>b_(n,0,1,e,a);return n=>n===0||n===1?n:WL(o(n),t,r)}var Sf=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2;var Lf=e=>t=>1-e(1-t);var Hg=ho(.33,1.53,.69,.99),gu=Lf(Hg),If=Sf(gu);var bf=e=>(e*=2)<1?.5*gu(e):.5*(2-Math.pow(2,-10*(e-1)));var kf=e=>1-Math.sin(Math.acos(e)),Pf=Lf(kf),Tf=Sf(kf);var Af=e=>/^0[^.\s]+$/u.test(e);function GL(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||Af(e):!0}var go=e=>Math.round(e*1e5)/1e5;var li=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function KL(e){return e==null}var XL=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu;var ui=(e,t)=>a=>!!(typeof a=="string"&&XL.test(a)&&a.startsWith(e)||t&&!KL(a)&&Object.prototype.hasOwnProperty.call(a,t)),Rf=(e,t,a)=>r=>{if(typeof r!="string")return r;let[o,n,s,i]=r.match(li);return{[e]:parseFloat(o),[t]:parseFloat(n),[a]:parseFloat(s),alpha:i!==void 0?parseFloat(i):1}};var k_=e=>ct(0,255,e),$g={...za,transform:e=>Math.round(k_(e))},$a={test:ui("rgb","red"),parse:Rf("red","green","blue"),transform:({red:e,green:t,blue:a,alpha:r=1})=>"rgba("+$g.transform(e)+", "+$g.transform(t)+", "+$g.transform(a)+", "+go(wr.transform(r))+")"};function P_(e){let t="",a="",r="",o="";return e.length>5?(t=e.substring(1,3),a=e.substring(3,5),r=e.substring(5,7),o=e.substring(7,9)):(t=e.substring(1,2),a=e.substring(2,3),r=e.substring(3,4),o=e.substring(4,5),t+=t,a+=a,r+=r,o+=o),{red:parseInt(t,16),green:parseInt(a,16),blue:parseInt(r,16),alpha:o?parseInt(o,16)/255:1}}var yu={test:ui("#"),parse:P_,transform:$a.transform};var yo={test:ui("hsl","hue"),parse:Rf("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:a,alpha:r=1})=>"hsla("+Math.round(e)+", "+Tt.transform(go(t))+", "+Tt.transform(go(a))+", "+go(wr.transform(r))+")"};var $e={test:e=>$a.test(e)||yu.test(e)||yo.test(e),parse:e=>$a.test(e)?$a.parse(e):yo.test(e)?yo.parse(e):yu.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?$a.transform(e):yo.transform(e)};var QL=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function T_(e){var t,a;return isNaN(e)&&typeof e=="string"&&(((t=e.match(li))===null||t===void 0?void 0:t.length)||0)+(((a=e.match(QL))===null||a===void 0?void 0:a.length)||0)>0}var YL="number",ZL="color",A_="var",R_="var(",JL="${}",__=/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 xn(e){let t=e.toString(),a=[],r={color:[],number:[],var:[]},o=[],n=0,i=t.replace(__,l=>($e.test(l)?(r.color.push(n),o.push(ZL),a.push($e.parse(l))):l.startsWith(R_)?(r.var.push(n),o.push(A_),a.push(l)):(r.number.push(n),o.push(YL),a.push(parseFloat(l))),++n,JL)).split(JL);return{values:a,split:i,indexes:r,types:o}}function eI(e){return xn(e).values}function tI(e){let{split:t,types:a}=xn(e),r=t.length;return o=>{let n="";for(let s=0;s<r;s++)if(n+=t[s],o[s]!==void 0){let i=a[s];i===YL?n+=go(o[s]):i===ZL?n+=$e.transform(o[s]):n+=o[s]}return n}}var E_=e=>typeof e=="number"?0:e;function D_(e){let t=eI(e);return tI(e)(t.map(E_))}var At={test:T_,parse:eI,createTransformer:tI,getAnimatableNone:D_};var M_=new Set(["brightness","contrast","saturate","opacity"]);function N_(e){let[t,a]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;let[r]=a.match(li)||[];if(!r)return e;let o=a.replace(r,""),n=M_.has(t)?1:0;return r!==a&&(n*=100),t+"("+n+o+")"}var O_=/\b([a-z-]*)\(.*?\)/gu,xu={...At,getAnimatableNone:e=>{let t=e.match(O_);return t?t.map(N_).join(" "):e}};var F_={...Gs,color:$e,backgroundColor:$e,outlineColor:$e,fill:$e,stroke:$e,borderColor:$e,borderTopColor:$e,borderRightColor:$e,borderBottomColor:$e,borderLeftColor:$e,filter:xu,WebkitFilter:xu},di=e=>F_[e];function _f(e,t){let a=di(e);return a!==xu&&(a=At),a.getAnimatableNone?a.getAnimatableNone(t):void 0}var B_=new Set(["auto","none","0"]);function aI(e,t,a){let r=0,o;for(;r<e.length&&!o;){let n=e[r];typeof n=="string"&&!B_.has(n)&&xn(n).values.length&&(o=e[r]),r++}if(o&&a)for(let n of t)e[n]=_f(a,o)}var Wg=e=>e===za||e===z,rI=(e,t)=>parseFloat(e.split(", ")[t]),oI=(e,t)=>(a,{transform:r})=>{if(r==="none"||!r)return 0;let o=r.match(/^matrix3d\((.+)\)$/u);if(o)return rI(o[1],t);{let n=r.match(/^matrix\((.+)\)$/u);return n?rI(n[1],e):0}},U_=new Set(["x","y","z"]),V_=qa.filter(e=>!U_.has(e));function nI(e){let t=[];return V_.forEach(a=>{let r=e.getValue(a);r!==void 0&&(t.push([a,r.get()]),r.set(a.startsWith("scale")?1:0))}),t}var vn={width:({x:e},{paddingLeft:t="0",paddingRight:a="0"})=>e.max-e.min-parseFloat(t)-parseFloat(a),height:({y:e},{paddingTop:t="0",paddingBottom:a="0"})=>e.max-e.min-parseFloat(t)-parseFloat(a),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:oI(4,13),y:oI(5,14)};vn.translateX=vn.x;vn.translateY=vn.y;var wn=new Set,Gg=!1,Kg=!1;function sI(){if(Kg){let e=Array.from(wn).filter(r=>r.needsMeasurement),t=new Set(e.map(r=>r.element)),a=new Map;t.forEach(r=>{let o=nI(r);o.length&&(a.set(r,o),r.render())}),e.forEach(r=>r.measureInitialState()),t.forEach(r=>{r.render();let o=a.get(r);o&&o.forEach(([n,s])=>{var i;(i=r.getValue(n))===null||i===void 0||i.set(s)})}),e.forEach(r=>r.measureEndState()),e.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}Kg=!1,Gg=!1,wn.forEach(e=>e.complete()),wn.clear()}function iI(){wn.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Kg=!0)})}function lI(){iI(),sI()}var xo=class{constructor(t,a,r,o,n,s=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...t],this.onComplete=a,this.name=r,this.motionValue=o,this.element=n,this.isAsync=s}scheduleResolve(){this.isScheduled=!0,this.isAsync?(wn.add(this),Gg||(Gg=!0,Z.read(iI),Z.resolveKeyframes(sI))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:t,name:a,element:r,motionValue:o}=this;for(let n=0;n<t.length;n++)if(t[n]===null)if(n===0){let s=o?.get(),i=t[t.length-1];if(s!==void 0)t[0]=s;else if(r&&a){let l=r.readValue(a,i);l!=null&&(t[0]=l)}t[0]===void 0&&(t[0]=i),o&&s===void 0&&o.set(t[0])}else t[n]=t[n-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),wn.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,wn.delete(this))}resume(){this.isComplete||this.scheduleResolve()}};var Ef=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);var j_=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function q_(e){let t=j_.exec(e);if(!t)return[,];let[,a,r,o]=t;return[`--${a??r}`,o]}var z_=4;function Xg(e,t,a=1){Ta(a<=z_,`Max CSS variable fallback depth detected in property "${e}". This may indicate a circular fallback dependency.`);let[r,o]=q_(e);if(!r)return;let n=window.getComputedStyle(t).getPropertyValue(r);if(n){let s=n.trim();return Ef(s)?parseFloat(s):s}return Ws(o)?Xg(o,t,a+1):o}var Df=e=>t=>t.test(e);var uI={test:e=>e==="auto",parse:e=>e};var Qg=[za,z,Tt,Ha,xL,yL,uI],Jg=e=>Qg.find(Df(e));var ci=class extends xo{constructor(t,a,r,o,n){super(t,a,r,o,n,!0)}readKeyframes(){let{unresolvedKeyframes:t,element:a,name:r}=this;if(!a||!a.current)return;super.readKeyframes();for(let l=0;l<t.length;l++){let u=t[l];if(typeof u=="string"&&(u=u.trim(),Ws(u))){let d=Xg(u,a.current);d!==void 0&&(t[l]=d),l===t.length-1&&(this.finalKeyframe=u)}}if(this.resolveNoneKeyframes(),!yf.has(r)||t.length!==2)return;let[o,n]=t,s=Jg(o),i=Jg(n);if(s!==i)if(Wg(s)&&Wg(i))for(let l=0;l<t.length;l++){let u=t[l];typeof u=="string"&&(t[l]=parseFloat(u))}else this.needsMeasurement=!0}resolveNoneKeyframes(){let{unresolvedKeyframes:t,name:a}=this,r=[];for(let o=0;o<t.length;o++)GL(t[o])&&r.push(o);r.length&&aI(t,r,a)}measureInitialState(){let{element:t,unresolvedKeyframes:a,name:r}=this;if(!t||!t.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=vn[r](t.measureViewportBox(),window.getComputedStyle(t.current)),a[0]=this.measuredOrigin;let o=a[a.length-1];o!==void 0&&t.getValue(r,o).jump(o,!1)}measureEndState(){var t;let{element:a,name:r,unresolvedKeyframes:o}=this;if(!a||!a.current)return;let n=a.getValue(r);n&&n.jump(this.measuredOrigin,!1);let s=o.length-1,i=o[s];o[s]=vn[r](a.measureViewportBox(),window.getComputedStyle(a.current)),i!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=i),!((t=this.removedTransforms)===null||t===void 0)&&t.length&&this.removedTransforms.forEach(([l,u])=>{a.getValue(l).set(u)}),this.resolveNoneKeyframes()}};var Yg=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(At.test(e)||e==="0")&&!e.startsWith("url("));function H_(e){let t=e[0];if(e.length===1)return!0;for(let a=0;a<e.length;a++)if(e[a]!==t)return!0}function dI(e,t,a,r){let o=e[0];if(o===null)return!1;if(t==="display"||t==="visibility")return!0;let n=e[e.length-1],s=Yg(o,t),i=Yg(n,t);return gr(s===i,`You are trying to animate ${t} from "${o}" to "${n}". ${o} is not an animatable value - to enable this animation set ${o} to a value animatable to ${n} via the \`style\` property.`),!s||!i?!1:H_(e)||(a==="spring"||fo(a))&&r}var $_=e=>e!==null;function vo(e,{repeat:t,repeatType:a="loop"},r){let o=e.filter($_),n=t&&a!=="loop"&&t%2===1?0:o.length-1;return!n||r===void 0?o[n]:r}var W_=40,fi=class{constructor({autoplay:t=!0,delay:a=0,type:r="keyframes",repeat:o=0,repeatDelay:n=0,repeatType:s="loop",...i}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=vt.now(),this.options={autoplay:t,delay:a,type:r,repeat:o,repeatDelay:n,repeatType:s,...i},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>W_?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&lI(),this._resolved}onKeyframesResolved(t,a){this.resolvedAt=vt.now(),this.hasAttemptedResolve=!0;let{name:r,type:o,velocity:n,delay:s,onComplete:i,onUpdate:l,isGenerator:u}=this.options;if(!u&&!dI(t,r,o,n))if(Cf.current||!s){l&&l(vo(t,this.options,a)),i&&i(),this.resolveFinishedPromise();return}else this.options.duration=0;let d=this.initPlayback(t,a);d!==!1&&(this._resolved={keyframes:t,finalKeyframe:a,...d},this.onPostResolved())}onPostResolved(){}then(t,a){return this.currentFinishedPromise.then(t,a)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(t=>{this.resolveFinishedPromise=t})}};var ie=(e,t,a)=>e+(t-e)*a;function Zg(e,t,a){return a<0&&(a+=1),a>1&&(a-=1),a<1/6?e+(t-e)*6*a:a<1/2?t:a<2/3?e+(t-e)*(2/3-a)*6:e}function cI({hue:e,saturation:t,lightness:a,alpha:r}){e/=360,t/=100,a/=100;let o=0,n=0,s=0;if(!t)o=n=s=a;else{let i=a<.5?a*(1+t):a+t-a*t,l=2*a-i;o=Zg(l,i,e+1/3),n=Zg(l,i,e),s=Zg(l,i,e-1/3)}return{red:Math.round(o*255),green:Math.round(n*255),blue:Math.round(s*255),alpha:r}}function pi(e,t){return a=>a>0?t:e}var ey=(e,t,a)=>{let r=e*e,o=a*(t*t-r)+r;return o<0?0:Math.sqrt(o)},G_=[yu,$a,yo],K_=e=>G_.find(t=>t.test(e));function fI(e){let t=K_(e);if(gr(!!t,`'${e}' is not an animatable color. Use the equivalent color code instead.`),!t)return!1;let a=t.parse(e);return t===yo&&(a=cI(a)),a}var ty=(e,t)=>{let a=fI(e),r=fI(t);if(!a||!r)return pi(e,t);let o={...a};return n=>(o.red=ey(a.red,r.red,n),o.green=ey(a.green,r.green,n),o.blue=ey(a.blue,r.blue,n),o.alpha=ie(a.alpha,r.alpha,n),$a.transform(o))};var X_=(e,t)=>a=>t(e(a)),Wa=(...e)=>e.reduce(X_);var Mf=new Set(["none","hidden"]);function pI(e,t){return Mf.has(e)?a=>a<=0?e:t:a=>a>=1?t:e}function Q_(e,t){return a=>ie(e,t,a)}function Nf(e){return typeof e=="number"?Q_:typeof e=="string"?Ws(e)?pi:$e.test(e)?ty:Z_:Array.isArray(e)?mI:typeof e=="object"?$e.test(e)?ty:J_:pi}function mI(e,t){let a=[...e],r=a.length,o=e.map((n,s)=>Nf(n)(n,t[s]));return n=>{for(let s=0;s<r;s++)a[s]=o[s](n);return a}}function J_(e,t){let a={...e,...t},r={};for(let o in a)e[o]!==void 0&&t[o]!==void 0&&(r[o]=Nf(e[o])(e[o],t[o]));return o=>{for(let n in r)a[n]=r[n](o);return a}}function Y_(e,t){var a;let r=[],o={color:0,var:0,number:0};for(let n=0;n<t.values.length;n++){let s=t.types[n],i=e.indexes[s][o[s]],l=(a=e.values[i])!==null&&a!==void 0?a:0;r[n]=l,o[s]++}return r}var Z_=(e,t)=>{let a=At.createTransformer(t),r=xn(e),o=xn(t);return r.indexes.var.length===o.indexes.var.length&&r.indexes.color.length===o.indexes.color.length&&r.indexes.number.length>=o.indexes.number.length?Mf.has(e)&&!o.values.length||Mf.has(t)&&!r.values.length?pI(e,t):Wa(mI(Y_(r,o),o.values),a):(gr(!0,`Complex values '${e}' and '${t}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`),pi(e,t))};function Of(e,t,a){return typeof e=="number"&&typeof t=="number"&&typeof a=="number"?ie(e,t,a):Nf(e)(e,t)}var eE=5;function Ff(e,t,a){let r=Math.max(t-eE,0);return vf(a-e(r),t-r)}var Pe={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};var ay=.001;function hI({duration:e=Pe.duration,bounce:t=Pe.bounce,velocity:a=Pe.velocity,mass:r=Pe.mass}){let o,n;gr(e<=Ve(Pe.maxDuration),"Spring duration must be 10 seconds or less");let s=1-t;s=ct(Pe.minDamping,Pe.maxDamping,s),e=ct(Pe.minDuration,Pe.maxDuration,dt(e)),s<1?(o=u=>{let d=u*s,c=d*e,f=d-a,g=Bf(u,s),x=Math.exp(-c);return ay-f/g*x},n=u=>{let c=u*s*e,f=c*a+a,g=Math.pow(s,2)*Math.pow(u,2)*e,x=Math.exp(-c),w=Bf(Math.pow(u,2),s);return(-o(u)+ay>0?-1:1)*((f-g)*x)/w}):(o=u=>{let d=Math.exp(-u*e),c=(u-a)*e+1;return-ay+d*c},n=u=>{let d=Math.exp(-u*e),c=(a-u)*(e*e);return d*c});let i=5/e,l=aE(o,n,i);if(e=Ve(e),isNaN(l))return{stiffness:Pe.stiffness,damping:Pe.damping,duration:e};{let u=Math.pow(l,2)*r;return{stiffness:u,damping:s*2*Math.sqrt(r*u),duration:e}}}var tE=12;function aE(e,t,a){let r=a;for(let o=1;o<tE;o++)r=r-e(r)/t(r);return r}function Bf(e,t){return e*Math.sqrt(1-t*t)}var rE=["duration","bounce"],oE=["stiffness","damping","mass"];function gI(e,t){return t.some(a=>e[a]!==void 0)}function nE(e){let t={velocity:Pe.velocity,stiffness:Pe.stiffness,damping:Pe.damping,mass:Pe.mass,isResolvedFromDuration:!1,...e};if(!gI(e,oE)&&gI(e,rE))if(e.visualDuration){let a=e.visualDuration,r=2*Math.PI/(a*1.2),o=r*r,n=2*ct(.05,1,1-(e.bounce||0))*Math.sqrt(o);t={...t,mass:Pe.mass,stiffness:o,damping:n}}else{let a=hI(e);t={...t,...a,mass:Pe.mass},t.isResolvedFromDuration=!0}return t}function Uf(e=Pe.visualDuration,t=Pe.bounce){let a=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e,{restSpeed:r,restDelta:o}=a,n=a.keyframes[0],s=a.keyframes[a.keyframes.length-1],i={done:!1,value:n},{stiffness:l,damping:u,mass:d,duration:c,velocity:f,isResolvedFromDuration:g}=nE({...a,velocity:-dt(a.velocity||0)}),x=f||0,w=u/(2*Math.sqrt(l*d)),L=s-n,y=dt(Math.sqrt(l/d)),h=Math.abs(L)<5;r||(r=h?Pe.restSpeed.granular:Pe.restSpeed.default),o||(o=h?Pe.restDelta.granular:Pe.restDelta.default);let m;if(w<1){let I=Bf(y,w);m=P=>{let R=Math.exp(-w*y*P);return s-R*((x+w*y*L)/I*Math.sin(I*P)+L*Math.cos(I*P))}}else if(w===1)m=I=>s-Math.exp(-y*I)*(L+(x+y*L)*I);else{let I=y*Math.sqrt(w*w-1);m=P=>{let R=Math.exp(-w*y*P),A=Math.min(I*P,300);return s-R*((x+w*y*L)*Math.sinh(A)+I*L*Math.cosh(A))/I}}let S={calculatedDuration:g&&c||null,next:I=>{let P=m(I);if(g)i.done=I>=c;else{let R=0;w<1&&(R=I===0?Ve(x):Ff(m,I,P));let A=Math.abs(R)<=r,V=Math.abs(s-P)<=o;i.done=A&&V}return i.value=i.done?s:P,i},toString:()=>{let I=Math.min(ti(S),2e4),P=mu(R=>S.next(I*R).value,I,30);return I+"ms "+P}};return S}function ry({keyframes:e,velocity:t=0,power:a=.8,timeConstant:r=325,bounceDamping:o=10,bounceStiffness:n=500,modifyTarget:s,min:i,max:l,restDelta:u=.5,restSpeed:d}){let c=e[0],f={done:!1,value:c},g=A=>i!==void 0&&A<i||l!==void 0&&A>l,x=A=>i===void 0?l:l===void 0||Math.abs(i-A)<Math.abs(l-A)?i:l,w=a*t,L=c+w,y=s===void 0?L:s(L);y!==L&&(w=y-c);let h=A=>-w*Math.exp(-A/r),m=A=>y+h(A),S=A=>{let V=h(A),F=m(A);f.done=Math.abs(V)<=u,f.value=f.done?y:F},I,P,R=A=>{g(f.value)&&(I=A,P=Uf({keyframes:[f.value,x(f.value)],velocity:Ff(m,A,f.value),damping:o,stiffness:n,restDelta:u,restSpeed:d}))};return R(0),{calculatedDuration:null,next:A=>{let V=!1;return!P&&I===void 0&&(V=!0,S(A),R(A)),I!==void 0&&A>=I?P.next(A-I):(!V&&S(A),f)}}}var yI=ho(.42,0,1,1),xI=ho(0,0,.58,1),Vf=ho(.42,0,.58,1);var vI=e=>Array.isArray(e)&&typeof e[0]!="number";var wI={linear:ge,easeIn:yI,easeInOut:Vf,easeOut:xI,circIn:kf,circInOut:Tf,circOut:Pf,backIn:gu,backInOut:If,backOut:Hg,anticipate:bf},oy=e=>{if(ai(e)){Ta(e.length===4,"Cubic bezier arrays must contain four numerical values.");let[t,a,r,o]=e;return ho(t,a,r,o)}else if(typeof e=="string")return Ta(wI[e]!==void 0,`Invalid easing type '${e}'`),wI[e];return e};function sE(e,t,a){let r=[],o=a||Of,n=e.length-1;for(let s=0;s<n;s++){let i=o(e[s],e[s+1]);if(t){let l=Array.isArray(t)?t[s]||ge:t;i=Wa(l,i)}r.push(i)}return r}function CI(e,t,{clamp:a=!0,ease:r,mixer:o}={}){let n=e.length;if(Ta(n===t.length,"Both input and output ranges must be the same length"),n===1)return()=>t[0];if(n===2&&t[0]===t[1])return()=>t[1];let s=e[0]===e[1];e[0]>e[n-1]&&(e=[...e].reverse(),t=[...t].reverse());let i=sE(t,r,o),l=i.length,u=d=>{if(s&&d<e[0])return t[0];let c=0;if(l>1)for(;c<e.length-2&&!(d<e[c+1]);c++);let f=Zt(e[c],e[c+1],d);return i[c](f)};return a?d=>u(ct(e[0],e[n-1],d)):u}function SI(e,t){let a=e[e.length-1];for(let r=1;r<=t;r++){let o=Zt(0,t,r);e.push(ie(a,1,o))}}function LI(e){let t=[0];return SI(t,e.length-1),t}function II(e,t){return e.map(a=>a*t)}function iE(e,t){return e.map(()=>t||Vf).splice(0,e.length-1)}function vu({duration:e=300,keyframes:t,times:a,ease:r="easeInOut"}){let o=vI(r)?r.map(oy):oy(r),n={done:!1,value:t[0]},s=II(a&&a.length===t.length?a:LI(t),e),i=CI(s,t,{ease:Array.isArray(o)?o:iE(t,o)});return{calculatedDuration:e,next:l=>(n.value=i(l),n.done=l>=e,n)}}var bI=e=>{let t=({timestamp:a})=>e(a);return{start:()=>Z.update(t,!0),stop:()=>ea(t),now:()=>je.isProcessing?je.timestamp:vt.now()}};var lE={decay:ry,inertia:ry,tween:vu,keyframes:vu,spring:Uf},uE=e=>e/100,Cn=class extends fi{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();let{onStop:l}=this.options;l&&l()};let{name:a,motionValue:r,element:o,keyframes:n}=this.options,s=o?.KeyframeResolver||xo,i=(l,u)=>this.onKeyframesResolved(l,u);this.resolver=new s(n,i,a,r,o),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(t){let{type:a="keyframes",repeat:r=0,repeatDelay:o=0,repeatType:n,velocity:s=0}=this.options,i=fo(a)?a:lE[a]||vu,l,u;i!==vu&&typeof t[0]!="number"&&(l=Wa(uE,Of(t[0],t[1])),t=[0,100]);let d=i({...this.options,keyframes:t});n==="mirror"&&(u=i({...this.options,keyframes:[...t].reverse(),velocity:-s})),d.calculatedDuration===null&&(d.calculatedDuration=ti(d));let{calculatedDuration:c}=d,f=c+o,g=f*(r+1)-o;return{generator:d,mirroredGenerator:u,mapPercentToKeyframes:l,calculatedDuration:c,resolvedDuration:f,totalDuration:g}}onPostResolved(){let{autoplay:t=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!t?this.pause():this.state=this.pendingPlayState}tick(t,a=!1){let{resolved:r}=this;if(!r){let{keyframes:A}=this.options;return{done:!0,value:A[A.length-1]}}let{finalKeyframe:o,generator:n,mirroredGenerator:s,mapPercentToKeyframes:i,keyframes:l,calculatedDuration:u,totalDuration:d,resolvedDuration:c}=r;if(this.startTime===null)return n.next(0);let{delay:f,repeat:g,repeatType:x,repeatDelay:w,onUpdate:L}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-d/this.speed,this.startTime)),a?this.currentTime=t:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(t-this.startTime)*this.speed;let y=this.currentTime-f*(this.speed>=0?1:-1),h=this.speed>=0?y<0:y>d;this.currentTime=Math.max(y,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=d);let m=this.currentTime,S=n;if(g){let A=Math.min(this.currentTime,d)/c,V=Math.floor(A),F=A%1;!F&&A>=1&&(F=1),F===1&&V--,V=Math.min(V,g+1),V%2&&(x==="reverse"?(F=1-F,w&&(F-=w/c)):x==="mirror"&&(S=s)),m=ct(0,1,F)*c}let I=h?{done:!1,value:l[0]}:S.next(m);i&&(I.value=i(I.value));let{done:P}=I;!h&&u!==null&&(P=this.speed>=0?this.currentTime>=d:this.currentTime<=0);let R=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&P);return R&&o!==void 0&&(I.value=vo(l,this.options,o)),L&&L(I.value),R&&this.finish(),I}get duration(){let{resolved:t}=this;return t?dt(t.calculatedDuration):0}get time(){return dt(this.currentTime)}set time(t){t=Ve(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){let a=this.playbackSpeed!==t;this.playbackSpeed=t,a&&(this.time=dt(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;let{driver:t=bI,onPlay:a,startTime:r}=this.options;this.driver||(this.driver=t(n=>this.tick(n))),a&&a();let o=this.driver.now();this.holdTime!==null?this.startTime=o-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=o):this.startTime=r??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";let{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)}};var kI=new Set(["opacity","clipPath","filter","transform"]);function PI(e,t,a,{delay:r=0,duration:o=300,repeat:n=0,repeatType:s="loop",ease:i="easeInOut",times:l}={}){let u={[t]:a};l&&(u.offset=l);let d=oi(i,o);return Array.isArray(d)&&(u.easing=d),e.animate(u,{delay:r,duration:o,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:n+1,direction:s==="reverse"?"alternate":"normal"})}var TI=mn(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));var jf=10,dE=2e4;function cE(e){return fo(e.type)||e.type==="spring"||!mf(e.ease)}function fE(e,t){let a=new Cn({...t,keyframes:e,repeat:0,delay:0,isGenerator:!0}),r={done:!1,value:e[0]},o=[],n=0;for(;!r.done&&n<dE;)r=a.sample(n),o.push(r.value),n+=jf;return{times:void 0,keyframes:o,duration:n-jf,ease:"linear"}}var AI={anticipate:bf,backInOut:If,circInOut:Tf};function pE(e){return e in AI}var wu=class extends fi{constructor(t){super(t);let{name:a,motionValue:r,element:o,keyframes:n}=this.options;this.resolver=new ci(n,(s,i)=>this.onKeyframesResolved(s,i),a,r,o),this.resolver.scheduleResolve()}initPlayback(t,a){let{duration:r=300,times:o,ease:n,type:s,motionValue:i,name:l,startTime:u}=this.options;if(!i.owner||!i.owner.current)return!1;if(typeof n=="string"&&po()&&pE(n)&&(n=AI[n]),cE(this.options)){let{onComplete:c,onUpdate:f,motionValue:g,element:x,...w}=this.options,L=fE(t,w);t=L.keyframes,t.length===1&&(t[1]=t[0]),r=L.duration,o=L.times,n=L.ease,s="keyframes"}let d=PI(i.owner.current,l,t,{...this.options,duration:r,times:o,ease:n});return d.startTime=u??this.calcStartTime(),this.pendingTimeline?(pu(d,this.pendingTimeline),this.pendingTimeline=void 0):d.onfinish=()=>{let{onComplete:c}=this.options;i.set(vo(t,this.options,a)),c&&c(),this.cancel(),this.resolveFinishedPromise()},{animation:d,duration:r,times:o,type:s,ease:n,keyframes:t}}get duration(){let{resolved:t}=this;if(!t)return 0;let{duration:a}=t;return dt(a)}get time(){let{resolved:t}=this;if(!t)return 0;let{animation:a}=t;return dt(a.currentTime||0)}set time(t){let{resolved:a}=this;if(!a)return;let{animation:r}=a;r.currentTime=Ve(t)}get speed(){let{resolved:t}=this;if(!t)return 1;let{animation:a}=t;return a.playbackRate}set speed(t){let{resolved:a}=this;if(!a)return;let{animation:r}=a;r.playbackRate=t}get state(){let{resolved:t}=this;if(!t)return"idle";let{animation:a}=t;return a.playState}get startTime(){let{resolved:t}=this;if(!t)return null;let{animation:a}=t;return a.startTime}attachTimeline(t){if(!this._resolved)this.pendingTimeline=t;else{let{resolved:a}=this;if(!a)return ge;let{animation:r}=a;pu(r,t)}return ge}play(){if(this.isStopped)return;let{resolved:t}=this;if(!t)return;let{animation:a}=t;a.playState==="finished"&&this.updateFinishedPromise(),a.play()}pause(){let{resolved:t}=this;if(!t)return;let{animation:a}=t;a.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();let{resolved:t}=this;if(!t)return;let{animation:a,keyframes:r,duration:o,type:n,ease:s,times:i}=t;if(a.playState==="idle"||a.playState==="finished")return;if(this.time){let{motionValue:u,onUpdate:d,onComplete:c,element:f,...g}=this.options,x=new Cn({...g,keyframes:r,duration:o,type:n,ease:s,times:i,isGenerator:!0}),w=Ve(this.time);u.setWithVelocity(x.sample(w-jf).value,x.sample(w).value,jf)}let{onStop:l}=this.options;l&&l(),this.cancel()}complete(){let{resolved:t}=this;t&&t.animation.finish()}cancel(){let{resolved:t}=this;t&&t.animation.cancel()}static supports(t){let{motionValue:a,name:r,repeatDelay:o,repeatType:n,damping:s,type:i}=t;if(!a||!a.owner||!(a.owner.current instanceof HTMLElement))return!1;let{onUpdate:l,transformTemplate:u}=a.owner.getProps();return TI()&&r&&kI.has(r)&&!l&&!u&&!o&&n!=="mirror"&&s!==0&&i!=="inertia"}};var mE={type:"spring",stiffness:500,damping:25,restSpeed:10},hE=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),gE={type:"keyframes",duration:.8},yE={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},RI=(e,{keyframes:t})=>t.length>2?gE:Vt.has(e)?e.startsWith("scale")?hE(t[1]):mE:yE;function _I({when:e,delay:t,delayChildren:a,staggerChildren:r,staggerDirection:o,repeat:n,repeatType:s,repeatDelay:i,from:l,elapsed:u,...d}){return!!Object.keys(d).length}var mi=(e,t,a,r={},o,n)=>s=>{let i=co(r,e)||{},l=i.delay||r.delay||0,{elapsed:u=0}=r;u=u-Ve(l);let d={keyframes:Array.isArray(a)?a:[null,a],ease:"easeOut",velocity:t.getVelocity(),...i,delay:-u,onUpdate:f=>{t.set(f),i.onUpdate&&i.onUpdate(f)},onComplete:()=>{s(),i.onComplete&&i.onComplete()},name:e,motionValue:t,element:n?void 0:o};_I(i)||(d={...d,...RI(e,d)}),d.duration&&(d.duration=Ve(d.duration)),d.repeatDelay&&(d.repeatDelay=Ve(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let c=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(d.duration=0,d.delay===0&&(c=!0)),(Cf.current||Us.skipAnimations)&&(c=!0,d.duration=0,d.delay=0),c&&!n&&t.get()!==void 0){let f=vo(d.keyframes,i);if(f!==void 0)return Z.update(()=>{d.onUpdate(f),d.onComplete()}),new fu([])}return!n&&wu.supports(d)?new wu(d):new Cn(d)};function xE({protectedKeys:e,needsAnimating:t},a){let r=e.hasOwnProperty(a)&&t[a]!==!0;return t[a]=!1,r}function qf(e,t,{delay:a=0,transitionOverride:r,type:o}={}){var n;let{transition:s=e.getDefaultTransition(),transitionEnd:i,...l}=t;r&&(s=r);let u=[],d=o&&e.animationState&&e.animationState.getState()[o];for(let c in l){let f=e.getValue(c,(n=e.latestValues[c])!==null&&n!==void 0?n:null),g=l[c];if(g===void 0||d&&xE(d,c))continue;let x={delay:a,...co(s||{},c)},w=!1;if(window.MotionHandoffAnimation){let y=wf(e);if(y){let h=window.MotionHandoffAnimation(y,c,Z);h!==null&&(x.startTime=h,w=!0)}}hu(e,c),f.start(mi(c,f,g,e.shouldReduceMotion&&yf.has(c)?{type:!1}:x,e,w));let L=f.animation;L&&u.push(L)}return i&&Promise.all(u).then(()=>{Z.update(()=>{i&&HL(e,i)})}),u}function zf(e,t,a={}){var r;let o=uo(e,t,a.type==="exit"?(r=e.presenceContext)===null||r===void 0?void 0:r.custom:void 0),{transition:n=e.getDefaultTransition()||{}}=o||{};a.transitionOverride&&(n=a.transitionOverride);let s=o?()=>Promise.all(qf(e,o,a)):()=>Promise.resolve(),i=e.variantChildren&&e.variantChildren.size?(u=0)=>{let{delayChildren:d=0,staggerChildren:c,staggerDirection:f}=n;return vE(e,t,d+u,c,f,a)}:()=>Promise.resolve(),{when:l}=n;if(l){let[u,d]=l==="beforeChildren"?[s,i]:[i,s];return u().then(()=>d())}else return Promise.all([s(),i(a.delay)])}function vE(e,t,a=0,r=0,o=1,n){let s=[],i=(e.variantChildren.size-1)*r,l=o===1?(u=0)=>u*r:(u=0)=>i-u*r;return Array.from(e.variantChildren).sort(wE).forEach((u,d)=>{u.notify("AnimationStart",t),s.push(zf(u,t,{...n,delay:a+l(d)}).then(()=>u.notify("AnimationComplete",t)))}),Promise.all(s)}function wE(e,t){return e.sortNodePosition(t)}function EI(e,t,a={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){let o=t.map(n=>zf(e,n,a));r=Promise.all(o)}else if(typeof t=="string")r=zf(e,t,a);else{let o=typeof t=="function"?uo(e,t,a.custom):t;r=Promise.all(qf(e,o,a))}return r.then(()=>{e.notify("AnimationComplete",t)})}var CE=iu.length;function ny(e){if(!e)return;if(!e.isControllingVariants){let a=e.parent?ny(e.parent)||{}:{};return e.props.initial!==void 0&&(a.initial=e.props.initial),a}let t={};for(let a=0;a<CE;a++){let r=iu[a],o=e.props[r];(xr(o)||o===!1)&&(t[r]=o)}return t}var SE=[...Jc].reverse(),LE=Jc.length;function IE(e){return t=>Promise.all(t.map(({animation:a,options:r})=>EI(e,a,r)))}function MI(e){let t=IE(e),a=DI(),r=!0,o=l=>(u,d)=>{var c;let f=uo(e,d,l==="exit"?(c=e.presenceContext)===null||c===void 0?void 0:c.custom:void 0);if(f){let{transition:g,transitionEnd:x,...w}=f;u={...u,...w,...x}}return u};function n(l){t=l(e)}function s(l){let{props:u}=e,d=ny(e.parent)||{},c=[],f=new Set,g={},x=1/0;for(let L=0;L<LE;L++){let y=SE[L],h=a[y],m=u[y]!==void 0?u[y]:d[y],S=xr(m),I=y===l?h.isActive:null;I===!1&&(x=L);let P=m===d[y]&&m!==u[y]&&S;if(P&&r&&e.manuallyAnimateOnMount&&(P=!1),h.protectedKeys={...g},!h.isActive&&I===null||!m&&!h.prevProp||lo(m)||typeof m=="boolean")continue;let R=bE(h.prevProp,m),A=R||y===l&&h.isActive&&!P&&S||L>x&&S,V=!1,F=Array.isArray(m)?m:[m],me=F.reduce(o(y),{});I===!1&&(me={});let{prevResolvedValues:ae={}}=h,Be={...ae,...me},Aa=Me=>{A=!0,f.has(Me)&&(V=!0,f.delete(Me)),h.needsAnimating[Me]=!0;let xe=e.getValue(Me);xe&&(xe.liveStyle=!1)};for(let Me in Be){let xe=me[Me],ot=ae[Me];if(g.hasOwnProperty(Me))continue;let oa=!1;lu(xe)&&lu(ot)?oa=!Mg(xe,ot):oa=xe!==ot,oa?xe!=null?Aa(Me):f.add(Me):xe!==void 0&&f.has(Me)?Aa(Me):h.protectedKeys[Me]=!0}h.prevProp=m,h.prevResolvedValues=me,h.isActive&&(g={...g,...me}),r&&e.blockInitialAnimation&&(A=!1),A&&(!(P&&R)||V)&&c.push(...F.map(Me=>({animation:Me,options:{type:y}})))}if(f.size){let L={};f.forEach(y=>{let h=e.getBaseTarget(y),m=e.getValue(y);m&&(m.liveStyle=!0),L[y]=h??null}),c.push({animation:L})}let w=!!c.length;return r&&(u.initial===!1||u.initial===u.animate)&&!e.manuallyAnimateOnMount&&(w=!1),r=!1,w?t(c):Promise.resolve()}function i(l,u){var d;if(a[l].isActive===u)return Promise.resolve();(d=e.variantChildren)===null||d===void 0||d.forEach(f=>{var g;return(g=f.animationState)===null||g===void 0?void 0:g.setActive(l,u)}),a[l].isActive=u;let c=s(l);for(let f in a)a[f].protectedKeys={};return c}return{animateChanges:s,setActive:i,setAnimateFunction:n,getState:()=>a,reset:()=>{a=DI(),r=!0}}}function bE(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!Mg(t,e):!1}function Sn(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function DI(){return{animate:Sn(!0),whileInView:Sn(),whileHover:Sn(),whileTap:Sn(),whileDrag:Sn(),whileFocus:Sn(),exit:Sn()}}var rt=class{constructor(t){this.isMounted=!1,this.node=t}update(){}};var Hf=class extends rt{constructor(t){super(t),t.animationState||(t.animationState=MI(t))}updateAnimationControlsSubscription(){let{animate:t}=this.node.getProps();lo(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){let{animate:t}=this.node.getProps(),{animate:a}=this.node.prevProps||{};t!==a&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),(t=this.unmountControls)===null||t===void 0||t.call(this)}};var kE=0,$f=class extends rt{constructor(){super(...arguments),this.id=kE++}update(){if(!this.node.presenceContext)return;let{isPresent:t,onExitComplete:a}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===r)return;let o=this.node.animationState.setActive("exit",!t);a&&!t&&o.then(()=>a(this.id))}mount(){let{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}};var NI={animation:{Feature:Hf},exit:{Feature:$f}};function Sr(e,t,a,r={passive:!0}){return e.addEventListener(t,a,r),()=>e.removeEventListener(t,a)}function Lr(e){return{point:{x:e.pageX,y:e.pageY}}}var OI=e=>t=>gn(t)&&e(t,Lr(t));function wo(e,t,a,r){return Sr(e,t,OI(a),r)}var FI=(e,t)=>Math.abs(e-t);function BI(e,t){let a=FI(e.x,t.x),r=FI(e.y,t.y);return Math.sqrt(a**2+r**2)}var hi=class{constructor(t,a,{transformPagePoint:r,contextWindow:o,dragSnapToOrigin:n=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let c=iy(this.lastMoveEventInfo,this.history),f=this.startEvent!==null,g=BI(c.offset,{x:0,y:0})>=3;if(!f&&!g)return;let{point:x}=c,{timestamp:w}=je;this.history.push({...x,timestamp:w});let{onStart:L,onMove:y}=this.handlers;f||(L&&L(this.lastMoveEvent,c),this.startEvent=this.lastMoveEvent),y&&y(this.lastMoveEvent,c)},this.handlePointerMove=(c,f)=>{this.lastMoveEvent=c,this.lastMoveEventInfo=sy(f,this.transformPagePoint),Z.update(this.updatePoint,!0)},this.handlePointerUp=(c,f)=>{this.end();let{onEnd:g,onSessionEnd:x,resumeAnimation:w}=this.handlers;if(this.dragSnapToOrigin&&w&&w(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let L=iy(c.type==="pointercancel"?this.lastMoveEventInfo:sy(f,this.transformPagePoint),this.history);this.startEvent&&g&&g(c,L),x&&x(c,L)},!gn(t))return;this.dragSnapToOrigin=n,this.handlers=a,this.transformPagePoint=r,this.contextWindow=o||window;let s=Lr(t),i=sy(s,this.transformPagePoint),{point:l}=i,{timestamp:u}=je;this.history=[{...l,timestamp:u}];let{onSessionStart:d}=a;d&&d(t,iy(i,this.history)),this.removeListeners=Wa(wo(this.contextWindow,"pointermove",this.handlePointerMove),wo(this.contextWindow,"pointerup",this.handlePointerUp),wo(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),ea(this.updatePoint)}};function sy(e,t){return t?{point:t(e.point)}:e}function UI(e,t){return{x:e.x-t.x,y:e.y-t.y}}function iy({point:e},t){return{point:e,delta:UI(e,VI(t)),offset:UI(e,PE(t)),velocity:TE(t,.1)}}function PE(e){return e[0]}function VI(e){return e[e.length-1]}function TE(e,t){if(e.length<2)return{x:0,y:0};let a=e.length-1,r=null,o=VI(e);for(;a>=0&&(r=e[a],!(o.timestamp-r.timestamp>Ve(t)));)a--;if(!r)return{x:0,y:0};let n=dt(o.timestamp-r.timestamp);if(n===0)return{x:0,y:0};let s={x:(o.x-r.x)/n,y:(o.y-r.y)/n};return s.x===1/0&&(s.x=0),s.y===1/0&&(s.y=0),s}var HI=1e-4,AE=1-HI,RE=1+HI,$I=.01,_E=0-$I,EE=0+$I;function ft(e){return e.max-e.min}function WI(e,t,a){return Math.abs(e-t)<=a}function jI(e,t,a,r=.5){e.origin=r,e.originPoint=ie(t.min,t.max,e.origin),e.scale=ft(a)/ft(t),e.translate=ie(a.min,a.max,e.origin)-e.originPoint,(e.scale>=AE&&e.scale<=RE||isNaN(e.scale))&&(e.scale=1),(e.translate>=_E&&e.translate<=EE||isNaN(e.translate))&&(e.translate=0)}function gi(e,t,a,r){jI(e.x,t.x,a.x,r?r.originX:void 0),jI(e.y,t.y,a.y,r?r.originY:void 0)}function qI(e,t,a){e.min=a.min+t.min,e.max=e.min+ft(t)}function GI(e,t,a){qI(e.x,t.x,a.x),qI(e.y,t.y,a.y)}function zI(e,t,a){e.min=t.min-a.min,e.max=e.min+ft(t)}function yi(e,t,a){zI(e.x,t.x,a.x),zI(e.y,t.y,a.y)}function YI(e,{min:t,max:a},r){return t!==void 0&&e<t?e=r?ie(t,e,r.min):Math.max(e,t):a!==void 0&&e>a&&(e=r?ie(a,e,r.max):Math.min(e,a)),e}function KI(e,t,a){return{min:t!==void 0?e.min+t:void 0,max:a!==void 0?e.max+a-(e.max-e.min):void 0}}function ZI(e,{top:t,left:a,bottom:r,right:o}){return{x:KI(e.x,a,o),y:KI(e.y,t,r)}}function XI(e,t){let a=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([a,r]=[r,a]),{min:a,max:r}}function eb(e,t){return{x:XI(e.x,t.x),y:XI(e.y,t.y)}}function tb(e,t){let a=.5,r=ft(e),o=ft(t);return o>r?a=Zt(t.min,t.max-r,e.min):r>o&&(a=Zt(e.min,e.max-o,t.min)),ct(0,1,a)}function ab(e,t){let a={};return t.min!==void 0&&(a.min=t.min-e.min),t.max!==void 0&&(a.max=t.max-e.min),a}var Wf=.35;function rb(e=Wf){return e===!1?e=0:e===!0&&(e=Wf),{x:QI(e,"left","right"),y:QI(e,"top","bottom")}}function QI(e,t,a){return{min:JI(e,t),max:JI(e,a)}}function JI(e,t){return typeof e=="number"?e:e[t]||0}var ob=()=>({translate:0,scale:1,origin:0,originPoint:0}),Ln=()=>({x:ob(),y:ob()}),nb=()=>({min:0,max:0}),Te=()=>({x:nb(),y:nb()});function jt(e){return[e("x"),e("y")]}function Gf({top:e,left:t,right:a,bottom:r}){return{x:{min:t,max:a},y:{min:e,max:r}}}function sb({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function ib(e,t){if(!t)return e;let a=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:a.y,left:a.x,bottom:r.y,right:r.x}}function ly(e){return e===void 0||e===1}function Kf({scale:e,scaleX:t,scaleY:a}){return!ly(e)||!ly(t)||!ly(a)}function Ir(e){return Kf(e)||uy(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function uy(e){return lb(e.x)||lb(e.y)}function lb(e){return e&&e!=="0%"}function Cu(e,t,a){let r=e-a,o=t*r;return a+o}function ub(e,t,a,r,o){return o!==void 0&&(e=Cu(e,o,r)),Cu(e,a,r)+t}function dy(e,t=0,a=1,r,o){e.min=ub(e.min,t,a,r,o),e.max=ub(e.max,t,a,r,o)}function cy(e,{x:t,y:a}){dy(e.x,t.translate,t.scale,t.originPoint),dy(e.y,a.translate,a.scale,a.originPoint)}var db=.999999999999,cb=1.0000000000001;function pb(e,t,a,r=!1){let o=a.length;if(!o)return;t.x=t.y=1;let n,s;for(let i=0;i<o;i++){n=a[i],s=n.projectionDelta;let{visualElement:l}=n.options;l&&l.props.style&&l.props.style.display==="contents"||(r&&n.options.layoutScroll&&n.scroll&&n!==n.root&&In(e,{x:-n.scroll.offset.x,y:-n.scroll.offset.y}),s&&(t.x*=s.x.scale,t.y*=s.y.scale,cy(e,s)),r&&Ir(n.latestValues)&&In(e,n.latestValues))}t.x<cb&&t.x>db&&(t.x=1),t.y<cb&&t.y>db&&(t.y=1)}function Co(e,t){e.min=e.min+t,e.max=e.max+t}function fb(e,t,a,r,o=.5){let n=ie(e.min,e.max,o);dy(e,t,a,n,r)}function In(e,t){fb(e.x,t.x,t.scaleX,t.scale,t.originX),fb(e.y,t.y,t.scaleY,t.scale,t.originY)}function fy(e,t){return Gf(ib(e.getBoundingClientRect(),t))}function mb(e,t,a){let r=fy(e,a),{scroll:o}=t;return o&&(Co(r.x,o.offset.x),Co(r.y,o.offset.y)),r}var Xf=({current:e})=>e?e.ownerDocument.defaultView:null;var DE=new WeakMap,Jf=class{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=Te(),this.visualElement=t}start(t,{snapToCursor:a=!1}={}){let{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;let o=d=>{let{dragSnapToOrigin:c}=this.getProps();c?this.pauseAnimation():this.stopAnimation(),a&&this.snapToCursor(Lr(d).point)},n=(d,c)=>{let{drag:f,dragPropagation:g,onDragStart:x}=this.getProps();if(f&&!g&&(this.openDragLock&&this.openDragLock(),this.openDragLock=qg(f),!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),jt(L=>{let y=this.getAxisMotionValue(L).get()||0;if(Tt.test(y)){let{projection:h}=this.visualElement;if(h&&h.layout){let m=h.layout.layoutBox[L];m&&(y=ft(m)*(parseFloat(y)/100))}}this.originPoint[L]=y}),x&&Z.postRender(()=>x(d,c)),hu(this.visualElement,"transform");let{animationState:w}=this.visualElement;w&&w.setActive("whileDrag",!0)},s=(d,c)=>{let{dragPropagation:f,dragDirectionLock:g,onDirectionLock:x,onDrag:w}=this.getProps();if(!f&&!this.openDragLock)return;let{offset:L}=c;if(g&&this.currentDirection===null){this.currentDirection=ME(L),this.currentDirection!==null&&x&&x(this.currentDirection);return}this.updateAxis("x",c.point,L),this.updateAxis("y",c.point,L),this.visualElement.render(),w&&w(d,c)},i=(d,c)=>this.stop(d,c),l=()=>jt(d=>{var c;return this.getAnimationState(d)==="paused"&&((c=this.getAxisMotionValue(d).animation)===null||c===void 0?void 0:c.play())}),{dragSnapToOrigin:u}=this.getProps();this.panSession=new hi(t,{onSessionStart:o,onStart:n,onMove:s,onSessionEnd:i,resumeAnimation:l},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,contextWindow:Xf(this.visualElement)})}stop(t,a){let r=this.isDragging;if(this.cancel(),!r)return;let{velocity:o}=a;this.startAnimation(o);let{onDragEnd:n}=this.getProps();n&&Z.postRender(()=>n(t,a))}cancel(){this.isDragging=!1;let{projection:t,animationState:a}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;let{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),a&&a.setActive("whileDrag",!1)}updateAxis(t,a,r){let{drag:o}=this.getProps();if(!r||!Qf(t,o,this.currentDirection))return;let n=this.getAxisMotionValue(t),s=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(s=YI(s,this.constraints[t],this.elastic[t])),n.set(s)}resolveConstraints(){var t;let{dragConstraints:a,dragElastic:r}=this.getProps(),o=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(t=this.visualElement.projection)===null||t===void 0?void 0:t.layout,n=this.constraints;a&&vr(a)?this.constraints||(this.constraints=this.resolveRefConstraints()):a&&o?this.constraints=ZI(o.layoutBox,a):this.constraints=!1,this.elastic=rb(r),n!==this.constraints&&o&&this.constraints&&!this.hasMutatedConstraints&&jt(s=>{this.constraints!==!1&&this.getAxisMotionValue(s)&&(this.constraints[s]=ab(o.layoutBox[s],this.constraints[s]))})}resolveRefConstraints(){let{dragConstraints:t,onMeasureDragConstraints:a}=this.getProps();if(!t||!vr(t))return!1;let r=t.current;Ta(r!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.");let{projection:o}=this.visualElement;if(!o||!o.layout)return!1;let n=mb(r,o.root,this.visualElement.getTransformPagePoint()),s=eb(o.layout.layoutBox,n);if(a){let i=a(sb(s));this.hasMutatedConstraints=!!i,i&&(s=Gf(i))}return s}startAnimation(t){let{drag:a,dragMomentum:r,dragElastic:o,dragTransition:n,dragSnapToOrigin:s,onDragTransitionEnd:i}=this.getProps(),l=this.constraints||{},u=jt(d=>{if(!Qf(d,a,this.currentDirection))return;let c=l&&l[d]||{};s&&(c={min:0,max:0});let f=o?200:1e6,g=o?40:1e7,x={type:"inertia",velocity:r?t[d]:0,bounceStiffness:f,bounceDamping:g,timeConstant:750,restDelta:1,restSpeed:10,...n,...c};return this.startAxisValueAnimation(d,x)});return Promise.all(u).then(i)}startAxisValueAnimation(t,a){let r=this.getAxisMotionValue(t);return hu(this.visualElement,t),r.start(mi(t,r,0,a,this.visualElement,!1))}stopAnimation(){jt(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){jt(t=>{var a;return(a=this.getAxisMotionValue(t).animation)===null||a===void 0?void 0:a.pause()})}getAnimationState(t){var a;return(a=this.getAxisMotionValue(t).animation)===null||a===void 0?void 0:a.state}getAxisMotionValue(t){let a=`_drag${t.toUpperCase()}`,r=this.visualElement.getProps(),o=r[a];return o||this.visualElement.getValue(t,(r.initial?r.initial[t]:void 0)||0)}snapToCursor(t){jt(a=>{let{drag:r}=this.getProps();if(!Qf(a,r,this.currentDirection))return;let{projection:o}=this.visualElement,n=this.getAxisMotionValue(a);if(o&&o.layout){let{min:s,max:i}=o.layout.layoutBox[a];n.set(t[a]-ie(s,i,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;let{drag:t,dragConstraints:a}=this.getProps(),{projection:r}=this.visualElement;if(!vr(a)||!r||!this.constraints)return;this.stopAnimation();let o={x:0,y:0};jt(s=>{let i=this.getAxisMotionValue(s);if(i&&this.constraints!==!1){let l=i.get();o[s]=tb({min:l,max:l},this.constraints[s])}});let{transformTemplate:n}=this.visualElement.getProps();this.visualElement.current.style.transform=n?n({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),jt(s=>{if(!Qf(s,t,null))return;let i=this.getAxisMotionValue(s),{min:l,max:u}=this.constraints[s];i.set(ie(l,u,o[s]))})}addListeners(){if(!this.visualElement.current)return;DE.set(this.visualElement,this);let t=this.visualElement.current,a=wo(t,"pointerdown",l=>{let{drag:u,dragListener:d=!0}=this.getProps();u&&d&&this.start(l)}),r=()=>{let{dragConstraints:l}=this.getProps();vr(l)&&l.current&&(this.constraints=this.resolveRefConstraints())},{projection:o}=this.visualElement,n=o.addEventListener("measure",r);o&&!o.layout&&(o.root&&o.root.updateScroll(),o.updateLayout()),Z.read(r);let s=Sr(window,"resize",()=>this.scalePositionWithinConstraints()),i=o.addEventListener("didUpdate",(({delta:l,hasLayoutChanged:u})=>{this.isDragging&&u&&(jt(d=>{let c=this.getAxisMotionValue(d);c&&(this.originPoint[d]+=l[d].translate,c.set(c.get()+l[d].translate))}),this.visualElement.render())}));return()=>{s(),a(),n(),i&&i()}}getProps(){let t=this.visualElement.getProps(),{drag:a=!1,dragDirectionLock:r=!1,dragPropagation:o=!1,dragConstraints:n=!1,dragElastic:s=Wf,dragMomentum:i=!0}=t;return{...t,drag:a,dragDirectionLock:r,dragPropagation:o,dragConstraints:n,dragElastic:s,dragMomentum:i}}};function Qf(e,t,a){return(t===!0||t===e)&&(a===null||a===e)}function ME(e,t=10){let a=null;return Math.abs(e.y)>t?a="y":Math.abs(e.x)>t&&(a="x"),a}var Yf=class extends rt{constructor(t){super(t),this.removeGroupControls=ge,this.removeListeners=ge,this.controls=new Jf(t)}mount(){let{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||ge}unmount(){this.removeGroupControls(),this.removeListeners()}};var hb=e=>(t,a)=>{e&&Z.postRender(()=>e(t,a))},Zf=class extends rt{constructor(){super(...arguments),this.removePointerDownListener=ge}onPointerDown(t){this.session=new hi(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Xf(this.node)})}createPanHandlers(){let{onPanSessionStart:t,onPanStart:a,onPan:r,onPanEnd:o}=this.node.getProps();return{onSessionStart:hb(t),onStart:hb(a),onMove:r,onEnd:(n,s)=>{delete this.session,o&&Z.postRender(()=>o(n,s))}}}mount(){this.removePointerDownListener=wo(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}};var xb=N(le(),1),Su=N(W(),1);var xi={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function gb(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}var vi={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(z.test(e))e=parseFloat(e);else return e;let a=gb(e,t.target.x),r=gb(e,t.target.y);return`${a}% ${r}%`}};var yb={correct:(e,{treeScale:t,projectionDelta:a})=>{let r=e,o=At.parse(e);if(o.length>5)return r;let n=At.createTransformer(e),s=typeof o[0]!="number"?1:0,i=a.x.scale*t.x,l=a.y.scale*t.y;o[0+s]/=i,o[1+s]/=l;let u=ie(i,l,.5);return typeof o[2+s]=="number"&&(o[2+s]/=u),typeof o[3+s]=="number"&&(o[3+s]/=u),n(o)}};var py=class extends Su.Component{componentDidMount(){let{visualElement:t,layoutGroup:a,switchLayoutGroup:r,layoutId:o}=this.props,{projection:n}=t;bL(NE),n&&(a.group&&a.group.add(n),r&&r.register&&o&&r.register(n),n.root.didUpdate(),n.addEventListener("animationComplete",()=>{this.safeToRemove()}),n.setOptions({...n.options,onExitComplete:()=>this.safeToRemove()})),xi.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){let{layoutDependency:a,visualElement:r,drag:o,isPresent:n}=this.props,s=r.projection;return s&&(s.isPresent=n,o||t.layoutDependency!==a||a===void 0?s.willUpdate():this.safeToRemove(),t.isPresent!==n&&(n?s.promote():s.relegate()||Z.postRender(()=>{let i=s.getStack();(!i||!i.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){let{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),js.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){let{visualElement:t,layoutGroup:a,switchLayoutGroup:r}=this.props,{projection:o}=t;o&&(o.scheduleCheckAfterUnmount(),a&&a.group&&a.group.remove(o),r&&r.deregister&&r.deregister(o))}safeToRemove(){let{safeToRemove:t}=this.props;t&&t()}render(){return null}};function ep(e){let[t,a]=zc(),r=(0,Su.useContext)(Ns);return(0,xb.jsx)(py,{...e,layoutGroup:r,switchLayoutGroup:(0,Su.useContext)(tf),isPresent:t,safeToRemove:a})}var NE={borderRadius:{...vi,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:vi,borderTopRightRadius:vi,borderBottomLeftRadius:vi,borderBottomRightRadius:vi,boxShadow:yb};function vb(e,t,a){let r=Se(e)?e:Cr(e);return r.start(mi("",r,t,a)),r.animation}function wb(e){return e instanceof SVGElement&&e.tagName!=="svg"}var Cb=(e,t)=>e.depth-t.depth;var tp=class{constructor(){this.children=[],this.isDirty=!1}add(t){si(this.children,t),this.isDirty=!0}remove(t){ii(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(Cb),this.isDirty=!1,this.children.forEach(t)}};function Sb(e,t){let a=vt.now(),r=({timestamp:o})=>{let n=o-a;n>=t&&(ea(r),e(n-t))};return Z.read(r,!0),()=>ea(r)}var kb=["TopLeft","TopRight","BottomLeft","BottomRight"],OE=kb.length,Lb=e=>typeof e=="string"?parseFloat(e):e,Ib=e=>typeof e=="number"||z.test(e);function Pb(e,t,a,r,o,n){o?(e.opacity=ie(0,a.opacity!==void 0?a.opacity:1,FE(r)),e.opacityExit=ie(t.opacity!==void 0?t.opacity:1,0,BE(r))):n&&(e.opacity=ie(t.opacity!==void 0?t.opacity:1,a.opacity!==void 0?a.opacity:1,r));for(let s=0;s<OE;s++){let i=`border${kb[s]}Radius`,l=bb(t,i),u=bb(a,i);if(l===void 0&&u===void 0)continue;l||(l=0),u||(u=0),l===0||u===0||Ib(l)===Ib(u)?(e[i]=Math.max(ie(Lb(l),Lb(u),r),0),(Tt.test(u)||Tt.test(l))&&(e[i]+="%")):e[i]=u}(t.rotate||a.rotate)&&(e.rotate=ie(t.rotate||0,a.rotate||0,r))}function bb(e,t){return e[t]!==void 0?e[t]:e.borderRadius}var FE=Tb(0,.5,Pf),BE=Tb(.5,.95,ge);function Tb(e,t,a){return r=>r<e?0:r>t?1:a(Zt(e,t,r))}function Ab(e,t){e.min=t.min,e.max=t.max}function aa(e,t){Ab(e.x,t.x),Ab(e.y,t.y)}function my(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function Rb(e,t,a,r,o){return e-=t,e=Cu(e,1/a,r),o!==void 0&&(e=Cu(e,1/o,r)),e}function UE(e,t=0,a=1,r=.5,o,n=e,s=e){if(Tt.test(t)&&(t=parseFloat(t),t=ie(s.min,s.max,t/100)-s.min),typeof t!="number")return;let i=ie(n.min,n.max,r);e===n&&(i-=t),e.min=Rb(e.min,t,a,i,o),e.max=Rb(e.max,t,a,i,o)}function _b(e,t,[a,r,o],n,s){UE(e,t[a],t[r],t[o],t.scale,n,s)}var VE=["x","scaleX","originX"],jE=["y","scaleY","originY"];function hy(e,t,a,r){_b(e.x,t,VE,a?a.x:void 0,r?r.x:void 0),_b(e.y,t,jE,a?a.y:void 0,r?r.y:void 0)}function Eb(e){return e.translate===0&&e.scale===1}function gy(e){return Eb(e.x)&&Eb(e.y)}function Db(e,t){return e.min===t.min&&e.max===t.max}function Nb(e,t){return Db(e.x,t.x)&&Db(e.y,t.y)}function Mb(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function yy(e,t){return Mb(e.x,t.x)&&Mb(e.y,t.y)}function xy(e){return ft(e.x)/ft(e.y)}function vy(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}var ap=class{constructor(){this.members=[]}add(t){si(this.members,t),t.scheduleRender()}remove(t){if(ii(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){let a=this.members[this.members.length-1];a&&this.promote(a)}}relegate(t){let a=this.members.findIndex(o=>t===o);if(a===0)return!1;let r;for(let o=a;o>=0;o--){let n=this.members[o];if(n.isPresent!==!1){r=n;break}}return r?(this.promote(r),!0):!1}promote(t,a){let r=this.lead;if(t!==r&&(this.prevLead=r,this.lead=t,t.show(),r)){r.instance&&r.scheduleRender(),t.scheduleRender(),t.resumeFrom=r,a&&(t.resumeFrom.preserveOpacity=!0),r.snapshot&&(t.snapshot=r.snapshot,t.snapshot.latestValues=r.animationValues||r.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);let{crossfade:o}=t.options;o===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(t=>{let{options:a,resumingFrom:r}=t;a.onExitComplete&&a.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}};function Ob(e,t,a){let r="",o=e.x.translate/t.x,n=e.y.translate/t.y,s=a?.z||0;if((o||n||s)&&(r=`translate3d(${o}px, ${n}px, ${s}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),a){let{transformPerspective:u,rotate:d,rotateX:c,rotateY:f,skewX:g,skewY:x}=a;u&&(r=`perspective(${u}px) ${r}`),d&&(r+=`rotate(${d}deg) `),c&&(r+=`rotateX(${c}deg) `),f&&(r+=`rotateY(${f}deg) `),g&&(r+=`skewX(${g}deg) `),x&&(r+=`skewY(${x}deg) `)}let i=e.x.scale*t.x,l=e.y.scale*t.y;return(i!==1||l!==1)&&(r+=`scale(${i}, ${l})`),r||"none"}var bn={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},Lu=typeof window<"u"&&window.MotionDebug!==void 0,wy=["","X","Y","Z"],qE={visibility:"hidden"},Fb=1e3,zE=0;function Cy(e,t,a,r){let{latestValues:o}=t;o[e]&&(a[e]=o[e],t.setStaticValue(e,0),r&&(r[e]=0))}function $b(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;let{visualElement:t}=e.options;if(!t)return;let a=wf(t);if(window.MotionHasOptimisedAnimation(a,"transform")){let{layout:o,layoutId:n}=e.options;window.MotionCancelOptimisedAnimation(a,"transform",Z,!(o||n))}let{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&$b(r)}function rp({attachResizeListener:e,defaultParent:t,measureScroll:a,checkIsScrollRoot:r,resetTransform:o}){return class{constructor(s={},i=t?.()){this.id=zE++,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,Lu&&(bn.totalNodes=bn.resolvedTargetDeltas=bn.recalculatedProjection=0),this.nodes.forEach(WE),this.nodes.forEach(JE),this.nodes.forEach(YE),this.nodes.forEach(GE),Lu&&window.MotionDebug.record(bn)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=s,this.root=i?i.root||i:this,this.path=i?[...i.path,i]:[],this.parent=i,this.depth=i?i.depth+1:0;for(let l=0;l<this.path.length;l++)this.path[l].shouldResetTransform=!0;this.root===this&&(this.nodes=new tp)}addEventListener(s,i){return this.eventHandlers.has(s)||this.eventHandlers.set(s,new mo),this.eventHandlers.get(s).add(i)}notifyListeners(s,...i){let l=this.eventHandlers.get(s);l&&l.notify(...i)}hasListeners(s){return this.eventHandlers.has(s)}mount(s,i=this.root.hasTreeAnimated){if(this.instance)return;this.isSVG=wb(s),this.instance=s;let{layoutId:l,layout:u,visualElement:d}=this.options;if(d&&!d.current&&d.mount(s),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),i&&(u||l)&&(this.isLayoutDirty=!0),e){let c,f=()=>this.root.updateBlockedByResize=!1;e(s,()=>{this.root.updateBlockedByResize=!0,c&&c(),c=Sb(f,250),xi.hasAnimatedSinceResize&&(xi.hasAnimatedSinceResize=!1,this.nodes.forEach(Ub))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&d&&(l||u)&&this.addEventListener("didUpdate",({delta:c,hasLayoutChanged:f,hasRelativeTargetChanged:g,layout:x})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}let w=this.options.transition||d.getDefaultTransition()||rD,{onLayoutAnimationStart:L,onLayoutAnimationComplete:y}=d.getProps(),h=!this.targetLayout||!yy(this.targetLayout,x)||g,m=!f&&g;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||m||f&&(h||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(c,m);let S={...co(w,"layout"),onPlay:L,onComplete:y};(d.shouldReduceMotion||this.options.layoutRoot)&&(S.delay=0,S.type=!1),this.startAnimation(S)}else f||Ub(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=x})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);let s=this.getStack();s&&s.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,ea(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(ZE),this.animationId++)}getTransformTemplate(){let{visualElement:s}=this.options;return s&&s.getProps().transformTemplate}willUpdate(s=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&$b(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d<this.path.length;d++){let c=this.path[d];c.shouldResetTransform=!0,c.updateScroll("snapshot"),c.options.layoutRoot&&c.willUpdate(!1)}let{layoutId:i,layout:l}=this.options;if(i===void 0&&!l)return;let u=this.getTransformTemplate();this.prevTransformTemplateValue=u?u(this.latestValues,""):void 0,this.updateSnapshot(),s&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(Bb);return}this.isUpdating||this.nodes.forEach(XE),this.isUpdating=!1,this.nodes.forEach(QE),this.nodes.forEach(HE),this.nodes.forEach($E),this.clearAllSnapshots();let i=vt.now();je.delta=ct(0,1e3/60,i-je.timestamp),je.timestamp=i,je.isProcessing=!0,Xc.update.process(je),Xc.preRender.process(je),Xc.render.process(je),je.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,js.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(KE),this.sharedNodes.forEach(eD)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Z.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Z.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 l=0;l<this.path.length;l++)this.path[l].updateScroll();let s=this.layout;this.layout=this.measure(!1),this.layoutCorrected=Te(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);let{visualElement:i}=this.options;i&&i.notify("LayoutMeasure",this.layout.layoutBox,s?s.layoutBox:void 0)}updateScroll(s="measure"){let i=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===s&&(i=!1),i){let l=r(this.instance);this.scroll={animationId:this.root.animationId,phase:s,isRoot:l,offset:a(this.instance),wasRoot:this.scroll?this.scroll.isRoot:l}}}resetTransform(){if(!o)return;let s=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,i=this.projectionDelta&&!gy(this.projectionDelta),l=this.getTransformTemplate(),u=l?l(this.latestValues,""):void 0,d=u!==this.prevTransformTemplateValue;s&&(i||Ir(this.latestValues)||d)&&(o(this.instance,u),this.shouldResetTransform=!1,this.scheduleRender())}measure(s=!0){let i=this.measurePageBox(),l=this.removeElementScroll(i);return s&&(l=this.removeTransform(l)),oD(l),{animationId:this.root.animationId,measuredBox:i,layoutBox:l,latestValues:{},source:this.id}}measurePageBox(){var s;let{visualElement:i}=this.options;if(!i)return Te();let l=i.measureViewportBox();if(!(((s=this.scroll)===null||s===void 0?void 0:s.wasRoot)||this.path.some(nD))){let{scroll:d}=this.root;d&&(Co(l.x,d.offset.x),Co(l.y,d.offset.y))}return l}removeElementScroll(s){var i;let l=Te();if(aa(l,s),!((i=this.scroll)===null||i===void 0)&&i.wasRoot)return l;for(let u=0;u<this.path.length;u++){let d=this.path[u],{scroll:c,options:f}=d;d!==this.root&&c&&f.layoutScroll&&(c.wasRoot&&aa(l,s),Co(l.x,c.offset.x),Co(l.y,c.offset.y))}return l}applyTransform(s,i=!1){let l=Te();aa(l,s);for(let u=0;u<this.path.length;u++){let d=this.path[u];!i&&d.options.layoutScroll&&d.scroll&&d!==d.root&&In(l,{x:-d.scroll.offset.x,y:-d.scroll.offset.y}),Ir(d.latestValues)&&In(l,d.latestValues)}return Ir(this.latestValues)&&In(l,this.latestValues),l}removeTransform(s){let i=Te();aa(i,s);for(let l=0;l<this.path.length;l++){let u=this.path[l];if(!u.instance||!Ir(u.latestValues))continue;Kf(u.latestValues)&&u.updateSnapshot();let d=Te(),c=u.measurePageBox();aa(d,c),hy(i,u.latestValues,u.snapshot?u.snapshot.layoutBox:void 0,d)}return Ir(this.latestValues)&&hy(i,this.latestValues),i}setTargetDelta(s){this.targetDelta=s,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(s){this.options={...this.options,...s,crossfade:s.crossfade!==void 0?s.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!==je.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(s=!1){var i;let l=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=l.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=l.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=l.isSharedProjectionDirty);let u=!!this.resumingFrom||this!==l;if(!(s||u&&this.isSharedProjectionDirty||this.isProjectionDirty||!((i=this.parent)===null||i===void 0)&&i.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;let{layout:c,layoutId:f}=this.options;if(!(!this.layout||!(c||f))){if(this.resolvedRelativeTargetAt=je.timestamp,!this.targetDelta&&!this.relativeTarget){let g=this.getClosestProjectingParent();g&&g.layout&&this.animationProgress!==1?(this.relativeParent=g,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Te(),this.relativeTargetOrigin=Te(),yi(this.relativeTargetOrigin,this.layout.layoutBox,g.layout.layoutBox),aa(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)){if(this.target||(this.target=Te(),this.targetWithTransforms=Te()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),GI(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):aa(this.target,this.layout.layoutBox),cy(this.target,this.targetDelta)):aa(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;let g=this.getClosestProjectingParent();g&&!!g.resumingFrom==!!this.resumingFrom&&!g.options.layoutScroll&&g.target&&this.animationProgress!==1?(this.relativeParent=g,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Te(),this.relativeTargetOrigin=Te(),yi(this.relativeTargetOrigin,this.target,g.target),aa(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}Lu&&bn.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||Kf(this.parent.latestValues)||uy(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 s;let i=this.getLead(),l=!!this.resumingFrom||this!==i,u=!0;if((this.isProjectionDirty||!((s=this.parent)===null||s===void 0)&&s.isProjectionDirty)&&(u=!1),l&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(u=!1),this.resolvedRelativeTargetAt===je.timestamp&&(u=!1),u)return;let{layout:d,layoutId:c}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(d||c))return;aa(this.layoutCorrected,this.layout.layoutBox);let f=this.treeScale.x,g=this.treeScale.y;pb(this.layoutCorrected,this.treeScale,this.path,l),i.layout&&!i.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(i.target=i.layout.layoutBox,i.targetWithTransforms=Te());let{target:x}=i;if(!x){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(my(this.prevProjectionDelta.x,this.projectionDelta.x),my(this.prevProjectionDelta.y,this.projectionDelta.y)),gi(this.projectionDelta,this.layoutCorrected,x,this.latestValues),(this.treeScale.x!==f||this.treeScale.y!==g||!vy(this.projectionDelta.x,this.prevProjectionDelta.x)||!vy(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",x)),Lu&&bn.recalculatedProjection++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(s=!0){var i;if((i=this.options.visualElement)===null||i===void 0||i.scheduleRender(),s){let l=this.getStack();l&&l.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Ln(),this.projectionDelta=Ln(),this.projectionDeltaWithTransform=Ln()}setAnimationOrigin(s,i=!1){let l=this.snapshot,u=l?l.latestValues:{},d={...this.latestValues},c=Ln();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!i;let f=Te(),g=l?l.source:void 0,x=this.layout?this.layout.source:void 0,w=g!==x,L=this.getStack(),y=!L||L.members.length<=1,h=!!(w&&!y&&this.options.crossfade===!0&&!this.path.some(aD));this.animationProgress=0;let m;this.mixTargetDelta=S=>{let I=S/1e3;Vb(c.x,s.x,I),Vb(c.y,s.y,I),this.setTargetDelta(c),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(yi(f,this.layout.layoutBox,this.relativeParent.layout.layoutBox),tD(this.relativeTarget,this.relativeTargetOrigin,f,I),m&&Nb(this.relativeTarget,m)&&(this.isProjectionDirty=!1),m||(m=Te()),aa(m,this.relativeTarget)),w&&(this.animationValues=d,Pb(d,u,this.latestValues,I,h,y)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=I},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(s){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(ea(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Z.update(()=>{xi.hasAnimatedSinceResize=!0,this.currentAnimation=vb(0,Fb,{...s,onUpdate:i=>{this.mixTargetDelta(i),s.onUpdate&&s.onUpdate(i)},onComplete:()=>{s.onComplete&&s.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);let s=this.getStack();s&&s.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(Fb),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){let s=this.getLead(),{targetWithTransforms:i,target:l,layout:u,latestValues:d}=s;if(!(!i||!l||!u)){if(this!==s&&this.layout&&u&&Wb(this.options.animationType,this.layout.layoutBox,u.layoutBox)){l=this.target||Te();let c=ft(this.layout.layoutBox.x);l.x.min=s.target.x.min,l.x.max=l.x.min+c;let f=ft(this.layout.layoutBox.y);l.y.min=s.target.y.min,l.y.max=l.y.min+f}aa(i,l),In(i,d),gi(this.projectionDeltaWithTransform,this.layoutCorrected,i,d)}}registerSharedNode(s,i){this.sharedNodes.has(s)||this.sharedNodes.set(s,new ap),this.sharedNodes.get(s).add(i);let u=i.options.initialPromotionConfig;i.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(i):void 0})}isLead(){let s=this.getStack();return s?s.lead===this:!0}getLead(){var s;let{layoutId:i}=this.options;return i?((s=this.getStack())===null||s===void 0?void 0:s.lead)||this:this}getPrevLead(){var s;let{layoutId:i}=this.options;return i?(s=this.getStack())===null||s===void 0?void 0:s.prevLead:void 0}getStack(){let{layoutId:s}=this.options;if(s)return this.root.sharedNodes.get(s)}promote({needsReset:s,transition:i,preserveFollowOpacity:l}={}){let u=this.getStack();u&&u.promote(this,l),s&&(this.projectionDelta=void 0,this.needsReset=!0),i&&this.setOptions({transition:i})}relegate(){let s=this.getStack();return s?s.relegate(this):!1}resetSkewAndRotation(){let{visualElement:s}=this.options;if(!s)return;let i=!1,{latestValues:l}=s;if((l.z||l.rotate||l.rotateX||l.rotateY||l.rotateZ||l.skewX||l.skewY)&&(i=!0),!i)return;let u={};l.z&&Cy("z",s,u,this.animationValues);for(let d=0;d<wy.length;d++)Cy(`rotate${wy[d]}`,s,u,this.animationValues),Cy(`skew${wy[d]}`,s,u,this.animationValues);s.render();for(let d in u)s.setStaticValue(d,u[d]),this.animationValues&&(this.animationValues[d]=u[d]);s.scheduleRender()}getProjectionStyles(s){var i,l;if(!this.instance||this.isSVG)return;if(!this.isVisible)return qE;let u={visibility:""},d=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,u.opacity="",u.pointerEvents=$s(s?.pointerEvents)||"",u.transform=d?d(this.latestValues,""):"none",u;let c=this.getLead();if(!this.projectionDelta||!this.layout||!c.target){let w={};return this.options.layoutId&&(w.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,w.pointerEvents=$s(s?.pointerEvents)||""),this.hasProjected&&!Ir(this.latestValues)&&(w.transform=d?d({},""):"none",this.hasProjected=!1),w}let f=c.animationValues||c.latestValues;this.applyTransformsToTarget(),u.transform=Ob(this.projectionDeltaWithTransform,this.treeScale,f),d&&(u.transform=d(f,u.transform));let{x:g,y:x}=this.projectionDelta;u.transformOrigin=`${g.origin*100}% ${x.origin*100}% 0`,c.animationValues?u.opacity=c===this?(l=(i=f.opacity)!==null&&i!==void 0?i:this.latestValues.opacity)!==null&&l!==void 0?l:1:this.preserveOpacity?this.latestValues.opacity:f.opacityExit:u.opacity=c===this?f.opacity!==void 0?f.opacity:"":f.opacityExit!==void 0?f.opacityExit:0;for(let w in Ys){if(f[w]===void 0)continue;let{correct:L,applyTo:y}=Ys[w],h=u.transform==="none"?f[w]:L(f[w],c);if(y){let m=y.length;for(let S=0;S<m;S++)u[y[S]]=h}else u[w]=h}return this.options.layoutId&&(u.pointerEvents=c===this?$s(s?.pointerEvents)||"":"none"),u}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(s=>{var i;return(i=s.currentAnimation)===null||i===void 0?void 0:i.stop()}),this.root.nodes.forEach(Bb),this.root.sharedNodes.clear()}}}function HE(e){e.updateLayout()}function $E(e){var t;let a=((t=e.resumeFrom)===null||t===void 0?void 0:t.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&a&&e.hasListeners("didUpdate")){let{layoutBox:r,measuredBox:o}=e.layout,{animationType:n}=e.options,s=a.source!==e.layout.source;n==="size"?jt(c=>{let f=s?a.measuredBox[c]:a.layoutBox[c],g=ft(f);f.min=r[c].min,f.max=f.min+g}):Wb(n,a.layoutBox,r)&&jt(c=>{let f=s?a.measuredBox[c]:a.layoutBox[c],g=ft(r[c]);f.max=f.min+g,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[c].max=e.relativeTarget[c].min+g)});let i=Ln();gi(i,r,a.layoutBox);let l=Ln();s?gi(l,e.applyTransform(o,!0),a.measuredBox):gi(l,r,a.layoutBox);let u=!gy(i),d=!1;if(!e.resumeFrom){let c=e.getClosestProjectingParent();if(c&&!c.resumeFrom){let{snapshot:f,layout:g}=c;if(f&&g){let x=Te();yi(x,a.layoutBox,f.layoutBox);let w=Te();yi(w,r,g.layoutBox),yy(x,w)||(d=!0),c.options.layoutRoot&&(e.relativeTarget=w,e.relativeTargetOrigin=x,e.relativeParent=c)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:a,delta:l,layoutDelta:i,hasLayoutChanged:u,hasRelativeTargetChanged:d})}else if(e.isLead()){let{onExitComplete:r}=e.options;r&&r()}e.options.transition=void 0}function WE(e){Lu&&bn.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 GE(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function KE(e){e.clearSnapshot()}function Bb(e){e.clearMeasurements()}function XE(e){e.isLayoutDirty=!1}function QE(e){let{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function Ub(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function JE(e){e.resolveTargetDelta()}function YE(e){e.calcProjection()}function ZE(e){e.resetSkewAndRotation()}function eD(e){e.removeLeadSnapshot()}function Vb(e,t,a){e.translate=ie(t.translate,0,a),e.scale=ie(t.scale,1,a),e.origin=t.origin,e.originPoint=t.originPoint}function jb(e,t,a,r){e.min=ie(t.min,a.min,r),e.max=ie(t.max,a.max,r)}function tD(e,t,a,r){jb(e.x,t.x,a.x,r),jb(e.y,t.y,a.y,r)}function aD(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}var rD={duration:.45,ease:[.4,0,.1,1]},qb=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),zb=qb("applewebkit/")&&!qb("chrome/")?Math.round:ge;function Hb(e){e.min=zb(e.min),e.max=zb(e.max)}function oD(e){Hb(e.x),Hb(e.y)}function Wb(e,t,a){return e==="position"||e==="preserve-aspect"&&!WI(xy(t),xy(a),.2)}function nD(e){var t;return e!==e.root&&((t=e.scroll)===null||t===void 0?void 0:t.wasRoot)}var Gb=rp({attachResizeListener:(e,t)=>Sr(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0});var Sy={current:void 0},op=rp({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Sy.current){let e=new Gb({});e.mount(window),e.setOptions({layoutScroll:!0}),Sy.current=e}return Sy.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"});var Kb={pan:{Feature:Zf},drag:{Feature:Yf,ProjectionNode:op,MeasureLayout:ep}};function Xb(e,t,a){let{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive("whileHover",a==="Start");let o="onHover"+a,n=r[o];n&&Z.postRender(()=>n(t,Lr(t)))}var np=class extends rt{mount(){let{current:t}=this.node;t&&(this.unmount=Ug(t,a=>(Xb(this.node,a,"Start"),r=>Xb(this.node,r,"End"))))}unmount(){}};var sp=class extends rt{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=Wa(Sr(this.node.current,"focus",()=>this.onFocus()),Sr(this.node.current,"blur",()=>this.onBlur()))}unmount(){}};function Qb(e,t,a){let{props:r}=e;e.animationState&&r.whileTap&&e.animationState.setActive("whileTap",a==="Start");let o="onTap"+(a==="End"?"":a),n=r[o];n&&Z.postRender(()=>n(t,Lr(t)))}var ip=class extends rt{mount(){let{current:t}=this.node;t&&(this.unmount=jg(t,a=>(Qb(this.node,a,"Start"),(r,{success:o})=>Qb(this.node,r,o?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}};var Iy=new WeakMap,Ly=new WeakMap,sD=e=>{let t=Iy.get(e.target);t&&t(e)},iD=e=>{e.forEach(sD)};function lD({root:e,...t}){let a=e||document;Ly.has(a)||Ly.set(a,{});let r=Ly.get(a),o=JSON.stringify(t);return r[o]||(r[o]=new IntersectionObserver(iD,{root:e,...t})),r[o]}function Jb(e,t,a){let r=lD(t);return Iy.set(e,a),r.observe(e),()=>{Iy.delete(e),r.unobserve(e)}}var uD={some:0,all:1},lp=class extends rt{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();let{viewport:t={}}=this.node.getProps(),{root:a,margin:r,amount:o="some",once:n}=t,s={root:a?a.current:void 0,rootMargin:r,threshold:typeof o=="number"?o:uD[o]},i=l=>{let{isIntersecting:u}=l;if(this.isInView===u||(this.isInView=u,n&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);let{onViewportEnter:d,onViewportLeave:c}=this.node.getProps(),f=u?d:c;f&&f(l)};return Jb(this.node.current,s,i)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;let{props:t,prevProps:a}=this.node;["amount","margin","root"].some(dD(t,a))&&this.startObserver()}unmount(){}};function dD({viewport:e={}},{viewport:t={}}={}){return a=>e[a]!==t[a]}var Yb={inView:{Feature:lp},tap:{Feature:ip},focus:{Feature:sp},hover:{Feature:np}};var Zb={layout:{ProjectionNode:op,MeasureLayout:ep}};var ok=N(W(),1);var Iu={current:null},up={current:!1};function ek(){if(up.current=!0,!!Bs)if(window.matchMedia){let e=window.matchMedia("(prefers-reduced-motion)"),t=()=>Iu.current=e.matches;e.addListener(t),t()}else Iu.current=!1}var cD=[...Qg,$e,At],tk=e=>cD.find(Df(e));var by=new WeakMap;function ak(e,t,a){for(let r in t){let o=t[r],n=a[r];if(Se(o))e.addValue(r,o);else if(Se(n))e.addValue(r,Cr(o,{owner:e}));else if(n!==o)if(e.hasValue(r)){let s=e.getValue(r);s.liveStyle===!0?s.jump(o):s.hasAnimated||s.set(o)}else{let s=e.getStaticValue(r);e.addValue(r,Cr(s!==void 0?s:o,{owner:e}))}}for(let r in a)t[r]===void 0&&e.removeValue(r);return t}var rk=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],dp=class{scrapeMotionValuesFromProps(t,a,r){return{}}constructor({parent:t,props:a,presenceContext:r,reducedMotionConfig:o,blockInitialAnimation:n,visualState:s},i={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=xo,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=()=>{let g=vt.now();this.renderScheduledAt<g&&(this.renderScheduledAt=g,Z.render(this.render,!1,!0))};let{latestValues:l,renderState:u,onUpdate:d}=s;this.onUpdate=d,this.latestValues=l,this.baseTarget={...l},this.initialValues=a.initial?{...l}:{},this.renderState=u,this.parent=t,this.props=a,this.presenceContext=r,this.depth=t?t.depth+1:0,this.reducedMotionConfig=o,this.options=i,this.blockInitialAnimation=!!n,this.isControllingVariants=hn(a),this.isVariantNode=Yc(a),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);let{willChange:c,...f}=this.scrapeMotionValuesFromProps(a,{},this);for(let g in f){let x=f[g];l[g]!==void 0&&Se(x)&&x.set(l[g],!1)}}mount(t){this.current=t,by.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((a,r)=>this.bindToMotionValue(r,a)),up.current||ek(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:Iu.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){by.delete(this.current),this.projection&&this.projection.unmount(),ea(this.notifyUpdate),ea(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(let t in this.events)this.events[t].clear();for(let t in this.features){let a=this.features[t];a&&(a.unmount(),a.isMounted=!1)}this.current=null}bindToMotionValue(t,a){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();let r=Vt.has(t),o=a.on("change",i=>{this.latestValues[t]=i,this.props.onUpdate&&Z.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0)}),n=a.on("renderRequest",this.scheduleRender),s;window.MotionCheckAppearSync&&(s=window.MotionCheckAppearSync(this,t,a)),this.valueSubscriptions.set(t,()=>{o(),n(),s&&s(),a.owner&&a.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 yr){let a=yr[t];if(!a)continue;let{isEnabled:r,Feature:o}=a;if(!this.features[t]&&o&&r(this.props)&&(this.features[t]=new o(this)),this.features[t]){let n=this.features[t];n.isMounted?n.update():(n.mount(),n.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Te()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,a){this.latestValues[t]=a}update(t,a){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=a;for(let r=0;r<rk.length;r++){let o=rk[r];this.propEventSubscriptions[o]&&(this.propEventSubscriptions[o](),delete this.propEventSubscriptions[o]);let n="on"+o,s=t[n];s&&(this.propEventSubscriptions[o]=this.on(o,s))}this.prevMotionValues=ak(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){let a=this.getClosestVariantNode();if(a)return a.variantChildren&&a.variantChildren.add(t),()=>a.variantChildren.delete(t)}addValue(t,a){let r=this.values.get(t);a!==r&&(r&&this.removeValue(t),this.bindToMotionValue(t,a),this.values.set(t,a),this.latestValues[t]=a.get())}removeValue(t){this.values.delete(t);let a=this.valueSubscriptions.get(t);a&&(a(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,a){if(this.props.values&&this.props.values[t])return this.props.values[t];let r=this.values.get(t);return r===void 0&&a!==void 0&&(r=Cr(a===null?void 0:a,{owner:this}),this.addValue(t,r)),r}readValue(t,a){var r;let o=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:(r=this.getBaseTargetFromProps(this.props,t))!==null&&r!==void 0?r:this.readValueFromInstance(this.current,t,this.options);return o!=null&&(typeof o=="string"&&(Ef(o)||Af(o))?o=parseFloat(o):!tk(o)&&At.test(a)&&(o=_f(t,a)),this.setBaseTarget(t,Se(o)?o.get():o)),Se(o)?o.get():o}setBaseTarget(t,a){this.baseTarget[t]=a}getBaseTarget(t){var a;let{initial:r}=this.props,o;if(typeof r=="string"||typeof r=="object"){let s=Hs(this.props,r,(a=this.presenceContext)===null||a===void 0?void 0:a.custom);s&&(o=s[t])}if(r&&o!==void 0)return o;let n=this.getBaseTargetFromProps(this.props,t);return n!==void 0&&!Se(n)?n:this.initialValues[t]!==void 0&&o===void 0?void 0:this.baseTarget[t]}on(t,a){return this.events[t]||(this.events[t]=new mo),this.events[t].add(a)}notify(t,...a){this.events[t]&&this.events[t].notify(...a)}};var wi=class extends dp{constructor(){super(...arguments),this.KeyframeResolver=ci}sortInstanceNodePosition(t,a){return t.compareDocumentPosition(a)&2?1:-1}getBaseTargetFromProps(t,a){return t.style?t.style[a]:void 0}removeValueFromRenderState(t,{vars:a,style:r}){delete a[t],delete r[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);let{children:t}=this.props;Se(t)&&(this.childSubscription=t.on("change",a=>{this.current&&(this.current.textContent=`${a}`)}))}};function fD(e){return window.getComputedStyle(e)}var cp=class extends wi{constructor(){super(...arguments),this.type="html",this.renderInstance=lf}readValueFromInstance(t,a){if(Vt.has(a)){let r=di(a);return r&&r.default||0}else{let r=fD(t),o=(of(a)?r.getPropertyValue(a):r[a])||0;return typeof o=="string"?o.trim():o}}measureInstanceViewportBox(t,{transformPagePoint:a}){return fy(t,a)}build(t,a,r){Ks(t,a,r.transformTemplate)}scrapeMotionValuesFromProps(t,a,r){return Zs(t,a,r)}};var fp=class extends wi{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Te}getBaseTargetFromProps(t,a){return t[a]}readValueFromInstance(t,a){if(Vt.has(a)){let r=di(a);return r&&r.default||0}return a=uf.has(a)?a:Vs(a),t.getAttribute(a)}scrapeMotionValuesFromProps(t,a,r){return ff(t,a,r)}build(t,a,r){Xs(t,a,this.isSVGTag,r.transformTemplate)}renderInstance(t,a,r,o){df(t,a,r,o)}mount(t){this.isSVGTag=Js(t.tagName),super.mount(t)}};var nk=(e,t)=>zs(e)?new fp(t):new cp(t,{allowProjection:e!==ok.Fragment});var sk=ML({...NI,...Yb,...Kb,...Zb},nk);var ky=eL(sk);var bu=N(le(),1);function ik({x:e,y:t,visible:a,onClick:r=!1}){return(0,bu.jsx)(Ag,{children:a&&(0,bu.jsx)(ky.div,{className:"fixed pointer-events-none z-[9999]",initial:{opacity:0,scale:.5},animate:{opacity:1,scale:1,x:e,y:t},exit:{opacity:0,scale:.5},transition:{type:"spring",stiffness:200,damping:20},style:{left:0,top:0},children:(0,bu.jsx)("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,bu.jsx)("path",{d:"M3 3L10.07 19.97L12.58 12.58L19.97 10.07L3 3Z",fill:"#C4B5FD"})})})})}var Ci=N(W(),1);function lk(){let[e,t]=Ci.useState({x:0,y:0,visible:!1,onClick:!1}),a=Ci.useCallback(n=>{let s=document.querySelector(n.selector);if(s){let i=s.getBoundingClientRect(),l=n.offset?.x||0,u=n.offset?.y||0;t({x:i.left+i.width/2+l,y:i.top+i.height/2+u,visible:!0,onClick:n.onClick||!1})}},[]),r=Ci.useCallback(()=>{t(n=>({...n,visible:!1}))},[]),o=Ci.useCallback(()=>{t(n=>({...n,visible:!0}))},[]);return{cursorState:e,moveTo:a,hide:r,show:o}}var br=N(W(),1);function uk({productBackendUrl:e,sessionId:t,enabled:a=!0}){let[r,o]=br.useState({status:"idle"}),n=br.useRef(null),s=br.useCallback(async()=>{if(!e||!a){console.log("[useUserAuth] Skipping auth - productBackendUrl:",e,"enabled:",a),o({status:"idle"});return}console.log("[useUserAuth] Starting auth request to product backend..."),console.log("[useUserAuth] Product backend URL:",e),console.log("[useUserAuth] Full request URL:",`${e}/users/me`),o({status:"loading"});try{let l=await fetch(`${e}/users/me`,{method:"GET",credentials:"include",headers:{Accept:"application/json"}});if(console.log("[useUserAuth] Response received - status:",l.status,"ok:",l.ok),!l.ok)throw console.log("[useUserAuth] Auth request failed with status:",l.status),l.status===401?new Error("Please log in to use the chat assistant."):l.status===403?new Error("You do not have permission to access this feature."):new Error(`Authentication failed (${l.status})`);let u=await l.json();console.log("[useUserAuth] Auth SUCCESS - parsed user data:"),console.log("[useUserAuth] id:",u.id),console.log("[useUserAuth] email:",u.email),console.log("[useUserAuth] name:",u.name),console.log("[useUserAuth] role:",u.role),console.log("[useUserAuth] isInternal:",u.isInternal),console.log("[useUserAuth] agreementsSigned:",u.agreementsSigned),console.log("[useUserAuth] lastLoginTime:",u.lastLoginTime),o({status:"authenticated",user:u})}catch(l){console.log("[useUserAuth] Auth ERROR:",l);let u=l instanceof Error?l.message:"Unable to verify your identity. Please try again.";o({status:"error",error:u})}},[e,a]);br.useEffect(()=>{t!==n.current&&(n.current=t,s())},[t,s]);let i=br.useCallback(()=>{s()},[s]);return{authState:r,retry:i}}var pp=N(W(),1);function dk({agentUrl:e,orgId:t}){let[a,r]=pp.useState({status:"idle",config:null,error:null});return pp.useEffect(()=>{if(!e||!t){console.log("[useOrgConfig] Skipping - missing agentUrl or orgId",{agentUrl:e,orgId:t});return}(async()=>{r({status:"loading",config:null,error:null});let n=`${e}/org/${t}/config`;console.log("[useOrgConfig] Fetching org config from:",n);try{let s=await fetch(n,{method:"GET",headers:{Accept:"application/json"}});if(!s.ok)throw new Error(`Failed to fetch org config (${s.status})`);let i=await s.json();console.log("[useOrgConfig] Received config:",i),r({status:"success",config:i,error:null})}catch(s){let i=s instanceof Error?s.message:"Failed to fetch org config";console.error("[useOrgConfig] Error:",i),r({status:"error",config:null,error:i})}})()},[e,t]),a}var Si=N(le(),1);function wt({className:e,...t}){return(0,Si.jsx)("div",{"data-slot":"card",className:Jt("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...t})}function Ga({className:e,...t}){return(0,Si.jsx)("div",{"data-slot":"card-header",className:Jt("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",e),...t})}function Ka({className:e,...t}){return(0,Si.jsx)("div",{"data-slot":"card-title",className:Jt("leading-none font-semibold",e),...t})}function Py({className:e,...t}){return(0,Si.jsx)("div",{"data-slot":"card-description",className:Jt("text-muted-foreground text-sm",e),...t})}function Ct({className:e,...t}){return(0,Si.jsx)("div",{"data-slot":"card-content",className:Jt("px-6",e),...t})}var C=N(le(),1),Ty=e=>new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),mp=(e,t="USD")=>new Intl.NumberFormat("en-US",{style:"currency",currency:t}).format(e),Ay=e=>{switch(e){case"Enterprise":return un;case"Professional":return ru;default:return Xl}},hp=e=>{switch(e){case"Enterprise":return"bg-purple-50 text-purple-700 border-purple-200";case"Professional":return"bg-blue-50 text-blue-700 border-blue-200";default:return"bg-gray-50 text-gray-700 border-gray-200"}};function ku({status:e,type:t="default"}){let r=(()=>{let n=e.toLowerCase();if(t==="transaction")switch(n){case"paid":return{color:"bg-emerald-50 text-emerald-700 border-emerald-200",icon:at};case"failed":return{color:"bg-red-50 text-red-700 border-red-200",icon:ka};case"pending":return{color:"bg-amber-50 text-amber-700 border-amber-200",icon:sn};case"refunded":return{color:"bg-slate-50 text-slate-700 border-slate-200",icon:Es};default:return{color:"bg-gray-50 text-gray-700 border-gray-200",icon:ba}}if(t==="subscription")switch(n){case"active":return{color:"bg-emerald-50 text-emerald-700 border-emerald-200",icon:at};case"cancelled":return{color:"bg-slate-50 text-slate-700 border-slate-200",icon:ka};case"past_due":return{color:"bg-red-50 text-red-700 border-red-200",icon:ba};case"trialing":return{color:"bg-blue-50 text-blue-700 border-blue-200",icon:sn};default:return{color:"bg-gray-50 text-gray-700 border-gray-200",icon:ba}}switch(n){case"active":return{color:"bg-emerald-50 text-emerald-700 border-emerald-200",icon:at};case"inactive":return{color:"bg-slate-50 text-slate-700 border-slate-200",icon:ka};default:return{color:"bg-gray-50 text-gray-700 border-gray-200",icon:ba}}})(),o=r.icon;return(0,C.jsxs)("span",{className:`inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium border ${r.color}`,children:[(0,C.jsx)(o,{className:"h-3 w-3"}),e]})}function pD({subscription:e}){let t=Ay(e.plan);return(0,C.jsxs)(wt,{className:"border-gray-200 shadow-sm bg-white overflow-hidden",children:[(0,C.jsx)("div",{className:`h-1 ${e.status==="active"?"bg-emerald-500":e.status==="past_due"?"bg-red-500":"bg-slate-300"}`}),(0,C.jsx)(Ga,{className:"pb-3",children:(0,C.jsxs)("div",{className:"flex items-start justify-between",children:[(0,C.jsxs)("div",{className:"space-y-1",children:[(0,C.jsxs)(Ka,{className:"text-base font-semibold text-gray-900 flex items-center gap-2",children:[(0,C.jsx)(ln,{className:"h-4 w-4 text-gray-500"}),e.id]}),e.customer_email&&(0,C.jsxs)(Py,{className:"text-sm text-gray-500 flex items-center gap-1.5",children:[(0,C.jsx)(Rs,{className:"h-3 w-3"}),e.customer_email]})]}),(0,C.jsx)(ku,{status:e.status,type:"subscription"})]})}),(0,C.jsx)(Ct,{className:"pt-0",children:(0,C.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,C.jsxs)("div",{className:"space-y-3",children:[(0,C.jsxs)("div",{children:[(0,C.jsx)("div",{className:"text-xs text-gray-500 mb-1",children:"Plan"}),(0,C.jsxs)("span",{className:`inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md text-xs font-medium border ${hp(e.plan)}`,children:[(0,C.jsx)(t,{className:"h-3 w-3"}),e.plan]})]}),(0,C.jsxs)("div",{children:[(0,C.jsx)("div",{className:"text-xs text-gray-500 mb-1",children:"Billing"}),(0,C.jsxs)("div",{className:"text-sm font-medium text-gray-900",children:[mp(e.amount,e.currency)," / ",e.billing_cycle]})]})]}),(0,C.jsxs)("div",{className:"space-y-3",children:[(0,C.jsxs)("div",{children:[(0,C.jsx)("div",{className:"text-xs text-gray-500 mb-1",children:"Current Period"}),(0,C.jsxs)("div",{className:"text-sm text-gray-700",children:[Ty(e.current_period_start)," - ",Ty(e.current_period_end)]})]}),(0,C.jsxs)("div",{children:[(0,C.jsx)("div",{className:"text-xs text-gray-500 mb-1",children:"Created"}),(0,C.jsx)("div",{className:"text-sm text-gray-700",children:Ty(e.created_at)})]})]})]})})]})}function mD({subscriptions:e,maxItems:t=5}){let a=e.slice(0,t),r=e.length>t;return e.length===0?(0,C.jsx)(wt,{className:"border-gray-200 shadow-sm bg-white",children:(0,C.jsxs)(Ct,{className:"py-8 text-center",children:[(0,C.jsx)(ln,{className:"h-10 w-10 text-gray-300 mx-auto mb-3"}),(0,C.jsx)("p",{className:"text-sm text-gray-500",children:"No subscriptions found"})]})}):(0,C.jsxs)(wt,{className:"border-gray-200 shadow-sm bg-white overflow-hidden",children:[(0,C.jsx)(Ga,{className:"pb-2 border-b border-gray-100",children:(0,C.jsxs)(Ka,{className:"text-sm font-medium text-gray-700 flex items-center gap-2",children:[(0,C.jsx)(ln,{className:"h-4 w-4"}),e.length," Subscription",e.length!==1?"s":""]})}),(0,C.jsxs)(Ct,{className:"p-0",children:[(0,C.jsx)("div",{className:"divide-y divide-gray-100",children:a.map(o=>{let n=Ay(o.plan);return(0,C.jsx)("div",{className:"px-4 py-3 hover:bg-gray-50 transition-colors",children:(0,C.jsxs)("div",{className:"flex items-center justify-between",children:[(0,C.jsxs)("div",{className:"flex items-center gap-3 min-w-0",children:[(0,C.jsx)("div",{className:`p-2 rounded-lg ${hp(o.plan).replace("text-","text-").replace("border-","bg-").split(" ")[0]}`,children:(0,C.jsx)(n,{className:"h-4 w-4"})}),(0,C.jsxs)("div",{className:"min-w-0",children:[(0,C.jsx)("div",{className:"text-sm font-medium text-gray-900 truncate",children:o.customer_email||o.customer_id}),(0,C.jsxs)("div",{className:"text-xs text-gray-500",children:[o.plan," \xB7 ",mp(o.amount,o.currency),"/",o.billing_cycle]})]})]}),(0,C.jsx)(ku,{status:o.status,type:"subscription"})]})},o.id)})}),r&&(0,C.jsx)("div",{className:"px-4 py-2 bg-gray-50 border-t border-gray-100 text-center",children:(0,C.jsxs)("span",{className:"text-xs text-gray-500",children:["+",e.length-t," more subscription",e.length-t!==1?"s":""]})})]})]})}function hD({customer:e}){let t=Ay(e.subscription);return(0,C.jsxs)(wt,{className:"border-gray-200 shadow-sm bg-white overflow-hidden",children:[(0,C.jsx)("div",{className:`h-1 ${e.status==="active"?"bg-emerald-500":"bg-slate-300"}`}),(0,C.jsx)(Ga,{className:"pb-3",children:(0,C.jsxs)("div",{className:"flex items-start justify-between",children:[(0,C.jsx)("div",{className:"flex items-center gap-3",children:(0,C.jsxs)("div",{children:[(0,C.jsx)(Ka,{className:"text-base font-semibold text-gray-900",children:e.name}),(0,C.jsxs)(Py,{className:"text-sm text-gray-500 flex items-center gap-1",children:[(0,C.jsx)(Rs,{className:"h-3 w-3"}),e.email]})]})}),(0,C.jsx)(ku,{status:e.status,type:"customer"})]})}),(0,C.jsx)(Ct,{className:"pt-0",children:(0,C.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,C.jsxs)("div",{className:"space-y-3",children:[(0,C.jsxs)("div",{children:[(0,C.jsx)("div",{className:"text-xs text-gray-500 mb-1",children:"Plan"}),(0,C.jsxs)("span",{className:`inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md text-xs font-medium border ${hp(e.subscription)}`,children:[(0,C.jsx)(t,{className:"h-3 w-3"}),e.subscription]})]}),(0,C.jsxs)("div",{children:[(0,C.jsx)("div",{className:"text-xs text-gray-500 mb-1",children:"Revenue"}),(0,C.jsxs)("div",{className:"text-sm font-medium text-gray-900 flex items-center gap-1",children:[(0,C.jsx)(dn,{className:"h-3 w-3 text-emerald-500"}),e.revenue]})]})]}),(0,C.jsxs)("div",{className:"space-y-3",children:[(0,C.jsxs)("div",{children:[(0,C.jsx)("div",{className:"text-xs text-gray-500 mb-1",children:"Location"}),(0,C.jsxs)("div",{className:"text-sm text-gray-700 flex items-center gap-1",children:[(0,C.jsx)(_s,{className:"h-3 w-3 text-gray-400"}),e.location||"Not specified"]})]}),(0,C.jsxs)("div",{children:[(0,C.jsx)("div",{className:"text-xs text-gray-500 mb-1",children:"Customer Since"}),(0,C.jsxs)("div",{className:"text-sm text-gray-700 flex items-center gap-1",children:[(0,C.jsx)(Jl,{className:"h-3 w-3 text-gray-400"}),e.joinDate]})]})]})]})})]})}function gD({customers:e,maxItems:t=5}){let a=e.slice(0,t),r=e.length>t;return e.length===0?(0,C.jsx)(wt,{className:"border-gray-200 shadow-sm bg-white",children:(0,C.jsxs)(Ct,{className:"py-8 text-center",children:[(0,C.jsx)(Ms,{className:"h-10 w-10 text-gray-300 mx-auto mb-3"}),(0,C.jsx)("p",{className:"text-sm text-gray-500",children:"No customers found"})]})}):(0,C.jsxs)(wt,{className:"border-gray-200 shadow-sm bg-white overflow-hidden",children:[(0,C.jsx)(Ga,{className:"pb-2 border-b border-gray-100",children:(0,C.jsxs)(Ka,{className:"text-sm font-medium text-gray-700 flex items-center gap-2",children:[(0,C.jsx)(Ms,{className:"h-4 w-4"}),e.length," Customer",e.length!==1?"s":""]})}),(0,C.jsxs)(Ct,{className:"p-0",children:[(0,C.jsx)("div",{className:"divide-y divide-gray-100",children:a.map(o=>(0,C.jsx)("div",{className:"px-4 py-3 hover:bg-gray-50 transition-colors",children:(0,C.jsxs)("div",{className:"flex items-center justify-between",children:[(0,C.jsx)("div",{className:"flex items-center gap-3 min-w-0",children:(0,C.jsxs)("div",{className:"min-w-0",children:[(0,C.jsx)("div",{className:"text-sm font-medium text-gray-900 truncate",children:o.name}),(0,C.jsx)("div",{className:"text-xs text-gray-500 truncate",children:o.email})]})}),(0,C.jsxs)("div",{className:"flex items-center gap-2",children:[(0,C.jsx)("span",{className:`px-2 py-0.5 rounded text-xs font-medium ${hp(o.subscription)}`,children:o.subscription}),(0,C.jsx)(ku,{status:o.status,type:"customer"})]})]})},o.id))}),r&&(0,C.jsx)("div",{className:"px-4 py-2 bg-gray-50 border-t border-gray-100 text-center",children:(0,C.jsxs)("span",{className:"text-xs text-gray-500",children:["+",e.length-t," more customer",e.length-t!==1?"s":""]})})]})]})}function ck({transactions:e,maxItems:t=5}){let a=e.slice(0,t),r=e.length>t;return e.length===0?(0,C.jsx)(wt,{className:"border-gray-200 shadow-sm bg-white",children:(0,C.jsxs)(Ct,{className:"py-8 text-center",children:[(0,C.jsx)(dn,{className:"h-10 w-10 text-gray-300 mx-auto mb-3"}),(0,C.jsx)("p",{className:"text-sm text-gray-500",children:"No transactions found"})]})}):(0,C.jsxs)(wt,{className:"border-gray-200 shadow-sm bg-white overflow-hidden",children:[(0,C.jsx)(Ga,{className:"pb-2 border-b border-gray-100",children:(0,C.jsxs)(Ka,{className:"text-sm font-medium text-gray-700 flex items-center gap-2",children:[(0,C.jsx)(dn,{className:"h-4 w-4"}),e.length," Transaction",e.length!==1?"s":""]})}),(0,C.jsxs)(Ct,{className:"p-0",children:[(0,C.jsx)("div",{className:"divide-y divide-gray-100",children:a.map(o=>(0,C.jsx)("div",{className:"px-4 py-3 hover:bg-gray-50 transition-colors",children:(0,C.jsxs)("div",{className:"flex items-center justify-between",children:[(0,C.jsxs)("div",{className:"flex items-center gap-3 min-w-0",children:[(0,C.jsx)("div",{className:`p-2 rounded-lg ${o.status==="paid"?"bg-emerald-50":o.status==="failed"?"bg-red-50":o.status==="refunded"?"bg-slate-50":"bg-amber-50"}`,children:o.status==="paid"?(0,C.jsx)(at,{className:"h-4 w-4 text-emerald-600"}):o.status==="failed"?(0,C.jsx)(ka,{className:"h-4 w-4 text-red-600"}):o.status==="refunded"?(0,C.jsx)(Es,{className:"h-4 w-4 text-slate-600"}):(0,C.jsx)(sn,{className:"h-4 w-4 text-amber-600"})}),(0,C.jsxs)("div",{className:"min-w-0",children:[(0,C.jsx)("div",{className:"text-sm font-medium text-gray-900 truncate",children:o.customer}),(0,C.jsxs)("div",{className:"text-xs text-gray-500",children:[o.date,o.decline_reason&&(0,C.jsxs)("span",{className:"text-red-500 ml-2",children:["\xB7 ",o.decline_reason]})]})]})]}),(0,C.jsxs)("div",{className:"flex items-center gap-3",children:[(0,C.jsxs)("span",{className:`text-sm font-semibold ${o.status==="paid"?"text-emerald-600":o.status==="failed"?"text-red-600":o.status==="refunded"?"text-slate-600":"text-amber-600"}`,children:[o.status==="refunded"?"-":"",o.amount]}),(0,C.jsx)(ku,{status:o.status,type:"transaction"})]})]})},o.id))}),r&&(0,C.jsx)("div",{className:"px-4 py-2 bg-gray-50 border-t border-gray-100 text-center",children:(0,C.jsxs)("span",{className:"text-xs text-gray-500",children:["+",e.length-t," more transaction",e.length-t!==1?"s":""]})})]})]})}function yD({apiKeys:e}){return e.length===0?(0,C.jsx)(wt,{className:"border-gray-200 shadow-sm bg-white",children:(0,C.jsxs)(Ct,{className:"py-8 text-center",children:[(0,C.jsx)(As,{className:"h-10 w-10 text-gray-300 mx-auto mb-3"}),(0,C.jsx)("p",{className:"text-sm text-gray-500",children:"No API keys found"})]})}):(0,C.jsxs)(wt,{className:"border-gray-200 shadow-sm bg-white overflow-hidden",children:[(0,C.jsx)(Ga,{className:"pb-2 border-b border-gray-100",children:(0,C.jsxs)(Ka,{className:"text-sm font-medium text-gray-700 flex items-center gap-2",children:[(0,C.jsx)(As,{className:"h-4 w-4"}),e.length," API Key",e.length!==1?"s":""]})}),(0,C.jsx)(Ct,{className:"p-0",children:(0,C.jsx)("div",{className:"divide-y divide-gray-100",children:e.map((t,a)=>(0,C.jsx)("div",{className:"px-4 py-3 hover:bg-gray-50 transition-colors",children:(0,C.jsxs)("div",{className:"flex items-center justify-between",children:[(0,C.jsxs)("div",{className:"min-w-0",children:[(0,C.jsx)("div",{className:"text-sm font-medium text-gray-900",children:t.name}),(0,C.jsxs)("div",{className:"text-xs text-gray-500 font-mono",children:[t.key.slice(0,12),"...",t.key.slice(-4)]})]}),(0,C.jsxs)("div",{className:"text-xs text-gray-500",children:["Last used: ",t.lastUsed]})]})},a))})})]})}function xD({sessions:e}){let t=a=>{let r=a.toLowerCase();return r.includes("mobile")||r.includes("iphone")||r.includes("android")?tu:Zl};return e.length===0?(0,C.jsx)(wt,{className:"border-gray-200 shadow-sm bg-white",children:(0,C.jsxs)(Ct,{className:"py-8 text-center",children:[(0,C.jsx)(Ds,{className:"h-10 w-10 text-gray-300 mx-auto mb-3"}),(0,C.jsx)("p",{className:"text-sm text-gray-500",children:"No active sessions"})]})}):(0,C.jsxs)(wt,{className:"border-gray-200 shadow-sm bg-white overflow-hidden",children:[(0,C.jsx)(Ga,{className:"pb-2 border-b border-gray-100",children:(0,C.jsxs)(Ka,{className:"text-sm font-medium text-gray-700 flex items-center gap-2",children:[(0,C.jsx)(Ds,{className:"h-4 w-4"}),e.length," Active Session",e.length!==1?"s":""]})}),(0,C.jsx)(Ct,{className:"p-0",children:(0,C.jsx)("div",{className:"divide-y divide-gray-100",children:e.map((a,r)=>{let o=t(a.device);return(0,C.jsx)("div",{className:"px-4 py-3 hover:bg-gray-50 transition-colors",children:(0,C.jsxs)("div",{className:"flex items-center justify-between",children:[(0,C.jsxs)("div",{className:"flex items-center gap-3",children:[(0,C.jsx)("div",{className:"p-2 rounded-lg bg-gray-100",children:(0,C.jsx)(o,{className:"h-4 w-4 text-gray-600"})}),(0,C.jsxs)("div",{children:[(0,C.jsx)("div",{className:"text-sm font-medium text-gray-900",children:a.device}),(0,C.jsxs)("div",{className:"text-xs text-gray-500 flex items-center gap-1",children:[(0,C.jsx)(_s,{className:"h-3 w-3"}),a.location]})]})]}),(0,C.jsx)("div",{className:"text-xs text-gray-500",children:a.time})]})},r)})})})]})}function vD({stats:e}){return(0,C.jsxs)(wt,{className:"border-gray-200 shadow-sm bg-white overflow-hidden",children:[(0,C.jsx)(Ga,{className:"pb-2 border-b border-gray-100",children:(0,C.jsxs)(Ka,{className:"text-sm font-medium text-gray-700 flex items-center gap-2",children:[(0,C.jsx)(au,{className:"h-4 w-4"}),"Dashboard Overview"]})}),(0,C.jsx)(Ct,{className:"p-4",children:(0,C.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[e.revenue&&(0,C.jsxs)("div",{className:"p-3 rounded-lg bg-emerald-50 border border-emerald-100",children:[(0,C.jsx)("div",{className:"text-xs text-emerald-600 font-medium mb-1",children:"Revenue"}),(0,C.jsx)("div",{className:"text-lg font-bold text-emerald-700",children:mp(e.revenue.total)}),e.revenue.change!==0&&(0,C.jsxs)("div",{className:`text-xs ${e.revenue.change>0?"text-emerald-600":"text-red-600"}`,children:[e.revenue.change>0?"+":"",e.revenue.change,"% from last period"]})]}),e.subscriptions&&(0,C.jsxs)("div",{className:"p-3 rounded-lg bg-blue-50 border border-blue-100",children:[(0,C.jsx)("div",{className:"text-xs text-blue-600 font-medium mb-1",children:"Subscriptions"}),(0,C.jsxs)("div",{className:"text-lg font-bold text-blue-700",children:[e.subscriptions.active," active"]}),(0,C.jsxs)("div",{className:"text-xs text-blue-600",children:[e.subscriptions.total," total"]})]}),e.customers&&(0,C.jsxs)("div",{className:"p-3 rounded-lg bg-purple-50 border border-purple-100",children:[(0,C.jsx)("div",{className:"text-xs text-purple-600 font-medium mb-1",children:"Customers"}),(0,C.jsx)("div",{className:"text-lg font-bold text-purple-700",children:e.customers.total}),e.customers.new>0&&(0,C.jsxs)("div",{className:"text-xs text-purple-600",children:["+",e.customers.new," new this period"]})]}),e.transactions&&(0,C.jsxs)("div",{className:"p-3 rounded-lg bg-amber-50 border border-amber-100",children:[(0,C.jsx)("div",{className:"text-xs text-amber-600 font-medium mb-1",children:"Transactions"}),(0,C.jsxs)("div",{className:"text-lg font-bold text-amber-700",children:[e.transactions.successful," successful"]}),e.transactions.failed>0&&(0,C.jsxs)("div",{className:"text-xs text-red-600",children:[e.transactions.failed," failed"]})]})]})})]})}function wD({customers:e}){return e.length===0?(0,C.jsx)(wt,{className:"border-gray-200 shadow-sm bg-white",children:(0,C.jsxs)(Ct,{className:"py-8 text-center",children:[(0,C.jsx)(un,{className:"h-10 w-10 text-gray-300 mx-auto mb-3"}),(0,C.jsx)("p",{className:"text-sm text-gray-500",children:"No top customers data"})]})}):(0,C.jsxs)(wt,{className:"border-gray-200 shadow-sm bg-white overflow-hidden",children:[(0,C.jsx)(Ga,{className:"pb-2 border-b border-gray-100",children:(0,C.jsxs)(Ka,{className:"text-sm font-medium text-gray-700 flex items-center gap-2",children:[(0,C.jsx)(un,{className:"h-4 w-4 text-amber-500"}),"Top Customers"]})}),(0,C.jsx)(Ct,{className:"p-0",children:(0,C.jsx)("div",{className:"divide-y divide-gray-100",children:e.map((t,a)=>(0,C.jsx)("div",{className:"px-4 py-3 hover:bg-gray-50 transition-colors",children:(0,C.jsxs)("div",{className:"flex items-center justify-between",children:[(0,C.jsxs)("div",{className:"flex items-center gap-3 min-w-0",children:[(0,C.jsx)("div",{className:`h-6 w-6 rounded-full flex items-center justify-center text-xs font-bold ${a===0?"bg-amber-100 text-amber-700":a===1?"bg-slate-100 text-slate-700":a===2?"bg-orange-100 text-orange-700":"bg-gray-100 text-gray-700"}`,children:a+1}),(0,C.jsxs)("div",{className:"min-w-0",children:[(0,C.jsx)("div",{className:"text-sm font-medium text-gray-900 truncate",children:t.name}),(0,C.jsx)("div",{className:"text-xs text-gray-500 truncate",children:t.email})]})]}),(0,C.jsx)("div",{className:"text-sm font-semibold text-emerald-600",children:typeof t.revenue=="number"?mp(t.revenue):t.revenue})]})},a))})})]})}function fk({type:e,data:t}){if(!t)return null;switch(e){case"subscription":return(0,C.jsx)(pD,{subscription:t});case"subscriptions":let a=t.subscriptions||t||[];return(0,C.jsx)(mD,{subscriptions:Array.isArray(a)?a:[a]});case"customer":return(0,C.jsx)(hD,{customer:t.customer||t});case"customers":let r=t.customers||t||[];return(0,C.jsx)(gD,{customers:Array.isArray(r)?r:[r]});case"transactions":let o=t.transactions||t||[];return(0,C.jsx)(ck,{transactions:Array.isArray(o)?o:[o]});case"transaction":return(0,C.jsx)(ck,{transactions:[t],maxItems:1});case"dashboard_stats":return(0,C.jsx)(vD,{stats:t});case"top_customers":let n=t.customers||t||[];return(0,C.jsx)(wD,{customers:Array.isArray(n)?n:[n]});case"api_keys":let s=t.api_keys||t||[];return(0,C.jsx)(yD,{apiKeys:Array.isArray(s)?s:[s]});case"sessions":let i=t.sessions||t||[];return(0,C.jsx)(xD,{sessions:Array.isArray(i)?i:[i]});default:return null}}var kn=N(le(),1);function pk({className:e=""}){return(0,kn.jsx)("div",{className:`flex items-center gap-1 px-4 py-3 ${e}`,children:(0,kn.jsxs)("div",{className:"flex items-center gap-1",children:[(0,kn.jsx)("span",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"0ms",animationDuration:"600ms"}}),(0,kn.jsx)("span",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"150ms",animationDuration:"600ms"}}),(0,kn.jsx)("span",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"300ms",animationDuration:"600ms"}})]})})}var p=N(le(),1),CD="0.2.46",SD="http://localhost:5002",Pu=340;function LD(e){return e.replace(/\\\\n/g,`
24
24
  `).replace(/\\\\t/g," ").replace(/\\\\"/g,'"').replace(/\\\\\\\\/g,"\\").replace(/\\n/g,`
25
25
  `).replace(/\\t/g," ").replace(/\\"/g,'"').replace(/\\\\/g,"\\")}function ID(e){if(!e)return null;let t=e.split(`
26
26
  `),a=[],r=null,o=!1,n=[],s="",i=u=>{let d=[],c=u,f=0;for(;c.length>0;){let g=c.match(/^`([^`]+)`/);if(g){d.push((0,p.jsx)("code",{className:"bg-gray-100 px-1 py-0.5 rounded text-xs font-mono",children:g[1]},f++)),c=c.slice(g[0].length);continue}let x=c.match(/^\*\*([^*]+)\*\*/);if(x){d.push((0,p.jsx)("strong",{children:x[1]},f++)),c=c.slice(x[0].length);continue}let w=c.match(/^\*([^*]+)\*/);if(w){d.push((0,p.jsx)("em",{children:w[1]},f++)),c=c.slice(w[0].length);continue}let L=c.match(/^\[([^\]]+)\]\(([^)]+)\)/);if(L){d.push((0,p.jsx)("a",{href:L[2],className:"kite-link",target:"_blank",rel:"noopener noreferrer",children:L[1]},f++)),c=c.slice(L[0].length);continue}let y=c.match(/^(https?:\/\/[^\s<>]+|www\.[^\s<>]+)/);if(y){let S=y[1],I=S.startsWith("www.")?`https://${S}`:S;d.push((0,p.jsx)("a",{href:I,className:"kite-link",target:"_blank",rel:"noopener noreferrer",children:S},f++)),c=c.slice(S.length);continue}let h=c.match(/^([a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,})/);if(h){let S=h[1];d.push((0,p.jsx)("a",{href:`mailto:${S}`,className:"kite-link",children:S},f++)),c=c.slice(S.length);continue}let m=c.search(/[`*\[@h]/);if(m===-1){d.push(c);break}else m===0?(d.push(c[0]),c=c.slice(1)):(d.push(c.slice(0,m)),c=c.slice(m))}return d.length===1?d[0]:(0,p.jsx)(p.Fragment,{children:d})},l=()=>{if(r){let u=r.type==="ul"?"ul":"ol";a.push((0,p.jsx)(u,{className:`${r.type==="ul"?"list-disc":"list-decimal"} ml-4 my-1`,children:r.items.map((d,c)=>(0,p.jsx)("li",{className:"ml-2",children:d},c))},a.length)),r=null}};for(let u=0;u<t.length;u++){let d=t[u];if(d.startsWith("```")){o?(a.push((0,p.jsx)("pre",{className:"bg-gray-100 rounded p-2 my-1 overflow-x-auto",children:(0,p.jsx)("code",{className:"text-xs font-mono",children:n.join(`
27
- `)})},a.length)),o=!1,n=[],s=""):(l(),o=!0,s=d.slice(3).trim());continue}if(o){n.push(d);continue}let c=d.match(/^(#{1,6})\s+(.+)/);if(c){l();let x=c[1].length,w=i(c[2]),L=x===1?"text-lg font-bold my-1":x===2?"text-base font-bold my-1":"text-sm font-semibold my-1";a.push((0,p.jsx)("div",{className:L,children:w},a.length));continue}let f=d.match(/^[-*]\s+(.+)/);if(f){(!r||r.type!=="ul")&&(l(),r={type:"ul",items:[]}),r.items.push(i(f[1]));continue}let g=d.match(/^\d+[.)]\s+(.+)/);if(g){(!r||r.type!=="ol")&&(l(),r={type:"ol",items:[]}),r.items.push(i(g[1]));continue}if(d.trim()===""){l(),a.push((0,p.jsx)("div",{className:"h-2"},a.length));continue}if(d.match(/^[-*_]{3,}$/)){l(),a.push((0,p.jsx)("hr",{className:"my-2 border-gray-200"},a.length));continue}l(),a.push((0,p.jsx)("div",{children:i(d)},a.length))}return l(),(0,p.jsx)(p.Fragment,{children:a})}var bD=[{id:"changing-layouts",label:"Changing layouts",prompt:"How do I change the layout of my profiles or folders?",icon:"layout"},{id:"bulk-uploads",label:"Bulk uploads",prompt:"How do I bulk upload profiles using a CSV file?",icon:"upload"},{id:"example-setups",label:"Example setups",prompt:"Can you show me some example folder setups?",icon:"setup"}],mk=[{id:"customers",title:"Customer Management",topics:[{id:"add-customer",label:"Add a new customer",prompt:"How do I add a new customer to the system and what information is required?"},{id:"customer-details",label:"View customer details",prompt:"Show me how to view and edit customer information and their payment history."}]},{id:"payments",title:"Payment Processing",topics:[{id:"process-payment",label:"Process a payment",prompt:"How do I process a one-time payment for a customer?"},{id:"refund-payment",label:"Issue a refund",prompt:"Walk me through issuing a refund for a customer payment."}]},{id:"subscriptions",title:"Subscription Management",topics:[{id:"create-subscription",label:"Create a subscription",prompt:"How do I set up a new subscription plan for a customer?"},{id:"update-subscription",label:"Update subscription tier",prompt:"How can I change a customer's subscription plan or upgrade them?"}]},{id:"billing",title:"Billing",topics:[{id:"payment-methods",label:"Manage payment methods",prompt:"How do customers add or update their payment methods?"}]}],Ry={"getting-started":{id:"getting-started",title:"Getting started",steps:[{text:"Step 1: Let's open the Customers page. This is where you'll manage all your customers - you can view, add, and edit customer information here.",navigation:{page:"customers"},cursorTarget:{selector:'[data-page="customers"]',offset:{x:0,y:0},onClick:!0}},{text:"Step 2: Now let's open the Add customer dialog. This is where you'll enter information for your first customer, including their name, email, and other details.",navigation:{page:"customers"},cursorTarget:{selector:'[data-testid="add-customer-button"]',offset:{x:0,y:0},onClick:!0}},{text:"Step 3: Let's open the Settings page. This is where you manage your account settings, company information, and preferences. We're going to verify your company address is correct.",navigation:{page:"settings",subtab:"general"},cursorTarget:{selector:'[data-page="settings"]',offset:{x:0,y:0},onClick:!0}},{text:"Step 4: Here's the address field in the Company Information section. It's important to verify this address is accurate since it's used for billing and shipping purposes. Make sure it's up to date.",navigation:{page:"settings",subtab:"general"},cursorTarget:{selector:'[data-testid="company-address-input"]',offset:{x:0,y:0},onClick:!1}},{text:"Step 5: Let's open the API Keys tab. This section shows all your API keys - you'll need these to connect your application to our services. We're going to create a production API key.",navigation:{page:"settings",subtab:"api"},cursorTarget:{selector:'[data-settings-tab="api"]',offset:{x:0,y:0},onClick:!0}},{text:"Step 6: Let's open the Create API Key dialog. Here you can create a new API key for your application. You'll want to give it a descriptive name like 'Production Key' so you can easily identify it later.",navigation:{page:"settings",subtab:"api"},cursorTarget:{selector:'[data-testid="create-api-key-button"]',offset:{x:0,y:0},onClick:!0}}]},"add-api-key":{id:"add-api-key",title:"How to add an API key",steps:[{text:"Step 1: Let's open the Settings page. This is where you manage your account settings and preferences. We need to go here to access the API Keys section.",navigation:{page:"settings",subtab:"general"},cursorTarget:{selector:'[data-page="settings"]',offset:{x:0,y:0},onClick:!1}},{text:"Step 2: Let's open the API Keys tab. This section shows all your API keys and allows you to create new ones. You'll need API keys to connect your application to our services.",navigation:{page:"settings",subtab:"api"},cursorTarget:{selector:'[data-settings-tab="api"]',offset:{x:0,y:0},onClick:!0}},{text:"Step 3: Let's open the Create API Key dialog. This is where you'll create your new API key - you can give it a name to help you identify it later, then click Create to generate it.",navigation:{page:"settings",subtab:"api"},cursorTarget:{selector:'[data-testid="create-api-key-button"]',offset:{x:0,y:0},onClick:!0}}]},"refund-payment":{id:"refund-payment",title:"How to refund a payment",steps:[{text:"Step 1: Let's open the Home page. This is your dashboard where you can view today's activity, your payment overview, and recent transactions. We need to go here to find the payment you want to refund.",navigation:{page:"dashboard"},cursorTarget:{selector:'[data-page="dashboard"]',offset:{x:0,y:0},onClick:!0}},{text:"Step 2: Scroll down to see the Recent transactions section at the bottom. This shows your latest payment transactions with their status. We're looking for a transaction with 'paid' status - only paid transactions can be refunded.",navigation:{page:"dashboard"},cursorTarget:{selector:'[data-testid="recent-activity-card"]',offset:{x:0,y:0},onClick:!1}},{text:"Step 3: Let's open the dropdown menu for this paid transaction. Each transaction has a menu button (three dots) that gives you options like refunding. Click it to see the available actions, including the 'Refund payment' option.",navigation:{page:"dashboard"},cursorTarget:{selector:'[data-testid="transaction-menu-button"]',offset:{x:0,y:0},onClick:!0}}]}},kD=[];function PD(){return(0,p.jsxs)("div",{className:"flex flex-col items-center justify-center h-full p-6",children:[(0,p.jsx)(Pt,{className:"h-8 w-8 animate-spin text-gray-400 mb-3"}),(0,p.jsx)("p",{className:"text-xs text-gray-500",children:"Verifying your identity..."})]})}function TD({error:e,onRetry:t}){return(0,p.jsxs)("div",{className:"flex flex-col items-center justify-center h-full p-6 text-center",children:[(0,p.jsx)("div",{className:"w-12 h-12 rounded-full bg-red-100 flex items-center justify-center mb-4",children:(0,p.jsx)(mr,{className:"h-6 w-6 text-red-600"})}),(0,p.jsx)("h3",{className:"text-sm font-semibold text-gray-900 mb-2",children:"Unable to Start Chat"}),(0,p.jsx)("p",{className:"text-xs text-gray-500 mb-4 max-w-[240px]",children:e}),(0,p.jsx)(tt,{variant:"secondary",size:"sm",onClick:t,className:"h-8 px-4 text-xs",children:"Try Again"})]})}function AD({isOpen:e=!0,onClose:t,onOpen:a,onBack:r,onNavigate:o,onActionComplete:n,currentPage:s,agentUrl:i=SD,startingQuestions:l,startingQuestionsEndpoint:u,userId:d,orgId:c,userName:f,userEmail:g,userOrganization:x,supabaseUrl:w,supabaseAnonKey:L,productBackendUrl:y}={}){let[h,m]=B.useState(kD),[S,I]=B.useState(""),[P,R]=B.useState(()=>crypto.randomUUID()),A=dk({agentUrl:i,orgId:c||""}),V=A.config?.productBackendUrl||y,{authState:F,retry:me}=uk({productBackendUrl:V,sessionId:P,enabled:!!V&&A.status==="success"});B.useEffect(()=>{if(!V||A.status!=="success")return;(async()=>{let k=`${V}/userSite`;console.log("[KiteChat TEST] Testing GET /userSite endpoint..."),console.log("[KiteChat TEST] URL:",k);try{let D=await fetch(k,{method:"GET",credentials:"include",headers:{Accept:"application/json"}});if(console.log("[KiteChat TEST] /userSite response status:",D.status),console.log("[KiteChat TEST] /userSite response ok:",D.ok),D.ok){let E=await D.json();console.log("[KiteChat TEST] /userSite SUCCESS - data:",E)}else{let E=await D.text();console.log("[KiteChat TEST] /userSite FAILED - status:",D.status,"body:",E)}}catch(D){console.error("[KiteChat TEST] /userSite ERROR:",D)}})()},[V,A.status]);let ae=B.useMemo(()=>F.status==="authenticated"?{userId:F.user.id,userName:F.user.name,userEmail:F.user.email,userRole:F.user.role,isInternal:F.user.isInternal}:{userId:d||"anonymous",userName:f||"Anonymous User",userEmail:g||"Not provided",userRole:void 0,isInternal:!1},[F,d,f,g]),[Be,Aa]=B.useState(!1),St=B.useRef(null),[So,Me]=B.useState(!1),xe=B.useRef(null),ot=B.useRef(null),oa=B.useRef(null);B.useEffect(()=>{console.log(`[KiteChat] Chat Panel v${CD} loaded`)},[]);let zt=B.useCallback(()=>{console.log("[KiteChat] resetSession called",{isEscalated:Be,hasSupabase:!!xe.current,sessionId:P}),Be&&xe.current&&P?(console.log("[KiteChat] Updating customer_status to disconnected for session:",P),xe.current.from("escalations").update({customer_status:"disconnected",customer_last_seen:new Date().toISOString()}).eq("session_id",P).then(v=>{console.log("[KiteChat] Disconnect update result:",v)},v=>{console.error("[KiteChat] Disconnect update failed:",v)})):console.log("[KiteChat] Skipping disconnect update - conditions not met"),R(crypto.randomUUID()),Aa(!1),St.current&&(St.current.close(),St.current=null),Me(!1),ot.current&&(ot.current.unsubscribe(),ot.current=null)},[Be,P]);B.useEffect(()=>{w&&L&&!xe.current&&(xe.current=VC(w,L))},[w,L]),B.useEffect(()=>{if(!Be||!P||!xe.current)return;let v=`typing:${P}`,k=xe.current.channel(v);return console.log(`[KiteChat] Subscribing to typing channel: ${v}`),k.on("broadcast",{event:"typing"},D=>{console.log("[KiteChat] Received typing broadcast:",D);let{sender:E,isTyping:M}=D.payload;E==="agent"&&(console.log(`[KiteChat] Agent typing: ${M}`),Me(M),M&&(oa.current&&window.clearTimeout(oa.current),oa.current=window.setTimeout(()=>{Me(!1)},5e3)))}).subscribe(D=>{console.log(`[KiteChat] Typing channel status: ${D}`),D==="SUBSCRIBED"&&(ot.current=k,console.log("[KiteChat] Typing channel ready"))}),()=>{k.unsubscribe(),ot.current=null,oa.current&&window.clearTimeout(oa.current)}},[Be,P]);let Tu=B.useRef(null),kr=B.useCallback(async v=>{if(!(!xe.current||!P))try{await xe.current.from("escalations").update({customer_status:v,customer_last_seen:new Date().toISOString()}).eq("session_id",P)}catch(k){console.error("[KiteChat] Failed to update customer status:",k)}},[P]);B.useEffect(()=>{if(!Be||!P||!xe.current)return;let v=P,k=xe.current;kr("active"),Tu.current=window.setInterval(()=>{kr("active")},6e4);let D=()=>{k.from("escalations").update({customer_status:"disconnected",customer_last_seen:new Date().toISOString()}).eq("session_id",v)},E=()=>{document.visibilityState==="hidden"?k.from("escalations").update({customer_status:"disconnected",customer_last_seen:new Date().toISOString()}).eq("session_id",v):document.visibilityState==="visible"&&kr("active")};return window.addEventListener("beforeunload",D),document.addEventListener("visibilitychange",E),()=>{window.removeEventListener("beforeunload",D),document.removeEventListener("visibilitychange",E),k.from("escalations").update({customer_status:"disconnected",customer_last_seen:new Date().toISOString()}).eq("session_id",v).then(()=>{console.log("[KiteChat] Marked customer as disconnected")},M=>{console.error("[KiteChat] Failed to mark disconnected:",M)}),Tu.current&&(window.clearInterval(Tu.current),Tu.current=null)}},[Be,P,kr]);let Au=B.useCallback(v=>{if(!ot.current){console.log("[KiteChat] Cannot send typing - channel not ready");return}if(!Be){console.log("[KiteChat] Cannot send typing - not escalated");return}console.log(`[KiteChat] Sending typing indicator: ${v}`),ot.current.send({type:"broadcast",event:"typing",payload:{sender:"user",isTyping:v}})},[Be]),Pn=B.useRef(null),yk=B.useCallback(()=>{!Be||!xe.current||(Au(!0),kr("active"),Pn.current&&window.clearTimeout(Pn.current),Pn.current=window.setTimeout(()=>{Au(!1)},1500))},[Be,Au,kr]),Tn=B.useRef({}),Dy=h.length===0,[An,ye]=B.useState("idle"),[xk,Le]=B.useState([]),Pr=B.useRef([]),vk=h.length?h[h.length-1].role:void 0,[gp,Lo]=B.useState("landing"),[My,Io]=B.useState(void 0),[wk,Ny]=B.useState(l||bD),[Ck,Oy]=B.useState(!1);B.useEffect(()=>{u&&!l&&(Oy(!0),fetch(u).then(v=>v.json()).then(v=>{Array.isArray(v)&&v.length>0&&Ny(v)}).catch(v=>{console.warn("[KiteChat] Failed to fetch starting questions:",v)}).finally(()=>Oy(!1)))},[u,l]),B.useEffect(()=>{l&&Ny(l)},[l]);let[he,Tr]=B.useState(void 0),Ne=B.useRef(void 0),Fy=B.useRef(null),[Ii,bi]=B.useState(!1);B.useEffect(()=>{window.resetIntegrationNotification=()=>{localStorage.removeItem("gmailNotificationSeen"),console.log("Integration notification reset! Click the Integrations tab to see it again.")};let v=()=>{if(!localStorage.getItem("gmailNotificationSeen")){Lo("landing"),Io(void 0);let D=Date.now(),E="I see you're exploring integrations. Let me know if there are any other connections we should add.",M={id:D,role:"assistant",kind:"text",content:"",isNotificationMessage:!0};m(J=>[...J,M]),Qa(D,E),localStorage.setItem("gmailNotificationSeen","true")}};return window.addEventListener("integrationTabClicked",v),()=>{window.removeEventListener("integrationTabClicked",v)}},[]),B.useEffect(()=>{he?(!Ne.current||Ne.current.id!==he.id||Ne.current.stepIndex!==he.stepIndex)&&(Ne.current=he):Ne.current=void 0},[he]);let[ki,Ru]=B.useState(null),[Xe,yp]=B.useState(null),[ne,se]=B.useState({}),By=B.useRef(null),xp=B.useRef(null),_u=B.useRef(null),{cursorState:Eu,moveTo:bo,hide:Rn}=lk(),[ko,vp]=B.useState(null),[Uy,Ar]=B.useState(null),wp=B.useRef(null),_n=B.useRef(null),[Vy,Pi]=B.useState(!1),[En,Du]=B.useState(""),jy=B.useRef(null);B.useEffect(()=>{if(!he||he.id!=="add-api-key"||he.stepIndex!==2)return;let k=setInterval(()=>{let D=document.querySelector('[role="dialog"]'),E=Ne.current;if(D&&E&&E.id==="add-api-key"&&E.stepIndex===2){Rn();let M=Date.now()+1;m(J=>[...J,{id:M,role:"assistant",kind:"guideComplete",content:"Perfect! The dialog is now open. You can enter a name and create your API key."}]),Tr(void 0),bi(!0)}},300);return()=>clearInterval(k)},[he,Rn]),B.useEffect(()=>()=>{Object.values(Tn.current).forEach(v=>window.clearInterval(v)),Tn.current={},Pr.current.forEach(v=>window.clearTimeout(v)),Pr.current=[]},[]),B.useEffect(()=>{if(he&&h.length>0){let v=h[h.length-1];if((v.kind==="guideStep"||v.kind==="guideComplete")&&_u.current&&xp.current){let k=xp.current,D=_u.current,E=k.getBoundingClientRect(),J=D.getBoundingClientRect().top-E.top+k.scrollTop;k.scrollTop=J}}else!he&&h.length>0&&By.current?.scrollIntoView({behavior:"smooth"})},[h,An,he]);let qy=B.useMemo(()=>{for(let v=h.length-1;v>=0;v--){let k=h[v];if(k.kind==="bulkSummary"&&k.bulkSummary?.navigationPage&&k.bulkSummary.successes>0)return k.bulkSummary.navigationPage}return null},[h]);B.useEffect(()=>{Fy.current=qy},[qy]),B.useEffect(()=>{wp.current=Uy},[Uy]),B.useEffect(()=>{let v=k=>{if((k.metaKey||k.ctrlKey)&&k.key==="Enter"){let D=wp.current;if(D){k.preventDefault(),k.stopPropagation(),Lp(D);return}if(Xe){k.preventDefault(),k.stopPropagation(),Sp();return}if(ki){k.preventDefault(),k.stopPropagation(),Cp(ki);return}let E=Fy.current;if(console.log("[DEBUG] Keyboard handler - latestBulkSummaryNavigation:",E,"onNavigate:",!!o),E&&o){console.log("[DEBUG] Navigating via keyboard to:",E.page),k.preventDefault(),k.stopPropagation(),o(E.page,E.subtab);return}if(Ii){k.preventDefault(),k.stopPropagation(),Hy();return}if(Ne.current){k.preventDefault(),k.stopPropagation(),Ip();return}}};return window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)},[Xe,ki,he,Ii,o]);let zy=B.useCallback(v=>{if(!i)return;St.current&&St.current.close();let k=i.replace(/^http/,"ws")+`/ws/escalation/${v}`,D=new WebSocket(k);D.onmessage=E=>{try{let M=JSON.parse(E.data);M.type==="agent_message"?m(J=>{let X=M.content,T=M.message_id;return(T?J.some(b=>b.serverMessageId===T):J.slice(-5).some(b=>b.content===X))?(console.debug("[KiteChat] Skipping duplicate agent message:",T||X.slice(0,30)),J):[...J,{id:Date.now(),role:"agent",kind:"text",content:X,serverMessageId:T}]}):M.type==="error"&&console.error("[KiteChat] Escalation error:",M.message)}catch(M){console.error("[KiteChat] Failed to parse escalation message:",M)}},D.onerror=E=>{console.error("[KiteChat] Escalation WebSocket error:",E)},D.onclose=()=>{console.log("[KiteChat] Escalation WebSocket closed")},St.current=D},[i]),Sk=B.useCallback(async v=>{if(!St.current||St.current.readyState!==WebSocket.OPEN)return console.error("[KiteChat] Escalation WebSocket not connected"),!1;try{return St.current.send(JSON.stringify({type:"user_message",content:v})),kr("active"),!0}catch(k){return console.error("[KiteChat] Failed to send escalated message:",k),!1}},[kr]);B.useEffect(()=>()=>{St.current&&St.current.close()},[]),B.useEffect(()=>{Be&&P&&zy(P)},[Be,P,zy]);function Qa(v,k,D){let E=k||"",M=D;if(k&&k.startsWith("{")&&k.includes('"response"'))try{let O=0,b=0;for(let G=0;G<k.length;G++)if(k[G]==="{")O++;else if(k[G]==="}"&&(O--,O===0)){b=G+1;break}let K=b>0?k.slice(0,b):k,te=JSON.parse(K);te.response&&typeof te.response=="string"&&(E=te.response,!M&&te.followups&&(M=te.followups))}catch{}E=LD(E);let J=E.split(" "),X=0,T=window.setInterval(()=>{X+=1,m(O=>O.map(b=>b.id===v?{...b,content:J.slice(0,X).join(" ")}:b)),X>=J.length&&(window.clearInterval(T),delete Tn.current[v],M&&M.length>0&&m(O=>O.map(b=>b.id===v?{...b,followups:M}:b)),ye("idle"))},25);Tn.current[v]=T}function Lk(v,k){m(D=>D.map(E=>E.id===v?{...E,followupSelected:!0}:E)),Mu(k.label)}function Hy(){Object.values(Tn.current).forEach(v=>window.clearInterval(v)),Tn.current={},Pr.current.forEach(v=>window.clearTimeout(v)),Pr.current=[],Rn(),zt(),m([]),I(""),ye("idle"),Lo("landing"),Io(void 0),Tr(void 0),bi(!1),Ru(null),yp(null),se({}),r&&r()}function MD(v){Lo("folder"),Io(v)}function Ik(){Lo("landing"),Io(void 0)}function bk(v){v.preventDefault();let k=S.trim();if(ko){if(!k){let D={id:Date.now(),role:"assistant",kind:"text",content:"Please describe what you'd like to do with this CSV file. For example: 'Create customers from this file' or 'Add these subscriptions'."};m(E=>[...E,D]);return}Pk(k,ko),I(""),vp(null),_n.current&&(_n.current.value="");return}if(k){if(Be){let D={id:Date.now(),role:"user",content:k};m(E=>[...E,D]),Sk(k),Au(!1),Pn.current&&(window.clearTimeout(Pn.current),Pn.current=null),I("");return}Mu(k),I("")}}function kk(v){let k={dashboard:"dashboard",customers:"customers page",payments:"payments page",settings:"settings page",support:"support page",disputes:"disputes page",radar:"radar page"};if(v.page==="settings"&&v.subtab){let D={general:"General",billing:"Billing",security:"Security",api:"API Keys",notifications:"Notifications",integrations:"Integrations"};return`${k.settings} (${D[v.subtab]} tab)`}return k[v.page]}function Cp(v){o&&o(v.page,v.subtab),Ru(null),m(k=>k.map(D=>D.kind==="navigationAction"&&D.navigationTarget?.page===v.page&&D.navigationTarget?.subtab===v.subtab?{...D,navigationTarget:void 0}:D))}function Sp(){if(!Xe)return;let v=ne;if(Xe.type!=="updateCompanyInfo"){if(Xe.type==="addApiKey"){let k=v;if(!k.name||!k.name.trim())return}else if(Xe.type==="addCustomer"){let k=v;if(!k.name||!k.name.trim()||!k.email||!k.email.trim())return}else if(Xe.type==="changePassword"){let k=v;if(!k.currentPassword||!k.newPassword||!k.confirmPassword||k.newPassword!==k.confirmPassword)return}else if(Xe.type==="addWebhook"){let k=v;if(!k.url||!k.url.trim())return}else if(Xe.type==="addPaymentMethod"){let k=v;if(!k.cardNumber||!k.expiryDate)return}else if(Xe.type==="deleteApiKey"){let k=v;if(!k.keyId&&!k.name)return}else if(Xe.type==="refundPayment"){let k=v;if(!k.transactionId&&!k.customer)return}else if(Xe.type==="createSubscription"){let k=v;if(!k.customerEmail&&!k.customerId)return}else if((Xe.type==="toggleBlockRule"||Xe.type==="enableBlockRule"||Xe.type==="disableBlockRule")&&!v.ruleId)return}n&&n(Xe.type,v),m(k=>k.map(D=>D.kind==="actionForm"&&D.actionType===Xe.type?{...D,isSubmitted:!0}:D)),yp(null),se({})}async function Mu(v){Pr.current.forEach(X=>window.clearTimeout(X)),Pr.current=[];let D=[...h].reverse().find(X=>X.role==="assistant")?.isNotificationMessage===!0,E=Date.now(),M={id:E,role:"user",content:v};if(m(X=>X.map(T=>T.followups&&T.followups.length>0?{...T,followupSelected:!0}:T).concat(M)),D){let X=Date.now()+1,T={id:X,role:"assistant",kind:"text",content:""};m(O=>[...O,T]),Qa(X,"Thank you, your feedback is saved.");return}Ru(null),ye("thinking"),Le([]);let J=!1;try{let X=new AbortController,T=setTimeout(()=>X.abort(),6e4);console.log("[ChatPanel] Sending chat request to agent backend..."),console.log("[ChatPanel] Agent URL:",i),console.log("[ChatPanel] User data being sent:"),console.log("[ChatPanel] user_id:",ae.userId),console.log("[ChatPanel] user_name:",ae.userName),console.log("[ChatPanel] user_email:",ae.userEmail),console.log("[ChatPanel] user_organization:",x),console.log("[ChatPanel] org_id:",c),console.log("[ChatPanel] authState.status:",F.status);let O=await fetch(`${i}/chat/stream`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({session_id:P,message:v,current_page:s||"dashboard",user_id:ae.userId,user_name:ae.userName,user_email:ae.userEmail,user_organization:x,org_id:c}),signal:X.signal});if(clearTimeout(T),!O.ok)throw new Error(`Agent request failed: ${O.status}`);let b=O.body?.getReader();if(!b)throw new Error("No response body");let K=new TextDecoder,te="";for(;;){let{done:G,value:fe}=await b.read();if(G)break;te+=K.decode(fe,{stream:!0});let Qe=te.split(`
27
+ `)})},a.length)),o=!1,n=[],s=""):(l(),o=!0,s=d.slice(3).trim());continue}if(o){n.push(d);continue}let c=d.match(/^(#{1,6})\s+(.+)/);if(c){l();let x=c[1].length,w=i(c[2]),L=x===1?"text-lg font-bold my-1":x===2?"text-base font-bold my-1":"text-sm font-semibold my-1";a.push((0,p.jsx)("div",{className:L,children:w},a.length));continue}let f=d.match(/^[-*]\s+(.+)/);if(f){(!r||r.type!=="ul")&&(l(),r={type:"ul",items:[]}),r.items.push(i(f[1]));continue}let g=d.match(/^\d+[.)]\s+(.+)/);if(g){(!r||r.type!=="ol")&&(l(),r={type:"ol",items:[]}),r.items.push(i(g[1]));continue}if(d.trim()===""){l(),a.push((0,p.jsx)("div",{className:"h-2"},a.length));continue}if(d.match(/^[-*_]{3,}$/)){l(),a.push((0,p.jsx)("hr",{className:"my-2 border-gray-200"},a.length));continue}l(),a.push((0,p.jsx)("div",{children:i(d)},a.length))}return l(),(0,p.jsx)(p.Fragment,{children:a})}var bD=[{id:"changing-layouts",label:"Changing layouts",prompt:"How do I change the layout of my profiles or folders?",icon:"layout"},{id:"bulk-uploads",label:"Bulk uploads",prompt:"How do I bulk upload profiles using a CSV file?",icon:"upload"},{id:"example-setups",label:"Example setups",prompt:"Can you show me some example folder setups?",icon:"setup"}],mk=[{id:"customers",title:"Customer Management",topics:[{id:"add-customer",label:"Add a new customer",prompt:"How do I add a new customer to the system and what information is required?"},{id:"customer-details",label:"View customer details",prompt:"Show me how to view and edit customer information and their payment history."}]},{id:"payments",title:"Payment Processing",topics:[{id:"process-payment",label:"Process a payment",prompt:"How do I process a one-time payment for a customer?"},{id:"refund-payment",label:"Issue a refund",prompt:"Walk me through issuing a refund for a customer payment."}]},{id:"subscriptions",title:"Subscription Management",topics:[{id:"create-subscription",label:"Create a subscription",prompt:"How do I set up a new subscription plan for a customer?"},{id:"update-subscription",label:"Update subscription tier",prompt:"How can I change a customer's subscription plan or upgrade them?"}]},{id:"billing",title:"Billing",topics:[{id:"payment-methods",label:"Manage payment methods",prompt:"How do customers add or update their payment methods?"}]}],Ry={"getting-started":{id:"getting-started",title:"Getting started",steps:[{text:"Step 1: Let's open the Customers page. This is where you'll manage all your customers - you can view, add, and edit customer information here.",navigation:{page:"customers"},cursorTarget:{selector:'[data-page="customers"]',offset:{x:0,y:0},onClick:!0}},{text:"Step 2: Now let's open the Add customer dialog. This is where you'll enter information for your first customer, including their name, email, and other details.",navigation:{page:"customers"},cursorTarget:{selector:'[data-testid="add-customer-button"]',offset:{x:0,y:0},onClick:!0}},{text:"Step 3: Let's open the Settings page. This is where you manage your account settings, company information, and preferences. We're going to verify your company address is correct.",navigation:{page:"settings",subtab:"general"},cursorTarget:{selector:'[data-page="settings"]',offset:{x:0,y:0},onClick:!0}},{text:"Step 4: Here's the address field in the Company Information section. It's important to verify this address is accurate since it's used for billing and shipping purposes. Make sure it's up to date.",navigation:{page:"settings",subtab:"general"},cursorTarget:{selector:'[data-testid="company-address-input"]',offset:{x:0,y:0},onClick:!1}},{text:"Step 5: Let's open the API Keys tab. This section shows all your API keys - you'll need these to connect your application to our services. We're going to create a production API key.",navigation:{page:"settings",subtab:"api"},cursorTarget:{selector:'[data-settings-tab="api"]',offset:{x:0,y:0},onClick:!0}},{text:"Step 6: Let's open the Create API Key dialog. Here you can create a new API key for your application. You'll want to give it a descriptive name like 'Production Key' so you can easily identify it later.",navigation:{page:"settings",subtab:"api"},cursorTarget:{selector:'[data-testid="create-api-key-button"]',offset:{x:0,y:0},onClick:!0}}]},"add-api-key":{id:"add-api-key",title:"How to add an API key",steps:[{text:"Step 1: Let's open the Settings page. This is where you manage your account settings and preferences. We need to go here to access the API Keys section.",navigation:{page:"settings",subtab:"general"},cursorTarget:{selector:'[data-page="settings"]',offset:{x:0,y:0},onClick:!1}},{text:"Step 2: Let's open the API Keys tab. This section shows all your API keys and allows you to create new ones. You'll need API keys to connect your application to our services.",navigation:{page:"settings",subtab:"api"},cursorTarget:{selector:'[data-settings-tab="api"]',offset:{x:0,y:0},onClick:!0}},{text:"Step 3: Let's open the Create API Key dialog. This is where you'll create your new API key - you can give it a name to help you identify it later, then click Create to generate it.",navigation:{page:"settings",subtab:"api"},cursorTarget:{selector:'[data-testid="create-api-key-button"]',offset:{x:0,y:0},onClick:!0}}]},"refund-payment":{id:"refund-payment",title:"How to refund a payment",steps:[{text:"Step 1: Let's open the Home page. This is your dashboard where you can view today's activity, your payment overview, and recent transactions. We need to go here to find the payment you want to refund.",navigation:{page:"dashboard"},cursorTarget:{selector:'[data-page="dashboard"]',offset:{x:0,y:0},onClick:!0}},{text:"Step 2: Scroll down to see the Recent transactions section at the bottom. This shows your latest payment transactions with their status. We're looking for a transaction with 'paid' status - only paid transactions can be refunded.",navigation:{page:"dashboard"},cursorTarget:{selector:'[data-testid="recent-activity-card"]',offset:{x:0,y:0},onClick:!1}},{text:"Step 3: Let's open the dropdown menu for this paid transaction. Each transaction has a menu button (three dots) that gives you options like refunding. Click it to see the available actions, including the 'Refund payment' option.",navigation:{page:"dashboard"},cursorTarget:{selector:'[data-testid="transaction-menu-button"]',offset:{x:0,y:0},onClick:!0}}]}},kD=[];function PD(){return(0,p.jsxs)("div",{className:"flex flex-col items-center justify-center h-full p-6",children:[(0,p.jsx)(Pt,{className:"h-8 w-8 animate-spin text-gray-400 mb-3"}),(0,p.jsx)("p",{className:"text-xs text-gray-500",children:"Verifying your identity..."})]})}function TD({error:e,onRetry:t}){return(0,p.jsxs)("div",{className:"flex flex-col items-center justify-center h-full p-6 text-center",children:[(0,p.jsx)("div",{className:"w-12 h-12 rounded-full bg-red-100 flex items-center justify-center mb-4",children:(0,p.jsx)(mr,{className:"h-6 w-6 text-red-600"})}),(0,p.jsx)("h3",{className:"text-sm font-semibold text-gray-900 mb-2",children:"Unable to Start Chat"}),(0,p.jsx)("p",{className:"text-xs text-gray-500 mb-4 max-w-[240px]",children:e}),(0,p.jsx)(tt,{variant:"secondary",size:"sm",onClick:t,className:"h-8 px-4 text-xs",children:"Try Again"})]})}function AD({isOpen:e=!0,onClose:t,onOpen:a,onBack:r,onNavigate:o,onActionComplete:n,currentPage:s,agentUrl:i=SD,startingQuestions:l,startingQuestionsEndpoint:u,userId:d,orgId:c,userName:f,userEmail:g,userOrganization:x,supabaseUrl:w,supabaseAnonKey:L,productBackendUrl:y}={}){let[h,m]=B.useState(kD),[S,I]=B.useState(""),[P,R]=B.useState(()=>crypto.randomUUID()),A=dk({agentUrl:i,orgId:c||""}),V=A.config?.productBackendUrl||y,{authState:F,retry:me}=uk({productBackendUrl:V,sessionId:P,enabled:!!V&&A.status==="success"});B.useEffect(()=>{if(!V||A.status!=="success")return;(async()=>{let k=`${V}/getDocument/snowkite/categories/`;console.log("[KiteChat TEST] Testing product backend connectivity..."),console.log("[KiteChat TEST] URL:",k);try{let D=await fetch(k,{method:"GET",headers:{Accept:"application/json"}});if(console.log("[KiteChat TEST] Response status:",D.status),console.log("[KiteChat TEST] Response ok:",D.ok),D.ok){let E=await D.json();console.log("[KiteChat TEST] SUCCESS - product backend reachable, data:",E)}else{let E=await D.text();console.log("[KiteChat TEST] FAILED - status:",D.status,"body:",E)}}catch(D){console.error("[KiteChat TEST] ERROR:",D)}})()},[V,A.status]);let ae=B.useMemo(()=>F.status==="authenticated"?{userId:F.user.id,userName:F.user.name,userEmail:F.user.email,userRole:F.user.role,isInternal:F.user.isInternal}:{userId:d||"anonymous",userName:f||"Anonymous User",userEmail:g||"Not provided",userRole:void 0,isInternal:!1},[F,d,f,g]),[Be,Aa]=B.useState(!1),St=B.useRef(null),[So,Me]=B.useState(!1),xe=B.useRef(null),ot=B.useRef(null),oa=B.useRef(null);B.useEffect(()=>{console.log(`[KiteChat] Chat Panel v${CD} loaded`)},[]);let zt=B.useCallback(()=>{console.log("[KiteChat] resetSession called",{isEscalated:Be,hasSupabase:!!xe.current,sessionId:P}),Be&&xe.current&&P?(console.log("[KiteChat] Updating customer_status to disconnected for session:",P),xe.current.from("escalations").update({customer_status:"disconnected",customer_last_seen:new Date().toISOString()}).eq("session_id",P).then(v=>{console.log("[KiteChat] Disconnect update result:",v)},v=>{console.error("[KiteChat] Disconnect update failed:",v)})):console.log("[KiteChat] Skipping disconnect update - conditions not met"),R(crypto.randomUUID()),Aa(!1),St.current&&(St.current.close(),St.current=null),Me(!1),ot.current&&(ot.current.unsubscribe(),ot.current=null)},[Be,P]);B.useEffect(()=>{w&&L&&!xe.current&&(xe.current=VC(w,L))},[w,L]),B.useEffect(()=>{if(!Be||!P||!xe.current)return;let v=`typing:${P}`,k=xe.current.channel(v);return console.log(`[KiteChat] Subscribing to typing channel: ${v}`),k.on("broadcast",{event:"typing"},D=>{console.log("[KiteChat] Received typing broadcast:",D);let{sender:E,isTyping:M}=D.payload;E==="agent"&&(console.log(`[KiteChat] Agent typing: ${M}`),Me(M),M&&(oa.current&&window.clearTimeout(oa.current),oa.current=window.setTimeout(()=>{Me(!1)},5e3)))}).subscribe(D=>{console.log(`[KiteChat] Typing channel status: ${D}`),D==="SUBSCRIBED"&&(ot.current=k,console.log("[KiteChat] Typing channel ready"))}),()=>{k.unsubscribe(),ot.current=null,oa.current&&window.clearTimeout(oa.current)}},[Be,P]);let Tu=B.useRef(null),kr=B.useCallback(async v=>{if(!(!xe.current||!P))try{await xe.current.from("escalations").update({customer_status:v,customer_last_seen:new Date().toISOString()}).eq("session_id",P)}catch(k){console.error("[KiteChat] Failed to update customer status:",k)}},[P]);B.useEffect(()=>{if(!Be||!P||!xe.current)return;let v=P,k=xe.current;kr("active"),Tu.current=window.setInterval(()=>{kr("active")},6e4);let D=()=>{k.from("escalations").update({customer_status:"disconnected",customer_last_seen:new Date().toISOString()}).eq("session_id",v)},E=()=>{document.visibilityState==="hidden"?k.from("escalations").update({customer_status:"disconnected",customer_last_seen:new Date().toISOString()}).eq("session_id",v):document.visibilityState==="visible"&&kr("active")};return window.addEventListener("beforeunload",D),document.addEventListener("visibilitychange",E),()=>{window.removeEventListener("beforeunload",D),document.removeEventListener("visibilitychange",E),k.from("escalations").update({customer_status:"disconnected",customer_last_seen:new Date().toISOString()}).eq("session_id",v).then(()=>{console.log("[KiteChat] Marked customer as disconnected")},M=>{console.error("[KiteChat] Failed to mark disconnected:",M)}),Tu.current&&(window.clearInterval(Tu.current),Tu.current=null)}},[Be,P,kr]);let Au=B.useCallback(v=>{if(!ot.current){console.log("[KiteChat] Cannot send typing - channel not ready");return}if(!Be){console.log("[KiteChat] Cannot send typing - not escalated");return}console.log(`[KiteChat] Sending typing indicator: ${v}`),ot.current.send({type:"broadcast",event:"typing",payload:{sender:"user",isTyping:v}})},[Be]),Pn=B.useRef(null),yk=B.useCallback(()=>{!Be||!xe.current||(Au(!0),kr("active"),Pn.current&&window.clearTimeout(Pn.current),Pn.current=window.setTimeout(()=>{Au(!1)},1500))},[Be,Au,kr]),Tn=B.useRef({}),Dy=h.length===0,[An,ye]=B.useState("idle"),[xk,Le]=B.useState([]),Pr=B.useRef([]),vk=h.length?h[h.length-1].role:void 0,[gp,Lo]=B.useState("landing"),[My,Io]=B.useState(void 0),[wk,Ny]=B.useState(l||bD),[Ck,Oy]=B.useState(!1);B.useEffect(()=>{u&&!l&&(Oy(!0),fetch(u).then(v=>v.json()).then(v=>{Array.isArray(v)&&v.length>0&&Ny(v)}).catch(v=>{console.warn("[KiteChat] Failed to fetch starting questions:",v)}).finally(()=>Oy(!1)))},[u,l]),B.useEffect(()=>{l&&Ny(l)},[l]);let[he,Tr]=B.useState(void 0),Ne=B.useRef(void 0),Fy=B.useRef(null),[Ii,bi]=B.useState(!1);B.useEffect(()=>{window.resetIntegrationNotification=()=>{localStorage.removeItem("gmailNotificationSeen"),console.log("Integration notification reset! Click the Integrations tab to see it again.")};let v=()=>{if(!localStorage.getItem("gmailNotificationSeen")){Lo("landing"),Io(void 0);let D=Date.now(),E="I see you're exploring integrations. Let me know if there are any other connections we should add.",M={id:D,role:"assistant",kind:"text",content:"",isNotificationMessage:!0};m(J=>[...J,M]),Qa(D,E),localStorage.setItem("gmailNotificationSeen","true")}};return window.addEventListener("integrationTabClicked",v),()=>{window.removeEventListener("integrationTabClicked",v)}},[]),B.useEffect(()=>{he?(!Ne.current||Ne.current.id!==he.id||Ne.current.stepIndex!==he.stepIndex)&&(Ne.current=he):Ne.current=void 0},[he]);let[ki,Ru]=B.useState(null),[Xe,yp]=B.useState(null),[ne,se]=B.useState({}),By=B.useRef(null),xp=B.useRef(null),_u=B.useRef(null),{cursorState:Eu,moveTo:bo,hide:Rn}=lk(),[ko,vp]=B.useState(null),[Uy,Ar]=B.useState(null),wp=B.useRef(null),_n=B.useRef(null),[Vy,Pi]=B.useState(!1),[En,Du]=B.useState(""),jy=B.useRef(null);B.useEffect(()=>{if(!he||he.id!=="add-api-key"||he.stepIndex!==2)return;let k=setInterval(()=>{let D=document.querySelector('[role="dialog"]'),E=Ne.current;if(D&&E&&E.id==="add-api-key"&&E.stepIndex===2){Rn();let M=Date.now()+1;m(J=>[...J,{id:M,role:"assistant",kind:"guideComplete",content:"Perfect! The dialog is now open. You can enter a name and create your API key."}]),Tr(void 0),bi(!0)}},300);return()=>clearInterval(k)},[he,Rn]),B.useEffect(()=>()=>{Object.values(Tn.current).forEach(v=>window.clearInterval(v)),Tn.current={},Pr.current.forEach(v=>window.clearTimeout(v)),Pr.current=[]},[]),B.useEffect(()=>{if(he&&h.length>0){let v=h[h.length-1];if((v.kind==="guideStep"||v.kind==="guideComplete")&&_u.current&&xp.current){let k=xp.current,D=_u.current,E=k.getBoundingClientRect(),J=D.getBoundingClientRect().top-E.top+k.scrollTop;k.scrollTop=J}}else!he&&h.length>0&&By.current?.scrollIntoView({behavior:"smooth"})},[h,An,he]);let qy=B.useMemo(()=>{for(let v=h.length-1;v>=0;v--){let k=h[v];if(k.kind==="bulkSummary"&&k.bulkSummary?.navigationPage&&k.bulkSummary.successes>0)return k.bulkSummary.navigationPage}return null},[h]);B.useEffect(()=>{Fy.current=qy},[qy]),B.useEffect(()=>{wp.current=Uy},[Uy]),B.useEffect(()=>{let v=k=>{if((k.metaKey||k.ctrlKey)&&k.key==="Enter"){let D=wp.current;if(D){k.preventDefault(),k.stopPropagation(),Lp(D);return}if(Xe){k.preventDefault(),k.stopPropagation(),Sp();return}if(ki){k.preventDefault(),k.stopPropagation(),Cp(ki);return}let E=Fy.current;if(console.log("[DEBUG] Keyboard handler - latestBulkSummaryNavigation:",E,"onNavigate:",!!o),E&&o){console.log("[DEBUG] Navigating via keyboard to:",E.page),k.preventDefault(),k.stopPropagation(),o(E.page,E.subtab);return}if(Ii){k.preventDefault(),k.stopPropagation(),Hy();return}if(Ne.current){k.preventDefault(),k.stopPropagation(),Ip();return}}};return window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)},[Xe,ki,he,Ii,o]);let zy=B.useCallback(v=>{if(!i)return;St.current&&St.current.close();let k=i.replace(/^http/,"ws")+`/ws/escalation/${v}`,D=new WebSocket(k);D.onmessage=E=>{try{let M=JSON.parse(E.data);M.type==="agent_message"?m(J=>{let X=M.content,T=M.message_id;return(T?J.some(b=>b.serverMessageId===T):J.slice(-5).some(b=>b.content===X))?(console.debug("[KiteChat] Skipping duplicate agent message:",T||X.slice(0,30)),J):[...J,{id:Date.now(),role:"agent",kind:"text",content:X,serverMessageId:T}]}):M.type==="error"&&console.error("[KiteChat] Escalation error:",M.message)}catch(M){console.error("[KiteChat] Failed to parse escalation message:",M)}},D.onerror=E=>{console.error("[KiteChat] Escalation WebSocket error:",E)},D.onclose=()=>{console.log("[KiteChat] Escalation WebSocket closed")},St.current=D},[i]),Sk=B.useCallback(async v=>{if(!St.current||St.current.readyState!==WebSocket.OPEN)return console.error("[KiteChat] Escalation WebSocket not connected"),!1;try{return St.current.send(JSON.stringify({type:"user_message",content:v})),kr("active"),!0}catch(k){return console.error("[KiteChat] Failed to send escalated message:",k),!1}},[kr]);B.useEffect(()=>()=>{St.current&&St.current.close()},[]),B.useEffect(()=>{Be&&P&&zy(P)},[Be,P,zy]);function Qa(v,k,D){let E=k||"",M=D;if(k&&k.startsWith("{")&&k.includes('"response"'))try{let O=0,b=0;for(let G=0;G<k.length;G++)if(k[G]==="{")O++;else if(k[G]==="}"&&(O--,O===0)){b=G+1;break}let K=b>0?k.slice(0,b):k,te=JSON.parse(K);te.response&&typeof te.response=="string"&&(E=te.response,!M&&te.followups&&(M=te.followups))}catch{}E=LD(E);let J=E.split(" "),X=0,T=window.setInterval(()=>{X+=1,m(O=>O.map(b=>b.id===v?{...b,content:J.slice(0,X).join(" ")}:b)),X>=J.length&&(window.clearInterval(T),delete Tn.current[v],M&&M.length>0&&m(O=>O.map(b=>b.id===v?{...b,followups:M}:b)),ye("idle"))},25);Tn.current[v]=T}function Lk(v,k){m(D=>D.map(E=>E.id===v?{...E,followupSelected:!0}:E)),Mu(k.label)}function Hy(){Object.values(Tn.current).forEach(v=>window.clearInterval(v)),Tn.current={},Pr.current.forEach(v=>window.clearTimeout(v)),Pr.current=[],Rn(),zt(),m([]),I(""),ye("idle"),Lo("landing"),Io(void 0),Tr(void 0),bi(!1),Ru(null),yp(null),se({}),r&&r()}function MD(v){Lo("folder"),Io(v)}function Ik(){Lo("landing"),Io(void 0)}function bk(v){v.preventDefault();let k=S.trim();if(ko){if(!k){let D={id:Date.now(),role:"assistant",kind:"text",content:"Please describe what you'd like to do with this CSV file. For example: 'Create customers from this file' or 'Add these subscriptions'."};m(E=>[...E,D]);return}Pk(k,ko),I(""),vp(null),_n.current&&(_n.current.value="");return}if(k){if(Be){let D={id:Date.now(),role:"user",content:k};m(E=>[...E,D]),Sk(k),Au(!1),Pn.current&&(window.clearTimeout(Pn.current),Pn.current=null),I("");return}Mu(k),I("")}}function kk(v){let k={dashboard:"dashboard",customers:"customers page",payments:"payments page",settings:"settings page",support:"support page",disputes:"disputes page",radar:"radar page"};if(v.page==="settings"&&v.subtab){let D={general:"General",billing:"Billing",security:"Security",api:"API Keys",notifications:"Notifications",integrations:"Integrations"};return`${k.settings} (${D[v.subtab]} tab)`}return k[v.page]}function Cp(v){o&&o(v.page,v.subtab),Ru(null),m(k=>k.map(D=>D.kind==="navigationAction"&&D.navigationTarget?.page===v.page&&D.navigationTarget?.subtab===v.subtab?{...D,navigationTarget:void 0}:D))}function Sp(){if(!Xe)return;let v=ne;if(Xe.type!=="updateCompanyInfo"){if(Xe.type==="addApiKey"){let k=v;if(!k.name||!k.name.trim())return}else if(Xe.type==="addCustomer"){let k=v;if(!k.name||!k.name.trim()||!k.email||!k.email.trim())return}else if(Xe.type==="changePassword"){let k=v;if(!k.currentPassword||!k.newPassword||!k.confirmPassword||k.newPassword!==k.confirmPassword)return}else if(Xe.type==="addWebhook"){let k=v;if(!k.url||!k.url.trim())return}else if(Xe.type==="addPaymentMethod"){let k=v;if(!k.cardNumber||!k.expiryDate)return}else if(Xe.type==="deleteApiKey"){let k=v;if(!k.keyId&&!k.name)return}else if(Xe.type==="refundPayment"){let k=v;if(!k.transactionId&&!k.customer)return}else if(Xe.type==="createSubscription"){let k=v;if(!k.customerEmail&&!k.customerId)return}else if((Xe.type==="toggleBlockRule"||Xe.type==="enableBlockRule"||Xe.type==="disableBlockRule")&&!v.ruleId)return}n&&n(Xe.type,v),m(k=>k.map(D=>D.kind==="actionForm"&&D.actionType===Xe.type?{...D,isSubmitted:!0}:D)),yp(null),se({})}async function Mu(v){Pr.current.forEach(X=>window.clearTimeout(X)),Pr.current=[];let D=[...h].reverse().find(X=>X.role==="assistant")?.isNotificationMessage===!0,E=Date.now(),M={id:E,role:"user",content:v};if(m(X=>X.map(T=>T.followups&&T.followups.length>0?{...T,followupSelected:!0}:T).concat(M)),D){let X=Date.now()+1,T={id:X,role:"assistant",kind:"text",content:""};m(O=>[...O,T]),Qa(X,"Thank you, your feedback is saved.");return}Ru(null),ye("thinking"),Le([]);let J=!1;try{let X=new AbortController,T=setTimeout(()=>X.abort(),6e4);console.log("[ChatPanel] Sending chat request to agent backend..."),console.log("[ChatPanel] Agent URL:",i),console.log("[ChatPanel] User data being sent:"),console.log("[ChatPanel] user_id:",ae.userId),console.log("[ChatPanel] user_name:",ae.userName),console.log("[ChatPanel] user_email:",ae.userEmail),console.log("[ChatPanel] user_organization:",x),console.log("[ChatPanel] org_id:",c),console.log("[ChatPanel] authState.status:",F.status);let O=await fetch(`${i}/chat/stream`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({session_id:P,message:v,current_page:s||"dashboard",user_id:ae.userId,user_name:ae.userName,user_email:ae.userEmail,user_organization:x,org_id:c}),signal:X.signal});if(clearTimeout(T),!O.ok)throw new Error(`Agent request failed: ${O.status}`);let b=O.body?.getReader();if(!b)throw new Error("No response body");let K=new TextDecoder,te="";for(;;){let{done:G,value:fe}=await b.read();if(G)break;te+=K.decode(fe,{stream:!0});let Qe=te.split(`
28
28
 
29
29
  `);te=Qe.pop()||"";for(let pt of Qe){if(!pt.trim())continue;let Ja=pt.split(`
30
30
  `),Je="",ha="";for(let H of Ja)H.startsWith("event: ")?Je=H.slice(7):H.startsWith("data: ")&&(ha=H.slice(6));if(!(!Je||!ha))try{let H=JSON.parse(ha);if(Je==="progress")H.status==="thinking"?(ye("thinking"),Le([{message:H.message,completed:!1}])):H.status==="searching"?(ye("thinking"),Le([{message:H.message||"Searching knowledge base...",completed:!1}])):H.status==="evaluating"?(ye("thinking"),Le([{message:H.message||"Evaluating sources...",completed:!1}])):H.status==="executing"?(ye("executing"),Le(q=>{let re=q.map(Rt=>({...Rt,completed:!0})),de=re[re.length-1];return(!de||de.message!==H.message)&&re.push({message:H.message,completed:!1}),re})):H.status==="responding"&&(ye("responding"),Le(q=>q.map(re=>({...re,completed:!0}))));else if(Je==="response"){Le([]),J=!0;let q=H;if(q.action==="navigate"&&q.navigation){let re={page:q.navigation.page,subtab:q.navigation.subtab};Ru(re);let de={id:E+1,role:"assistant",kind:"navigationAction",content:q.response||`I can take you to the ${kk(re)}.`,navigationTarget:re};m(Rt=>[...Rt,de]),ye("idle")}else if(q.action==="show_form"&&q.actionType){yp({type:q.actionType,data:q.actionData||{}}),se(q.actionData||{});let re={id:E+1,role:"assistant",kind:"actionForm",content:q.response||q.message||"Please fill in the details below:",actionType:q.actionType,actionData:q.actionData||{}};m(de=>[...de,re]),ye("idle")}else if(q.action==="suggest_bulk"){let re=E+1,de={id:re,role:"assistant",kind:"text",content:""};m(Rt=>[...Rt,de]),Qa(re,q.response||q.message||"For bulk operations, you can upload a CSV file - just click the \u{1F4CE} button!",q.followups),J=!0}else if(q.action==="bulk_preview"){Ar(q.bulk_session_id);let re={id:E+1,role:"assistant",kind:"bulkPreview",content:q.message||`I found ${q.csv_data?.rowCount||0} items. Here's a preview:`,csvData:q.csv_data?{rowCount:q.csv_data.rowCount,columns:q.csv_data.columns,sampleRows:q.csv_data.sampleRows,fileName:"From context"}:void 0,suggestedAction:q.suggested_action,bulkSessionId:q.bulk_session_id};m(de=>[...de,re]),ye("idle"),J=!0}else if(q.action==="execute"&&q.executionResult){let re=E+1,de={id:re,role:"assistant",kind:"text",content:"",structuredData:q.structuredData||void 0};m(Rt=>[...Rt,de]),Qa(re,q.response||"Action completed successfully.",q.followups),J=!0,setTimeout(()=>{window.dispatchEvent(new CustomEvent("agentActionComplete",{detail:{result:q.executionResult}}))},100)}else{let re=E+1,de={id:re,role:"assistant",kind:"text",content:""};m(Rt=>[...Rt,de]),Qa(re,q.response||q.message||"",q.followups),J=!0}}else if(Je==="error"){ye("idle"),Le([]),J=!0;let q=E+1,re={id:q,role:"assistant",kind:"text",content:""};m(de=>[...de,re]),Qa(q,H.message||"An error occurred processing your request.")}else if(Je==="done")Le([]),ye("idle"),J=!0;else if(Je==="escalation"){Aa(!0),ye("idle");let re={id:Date.now()+2,role:"assistant",kind:"text",content:H.message||"You've been connected to our support queue. An agent will be with you shortly."};m(de=>[...de,re])}}catch(H){console.error("Failed to parse SSE event:",H)}}}Le([]),J||ye("idle")}catch(X){console.error("Agent request failed:",X),Le([]);let T=E+1,O={id:T,role:"assistant",kind:"text",content:""};m(K=>[...K,O]);let b="I'm having trouble connecting to my backend.";X instanceof Error&&(X.name==="AbortError"?b="The request timed out. The server might be busy - please try again.":X.message.includes("Failed to fetch")||X.message.includes("NetworkError")?b="I'm having trouble connecting to my backend. Please make sure the agent server is running on port 5002.":X.message.includes("Agent request failed:")&&(b="The server encountered an error. Please try again.")),b+=" For simple navigation requests, I can still help you locally.",Qa(T,b)}finally{Le([])}}async function Pk(v,k){Pr.current.forEach(M=>window.clearTimeout(M)),Pr.current=[];let D=Date.now(),E={id:D,role:"user",content:`\u{1F4CE} ${k.name}
package/dist/index.cjs CHANGED
@@ -1077,7 +1077,7 @@ function TypingIndicator({ className = "" }) {
1077
1077
 
1078
1078
  // src/ChatPanel.tsx
1079
1079
  var import_jsx_runtime10 = require("react/jsx-runtime");
1080
- var CHAT_PANEL_VERSION = true ? "0.2.45" : "dev";
1080
+ var CHAT_PANEL_VERSION = true ? "0.2.46" : "dev";
1081
1081
  var DEFAULT_AGENT_URL = "http://localhost:5002";
1082
1082
  var PANEL_WIDTH = 340;
1083
1083
  function unescapeJsonString(str) {
@@ -1556,32 +1556,32 @@ function ChatPanel({
1556
1556
  if (!effectiveProductBackendUrl || orgConfigState.status !== "success") {
1557
1557
  return;
1558
1558
  }
1559
- const testUserSiteEndpoint = async () => {
1560
- const url = `${effectiveProductBackendUrl}/userSite`;
1561
- console.log("[KiteChat TEST] Testing GET /userSite endpoint...");
1559
+ const testProductBackendEndpoint = async () => {
1560
+ const url = `${effectiveProductBackendUrl}/getDocument/snowkite/categories/`;
1561
+ console.log("[KiteChat TEST] Testing product backend connectivity...");
1562
1562
  console.log("[KiteChat TEST] URL:", url);
1563
1563
  try {
1564
1564
  const response = await fetch(url, {
1565
1565
  method: "GET",
1566
- credentials: "include",
1566
+ // Note: not using credentials: 'include' to avoid CORS issues with wildcard
1567
1567
  headers: {
1568
1568
  "Accept": "application/json"
1569
1569
  }
1570
1570
  });
1571
- console.log("[KiteChat TEST] /userSite response status:", response.status);
1572
- console.log("[KiteChat TEST] /userSite response ok:", response.ok);
1571
+ console.log("[KiteChat TEST] Response status:", response.status);
1572
+ console.log("[KiteChat TEST] Response ok:", response.ok);
1573
1573
  if (response.ok) {
1574
1574
  const data = await response.json();
1575
- console.log("[KiteChat TEST] /userSite SUCCESS - data:", data);
1575
+ console.log("[KiteChat TEST] SUCCESS - product backend reachable, data:", data);
1576
1576
  } else {
1577
1577
  const errorText = await response.text();
1578
- console.log("[KiteChat TEST] /userSite FAILED - status:", response.status, "body:", errorText);
1578
+ console.log("[KiteChat TEST] FAILED - status:", response.status, "body:", errorText);
1579
1579
  }
1580
1580
  } catch (error) {
1581
- console.error("[KiteChat TEST] /userSite ERROR:", error);
1581
+ console.error("[KiteChat TEST] ERROR:", error);
1582
1582
  }
1583
1583
  };
1584
- testUserSiteEndpoint();
1584
+ testProductBackendEndpoint();
1585
1585
  }, [effectiveProductBackendUrl, orgConfigState.status]);
1586
1586
  const effectiveUser = React6.useMemo(() => {
1587
1587
  if (authState.status === "authenticated") {
package/dist/index.js CHANGED
@@ -31,7 +31,7 @@ import {
31
31
  cn,
32
32
  createKiteChat,
33
33
  useGuideCursor
34
- } from "./chunk-262FS4KW.js";
34
+ } from "./chunk-4HIWUL6E.js";
35
35
  export {
36
36
  ApiKeyList,
37
37
  AssistantActivity,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kite-copilot/chat-panel",
3
- "version": "0.2.45",
3
+ "version": "0.2.46",
4
4
  "description": "AI-powered chat panel SDK with programmatic lifecycle control",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",