1import{e as Es,k as Ki,R as G,l as ka,r as j,j as r,a as se,T as yn,f as bn,g as jn,i as wn,c as Aa}from"./index-BNxbYk1K.js";import{B as Y,u as Da}from"./Combination-DdClW_kE.js";import{C as A,d as D,a as F,b as O,c as Tt}from"./card-BkzPihmM.js";import{B as Va}from"./button-fGjzRQRl.js";import{S as B}from"./skeleton-CPNR71Kt.js";import{A as Fs,a as Os}from"./alert-Cb04qS0_.js";import{I as Zt}from"./insightbridge-nav-DvZSVhOF.js";import{D as Qt}from"./DashboardLayout-2A5En_hE.js";import{u as Ra,g as Ma,D as La}from"./useSharedDateRange-B9ov1rjd.js";import{T as It,a as Bt,b as ne,c as Ee}from"./tabs-rSzUEskH.js";import{D as Wi}from"./dollar-sign-Cm9B2fga.js";import{T as zi}from"./trending-down-BV8kovJk.js";import{G as Ea}from"./globe-tgDshTwv.js";import{U as Hi}from"./users-B0dMuCxA.js";import{_ as Fa,d as Yi,e as Oa,s as Ia,i as Tn,f as Ue,g as Gi,h as ct,j as ut,k as ze,v as Ba,S as $a,l as Ua,m as _e,T as le,n as _a,R as Ze,B as Xi,C as Nt,X as St,Y as Pt,c as ps,o as Ka,L as qi,a as gs,b as Ae}from"./BarChart-DgBr2EiS.js";import{E as Wa}from"./external-link-BlTzYYVV.js";import{I as Ct}from"./info-Bea9gTdA.js";import{C as za}from"./circle-alert-BBE_7vs0.js";import{S as Ha,a as Ya,b as Ga,c as Xa,d as qa}from"./select-htgafiqk.js";import{T as Se}from"./trending-up-CEmwXDes.js";import{T as Nn}from"./target-D5aI2EMC.js";import{T as Sn,M as Za}from"./trophy-CE6Xfz5t.js";import{T as kt}from"./triangle-alert-C7YlXR4k.js";import{A as Qa}from"./arrow-right-CJjy6aT4.js";import{L as Ja}from"./UnifiedHeader-Dz1rLYwV.js";import{S as we}from"./sparkles-C-LlAgkc.js";import{u as eo,U as to}from"./UpgradePrompt-n2PYTFbU.js";import{P as so}from"./PropertySwitcher-DZCwSNQH.js";import{u as no}from"./useSelectedProperty-BOYuBiF6.js";import{L as io}from"./loader-circle-DEmCcdJm.js";import{L as ro}from"./lightbulb-DZpiCaTN.js";import{m as Zi,a as Qi,f as Pn}from"./format-DUphz8-X.js";import{E as ao}from"./eye-uheIfAPm.js";import{S as oo}from"./shopping-cart-DYGqmtfR.js";import{C as lo}from"./credit-card-Cr_Px33V.js";import{a as co}from"./chevron-down-DrJl9VVd.js";import"./chart-column-CNgwqSkj.js";import"./package-D_k2v9ny.js";import"./brain-0WaJ2EXV.js";import"./bell-Cw7mLNf4.js";import"./settings-iJL7mPAd.js";import"./Favicon_1764023092809-ex95T9km.js";import"./file-spreadsheet-C8e1D25k.js";import"./shield-DpG7G2Na.js";import"./subDays-DLPromNv.js";import"./label-D5h4ca5X.js";import"./switch-DNkuY_cD.js";import"./index-0WFKV9rI.js";import"./calendar-DFb1Z1B5.js";import"./index-CWA5ziqM.js";import"./chevron-up-Egk5HEwc.js";import"./lock-DgahApRP.js";import"./zap-DdFSmoqL.js";import"./file-text-utP58_IN.js";/** 2 * @license lucide-react v0.453.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const uo=Es("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/** 7 * @license lucide-react v0.453.0 - ISC 8 * 9 * This source code is licensed under the ISC license. 10 * See the LICENSE file in the root directory of this source tree. 11 */const Jt=Es("Route",[["circle",{cx:"6",cy:"19",r:"3",key:"1kj8tv"}],["path",{d:"M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15",key:"1d8sl"}],["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}]]);/** 12 * @license lucide-react v0.453.0 - ISC 13 * 14 * This source code is licensed under the ISC license. 15 * See the LICENSE file in the root directory of this source tree. 16 */const ho=Es("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);var fo=Fa,mo=Oa,po=Yi;function go(t,e){return t&&t.length?fo(t,po(e),mo):void 0}var xo=go;const vo=Ki(xo);function yo(t,e){for(var s,n=-1,i=t.length;++n<i;){var o=e(t[n]);o!==void 0&&(s=s===void 0?o:s+o)}return s}var bo=yo,jo=Yi,wo=bo;function To(t,e){return t&&t.length?wo(t,jo(e)):0}var No=To;const So=Ki(No);var Po=["width","height","className","style","children"],Co=["sourceX","sourceY","sourceControlX","targetX","targetY","targetControlX","linkWidth"];function Fe(t){"@babel/helpers - typeof";return Fe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Fe(t)}function Cn(t,e){if(t==null)return{};var s=ko(t,e),n,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i<o.length;i++)n=o[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(s[n]=t[n])}return s}function ko(t,e){if(t==null)return{};var s={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;s[n]=t[n]}return s}function Te(){return Te=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var s=arguments[e];for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(t[n]=s[n])}return t},Te.apply(this,arguments)}function Ao(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function kn(t,e){for(var s=0;s<e.length;s++){var n=e[s];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,er(n.key),n)}}function Do(t,e,s){return e&&kn(t.prototype,e),s&&kn(t,s),Object.defineProperty(t,"prototype",{writable:!1}),t}function Vo(t,e,s){return e=At(e),Ro(t,Ji()?Reflect.construct(e,s||[],At(t).constructor):e.apply(t,s))}function Ro(t,e){if(e&&(Fe(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Mo(t)}function Mo(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Ji(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Ji=function(){return!!t})()}function At(t){return At=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(s){return s.__proto__||Object.getPrototypeOf(s)},At(t)}function Lo(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&xs(t,e)}
16function xs(t,e){return xs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},xs(t,e)}function An(t,e){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),s.push.apply(s,n)}return s}function L(t){for(var e=1;e<arguments.length;e++){var s=arguments[e]!=null?arguments[e]:{};e%2?An(Object(s),!0).forEach(function(n){$t(t,n,s[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)):An(Object(s)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(s,n))})}return t}function $t(t,e,s){return e=er(e),e in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function er(t){var e=Eo(t,"string");return Fe(e)=="symbol"?e:e+""}function Eo(t,e){if(Fe(t)!="object"||!t)return t;var s=t[Symbol.toPrimitive];if(s!==void 0){var n=s.call(t,e||"default");if(Fe(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Fo={x:0,y:0},Oo=function(e,s){var n=+e,i=s-n;return function(o){return n+i*o}},Ut=function(e){return e.y+e.dy/2},Qe=function(e){return e&&e.value||0},Dt=function(e,s){return s.reduce(function(n,i){return n+Qe(e[i])},0)},Io=function(e,s,n){return n.reduce(function(i,o){var a=s[o],l=e[a.source];return i+Ut(l)*Qe(s[o])},0)},Bo=function(e,s,n){return n.reduce(function(i,o){var a=s[o],l=e[a.target];return i+Ut(l)*Qe(s[o])},0)},$o=function(e,s){return e.y-s.y},Uo=function(e,s){for(var n=[],i=[],o=[],a=[],l=0,c=e.length;l<c;l++){var d=e[l];d.source===s&&(o.push(d.target),a.push(l)),d.target===s&&(n.push(d.source),i.push(l))}return{sourceNodes:n,sourceLinks:i,targetLinks:a,targetNodes:o}},_o=function t(e,s){for(var n=s.targetNodes,i=0,o=n.length;i<o;i++){var a=e[n[i]];a&&(a.depth=Math.max(s.depth+1,a.depth),t(e,a))}},Ko=function(e,s,n){for(var i=e.nodes,o=e.links,a=i.map(function(x,b){var v=Uo(o,b);return L(L(L({},x),v),{},{value:Math.max(Dt(o,v.sourceLinks),Dt(o,v.targetLinks)),depth:0})}),l=0,c=a.length;l<c;l++){var d=a[l];d.sourceNodes.length||_o(a,d)}var u=vo(a,function(x){return x.depth}).depth;if(u>=1)for(var h=(s-n)/u,f=0,m=a.length;f<m;f++){var p=a[f];p.targetNodes.length||(p.depth=u),p.x=p.depth*h,p.dx=n}return{tree:a,maxDepth:u}},Wo=function(e){for(var s=[],n=0,i=e.length;n<i;n++){var o=e[n];s[o.depth]||(s[o.depth]=[]),s[o.depth].push(o)}return s},zo=function(e,s,n,i){for(var o=_a(e.map(function(h){return(s-(h.length-1)*n)/So(h,Qe)})),a=0,l=e.length;a<l;a++)for(var c=0,d=e[a].length;c<d;c++){var u=e[a][c];u.y=c,u.dy=u.value*o}return i.map(function(h){return L(L({},h),{},{dy:Qe(h)*o})})},es=function(e,s,n){for(var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,o=0,a=e.length;o<a;o++){var l=e[o],c=l.length;i&&l.sort($o);for(var d=0,u=0;u<c;u++){var h=l[u],f=d-h.y;f>0&&(h.y+=f),d=h.y+h.dy+n}d=s+n;for(var m=c-1;m>=0;m--){var p=l[m],x=p.y+p.dy+n-d;if(x>0)p.y-=x,d=p.y;else break}}},Ho=function(e,s,n,i){for(var o=0,a=s.length;o<a;o++)for(var l=s[o],c=0,d=l.length;c<d;c++){var u=l[c];if(u.sourceLinks.length){var h=Dt(n,u.sourceLinks),f=Io(e,n,u.sourceLinks),m=f/h;u.y+=(m-Ut(u))*i}}},Yo=function(e,s,n,i){for(var o=s.length-1;o>=0;o--)for(var a=s[o],l=0,c=a.length;l<c;l++){var d=a[l];if(d.targetLinks.length){var u=Dt(n,d.targetLinks),h=Bo(e,n,d.targetLinks),f=h/u;d.y+=(f-Ut(d))*i}}},Go=function(e,s){for(var n=0,i=e.length;n<i;n++){var o=e[n],a=0,l=0;o.targetLinks.sort(function(p,x){return e[s[p].target].y-e[s[x].target].y}),o.sourceLinks.sort(function(p,x){return e[s[p].source].y-e[s[x].source].y});for(var c=0,d=o.targetLinks.length;c<d;c++){var u=s[o.targetLinks[c]];u&&(u.sy=a,a+=u.dy)}for(var h=0,f=o.sourceLinks.length;h<f;h++){var m=s[o.sourceLinks[h]];m&&(m.ty=l,l+=m.dy)}}},Xo=function(e){var s=e.data,n=e.width,i=e.height,o=e.iterations,a=e.nodeWidth,l=e.nodePadding,c=e.sort,d=s.links,u=Ko(s,n,a),h=u.tree,f=Wo(h),m=zo(f,i,l,d);es(f,i,l,c);for(var p=1,x=1;x<=o;x++)Yo(h,f,m,p*=.99),es(f,i,l,c),Ho(h,f,m,p),es(f,i,l,c);return Go(h,m),{nodes:h,links:m}},qo=function(e,s){return s==="node"?{x:e.x+e.width/2,y:e.y+e.height/2}:{x:(e.sourceX+e.targetX)/2,y:(e.sourceY+e.targetY)/2}},Zo=function(e,s,n){var i=e.payload;if(s==="node")return[{payload:e,name:_e(i,n,""),value:_e(i,"value")}];if(i.source&&i.target){var o=_e(i.source,n,""),a=_e(i.target,n,"");return[{payload:e,name:"".concat(o," - ").concat(a),value:_e(i,"value")}]}return[]},Is=function(t){function e(){var s;Ao(this,e);for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];return s=Vo(this,e,[].concat(i)),$t(s,"state",{activeElement:null,activeElementType:null,isTooltipActive:!1,nodes:[],links:[]}),s}return Lo(e,t),Do(e,[{key:"handleMouseEnter",value:function(n,i,o){var a=this.props,l=a.onMouseEnter,c=a.children,d=ct(c,le);d?this.setState(function(u){return d.props.trigger==="hover"?L(L({},u),{},{activeElement:n,activeElementType:i,isTooltipActive:!0}):u},function(){l&&l(n,i,o)}):l&&l(n,i,o)}},{key:"handleMouseLeave",value:function(n,i,o){var a=this.props,l=a.onMouseLeave,c=a.children,d=ct(c,le);d?this.setState(function(u){return d.props.trigger==="hover"?L(L({},u),{},{activeElement:void 0,activeElementType:void 0,isTooltipActive:!1}):u},function(){l&&l(n,i,o)}):l&&l(n,i,o)}},{key:"handleClick",value:function(n,i,o){var a=this.props,l=a.onClick,c=a.children,d=ct(c,le);d&&d.props.trigger==="click"&&(this.state.isTooltipActive?this.setState(function(u){return L(L({},u),{},{activeElement:void 0,activeElementType:void 0,isTooltipActive:!1})}):this.setState(function(u){return L(L({},u),{},{activeElement:n,activeElementType:i,isTooltipActive:!0})}
16)),l&&l(n,i,o)}},{key:"renderLinks",value:function(n,i){var o=this,a=this.props,l=a.linkCurvature,c=a.link,d=a.margin,u=ut(d,"top")||0,h=ut(d,"left")||0;return G.createElement(ze,{className:"recharts-sankey-links",key:"recharts-sankey-links"},n.map(function(f,m){var p=f.sy,x=f.ty,b=f.dy,v=i[f.source],y=i[f.target],g=v.x+v.dx+h,N=y.x+h,w=Oo(g,N),P=w(l),V=w(1-l),C=v.y+p+b/2+u,M=y.y+x+b/2+u,$=L({sourceX:g,targetX:N,sourceY:C,targetY:M,sourceControlX:P,targetControlX:V,sourceRelativeY:p,targetRelativeY:x,linkWidth:b,index:m,payload:L(L({},f),{},{source:v,target:y})},Ue(c,!1)),ee={onMouseEnter:o.handleMouseEnter.bind(o,$,"link"),onMouseLeave:o.handleMouseLeave.bind(o,$,"link"),onClick:o.handleClick.bind(o,$,"link")};return G.createElement(ze,Te({key:"link-".concat(f.source,"-").concat(f.target,"-").concat(f.value)},ee),o.constructor.renderLinkItem(c,$))}))}},{key:"renderNodes",value:function(n){var i=this,o=this.props,a=o.node,l=o.margin,c=ut(l,"top")||0,d=ut(l,"left")||0;return G.createElement(ze,{className:"recharts-sankey-nodes",key:"recharts-sankey-nodes"},n.map(function(u,h){var f=u.x,m=u.y,p=u.dx,x=u.dy,b=L(L({},Ue(a,!1)),{},{x:f+d,y:m+c,width:p,height:x,index:h,payload:u}),v={onMouseEnter:i.handleMouseEnter.bind(i,b,"node"),onMouseLeave:i.handleMouseLeave.bind(i,b,"node"),onClick:i.handleClick.bind(i,b,"node")};return G.createElement(ze,Te({key:"node-".concat(u.x,"-").concat(u.y,"-").concat(u.value)},v),i.constructor.renderNodeItem(a,b))}))}},{key:"renderTooltip",value:function(){var n=this.props,i=n.children,o=n.width,a=n.height,l=n.nameKey,c=ct(i,le);if(!c)return null;var d=this.state,u=d.isTooltipActive,h=d.activeElement,f=d.activeElementType,m={x:0,y:0,width:o,height:a},p=h?qo(h,f):Fo,x=h?Zo(h,f,l):[];return G.cloneElement(c,{viewBox:m,active:u,coordinate:p,label:"",payload:x})}},{key:"render",value:function(){if(!Ba(this))return null;var n=this.props,i=n.width,o=n.height,a=n.className,l=n.style,c=n.children,d=Cn(n,Po),u=this.state,h=u.links,f=u.nodes,m=Ue(d,!1);return G.createElement("div",{className:ka("recharts-wrapper",a),style:L(L({},l),{},{position:"relative",cursor:"default",width:i,height:o}),role:"region"},G.createElement($a,Te({},m,{width:i,height:o}),Ua(c),this.renderLinks(h,f),this.renderNodes(f)),this.renderTooltip())}}],[{key:"getDerivedStateFromProps",value:function(n,i){var o=n.data,a=n.width,l=n.height,c=n.margin,d=n.iterations,u=n.nodeWidth,h=n.nodePadding,f=n.sort;if(o!==i.prevData||a!==i.prevWidth||l!==i.prevHeight||!Ia(c,i.prevMargin)||d!==i.prevIterations||u!==i.prevNodeWidth||h!==i.prevNodePadding||f!==i.sort){var m=a-(c&&c.left||0)-(c&&c.right||0),p=l-(c&&c.top||0)-(c&&c.bottom||0),x=Xo({data:o,width:m,height:p,iterations:d,nodeWidth:u,nodePadding:h,sort:f}),b=x.links,v=x.nodes;return L(L({},i),{},{nodes:v,links:b,prevData:o,prevWidth:d,prevHeight:l,prevMargin:c,prevNodePadding:h,prevNodeWidth:u,prevIterations:d,prevSort:f})}return null}},{key:"renderLinkItem",value:function(n,i){if(G.isValidElement(n))return G.cloneElement(n,i);if(Tn(n))return n(i);var o=i.sourceX,a=i.sourceY,l=i.sourceControlX,c=i.targetX,d=i.targetY,u=i.targetControlX,h=i.linkWidth,f=Cn(i,Co);return G.createElement("path",Te({className:"recharts-sankey-link",d:` 17 M`.concat(o,",").concat(a,` 18 C`).concat(l,",").concat(a," ").concat(u,",").concat(d," ").concat(c,",").concat(d,` 19 `),fill:"none",stroke:"#333",strokeWidth:h,strokeOpacity:"0.2"},Ue(f,!1)))}},{key:"renderNodeItem",value:function(n,i){return G.isValidElement(n)?G.cloneElement(n,i):Tn(n)?n(i):G.createElement(Gi,Te({className:"recharts-sankey-node",fill:"#0088fe",fillOpacity:"0.8"},Ue(i,!1),{role:"img"}))}}])}(j.PureComponent);$t(Is,"displayName","Sankey");$t(Is,"defaultProps",{nameKey:"name",dataKey:"value",nodePadding:10,nodeWidth:10,linkCurvature:.5,iterations:32,margin:{top:5,right:5,bottom:5,left:5},sort:!0});function Dn(t,e){const n=tl(t);let i;if(n.date){const c=sl(n.date,2);i=nl(c.restDateString,c.year)}if(!i||isNaN(i.getTime()))return new Date(NaN);const o=i.getTime();let a=0,l;if(n.time&&(a=il(n.time),isNaN(a)))return new Date(NaN);if(n.timezone){if(l=rl(n.timezone),isNaN(l))return new Date(NaN)}else{const c=new Date(o+a),d=new Date(0);return d.setFullYear(c.getUTCFullYear(),c.getUTCMonth(),c.getUTCDate()),d.setHours(c.getUTCHours(),c.getUTCMinutes(),c.getUTCSeconds(),c.getUTCMilliseconds()),d}return new Date(o+a+l)}
19const dt={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},Qo=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,Jo=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,el=/^([+-])(\d{2})(?::?(\d{2}))?$/;function tl(t){const e={},s=t.split(dt.dateTimeDelimiter);let n;if(s.length>2)return e;if(/:/.test(s[0])?n=s[0]:(e.date=s[0],n=s[1],dt.timeZoneDelimiter.test(e.date)&&(e.date=t.split(dt.timeZoneDelimiter)[0],n=t.substr(e.date.length,t.length))),n){const i=dt.timezone.exec(n);i?(e.time=n.replace(i[1],""),e.timezone=i[1]):e.time=n}return e}function sl(t,e){const s=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+e)+"})|(\\d{2}|[+-]\\d{"+(2+e)+"})$)"),n=t.match(s);if(!n)return{year:NaN,restDateString:""};const i=n[1]?parseInt(n[1]):null,o=n[2]?parseInt(n[2]):null;return{year:o===null?i:o*100,restDateString:t.slice((n[1]||n[2]).length)}}function nl(t,e){if(e===null)return new Date(NaN);const s=t.match(Qo);if(!s)return new Date(NaN);const n=!!s[4],i=Ke(s[1]),o=Ke(s[2])-1,a=Ke(s[3]),l=Ke(s[4]),c=Ke(s[5])-1;if(n)return ul(e,l,c)?al(e,l,c):new Date(NaN);{const d=new Date(0);return!ll(e,o,a)||!cl(e,i)?new Date(NaN):(d.setUTCFullYear(e,o,Math.max(i,a)),d)}}function Ke(t){return t?parseInt(t):1}function il(t){const e=t.match(Jo);if(!e)return NaN;const s=ts(e[1]),n=ts(e[2]),i=ts(e[3]);return dl(s,n,i)?s*Zi+n*Qi+i*1e3:NaN}function ts(t){return t&&parseFloat(t.replace(",","."))||0}function rl(t){if(t==="Z")return 0;const e=t.match(el);if(!e)return 0;const s=e[1]==="+"?-1:1,n=parseInt(e[2]),i=e[3]&&parseInt(e[3])||0;return hl(n,i)?s*(n*Zi+i*Qi):NaN}function al(t,e,s){const n=new Date(0);n.setUTCFullYear(t,0,4);const i=n.getUTCDay()||7,o=(e-1)*7+s+1-i;return n.setUTCDate(n.getUTCDate()+o),n}const ol=[31,null,31,30,31,30,31,31,30,31,30,31];function tr(t){return t%400===0||t%4===0&&t%100!==0}function ll(t,e,s){return e>=0&&e<=11&&s>=1&&s<=(ol[e]||(tr(t)?29:28))}function cl(t,e){return e>=1&&e<=(tr(t)?366:365)}function ul(t,e,s){return e>=1&&e<=53&&s>=0&&s<=6}function dl(t,e,s){return t===24?e===0&&s===0:s>=0&&s<60&&e>=0&&e<60&&t>=0&&t<25}function hl(t,e){return e>=0&&e<=59}function fl(t){if(typeof Proxy>"u")return t;const e=new Map,s=(...n)=>t(...n);return new Proxy(s,{get:(n,i)=>i==="create"?t:(e.has(i)||e.set(i,t(i)),e.get(i))})}function _t(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}const vs=t=>Array.isArray(t);function sr(t,e){if(!Array.isArray(e))return!1;const s=e.length;if(s!==t.length)return!1;for(let n=0;n<s;n++)if(e[n]!==t[n])return!1;return!0}function Je(t){return typeof t=="string"||Array.isArray(t)}function Vn(t){const e=[{},{}];return t==null||t.values.forEach((s,n)=>{e[0][n]=s.get(),e[1][n]=s.getVelocity()}),e}function Bs(t,e,s,n){if(typeof e=="function"){const[i,o]=Vn(n);e=e(s!==void 0?s:t.custom,i,o)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[i,o]=Vn(n);e=e(s!==void 0?s:t.custom,i,o)}return e}function Kt(t,e,s){const n=t.getProps();return Bs(n,e,s!==void 0?s:n.custom,t)}const $s=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Us=["initial",...$s],it=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Ce=new Set(it),ue=t=>t*1e3,de=t=>t/1e3,ml={type:"spring",stiffness:500,damping:25,restSpeed:10},pl=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),gl={type:"keyframes",duration:.8},xl={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},vl=(t,{keyframes:e})=>e.length>2?gl:Ce.has(t)?t.startsWith("scale")?pl(e[1]):ml:xl;function _s(t,e){return t?t[e]||t.default||t:void 0}const yl={skipAnimations:!1,useManualTiming:!1},bl=t=>t!==null;function Wt(t,{repeat:e,repeatType:s="loop"},n){const i=t.filter(bl),o=e&&s!=="loop"&&e%2===1?0:i.length-1;return!o||n===void 0?i[o]:n}const H=t=>t;let ys=H;function jl(t){let e=new Set,s=new Set,n=!1,i=!1;const o=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1};function l(d){o.has(d)&&(c.schedule(d),t()),d(a)}const c={schedule:(d,u=!1,h=!1)=>{const m=h&&n?e:s;return u&&o.add(d),m.has(d)||m.add(d),d},cancel:d=>
vendor: 83,545 bytes, line 19
19{s.delete(d),o.delete(d)},process:d=>{if(a=d,n){i=!0;return}n=!0,[e,s]=[s,e],s.clear(),e.forEach(l),n=!1,i&&(i=!1,c.process(d))}};return c}const ht=["read","resolveKeyframes","update","preRender","render","postRender"],wl=40;function nr(t,e){let s=!1,n=!0;const i={delta:0,timestamp:0,isProcessing:!1},o=()=>s=!0,a=ht.reduce((v,y)=>(v[y]=jl(o),v),{}),{read:l,resolveKeyframes:c,update:d,preRender:u,render:h,postRender:f}=a,m=()=>{const v=performance.now();s=!1,i.delta=n?1e3/60:Math.max(Math.min(v-i.timestamp,wl),1),i.timestamp=v,i.isProcessing=!0,l.process(i),c.process(i),d.process(i),u.process(i),h.process(i),f.process(i),i.isProcessing=!1,s&&e&&(n=!1,t(m))},p=()=>{s=!0,n=!0,i.isProcessing||t(m)};return{schedule:ht.reduce((v,y)=>{const g=a[y];return v[y]=(N,w=!1,P=!1)=>(s||p(),g.schedule(N,w,P)),v},{}),cancel:v=>{for(let y=0;y<ht.length;y++)a[ht[y]].cancel(v)},state:i,steps:a}}const{schedule:k,cancel:ge,state:K,steps:ss}=nr(typeof requestAnimationFrame<"u"?requestAnimationFrame:H,!0),ir=(t,e,s)=>(((1-3*s+3*e)*t+(3*s-6*e))*t+3*e)*t,Tl=1e-7,Nl=12;function Sl(t,e,s,n,i){let o,a,l=0;do a=e+(s-e)/2,o=ir(a,n,i)-t,o>0?s=a:e=a;while(Math.abs(o)>Tl&&++l<Nl);return a}function rt(t,e,s,n){if(t===e&&s===n)return H;const i=o=>Sl(o,0,1,t,s);return o=>o===0||o===1?o:ir(i(o),e,n)}const rr=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,ar=t=>e=>1-t(1-e),or=rt(.33,1.53,.69,.99),Ks=ar(or),lr=rr(Ks),cr=t=>(t*=2)<1?.5*Ks(t):.5*(2-Math.pow(2,-10*(t-1))),Ws=t=>1-Math.sin(Math.acos(t)),ur=ar(Ws),dr=rr(Ws),hr=t=>/^0[^.\s]+$/u.test(t);function Pl(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||hr(t):!0}const fr=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),mr=t=>e=>typeof e=="string"&&e.startsWith(t),pr=mr("--"),Cl=mr("var(--"),zs=t=>Cl(t)?kl.test(t.split("/*")[0].trim()):!1,kl=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,Al=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Dl(t){const e=Al.exec(t);if(!e)return[,];const[,s,n,i]=e;return[`--${s??n}`,i]}function gr(t,e,s=1){const[n,i]=Dl(t);if(!n)return;const o=window.getComputedStyle(e).getPropertyValue(n);if(o){const a=o.trim();return fr(a)?parseFloat(a):a}return zs(i)?gr(i,e,s+1):i}const he=(t,e,s)=>s>e?e:s<t?t:s,$e={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},et={...$e,transform:t=>he(0,1,t)},ft={...$e,default:1},at=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),fe=at("deg"),ie=at("%"),S=at("px"),Vl=at("vh"),Rl=at("vw"),Rn={...ie,parse:t=>ie.parse(t)/100,transform:t=>ie.transform(t*100)},Ml=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),Mn=t=>t===$e||t===S,Ln=(t,e)=>parseFloat(t.split(", ")[e]),En=(t,e)=>(s,{transform:n})=>{if(n==="none"||!n)return 0;const i=n.match(/^matrix3d\((.+)\)$/u);if(i)return Ln(i[1],e);{const o=n.match(/^matrix\((.+)\)$/u);return o?Ln(o[1],t):0}},Ll=new Set(["x","y","z"]),El=it.filter(t=>!Ll.has(t));function Fl(t){const e=[];return El.forEach(s=>{const n=t.getValue(s);n!==void 0&&(e.push([s,n.get()]),n.set(s.startsWith("scale")?1:0))}),e}const Oe={width:({x:t},{paddingLeft:e="0",paddingRight:s="0"})=>t.max-t.min-parseFloat(e)-parseFloat(s),height:({y:t},{paddingTop:e="0",paddingBottom:s="0"})=>t.max-t.min-parseFloat(e)-parseFloat(s),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:En(4,13),y:En(5,14)};Oe.translateX=Oe.x;Oe.translateY=Oe.y;const xr=t=>e=>e.test(t),Ol={test:t=>t==="auto",parse:t=>t},vr=[$e,S,ie,fe,Rl,Vl,Ol],Fn=t=>vr.find(xr(t)),Pe=new Set;let bs=!1,js=!1;function yr(){if(js){const t=Array.from(Pe).filter(n=>n.needsMeasurement),e=new Set(t.map(n=>n.element)),s=new Map;e.forEach(n=>{const i=Fl(n);i.length&&(s.set(n,i),n.render())}),t.forEach(n=>n.measureInitialState()),e.forEach(n=>{n.render();const i=s.get(n);i&&i.forEach(([o,a])=>{var l;(l=n.getValue(o))===null||l===void 0||l.set(a)})}),t.forEach(n=>n.measureEndState()),t.forEach(n=>{n.suspendedScrollY!==void 0&&window.scrollTo(0,n.suspendedScrollY)})}js=!1,bs=!1,Pe.forEach(t=>t.complete()),Pe.clear()}function br(){Pe.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(js=!0)})}function Il(){br(),yr()}class Hs{constructor(e,s,n,i,o,a=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...e],this.onComplete=s,this.name=n,this.motionValue=i,this.element=o,this.isAsync=a}scheduleResolve(){this.isScheduled=!0,this.isAsync?(Pe.add(this),bs||(bs=!0,k.read(br),k.resolveKeyframes(yr))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:s,element:n,motionValue:i}=this;for(let o=0;o<e.length;o++)if(e[o]===null)if(o===0){const a=i==null?void 0:i.get(),l=e[e.length-1];if(a!==void 0)e[0]=a;else if(n&&s){const c=n.readValue(s,l);c!=null&&(e[0]=c)}e[0]===void 0&&(e[0]=l),i&&a===void 0&&i.set(e[0])}else e[o]=e[o-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),Pe.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,Pe.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const Ge=t=>Math.round(t*1e5)/1e5,Ys=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function Bl(t){return t==null}const $l=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Gs=(t,e)=>s=>!!(typeof s=="string"&&$l.test(s)&&s.startsWith(t)||e&&!Bl(s)&&Object.prototype.hasOwnProperty.call(s,e)),jr=(t,e,s)=>n=>{if(typeof n!="string")return n;const[i,o,a,l]=n.match(Ys);return{[t]:parseFloat(i),[e]:parseFloat(o),[s]:parseFloat(a),alpha:l!==void 0?parseFloat(l):1}},Ul=t=>he(0,255,t),ns={...$e,transform:t=>Math.round(Ul(t))},Ne={test:Gs("rgb","red"),parse:jr("red","green","blue"),transform:({red:t,green:e,blue:s,alpha:n=1})=>"rgba("+ns.transform(t)+", "+ns.transform(e)+", "+ns.transform(s)+", "+Ge(et.transform(n))+")"};function _l(t){let e="",s="",n="",i="";return t.length>5?(e=t.substring(1,3),s=t.substring(3,5),n=t.substring(5,7),i=t.substring(7,9)):(e=t.substring(1,2),s=t.substring(2,3),n=t.substring(3,4),i=t.substring(4,5),e+=e,s+=s,n+=n,i+=i),{red:parseInt(e,16),green:parseInt(s,16),blue:parseInt(n,16),alpha:i?parseInt(i,16)/255:1}}const ws={test:Gs("#"),parse:_l,transform:Ne.transform},De={test:Gs("hsl","hue"),parse:jr("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:s,alpha:n=1})=>"hsla("+Math.round(t)+", "+ie.transform(Ge(e))+", "+ie.transform(Ge(s))+", "+Ge(et.transform(n))+")"},W={test:t=>Ne.test(t)||ws.test(t)||De.test(t),parse:t=>Ne.test(t)?Ne.parse(t):De.test(t)?De.parse(t):ws.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?Ne.transform(t):De.transform(t)},Kl=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function Wl(t){var e,s;return isNaN(t)&&typeof t=="string"&&(((e=t.match(Ys))===null||e===void 0?void 0:e.length)||0)+(((s=t.match(Kl))===null||s===void 0?void 0:s.length)||0)>0}const wr="number",Tr="color",zl="var",Hl="var(",On="${}",Yl=/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 tt(t){const e=t.toString(),s=[],n={color:[],number:[],var:[]},i=[];let o=0;const l=e.replace(Yl,c=>(W.test(c)?(n.color.push(o),i.push(Tr),s.push(W.parse(c))):c.startsWith(Hl)?(n.var.push(o),i.push(zl),s.push(c)):(n.number.push(o),i.push(wr),s.push(parseFloat(c))),++o,On)).split(On);return{values:s,split:l,indexes:n,types:i}}function Nr(t){return tt(t).values}function Sr(t){const{split:e,types:s}=tt(t),n=e.length;return i=>{let o="";for(let a=0;a<n;a++)if(o+=e[a],i[a]!==void 0){const l=s[a];l===wr?o+=Ge(i[a]):l===Tr?o+=W.transform(i[a]):o+=i[a]}return o}}const Gl=t=>typeof t=="number"?0:t;function Xl(t){const e=Nr(t);return Sr(t)(e.map(Gl))}const xe={test:Wl,parse:Nr,createTransformer:Sr,getAnimatableNone:Xl},ql=new Set(["brightness","contrast","saturate","opacity"]);function Zl(t){const[e,s]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[n]=s.match(Ys)||[];if(!n)return t;const i=s.replace(n,"");let o=ql.has(e)?1:0;return n!==s&&(o*=100),e+"("+o+i+")"}const Ql=/\b([a-z-]*)\(.*?\)/gu,Ts={...xe,getAnimatableNone:t=>{const e=t.match(Ql);return e?e.map(Zl).join(" "):t}},Jl={borderWidth:S,borderTopWidth:S,borderRightWidth:S,borderBottomWidth:S,borderLeftWidth:S,borderRadius:S,radius:S,borderTopLeftRadius:S,borderTopRightRadius:S,borderBottomRightRadius:S,borderBottomLeftRadius:S,width:S,maxWidth:S,height:S,maxHeight:S,top:S,right:S,bottom:S,left:S,padding:S,paddingTop:S,paddingRight:S,paddingBottom:S,paddingLeft:S,margin:S,marginTop:S,marginRight:S,marginBottom:S,marginLeft:S,backgroundPositionX:S,backgroundPositionY:S},ec={rotate:fe,rotateX:fe,rotateY:fe,rotateZ:fe,scale:ft,scaleX:ft,scaleY:ft,scaleZ:ft,skew:fe,skewX:fe,skewY:fe,distance:S,translateX:S,translateY:S,translateZ:S,x:S,y:S,z:S,perspective:S,transformPerspective:S,opacity:et,originX:Rn,originY:Rn,originZ:S},In={...$e,transform:Math.round},Xs={...Jl,...ec,zIndex:In,size:S,fillOpacity:et,strokeOpacity:et,numOctaves:In},tc={...Xs,color:W,backgroundColor:W,outlineColor:W,fill:W,stroke:W,borderColor:W,borderTopColor:W,borderRightColor:W,borderBottomColor:W,borderLeftColor:W,filter:Ts,WebkitFilter:Ts},qs=t=>tc[t];function Pr(t,e){let s=qs(t);return s!==Ts&&(s=xe),s.getAnimatableNone?s.getAnimatableNone(e):void 0}const sc=new Set(["auto","none","0"]);function nc(t,e,s){let n=0,i;for(;n<t.length&&!i;){const o=t[n];typeof o=="string"&&!sc.has(o)&&tt(o).values.length&&(i=t[n]),n++}if(i&&s)for(const o of e)t[o]=Pr(s,i)}class Cr extends Hs{constructor(e,s,n,i,o){super(e,s,n,i,o,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:s,name:n}=this;if(!s||!s.current)return;super.readKeyframes();for(let c=0;c<e.length;c++){let d=e[c];if(typeof d=="string"&&(d=d.trim(),zs(d))){const u=gr(d,s.current);u!==void 0&&(e[c]=u),c===e.length-1&&(this.finalKeyframe=d)}}if(this.resolveNoneKeyframes(),!Ml.has(n)||e.length!==2)return;const[i,o]=e,a=Fn(i),l=Fn(o);if(a!==l)if(Mn(a)&&Mn(l))for(let c=0;c<e.length;c++){const d=e[c];typeof d=="string"&&(e[c]=parseFloat(d))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:s}=this,n=[];for(let i=0;i<e.length;i++)Pl(e[i])&&n.push(i);n.length&&nc(e,n,s)}measureInitialState(){const{element:e,unresolvedKeyframes:s,name:n}=this;if(!e||!e.current)return;n==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Oe[n](e.measureViewportBox(),window.getComputedStyle(e.current)),s[0]=this.measuredOrigin;const i=s[s.length-1];i!==void 0&&e.getValue(n,i).jump(i,!1)}measureEndState(){var e;const{element:s,name:n,unresolvedKeyframes:i}=this;if(!s||!s.current)return;const o=s.getValue(n);o&&o.jump(this.measuredOrigin,!1);const a=i.length-1,l=i[a];i[a]=Oe[n](s.measureViewportBox(),window.getComputedStyle(s.current)),l!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=l),!((e=this.removedTransforms)===null||e===void 0)&&e.length&&this.removedTransforms.forEach(([c,d])=>{s.getValue(c).set(d)}),this.resolveNoneKeyframes()}}function Zs(t){return typeof t=="function"}let bt;function ic(){bt=void 0}const re={now:()=>(bt===void 0&&re.set(K.isProcessing||yl.useManualTiming?K.timestamp:performance.now()),bt),set:t=>{bt=t,queueMicrotask(ic)}},Bn=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(xe.test(t)||t==="0")&&!t.startsWith("url("));function rc(t){const e=t[0];if(t.length===1)return!0;for(let s=0;s<t.length;s++)if(t[s]!==e)return!0}function ac(t,e,s,n){const i=t[0];if(i===null)return!1;if(e==="display"||e==="visibility")return!0;const o=t[t.length-1],a=Bn(i,e),l=Bn(o,e);return!a||!l?!1:rc(t)||(s==="spring"||Zs(s))&&n}const oc=40;class kr{constructor({autoplay:e=!0,delay:s=0,type:n="keyframes",repeat:i=0,repeatDelay:o=0,repeatType:a="loop",...l}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=re.now(),this.options={autoplay:e,delay:s,type:n,repeat:i,repeatDelay:o,repeatType:a,...l},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>oc?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&Il(),this._resolved}onKeyframesResolved(e,s){this.resolvedAt=re.now(),this.hasAttemptedResolve=!0;const{name:n,type:i,velocity:o,delay:a,onComplete:l,onUpdate:c,isGenerator:d}=this.options;if(!d&&!ac(e,n,i,o))if(a)this.options.duration=0;else{c==null||c(Wt(e,this.options,s)),l==null||l(),this.resolveFinishedPromise();return}const u=this.initPlayback(e,s);u!==!1&&(this._resolved={keyframes:e,finalKeyframe:s,...u},this.onPostResolved())}onPostResolved(){}then(e,s){return this.currentFinishedPromise.then(e,s)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(e=>{this.resolveFinishedPromise=e})}}const Ie=(t,e,s)=>{const n=e-t;return n===0?1:(s-t)/n},Ar=(t,e,s=10)=>{let n="";const i=Math.max(Math.round(e/s),2);for(let o=0;o<i;o++)n+=t(Ie(0,i-1,o))+", ";return`linear(${n.substring(0,n.length-2)})`};function Dr(t,e){return e?t*(1e3/e):0}const lc=5;function Vr(t,e,s){const n=Math.max(e-lc,0);return Dr(s-t(n),e-n)}const E={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},is=.001;function cc({duration:t=E.duration,bounce:e=E.bounce,velocity:s=E.velocity,mass:n=E.mass}){let i,o,a=1-e;a=he(E.minDamping,E.maxDamping,a),t=he(E.minDuration,E.maxDuration,de(t)),a<1?(i=d=>{const u=d*a,h=u*t,f=u-s,m=Ns(d,a),p=Math.exp(-h);return is-f/m*p},o=d=>{const h=d*a*t,f=h*s+s,m=Math.pow(a,2)*Math.pow(d,2)*t,p=Math.exp(-h),x=Ns(Math.pow(d,2),a);return(-i(d)+is>0?-1:1)*((f-m)*p)/x}):(i=d=>{const u=Math.exp(-d*t),h=(d-s)*t+1;return-is+u*h},o=d=>{const u=Math.exp(-d*t),h=(s-d)*(t*t);return u*h});const l=5/t,c=dc(i,o,l);if(t=ue(t),isNaN(c))return{stiffness:E.stiffness,damping:E.damping,duration:t};{const d=Math.pow(c,2)*n;return{stiffness:d,damping:a*2*Math.sqrt(n*d),duration:t}}}const uc=12;function dc(t,e,s){let n=s;for(let i=1;i<uc;i++)n=n-t(n)/e(n);return n}function Ns(t,e){return t*Math.sqrt(1-e*e)}const Ss=2e4;function Rr(t){let e=0;const s=50;let n=t.next(e);for(;!n.done&&e<Ss;)e+=s,n=t.next(e);return e>=Ss?1/0:e}const hc=["duration","bounce"],fc=["stiffness","damping","mass"];function $n(t,e){return e.some(s=>t[s]!==void 0)}function mc(t){let e={velocity:E.velocity,stiffness:E.stiffness,damping:E.damping,mass:E.mass,isResolvedFromDuration:!1,...t};if(!$n(t,fc)&&$n(t,hc))if(t.visualDuration){const s=t.visualDuration,n=2*Math.PI/(s*1.2),i=n*n,o=2*he(.05,1,1-t.bounce)*Math.sqrt(i);e={...e,mass:E.mass,stiffness:i,damping:o}}else{const s=cc(t);e={...e,...s,mass:E.mass},e.isResolvedFromDuration=!0}return e}function Mr(t=E.visualDuration,e=E.bounce){const s=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:n,restDelta:i}=s;const o=s.keyframes[0],a=s.keyframes[s.keyframes.length-1],l={done:!1,value:o},{stiffness:c,damping:d,mass:u,duration:h,velocity:f,isResolvedFromDuration:m}=mc({...s,velocity:-de(s.velocity||0)}),p=f||0,x=d/(2*Math.sqrt(c*u)),b=a-o,v=de(Math.sqrt(c/u)),y=Math.abs(b)<5;n||(n=y?E.restSpeed.granular:E.restSpeed.default),i||(i=y?E.restDelta.granular:E.restDelta.default);let g;if(x<1){const w=Ns(v,x);g=P=>{const V=Math.exp(-x*v*P);return a-V*((p+x*v*b)/w*Math.sin(w*P)+b*Math.cos(w*P))}}else if(x===1)g=w=>a-Math.exp(-v*w)*(b+(p+v*b)*w);else{const w=v*Math.sqrt(x*x-1);g=P=>{const V=Math.exp(-x*v*P),C=Math.min(w*P,300);return a-V*((p+x*v*b)*Math.sinh(C)+w*b*Math.cosh(C))/w}}const N={calculatedDuration:m&&h||null,next:w=>{const P=g(w);if(m)l.done=w>=h;else{let V=0;x<1&&(V=w===0?ue(p):Vr(g,w,P));const C=Math.abs(V)<=n,M=Math.abs(a-P)<=i;l.done=C&&M}return l.value=l.done?a:P,l},toString:()=>{const w=Math.min(Rr(N),Ss),P=Ar(V=>N.next(w*V).value,w,30);return w+"ms "+P}};return N}function Un({keyframes:t,velocity:e=0,power:s=.8,timeConstant:n=325,bounceDamping:i=10,bounceStiffness:o=500,modifyTarget:a,min:l,max:c,restDelta:d=.5,restSpeed:u}){const h=t[0],f={done:!1,value:h},m=C=>l!==void 0&&C<l||c!==void 0&&C>c,p=C=>l===void 0?c:c===void 0||Math.abs(l-C)<Math.abs(c-C)?l:c;let x=s*e;const b=h+x,v=a===void 0?b:a(b);v!==b&&(x=v-h);const y=C=>-x*Math.exp(-C/n),g=C=>v+y(C),N=C=>{const M=y(C),$=g(C);f.done=Math.abs(M)<=d,f.value=f.done?v:$};let w,P;const V=C=>{m(f.value)&&(w=C,P=Mr({keyframes:[f.value,p(f.value)],velocity:Vr(g,C,f.value),damping:i,stiffness:o,restDelta:d,restSpeed:u}))};return V(0),{calculatedDuration:null,next:C=>{let M=!1;return!P&&w===void 0&&(M=!0,N(C),V(C)),w!==void 0&&C>=w?P.next(C-w):(!M&&N(C),f)}}}const pc=rt(.42,0,1,1),gc=rt(0,0,.58,1),Lr=rt(.42,0,.58,1),xc=t=>Array.isArray(t)&&typeof t[0]!="number",Qs=t=>Array.isArray(t)&&typeof t[0]=="number",_n={linear:H,easeIn:pc,easeInOut:Lr,easeOut:gc,circIn:Ws,circInOut:dr,circOut:ur,backIn:Ks,backInOut:lr,backOut:or,anticipate:cr},Kn=t=>{if(Qs(t)){ys(t.length===4);const[e,s,n,i]=t;return rt(e,s,n,i)}else if(typeof t=="string")return ys(_n[t]!==void 0),_n[t];return t},vc=(t,e)=>s=>e(t(s)),me=(...t)=>t.reduce(vc),R=(t,e,s)=>t+(e-t)*s;function rs(t,e,s){return s<0&&(s+=1),s>1&&(s-=1),s<1/6?t+(e-t)*6*s:s<1/2?e:s<2/3?t+(e-t)*(2/3-s)*6:t}function yc({hue:t,saturation:e,lightness:s,alpha:n}){t/=360,e/=100,s/=100;let i=0,o=0,a=0;if(!e)i=o=a=s;else{const l=s<.5?s*(1+e):s+e-s*e,c=2*s-l;i=rs(c,l,t+1/3),o=rs(c,l,t),a=rs(c,l,t-1/3)}return{red:Math.round(i*255),green:Math.round(o*255),blue:Math.round(a*255),alpha:n}}function Vt(t,e){return s=>s>0?e:t}const as=(t,e,s)=>{const n=t*t,i=s*(e*e-n)+n;return i<0?0:Math.sqrt(i)},bc=[ws,Ne,De],jc=t=>bc.find(e=>e.test(t));function Wn(t){const e=jc(t);if(!e)return!1;let s=e.parse(t);return e===De&&(s=yc(s)),s}const zn=(t,e)=>{const s=Wn(t),n=Wn(e);if(!s||!n)return Vt(t,e);const i={...s};return o=>(i.red=as(s.red,n.red,o),i.green=as(s.green,n.green,o),i.blue=as(s.blue,n.blue,o),i.alpha=R(s.alpha,n.alpha,o),Ne.transform(i))},Ps=new Set(["none","hidden"]);function wc(t,e){return Ps.has(t)?s=>s<=0?t:e:s=>s>=1?e:t}function Tc(t,e){return s=>R(t,e,s)}function Js(t){return typeof t=="number"?Tc:typeof t=="string"?zs(t)?Vt:W.test(t)?zn:Pc:Array.isArray(t)?Er:typeof t=="object"?W.test(t)?zn:Nc:Vt}function Er(t,e){const s=[...t],n=s.length,i=t.map((o,a)=>Js(o)(o,e[a]));return o=>{for(let a=0;a<n;a++)s[a]=i[a](o);return s}}function Nc(t,e){const s={...t,...e},n={};for(const i in s)t[i]!==void 0&&e[i]!==void 0&&(n[i]=Js(t[i])(t[i],e[i]));return i=>{for(const o in n)s[o]=n[o](i);return s}}function Sc(t,e){var s;const n=[],i={color:0,var:0,number:0};for(let o=0;o<e.values.length;o++){const a=e.types[o],l=t.indexes[a][i[a]],c=(s=t.values[l])!==null&&s!==void 0?s:0;n[o]=c,i[a]++}return n}const Pc=(t,e)=>{const s=xe.createTransformer(e),n=tt(t),i=tt(e);return n.indexes.var.length===i.indexes.var.length&&n.indexes.color.length===i.indexes.color.length&&n.indexes.number.length>=i.indexes.number.length?Ps.has(t)&&!i.values.length||Ps.has(e)&&!n.values.length?wc(t,e):me(Er(Sc(n,i),i.values),s):Vt(t,e)};function Fr(t,e,s){return typeof t=="number"&&typeof e=="number"&&typeof s=="number"?R(t,e,s):Js(t)(t,e)}function Cc(t,e,s){const n=[],i=s||Fr,o=t.length-1;for(let a=0;a<o;a++){let l=i(t[a],t[a+1]);if(e){const c=Array.isArray(e)?e[a]||H:e;l=me(c,l)}n.push(l)}return n}function kc(t,e,{clamp:s=!0,ease:n,mixer:i}={}){const o=t.length;if(ys(o===e.length),o===1)return()=>e[0];if(o===2&&t[0]===t[1])return()=>e[1];t[0]>t[o-1]&&(t=[...t].reverse(),e=[...e].reverse());const a=Cc(e,n,i),l=a.length,c=d=>{let u=0;if(l>1)for(;u<t.length-2&&!(d<t[u+1]);u++);const h=Ie(t[u],t[u+1],d);return a[u](h)};return s?d=>c(he(t[0],t[o-1],d)):c}function Ac(t,e){const s=t[t.length-1];for(let n=1;n<=e;n++){const i=Ie(0,e,n);t.push(R(s,1,i))}}function Dc(t){const e=[0];return Ac(e,t.length-1),e}function Vc(t,e){return t.map(s=>s*e)}function Rc(t,e){return t.map(()=>e||Lr).splice(0,t.length-1)}function Rt({duration:t=300,keyframes:e,times:s,ease:n="easeInOut"}){const i=xc(n)?n.map(Kn):Kn(n),o={done:!1,value:e[0]},a=Vc(s&&s.length===e.length?s:Dc(e),t),l=kc(a,e,{ease:Array.isArray(i)?i:Rc(e,i)});return{calculatedDuration:t,next:c=>(o.value=l(c),o.done=c>=t,o)}}const Mc=t=>{const e=({timestamp:s})=>t(s);return{start:()=>k.update(e,!0),stop:()=>ge(e),now:()=>K.isProcessing?K.timestamp:re.now()}},Lc={decay:Un,inertia:Un,tween:Rt,keyframes:Rt,spring:Mr},Ec=t=>t/100;class en extends kr{constructor(e){super(e),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:c}=this.options;c&&c()};const{name:s,motionValue:n,element:i,keyframes:o}=this.options,a=(i==null?void 0:i.KeyframeResolver)||Hs,l=(c,d)=>this.onKeyframesResolved(c,d);this.resolver=new a(o,l,s,n,i),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(e){const{type:s="keyframes",repeat:n=0,repeatDelay:i=0,repeatType:o,velocity:a=0}=this.options,l=Zs(s)?s:Lc[s]||Rt;let c,d;l!==Rt&&typeof e[0]!="number"&&(c=me(Ec,Fr(e[0],e[1])),e=[0,100]);const u=l({...this.options,keyframes:e});o==="mirror"&&(d=l({...this.options,keyframes:[...e].reverse(),velocity:-a})),u.calculatedDuration===null&&(u.calculatedDuration=Rr(u));const{calculatedDuration:h}=u,f=h+i,m=f*(n+1)-i;return{generator:u,mirroredGenerator:d,mapPercentToKeyframes:c,calculatedDuration:h,resolvedDuration:f,totalDuration:m}}onPostResolved(){const{autoplay:e=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!e?this.pause():this.state=this.pendingPlayState}tick(e,s=!1){const{resolved:n}=this;if(!n){const{keyframes:C}=this.options;return{done:!0,value:C[C.length-1]}}const{finalKeyframe:i,generator:o,mirroredGenerator:a,mapPercentToKeyframes:l,keyframes:c,calculatedDuration:d,totalDuration:u,resolvedDuration:h}=n;if(this.startTime===null)return o.next(0);const{delay:f,repeat:m,repeatType:p,repeatDelay:x,onUpdate:b}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-u/this.speed,this.startTime)),s?this.currentTime=e:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(e-this.startTime)*this.speed;const v=this.currentTime-f*(this.speed>=0?1:-1),y=this.speed>=0?v<0:v>u;this.currentTime=Math.max(v,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=u);let g=this.currentTime,N=o;if(m){const C=Math.min(this.currentTime,u)/h;let M=Math.floor(C),$=C%1;!$&&C>=1&&($=1),$===1&&M--,M=Math.min(M,m+1),!!(M%2)&&(p==="reverse"?($=1-$,x&&($-=x/h)):p==="mirror"&&(N=a)),g=he(0,1,$)*h}const w=y?{done:!1,value:c[0]}:N.next(g);l&&(w.value=l(w.value));let{done:P}=w;!y&&d!==null&&(P=this.speed>=0?this.currentTime>=u:this.currentTime<=0);const V=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&P);return V&&i!==void 0&&(w.value=Wt(c,this.options,i)),b&&b(w.value),V&&this.finish(),w}get duration(){const{resolved:e}=this;return e?de(e.calculatedDuration):0}get time(){return de(this.currentTime)}set time(e){e=ue(e),this.currentTime=e,this.holdTime!==null||this.speed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.speed)}get speed(){return this.playbackSpeed}set speed(e){const s=this.playbackSpeed!==e;this.playbackSpeed=e,s&&(this.time=de(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:e=Mc,onPlay:s,startTime:n}=this.options;this.driver||(this.driver=e(o=>this.tick(o))),s&&s();const i=this.driver.now();this.holdTime!==null?this.startTime=i-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=i):this.startTime=n??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var e;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(e=this.currentTime)!==null&&e!==void 0?e:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:e}=this.options;e&&e()}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(e){return this.startTime=0,this.tick(e,!0)}}const Fc=new Set(["opacity","clipPath","filter","transform"]);function tn(t){let e;return()=>(e===void 0&&(e=t()),e)}const Oc={linearEasing:void 0};function Ic(t,e){const s=tn(t);return()=>{var n;return(n=Oc[e])!==null&&n!==void 0?n:s()}}const Mt=Ic(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing");function Or(t){return!!(typeof t=="function"&&Mt()||!t||typeof t=="string"&&(t in Cs||Mt())||Qs(t)||Array.isArray(t)&&t.every(Or))}const He=([t,e,s,n])=>`cubic-bezier(${t}, ${e}, ${s}, ${n})`,Cs={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:He([0,.65,.55,1]),circOut:He([.55,0,1,.45]),backIn:He([.31,.01,.66,-.59]),backOut:He([.33,1.53,.69,.99])};function Ir(t,e){if(t)return typeof t=="function"&&Mt()?Ar(t,e):Qs(t)?He(t):Array.isArray(t)?t.map(s=>Ir(s,e)||Cs.easeOut):Cs[t]}function Bc(t,e,s,{delay:n=0,duration:i=300,repeat:o=0,repeatType:a="loop",ease:l="easeInOut",times:c}={}){const d={[e]:s};c&&(d.offset=c);const u=Ir(l,i);return Array.isArray(u)&&(d.easing=u),t.animate(d,{delay:n,duration:i,easing:Array.isArray(u)?"linear":u,fill:"both",iterations:o+1,direction:a==="reverse"?"alternate":"normal"})}function Hn(t,e){t.timeline=e,t.onfinish=null}const $c=tn(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),Lt=10,Uc=2e4;function _c(t){return Zs(t.type)||t.type==="spring"||!Or(t.ease)}function Kc(t,e){const s=new en({...e,keyframes:t,repeat:0,delay:0,isGenerator:!0});let n={done:!1,value:t[0]};const i=[];let o=0;for(;!n.done&&o<Uc;)n=s.sample(o),i.push(n.value),o+=Lt;return{times:void 0,keyframes:i,duration:o-Lt,ease:"linear"}}const Br={anticipate:cr,backInOut:lr,circInOut:dr};function Wc(t){return t in Br}class Yn extends kr{constructor(e){super(e);const{name:s,motionValue:n,element:i,keyframes:o}=this.options;this.resolver=new Cr(o,(a,l)=>this.onKeyframesResolved(a,l),s,n,i),this.resolver.scheduleResolve()}initPlayback(e,s){var n;let{duration:i=300,times:o,ease:a,type:l,motionValue:c,name:d,startTime:u}=this.options;if(!(!((n=c.owner)===null||n===void 0)&&n.current))return!1;if(typeof a=="string"&&Mt()&&Wc(a)&&(a=Br[a]),_c(this.options)){const{onComplete:f,onUpdate:m,motionValue:p,element:x,...b}=this.options,v=Kc(e,b);e=v.keyframes,e.length===1&&(e[1]=e[0]),i=v.duration,o=v.times,a=v.ease,l="keyframes"}const h=Bc(c.owner.current,d,e,{...this.options,duration:i,times:o,ease:a});return h.startTime=u??this.calcStartTime(),this.pendingTimeline?(Hn(h,this.pendingTimeline),this.pendingTimeline=void 0):h.onfinish=()=>{const{onComplete:f}=this.options;c.set(Wt(e,this.options,s)),f&&f(),this.cancel(),this.resolveFinishedPromise()},{animation:h,duration:i,times:o,type:l,ease:a,keyframes:e}}get duration(){const{resolved:e}=this;if(!e)return 0;const{duration:s}=e;return de(s)}get time(){const{resolved:e}=this;if(!e)return 0;const{animation:s}=e;return de(s.currentTime||0)}set time(e){const{resolved:s}=this;if(!s)return;const{animation:n}=s;n.currentTime=ue(e)}get speed(){const{resolved:e}=this;if(!e)return 1;const{animation:s}=e;return s.playbackRate}set speed(e){const{resolved:s}=this;if(!s)return;const{animation:n}=s;n.playbackRate=e}get state(){const{resolved:e}=this;if(!e)return"idle";const{animation:s}=e;return s.playState}get startTime(){const{resolved:e}=this;if(!e)return null;const{animation:s}=e;return s.startTime}attachTimeline(e){if(!this._resolved)this.pendingTimeline=e;else{const{resolved:s}=this;if(!s)return H;const{animation:n}=s;Hn(n,e)}return H}play(){if(this.isStopped)return;const{resolved:e}=this;if(!e)return;const{animation:s}=e;s.playState==="finished"&&this.updateFinishedPromise(),s.play()}pause(){const{resolved:e}=this;if(!e)return;const{animation:s}=e;s.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:e}=this;if(!e)return;const{animation:s,keyframes:n,duration:i,type:o,ease:a,times:l}=e;if(s.playState==="idle"||s.playState==="finished")return;if(this.time){const{motionValue:d,onUpdate:u,onComplete:h,element:f,...m}=this.options,p=new en({...m,keyframes:n,duration:i,type:o,ease:a,times:l,isGenerator:!0}),x=ue(this.time);d.setWithVelocity(p.sample(x-Lt).value,p.sample(x).value,Lt)}const{onStop:c}=this.options;c&&c(),this.cancel()}complete(){const{resolved:e}=this;e&&e.animation.finish()}cancel(){const{resolved:e}=this;e&&e.animation.cancel()}static supports(e){const{motionValue:s,name:n,repeatDelay:i,repeatType:o,damping:a,type:l}=e;return $c()&&n&&Fc.has(n)&&s&&s.owner&&s.owner.current instanceof HTMLElement&&!s.owner.getProps().onUpdate&&!i&&o!=="mirror"&&a!==0&&l!=="inertia"}}const zc=tn(()=>window.ScrollTimeline!==void 0);class Hc{constructor(e){this.stop=()=>this.runAll("stop"),this.animations=e.filter(Boolean)}then(e,s){return Promise.all(this.animations).then(e).catch(s)}getAll(e){return this.animations[0][e]}setAll(e,s){for(let n=0;n<this.animations.length;n++)this.animations[n][e]=s}attachTimeline(e,s){const n=this.animations.map(i=>zc()&&i.attachTimeline?i.attachTimeline(e):s(i));return()=>{n.forEach((i,o)=>{i&&i(),this.animations[o].stop()})}}get time(){return this.getAll("time")}set time(e){this.setAll("time",e)}get speed(){return this.getAll("speed")}set speed(e){this.setAll("speed",e)}get startTime(){return this.getAll("startTime")}get duration(){let e=0;for(let s=0;s<this.animations.length;s++)e=Math.max(e,this.animations[s].duration);return e}runAll(e){this.animations.forEach(s=>s[e]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}function Yc({when:t,delay:e,delayChildren:s,staggerChildren:n,staggerDirection:i,repeat:o,repeatType:a,repeatDelay:l,from:c,elapsed:d,...u}){return!!Object.keys(u).length}const sn=(t,e,s,n={},i,o)=>a=>{const l=_s(n,t)||{},c=l.delay||n.delay||0;let{elapsed:d=0}=n;d=d-ue(c);let u={keyframes:Array.isArray(s)?s:[null,s],ease:"easeOut",velocity:e.getVelocity(),...l,delay:-d,onUpdate:f=>{e.set(f),l.onUpdate&&l.onUpdate(f)},onComplete:()=>{a(),l.onComplete&&l.onComplete()},name:t,motionValue:e,element:o?void 0:i};Yc(l)||(u={...u,...vl(t,u)}),u.duration&&(u.duration=ue(u.duration)),u.repeatDelay&&(u.repeatDelay=ue(u.repeatDelay)),u.from!==void 0&&(u.keyframes[0]=u.from);let h=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(u.duration=0,u.delay===0&&(h=!0)),h&&!o&&e.get()!==void 0){const f=Wt(u.keyframes,l);if(f!==void 0)return k.update(()=>{u.onUpdate(f),u.onComplete()}),new Hc([])}return!o&&Yn.supports(u)?new Yn(u):new en(u)},Gc=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),Xc=t=>vs(t)?t[t.length-1]||0:t;function nn(t,e){t.indexOf(e)===-1&&t.push(e)}function rn(t,e){const s=t.indexOf(e);s>-1&&t.splice(s,1)}class an{constructor(){this.subscriptions=[]}add(e){return nn(this.subscriptions,e),()=>rn(this.subscriptions,e)}notify(e,s,n){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](e,s,n);else for(let o=0;o<i;o++){const a=this.subscriptions[o];a&&a(e,s,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const Gn=30,qc=t=>!isNaN(parseFloat(t));class Zc{constructor(e,s={}){this.version="11.13.1",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(n,i=!0)=>{const o=re.now();this.updatedAt!==o&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(n),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),i&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(e),this.owner=s.owner}setCurrent(e){this.current=e,this.updatedAt=re.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=qc(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,s){this.events[e]||(this.events[e]=new an);const n=this.events[e].add(s);return e==="change"?()=>{n(),k.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,s){this.passiveEffect=e,this.stopPassiveEffect=s}set(e,s=!0){!s||!this.passiveEffect?this.updateAndNotify(e,s):this.passiveEffect(e,this.updateAndNotify)}setWithVelocity(e,s,n){this.set(s),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,s=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,s&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=re.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>Gn)return 0;const s=Math.min(this.updatedAt-this.prevUpdatedAt,Gn);return Dr(parseFloat(this.current)-parseFloat(this.prevFrameValue),s)}start(e){return this.stop(),new Promise(s=>{this.hasAnimated=!0,this.animation=e(s),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 st(t,e){return new Zc(t,e)}function Qc(t,e,s){t.hasValue(e)?t.getValue(e).set(s):t.addValue(e,st(s))}function Jc(t,e){const s=Kt(t,e);let{transitionEnd:n={},transition:i={},...o}=s||{};o={...o,...n};for(const a in o){const l=Xc(o[a]);Qc(t,a,l)}}const on=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),eu="framerAppearId",$r="data-"+on(eu);function Ur(t){return t.props[$r]}const z=t=>!!(t&&t.getVelocity);function tu(t){return!!(z(t)&&t.add)}function ks(t,e){const s=t.getValue("willChange");if(tu(s))return s.add(e)}function su({protectedKeys:t,needsAnimating:e},s){const n=t.hasOwnProperty(s)&&e[s]!==!0;return e[s]=!1,n}function _r(t,e,{delay:s=0,transitionOverride:n,type:i}={}){var o;let{transition:a=t.getDefaultTransition(),transitionEnd:l,...c}=e;n&&(a=n);const d=[],u=i&&t.animationState&&t.animationState.getState()[i];for(const h in c){const f=t.getValue(h,(o=t.latestValues[h])!==null&&o!==void 0?o:null),m=c[h];if(m===void 0||u&&su(u,h))continue;const p={delay:s,..._s(a||{},h)};let x=!1;if(window.MotionHandoffAnimation){const v=Ur(t);if(v){const y=window.MotionHandoffAnimation(v,h,k);y!==null&&(p.startTime=y,x=!0)}}ks(t,h),f.start(sn(h,f,m,t.shouldReduceMotion&&Ce.has(h)?{type:!1}:p,t,x));const b=f.animation;b&&d.push(b)}return l&&Promise.all(d).then(()=>{k.update(()=>{l&&Jc(t,l)})}),d}function As(t,e,s={}){var n;const i=Kt(t,e,s.type==="exit"?(n=t.presenceContext)===null||n===void 0?void 0:n.custom:void 0);let{transition:o=t.getDefaultTransition()||{}}=i||{};s.transitionOverride&&(o=s.transitionOverride);const a=i?()=>Promise.all(_r(t,i,s)):()=>Promise.resolve(),l=t.variantChildren&&t.variantChildren.size?(d=0)=>{const{delayChildren:u=0,staggerChildren:h,staggerDirection:f}=o;return nu(t,e,u+d,h,f,s)}:()=>Promise.resolve(),{when:c}=o;if(c){const[d,u]=c==="beforeChildren"?[a,l]:[l,a];return d().then(()=>u())}else return Promise.all([a(),l(s.delay)])}function nu(t,e,s=0,n=0,i=1,o){const a=[],l=(t.variantChildren.size-1)*n,c=i===1?(d=0)=>d*n:(d=0)=>l-d*n;return Array.from(t.variantChildren).sort(iu).forEach((d,u)=>{d.notify("AnimationStart",e),a.push(As(d,e,{...o,delay:s+c(u)}).then(()=>d.notify("AnimationComplete",e)))}),Promise.all(a)}function iu(t,e){return t.sortNodePosition(e)}function ru(t,e,s={}){t.notify("AnimationStart",e);let n;if(Array.isArray(e)){const i=e.map(o=>As(t,o,s));n=Promise.all(i)}else if(typeof e=="string")n=As(t,e,s);else{const i=typeof e=="function"?Kt(t,e,s.custom):e;n=Promise.all(_r(t,i,s))}return n.then(()=>{t.notify("AnimationComplete",e)})}const au=Us.length;function Kr(t){if(!t)return;if(!t.isControllingVariants){const s=t.parent?Kr(t.parent)||{}:{};return t.props.initial!==void 0&&(s.initial=t.props.initial),s}const e={};for(let s=0;s<au;s++){const n=Us[s],i=t.props[n];(Je(i)||i===!1)&&(e[n]=i)}return e}const ou=[...$s].reverse(),lu=$s.length;function cu(t){return e=>Promise.all(e.map(({animation:s,options:n})=>ru(t,s,n)))}function uu(t){let e=cu(t),s=Xn(),n=!0;const i=c=>(d,u)=>{var h;const f=Kt(t,u,c==="exit"?(h=t.presenceContext)===null||h===void 0?void 0:h.custom:void 0);if(f){const{transition:m,transitionEnd:p,...x}=f;d={...d,...x,...p}}return d};function o(c){e=c(t)}function a(c){const{props:d}=t,u=Kr(t.parent)||{},h=[],f=new Set;let m={},p=1/0;for(let b=0;b<lu;b++){const v=ou[b],y=s[v],g=d[v]!==void 0?d[v]:u[v],N=Je(g),w=v===c?y.isActive:null;w===!1&&(p=b);let P=g===u[v]&&g!==d[v]&&N;if(P&&n&&t.manuallyAnimateOnMount&&(P=!1),y.protectedKeys={...m},!y.isActive&&w===null||!g&&!y.prevProp||_t(g)||typeof g=="boolean")continue;const V=du(y.prevProp,g);let C=V||v===c&&y.isActive&&!P&&N||b>p&&N,M=!1;const $=Array.isArray(g)?g:[g];let ee=$.reduce(i(v),{});w===!1&&(ee={});const{prevResolvedValues:te={}}=y,lt={...te,...ee},ae=_=>{C=!0,f.has(_)&&(M=!0,f.delete(_)),y.needsAnimating[_]=!0;const q=t.getValue(_);q&&(q.liveStyle=!1)};for(const _ in lt){const q=ee[_],ke=te[_];if(m.hasOwnProperty(_))continue;let T=!1;vs(q)&&vs(ke)?T=!sr(q,ke):T=q!==ke,T?q!=null?ae(_):f.add(_):q!==void 0&&f.has(_)?ae(_):y.protectedKeys[_]=!0}y.prevProp=g,y.prevResolvedValues=ee,y.isActive&&(m={...m,...ee}),n&&t.blockInitialAnimation&&(C=!1),C&&(!(P&&V)||M)&&h.push(...$.map(_=>({animation:_,options:{type:v}})))}if(f.size){const b={};f.forEach(v=>{const y=t.getBaseTarget(v),g=t.getValue(v);g&&(g.liveStyle=!0),b[v]=y??null}),h.push({animation:b})}let x=!!h.length;return n&&(d.initial===!1||d.initial===d.animate)&&!t.manuallyAnimateOnMount&&(x=!1),n=!1,x?e(h):Promise.resolve()}function l(c,d){var u;if(s[c].isActive===d)return Promise.resolve();(u=t.variantChildren)===null||u===void 0||u.forEach(f=>{var m;return(m=f.animationState)===null||m===void 0?void 0:m.setActive(c,d)}),s[c].isActive=d;const h=a(c);for(const f in s)s[f].protectedKeys={};return h}return{animateChanges:a,setActive:l,setAnimateFunction:o,getState:()=>s,reset:()=>{s=Xn(),n=!0}}}function du(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!sr(e,t):!1}function ye(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Xn(){return{animate:ye(!0),whileInView:ye(),whileHover:ye(),whileTap:ye(),whileDrag:ye(),whileFocus:ye(),exit:ye()}}class ve{constructor(e){this.isMounted=!1,this.node=e}update(){}}class hu extends ve{constructor(e){super(e),e.animationState||(e.animationState=uu(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();_t(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:s}=this.node.prevProps||{};e!==s&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)===null||e===void 0||e.call(this)}}let fu=0;class mu extends ve{constructor(){super(...arguments),this.id=fu++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:s}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===n)return;const i=this.node.animationState.setActive("exit",!e);s&&!e&&i.then(()=>s(this.id))}mount(){const{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}}const pu={animation:{Feature:hu},exit:{Feature:mu}};function gu(t,e,s){var n;if(t instanceof Element)return[t];if(typeof t=="string"){let i=document;const o=(n=void 0)!==null&&n!==void 0?n:i.querySelectorAll(t);return o?Array.from(o):[]}return Array.from(t)}const J={x:!1,y:!1};function Wr(){return J.x||J.y}function qn(t){return e=>{e.pointerType==="touch"||Wr()||t(e)}}function xu(t,e,s={}){const n=new AbortController,i={passive:!0,...s,signal:n.signal},o=qn(a=>{const{target:l}=a,c=e(a);if(!c||!l)return;const d=qn(u=>{c(u),l.removeEventListener("pointerleave",d)});l.addEventListener("pointerleave",d,i)});return gu(t).forEach(a=>{a.addEventListener("pointerenter",o,i)}),()=>n.abort()}function vu(t){return t==="x"||t==="y"?J[t]?null:(J[t]=!0,()=>{J[t]=!1}):J.x||J.y?null:(J.x=J.y=!0,()=>{J.x=J.y=!1})}const zr=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1;function ot(t){return{point:{x:t.pageX,y:t.pageY}}}const yu=t=>e=>zr(e)&&t(e,ot(e));function ce(t,e,s,n={passive:!0}){return t.addEventListener(e,s,n),()=>t.removeEventListener(e,s)}function pe(t,e,s,n){return ce(t,e,yu(s),n)}const Zn=(t,e)=>Math.abs(t-e);function bu(t,e){const s=Zn(t.x,e.x),n=Zn(t.y,e.y);return Math.sqrt(s**2+n**2)}class Hr{constructor(e,s,{transformPagePoint:n,contextWindow:i,dragSnapToOrigin:o=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const h=ls(this.lastMoveEventInfo,this.history),f=this.startEvent!==null,m=bu(h.offset,{x:0,y:0})>=3;if(!f&&!m)return;const{point:p}=h,{timestamp:x}=K;this.history.push({...p,timestamp:x});const{onStart:b,onMove:v}=this.handlers;f||(b&&b(this.lastMoveEvent,h),this.startEvent=this.lastMoveEvent),v&&v(this.lastMoveEvent,h)},this.handlePointerMove=(h,f)=>{this.lastMoveEvent=h,this.lastMoveEventInfo=os(f,this.transformPagePoint),k.update(this.updatePoint,!0)},this.handlePointerUp=(h,f)=>{this.end();const{onEnd:m,onSessionEnd:p,resumeAnimation:x}=this.handlers;if(this.dragSnapToOrigin&&x&&x(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const b=ls(h.type==="pointercancel"?this.lastMoveEventInfo:os(f,this.transformPagePoint),this.history);this.startEvent&&m&&m(h,b),p&&p(h,b)},!zr(e))return;this.dragSnapToOrigin=o,this.handlers=s,this.transformPagePoint=n,this.contextWindow=i||window;const a=ot(e),l=os(a,this.transformPagePoint),{point:c}=l,{timestamp:d}=K;this.history=[{...c,timestamp:d}];const{onSessionStart:u}=s;u&&u(e,ls(l,this.history)),this.removeListeners=me(pe(this.contextWindow,"pointermove",this.handlePointerMove),pe(this.contextWindow,"pointerup",this.handlePointerUp),pe(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),ge(this.updatePoint)}}function os(t,e){return e?{point:e(t.point)}:t}function Qn(t,e){return{x:t.x-e.x,y:t.y-e.y}}function ls({point:t},e){return{point:t,delta:Qn(t,Yr(e)),offset:Qn(t,ju(e)),velocity:wu(e,.1)}}function ju(t){return t[0]}function Yr(t){return t[t.length-1]}function wu(t,e){if(t.length<2)return{x:0,y:0};let s=t.length-1,n=null;const i=Yr(t);for(;s>=0&&(n=t[s],!(i.timestamp-n.timestamp>ue(e)));)s--;if(!n)return{x:0,y:0};const o=de(i.timestamp-n.timestamp);if(o===0)return{x:0,y:0};const a={x:(i.x-n.x)/o,y:(i.y-n.y)/o};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}function Ve(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}const Gr=1e-4,Tu=1-Gr,Nu=1+Gr,Xr=.01,Su=0-Xr,Pu=0+Xr;function X(t){return t.max-t.min}function Cu(t,e,s){return Math.abs(t-e)<=s}function Jn(t,e,s,n=.5){t.origin=n,t.originPoint=R(e.min,e.max,t.origin),t.scale=X(s)/X(e),t.translate=R(s.min,s.max,t.origin)-t.originPoint,(t.scale>=Tu&&t.scale<=Nu||isNaN(t.scale))&&(t.scale=1),(t.translate>=Su&&t.translate<=Pu||isNaN(t.translate))&&(t.translate=0)}function Xe(t,e,s,n){Jn(t.x,e.x,s.x,n?n.originX:void 0),Jn(t.y,e.y,s.y,n?n.originY:void 0)}function ei(t,e,s){t.min=s.min+e.min,t.max=t.min+X(e)}function ku(t,e,s){ei(t.x,e.x,s.x),ei(t.y,e.y,s.y)}function ti(t,e,s){t.min=e.min-s.min,t.max=t.min+X(e)}function qe(t,e,s){ti(t.x,e.x,s.x),ti(t.y,e.y,s.y)}function Au(t,{min:e,max:s},n){return e!==void 0&&t<e?t=n?R(e,t,n.min):Math.max(t,e):s!==void 0&&t>s&&(t=n?R(s,t,n.max):Math.min(t,s)),t}function si(t,e,s){return{min:e!==void 0?t.min+e:void 0,max:s!==void 0?t.max+s-(t.max-t.min):void 0}}function Du(t,{top:e,left:s,bottom:n,right:i}){return{x:si(t.x,s,i),y:si(t.y,e,n)}}function ni(t,e){let s=e.min-t.min,n=e.max-t.max;return e.max-e.min<t.max-t.min&&([s,n]=[n,s]),{min:s,max:n}}function Vu(t,e){return{x:ni(t.x,e.x),y:ni(t.y,e.y)}}function Ru(t,e){let s=.5;const n=X(t),i=X(e);return i>n?s=Ie(e.min,e.max-n,t.min):n>i&&(s=Ie(t.min,t.max-i,e.min)),he(0,1,s)}function Mu(t,e){const s={};return e.min!==void 0&&(s.min=e.min-t.min),e.max!==void 0&&(s.max=e.max-t.min),s}const Ds=.35;function Lu(t=Ds){return t===!1?t=0:t===!0&&(t=Ds),{x:ii(t,"left","right"),y:ii(t,"top","bottom")}}function ii(t,e,s){return{min:ri(t,e),max:ri(t,s)}}function ri(t,e){return typeof t=="number"?t:t[e]||0}const ai=()=>({translate:0,scale:1,origin:0,originPoint:0}),Re=()=>({x:ai(),y:ai()}),oi=()=>({min:0,max:0}),I=()=>({x:oi(),y:oi()});function Q(t){return[t("x"),t("y")]}function qr({top:t,left:e,right:s,bottom:n}){return{x:{min:e,max:s},y:{min:t,max:n}}}function Eu({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function Fu(t,e){if(!e)return t;const s=e({x:t.left,y:t.top}),n=e({x:t.right,y:t.bottom});return{top:s.y,left:s.x,bottom:n.y,right:n.x}}function cs(t){return t===void 0||t===1}function Vs({scale:t,scaleX:e,scaleY:s}){return!cs(t)||!cs(e)||!cs(s)}function be(t){return Vs(t)||Zr(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function Zr(t){return li(t.x)||li(t.y)}function li(t){return t&&t!=="0%"}function Et(t,e,s){const n=t-s,i=e*n;return s+i}function ci(t,e,s,n,i){return i!==void 0&&(t=Et(t,i,n)),Et(t,s,n)+e}function Rs(t,e=0,s=1,n,i){t.min=ci(t.min,e,s,n,i),t.max=ci(t.max,e,s,n,i)}function Qr(t,{x:e,y:s}){Rs(t.x,e.translate,e.scale,e.originPoint),Rs(t.y,s.translate,s.scale,s.originPoint)}const ui=.999999999999,di=1.0000000000001;function Ou(t,e,s,n=!1){const i=s.length;if(!i)return;e.x=e.y=1;let o,a;for(let l=0;l<i;l++){o=s[l],a=o.projectionDelta;const{visualElement:c}=o.options;c&&c.props.style&&c.props.style.display==="contents"||(n&&o.options.layoutScroll&&o.scroll&&o!==o.root&&Le(t,{x:-o.scroll.offset.x,y:-o.scroll.offset.y}),a&&(e.x*=a.x.scale,e.y*=a.y.scale,Qr(t,a)),n&&be(o.latestValues)&&Le(t,o.latestValues))}e.x<di&&e.x>ui&&(e.x=1),e.y<di&&e.y>ui&&(e.y=1)}function Me(t,e){t.min=t.min+e,t.max=t.max+e}function hi(t,e,s,n,i=.5){const o=R(t.min,t.max,i);Rs(t,e,s,o,n)}function Le(t,e){hi(t.x,e.x,e.scaleX,e.scale,e.originX),hi(t.y,e.y,e.scaleY,e.scale,e.originY)}function Jr(t,e){return qr(Fu(t.getBoundingClientRect(),e))}function Iu(t,e,s){const n=Jr(t,s),{scroll:i}=e;return i&&(Me(n.x,i.offset.x),Me(n.y,i.offset.y)),n}const ea=({current:t})=>t?t.ownerDocument.defaultView:null,Bu=new WeakMap;class $u{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=I(),this.visualElement=e}start(e,{snapToCursor:s=!1}={}){const{presenceContext:n}=this.visualElement;if(n&&n.isPresent===!1)return;const i=u=>{const{dragSnapToOrigin:h}=this.getProps();h?this.pauseAnimation():this.stopAnimation(),s&&this.snapToCursor(ot(u).point)},o=(u,h)=>{const{drag:f,dragPropagation:m,onDragStart:p}=this.getProps();if(f&&!m&&(this.openDragLock&&this.openDragLock(),this.openDragLock=vu(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),Q(b=>{let v=this.getAxisMotionValue(b).get()||0;if(ie.test(v)){const{projection:y}=this.visualElement;if(y&&y.layout){const g=y.layout.layoutBox[b];g&&(v=X(g)*(parseFloat(v)/100))}}this.originPoint[b]=v}),p&&k.postRender(()=>p(u,h)),ks(this.visualElement,"transform");const{animationState:x}=this.visualElement;x&&x.setActive("whileDrag",!0)},a=(u,h)=>{const{dragPropagation:f,dragDirectionLock:m,onDirectionLock:p,onDrag:x}=this.getProps();if(!f&&!this.openDragLock)return;const{offset:b}=h;if(m&&this.currentDirection===null){this.currentDirection=Uu(b),this.currentDirection!==null&&p&&p(this.currentDirection);return}this.updateAxis("x",h.point,b),this.updateAxis("y",h.point,b),this.visualElement.render(),x&&x(u,h)},l=(u,h)=>this.stop(u,h),c=()=>Q(u=>{var h;return this.getAnimationState(u)==="paused"&&((h=this.getAxisMotionValue(u).animation)===null||h===void 0?void 0:h.play())}),{dragSnapToOrigin:d}=this.getProps();this.panSession=new Hr(e,{onSessionStart:i,onStart:o,onMove:a,onSessionEnd:l,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:d,contextWindow:ea(this.visualElement)})}stop(e,s){const n=this.isDragging;if(this.cancel(),!n)return;const{velocity:i}=s;this.startAnimation(i);const{onDragEnd:o}=this.getProps();o&&k.postRender(()=>o(e,s))}cancel(){this.isDragging=!1;const{projection:e,animationState:s}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:n}=this.getProps();!n&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),s&&s.setActive("whileDrag",!1)}updateAxis(e,s,n){const{drag:i}=this.getProps();if(!n||!mt(e,i,this.currentDirection))return;const o=this.getAxisMotionValue(e);let a=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(a=Au(a,this.constraints[e],this.elastic[e])),o.set(a)}resolveConstraints(){var e;const{dragConstraints:s,dragElastic:n}=this.getProps(),i=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(e=this.visualElement.projection)===null||e===void 0?void 0:e.layout,o=this.constraints;s&&Ve(s)?this.constraints||(this.constraints=this.resolveRefConstraints()):s&&i?this.constraints=Du(i.layoutBox,s):this.constraints=!1,this.elastic=Lu(n),o!==this.constraints&&i&&this.constraints&&!this.hasMutatedConstraints&&Q(a=>{this.constraints!==!1&&this.getAxisMotionValue(a)&&(this.constraints[a]=Mu(i.layoutBox[a],this.constraints[a]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:s}=this.getProps();if(!e||!Ve(e))return!1;const n=e.current,{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const o=Iu(n,i.root,this.visualElement.getTransformPagePoint());let a=Vu(i.layout.layoutBox,o);if(s){const l=s(Eu(a));this.hasMutatedConstraints=!!l,l&&(a=qr(l))}return a}startAnimation(e){const{drag:s,dragMomentum:n,dragElastic:i,dragTransition:o,dragSnapToOrigin:a,onDragTransitionEnd:l}=this.getProps(),c=this.constraints||{},d=Q(u=>{if(!mt(u,s,this.currentDirection))return;let h=c&&c[u]||{};a&&(h={min:0,max:0});const f=i?200:1e6,m=i?40:1e7,p={type:"inertia",velocity:n?e[u]:0,bounceStiffness:f,bounceDamping:m,timeConstant:750,restDelta:1,restSpeed:10,...o,...h};return this.startAxisValueAnimation(u,p)});return Promise.all(d).then(l)}startAxisValueAnimation(e,s){const n=this.getAxisMotionValue(e);return ks(this.visualElement,e),n.start(sn(e,n,0,s,this.visualElement,!1))}stopAnimation(){Q(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){Q(e=>{var s;return(s=this.getAxisMotionValue(e).animation)===null||s===void 0?void 0:s.pause()})}getAnimationState(e){var s;return(s=this.getAxisMotionValue(e).animation)===null||s===void 0?void 0:s.state}getAxisMotionValue(e){const s=`_drag${e.toUpperCase()}`,n=this.visualElement.getProps(),i=n[s];return i||this.visualElement.getValue(e,(n.initial?n.initial[e]:void 0)||0)}snapToCursor(e){Q(s=>{const{drag:n}=this.getProps();if(!mt(s,n,this.currentDirection))return;const{projection:i}=this.visualElement,o=this.getAxisMotionValue(s);if(i&&i.layout){const{min:a,max:l}=i.layout.layoutBox[s];o.set(e[s]-R(a,l,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:s}=this.getProps(),{projection:n}=this.visualElement;if(!Ve(s)||!n||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};Q(a=>{const l=this.getAxisMotionValue(a);if(l&&this.constraints!==!1){const c=l.get();i[a]=Ru({min:c,max:c},this.constraints[a])}});const{transformTemplate:o}=this.visualElement.getProps();this.visualElement.current.style.transform=o?o({},""):"none",n.root&&n.root.updateScroll(),n.updateLayout(),this.resolveConstraints(),Q(a=>{if(!mt(a,e,null))return;const l=this.getAxisMotionValue(a),{min:c,max:d}=this.constraints[a];l.set(R(c,d,i[a]))})}addListeners(){if(!this.visualElement.current)return;Bu.set(this.visualElement,this);const e=this.visualElement.current,s=pe(e,"pointerdown",c=>{const{drag:d,dragListener:u=!0}=this.getProps();d&&u&&this.start(c)}),n=()=>{const{dragConstraints:c}=this.getProps();Ve(c)&&c.current&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,o=i.addEventListener("measure",n);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),k.read(n);const a=ce(window,"resize",()=>this.scalePositionWithinConstraints()),l=i.addEventListener("didUpdate",({delta:c,hasLayoutChanged:d})=>{this.isDragging&&d&&(Q(u=>{const h=this.getAxisMotionValue(u);h&&(this.originPoint[u]+=c[u].translate,h.set(h.get()+c[u].translate))}),this.visualElement.render())});return()=>{a(),s(),o(),l&&l()}}getProps(){const e=this.visualElement.getProps(),{drag:s=!1,dragDirectionLock:n=!1,dragPropagation:i=!1,dragConstraints:o=!1,dragElastic:a=Ds,dragMomentum:l=!0}=e;return{...e,drag:s,dragDirectionLock:n,dragPropagation:i,dragConstraints:o,dragElastic:a,dragMomentum:l}}}function mt(t,e,s){return(e===!0||e===t)&&(s===null||s===t)}function Uu(t,e=10){let s=null;return Math.abs(t.y)>e?s="y":Math.abs(t.x)>e&&(s="x"),s}class _u extends ve{constructor(e){super(e),this.removeGroupControls=H,this.removeListeners=H,this.controls=new $u(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||H}unmount(){this.removeGroupControls(),this.removeListeners()}}const fi=t=>(e,s)=>{t&&k.postRender(()=>t(e,s))};class Ku extends ve{constructor(){super(...arguments),this.removePointerDownListener=H}onPointerDown(e){this.session=new Hr(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:ea(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:s,onPan:n,onPanEnd:i}=this.node.getProps();return{onSessionStart:fi(e),onStart:fi(s),onMove:n,onEnd:(o,a)=>{delete this.session,i&&k.postRender(()=>i(o,a))}}}mount(){this.removePointerDownListener=pe(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const zt=j.createContext(null);function Wu(){const t=j.useContext(zt);if(t===null)return[!0,null];const{isPresent:e,onExitComplete:s,register:n}=t,i=j.useId();j.useEffect(()=>n(i),[]);const o=j.useCallback(()=>s&&s(i),[i,s]);return!e&&s?[!1,o]:[!0]}const ln=j.createContext({}),ta=j.createContext({}),jt={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function mi(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const We={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(S.test(t))t=parseFloat(t);else return t;const s=mi(t,e.target.x),n=mi(t,e.target.y);return`${s}% ${n}%`}},zu={correct:(t,{treeScale:e,projectionDelta:s})=>{const n=t,i=xe.parse(t);if(i.length>5)return n;const o=xe.createTransformer(t),a=typeof i[0]!="number"?1:0,l=s.x.scale*e.x,c=s.y.scale*e.y;i[0+a]/=l,i[1+a]/=c;const d=R(l,c,.5);return typeof i[2+a]=="number"&&(i[2+a]/=d),typeof i[3+a]=="number"&&(i[3+a]/=d),o(i)}},Ft={};function Hu(t){Object.assign(Ft,t)}const{schedule:cn,cancel:Zf}=nr(queueMicrotask,!1);class Yu extends j.Component{componentDidMount(){const{visualElement:e,layoutGroup:s,switchLayoutGroup:n,layoutId:i}=this.props,{projection:o}=e;Hu(Gu),o&&(s.group&&s.group.add(o),n&&n.register&&i&&n.register(o),o.root.didUpdate(),o.addEventListener("animationComplete",()=>{this.safeToRemove()}),o.setOptions({...o.options,onExitComplete:()=>this.safeToRemove()})),jt.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:s,visualElement:n,drag:i,isPresent:o}=this.props,a=n.projection;return a&&(a.isPresent=o,i||e.layoutDependency!==s||s===void 0?a.willUpdate():this.safeToRemove(),e.isPresent!==o&&(o?a.promote():a.relegate()||k.postRender(()=>{const l=a.getStack();(!l||!l.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),cn.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:s,switchLayoutGroup:n}=this.props,{projection:i}=e;i&&(i.scheduleCheckAfterUnmount(),s&&s.group&&s.group.remove(i),n&&n.deregister&&n.deregister(i))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function sa(t){const[e,s]=Wu(),n=j.useContext(ln);return r.jsx(Yu,{...t,layoutGroup:n,switchLayoutGroup:j.useContext(ta),isPresent:e,safeToRemove:s})}const Gu={borderRadius:{...We,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:We,borderTopRightRadius:We,borderBottomLeftRadius:We,borderBottomRightRadius:We,boxShadow:zu},na=["TopLeft","TopRight","BottomLeft","BottomRight"],Xu=na.length,pi=t=>typeof t=="string"?parseFloat(t):t,gi=t=>typeof t=="number"||S.test(t);function qu(t,e,s,n,i,o){i?(t.opacity=R(0,s.opacity!==void 0?s.opacity:1,Zu(n)),t.opacityExit=R(e.opacity!==void 0?e.opacity:1,0,Qu(n))):o&&(t.opacity=R(e.opacity!==void 0?e.opacity:1,s.opacity!==void 0?s.opacity:1,n));for(let a=0;a<Xu;a++){const l=`border${na[a]}Radius`;let c=xi(e,l),d=xi(s,l);if(c===void 0&&d===void 0)continue;c||(c=0),d||(d=0),c===0||d===0||gi(c)===gi(d)?(t[l]=Math.max(R(pi(c),pi(d),n),0),(ie.test(d)||ie.test(c))&&(t[l]+="%")):t[l]=d}(e.rotate||s.rotate)&&(t.rotate=R(e.rotate||0,s.rotate||0,n))}function xi(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const Zu=ia(0,.5,ur),Qu=ia(.5,.95,H);function ia(t,e,s){return n=>n<t?0:n>e?1:s(Ie(t,e,n))}function vi(t,e){t.min=e.min,t.max=e.max}function Z(t,e){vi(t.x,e.x),vi(t.y,e.y)}function yi(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function bi(t,e,s,n,i){return t-=e,t=Et(t,1/s,n),i!==void 0&&(t=Et(t,1/i,n)),t}function Ju(t,e=0,s=1,n=.5,i,o=t,a=t){if(ie.test(e)&&(e=parseFloat(e),e=R(a.min,a.max,e/100)-a.min),typeof e!="number")return;let l=R(o.min,o.max,n);t===o&&(l-=e),t.min=bi(t.min,e,s,l,i),t.max=bi(t.max,e,s,l,i)}function ji(t,e,[s,n,i],o,a){Ju(t,e[s],e[n],e[i],e.scale,o,a)}const ed=["x","scaleX","originX"],td=["y","scaleY","originY"];function wi(t,e,s,n){ji(t.x,e,ed,s?s.x:void 0,n?n.x:void 0),ji(t.y,e,td,s?s.y:void 0,n?n.y:void 0)}function Ti(t){return t.translate===0&&t.scale===1}function ra(t){return Ti(t.x)&&Ti(t.y)}function Ni(t,e){return t.min===e.min&&t.max===e.max}function sd(t,e){return Ni(t.x,e.x)&&Ni(t.y,e.y)}function Si(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function aa(t,e){return Si(t.x,e.x)&&Si(t.y,e.y)}function Pi(t){return X(t.x)/X(t.y)}function Ci(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class nd{constructor(){this.members=[]}add(e){nn(this.members,e),e.scheduleRender()}remove(e){if(rn(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const s=this.members[this.members.length-1];s&&this.promote(s)}}relegate(e){const s=this.members.findIndex(i=>e===i);if(s===0)return!1;let n;for(let i=s;i>=0;i--){const o=this.members[i];if(o.isPresent!==!1){n=o;break}}return n?(this.promote(n),!0):!1}promote(e,s){const n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.instance&&n.scheduleRender(),e.scheduleRender(),e.resumeFrom=n,s&&(e.resumeFrom.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:i}=e.options;i===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:s,resumingFrom:n}=e;s.onExitComplete&&s.onExitComplete(),n&&n.options.onExitComplete&&n.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function id(t,e,s){let n="";const i=t.x.translate/e.x,o=t.y.translate/e.y,a=(s==null?void 0:s.z)||0;if((i||o||a)&&(n=`translate3d(${i}px, ${o}px, ${a}px) `),(e.x!==1||e.y!==1)&&(n+=`scale(${1/e.x}, ${1/e.y}) `),s){const{transformPerspective:d,rotate:u,rotateX:h,rotateY:f,skewX:m,skewY:p}=s;d&&(n=`perspective(${d}px) ${n}`),u&&(n+=`rotate(${u}deg) `),h&&(n+=`rotateX(${h}deg) `),f&&(n+=`rotateY(${f}deg) `),m&&(n+=`skewX(${m}deg) `),p&&(n+=`skewY(${p}deg) `)}const l=t.x.scale*e.x,c=t.y.scale*e.y;return(l!==1||c!==1)&&(n+=`scale(${l}, ${c})`),n||"none"}const rd=(t,e)=>t.depth-e.depth;class ad{constructor(){this.children=[],this.isDirty=!1}add(e){nn(this.children,e),this.isDirty=!0}remove(e){rn(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(rd),this.isDirty=!1,this.children.forEach(e)}}function wt(t){const e=z(t)?t.get():t;return Gc(e)?e.toValue():e}function od(t,e){const s=re.now(),n=({timestamp:i})=>{const o=i-s;o>=e&&(ge(n),t(o-e))};return k.read(n,!0),()=>ge(n)}function ld(t){return t instanceof SVGElement&&t.tagName!=="svg"}function cd(t,e,s){const n=z(t)?t:st(t);return n.start(sn("",n,e,s)),n.animation}const je={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},Ye=typeof window<"u"&&window.MotionDebug!==void 0,us=["","X","Y","Z"],ud={visibility:"hidden"},ki=1e3;let dd=0;function ds(t,e,s,n){const{latestValues:i}=e;i[t]&&(s[t]=i[t],e.setStaticValue(t,0),n&&(n[t]=0))}function oa(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const s=Ur(e);if(window.MotionHasOptimisedAnimation(s,"transform")){const{layout:i,layoutId:o}=t.options;window.MotionCancelOptimisedAnimation(s,"transform",k,!(i||o))}const{parent:n}=t;n&&!n.hasCheckedOptimisedAppear&&oa(n)}function la({attachResizeListener:t,defaultParent:e,measureScroll:s,checkIsScrollRoot:n,resetTransform:i}){return class{constructor(a={},l=e==null?void 0:e()){this.id=dd++,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,Ye&&(je.totalNodes=je.resolvedTargetDeltas=je.recalculatedProjection=0),this.nodes.forEach(md),this.nodes.forEach(yd),this.nodes.forEach(bd),this.nodes.forEach(pd),Ye&&window.MotionDebug.record(je)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=a,this.root=l?l.root||l:this,this.path=l?[...l.path,l]:[],this.parent=l,this.depth=l?l.depth+1:0;for(let c=0;c<this.path.length;c++)this.path[c].shouldResetTransform=!0;this.root===this&&(this.nodes=new ad)}addEventListener(a,l){return this.eventHandlers.has(a)||this.eventHandlers.set(a,new an),this.eventHandlers.get(a).add(l)}notifyListeners(a,...l){const c=this.eventHandlers.get(a);c&&c.notify(...l)}hasListeners(a){return this.eventHandlers.has(a)}mount(a,l=this.root.hasTreeAnimated){if(this.instance)return;this.isSVG=ld(a),this.instance=a;const{layoutId:c,layout:d,visualElement:u}=this.options;if(u&&!u.current&&u.mount(a),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),l&&(d||c)&&(this.isLayoutDirty=!0),t){let h;const f=()=>this.root.updateBlockedByResize=!1;t(a,()=>{this.root.updateBlockedByResize=!0,h&&h(),h=od(f,250),jt.hasAnimatedSinceResize&&(jt.hasAnimatedSinceResize=!1,this.nodes.forEach(Di))})}c&&this.root.registerSharedNode(c,this),this.options.animate!==!1&&u&&(c||d)&&this.addEventListener("didUpdate",({delta:h,hasLayoutChanged:f,hasRelativeTargetChanged:m,layout:p})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const x=this.options.transition||u.getDefaultTransition()||Sd,{onLayoutAnimationStart:b,onLayoutAnimationComplete:v}=u.getProps(),y=!this.targetLayout||!aa(this.targetLayout,p)||m,g=!f&&m;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||g||f&&(y||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(h,g);const N={..._s(x,"layout"),onPlay:b,onComplete:v};(u.shouldReduceMotion||this.options.layoutRoot)&&(N.delay=0,N.type=!1),this.startAnimation(N)}else f||Di(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=p})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const a=this.getStack();a&&a.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,ge(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(jd),this.animationId++)}getTransformTemplate(){const{visualElement:a}=this.options;return a&&a.getProps().transformTemplate}willUpdate(a=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&oa(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let u=0;u<this.path.length;u++){const h=this.path[u];h.shouldResetTransform=!0,h.updateScroll("snapshot"),h.options.layoutRoot&&h.willUpdate(!1)}const{layoutId:l,layout:c}=this.options;if(l===void 0&&!c)return;const d=this.getTransformTemplate();this.prevTransformTemplateValue=d?d(this.latestValues,""):void 0,this.updateSnapshot(),a&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(Ai);return}this.isUpdating||this.nodes.forEach(xd),this.isUpdating=!1,this.nodes.forEach(vd),this.nodes.forEach(hd),this.nodes.forEach(fd),this.clearAllSnapshots();const l=re.now();K.delta=he(0,1e3/60,l-K.timestamp),K.timestamp=l,K.isProcessing=!0,ss.update.process(K),ss.preRender.process(K),ss.render.process(K),K.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,cn.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(gd),this.sharedNodes.forEach(wd)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,k.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){k.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let c=0;c<this.path.length;c++)this.path[c].updateScroll();const a=this.layout;this.layout=this.measure(!1),this.layoutCorrected=I(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:l}=this.options;l&&l.notify("LayoutMeasure",this.layout.layoutBox,a?a.layoutBox:void 0)}updateScroll(a="measure"){let l=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===a&&(l=!1),l){const c=n(this.instance);this.scroll={animationId:this.root.animationId,phase:a,isRoot:c,offset:s(this.instance),wasRoot:this.scroll?this.scroll.isRoot:c}}}resetTransform(){if(!i)return;const a=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,l=this.projectionDelta&&!ra(this.projectionDelta),c=this.getTransformTemplate(),d=c?c(this.latestValues,""):void 0,u=d!==this.prevTransformTemplateValue;a&&(l||be(this.latestValues)||u)&&(i(this.instance,d),this.shouldResetTransform=!1,this.scheduleRender())}measure(a=!0){const l=this.measurePageBox();let c=this.removeElementScroll(l);return a&&(c=this.removeTransform(c)),Pd(c),{animationId:this.root.animationId,measuredBox:l,layoutBox:c,latestValues:{},source:this.id}}measurePageBox(){var a;const{visualElement:l}=this.options;if(!l)return I();const c=l.measureViewportBox();if(!(((a=this.scroll)===null||a===void 0?void 0:a.wasRoot)||this.path.some(Cd))){const{scroll:u}=this.root;u&&(Me(c.x,u.offset.x),Me(c.y,u.offset.y))}return c}removeElementScroll(a){var l;const c=I();if(Z(c,a),!((l=this.scroll)===null||l===void 0)&&l.wasRoot)return c;for(let d=0;d<this.path.length;d++){const u=this.path[d],{scroll:h,options:f}=u;u!==this.root&&h&&f.layoutScroll&&(h.wasRoot&&Z(c,a),Me(c.x,h.offset.x),Me(c.y,h.offset.y))}return c}applyTransform(a,l=!1){const c=I();Z(c,a);for(let d=0;d<this.path.length;d++){const u=this.path[d];!l&&u.options.layoutScroll&&u.scroll&&u!==u.root&&Le(c,{x:-u.scroll.offset.x,y:-u.scroll.offset.y}),be(u.latestValues)&&Le(c,u.latestValues)}return be(this.latestValues)&&Le(c,this.latestValues),c}removeTransform(a){const l=I();Z(l,a);for(let c=0;c<this.path.length;c++){const d=this.path[c];if(!d.instance||!be(d.latestValues))continue;Vs(d.latestValues)&&d.updateSnapshot();const u=I(),h=d.measurePageBox();Z(u,h),wi(l,d.latestValues,d.snapshot?d.snapshot.layoutBox:void 0,u)}return be(this.latestValues)&&wi(l,this.latestValues),l}setTargetDelta(a){this.targetDelta=a,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(a){this.options={...this.options,...a,crossfade:a.crossfade!==void 0?a.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!==K.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(a=!1){var l;const c=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=c.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=c.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=c.isSharedProjectionDirty);const d=!!this.resumingFrom||this!==c;if(!(a||d&&this.isSharedProjectionDirty||this.isProjectionDirty||!((l=this.parent)===null||l===void 0)&&l.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:h,layoutId:f}=this.options;if(!(!this.layout||!(h||f))){if(this.resolvedRelativeTargetAt=K.timestamp,!this.targetDelta&&!this.relativeTarget){const m=this.getClosestProjectingParent();m&&m.layout&&this.animationProgress!==1?(this.relativeParent=m,this.forceRelativeParentToResolveTarget(),this.relativeTarget=I(),this.relativeTargetOrigin=I(),qe(this.relativeTargetOrigin,this.layout.layoutBox,m.layout.layoutBox),Z(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)){if(this.target||(this.target=I(),this.targetWithTransforms=I()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),ku(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Z(this.target,this.layout.layoutBox),Qr(this.target,this.targetDelta)):Z(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;const m=this.getClosestProjectingParent();m&&!!m.resumingFrom==!!this.resumingFrom&&!m.options.layoutScroll&&m.target&&this.animationProgress!==1?(this.relativeParent=m,this.forceRelativeParentToResolveTarget(),this.relativeTarget=I(),this.relativeTargetOrigin=I(),qe(this.relativeTargetOrigin,this.target,m.target),Z(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}Ye&&je.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||Vs(this.parent.latestValues)||Zr(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 a;const l=this.getLead(),c=!!this.resumingFrom||this!==l;let d=!0;if((this.isProjectionDirty||!((a=this.parent)===null||a===void 0)&&a.isProjectionDirty)&&(d=!1),c&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(d=!1),this.resolvedRelativeTargetAt===K.timestamp&&(d=!1),d)return;const{layout:u,layoutId:h}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(u||h))return;Z(this.layoutCorrected,this.layout.layoutBox);const f=this.treeScale.x,m=this.treeScale.y;Ou(this.layoutCorrected,this.treeScale,this.path,c),l.layout&&!l.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(l.target=l.layout.layoutBox,l.targetWithTransforms=I());const{target:p}=l;if(!p){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(yi(this.prevProjectionDelta.x,this.projectionDelta.x),yi(this.prevProjectionDelta.y,this.projectionDelta.y)),Xe(this.projectionDelta,this.layoutCorrected,p,this.latestValues),(this.treeScale.x!==f||this.treeScale.y!==m||!Ci(this.projectionDelta.x,this.prevProjectionDelta.x)||!Ci(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",p)),Ye&&je.recalculatedProjection++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(a=!0){var l;if((l=this.options.visualElement)===null||l===void 0||l.scheduleRender(),a){const c=this.getStack();c&&c.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Re(),this.projectionDelta=Re(),this.projectionDeltaWithTransform=Re()}setAnimationOrigin(a,l=!1){const c=this.snapshot,d=c?c.latestValues:{},u={...this.latestValues},h=Re();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!l;const f=I(),m=c?c.source:void 0,p=this.layout?this.layout.source:void 0,x=m!==p,b=this.getStack(),v=!b||b.members.length<=1,y=!!(x&&!v&&this.options.crossfade===!0&&!this.path.some(Nd));this.animationProgress=0;let g;this.mixTargetDelta=N=>{const w=N/1e3;Vi(h.x,a.x,w),Vi(h.y,a.y,w),this.setTargetDelta(h),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(qe(f,this.layout.layoutBox,this.relativeParent.layout.layoutBox),Td(this.relativeTarget,this.relativeTargetOrigin,f,w),g&&sd(this.relativeTarget,g)&&(this.isProjectionDirty=!1),g||(g=I()),Z(g,this.relativeTarget)),x&&(this.animationValues=u,qu(u,d,this.latestValues,w,y,v)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=w},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(a){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(ge(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=k.update(()=>{jt.hasAnimatedSinceResize=!0,this.currentAnimation=cd(0,ki,{...a,onUpdate:l=>{this.mixTargetDelta(l),a.onUpdate&&a.onUpdate(l)},onComplete:()=>{a.onComplete&&a.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const a=this.getStack();a&&a.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(ki),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const a=this.getLead();let{targetWithTransforms:l,target:c,layout:d,latestValues:u}=a;if(!(!l||!c||!d)){if(this!==a&&this.layout&&d&&ca(this.options.animationType,this.layout.layoutBox,d.layoutBox)){c=this.target||I();const h=X(this.layout.layoutBox.x);c.x.min=a.target.x.min,c.x.max=c.x.min+h;const f=X(this.layout.layoutBox.y);c.y.min=a.target.y.min,c.y.max=c.y.min+f}Z(l,c),Le(l,u),Xe(this.projectionDeltaWithTransform,this.layoutCorrected,l,u)}}registerSharedNode(a,l){this.sharedNodes.has(a)||this.sharedNodes.set(a,new nd),this.sharedNodes.get(a).add(l);const d=l.options.initialPromotionConfig;l.promote({transition:d?d.transition:void 0,preserveFollowOpacity:d&&d.shouldPreserveFollowOpacity?d.shouldPreserveFollowOpacity(l):void 0})}isLead(){const a=this.getStack();return a?a.lead===this:!0}getLead(){var a;const{layoutId:l}=this.options;return l?((a=this.getStack())===null||a===void 0?void 0:a.lead)||this:this}getPrevLead(){var a;const{layoutId:l}=this.options;return l?(a=this.getStack())===null||a===void 0?void 0:a.prevLead:void 0}getStack(){const{layoutId:a}=this.options;if(a)return this.root.sharedNodes.get(a)}promote({needsReset:a,transition:l,preserveFollowOpacity:c}={}){const d=this.getStack();d&&d.promote(this,c),a&&(this.projectionDelta=void 0,this.needsReset=!0),l&&this.setOptions({transition:l})}relegate(){const a=this.getStack();return a?a.relegate(this):!1}resetSkewAndRotation(){const{visualElement:a}=this.options;if(!a)return;let l=!1;const{latestValues:c}=a;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(l=!0),!l)return;const d={};c.z&&ds("z",a,d,this.animationValues);for(let u=0;u<us.length;u++)ds(`rotate${us[u]}`,a,d,this.animationValues),ds(`skew${us[u]}`,a,d,this.animationValues);a.render();for(const u in d)a.setStaticValue(u,d[u]),this.animationValues&&(this.animationValues[u]=d[u]);a.scheduleRender()}getProjectionStyles(a){var l,c;if(!this.instance||this.isSVG)return;if(!this.isVisible)return ud;const d={visibility:""},u=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,d.opacity="",d.pointerEvents=wt(a==null?void 0:a.pointerEvents)||"",d.transform=u?u(this.latestValues,""):"none",d;const h=this.getLead();if(!this.projectionDelta||!this.layout||!h.target){const x={};return this.options.layoutId&&(x.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,x.pointerEvents=wt(a==null?void 0:a.pointerEvents)||""),this.hasProjected&&!be(this.latestValues)&&(x.transform=u?u({},""):"none",this.hasProjected=!1),x}const f=h.animationValues||h.latestValues;this.applyTransformsToTarget(),d.transform=id(this.projectionDeltaWithTransform,this.treeScale,f),u&&(d.transform=u(f,d.transform));const{x:m,y:p}=this.projectionDelta;d.transformOrigin=`${m.origin*100}% ${p.origin*100}% 0`,h.animationValues?d.opacity=h===this?(c=(l=f.opacity)!==null&&l!==void 0?l:this.latestValues.opacity)!==null&&c!==void 0?c:1:this.preserveOpacity?this.latestValues.opacity:f.opacityExit:d.opacity=h===this?f.opacity!==void 0?f.opacity:"":f.opacityExit!==void 0?f.opacityExit:0;for(const x in Ft){if(f[x]===void 0)continue;const{correct:b,applyTo:v}=Ft[x],y=d.transform==="none"?f[x]:b(f[x],h);if(v){const g=v.length;for(let N=0;N<g;N++)d[v[N]]=y}else d[x]=y}return this.options.layoutId&&(d.pointerEvents=h===this?wt(a==null?void 0:a.pointerEvents)||"":"none"),d}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(a=>{var l;return(l=a.currentAnimation)===null||l===void 0?void 0:l.stop()}),this.root.nodes.forEach(Ai),this.root.sharedNodes.clear()}}}function hd(t){t.updateLayout()}function fd(t){var e;const s=((e=t.resumeFrom)===null||e===void 0?void 0:e.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&s&&t.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:i}=t.layout,{animationType:o}=t.options,a=s.source!==t.layout.source;o==="size"?Q(h=>{const f=a?s.measuredBox[h]:s.layoutBox[h],m=X(f);f.min=n[h].min,f.max=f.min+m}):ca(o,s.layoutBox,n)&&Q(h=>{const f=a?s.measuredBox[h]:s.layoutBox[h],m=X(n[h]);f.max=f.min+m,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[h].max=t.relativeTarget[h].min+m)});const l=Re();Xe(l,n,s.layoutBox);const c=Re();a?Xe(c,t.applyTransform(i,!0),s.measuredBox):Xe(c,n,s.layoutBox);const d=!ra(l);let u=!1;if(!t.resumeFrom){const h=t.getClosestProjectingParent();if(h&&!h.resumeFrom){const{snapshot:f,layout:m}=h;if(f&&m){const p=I();qe(p,s.layoutBox,f.layoutBox);const x=I();qe(x,n,m.layoutBox),aa(p,x)||(u=!0),h.options.layoutRoot&&(t.relativeTarget=x,t.relativeTargetOrigin=p,t.relativeParent=h)}}}t.notifyListeners("didUpdate",{layout:n,snapshot:s,delta:c,layoutDelta:l,hasLayoutChanged:d,hasRelativeTargetChanged:u})}else if(t.isLead()){const{onExitComplete:n}=t.options;n&&n()}t.options.transition=void 0}function md(t){Ye&&je.totalNodes++,t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.
19isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function pd(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function gd(t){t.clearSnapshot()}function Ai(t){t.clearMeasurements()}function xd(t){t.isLayoutDirty=!1}function vd(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function Di(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function yd(t){t.resolveTargetDelta()}function bd(t){t.calcProjection()}function jd(t){t.resetSkewAndRotation()}function wd(t){t.removeLeadSnapshot()}function Vi(t,e,s){t.translate=R(e.translate,0,s),t.scale=R(e.scale,1,s),t.origin=e.origin,t.originPoint=e.originPoint}function Ri(t,e,s,n){t.min=R(e.min,s.min,n),t.max=R(e.max,s.max,n)}function Td(t,e,s,n){Ri(t.x,e.x,s.x,n),Ri(t.y,e.y,s.y,n)}function Nd(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const Sd={duration:.45,ease:[.4,0,.1,1]},Mi=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),Li=Mi("applewebkit/")&&!Mi("chrome/")?Math.round:H;function Ei(t){t.min=Li(t.min),t.max=Li(t.max)}function Pd(t){Ei(t.x),Ei(t.y)}function ca(t,e,s){return t==="position"||t==="preserve-aspect"&&!Cu(Pi(e),Pi(s),.2)}function Cd(t){var e;return t!==t.root&&((e=t.scroll)===null||e===void 0?void 0:e.wasRoot)}const kd=la({attachResizeListener:(t,e)=>ce(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),hs={current:void 0},ua=la({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!hs.current){const t=new kd({});t.mount(window),t.setOptions({layoutScroll:!0}),hs.current=t}return hs.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),Ad={pan:{Feature:Ku},drag:{Feature:_u,ProjectionNode:ua,MeasureLayout:sa}};function Fi(t,e,s){const{props:n}=t;t.animationState&&n.whileHover&&t.animationState.setActive("whileHover",s);const i=n[s?"onHoverStart":"onHoverEnd"];i&&k.postRender(()=>i(e,ot(e)))}class Dd extends ve{mount(){const{current:e,props:s}=this.node;e&&(this.unmount=xu(e,n=>(Fi(this.node,n,!0),i=>Fi(this.node,i,!1)),{passive:!s.onHoverStart&&!s.onHoverEnd}))}unmount(){}}class Vd extends ve{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!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=me(ce(this.node.current,"focus",()=>this.onFocus()),ce(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const da=(t,e)=>e?t===e?!0:da(t,e.parentElement):!1;function fs(t,e){if(!e)return;const s=new PointerEvent("pointer"+t);e(s,ot(s))}class Rd extends ve{constructor(){super(...arguments),this.removeStartListeners=H,this.removeEndListeners=H,this.removeAccessibleListeners=H,this.startPointerPress=(e,s)=>{if(this.isPressing)return;this.removeEndListeners();const n=this.node.getProps(),o=pe(window,"pointerup",(l,c)=>{if(!this.checkPressEnd())return;const{onTap:d,onTapCancel:u,globalTapTarget:h}=this.node.getProps(),f=!h&&!da(this.node.current,l.target)?u:d;f&&k.update(()=>f(l,c))},{passive:!(n.onTap||n.onPointerUp)}),a=pe(window,"pointercancel",(l,c)=>this.cancelPress(l,c),{passive:!(n.onTapCancel||n.onPointerCancel)});this.removeEndListeners=me(o,a),this.startPress(e,s)},this.startAccessiblePress=()=>{const e=o=>{if(o.key!=="Enter"||this.isPressing)return;const a=l=>{l.key!=="Enter"||!this.checkPressEnd()||fs("up",(c,d)=>{const{onTap:u}=this.node.getProps();u&&k.postRender(()=>u(c,d))})};this.removeEndListeners(),this.removeEndListeners=ce(this.node.current,"keyup",a),fs("down",(l,c)=>{this.startPress(l,c)})},s=ce(this.node.current,"keydown",e),n=()=>{this.isPressing&&fs("cancel",(o,a)=>this.cancelPress(o,a))},i=ce(this.node.current,"blur",n);this.removeAccessibleListeners=me(s,i)}}startPress(e,s){this.isPressing=!0;const{onTapStart:n,whileTap:i}=this.node.getProps();i&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),n&&k.postRender(()=>n(e,s))}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!Wr()}cancelPress(e,s){if(!this.checkPressEnd())return;const{onTapCancel:n}=this.node.getProps();n&&k.postRender(()=>n(e,s))}mount(){const e=this.node.getProps(),s=pe(e.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(e.onTapStart||e.onPointerStart)}),n=ce(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=me(s,n)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const Ms=new WeakMap,ms=new WeakMap,Md=t=>{const e=Ms.get(t.target);e&&e(t)}
vendor: 9,798 bytes, line 19
19,Ld=t=>{t.forEach(Md)};function Ed({root:t,...e}){const s=t||document;ms.has(s)||ms.set(s,{});const n=ms.get(s),i=JSON.stringify(e);return n[i]||(n[i]=new IntersectionObserver(Ld,{root:t,...e})),n[i]}function Fd(t,e,s){const n=Ed(e);return Ms.set(t,s),n.observe(t),()=>{Ms.delete(t),n.unobserve(t)}}const Od={some:0,all:1};class Id extends ve{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:s,margin:n,amount:i="some",once:o}=e,a={root:s?s.current:void 0,rootMargin:n,threshold:typeof i=="number"?i:Od[i]},l=c=>{const{isIntersecting:d}=c;if(this.isInView===d||(this.isInView=d,o&&!d&&this.hasEnteredView))return;d&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",d);const{onViewportEnter:u,onViewportLeave:h}=this.node.getProps(),f=d?u:h;f&&f(c)};return Fd(this.node.current,a,l)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:s}=this.node;["amount","margin","root"].some(Bd(e,s))&&this.startObserver()}unmount(){}}function Bd({viewport:t={}},{viewport:e={}}={}){return s=>t[s]!==e[s]}const $d={inView:{Feature:Id},tap:{Feature:Rd},focus:{Feature:Vd},hover:{Feature:Dd}},Ud={layout:{ProjectionNode:ua,MeasureLayout:sa}},un=j.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),Ht=j.createContext({}),dn=typeof window<"u",ha=dn?j.useLayoutEffect:j.useEffect,fa=j.createContext({strict:!1});function _d(t,e,s,n,i){var o,a;const{visualElement:l}=j.useContext(Ht),c=j.useContext(fa),d=j.useContext(zt),u=j.useContext(un).reducedMotion,h=j.useRef();n=n||c.renderer,!h.current&&n&&(h.current=n(t,{visualState:e,parent:l,props:s,presenceContext:d,blockInitialAnimation:d?d.initial===!1:!1,reducedMotionConfig:u}));const f=h.current,m=j.useContext(ta);f&&!f.projection&&i&&(f.type==="html"||f.type==="svg")&&Kd(h.current,s,i,m);const p=j.useRef(!1);j.useInsertionEffect(()=>{f&&p.current&&f.update(s,d)});const x=s[$r],b=j.useRef(!!x&&!(!((o=window.MotionHandoffIsComplete)===null||o===void 0)&&o.call(window,x))&&((a=window.MotionHasOptimisedAnimation)===null||a===void 0?void 0:a.call(window,x)));return ha(()=>{f&&(p.current=!0,window.MotionIsMounted=!0,f.updateFeatures(),cn.render(f.render),b.current&&f.animationState&&f.animationState.animateChanges())}),j.useEffect(()=>{f&&(!b.current&&f.animationState&&f.animationState.animateChanges(),b.current&&(queueMicrotask(()=>{var v;(v=window.MotionHandoffMarkAsComplete)===null||v===void 0||v.call(window,x)}),b.current=!1))}),f}function Kd(t,e,s,n){const{layoutId:i,layout:o,drag:a,dragConstraints:l,layoutScroll:c,layoutRoot:d}=e;t.projection=new s(t.latestValues,e["data-framer-portal-id"]?void 0:ma(t.parent)),t.projection.setOptions({layoutId:i,layout:o,alwaysMeasureLayout:!!a||l&&Ve(l),visualElement:t,animationType:typeof o=="string"?o:"both",initialPromotionConfig:n,layoutScroll:c,layoutRoot:d})}function ma(t){if(t)return t.options.allowProjection!==!1?t.projection:ma(t.parent)}function Wd(t,e,s){return j.useCallback(n=>{n&&t.mount&&t.mount(n),e&&(n?e.mount(n):e.unmount()),s&&(typeof s=="function"?s(n):Ve(s)&&(s.current=n))},[e])}function Yt(t){return _t(t.animate)||Us.some(e=>Je(t[e]))}function pa(t){return!!(Yt(t)||t.variants)}function zd(t,e){if(Yt(t)){const{initial:s,animate:n}=t;return{initial:s===!1||Je(s)?s:void 0,animate:Je(n)?n:void 0}}return t.inherit!==!1?e:{}}function Hd(t){const{initial:e,animate:s}=zd(t,j.useContext(Ht));return j.useMemo(()=>({initial:e,animate:s}),[Oi(e),Oi(s)])}function Oi(t){return Array.isArray(t)?t.join(" "):t}const Ii={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"]},Be={};for(const t in Ii)Be[t]={isEnabled:e=>Ii[t].some(s=>!!e[s])};function Yd(t){for(const e in t)Be[e]={...Be[e],...t[e]}}const Gd=Symbol.for("motionComponentSymbol");function Xd({preloadedFeatures:t,createVisualElement:e,useRender:s,useVisualState:n,Component:i}){t&&Yd(t);function o(l,c){let d;const u={...j.useContext(un),...l,layoutId:qd(l)},{isStatic:h}=u,f=Hd(l),m=n(l,h);if(!h&&dn){Zd();const p=Qd(u);d=p.MeasureLayout,f.visualElement=_d(i,m,u,e,p.ProjectionNode)}return r.jsxs(Ht.Provider,{value:f,children:[d&&f.visualElement?r.jsx(d,{visualElement:f.visualElement,...u}):null,s(i,l,Wd(m,f.visualElement,c),m,h,f.visualElement)]})}const a=j.forwardRef(o);return a[Gd]=i,a}function qd({layoutId:t}){const e=j.useContext(ln).id;return e&&t!==void 0?e+"-"+t:t}function Zd(t,e){j.useContext(fa).strict}function Qd(t){const{drag:e,layout:s}=Be;if(!e&&!s)return{};const n={...e,...s};return{MeasureLayout:e!=null&&e.isEnabled(t)||s!=null&&s.isEnabled(t)?n.MeasureLayout:void 0,ProjectionNode:n.ProjectionNode}}const Jd=["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 hn(t){return typeof t!="string"||t.includes("-")?!1:!!(Jd.indexOf(t)>-1||/[A-Z]/u.test(t))}function ga(t,{style:e,vars:s},n,i){Object.assign(t.style,e,i&&i.getProjectionStyles(n));for(const o in s)t.style.setProperty(o,s[o])}const xa=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 va(t,e,s,n){ga(t,e,void 0,n);for(const i in e.attrs)t.setAttribute(xa.has(i)?i:on(i),e.attrs[i])}function ya(t,{layout:e,layoutId:s}){return Ce.has(t)||t.startsWith("origin")||(e||s!==void 0)&&(!!Ft[t]||t==="opacity")}function fn(t,e,s){var n;const{style:i}=t,o={};for(const a in i)(z(i[a])||e.style&&z(e.style[a])||ya(a,t)||((n=s==null?void 0:s.getValue(a))===null||n===void 0?void 0:n.liveStyle)!==void 0)&&(o[a]=i[a]);return o}function ba(t,e,s){const n=fn(t,e,s);for(const i in t)if(z(t[i])||z(e[i])){const o=it.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;n[o]=t[i]}return n}function mn(t){const e=j.useRef(null);return e.current===null&&(e.current=t()),e.current}function eh({scrapeMotionValuesFromProps:t,createRenderState:e,onMount:s},n,i,o){const a={latestValues:th(n,i,o,t),renderState:e()};return s&&(a.mount=l=>s(n,l,a)),a}const ja=t=>(e,s)=>{const n=j.useContext(Ht),i=j.useContext(zt),o=()=>eh(t,e,n,i);return s?o():mn(o)};function th(t,e,s,n){const i={},o=n(t,{});for(const f in o)i[f]=wt(o[f]);let{initial:a,animate:l}=t;const c=Yt(t),d=pa(t);e&&d&&!c&&t.inherit!==!1&&(a===void 0&&(a=e.initial),l===void 0&&(l=e.animate));let u=s?s.initial===!1:!1;u=u||a===!1;const h=u?l:a;if(h&&typeof h!="boolean"&&!_t(h)){const f=Array.isArray(h)?h:[h];for(let m=0;m<f.length;m++){const p=Bs(t,f[m]);if(p){const{transitionEnd:x,transition:b,...v}=p;for(const y in v){let g=v[y];if(Array.isArray(g)){const N=u?g.length-1:0;g=g[N]}g!==null&&(i[y]=g)}for(const y in x)i[y]=x[y]}}}return i}const pn=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),wa=()=>({...pn(),attrs:{}}),Ta=(t,e)=>e&&typeof t=="number"?e.transform(t):t,sh={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},nh=it.length;function ih(t,e,s){let n="",i=!0;for(let o=0;o<nh;o++){const a=it[o],l=t[a];if(l===void 0)continue;let c=!0;if(typeof l=="number"?c=l===(a.startsWith("scale")?1:0):c=parseFloat(l)===0,!c||s){const d=Ta(l,Xs[a]);if(!c){i=!1;const u=sh[a]||a;n+=`${u}(${d}) `}s&&(e[a]=d)}}return n=n.trim(),s?n=s(e,i?"":n):i&&(n="none"),n}function gn(t,e,s){const{style:n,vars:i,transformOrigin:o}=t;let a=!1,l=!1;for(const c in e){const d=e[c];if(Ce.has(c)){a=!0;continue}else if(pr(c)){i[c]=d;continue}else{const u=Ta(d,Xs[c]);c.startsWith("origin")?(l=!0,o[c]=u):n[c]=u}}if(e.transform||(a||s?n.transform=ih(e,t.transform,s):n.transform&&(n.transform="none")),l){const{originX:c="50%",originY:d="50%",originZ:u=0}=o;n.transformOrigin=`${c} ${d} ${u}`}}function Bi(t,e,s){return typeof t=="string"?t:S.transform(e+s*t)}function rh(t,e,s){const n=Bi(e,t.x,t.width),i=Bi(s,t.y,t.height);return`${n} ${i}`}const ah={offset:"stroke-dashoffset",array:"stroke-dasharray"},oh={offset:"strokeDashoffset",array:"strokeDasharray"};function lh(t,e,s=1,n=0,i=!0){t.pathLength=1;const o=i?ah:oh;t[o.offset]=S.transform(-n);const a=S.transform(e),l=S.transform(s);t[o.array]=`${a} ${l}`}function xn(t,{attrX:e,attrY:s,attrScale:n,originX:i,originY:o,pathLength:a,pathSpacing:l=1,pathOffset:c=0,...d},u,h){if(gn(t,d,h),u){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:f,style:m,dimensions:p}=t;f.transform&&(p&&(m.transform=f.transform),delete f.transform),p&&(i!==void 0||o!==void 0||m.transform)&&(m.transformOrigin=rh(p,i!==void 0?i:.5,o!==void 0?o:.5)),e!==void 0&&(f.x=e),s!==void 0&&(f.y=s),n!==void 0&&(f.scale=n),a!==void 0&&lh(f,a,l,c,!1)}const vn=t=>typeof t=="string"&&t.toLowerCase()==="svg",ch={useVisualState:ja({scrapeMotionValuesFromProps:ba,createRenderState:wa,onMount:(t,e,{renderState:s,latestValues:n})=>{k.read(()=>{try{s.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{s.dimensions={x:0,y:0,width:0,height:0}}}),k.render(()=>{xn(s,n,vn(e.tagName),t.transformTemplate),va(e,s)})}})},uh={useVisualState:ja({scrapeMotionValuesFromProps:fn,createRenderState:pn})};
vendor: 4,586 bytes, line 19
19function Na(t,e,s){for(const n in e)!z(e[n])&&!ya(n,s)&&(t[n]=e[n])}function dh({transformTemplate:t},e){return j.useMemo(()=>{const s=pn();return gn(s,e,t),Object.assign({},s.vars,s.style)},[e])}function hh(t,e){const s=t.style||{},n={};return Na(n,s,t),Object.assign(n,dh(t,e)),n}function fh(t,e){const s={},n=hh(t,e);return t.drag&&t.dragListener!==!1&&(s.draggable=!1,n.userSelect=n.WebkitUserSelect=n.WebkitTouchCallout="none",n.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(s.tabIndex=0),s.style=n,s}const mh=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 Ot(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||mh.has(t)}let Sa=t=>!Ot(t);function ph(t){t&&(Sa=e=>e.startsWith("on")?!Ot(e):t(e))}try{ph(require("@emotion/is-prop-valid").default)}catch{}function gh(t,e,s){const n={};for(const i in t)i==="values"&&typeof t.values=="object"||(Sa(i)||s===!0&&Ot(i)||!e&&!Ot(i)||t.draggable&&i.startsWith("onDrag"))&&(n[i]=t[i]);return n}function xh(t,e,s,n){const i=j.useMemo(()=>{const o=wa();return xn(o,e,vn(n),t.transformTemplate),{...o.attrs,style:{...o.style}}},[e]);if(t.style){const o={};Na(o,t.style,t),i.style={...o,...i.style}}return i}function vh(t=!1){return(s,n,i,{latestValues:o},a)=>{const c=(hn(s)?xh:fh)(n,o,a,s),d=gh(n,typeof s=="string",t),u=s!==j.Fragment?{...d,...c,ref:i}:{},{children:h}=n,f=j.useMemo(()=>z(h)?h.get():h,[h]);return j.createElement(s,{...u,children:f})}}function yh(t,e){return function(n,{forwardMotionProps:i}={forwardMotionProps:!1}){const a={...hn(n)?ch:uh,preloadedFeatures:t,useRender:vh(i),createVisualElement:e,Component:n};return Xd(a)}}const Ls={current:null},Pa={current:!1};function bh(){if(Pa.current=!0,!!dn)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>Ls.current=t.matches;t.addListener(e),e()}else Ls.current=!1}function jh(t,e,s){for(const n in e){const i=e[n],o=s[n];if(z(i))t.addValue(n,i);else if(z(o))t.addValue(n,st(i,{owner:t}));else if(o!==i)if(t.hasValue(n)){const a=t.getValue(n);a.liveStyle===!0?a.jump(i):a.hasAnimated||a.set(i)}else{const a=t.getStaticValue(n);t.addValue(n,st(a!==void 0?a:i,{owner:t}))}}for(const n in s)e[n]===void 0&&t.removeValue(n);return e}const $i=new WeakMap,wh=[...vr,W,xe],Th=t=>wh.find(xr(t)),Ui=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class Nh{scrapeMotionValuesFromProps(e,s,n){return{}}constructor({parent:e,props:s,presenceContext:n,reducedMotionConfig:i,blockInitialAnimation:o,visualState:a},l={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Hs,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const f=re.now();this.renderScheduledAt<f&&(this.renderScheduledAt=f,k.render(this.render,!1,!0))};const{latestValues:c,renderState:d}=a;this.latestValues=c,this.baseTarget={...c},this.initialValues=s.initial?{...c}:{},this.renderState=d,this.parent=e,this.props=s,this.presenceContext=n,this.depth=e?e.depth+1:0,this.reducedMotionConfig=i,this.options=l,this.blockInitialAnimation=!!o,this.isControllingVariants=Yt(s),this.isVariantNode=pa(s),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:u,...h}=this.scrapeMotionValuesFromProps(s,{},this);for(const f in h){const m=h[f];c[f]!==void 0&&z(m)&&m.set(c[f],!1)}}mount(e){this.current=e,$i.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEac
vendor: 5,730 bytes, line 19
19h((s,n)=>this.bindToMotionValue(n,s)),Pa.current||bh(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:Ls.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){$i.delete(this.current),this.projection&&this.projection.unmount(),ge(this.notifyUpdate),ge(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const s=this.features[e];s&&(s.unmount(),s.isMounted=!1)}this.current=null}bindToMotionValue(e,s){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const n=Ce.has(e),i=s.on("change",l=>{this.latestValues[e]=l,this.props.onUpdate&&k.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0)}),o=s.on("renderRequest",this.scheduleRender);let a;window.MotionCheckAppearSync&&(a=window.MotionCheckAppearSync(this,e,s)),this.valueSubscriptions.set(e,()=>{i(),o(),a&&a(),s.owner&&s.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in Be){const s=Be[e];if(!s)continue;const{isEnabled:n,Feature:i}=s;if(!this.features[e]&&i&&n(this.props)&&(this.features[e]=new i(this)),this.features[e]){const o=this.features[e];o.isMounted?o.update():(o.mount(),o.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):I()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,s){this.latestValues[e]=s}update(e,s){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=s;for(let n=0;n<Ui.length;n++){const i=Ui[n];this.propEventSubscriptions[i]&&(this.propEventSubscriptions[i](),delete this.propEventSubscriptions[i]);const o="on"+i,a=e[o];a&&(this.propEventSubscriptions[i]=this.on(i,a))}this.prevMotionValues=jh(this,this.scrapeMotionValuesFromProps(e,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]: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(e){const s=this.getClosestVariantNode();if(s)return s.variantChildren&&s.variantChildren.add(e),()=>s.variantChildren.delete(e)}addValue(e,s){const n=this.values.get(e);s!==n&&(n&&this.removeValue(e),this.bindToMotionValue(e,s),this.values.set(e,s),this.latestValues[e]=s.get())}removeValue(e){this.values.delete(e);const s=this.valueSubscriptions.get(e);s&&(s(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,s){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return n===void 0&&s!==void 0&&(n=st(s===null?void 0:s,{owner:this}),this.addValue(e,n)),n}readValue(e,s){var n;let i=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:(n=this.getBaseTargetFromProps(this.props,e))!==null&&n!==void 0?n:this.readValueFromInstance(this.current,e,this.options);return i!=null&&(typeof i=="string"&&(fr(i)||hr(i))?i=parseFloat(i):!Th(i)&&xe.test(s)&&(i=Pr(e,s)),this.setBaseTarget(e,z(i)?i.get():i)),z(i)?i.get():i}setBaseTarget(e,s){this.baseTarget[e]=s}getBaseTarget(e){var s;const{initial:n}=this.props;let i;if(typeof n=="string"||typeof n=="object"){const a=Bs(this.props,n,(s=this.presenceContext)===null||s===void 0?void 0:s.custom);a&&(i=a[e])}if(n&&i!==void 0)return i;const o=this.getBaseTargetFromProps(this.props,e);return o!==void 0&&!z(o)?o:this.initialValues[e]!==void 0&&i===void 0?void 0:this.baseTarget[e]}on(e,s){return this.events[e]||(this.events[e]=new an),this.events[e].add(s)}notify(e,...s){this.events[e]&&this.events[e].notify(...s)}}class Ca extends Nh{constructor(){super(...arguments),this.KeyframeResolver=Cr}sortInstanceNodePosition(e,s){return e.compareDocumentPosition(s)&2?1:-1}getBaseTargetFromProps(e,s){return e.style?e.style[s]:void 0}removeValueFromRenderState(e,{vars:s,style:n}){delete s[e],delete n[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;z(e)&&(this.childSubscription=e.on("change",s=>{this.current&&(this.current.textContent=`${s}`)}))}}function Sh(t){return window.getComputedStyle(t)}class Ph extends Ca{constructor(){super(...arguments),this.type="html",this.renderInstance=ga}readValueFromInstance(e,s){if(Ce.has(s)){const n=qs(s);return n&&n.default||0}else{const n=Sh(e),i=(pr(s)?n.getPropertyValue(s):n[s])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(e,{transformPagePoint:s}){return Jr(e,s)}build(e,s,n){gn(e,s,n.transformTemplate)}scrapeMotionValuesFromProps(e,s,n){return fn(e,s,n)}}class Ch extends Ca{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=I}getBaseTargetFromProps(e,s){return e[s]}readValueFromInstance(e,s){if(Ce.has(s)){const n=qs(s);return n&&n.default||0}return s=xa.has(s)?s:on(s),e.getAttribute(s)}scrapeMotionValuesFromProps(e,s,n){return ba(e,s,n)}
19build(e,s,n){xn(e,s,this.isSVGTag,n.transformTemplate)}renderInstance(e,s,n,i){va(e,s,n,i)}mount(e){this.isSVGTag=vn(e.tagName),super.mount(e)}}const kh=(t,e)=>hn(t)?new Ch(e):new Ph(e,{allowProjection:t!==j.Fragment}),Ah=yh({...pu,...$d,...Ad,...Ud},kh),pt=fl(Ah);class Dh extends j.Component{getSnapshotBeforeUpdate(e){const s=this.props.childRef.current;if(s&&e.isPresent&&!this.props.isPresent){const n=this.props.sizeRef.current;n.height=s.offsetHeight||0,n.width=s.offsetWidth||0,n.top=s.offsetTop,n.left=s.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function Vh({children:t,isPresent:e}){const s=j.useId(),n=j.useRef(null),i=j.useRef({width:0,height:0,top:0,left:0}),{nonce:o}=j.useContext(un);return j.useInsertionEffect(()=>{const{width:a,height:l,top:c,left:d}=i.current;if(e||!n.current||!a||!l)return;n.current.dataset.motionPopId=s;const u=document.createElement("style");return o&&(u.nonce=o),document.head.appendChild(u),u.sheet&&u.sheet.insertRule(` 20 [data-motion-pop-id="${s}"] { 21 position: absolute !important; 22 width: ${a}px !important; 23 height: ${l}px !important; 24 top: ${c}px !important; 25 left: ${d}px !important; 26 } 27 `),()=>{document.head.removeChild(u)}},[e]),r.jsx(Dh,{isPresent:e,childRef:n,sizeRef:i,children:j.cloneElement(t,{ref:n})})}const Rh=({children:t,initial:e,isPresent:s,onExitComplete:n,custom:i,presenceAffectsLayout:o,mode:a})=>{const l=mn(Mh),c=j.useId(),d=j.useCallback(h=>{l.set(h,!0);for(const f of l.values())if(!f)return;n&&n()},[l,n]),u=j.useMemo(()=>({id:c,initial:e,isPresent:s,custom:i,onExitComplete:d,register:h=>(l.set(h,!1),()=>l.delete(h))}),o?[Math.random(),d]:[s,d]);return j.useMemo(()=>{l.forEach((h,f)=>l.set(f,!1))},[s]),j.useEffect(()=>{!s&&!l.size&&n&&n()},[s]),a==="popLayout"&&(t=r.jsx(Vh,{isPresent:s,children:t})),r.jsx(zt.Provider,{value:u,children:t})};function Mh(){return new Map}const gt=t=>t.key||"";function _i(t){const e=[];return j.Children.forEach(t,s=>{j.isValidElement(s)&&e.push(s)}),e}const Lh=({children:t,exitBeforeEnter:e,custom:s,initial:n=!0,onExitComplete:i,presenceAffectsLayout:o=!0,mode:a="sync"})=>{const l=j.useMemo(()=>_i(t),[t]),c=l.map(gt),d=j.useRef(!0),u=j.useRef(l),h=mn(()=>new Map),[f,m]=j.useState(l),[p,x]=j.useState(l);ha(()=>{d.current=!1,u.current=l;for(let y=0;y<p.length;y++){const g=gt(p[y]);c.includes(g)?h.delete(g):h.get(g)!==!0&&h.set(g,!1)}},[p,c.length,c.join("-")]);const b=[];if(l!==f){let y=[...l];for(let g=0;g<p.length;g++){const N=p[g],w=gt(N);c.includes(w)||(y.splice(g,0,N),b.push(N))}a==="wait"&&b.length&&(y=b),x(_i(y)),m(l);return}const{forceRender:v}=j.useContext(ln);return r.jsx(r.Fragment,{children:p.map(y=>{const g=gt(y),N=l===p||c.includes(g),w=()=>{if(h.has(g))h.set(g,!0);else return;let P=!0;h.forEach(V=>{V||(P=!1)}),P&&(v==null||v(),x(u.current),i&&i())};return r.jsx(Rh,{isPresent:N,initial:!d.current||n?void 0:!1,custom:N?void 0:s,presenceAffectsLayout:o,mode:a,onExitComplete:N?void 0:w,children:y},g)})})};function Eh({stages:t,onStageClick:e,isEcommerce:s=!0}){const[n,i]=j.useState(null),[o,a]=j.useState(null),l=u=>{i(u),e==null||e(u)},c=u=>"bg-primary",d=u=>!u||u<15?"excellent":u<30?"good":"needs attention";return r.jsx("div",{className:"w-full py-8 px-4",children:r.jsx("div",{className:"max-w-4xl mx-auto",children:r.jsxs("div",{className:"relative",children:[r.jsx("div",{className:"space-y-2",children:t.map((u,h)=>{const f=100-h*15,m=n===u.name,p=o===u.name,x=u.icon;return r.jsx("div",{className:"flex justify-center",children:r.jsxs(pt.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:h*.1,duration:.5},style:{width:`${f}%`},className:"relative",children:[r.jsx(pt.button,{whileHover:{scale:1.02},whileTap:{scale:.98},onClick:()=>l(u.name),onMouseEnter:()=>a(u.name),onMouseLeave:()=>a(null),className:` 28 w-full py-6 px-6 rounded-lg cursor-pointer transition-all 29 ${m||p?"ring-2 ring-primary shadow-lg":"shadow-md"} 30 ${c(u.dropOffRate)} text-white 31 `,"data-testid":`funnel-stage-${u.name}`,children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(x,{className:"w-6 h-6"}),r.jsxs("div",{className:"text-left",children:[r.jsx("div",{className:"font-semibold text-sm uppercase tracking-wide",children:u.label}),r.jsx("div",{className:"text-2xl font-bold mt-1",children:u.count.toLocaleStr
31ing()})]})]}),r.jsxs("div",{className:"text-right",children:[u.conversionRate!==void 0&&r.jsxs("div",{className:"text-sm font-medium",children:[u.conversionRate.toFixed(1),"% conversion"]}),u.revenue!==void 0&&u.revenue>0&&r.jsxs("div",{className:"text-sm mt-1 flex items-center justify-end gap-1",children:[r.jsx(Wi,{className:"w-4 h-4"}),u.revenue.toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:0})]})]})]})}),h<t.length-1&&u.dropOffRate!==void 0&&r.jsx(pt.div,{initial:{opacity:0},animate:{opacity:1},transition:{delay:h*.1+.3},className:"absolute left-1/2 -translate-x-1/2 -bottom-1 z-10",children:r.jsxs(Y,{className:"text-xs px-2 py-1 bg-white text-black border-none","data-testid":`dropoff-${u.name}`,children:[r.jsx(zi,{className:"w-3 h-3 mr-1 inline"}),u.dropOffRate.toFixed(1),"% drop"]})})]})},u.name)})}),r.jsx(Lh,{children:n&&r.jsx(pt.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"mt-8",children:r.jsx(A,{children:r.jsx(D,{className:"p-6",children:(()=>{const u=t.find(h=>h.name===n);return u?r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsxs("h3",{className:"text-xl font-bold text-black dark:text-white",children:[u.label," Details"]}),r.jsx(Y,{className:"bg-primary text-white",children:d(u.dropOffRate)})]}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[r.jsxs("div",{className:"p-4 bg-black rounded",children:[r.jsx("div",{className:"text-sm text-white mb-1",children:"Users"}),r.jsx("div",{className:"text-2xl font-bold text-white",children:u.count.toLocaleString()})]}),u.conversionRate!==void 0&&r.jsxs("div",{className:"p-4 bg-black rounded",children:[r.jsx("div",{className:"text-sm text-white mb-1",children:"Conversion Rate"}),r.jsxs("div",{className:"text-2xl font-bold text-white",children:[u.conversionRate.toFixed(1),"%"]})]}),u.dropOffRate!==void 0&&r.jsxs("div",{className:"p-4 bg-black rounded",children:[r.jsx("div",{className:"text-sm text-white mb-1",children:"Drop-off Rate"}),r.jsxs("div",{className:"text-2xl font-bold text-white",children:[u.dropOffRate.toFixed(1),"%"]})]}),u.revenue!==void 0&&u.revenue>0&&r.jsxs("div",{className:"p-4 bg-black rounded",children:[r.jsx("div",{className:"text-sm text-white mb-1",children:"Revenue"}),r.jsxs("div",{className:"text-2xl font-bold text-white",children:["$",u.revenue.toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:0})]})]})]}),r.jsx("div",{className:"mt-4 text-center",children:r.jsx("button",{onClick:()=>i(null),className:"text-sm text-black dark:text-white hover:underline","data-testid":"close-stage-details",children:"Close Details"})})]}):null})()})})})})]})})})}function Fh({connectionId:t,dateRangeFrom:e,dateRangeTo:s,stageName:n,stageLabel:i}){const[o,a]=j.useState("device"),{data:l,isLoading:c}=se({queryKey:["/api/insightbridge/funnel-dimensional",t,e,s,o],enabled:!!t&&!!e&&!!s}),{data:d,isLoading:u}=se({queryKey:["/api/insightbridge/exit-pages",t,e,s],enabled:!!t&&!!e&&!!s}),h=l==null?void 0:l.filter(p=>p.stage===n).reduce((p,x)=>{var y;const b=((y=x.meta)==null?void 0:y[o])||"Unknown",v=p.find(g=>g.name===b);return v?(v.count+=x.count,v.revenue=(v.revenue||0)+(x.revenue||0)):p.push({name:b,count:x.count,revenue:x.revenue||0}),p},[]).sort((p,x)=>x.count-p.count).slice(0,10),f={device:"Device Type",country:"Geography",userType:"User Type"},m=["#FE8D01","#FF6B35","#F7B801","#00D9FF","#7209B7"];return r.jsxs("div",{className:"space-y-6",children:[r.jsxs(A,{children:[r.jsx(F,{children:r.jsxs(O,{className:"text-black dark:text-white",children:["Drop-off Analysis: ",i]})}),r.jsx(D,{children:r.jsxs(It,{value:o,onValueChange:p=>a(p),children:[r.jsxs(Bt,{className:"grid w-full grid-cols-3",children:[r.jsxs(ne,{value:"device",className:"flex items-center gap-2 text-white data-[state=active]:text-white","data-testid":"tab-device",children:[r.jsx(ho,{className:"w-4 h-4"}),"Device"]}),r.jsxs(ne,{value:"country",className:"flex items-center gap-2 text-white data-[state=active]:text-white","data-testid":"tab-country",children:[r.jsx(Ea,{className:"w-4 h-4"}),"Geography"]}),r.jsxs(ne,{value:"userType",className:"flex items-center gap-2 text-white data-[state=active]:text-white","data-testid":"tab-usertype",children:[r.jsx(Hi,{className:"w-4 h-4"}),"User Type"]})]}),r.jsx(Ee,{value:o,className:"mt-6",children:c?r.jsxs("div",{className:"space-y-3",children:[r.jsx(B,{className:"h-8 w-full"}),r.jsx(B,{className:"h-8 w-full"}),r.jsx(B,{className:"h-8 w-full"})]}):h&&h.length>0?r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ze,{width:"100%",height:300,children:r.jsxs(Xi,{data:h,children:[r.jsx(Nt,{strokeDasharray:"3 3"}),r.jsx(St,{dataKey:"name",angle:-45,textAnchor:"end",height:100}),r.jsx(Pt,{}),r.jsx(le,{contentStyle:{backgroundColor:"white",border:"1px solid #ccc",color:"#000"},formatter:p=>
31[p.toLocaleString(),"Count"]}),r.jsx(ps,{dataKey:"count",radius:[8,8,0,0],children:h.map((p,x)=>r.jsx(Ka,{fill:m[x%m.length]},`cell-${x}`))})]})}),r.jsxs("div",{className:"grid gap-2",children:[r.jsxs("div",{className:"text-sm font-medium text-black dark:text-white mb-2",children:["Breakdown by ",f[o]]}),h.map((p,x)=>r.jsxs("div",{className:"flex items-center justify-between p-3 bg-white rounded border border-gray-200","data-testid":`dimension-item-${x}`,children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:m[x%m.length]}}),r.jsx("span",{className:"font-medium text-black",children:p.name})]}),r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsxs("span",{className:"text-black",children:[p.count.toLocaleString()," users"]}),p.revenue>0&&r.jsxs("span",{className:"text-black text-sm",children:["$",p.revenue.toLocaleString()," revenue"]})]})]},p.name))]})]}):r.jsxs("div",{className:"text-center py-8 text-black dark:text-white",children:["No ",f[o].toLowerCase()," data available for this stage"]})})]})})]}),r.jsxs(A,{children:[r.jsx(F,{children:r.jsxs(O,{className:"flex items-center gap-2 text-black dark:text-white",children:[r.jsx(Wa,{className:"w-5 h-5"}),"Top Exit Pages"]})}),r.jsx(D,{children:u?r.jsxs("div",{className:"space-y-3",children:[r.jsx(B,{className:"h-12 w-full"}),r.jsx(B,{className:"h-12 w-full"}),r.jsx(B,{className:"h-12 w-full"})]}):d&&d.length>0?r.jsx("div",{className:"space-y-2",children:d.slice(0,10).map((p,x)=>r.jsxs("div",{className:"flex items-center justify-between p-3 bg-white rounded border border-gray-200","data-testid":`exit-page-${x}`,children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("div",{className:"font-medium text-black truncate",children:p.pageTitle||p.pagePath}),r.jsx("div",{className:"text-sm text-black dark:text-white truncate",children:p.pagePath})]}),r.jsx("div",{className:"flex items-center gap-4 ml-4",children:r.jsxs("div",{className:"text-right",children:[r.jsxs("div",{className:"text-sm font-medium text-black",children:[p.exits.toLocaleString()," exits"]}),r.jsxs("div",{className:"text-xs text-black dark:text-white",children:[p.exitRate.toFixed(1),"% exit rate"]})]})})]},x))}):r.jsx("div",{className:"text-center py-8 text-black dark:text-white",children:"No exit page data available"})})]})]})}function Oh({connectionId:t,dateRangeFrom:e,dateRangeTo:s}){const{data:n,isLoading:i}=se({queryKey:["/api/insightbridge/funnels",t,e,s],queryFn:async()=>{const d=await fetch(`/api/insightbridge/funnels/${t}?from=${e}&to=${s}`,{credentials:"include"});if(!d.ok)throw new Error("Failed to fetch funnel data");return d.json()},enabled:!!t&&!!e&&!!s}),{data:o,isLoading:a}=se({queryKey:["/api/insightbridge/funnel-by-channel",t,e,s],queryFn:async()=>{const d=await fetch(`/api/insightbridge/funnel-by-channel/${t}?from=${e}&to=${s}`,{credentials:"include"});if(!d.ok)throw new Error("Failed to fetch channel data");return d.json()},enabled:!!t&&!!e&&!!s}),l=i||a,c=Ih(n||[],o||[]);return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-6 gap-4",children:[r.jsxs(A,{children:[r.jsx(F,{className:"pb-2",children:r.jsx(O,{className:"text-sm font-medium text-black dark:text-white",children:"Total Revenue"})}),r.jsx(D,{children:l?r.jsx(B,{className:"h-8 w-24"}):r.jsxs("div",{className:"text-2xl font-bold text-black dark:text-white","data-testid":"total-revenue",children:["$",c.totalRevenue.toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:0})]})})]}),r.jsxs(A,{children:[r.jsx(F,{className:"pb-2",children:r.jsx(O,{className:"text-sm font-medium text-black dark:text-white",children:"Average Order Value"})}),r.jsx(D,{children:l?r.jsx(B,{className:"h-8 w-24"}):r.jsxs("div",{className:"text-2xl font-bold text-black dark:text-white","data-testid":"aov",children:["$",c.aov.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})]})})]}),r.jsxs(A,{children:[r.jsx(F,{className:"pb-2",children:r.jsx(O,{className:"text-sm font-medium text-black dark:text-white",children:"Add to Cart Count"})}),r.jsx(D,{children:l?r.jsx(B,{className:"h-8 w-24"}):r.jsx("div",{className:"text-2xl font-bold text-black dark:text-white","data-testid":"add-to-cart-count",children:c.addToCartCount.toLocaleStr
31ing()})})]}),r.jsxs(A,{children:[r.jsx(F,{className:"pb-2",children:r.jsxs(O,{className:"text-sm font-medium text-black dark:text-white flex items-center gap-2",children:["Add to Cart Value",r.jsx(yn,{children:r.jsxs(bn,{children:[r.jsx(jn,{asChild:!0,children:r.jsx(Ct,{className:"w-4 h-4 cursor-help","data-testid":"tooltip-add-to-cart-value"})}),r.jsx(wn,{className:"bg-white dark:bg-black border border-orange-500",children:r.jsx("p",{className:"text-black dark:text-white",children:"Add to Cart Value = Add to Cart Users à AOV"})})]})})]})}),r.jsx(D,{children:l?r.jsx(B,{className:"h-8 w-24"}):r.jsxs("div",{className:"text-2xl font-bold text-black dark:text-white","data-testid":"add-to-cart-value",children:["$",c.addToCartValue.toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:0})]})})]}),r.jsxs(A,{children:[r.jsx(F,{className:"pb-2",children:r.jsxs(O,{className:"text-sm font-medium text-black dark:text-white flex items-center gap-2",children:["Cart Abandonment Value",r.jsx(yn,{children:r.jsxs(bn,{children:[r.jsx(jn,{asChild:!0,children:r.jsx(Ct,{className:"w-4 h-4 cursor-help","data-testid":"tooltip-cart-abandonment"})}),r.jsx(wn,{className:"bg-white dark:bg-black border border-orange-500",children:r.jsx("p",{className:"text-black dark:text-white",children:"Cart Abandonment Value = Abandoned Carts à AOV"})})]})})]})}),r.jsx(D,{children:l?r.jsx(B,{className:"h-8 w-24"}):r.jsxs("div",{children:[r.jsxs("div",{className:"text-2xl font-bold text-black dark:text-white","data-testid":"abandonment-value",children:["$",c.cartAbandonmentValue.toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:0})]}),r.jsxs("div",{className:"text-xs text-black dark:text-white mt-1",children:[c.abandonedCarts.toLocaleString()," abandoned carts"]})]})})]}),r.jsxs(A,{children:[r.jsx(F,{className:"pb-2",children:r.jsx(O,{className:"text-sm font-medium text-black dark:text-white",children:"Revenue Per Session"})}),r.jsx(D,{children:l?r.jsx(B,{className:"h-8 w-24"}):r.jsxs("div",{className:"text-2xl font-bold text-black dark:text-white","data-testid":"rps",children:["$",c.revenuePerSession.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})]})})]})]}),c.cartAbandonmentValue>0&&r.jsxs(A,{className:"border-orange-500",children:[r.jsx(F,{children:r.jsxs(O,{className:"flex items-center gap-2 text-black dark:text-white",children:[r.jsx(za,{className:"w-5 h-5"}),"Recovery Opportunity"]})}),r.jsx(D,{children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("p",{className:"text-black dark:text-white",children:["You have ",r.jsxs("span",{className:"font-bold",children:["$",c.cartAbandonmentValue.toLocaleString()]})," in potential revenue from ",r.jsx("span",{className:"font-bold",children:c.abandonedCarts})," abandoned carts."]}),r.jsxs("div",{className:"flex gap-2 flex-wrap",children:[r.jsxs(Y,{className:"bg-orange-500 text-white",children:["Avg Abandoned Value: $",(c.cartAbandonmentValue/Math.max(c.abandonedCarts,1)).toFixed(2)]}),r.jsxs(Y,{className:"bg-orange-500 text-white",children:["Potential Recovery: ",(c.abandonedCarts*.1).toFixed(0)," orders (10% recovery rate)"]})]}),r.jsxs("p",{className:"text-sm text-black dark:text-white mt-3",children:["ð¡ ",r.jsx("strong",{children:"Recommendations:"})," Implement cart abandonment email campaigns, retargeting ads, or exit-intent popups to recover these lost sales."]})]})})]})]})}function Ih(t,e){const s={totalRevenue:0,totalPurchases:0,totalSessions:0,abandonedCarts:0,aov:0,revenuePerSession:0,cartAbandonmentValue:0,addToCartCount:0,addToCartValue:0};e&&e.length>0&&(e.forEach(i=>{s.totalRevenue+=i.revenue||0,s.totalPurchases+=i.transactions||0,s.addToCartCount+=i.addToCarts||i.addToCartUsers||0}),e.forEach(i=>{const o=i.addToCarts||i.addToCartUsers||0,a=i.transactions||0;s.abandonedCarts+=Math.max(0,o-a)})),s.totalPurchases>0&&(s.aov=s.totalRevenue/s.totalPurchases),s.cartAbandonmentValue=s.abandonedCarts*s.aov,s.addToCartValue=s.addToCartCount*s.aov;const n=t==null?void 0:t.find(i=>i.stage==="sessions");return n&&(s.totalSessions=n.count||0,s.totalSessions>0&&(s.revenuePerSession=s.totalRevenue/s.totalSessions)),s}const Bh=[{value:"device",label:"Device Type"},{value:"channel",label:"Traffic Channel"},{value:"country",label:"Geography (Country)"},{value:"userType",label:"User Type (New vs Returning)"}];function $h({connectionId:t,dateRangeFrom:e,dateRangeTo:s}){const[n,i]=j.useState("device"),{data:o,isLoading:a}=se({queryKey:["/api/insightbridge/segment-comparison",t,e,s,n],queryFn:async()=>{const u=await fetch(`/api/insightbridge/segment-comparison/${t}?from=${e}&to=${s}&dimension=${n}`,{credentials:"include"});if(!u.ok)throw new Error("Failed to fetch segment comparison data");return u.json()},enabled:!!t&&!!e&&!!s}),l=u=>!o||o.length===0?null:o.reduce((h,f)=>f[u]>h[u]?f:h),c=l("conversionRate"),d=l("revenue");return r.jsxs(A,{children:[r.jsx(F,{children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(O,{className:"text-black dark:text-white",children:"Segment Performance Comparison"}),r.jsxs(Ha,{value:n,onValueChange:u=>i(u),children:[r.jsx(Ya,{className:"w-[280px]","data-testid":"select-dimension",children:r.jsx(Ga,{})}),r.jsx(Xa,{children:Bh.map(u=>r.jsx(qa,{value:u.value,children:u.label},u.value))})]})]})}),r.jsx(D,{children:a?r.jsx("div",{className:"space-y-3",children:[...Array(3)].map((u,h)=>r.jsx(B,{className:"h-16 w-full"},h))}):!o||o.length===0?r.jsx("div",{className:"text-center py-8 text-black dark:text-white",children:"No data available for this segment"}):r.jsxs("div",{className:"overflow-x-auto",children:[r.jsxs("table",{className:"w-full text-sm","data-testid":"segment-comparison-table",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b border-white/10",children:[r.jsx("th",{className:"text-left py-3 px-2 font-medium text-black dark:text-white",children:"Segment"}),r.jsx("th",{className:"text-right py-3 px-2 font-medium text-black dark:text-white",children:"Sessions"}),r.jsx("th",{className:"text-right py-3 px-2 font-medium text-black dark:text-white",children:"Conv. Rate"}),r.jsx("th",{className:"text-right py-3 px-2 font-medium text-black dark:text-white",children:"Revenue"}),r.jsx("th",{className:"text-right py-3 px-2 font-medium text-black dark:text-white",children:"AOV"}),r.jsx("th",{className:"text-right py-3 px-2 font-medium text-black dark:text-white",children:"Cart Aband."}),r.jsx("th",{className:"text-right py-3 px-2 font-medium text-black dark:text-white",children:"Performance"})]})}),r.jsx("tbody",{children:o.map((u,h)=>{const f=u.segment===(c==null?void 0:c.segment),m=u.segment===(d==null?void 0:d.segment);return r.jsxs("tr",{className:"border-b border-white/5 hover:bg-white/5","data-testid":`segment-row-${h}`,children:[r.jsx("td",{className:"py-3 px-2",children:r.jsx("div",{className:"font-medium text-black dark:text-white",children:u.segment})}),r.jsx("td",{className:"text-right py-3 px-2 text-black dark:text-white",children:u.sessions.toLocaleStr
31ing()}),r.jsx("td",{className:"text-right py-3 px-2",children:r.jsxs("div",{className:"flex items-center justify-end gap-1",children:[r.jsxs("span",{className:"text-black dark:text-white",children:[u.conversionRate.toFixed(2),"%"]}),f&&r.jsx(Se,{className:"w-4 h-4 text-orange-500"})]})}),r.jsx("td",{className:"text-right py-3 px-2",children:r.jsxs("div",{className:"flex items-center justify-end gap-1",children:[r.jsxs("span",{className:"text-black dark:text-white",children:["$",u.revenue.toLocaleString()]}),m&&r.jsx(Se,{className:"w-4 h-4 text-orange-500"})]})}),r.jsxs("td",{className:"text-right py-3 px-2 text-black dark:text-white",children:["$",u.aov.toFixed(2)]}),r.jsxs("td",{className:"text-right py-3 px-2 text-black dark:text-white",children:[u.cartAbandonmentRate.toFixed(1),"%"]}),r.jsx("td",{className:"text-right py-3 px-2",children:r.jsxs("div",{className:"flex justify-end gap-1",children:[f&&r.jsx(Y,{className:"bg-orange-500 text-white text-xs",children:"Top Conv."}),m&&r.jsx(Y,{className:"bg-orange-500 text-white text-xs",children:"Top Rev."})]})})]},u.segment)})})]}),c&&d&&r.jsx("div",{className:"mt-4 p-4 bg-white/5 rounded-lg border border-orange-500/20",children:r.jsxs("div",{className:"text-sm text-black dark:text-white space-y-2",children:[r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx(uo,{className:"w-4 h-4 text-orange-500 mt-0.5 flex-shrink-0"}),r.jsxs("span",{children:[r.jsx("strong",{children:c.segment})," has the highest conversion rate at"," ",r.jsxs("strong",{children:[c.conversionRate.toFixed(2),"%"]})]})]}),r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx(Se,{className:"w-4 h-4 text-orange-500 mt-0.5 flex-shrink-0"}),r.jsxs("span",{children:[r.jsx("strong",{children:d.segment})," generates the most revenue at"," ",r.jsxs("strong",{children:["$",d.revenue.toLocaleString()]})]})]})]})})]})})]})}function Uh({connectionId:t,dateRangeFrom:e,dateRangeTo:s}){const[n,i]=j.useState("flow"),{data:o,isLoading:a,error:l}=se({queryKey:["/api/insightbridge/conversion-paths",t,e,s],queryFn:async()=>{const m=await fetch(`/api/insightbridge/conversion-paths/${t}?from=${e}&to=${s}`,{credentials:"include"});if(!m.ok)throw new Error("Failed to fetch conversion path data");return m.json()},enabled:!!t}),c=j.useMemo(()=>{if(!(o!=null&&o.channelFlow)||o.channelFlow.length===0)return null;const m=[],p=[],x=o.channelFlow.slice(0,6);x.forEach(w=>{m.push({name:w.channel})}),["View Items","Add to Cart","Checkout","Purchase"].forEach(w=>{m.push({name:w})});const v=x.length;x.forEach((w,P)=>{w.viewItems>0&&p.push({source:P,target:v,value:w.viewItems})}),x.reduce((w,P)=>w+P.viewItems,0);const y=x.reduce((w,P)=>w+P.addToCarts,0),g=x.reduce((w,P)=>w+P.checkouts,0),N=x.reduce((w,P)=>w+P.purchases,0);return y>0&&p.push({source:v,target:v+1,value:y}),g>0&&p.push({source:v+1,target:v+2,value:g}),N>0&&p.push({source:v+2,target:v+3,value:N}),{nodes:m,links:p}},[o]);if(a)return r.jsxs(A,{className:"bg-card",children:[r.jsx(F,{children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Jt,{className:"h-5 w-5 text-primary"}),r.jsx(O,{children:"Conversion Path Finder"})]})}),r.jsx(D,{children:r.jsx(B,{className:"h-[400px]"})})]});if(l||!o)return r.jsxs(A,{className:"bg-card",children:[r.jsx(F,{children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Jt,{className:"h-5 w-5 text-primary"}),r.jsx(O,{children:"Conversion Path Finder"})]})}),r.jsx(D,{children:r.jsx(Fs,{children:r.jsx(Os,{children:"Unable to load conversion path data. Please try again later."})})})]});const d=o.channelFlow.reduce((m,p)=>m+p.sessions,0),u=o.channelFlow.reduce((m,p)=>m+p.purchases,0),h=o.channelFlow.reduce((m,p)=>m+p.revenue,0),f=d>0?u/d*100:0;return r.jsxs(A,{className:"bg-card",children:[r.jsx(F,{children:r.jsx("div",{className:"flex items-center justify-between",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Jt,{className:"h-5 w-5 text-primary"}),r.jsxs("div",{children:[r.jsx(O,{"data-testid":"heading-path-finder",children:"Conversion Path Finder"}),r.jsx(Tt,{children:"Discover your best conversion paths and identify optimization opportunities"})]})]})})}),r.jsxs(D,{children:[r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4 mb-6",children:[r.jsxs("div",{className:"bg-black rounded-lg p-4",children:[r.jsx("div",{className:"text-sm text-gray-400 mb-1",children:"Total Sessions"}),r.jsx("div",{className:"text-2xl font-bold text-white",children:d.toLocaleStr
31ing()})]}),r.jsxs("div",{className:"bg-black rounded-lg p-4",children:[r.jsx("div",{className:"text-sm text-gray-400 mb-1",children:"Conversions"}),r.jsx("div",{className:"text-2xl font-bold text-white",children:u.toLocaleString()})]}),r.jsxs("div",{className:"bg-black rounded-lg p-4",children:[r.jsx("div",{className:"text-sm text-gray-400 mb-1",children:"Conversion Rate"}),r.jsxs("div",{className:"text-2xl font-bold text-primary",children:[f.toFixed(2),"%"]})]}),r.jsxs("div",{className:"bg-black rounded-lg p-4",children:[r.jsx("div",{className:"text-sm text-gray-400 mb-1",children:"Total Revenue"}),r.jsxs("div",{className:"text-2xl font-bold text-green-500",children:["$",h.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})]})]})]}),r.jsxs(It,{value:n,onValueChange:m=>i(m),children:[r.jsxs(Bt,{className:"mb-4",children:[r.jsxs(ne,{value:"flow","data-testid":"tab-flow",children:[r.jsx(Nn,{className:"h-4 w-4 mr-2"}),"Channel Flow"]}),r.jsxs(ne,{value:"paths","data-testid":"tab-paths",children:[r.jsx(Sn,{className:"h-4 w-4 mr-2"}),"Top Paths"]}),r.jsxs(ne,{value:"problems","data-testid":"tab-problems",children:[r.jsx(kt,{className:"h-4 w-4 mr-2"}),"Problem Areas"]})]}),r.jsx(Ee,{value:"flow",children:c&&c.links.length>0?r.jsxs("div",{className:"bg-black rounded-lg p-4",children:[r.jsx(Ze,{width:"100%",height:350,children:r.jsx(Is,{data:c,node:r.jsx(_h,{}
31),link:{stroke:"#FE8D01",strokeOpacity:.4},nodePadding:30,nodeWidth:12,margin:{top:20,right:200,bottom:20,left:20},children:r.jsx(le,{contentStyle:{backgroundColor:"#1a1a1a",border:"1px solid #333",borderRadius:"8px",color:"#fff"}})})}),r.jsx("div",{className:"mt-4 grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-2",children:o.channelFlow.slice(0,6).map((m,p)=>r.jsxs("div",{className:"bg-gray-900 rounded p-3 text-center",children:[r.jsx("div",{className:"text-xs text-gray-400 truncate",title:m.channel,children:m.channel}),r.jsx("div",{className:"text-sm font-bold text-white",children:m.sessions.toLocaleString()}),r.jsxs("div",{className:"text-xs text-primary",children:[m.conversionRate.toFixed(1),"% CR"]})]},m.channel))})]}):r.jsxs("div",{className:"text-center py-12 text-gray-400",children:[r.jsx(Nn,{className:"h-12 w-12 mx-auto mb-3 opacity-50"}),r.jsx("p",{children:"No channel flow data available for this period"})]})}),r.jsx(Ee,{value:"paths",children:o.topConvertingPaths.length>0?r.jsxs("div",{className:"space-y-3",children:[r.jsx("div",{className:"text-sm text-gray-400 mb-4",children:"Top converting channel + landing page combinations"}),o.topConvertingPaths.map((m,p)=>r.jsxs("div",{className:"bg-black rounded-lg p-4 flex items-center justify-between","data-testid":`path-${p}`,children:[r.jsxs("div",{className:"flex items-center gap-4 flex-1 min-w-0",children:[r.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-full bg-primary text-white font-bold text-sm",children:p+1}),r.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[r.jsx(Y,{variant:"outline",className:"shrink-0",children:m.entryChannel}),r.jsx(Qa,{className:"h-4 w-4 text-gray-500 shrink-0"}),r.jsx("span",{className:"text-white truncate",title:m.landingPage,children:m.landingPage})]})]}),r.jsxs("div",{className:"flex items-center gap-6 shrink-0",children:[r.jsxs("div",{className:"text-right",children:[r.jsx("div",{className:"text-xs text-gray-400",children:"Sessions"}),r.jsx("div",{className:"font-bold text-white",children:m.sessions.toLocaleString()})]}),r.jsxs("div",{className:"text-right",children:[r.jsx("div",{className:"text-xs text-gray-400",children:"Conversions"}),r.jsx("div",{className:"font-bold text-green-500",children:m.conversions})]}),r.jsxs("div",{className:"text-right min-w-[80px]",children:[r.jsx("div",{className:"text-xs text-gray-400",children:"Conv. Rate"}),r.jsxs("div",{className:"font-bold text-primary",children:[m.conversionRate.toFixed(2),"%"]})]}),m.revenue>0&&r.jsxs("div",{className:"text-right",children:[r.jsx("div",{className:"text-xs text-gray-400",children:"Revenue"}),r.jsxs("div",{className:"font-bold text-green-500",children:["$",m.revenue.toLocaleString()]})]})]})]},p))]}):r.jsxs("div",{className:"text-center py-12 text-gray-400",children:[r.jsx(Sn,{className:"h-12 w-12 mx-auto mb-3 opacity-50"}),r.jsx("p",{children:"No converting paths found for this period"})]})}),r.jsxs(Ee,{value:"problems",children:[o.problemAreas.length>0?r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"text-sm text-gray-400 mb-4",children:"Identified issues that may be hurting your conversion rate"}),o.problemAreas.map((m,p)=>r.jsx("div",{className:"bg-black rounded-lg p-4 border-l-4 border-red-500","data-testid":`problem-${p}`,children:r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx(kt,{className:"h-5 w-5 text-red-500"}),r.jsx("span",{className:"font-bold text-white",children:m.stage}),r.jsxs(Y,{variant:"destructive",className:"text-xs",children:[m.dropOffRate.toFixed(0),"% drop-off"]})]}),r.jsx("p",{className:"text-gray-300 mb-2",children:m.issue}),r.jsx("p",{className:"text-sm text-gray-400",children:m.impact})]}),m.potentialRevenueLoss>0&&r.jsxs("div",{className:"text-right ml-4",children:[r.jsx("div",{className:"text-xs text-gray-400",children:"Potential Revenue Loss"}),r.jsxs("div",{className:"text-xl font-bold text-red-500",children:["$",m.potentialRevenueLoss.toLocaleStr
31ing(void 0,{maximumFractionDigits:0})]})]})]})},p))]}):r.jsxs("div",{className:"text-center py-12 text-green-500",children:[r.jsx(Se,{className:"h-12 w-12 mx-auto mb-3"}),r.jsx("p",{className:"font-medium",children:"No major problems detected"}),r.jsx("p",{className:"text-sm text-gray-400 mt-1",children:"Your funnel is performing well"})]}),o.exitPages.length>0&&r.jsxs("div",{className:"mt-8",children:[r.jsxs("h4",{className:"text-lg font-semibold text-white mb-4 flex items-center gap-2",children:[r.jsx(Ja,{className:"h-5 w-5 text-red-500"}),"Top Exit Pages"]}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:o.exitPages.slice(0,6).map((m,p)=>r.jsxs("div",{className:"bg-black rounded-lg p-3 flex items-center justify-between",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("div",{className:"text-white truncate text-sm",title:m.page,children:m.page}),r.jsx("div",{className:"text-xs text-gray-400 truncate",title:m.pageTitle,children:m.pageTitle})]}),r.jsxs("div",{className:"text-right ml-3 shrink-0",children:[r.jsxs("div",{className:"text-red-500 font-bold",children:[m.exitRate.toFixed(1),"%"]}),r.jsxs("div",{className:"text-xs text-gray-400",children:[m.exits.toLocaleString()," exits"]})]})]},p))})]})]})]})]})]})}function _h(t){const{x:e,y:s,width:n,height:i,index:o,payload:a}=t,l=o<6;return r.jsxs(ze,{children:[r.jsx(Gi,{x:e,y:s,width:n,height:i,fill:l?"#FE8D01":"#22c55e",fillOpacity:.9}),r.jsx("text",{x:e+n+6,y:s+i/2,textAnchor:"start",dominantBaseline:"middle",fill:"#fff",fontSize:11,children:(a==null?void 0:a.name)||""})]},`CustomNode${o}`)}const xt=["#FE8D01","#3b82f6","#22c55e","#a855f7","#ef4444","#06b6d4","#f59e0b","#ec4899","#64748b","#10b981"],Kh={opener:{label:"Awareness Channel",description:"Starts more journeys than it closes â great for new customer acquisition",color:"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400",icon:Se,iconColor:"text-blue-500"},balanced:{label:"Balanced Channel",description:"Contributes equally to starting and closing customer journeys",color:"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300",icon:Za,iconColor:"text-gray-400"},closer:{label:"Conversion Channel",description:"Closes more journeys than it starts â great last-touch performance",color:"bg-orange-100 text-orange-800 dark:bg-orange-900/30 dark:text-orange-400",icon:zi,iconColor:"text-orange-500"}};function vt(t){return"$"+t.toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:0})}function Wh(t){if(!t||t.length<10)return t;const[e,s,n]=t.split("-");return`${s}/${n}`}function zh({connectionId:t,dateRangeFrom:e,dateRangeTo:s,isEcommerce:n}){const[i,o]=j.useState("trends"),[a,l]=j.useState(n?"revenue":"sessions"),[c,d]=j.useState(null),{data:u,isLoading:h,error:f}=se({queryKey:["/api/insightbridge/channel-halo",t,e,s],queryFn:async()=>{const g=await fetch(`/api/insightbridge/channel-halo/${t}?from=${e}&to=${s}`,{credentials:"include"});if(!g.ok)throw new Error("Failed to fetch channel halo data");return g.json()},enabled:!!t}),m=j.useMemo(()=>u!=null&&u.topChannels?u.topChannels.slice(0,8):[],[u]),p=c??new Set(m.slice(0,5)),x=g=>{const N=new Set(p);N.has(g)?N.size>1&&N.delete(g):N.add(g),d(N)},b=j.useMemo(()=>u!=null&&u.dailyTrends?u.dailyTrends.map(g=>{const N={date:g.date};for(const w of m){const P=a==="revenue"?w:`${w}_sessions`;N[w]=g[P]||0}return N}):[],[u,m,a]);if(h)return r.jsxs(A,{className:"bg-white dark:bg-card border border-gray-200 dark:border-gray-700",children:[r.jsx(F,{children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(we,{className:"h-5 w-5 text-[#FE8D01]"}),r.jsx(O,{children:"Channel Halo Effect"})]})}),r.jsx(D,{children:r.jsx(B,{className:"h-[340px]"})})]});if(f||!u)return r.jsxs(A,{className:"bg-white dark:bg-card border border-gray-200 dark:border-gray-700",children:[r.jsx(F,{children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(we,{className:"h-5 w-5 text-[#FE8D01]"}),r.jsx(O,{children:"Channel Halo Effect"})]})}),r.jsx(D,{children:r.jsx(Fs,{children:r.jsx(Os,{children:"Unable to load channel influence data. Please try again later."})})})]});const v=u.channelRoles.filter(g=>g.role==="opener"),y=u.channelRoles.filter(g=>g.role==="closer");return r.jsxs(A,{className:"bg-white dark:bg-card border border-gray-200 dark:border-gray-700",children:[r.jsx(F,{children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(we,{className:"h-5 w-5 text-[#FE8D01]"}),r.jsxs("div",{children:[r.jsx(O,{className:"text-black dark:text-white",children:"Channel Halo Effect & Cross-Channel Influence"}),r.jsx(Tt,{className:"mt-1",children:"See how channels work together â which start the customer journey and which close it"})]})]})}),r.jsxs(D,{children:[(v.length>0||y.length>0)&&r.jsxs("div",{className:"flex flex-wrap gap-2 mb-5 p-3 bg-gray-50 dark:bg-gray-800/50 rounded-lg",children:[r.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-gray-500",children:[r.jsx(Ct,{className:"h-3.5 w-3.5"}
31),r.jsx("span",{children:"Quick summary:"})]}),v.map(g=>r.jsxs(Y,{className:"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400 text-xs font-medium",children:[g.channel," â awareness"]},g.channel)),y.map(g=>r.jsxs(Y,{className:"bg-orange-100 text-orange-800 dark:bg-orange-900/30 dark:text-orange-400 text-xs font-medium",children:[g.channel," â converter"]},g.channel))]}),r.jsxs(It,{value:i,onValueChange:g=>o(g),children:[r.jsxs(Bt,{className:"mb-4 bg-gray-100 dark:bg-gray-800",children:[r.jsx(ne,{value:"trends",className:"data-[state=active]:bg-white dark:data-[state=active]:bg-gray-700",children:"Daily Trends"}),r.jsx(ne,{value:"roles",className:"data-[state=active]:bg-white dark:data-[state=active]:bg-gray-700",children:"Channel Roles"})]}),r.jsx(Ee,{value:"trends",children:r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[n&&r.jsxs("div",{className:"flex rounded-md border border-gray-200 dark:border-gray-700 overflow-hidden text-xs",children:[r.jsx("button",{onClick:()=>l("revenue"),className:`px-3 py-1.5 font-medium transition-colors ${a==="revenue"?"bg-[#FE8D01] text-white":"bg-white dark:bg-gray-800 text-gray-600 dark:text-gray-300 hover:bg-gray-50"}`,children:"Revenue"}),r.jsx("button",{onClick:()=>l("sessions"),className:`px-3 py-1.5 font-medium transition-colors ${a==="sessions"?"bg-[#FE8D01] text-white":"bg-white dark:bg-gray-800 text-gray-600 dark:text-gray-300 hover:bg-gray-50"}`,children:"Sessions"})]}),r.jsx("div",{className:"flex flex-wrap gap-1.5",children:m.map((g,N)=>r.jsx("button",{onClick:()=>x(g),className:`inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium transition-all border ${p.has(g)?"border-transparent text-white":"border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 text-gray-500 dark:text-gray-400"}`,style:p.has(g)?{backgroundColor:xt[N%xt.length]}:{},children:g},g))})]}),b.length>0?r.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800/30 rounded-lg p-4",children:[r.jsx(Ze,{width:"100%",height:320,children:r.jsxs(qi,{data:b,margin:{top:5,right:20,left:10,bottom:5},children:[r.jsx(Nt,{strokeDasharray:"3 3",stroke:"#e5e7eb"}),r.jsx(St,{dataKey:"date",tickFormatter:Wh,tick:{fontSize:11,fill:"#9ca3af"},interval:"preserveStartEnd"}),r.jsx(Pt,{tick:{fontSize:11,fill:"#9ca3af"},tickFormatter:g=>a==="revenue"?`$${(g/1e3).toFixed(0)}k`:g.toLocaleString(),width:60}),r.jsx(le,{contentStyle:{backgroundColor:"#fff",border:"1px solid #e5e7eb",borderRadius:"8px",fontSize:12},formatter:(g,N)=>[a==="revenue"?vt(g):g.toLocaleString(),N],labelFormatter:g=>`Date: ${g}`}),r.jsx(gs,{wrapperStyle:{fontSize:12}}),m.map((g,N)=>p.has(g)?r.jsx(Ae,{type:"monotone",dataKey:g,stroke:xt[N%xt.length],strokeWidth:2,dot:!1,activeDot:{r:4}},g):null)]})}),r.jsx("p",{className:"text-xs text-gray-400 mt-2 text-center",children:"Tip: Look for spikes in awareness channels (Paid Social, Display) followed by rises in Direct or Organic Search a few days later â that's the halo effect in action."})]}):r.jsxs("div",{className:"text-center py-12 text-gray-400",children:[r.jsx(we,{className:"h-10 w-10 mx-auto mb-3 opacity-40"}),r.jsx("p",{children:"No daily trend data available for this period"})]})]})}),r.jsx(Ee,{value:"roles",children:r.jsxs("div",{className:"space-y-4",children:[r.jsxs("p",{className:"text-sm text-gray-500",children:["The ",r.jsx("strong",{children:"Assist Score"})," compares first-touch revenue (new users acquired) vs last-touch revenue (purchases closed). A score >1.3 means the channel starts more journeys than it ends â an awareness driver. A score <0.7 means it primarily closes deals."]}),n&&u.channelRoles.length>0&&r.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800/30 rounded-lg p-4",children:[r.jsx("p",{className:"text-xs text-gray-500 mb-3 font-medium",children:"First-touch vs Last-touch Revenue by Channel"}),r.jsx(Ze,{width:"100%",height:240,children:r.jsxs(Xi,{data:u.channelRoles.slice(0,8),margin:{top:5,right:10,left:10,bottom:60},barCategoryGap:"30%",children:[r.jsx(Nt,{strokeDasharray:"3 3",stroke:"#e5e7eb"}),r.jsx(St,{dataKey:"channel",tick:{fontSize:10,fill:"#9ca3af"},angle:-35,textAnchor:"end",interval:0}),r.jsx(Pt,{tick:{fontSize:10,fill:"#9ca3af"},tickFormatter:g=>`$${(g/1e3).toFixed(0)}k`,width:50}),r.jsx(le,{contentStyle:{backgroundColor:"#fff",border:"1px solid #e5e7eb",borderRadius:"8px",fontSize:12},formatter:(g,N)=>[vt(g),N==="firstTouchRevenue"?"First-touch Revenue":"Last-touch Revenue"]}),r.jsx(gs,{formatter:g=>g==="firstTouchRevenue"?"First-touch Revenue":"Last-touch Revenue",wrapperStyle:{fontSize:11}}),r.jsx(ps,{dataKey:"firstTouchRevenue",fill:"#3b82f6",radius:[3,3,0,0]}),r.jsx(ps,{dataKey:"lastTouchRevenue",fill:"#FE8D01",radius:[3,3,0,0]})]})})]}),r.jsxs("div",{className:"space-y-2",children:[u.channelRoles.map(g=>{const N=Kh[g.role],w=N.icon;return r.jsxs("div",{className:"flex items-center gap-4 p-3 rounded-lg border border-gray-100 dark:border-gray-700 bg-white dark:bg-gray-800/50",children:[r.jsx("div",{className:"w-8 h-8 rounded-full bg-gray-100 dark:bg-gray-700 flex items-center justify-center shrink-0",children:r.jsx(w,{className:`h-4 w-4 ${N.iconColor}`})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r.jsx("span",{className:"font-semibold text-sm text-black dark:text-white",children:g.channel}),r.jsx(Y,{className:`text-xs ${N.color}`,children:N.label})]}),r.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:N.description})]}),r.jsxs("div",{className:"flex gap-6 shrink-0 text-right",children:[n&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{children:[r.jsx("div",{className:"text-xs text-blue-500 font-medium",children:"First-touch"}),r.jsx("div",{className:"text-sm font-bold text-black dark:text-white",children:vt(g.firstTouchRevenue)}),r.jsxs("div",{className:"text-xs text-gray-400",children:[g.firstTouchNewUsers.toLocaleStr
31ing()," new users"]})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-xs text-orange-500 font-medium",children:"Last-touch"}),r.jsx("div",{className:"text-sm font-bold text-black dark:text-white",children:vt(g.lastTouchRevenue)}),r.jsxs("div",{className:"text-xs text-gray-400",children:[g.lastTouchPurchases.toLocaleString()," purchases"]})]})]}),!n&&r.jsxs("div",{children:[r.jsx("div",{className:"text-xs text-gray-500 font-medium",children:"Sessions"}),r.jsx("div",{className:"text-sm font-bold text-black dark:text-white",children:g.lastTouchSessions.toLocaleString()})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-xs text-gray-500 font-medium",children:"Assist Score"}),r.jsxs("div",{className:`text-sm font-bold ${g.role==="opener"?"text-blue-500":g.role==="closer"?"text-orange-500":"text-gray-500"}`,children:[g.assistScore.toFixed(2),"Ã"]})]})]})]},g.channel)}),u.channelRoles.length===0&&r.jsxs("div",{className:"text-center py-10 text-gray-400",children:[r.jsx(we,{className:"h-10 w-10 mx-auto mb-3 opacity-40"}),r.jsx("p",{children:"No channel role data available for this period"})]})]})]})})]})]})]})}const nt=[{name:"sessions",label:"Total Users"},{name:"item_view",label:"Item Views"},{name:"add_to_cart",label:"Add to Cart"},{name:"checkout",label:"Checkout"},{name:"purchase",label:"Purchase"}];function Jf(){var Gt,_,q,ke;const{hasAccess:t,reason:e,isLoading:s,isAdmin:n}=eo("funnel"),{dateRange:i,setDateRange:o}=Ra(30),[a,l]=j.useState("previous"),[c,d]=j.useState(null),[u,h]=j.useState("visual"),[f,m]=j.useState({}),p=T=>{T!=null&&T.dataKey&&m(U=>({...U,[T.dataKey]:!U[T.dataKey]}))},{selectedConnectionId:x,setSelectedConnectionId:b,connections:v}=no(),y=x,g=v.find(T=>T.id===y),{data:N=[],isLoading:w}=se({queryKey:["/api/insightbridge/funnels",y,i.from,i.to],queryFn:async()=>{const T=await fetch(`/api/insightbridge/funnels/${y}?from=${i.from}&to=${i.to}`,{credentials:"include"});if(!T.ok)throw new Error("Failed to fetch funnel data");return T.json()},enabled:!!y}),{data:P,isLoading:V}=se({queryKey:["/api/insightbridge/funnel-comparison",y,i.from,i.to,a],queryFn:async()=>{if(a==="none")return null;const T=Ma(i,a);if(!T)throw new Error("Failed to calculate comparison dates");const U=await fetch(`/api/insightbridge/funnel-comparison/${y}?from=${i.from}&to=${i.to}&comparisonFrom=${T.from}&comparisonTo=${T.to}`,{credentials:"include"});if(!U.ok)throw new Error("Failed to fetch funnel data");return U.json()},enabled:!!y&&a!=="none"}),C=w||V,M=a!=="none"?P:N,{data:$=[]}=se({queryKey:["/api/insightbridge/funnel-by-channel",y,i.from,i.to],queryFn:async()=>{const T=await fetch(`/api/insightbridge/funnel-by-channel/${y}?from=${i.from}&to=${i.to}`,{credentials:"include"});if(!T.ok)throw new Error("Failed to fetch channel data");return T.json()},enabled:!!y&&a==="none"}),ee=Array.isArray(M)?M:(M==null?void 0:M.current)||[],te=a==="none"&&$.length>0?Yh($):Gh(ee),lt=Xh(N),ae=Da({mutationFn:async()=>(await Aa(`/api/insightbridge/funnel-insights/${y}`,"POST",{from:i.from,to:i.to})).json()}),oe=ae.data;return s?r.jsx(Hh,{}):!t&&!n?r.jsx(Qt,{children:r.jsx("div",{className:"px-6 py-8",children:r.jsxs("div",{className:"w-full",children:[r.jsx(Zt,{}),r.jsx(to,{feature:"funnel",reason:e})]})})}):v.length===0?r.jsx(Qt,{children:r.jsx("div",{className:"px-6 py-8",children:r.jsxs("div",{className:"w-full",children:[r.jsx(Zt,{}),r.jsx(Fs,{children:r.jsx(Os,{"data-testid":"alert-no-connection",children:"No Google Analytics connected. Please connect your GA4 property first."})})]})})}):r.jsx(Qt,{children:r.jsx("div",{className:"px-6 py-8",children:r.jsxs("div",{className:"w-full",children:[r.jsx(Zt,{}),r.jsxs("div",{className:"mb-8",children:[r.jsx("h1",{className:"text-3xl font-bold mb-2","data-testid":"heading-funnel",children:"eCommerce Funnel"}),r.jsx("div",{className:"flex items-center gap-2","data-testid":"text-property",children:r.jsx(so,{selectedConnectionId:y,onConnectionChange:b})})]}),r.jsx(A,{className:"mb-8 bg-card",children:r.jsx(D,{className:"pt-6",children:r.jsx(La,{value:i,onChange:o,comparisonMode:a,onComparisonModeChange:l})})}),C?r.jsx(A,{children:r.jsx(D,{className:"pt-6",children:r.jsx(B,{className:"h-96"})})}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6 mb-8",children:[r.jsxs(A,{"data-testid":"card-total-users",children:[r.jsx(F,{className:"pb-2",children:r.jsx(O,{className:"text-sm font-medium text-card-foreground",children:"Total Users"})}),r.jsx(D,{children:r.jsx("div",{className:"text-2xl font-bold","data-testid":"text-total-users",children:yt(((Gt=te[0])==null?void 0:Gt.count)||0)})})]}),r.jsxs(A,{"data-testid":"card-total-purchases",children:[r.jsx(F,{className:"pb-2",children:r.jsx(O,{className:"text-sm font-medium text-card-foreground",children:"Total Purchases"})}),r.jsx(D,{children:r.jsx("div",{className:"text-2xl font-bold","data-testid":"text-total-purchases",children:yt(((_=te[4])==null?void 0:_.count)||0)})})]}),r.jsxs(A,{"data-testid":"card-conversion-rate",children:[r.jsx(F,{className:"pb-2",children:r.jsx(O,{className:"text-sm font-medium text-card-foreground",children:"Overall Conversion Rate"})}),r.jsx(D,{children:r.jsxs("div",{className:"text-2xl font-bold","data-testid":"text-conversion-rate",children:[(q=te[4])==null?void 0:q.conversionRate.toFixed(2),"%"]})})]})]}),r.jsxs("div",{className:"my-8",children:[r.jsx("h2",{className:"text-2xl font-bold mb-6 text-white",children:"Revenue Intelligence"}),r.jsx(Oh,{connectionId:y,dateRangeFrom:i.from,dateRangeTo:i.to})]}),r.jsx("div",{className:"my-8",children:r.jsx(Uh,{connectionId:y,dateRangeFrom:i.from,dateRangeTo:i.to})}),r.jsx("div",{className:"my-8",children:r.jsx(zh,{connectionId:y,dateRangeFrom:i.from,dateRangeTo:i.to,isEcommerce:!!(g!=null&&g.ecommerceEnabled)})}),r.jsxs(A,{className:"mb-8 bg-card",children:[r.jsxs(F,{children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(we,{className:"h-5 w-5 text-primary"}),r.jsx(O,{"data-testid":"heading-ai-insights",children:"AI-Powered Funnel Insights"})]}),r.jsx(Va,{onClick:()=>ae.mutate(),disabled:ae.isPending||!y,variant:"outline",size:"sm","data-testid":"button-generate-insights",children:ae.isPending?r.jsxs(r.Fragment,{children:[r.jsx(io,{className:"h-4 w-4 mr-2 animate-spin"}),"Analyzing..."]}):r.jsxs(r.Fragment,{children:[r.jsx(we,{className:"h-4 w-4 mr-2"}),"Generate Insights"]})})]}),r.jsx(Tt,{children:"AI-powered analysis with actionable recommendations to improve your funnel performance"})]}
31),r.jsxs(D,{children:[!oe&&!ae.isPending&&r.jsxs("div",{className:"text-center py-8",children:[r.jsx(ro,{className:"h-12 w-12 mx-auto text-muted-foreground mb-3"}),r.jsx("p",{className:"text-card-foreground mb-4",children:'Click "Generate Insights" to get AI-powered recommendations for your funnel'})]}),ae.isPending&&r.jsxs("div",{className:"space-y-4",children:[r.jsx(B,{className:"h-24"}),r.jsx(B,{className:"h-24"}),r.jsx(B,{className:"h-24"})]}),oe&&r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center gap-3 p-4 bg-black rounded-lg",children:[r.jsxs("div",{className:"text-sm",children:[r.jsx("span",{className:"font-medium text-white",children:"Funnel Health:"})," ",r.jsx(Y,{variant:oe.overallHealth==="excellent"?"default":oe.overallHealth==="good"?"secondary":oe.overallHealth==="fair"?"outline":"destructive","data-testid":"badge-funnel-health",children:oe.overallHealth.toUpperCase()})]}),r.jsx("div",{className:"flex-1 text-sm text-foreground",children:oe.summary})]}),oe.insights.map((T,U)=>r.jsx("div",{className:"border border-border rounded-lg p-4","data-testid":`insight-${U}`,children:r.jsxs("div",{className:"flex items-start gap-3 mb-3",children:[r.jsxs("div",{className:"mt-0.5",children:[T.severity==="critical"&&r.jsx(kt,{className:"h-5 w-5 text-red-600"}),T.severity==="warning"&&r.jsx(kt,{className:"h-5 w-5 text-yellow-600"}),T.severity==="info"&&r.jsx(Ct,{className:"h-5 w-5 text-primary"}),T.severity==="positive"&&r.jsx(Se,{className:"h-5 w-5 text-green-600"})]}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("h4",{className:"font-semibold text-card-foreground","data-testid":`insight-${U}-title`,children:T.title}),r.jsx(Y,{variant:"outline",className:"text-xs",children:T.category.replace("_"," ")})]}),r.jsx("p",{className:"text-sm text-card-foreground mb-3","data-testid":`insight-${U}-description`,children:T.description}),T.affectedStages.length>0&&r.jsxs("div",{className:"mb-3",children:[r.jsx("p",{className:"text-xs font-medium mb-1",children:"Affected Stages:"}),r.jsx("div",{className:"flex flex-wrap gap-1",children:T.affectedStages.map((Xt,qt)=>r.jsx(Y,{variant:"secondary",className:"text-xs",children:Xt},qt))})]}),T.recommendations.length>0&&r.jsxs("div",{className:"bg-black rounded p-3",children:[r.jsx("p",{className:"text-xs font-medium mb-2 text-white",children:"Recommendations:"}),r.jsx("ul",{className:"space-y-1",children:T.recommendations.map((Xt,qt)=>r.jsxs("li",{className:"text-sm flex items-start gap-2 text-white",children:[r.jsx("span",{className:"text-primary mt-1",children:"â¢"}),r.jsx("span",{children:Xt})]},qt))})]})]})]})},U))]})]})]}),lt.length>0&&r.jsxs(A,{className:"mb-8 bg-card",children:[r.jsxs(F,{children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Se,{className:"h-5 w-5 text-primary"}),r.jsx(O,{"data-testid":"heading-trends",children:"Funnel Performance Trends"})]}),r.jsx(Tt,{children:"Daily performance tracking for each funnel stage"})]}),r.jsx(D,{children:r.jsx(Ze,{width:"100%",height:400,children:r.jsxs(qi,{data:lt,children:[r.jsx(Nt,{strokeDasharray:"3 3",stroke:"#333"}),r.jsx(St,{dataKey:"date",stroke:"#888",tick:{fill:"#888"},tickFormatter:T=>Pn(Dn(T),"MMM d")}),r.jsx(Pt,{stroke:"#888",tick:{fill:"#888"}}),r.jsx(le,{contentStyle:{backgroundColor:"#fff",border:"1px solid #ccc",borderRadius:"6px"},labelFormatter:T=>Pn(Dn(T),"MMM d, yyyy")}),r.jsx(gs,{onClick:p,wrapperStyle:{cursor:"pointer"}}),r.jsx(Ae,{type:"monotone",dataKey:"sessions",stroke:"#FE8D01",
31strokeWidth:2,name:"Sessions",hide:f.sessions}),r.jsx(Ae,{type:"monotone",dataKey:"item_view",stroke:"#22c55e",strokeWidth:2,name:"Item Views",hide:f.item_view}),r.jsx(Ae,{type:"monotone",dataKey:"add_to_cart",stroke:"#3b82f6",strokeWidth:2,name:"Add to Cart",hide:f.add_to_cart}),r.jsx(Ae,{type:"monotone",dataKey:"checkout",stroke:"#a855f7",strokeWidth:2,name:"Checkout",hide:f.checkout}),r.jsx(Ae,{type:"monotone",dataKey:"purchase",stroke:"#ef4444",strokeWidth:2,name:"Purchase",hide:f.purchase})]})})})]}),r.jsxs(A,{className:"mb-8",children:[r.jsx(F,{children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(O,{"data-testid":"heading-stages",children:"Funnel Visualization"}),r.jsx(It,{value:u,onValueChange:T=>h(T),className:"w-auto",children:r.jsxs(Bt,{children:[r.jsx(ne,{value:"visual","data-testid":"tab-visual",children:"Visual Funnel"}),r.jsx(ne,{value:"traditional","data-testid":"tab-traditional",children:"Traditional View"})]})})]})}),r.jsx(D,{children:u==="visual"?r.jsx(Eh,{stages:te.map((T,U)=>({name:T.name,label:T.label,count:T.count,revenue:0,dropOffRate:T.dropOff,conversionRate:T.conversionRate,icon:U===0?Hi:U===1?ao:U===2?oo:U===3?lo:Wi})),onStageClick:T=>{d(T===c?null:T)},isEcommerce:!0}):r.jsx("div",{className:"space-y-6",children:te.map((T,U)=>r.jsxs("div",{"data-testid":`stage-${T.name}`,children:[r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"text-sm font-medium text-card-foreground","data-testid":`stage-${T.name}-number`,children:U+1}),r.jsx("div",{className:"font-medium","data-testid":`stage-${T.name}-label`,children:T.label})]}),r.jsxs("div",{className:"text-right",children:[r.jsx("div",{className:"font-bold","data-testid":`stage-${T.name}-count`,children:yt(T.count)}),r.jsxs("div",{className:"text-sm text-card-foreground","data-testid":`stage-${T.name}-rate`,children:[T.conversionRate.toFixed(1),"% of sessions"]})]})]}),r.jsx("div",{className:"w-full bg-muted rounded-full h-8 relative overflow-hidden",children:r.jsx("div",{className:"h-full bg-primary transition-all duration-300 flex items-center justify-end pr-4 text-primary-foreground text-sm font-medium",style:{width:`${T.conversionRate}%`},"data-testid":`stage-${T.name}-bar`,children:T.conversionRate>=10&&`${T.conversionRate.toFixed(1)}%`})})]}),U<te.length-1&&r.jsx("div",{className:"flex items-center justify-center mt-2","data-testid":`dropoff-${T.name}`,children:r.jsxs("div",{className:"flex items-center gap-2 text-sm text-red-600",children:[r.jsx(co,{className:"h-4 w-4"}),r.jsxs("span",{"data-testid":`dropoff-${T.name}-text`,children:[T.dropOff.toFixed(1),"% drop-off (",yt(T.count-te[U+1].count)," users)"]})]})})]},T.name))})})]}),r.jsx("div",{className:"my-8",children:r.jsx($h,{connectionId:y,dateRangeFrom:i.from,dateRangeTo:i.to})}),c&&r.jsx(Fh,{connectionId:y,dateRangeFrom:i.from,dateRangeTo:i.to,stageName:c,stageLabel:((ke=nt.find(T=>T.name===c))==null?void 0:ke.label)||c})]})]})})})}function Hh(){return r.jsx("div",{className:"min-h-screen bg-background p-8",children:r.jsxs("div",{className:"max-w-5xl mx-auto",children:[r.jsx(B,{className:"h-10 w-64 mb-8"}),r.jsx("div",{className:"space-y-6",children:[...Array(5)].map((t,e)=>r.jsx(A,{children:r.jsx(D,{className:"pt-6",children:r.jsx(B,{className:"h-16"})})},e))})]})})}function Yh(t){const e=t.reduce((i,o)=>(i.allUsers=(i.allUsers||0)+(o.allUsers||0),i.viewItemUsers=(i.viewItemUsers||0)+(o.viewItemUsers||0),i.addToCartUsers=(i.addToCartUsers||0)+(o.addToCartUsers||0),i.beginCheckoutUsers=(i.beginCheckoutUsers||0)+(o.beginCheckoutUsers||0),i.purchaseUsers=(i.purchaseUsers||0)+(o.purchaseUsers||0),i),{}),s={sessions:e.allUsers||0,item_view:e.viewItemUsers||0,add_to_cart:e.addToCartUsers||0,checkout:e.beginCheckoutUsers||0,purchase:e.purchaseUsers||0};return nt.map((i,o)=>{const a=s[i.name]||0,l=s.sessions||1,c=a/l*100,d=nt[o+1],u=d&&s[d.name]||0,h=a>0?(a-u)/a*100:0;return{name:i.name,label:i.label,count:a,dropOff:h,conversionRate:c}})}function Gh(t){const e={};return t.forEach(n=>{e[n.stage]||(e[n.stage]=0),e[n.stage]+=n.count}),nt.map((n,i)=>{const o=e[n.name]||0,a=e.sessions||1,l=o/a*100,c=nt[i+1],d=c&&e[c.name]||0,u=o>0?(o-d)/o*100:0;return{name:n.name,label:n.label,count:o,dropOff:u,conversionRate:l}})}function yt(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}K`:t.toFixed(0)}function Xh(t){const e={};return t.forEach(n=>{e[n.date]||(e[n.date]={}),e[n.date][n.stage]=n.count}),Object.keys(e).sort().map(n=>({date:n,sessions:e[n].sessions||0,item_view:e[n].item_view||0,add_to_cart:e[n].add_to_cart||0,checkout:e[n].checkout||0,purchase:e[n].purchase||0}))}export{Jf as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.