shieldcortex 2.17.1 → 2.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -12
- package/dashboard/.next/standalone/dashboard/.next/BUILD_ID +1 -1
- package/dashboard/.next/standalone/dashboard/.next/build-manifest.json +2 -2
- package/dashboard/.next/standalone/dashboard/.next/prerender-manifest.json +3 -3
- package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.html +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.html +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/index.html +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/index.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/_full.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/_index.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/page_client-reference-manifest.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_25b1b286._.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/pages/404.html +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/pages/500.html +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/server-reference-manifest.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/server-reference-manifest.json +1 -1
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/{61a3c89b08347bc2.js → 8a1c0cc0ae709e3d.js} +1 -1
- package/dist/defence/iron-dome/index.d.ts.map +1 -1
- package/dist/defence/iron-dome/index.js +5 -0
- package/dist/defence/iron-dome/index.js.map +1 -1
- package/dist/defence/pipeline.d.ts.map +1 -1
- package/dist/defence/pipeline.js +9 -6
- package/dist/defence/pipeline.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -1
- package/dist/lib.d.ts +2 -0
- package/dist/lib.d.ts.map +1 -1
- package/dist/lib.js +2 -0
- package/dist/lib.js.map +1 -1
- package/dist/license/cli.d.ts +9 -0
- package/dist/license/cli.d.ts.map +1 -0
- package/dist/license/cli.js +141 -0
- package/dist/license/cli.js.map +1 -0
- package/dist/license/gate.d.ts +38 -0
- package/dist/license/gate.d.ts.map +1 -0
- package/dist/license/gate.js +84 -0
- package/dist/license/gate.js.map +1 -0
- package/dist/license/index.d.ts +12 -0
- package/dist/license/index.d.ts.map +1 -0
- package/dist/license/index.js +12 -0
- package/dist/license/index.js.map +1 -0
- package/dist/license/keys.d.ts +50 -0
- package/dist/license/keys.d.ts.map +1 -0
- package/dist/license/keys.js +30 -0
- package/dist/license/keys.js.map +1 -0
- package/dist/license/store.d.ts +45 -0
- package/dist/license/store.d.ts.map +1 -0
- package/dist/license/store.js +148 -0
- package/dist/license/store.js.map +1 -0
- package/dist/license/validate.d.ts +24 -0
- package/dist/license/validate.d.ts.map +1 -0
- package/dist/license/validate.js +86 -0
- package/dist/license/validate.js.map +1 -0
- package/dist/license/verify.d.ts +18 -0
- package/dist/license/verify.d.ts.map +1 -0
- package/dist/license/verify.js +126 -0
- package/dist/license/verify.js.map +1 -0
- package/dist/memory/store.d.ts.map +1 -1
- package/dist/memory/store.js +18 -16
- package/dist/memory/store.js.map +1 -1
- package/dist/tools/context.d.ts.map +1 -1
- package/dist/tools/context.js +2 -0
- package/dist/tools/context.js.map +1 -1
- package/dist/worker/brain-worker.d.ts.map +1 -1
- package/dist/worker/brain-worker.js +25 -18
- package/dist/worker/brain-worker.js.map +1 -1
- package/package.json +1 -1
- /package/dashboard/.next/standalone/dashboard/.next/static/{H-BGC5Yp6YmPEZGryV6bd → h890EBq1H-89xzeQf-gx5}/_buildManifest.js +0 -0
- /package/dashboard/.next/standalone/dashboard/.next/static/{H-BGC5Yp6YmPEZGryV6bd → h890EBq1H-89xzeQf-gx5}/_clientMiddlewareManifest.json +0 -0
- /package/dashboard/.next/standalone/dashboard/.next/static/{H-BGC5Yp6YmPEZGryV6bd → h890EBq1H-89xzeQf-gx5}/_ssgManifest.js +0 -0
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
${p}px !important;
|
|
7
7
|
${x}px !important;
|
|
8
8
|
}
|
|
9
|
-
`),()=>{g.contains(f)&&g.removeChild(f)}},[t]),(0,c.jsx)(N,{isPresent:t,childRef:a,sizeRef:o,children:b.cloneElement(e,{ref:d})})}let S=({children:e,initial:t,isPresent:s,onExitComplete:i,custom:r,presenceAffectsLayout:n,mode:a,anchorX:o,anchorY:l,root:d})=>{let h=p(C),m=(0,u.useId)(),x=!0,f=(0,u.useMemo)(()=>(x=!1,{id:m,initial:t,isPresent:s,custom:r,onExitComplete:e=>{for(let t of(h.set(e,!0),h.values()))if(!t)return;i&&i()},register:e=>(h.set(e,!1),()=>h.delete(e))}),[s,h,i]);return n&&x&&(f={...f}),(0,u.useMemo)(()=>{h.forEach((e,t)=>h.set(t,!1))},[s]),u.useEffect(()=>{s||h.size||!i||i()},[s]),"popLayout"===a&&(e=(0,c.jsx)(k,{isPresent:s,anchorX:o,anchorY:l,root:d,children:e})),(0,c.jsx)(g.Provider,{value:f,children:e})};function C(){return new Map}function T(e=!0){let t=(0,u.useContext)(g);if(null===t)return[!0,null];let{isPresent:s,onExitComplete:i,register:r}=t,n=(0,u.useId)();(0,u.useEffect)(()=>{if(e)return r(n)},[e]);let a=(0,u.useCallback)(()=>e&&i&&i(n),[n,i,e]);return!s&&i?[!1,a]:[!0]}let A=e=>e.key||"";function M(e){let t=[];return u.Children.forEach(e,e=>{(0,u.isValidElement)(e)&&t.push(e)}),t}let P=({children:e,custom:t,initial:s=!0,onExitComplete:i,presenceAffectsLayout:r=!0,mode:n="sync",propagate:a=!1,anchorX:o="left",anchorY:l="top",root:d})=>{let[h,x]=T(a),g=(0,u.useMemo)(()=>M(e),[e]),y=a&&!h?[]:g.map(A),v=(0,u.useRef)(!0),b=(0,u.useRef)(g),j=p(()=>new Map),w=(0,u.useRef)(new Set),[N,k]=(0,u.useState)(g),[C,P]=(0,u.useState)(g);f(()=>{v.current=!1,b.current=g;for(let e=0;e<C.length;e++){let t=A(C[e]);y.includes(t)?(j.delete(t),w.current.delete(t)):!0!==j.get(t)&&j.set(t,!1)}},[C,y.length,y.join("-")]);let E=[];if(g!==N){let e=[...g];for(let t=0;t<C.length;t++){let s=C[t],i=A(s);y.includes(i)||(e.splice(t,0,s),E.push(s))}return"wait"===n&&E.length&&(e=E),P(M(e)),k(g),null}let{forceRender:D}=(0,u.useContext)(m);return(0,c.jsx)(c.Fragment,{children:C.map(e=>{let u=A(e),m=(!a||!!h)&&(g===C||y.includes(u));return(0,c.jsx)(S,{isPresent:m,initial:(!v.current||!!s)&&void 0,custom:t,presenceAffectsLayout:r,mode:n,root:d,onExitComplete:m?void 0:()=>{if(w.current.has(u)||(w.current.add(u),!j.has(u)))return;j.set(u,!0);let e=!0;j.forEach(t=>{t||(e=!1)}),e&&(D?.(),P(b.current),a&&x?.(),i&&i())},anchorX:o,anchorY:l,children:e},u)})})},E=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],D=new Set(E),L=(e,t,s)=>s>t?t:s<e?e:s,R={test:e=>"number"==typeof e,parse:parseFloat,transform:e=>e},V={...R,transform:e=>L(0,1,e)},F={...R,default:1},$=e=>Math.round(1e5*e)/1e5,z=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu,_=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,I=(e,t)=>s=>!!("string"==typeof s&&_.test(s)&&s.startsWith(e)||t&&null!=s&&Object.prototype.hasOwnProperty.call(s,t)),O=(e,t,s)=>i=>{if("string"!=typeof i)return i;let[r,n,a,o]=i.match(z);return{[e]:parseFloat(r),[t]:parseFloat(n),[s]:parseFloat(a),alpha:void 0!==o?parseFloat(o):1}},B={...R,transform:e=>Math.round(L(0,255,e))},U={test:I("rgb","red"),parse:O("red","green","blue"),transform:({red:e,green:t,blue:s,alpha:i=1})=>"rgba("+B.transform(e)+", "+B.transform(t)+", "+B.transform(s)+", "+$(V.transform(i))+")"},W={test:I("#"),parse:function(e){let t="",s="",i="",r="";return e.length>5?(t=e.substring(1,3),s=e.substring(3,5),i=e.substring(5,7),r=e.substring(7,9)):(t=e.substring(1,2),s=e.substring(2,3),i=e.substring(3,4),r=e.substring(4,5),t+=t,s+=s,i+=i,r+=r),{red:parseInt(t,16),green:parseInt(s,16),blue:parseInt(i,16),alpha:r?parseInt(r,16)/255:1}},transform:U.transform},q=e=>({test:t=>"string"==typeof t&&t.endsWith(e)&&1===t.split(" ").length,parse:parseFloat,transform:t=>`${t}${e}`}),K=q("deg"),H=q("%"),Y=q("px"),X=q("vh"),G=q("vw"),Q={...H,parse:e=>H.parse(e)/100,transform:e=>H.transform(100*e)},J={test:I("hsl","hue"),parse:O("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:s,alpha:i=1})=>"hsla("+Math.round(e)+", "+H.transform($(t))+", "+H.transform($(s))+", "+$(V.transform(i))+")"},Z={test:e=>U.test(e)||W.test(e)||J.test(e),parse:e=>U.test(e)?U.parse(e):J.test(e)?J.parse(e):W.parse(e),transform:e=>"string"==typeof e?e:e.hasOwnProperty("red")?U.transform(e):J.transform(e),getAnimatableNone:e=>{let t=Z.parse(e);return t.alpha=0,Z.transform(t)}},ee=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,et="number",es="color",ei=/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 er(e){let t=e.toString(),s=[],i={color:[],number:[],var:[]},r=[],n=0,a=t.replace(ei,e=>(Z.test(e)?(i.color.push(n),r.push(es),s.push(Z.parse(e))):e.startsWith("var(")?(i.var.push(n),r.push("var"),s.push(e)):(i.number.push(n),r.push(et),s.push(parseFloat(e))),++n,"${}")).split("${}");return{values:s,split:a,indexes:i,types:r}}function en(e){return er(e).values}function ea(e){let{split:t,types:s}=er(e),i=t.length;return e=>{let r="";for(let n=0;n<i;n++)if(r+=t[n],void 0!==e[n]){let t=s[n];t===et?r+=$(e[n]):t===es?r+=Z.transform(e[n]):r+=e[n]}return r}}let eo=e=>"number"==typeof e?0:Z.test(e)?Z.getAnimatableNone(e):e,el={test:function(e){return isNaN(e)&&"string"==typeof e&&(e.match(z)?.length||0)+(e.match(ee)?.length||0)>0},parse:en,createTransformer:ea,getAnimatableNone:function(e){let t=en(e);return ea(e)(t.map(eo))}},ed=new Set(["brightness","contrast","saturate","opacity"]);function ec(e){let[t,s]=e.slice(0,-1).split("(");if("drop-shadow"===t)return e;let[i]=s.match(z)||[];if(!i)return e;let r=s.replace(i,""),n=+!!ed.has(t);return i!==s&&(n*=100),t+"("+n+r+")"}let eu=/\b([a-z-]*)\(.*?\)/gu,eh={...el,getAnimatableNone:e=>{let t=e.match(eu);return t?t.map(ec).join(" "):e}},em={...R,transform:Math.round},ep={borderWidth:Y,borderTopWidth:Y,borderRightWidth:Y,borderBottomWidth:Y,borderLeftWidth:Y,borderRadius:Y,borderTopLeftRadius:Y,borderTopRightRadius:Y,borderBottomRightRadius:Y,borderBottomLeftRadius:Y,width:Y,maxWidth:Y,height:Y,maxHeight:Y,top:Y,right:Y,bottom:Y,left:Y,inset:Y,insetBlock:Y,insetBlockStart:Y,insetBlockEnd:Y,insetInline:Y,insetInlineStart:Y,insetInlineEnd:Y,padding:Y,paddingTop:Y,paddingRight:Y,paddingBottom:Y,paddingLeft:Y,paddingBlock:Y,paddingBlockStart:Y,paddingBlockEnd:Y,paddingInline:Y,paddingInlineStart:Y,paddingInlineEnd:Y,margin:Y,marginTop:Y,marginRight:Y,marginBottom:Y,marginLeft:Y,marginBlock:Y,marginBlockStart:Y,marginBlockEnd:Y,marginInline:Y,marginInlineStart:Y,marginInlineEnd:Y,fontSize:Y,backgroundPositionX:Y,backgroundPositionY:Y,rotate:K,rotateX:K,rotateY:K,rotateZ:K,scale:F,scaleX:F,scaleY:F,scaleZ:F,skew:K,skewX:K,skewY:K,distance:Y,translateX:Y,translateY:Y,translateZ:Y,x:Y,y:Y,z:Y,perspective:Y,transformPerspective:Y,opacity:V,originX:Q,originY:Q,originZ:Y,zIndex:em,fillOpacity:V,strokeOpacity:V,numOctaves:em},ex={...ep,color:Z,backgroundColor:Z,outlineColor:Z,fill:Z,stroke:Z,borderColor:Z,borderTopColor:Z,borderRightColor:Z,borderBottomColor:Z,borderLeftColor:Z,filter:eh,WebkitFilter:eh},ef=e=>ex[e],eg=()=>({translate:0,scale:1,origin:0,originPoint:0}),ey=()=>({x:eg(),y:eg()}),ev=()=>({min:0,max:0}),eb=()=>({x:ev(),y:ev()}),ej=e=>!!(e&&e.getVelocity),ew=new Set(["width","height","top","left","right","bottom",...E]),eN=e=>t=>t.test(e),ek=[R,Y,H,K,G,X,{test:e=>"auto"===e,parse:e=>e}],eS=e=>ek.find(eN(e)),eC=()=>{},eT=()=>{};h.default;let eA=e=>t=>"string"==typeof t&&t.startsWith(e),eM=eA("--"),eP=eA("var(--"),eE=e=>!!eP(e)&&eD.test(e.split("/*")[0].trim()),eD=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function eL(e){return"string"==typeof e&&e.split("/*")[0].includes("var(--")}let eR=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u,eV=e=>180*e/Math.PI,eF=e=>ez(eV(Math.atan2(e[1],e[0]))),e$={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:eF,rotateZ:eF,skewX:e=>eV(Math.atan(e[1])),skewY:e=>eV(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},ez=e=>((e%=360)<0&&(e+=360),e),e_=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),eI=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),eO={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:e_,scaleY:eI,scale:e=>(e_(e)+eI(e))/2,rotateX:e=>ez(eV(Math.atan2(e[6],e[5]))),rotateY:e=>ez(eV(Math.atan2(-e[2],e[0]))),rotateZ:eF,rotate:eF,skewX:e=>eV(Math.atan(e[4])),skewY:e=>eV(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function eB(e){return+!!e.includes("scale")}function eU(e,t){let s,i;if(!e||"none"===e)return eB(t);let r=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);if(r)s=eO,i=r;else{let t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);s=e$,i=t}if(!i)return eB(t);let n=s[t],a=i[1].split(",").map(eW);return"function"==typeof n?n(a):a[n]}function eW(e){return parseFloat(e.trim())}let eq=e=>e===R||e===Y,eK=new Set(["x","y","z"]),eH=E.filter(e=>!eK.has(e)),eY={width:({x:e},{paddingLeft:t="0",paddingRight:s="0"})=>e.max-e.min-parseFloat(t)-parseFloat(s),height:({y:e},{paddingTop:t="0",paddingBottom:s="0"})=>e.max-e.min-parseFloat(t)-parseFloat(s),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>eU(t,"x"),y:(e,{transform:t})=>eU(t,"y")};eY.translateX=eY.x,eY.translateY=eY.y;let eX=e=>e,eG={},eQ=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function eJ(e,t){let s=!1,i=!0,r={delta:0,timestamp:0,isProcessing:!1},n=()=>s=!0,a=eQ.reduce((e,s)=>(e[s]=function(e,t){let s=new Set,i=new Set,r=!1,n=!1,a=new WeakSet,o={delta:0,timestamp:0,isProcessing:!1},l=0;function d(t){a.has(t)&&(c.schedule(t),e()),l++,t(o)}let c={schedule:(e,t=!1,n=!1)=>{let o=n&&r?s:i;return t&&a.add(e),o.has(e)||o.add(e),e},cancel:e=>{i.delete(e),a.delete(e)},process:e=>{if(o=e,r){n=!0;return}r=!0,[s,i]=[i,s],s.forEach(d),t,l=0,s.clear(),r=!1,n&&(n=!1,c.process(e))}};return c}(n,t?s:void 0),e),{}),{setup:o,read:l,resolveKeyframes:d,preUpdate:c,update:u,preRender:h,render:m,postRender:p}=a,x=()=>{let n=eG.useManualTiming?r.timestamp:performance.now();s=!1,eG.useManualTiming||(r.delta=i?1e3/60:Math.max(Math.min(n-r.timestamp,40),1)),r.timestamp=n,r.isProcessing=!0,o.process(r),l.process(r),d.process(r),c.process(r),u.process(r),h.process(r),m.process(r),p.process(r),r.isProcessing=!1,s&&t&&(i=!1,e(x))};return{schedule:eQ.reduce((t,n)=>{let o=a[n];return t[n]=(t,n=!1,a=!1)=>(!s&&(s=!0,i=!0,r.isProcessing||e(x)),o.schedule(t,n,a)),t},{}),cancel:e=>{for(let t=0;t<eQ.length;t++)a[eQ[t]].cancel(e)},state:r,steps:a}}let{schedule:eZ,cancel:e0,state:e1,steps:e5}=eJ("u">typeof requestAnimationFrame?requestAnimationFrame:eX,!0),e4=new Set,e2=!1,e3=!1,e6=!1;function e8(){if(e3){let e=Array.from(e4).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),s=new Map;t.forEach(e=>{let t,i=(t=[],eH.forEach(s=>{let i=e.getValue(s);void 0!==i&&(t.push([s,i.get()]),i.set(+!!s.startsWith("scale")))}),t);i.length&&(s.set(e,i),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();let t=s.get(e);t&&t.forEach(([t,s])=>{e.getValue(t)?.set(s)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{void 0!==e.suspendedScrollY&&window.scrollTo(0,e.suspendedScrollY)})}e3=!1,e2=!1,e4.forEach(e=>e.complete(e6)),e4.clear()}function e7(){e4.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(e3=!0)})}class e9{constructor(e,t,s,i,r,n=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=s,this.motionValue=i,this.element=r,this.isAsync=n}scheduleResolve(){this.state="scheduled",this.isAsync?(e4.add(this),e2||(e2=!0,eZ.read(e7),eZ.resolveKeyframes(e8))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:e,name:t,element:s,motionValue:i}=this;if(null===e[0]){let r=i?.get(),n=e[e.length-1];if(void 0!==r)e[0]=r;else if(s&&t){let i=s.readValue(t,n);null!=i&&(e[0]=i)}void 0===e[0]&&(e[0]=n),i&&void 0===r&&i.set(e[0])}for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),e4.delete(this)}cancel(){"scheduled"===this.state&&(e4.delete(this),this.state="pending")}resume(){"pending"===this.state&&this.scheduleResolve()}}function te(e,t){let s=ef(e);return s!==eh&&(s=el),s.getAnimatableNone?s.getAnimatableNone(t):void 0}let tt=new Set(["auto","none","0"]);class ts extends e9{constructor(e,t,s,i,r){super(e,t,s,i,r,!0)}readKeyframes(){let{unresolvedKeyframes:e,element:t,name:s}=this;if(!t||!t.current)return;super.readKeyframes();for(let s=0;s<e.length;s++){let i=e[s];if("string"==typeof i&&eE(i=i.trim())){let r=function e(t,s,i=1){eT(i<=4,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`,"max-css-var-depth");let[r,n]=function(e){let t=eR.exec(e);if(!t)return[,];let[,s,i,r]=t;return[`--${s??i}`,r]}(t);if(!r)return;let a=window.getComputedStyle(s).getPropertyValue(r);if(a){let e=a.trim();return/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e)?parseFloat(e):e}return eE(n)?e(n,s,i+1):n}(i,t.current);void 0!==r&&(e[s]=r),s===e.length-1&&(this.finalKeyframe=i)}}if(this.resolveNoneKeyframes(),!ew.has(s)||2!==e.length)return;let[i,r]=e,n=eS(i),a=eS(r);if(eL(i)!==eL(r)&&eY[s]){this.needsMeasurement=!0;return}if(n!==a)if(eq(n)&&eq(a))for(let t=0;t<e.length;t++){let s=e[t];"string"==typeof s&&(e[t]=parseFloat(s))}else eY[s]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){let{unresolvedKeyframes:e,name:t}=this,s=[];for(let t=0;t<e.length;t++)(null===e[t]||function(e){if("number"==typeof e)return 0===e;if(null===e)return!0;return"none"===e||"0"===e||/^0[^.\s]+$/u.test(e)}(e[t]))&&s.push(t);s.length&&function(e,t,s){let i,r=0;for(;r<e.length&&!i;){let t=e[r];"string"==typeof t&&!tt.has(t)&&er(t).values.length&&(i=e[r]),r++}if(i&&s)for(let r of t)e[r]=te(s,i)}(e,s,t)}measureInitialState(){let{element:e,unresolvedKeyframes:t,name:s}=this;if(!e||!e.current)return;"height"===s&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=eY[s](e.measureViewportBox(),window.getComputedStyle(e.current)),t[0]=this.measuredOrigin;let i=t[t.length-1];void 0!==i&&e.getValue(s,i).jump(i,!1)}measureEndState(){let{element:e,name:t,unresolvedKeyframes:s}=this;if(!e||!e.current)return;let i=e.getValue(t);i&&i.jump(this.measuredOrigin,!1);let r=s.length-1,n=s[r];s[r]=eY[t](e.measureViewportBox(),window.getComputedStyle(e.current)),null!==n&&void 0===this.finalKeyframe&&(this.finalKeyframe=n),this.removedTransforms?.length&&this.removedTransforms.forEach(([t,s])=>{e.getValue(t).set(s)}),this.resolveNoneKeyframes()}}function ti(e,t){-1===e.indexOf(t)&&e.push(t)}function tr(e,t){let s=e.indexOf(t);s>-1&&e.splice(s,1)}class tn{constructor(){this.subscriptions=[]}add(e){return ti(this.subscriptions,e),()=>tr(this.subscriptions,e)}notify(e,t,s){let i=this.subscriptions.length;if(i)if(1===i)this.subscriptions[0](e,t,s);else for(let r=0;r<i;r++){let i=this.subscriptions[r];i&&i(e,t,s)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}let{schedule:ta}=eJ(queueMicrotask,!1);function to(){t=void 0}let tl={now:()=>(void 0===t&&tl.set(e1.isProcessing||eG.useManualTiming?e1.timestamp:performance.now()),t),set:e=>{t=e,queueMicrotask(to)}};class td{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{let t=tl.now();if(this.updatedAt!==t&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(let e of this.dependents)e.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=tl.now(),null===this.canTrackVelocity&&void 0!==e&&(this.canTrackVelocity=!isNaN(parseFloat(this.current)))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,t){this.events[e]||(this.events[e]=new tn);let s=this.events[e].add(t);return"change"===e?()=>{s(),eZ.read(()=>{this.events.change.getSize()||this.stop()})}:s}clearListeners(){for(let e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,s){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-s}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return o&&o.push(this),this.current}getPrevious(){return this.prev}getVelocity(){var e;let t=tl.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;let s=Math.min(this.updatedAt-this.prevUpdatedAt,30);return e=parseFloat(this.current)-parseFloat(this.prevFrameValue),s?1e3/s*e:0}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),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.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function tc(e,t){return new td(e,t)}let tu=[...ek,Z,el],th={current:null},tm={current:!1},tp="u">typeof window,tx=new WeakMap;function tf(e){return null!==e&&"object"==typeof e&&"function"==typeof e.start}function tg(e){return"string"==typeof e||Array.isArray(e)}let ty=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],tv=["initial",...ty];function tb(e){return tf(e.animate)||tv.some(t=>tg(e[t]))}function tj(e){return!!(tb(e)||e.variants)}function tw(e){let t=[{},{}];return e?.values.forEach((e,s)=>{t[0][s]=e.get(),t[1][s]=e.getVelocity()}),t}function tN(e,t,s,i){if("function"==typeof t){let[r,n]=tw(i);t=t(void 0!==s?s:e.custom,r,n)}if("string"==typeof t&&(t=e.variants&&e.variants[t]),"function"==typeof t){let[r,n]=tw(i);t=t(void 0!==s?s:e.custom,r,n)}return t}let tk=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],tS={};class tC{scrapeMotionValuesFromProps(e,t,s){return{}}constructor({parent:e,props:t,presenceContext:s,reducedMotionConfig:i,blockInitialAnimation:r,visualState:n},a={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=e9,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{let e=tl.now();this.renderScheduledAt<e&&(this.renderScheduledAt=e,eZ.render(this.render,!1,!0))};const{latestValues:o,renderState:l}=n;this.latestValues=o,this.baseTarget={...o},this.initialValues=t.initial?{...o}:{},this.renderState=l,this.parent=e,this.props=t,this.presenceContext=s,this.depth=e?e.depth+1:0,this.reducedMotionConfig=i,this.options=a,this.blockInitialAnimation=!!r,this.isControllingVariants=tb(t),this.isVariantNode=tj(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:d,...c}=this.scrapeMotionValuesFromProps(t,{},this);for(const e in c){const t=c[e];void 0!==o[e]&&ej(t)&&t.set(o[e])}}mount(e){this.current=e,tx.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.forEach((e,t)=>this.bindToMotionValue(t,e)),"never"===this.reducedMotionConfig?this.shouldReduceMotion=!1:"always"===this.reducedMotionConfig?this.shouldReduceMotion=!0:(tm.current||function(){if(tm.current=!0,tp)if(window.matchMedia){let e=window.matchMedia("(prefers-reduced-motion)"),t=()=>th.current=e.matches;e.addEventListener("change",t),t()}else th.current=!1}(),this.shouldReduceMotion=th.current),this.parent?.addChild(this),this.update(this.props,this.presenceContext)}unmount(){for(let e in this.projection&&this.projection.unmount(),e0(this.notifyUpdate),e0(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this),this.events)this.events[e].clear();for(let e in this.features){let t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,t){let s;this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();let i=D.has(e);i&&this.onBindTransform&&this.onBindTransform();let r=t.on("change",t=>{this.latestValues[e]=t,this.props.onUpdate&&eZ.preRender(this.notifyUpdate),i&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});"u">typeof window&&window.MotionCheckAppearSync&&(s=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{r(),s&&s(),t.owner&&t.stop()})}sortNodePosition(e){return this.current&&this.sortInstanceNodePosition&&this.type===e.type?this.sortInstanceNodePosition(this.current,e.current):0}updateFeatures(){let e="animation";for(e in tS){let t=tS[e];if(!t)continue;let{isEnabled:s,Feature:i}=t;if(!this.features[e]&&i&&s(this.props)&&(this.features[e]=new i(this)),this.features[e]){let t=this.features[e];t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):eb()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let t=0;t<tk.length;t++){let s=tk[t];this.propEventSubscriptions[s]&&(this.propEventSubscriptions[s](),delete this.propEventSubscriptions[s]);let i=e["on"+s];i&&(this.propEventSubscriptions[s]=this.on(s,i))}this.prevMotionValues=function(e,t,s){for(let i in t){let r=t[i],n=s[i];if(ej(r))e.addValue(i,r);else if(ej(n))e.addValue(i,tc(r,{owner:e}));else if(n!==r)if(e.hasValue(i)){let t=e.getValue(i);!0===t.liveStyle?t.jump(r):t.hasAnimated||t.set(r)}else{let t=e.getStaticValue(i);e.addValue(i,tc(void 0!==t?t:r,{owner:e}))}}for(let i in s)void 0===t[i]&&e.removeValue(i);return t}(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){let t=this.getClosestVariantNode();if(t)return t.variantChildren&&t.variantChildren.add(e),()=>t.variantChildren.delete(e)}addValue(e,t){let s=this.values.get(e);t!==s&&(s&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);let t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let s=this.values.get(e);return void 0===s&&void 0!==t&&(s=tc(null===t?void 0:t,{owner:this}),this.addValue(e,s)),s}readValue(e,t){let s=void 0===this.latestValues[e]&&this.current?this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options):this.latestValues[e];if(null!=s){let i,r;if("string"==typeof s&&(i=s,/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(i)||(r=s,/^0[^.\s]+$/u.test(r))))s=parseFloat(s);else{let i;i=s,!tu.find(eN(i))&&el.test(t)&&(s=te(e,t))}this.setBaseTarget(e,ej(s)?s.get():s)}return ej(s)?s.get():s}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){let t,{initial:s}=this.props;if("string"==typeof s||"object"==typeof s){let i=tN(this.props,s,this.presenceContext?.custom);i&&(t=i[e])}if(s&&void 0!==t)return t;let i=this.getBaseTargetFromProps(this.props,e);return void 0===i||ej(i)?void 0!==this.initialValues[e]&&void 0===t?void 0:this.baseTarget[e]:i}on(e,t){return this.events[e]||(this.events[e]=new tn),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){ta.render(this.render)}}class tT extends tC{constructor(){super(...arguments),this.KeyframeResolver=ts}sortInstanceNodePosition(e,t){return 2&e.compareDocumentPosition(t)?1:-1}getBaseTargetFromProps(e,t){let s=e.style;return s?s[t]:void 0}removeValueFromRenderState(e,{vars:t,style:s}){delete t[e],delete s[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);let{children:e}=this.props;ej(e)&&(this.childSubscription=e.on("change",e=>{this.current&&(this.current.textContent=`${e}`)}))}}function tA(e){return e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}let tM=(e,t)=>t&&"number"==typeof e?t.transform(e):e,tP={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},tE=E.length;function tD(e,t,s){let{style:i,vars:r,transformOrigin:n}=e,a=!1,o=!1;for(let e in t){let s=t[e];if(D.has(e)){a=!0;continue}if(eM(e)){r[e]=s;continue}{let t=tM(s,ep[e]);e.startsWith("origin")?(o=!0,n[e]=t):i[e]=t}}if(!t.transform&&(a||s?i.transform=function(e,t,s){let i="",r=!0;for(let n=0;n<tE;n++){let a=E[n],o=e[a];if(void 0===o)continue;let l=!0;if("number"==typeof o)l=o===+!!a.startsWith("scale");else{let e=parseFloat(o);l=a.startsWith("scale")?1===e:0===e}if(!l||s){let e=tM(o,ep[a]);if(!l){r=!1;let t=tP[a]||a;i+=`${t}(${e}) `}s&&(t[a]=e)}}return i=i.trim(),s?i=s(t,r?"":i):r&&(i="none"),i}(t,e.transform,s):i.transform&&(i.transform="none")),o){let{originX:e="50%",originY:t="50%",originZ:s=0}=n;i.transformOrigin=`${e} ${t} ${s}`}}let tL={offset:"stroke-dashoffset",array:"stroke-dasharray"},tR={offset:"strokeDashoffset",array:"strokeDasharray"},tV=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function tF(e,{attrX:t,attrY:s,attrScale:i,pathLength:r,pathSpacing:n=1,pathOffset:a=0,...o},l,d,c){if(tD(e,o,d),l){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};let{attrs:u,style:h}=e;for(let e of(u.transform&&(h.transform=u.transform,delete u.transform),(h.transform||u.transformOrigin)&&(h.transformOrigin=u.transformOrigin??"50% 50%",delete u.transformOrigin),h.transform&&(h.transformBox=c?.transformBox??"fill-box",delete u.transformBox),tV))void 0!==u[e]&&(h[e]=u[e],delete u[e]);void 0!==t&&(u.x=t),void 0!==s&&(u.y=s),void 0!==i&&(u.scale=i),void 0!==r&&function(e,t,s=1,i=0,r=!0){e.pathLength=1;let n=r?tL:tR;e[n.offset]=`${-i}`,e[n.array]=`${t} ${s}`}(u,r,n,a,!1)}let t$=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"]),tz=e=>"string"==typeof e&&"svg"===e.toLowerCase();function t_(e,{style:t,vars:s},i,r){let n,a=e.style;for(n in t)a[n]=t[n];for(n in r?.applyProjectionStyles(a,i),s)a.setProperty(n,s[n])}function tI(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}let tO={correct:(e,t)=>{if(!t.target)return e;if("string"==typeof e)if(!Y.test(e))return e;else e=parseFloat(e);let s=tI(e,t.target.x),i=tI(e,t.target.y);return`${s}% ${i}%`}},tB=(e,t,s)=>e+(t-e)*s,tU={borderRadius:{...tO,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:tO,borderTopRightRadius:tO,borderBottomLeftRadius:tO,borderBottomRightRadius:tO,boxShadow:{correct:(e,{treeScale:t,projectionDelta:s})=>{let i=el.parse(e);if(i.length>5)return e;let r=el.createTransformer(e),n=+("number"!=typeof i[0]),a=s.x.scale*t.x,o=s.y.scale*t.y;i[0+n]/=a,i[1+n]/=o;let l=tB(a,o,.5);return"number"==typeof i[2+n]&&(i[2+n]/=l),"number"==typeof i[3+n]&&(i[3+n]/=l),r(i)}}};function tW(e,{layout:t,layoutId:s}){return D.has(e)||e.startsWith("origin")||(t||void 0!==s)&&(!!tU[e]||"opacity"===e)}function tq(e,t,s){let i=e.style,r=t?.style,n={};if(!i)return n;for(let t in i)(ej(i[t])||r&&ej(r[t])||tW(t,e)||s?.getValue(t)?.liveStyle!==void 0)&&(n[t]=i[t]);return n}function tK(e,t,s){let i=tq(e,t,s);for(let s in e)(ej(e[s])||ej(t[s]))&&(i[-1!==E.indexOf(s)?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s]=e[s]);return i}class tH extends tT{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=eb}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(D.has(t)){let e=ef(t);return e&&e.default||0}return t=t$.has(t)?t:tA(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,s){return tK(e,t,s)}build(e,t,s){tF(e,t,this.isSVGTag,s.transformTemplate,s.style)}renderInstance(e,t,s,i){for(let s in t_(e,t,void 0,i),t.attrs)e.setAttribute(t$.has(s)?s:tA(s),t.attrs[s])}mount(e){this.isSVGTag=tz(e.tagName),super.mount(e)}}function tY({top:e,left:t,right:s,bottom:i}){return{x:{min:t,max:s},y:{min:e,max:i}}}function tX(e){return void 0===e||1===e}function tG({scale:e,scaleX:t,scaleY:s}){return!tX(e)||!tX(t)||!tX(s)}function tQ(e){return tG(e)||tJ(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function tJ(e){var t,s;return(t=e.x)&&"0%"!==t||(s=e.y)&&"0%"!==s}function tZ(e,t,s,i,r){return void 0!==r&&(e=i+r*(e-i)),i+s*(e-i)+t}function t0(e,t=0,s=1,i,r){e.min=tZ(e.min,t,s,i,r),e.max=tZ(e.max,t,s,i,r)}function t1(e,{x:t,y:s}){t0(e.x,t.translate,t.scale,t.originPoint),t0(e.y,s.translate,s.scale,s.originPoint)}function t5(e,t){e.min=e.min+t,e.max=e.max+t}function t4(e,t,s,i,r=.5){let n=tB(e.min,e.max,r);t0(e,t,s,n,i)}function t2(e,t){t4(e.x,t.x,t.scaleX,t.scale,t.originX),t4(e.y,t.y,t.scaleY,t.scale,t.originY)}function t3(e,t){return tY(function(e,t){if(!t)return e;let s=t({x:e.left,y:e.top}),i=t({x:e.right,y:e.bottom});return{top:s.y,left:s.x,bottom:i.y,right:i.x}}(e.getBoundingClientRect(),t))}class t6 extends tT{constructor(){super(...arguments),this.type="html",this.renderInstance=t_}readValueFromInstance(e,t){if(D.has(t))return this.projection?.isProjecting?eB(t):((e,t)=>{let{transform:s="none"}=getComputedStyle(e);return eU(s,t)})(e,t);{let s=window.getComputedStyle(e),i=(eM(t)?s.getPropertyValue(t):s[t])||0;return"string"==typeof i?i.trim():i}}measureInstanceViewportBox(e,{transformPagePoint:t}){return t3(e,t)}build(e,t,s){tD(e,t,s.transformTemplate)}scrapeMotionValuesFromProps(e,t,s){return tq(e,t,s)}}let t8=["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 t7(e){if("string"!=typeof e||e.includes("-"));else if(t8.indexOf(e)>-1||/[A-Z]/u.test(e))return!0;return!1}let t9=(0,u.createContext)({strict:!1}),se=(0,u.createContext)({});function st(e){return Array.isArray(e)?e.join(" "):e}let ss=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function si(e,t,s){for(let i in t)ej(t[i])||tW(i,s)||(e[i]=t[i])}let sr=()=>({...ss(),attrs:{}}),sn=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 sa(e){return e.startsWith("while")||e.startsWith("drag")&&"draggable"!==e||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||sn.has(e)}let so=e=>!sa(e);try{d=(()=>{let e=Error("Cannot find module '@emotion/is-prop-valid'");throw e.code="MODULE_NOT_FOUND",e})().default,"function"==typeof d&&(so=e=>e.startsWith("on")?!sa(e):d(e))}catch{}function sl(e){return ej(e)?e.get():e}let sd=e=>(t,s)=>{let i=(0,u.useContext)(se),r=(0,u.useContext)(g),n=()=>(function({scrapeMotionValuesFromProps:e,createRenderState:t},s,i,r){return{latestValues:function(e,t,s,i){let r={},n=i(e,{});for(let e in n)r[e]=sl(n[e]);let{initial:a,animate:o}=e,l=tb(e),d=tj(e);t&&d&&!l&&!1!==e.inherit&&(void 0===a&&(a=t.initial),void 0===o&&(o=t.animate));let c=!!s&&!1===s.initial,u=(c=c||!1===a)?o:a;if(u&&"boolean"!=typeof u&&!tf(u)){let t=Array.isArray(u)?u:[u];for(let s=0;s<t.length;s++){let i=tN(e,t[s]);if(i){let{transitionEnd:e,transition:t,...s}=i;for(let e in s){let t=s[e];if(Array.isArray(t)){let e=c?t.length-1:0;t=t[e]}null!==t&&(r[e]=t)}for(let t in e)r[t]=e[t]}}}return r}(s,i,r,e),renderState:t()}})(e,t,i,r);return s?n():p(n)},sc=sd({scrapeMotionValuesFromProps:tq,createRenderState:ss}),su=sd({scrapeMotionValuesFromProps:tK,createRenderState:sr}),sh={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"]},sm=!1;function sp(){return!function(){if(sm)return;let e={};for(let t in sh)e[t]={isEnabled:e=>sh[t].some(t=>!!e[t])};tS=e,sm=!0}(),tS}let sx=Symbol.for("motionComponentSymbol"),sf="data-"+tA("framerAppearId"),sg=(0,u.createContext)({});function sy(e){return e&&"object"==typeof e&&Object.prototype.hasOwnProperty.call(e,"current")}function sv(e,{forwardMotionProps:t=!1,type:s}={},i,r){i&&function(e){let t=sp();for(let s in e)t[s]={...t[s],...e[s]};tS=t}(i);let n=s?"svg"===s:t7(e),a=n?su:sc;function o(s,i){var o;let l,d,h,p={...(0,u.useContext)(j),...s,layoutId:function({layoutId:e}){let t=(0,u.useContext)(m).id;return t&&void 0!==e?t+"-"+e:e}(s)},{isStatic:y}=p,v=function(e){let{initial:t,animate:s}=function(e,t){if(tb(e)){let{initial:t,animate:s}=e;return{initial:!1===t||tg(t)?t:void 0,animate:tg(s)?s:void 0}}return!1!==e.inherit?t:{}}(e,(0,u.useContext)(se));return(0,u.useMemo)(()=>({initial:t,animate:s}),[st(t),st(s)])}(s),b=a(s,y);if(!y&&x){(0,u.useContext)(t9).strict;let t=function(e){let{drag:t,layout:s}=sp();if(!t&&!s)return{};let i={...t,...s};return{MeasureLayout:t?.isEnabled(e)||s?.isEnabled(e)?i.MeasureLayout:void 0,ProjectionNode:i.ProjectionNode}}(p);l=t.MeasureLayout,v.visualElement=function(e,t,s,i,r,n){let{visualElement:a}=(0,u.useContext)(se),o=(0,u.useContext)(t9),l=(0,u.useContext)(g),d=(0,u.useContext)(j).reducedMotion,c=(0,u.useRef)(null),h=(0,u.useRef)(!1);i=i||o.renderer,!c.current&&i&&(c.current=i(e,{visualState:t,parent:a,props:s,presenceContext:l,blockInitialAnimation:!!l&&!1===l.initial,reducedMotionConfig:d,isSVG:n}),h.current&&c.current&&(c.current.manuallyAnimateOnMount=!0));let m=c.current,p=(0,u.useContext)(sg);m&&!m.projection&&r&&("html"===m.type||"svg"===m.type)&&function(e,t,s,i){let{layoutId:r,layout:n,drag:a,dragConstraints:o,layoutScroll:l,layoutRoot:d,layoutCrossfade:c}=t;e.projection=new s(e.latestValues,t["data-framer-portal-id"]?void 0:function e(t){if(t)return!1!==t.options.allowProjection?t.projection:e(t.parent)}(e.parent)),e.projection.setOptions({layoutId:r,layout:n,alwaysMeasureLayout:!!a||o&&sy(o),visualElement:e,animationType:"string"==typeof n?n:"both",initialPromotionConfig:i,crossfade:c,layoutScroll:l,layoutRoot:d})}(c.current,s,r,p);let x=(0,u.useRef)(!1);(0,u.useInsertionEffect)(()=>{m&&x.current&&m.update(s,l)});let y=s[sf],v=(0,u.useRef)(!!y&&!window.MotionHandoffIsComplete?.(y)&&window.MotionHasOptimisedAnimation?.(y));return f(()=>{h.current=!0,m&&(x.current=!0,window.MotionIsMounted=!0,m.updateFeatures(),m.scheduleRenderMicrotask(),v.current&&m.animationState&&m.animationState.animateChanges())}),(0,u.useEffect)(()=>{m&&(!v.current&&m.animationState&&m.animationState.animateChanges(),v.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(y)}),v.current=!1),m.enteringChildren=void 0)}),m}(e,b,p,r,t.ProjectionNode,n)}return(0,c.jsxs)(se.Provider,{value:v,children:[l&&v.visualElement?(0,c.jsx)(l,{visualElement:v.visualElement,...p}):null,function(e,t,s,{latestValues:i},r,n=!1,a){let o=(a??t7(e)?function(e,t,s,i){let r=(0,u.useMemo)(()=>{let s=sr();return tF(s,t,tz(i),e.transformTemplate,e.style),{...s.attrs,style:{...s.style}}},[t]);if(e.style){let t={};si(t,e.style,e),r.style={...t,...r.style}}return r}:function(e,t){let s,i,r={},n=(s=e.style||{},si(i={},s,e),Object.assign(i,function({transformTemplate:e},t){return(0,u.useMemo)(()=>{let s=ss();return tD(s,t,e),Object.assign({},s.vars,s.style)},[t])}(e,t)),i);return e.drag&&!1!==e.dragListener&&(r.draggable=!1,n.userSelect=n.WebkitUserSelect=n.WebkitTouchCallout="none",n.touchAction=!0===e.drag?"none":`pan-${"x"===e.drag?"y":"x"}`),void 0===e.tabIndex&&(e.onTap||e.onTapStart||e.whileTap)&&(r.tabIndex=0),r.style=n,r})(t,i,r,e),l=function(e,t,s){let i={};for(let r in e)("values"!==r||"object"!=typeof e.values)&&(so(r)||!0===s&&sa(r)||!t&&!sa(r)||e.draggable&&r.startsWith("onDrag"))&&(i[r]=e[r]);return i}(t,"string"==typeof e,n),d=e!==u.Fragment?{...l,...o,ref:s}:{},{children:c}=t,h=(0,u.useMemo)(()=>ej(c)?c.get():c,[c]);return(0,u.createElement)(e,{...d,children:h})}(e,s,(o=v.visualElement,d=(0,u.useRef)(i),(0,u.useInsertionEffect)(()=>{d.current=i}),h=(0,u.useRef)(null),(0,u.useCallback)(e=>{e&&b.onMount?.(e),o&&(e?o.mount(e):o.unmount());let t=d.current;if("function"==typeof t)if(e){let s=t(e);"function"==typeof s&&(h.current=s)}else h.current?(h.current(),h.current=null):t(e);else t&&(t.current=e)},[o])),b,y,t,n)]})}o.displayName=`motion.${"string"==typeof e?e:`create(${e.displayName??e.name??""})`}`;let l=(0,u.forwardRef)(o);return l[sx]=e,l}class sb{constructor(e){this.isMounted=!1,this.node=e}update(){}}function sj(e,t,s){let i=e.getProps();return tN(i,t,void 0!==s?s:i.custom,e)}function sw(e,t){return e?.[t]??e?.default??e}let sN=e=>Array.isArray(e);function sk(e,t){let s=e.getValue("willChange");if(ej(s)&&s.add)return s.add(t);if(!s&&eG.WillChange){let s=new eG.WillChange("auto");e.addValue("willChange",s),s.add(t)}}let sS=e=>1e3*e,sC=(e,t)=>s=>t(e(s)),sT=(...e)=>e.reduce(sC),sA={layout:0,mainThread:0,waapi:0};function sM(e,t,s){return(s<0&&(s+=1),s>1&&(s-=1),s<1/6)?e+(t-e)*6*s:s<.5?t:s<2/3?e+(t-e)*(2/3-s)*6:e}function sP(e,t){return s=>s>0?t:e}let sE=(e,t,s)=>{let i=e*e,r=s*(t*t-i)+i;return r<0?0:Math.sqrt(r)},sD=[W,U,J];function sL(e){let t=sD.find(t=>t.test(e));if(eC(!!t,`'${e}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!t)return!1;let s=t.parse(e);return t===J&&(s=function({hue:e,saturation:t,lightness:s,alpha:i}){e/=360,s/=100;let r=0,n=0,a=0;if(t/=100){let i=s<.5?s*(1+t):s+t-s*t,o=2*s-i;r=sM(o,i,e+1/3),n=sM(o,i,e),a=sM(o,i,e-1/3)}else r=n=a=s;return{red:Math.round(255*r),green:Math.round(255*n),blue:Math.round(255*a),alpha:i}}(s)),s}let sR=(e,t)=>{let s=sL(e),i=sL(t);if(!s||!i)return sP(e,t);let r={...s};return e=>(r.red=sE(s.red,i.red,e),r.green=sE(s.green,i.green,e),r.blue=sE(s.blue,i.blue,e),r.alpha=tB(s.alpha,i.alpha,e),U.transform(r))},sV=new Set(["none","hidden"]);function sF(e,t){return s=>tB(e,t,s)}function s$(e){return"number"==typeof e?sF:"string"==typeof e?eE(e)?sP:Z.test(e)?sR:sI:Array.isArray(e)?sz:"object"==typeof e?Z.test(e)?sR:s_:sP}function sz(e,t){let s=[...e],i=s.length,r=e.map((e,s)=>s$(e)(e,t[s]));return e=>{for(let t=0;t<i;t++)s[t]=r[t](e);return s}}function s_(e,t){let s={...e,...t},i={};for(let r in s)void 0!==e[r]&&void 0!==t[r]&&(i[r]=s$(e[r])(e[r],t[r]));return e=>{for(let t in i)s[t]=i[t](e);return s}}let sI=(e,t)=>{let s=el.createTransformer(t),i=er(e),r=er(t);if(!(i.indexes.var.length===r.indexes.var.length&&i.indexes.color.length===r.indexes.color.length&&i.indexes.number.length>=r.indexes.number.length))return eC(!0,`Complex values '${e}' and '${t}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),sP(e,t);if(sV.has(e)&&!r.values.length||sV.has(t)&&!i.values.length)return sV.has(e)?s=>s<=0?e:t:s=>s>=1?t:e;return sT(sz(function(e,t){let s=[],i={color:0,var:0,number:0};for(let r=0;r<t.values.length;r++){let n=t.types[r],a=e.indexes[n][i[n]],o=e.values[a]??0;s[r]=o,i[n]++}return s}(i,r),r.values),s)};function sO(e,t,s){return"number"==typeof e&&"number"==typeof t&&"number"==typeof s?tB(e,t,s):s$(e)(e,t)}let sB=e=>{let t=({timestamp:t})=>e(t);return{start:(e=!0)=>eZ.update(t,e),stop:()=>e0(t),now:()=>e1.isProcessing?e1.timestamp:tl.now()}},sU=(e,t,s=10)=>{let i="",r=Math.max(Math.round(t/s),2);for(let t=0;t<r;t++)i+=Math.round(1e4*e(t/(r-1)))/1e4+", ";return`linear(${i.substring(0,i.length-2)})`};function sW(e){let t=0,s=e.next(t);for(;!s.done&&t<2e4;)t+=50,s=e.next(t);return t>=2e4?1/0:t}function sq(e,t,s){var i,r;let n=Math.max(t-5,0);return i=s-e(n),(r=t-n)?1e3/r*i:0}let sK=.01,sH=2,sY=.005,sX=.5;function sG(e,t){return e*Math.sqrt(1-t*t)}let sQ=["duration","bounce"],sJ=["stiffness","damping","mass"];function sZ(e,t){return t.some(t=>void 0!==e[t])}function s0(e=.3,t=.3){let s,i="object"!=typeof e?{visualDuration:e,keyframes:[0,1],bounce:t}:e,{restSpeed:r,restDelta:n}=i,a=i.keyframes[0],o=i.keyframes[i.keyframes.length-1],l={done:!1,value:a},{stiffness:d,damping:c,mass:u,duration:h,velocity:m,isResolvedFromDuration:p}=function(e){let t={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...e};if(!sZ(e,sJ)&&sZ(e,sQ))if(e.visualDuration){let s=2*Math.PI/(1.2*e.visualDuration),i=s*s,r=2*L(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:1,stiffness:i,damping:r}}else{let s=function({duration:e=800,bounce:t=.3,velocity:s=0,mass:i=1}){let r,n;eC(e<=sS(10),"Spring duration must be 10 seconds or less","spring-duration-limit");let a=1-t;a=L(.05,1,a),e=L(.01,10,e/1e3),a<1?(r=t=>{let i=t*a,r=i*e;return .001-(i-s)/sG(t,a)*Math.exp(-r)},n=t=>{let i=t*a*e,n=Math.pow(a,2)*Math.pow(t,2)*e,o=Math.exp(-i),l=sG(Math.pow(t,2),a);return(i*s+s-n)*o*(-r(t)+.001>0?-1:1)/l}):(r=t=>-.001+Math.exp(-t*e)*((t-s)*e+1),n=t=>e*e*(s-t)*Math.exp(-t*e));let o=function(e,t,s){let i=s;for(let s=1;s<12;s++)i-=e(i)/t(i);return i}(r,n,5/e);if(e=sS(e),isNaN(o))return{stiffness:100,damping:10,duration:e};{let t=Math.pow(o,2)*i;return{stiffness:t,damping:2*a*Math.sqrt(i*t),duration:e}}}(e);(t={...t,...s,mass:1}).isResolvedFromDuration=!0}return t}({...i,velocity:-((i.velocity||0)/1e3)}),x=m||0,f=c/(2*Math.sqrt(d*u)),g=o-a,y=Math.sqrt(d/u)/1e3,v=5>Math.abs(g);if(r||(r=v?sK:sH),n||(n=v?sY:sX),f<1){let e=sG(y,f);s=t=>o-Math.exp(-f*y*t)*((x+f*y*g)/e*Math.sin(e*t)+g*Math.cos(e*t))}else if(1===f)s=e=>o-Math.exp(-y*e)*(g+(x+y*g)*e);else{let e=y*Math.sqrt(f*f-1);s=t=>{let s=Math.exp(-f*y*t),i=Math.min(e*t,300);return o-s*((x+f*y*g)*Math.sinh(i)+e*g*Math.cosh(i))/e}}let b={calculatedDuration:p&&h||null,next:e=>{let t=s(e);if(p)l.done=e>=h;else{let i=0===e?x:0;f<1&&(i=0===e?sS(x):sq(s,e,t));let a=Math.abs(o-t)<=n;l.done=Math.abs(i)<=r&&a}return l.value=l.done?o:t,l},toString:()=>{let e=Math.min(sW(b),2e4),t=sU(t=>b.next(e*t).value,e,30);return e+"ms "+t},toTransition:()=>{}};return b}function s1({keyframes:e,velocity:t=0,power:s=.8,timeConstant:i=325,bounceDamping:r=10,bounceStiffness:n=500,modifyTarget:a,min:o,max:l,restDelta:d=.5,restSpeed:c}){let u,h,m=e[0],p={done:!1,value:m},x=s*t,f=m+x,g=void 0===a?f:a(f);g!==f&&(x=g-m);let y=e=>-x*Math.exp(-e/i),v=e=>g+y(e),b=e=>{let t=y(e),s=v(e);p.done=Math.abs(t)<=d,p.value=p.done?g:s},j=e=>{let t;if(t=p.value,void 0!==o&&t<o||void 0!==l&&t>l){var s;u=e,h=s0({keyframes:[p.value,(s=p.value,void 0===o?l:void 0===l||Math.abs(o-s)<Math.abs(l-s)?o:l)],velocity:sq(v,e,p.value),damping:r,stiffness:n,restDelta:d,restSpeed:c})}};return j(0),{calculatedDuration:null,next:e=>{let t=!1;return(h||void 0!==u||(t=!0,b(e),j(e)),void 0!==u&&e>=u)?h.next(e-u):(t||b(e),p)}}}s0.applyToOptions=e=>{let t=function(e,t=100,s){let i=s({...e,keyframes:[0,t]}),r=Math.min(sW(i),2e4);return{type:"keyframes",ease:e=>i.next(r*e).value/t,duration:r/1e3}}(e,100,s0);return e.ease=t.ease,e.duration=sS(t.duration),e.type="keyframes",e};let s5=(e,t,s)=>(((1-3*s+3*t)*e+(3*s-6*t))*e+3*t)*e;function s4(e,t,s,i){return e===t&&s===i?eX:r=>0===r||1===r?r:s5(function(e,t,s,i,r){let n,a,o=0;do(n=s5(a=t+(s-t)/2,i,r)-e)>0?s=a:t=a;while(Math.abs(n)>1e-7&&++o<12)return a}(r,0,1,e,s),t,i)}let s2=s4(.42,0,1,1),s3=s4(0,0,.58,1),s6=s4(.42,0,.58,1),s8=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,s7=e=>t=>1-e(1-t),s9=s4(.33,1.53,.69,.99),ie=s7(s9),it=s8(ie),is=e=>(e*=2)<1?.5*ie(e):.5*(2-Math.pow(2,-10*(e-1))),ii=e=>1-Math.sin(Math.acos(e)),ir=s7(ii),ia=s8(ii),io=e=>Array.isArray(e)&&"number"==typeof e[0],il={linear:eX,easeIn:s2,easeInOut:s6,easeOut:s3,circIn:ii,circInOut:ia,circOut:ir,backIn:ie,backInOut:it,backOut:s9,anticipate:is},id=e=>{if(io(e)){eT(4===e.length,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");let[t,s,i,r]=e;return s4(t,s,i,r)}return"string"==typeof e?(eT(void 0!==il[e],`Invalid easing type '${e}'`,"invalid-easing-type"),il[e]):e},ic=(e,t,s)=>{let i=t-e;return 0===i?1:(s-e)/i};function iu({duration:e=300,keyframes:t,times:s,ease:i="easeInOut"}){var r;let n,a=Array.isArray(i)&&"number"!=typeof i[0]?i.map(id):id(i),o={done:!1,value:t[0]},l=function(e,t,{clamp:s=!0,ease:i,mixer:r}={}){let n=e.length;if(eT(n===t.length,"Both input and output ranges must be the same length","range-length"),1===n)return()=>t[0];if(2===n&&t[0]===t[1])return()=>t[1];let a=e[0]===e[1];e[0]>e[n-1]&&(e=[...e].reverse(),t=[...t].reverse());let o=function(e,t,s){let i=[],r=s||eG.mix||sO,n=e.length-1;for(let s=0;s<n;s++){let n=r(e[s],e[s+1]);t&&(n=sT(Array.isArray(t)?t[s]||eX:t,n)),i.push(n)}return i}(t,i,r),l=o.length,d=s=>{if(a&&s<e[0])return t[0];let i=0;if(l>1)for(;i<e.length-2&&!(s<e[i+1]);i++);let r=ic(e[i],e[i+1],s);return o[i](r)};return s?t=>d(L(e[0],e[n-1],t)):d}((r=s&&s.length===t.length?s:(!function(e,t){let s=e[e.length-1];for(let i=1;i<=t;i++){let r=ic(0,t,i);e.push(tB(s,1,r))}}(n=[0],t.length-1),n),r.map(t=>t*e)),t,{ease:Array.isArray(a)?a:t.map(()=>a||s6).splice(0,t.length-1)});return{calculatedDuration:e,next:t=>(o.value=l(t),o.done=t>=e,o)}}let ih=e=>null!==e;function im(e,{repeat:t,repeatType:s="loop"},i,r=1){let n=e.filter(ih),a=r<0||t&&"loop"!==s&&t%2==1?0:n.length-1;return a&&void 0!==i?i:n[a]}let ip={decay:s1,inertia:s1,tween:iu,keyframes:iu,spring:s0};function ix(e){"string"==typeof e.type&&(e.type=ip[e.type])}class ig{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}}let iy=e=>e/100;class iv extends ig{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{let{motionValue:e}=this.options;e&&e.updatedAt!==tl.now()&&this.tick(tl.now()),this.isStopped=!0,"idle"!==this.state&&(this.teardown(),this.options.onStop?.())},sA.mainThread++,this.options=e,this.initAnimation(),this.play(),!1===e.autoplay&&this.pause()}initAnimation(){let{options:e}=this;ix(e);let{type:t=iu,repeat:s=0,repeatDelay:i=0,repeatType:r,velocity:n=0}=e,{keyframes:a}=e,o=t||iu;o!==iu&&"number"!=typeof a[0]&&(this.mixKeyframes=sT(iy,sO(a[0],a[1])),a=[0,100]);let l=o({...e,keyframes:a});"mirror"===r&&(this.mirroredGenerator=o({...e,keyframes:[...a].reverse(),velocity:-n})),null===l.calculatedDuration&&(l.calculatedDuration=sW(l));let{calculatedDuration:d}=l;this.calculatedDuration=d,this.resolvedDuration=d+i,this.totalDuration=this.resolvedDuration*(s+1)-i,this.generator=l}updateTime(e){let t=Math.round(e-this.startTime)*this.playbackSpeed;null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=t}tick(e,t=!1){let{generator:s,totalDuration:i,mixKeyframes:r,mirroredGenerator:n,resolvedDuration:a,calculatedDuration:o}=this;if(null===this.startTime)return s.next(0);let{delay:l=0,keyframes:d,repeat:c,repeatType:u,repeatDelay:h,type:m,onUpdate:p,finalKeyframe:x}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-i/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);let f=this.currentTime-l*(this.playbackSpeed>=0?1:-1),g=this.playbackSpeed>=0?f<0:f>i;this.currentTime=Math.max(f,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=i);let y=this.currentTime,v=s;if(c){let e=Math.min(this.currentTime,i)/a,t=Math.floor(e),s=e%1;!s&&e>=1&&(s=1),1===s&&t--,(t=Math.min(t,c+1))%2&&("reverse"===u?(s=1-s,h&&(s-=h/a)):"mirror"===u&&(v=n)),y=L(0,1,s)*a}let b=g?{done:!1,value:d[0]}:v.next(y);r&&(b.value=r(b.value));let{done:j}=b;g||null===o||(j=this.playbackSpeed>=0?this.currentTime>=i:this.currentTime<=0);let w=null===this.holdTime&&("finished"===this.state||"running"===this.state&&j);return w&&m!==s1&&(b.value=im(d,this.options,x,this.speed)),p&&p(b.value),w&&this.finish(),b}then(e,t){return this.finished.then(e,t)}get duration(){return this.calculatedDuration/1e3}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+e/1e3}get time(){return this.currentTime/1e3}set time(e){e=sS(e),this.currentTime=e,null===this.startTime||null!==this.holdTime||0===this.playbackSpeed?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(e){this.updateTime(tl.now());let t=this.playbackSpeed!==e;this.playbackSpeed=e,t&&(this.time=this.currentTime/1e3)}play(){if(this.isStopped)return;let{driver:e=sB,startTime:t}=this.options;this.driver||(this.driver=e(e=>this.tick(e))),this.options.onPlay?.();let s=this.driver.now();"finished"===this.state?(this.updateFinished(),this.startTime=s):null!==this.holdTime?this.startTime=s-this.holdTime:this.startTime||(this.startTime=t??s),"finished"===this.state&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(tl.now()),this.holdTime=this.currentTime}complete(){"running"!==this.state&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null,sA.mainThread--}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),e.observe(this)}}function ib(e){let t;return()=>(void 0===t&&(t=e()),t)}let ij=ib(()=>void 0!==window.ScrollTimeline),iw={},iN=(s=ib(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(e){return!1}return!0}),()=>iw.linearEasing??s()),ik=([e,t,s,i])=>`cubic-bezier(${e}, ${t}, ${s}, ${i})`,iS={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:ik([0,.65,.55,1]),circOut:ik([.55,0,1,.45]),backIn:ik([.31,.01,.66,-.59]),backOut:ik([.33,1.53,.69,.99])};function iC(e){return"function"==typeof e&&"applyToOptions"in e}class iT extends ig{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;const{element:t,name:s,keyframes:i,pseudoElement:r,allowFlatten:n=!1,finalKeyframe:a,onComplete:o}=e;this.isPseudoElement=!!r,this.allowFlatten=n,this.options=e,eT("string"!=typeof e.type,'Mini animate() doesn\'t support "type" as a string.',"mini-spring");const l=function({type:e,...t}){return iC(e)&&iN()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}(e);this.animation=function(e,t,s,{delay:i=0,duration:r=300,repeat:n=0,repeatType:a="loop",ease:o="easeOut",times:l}={},d){let c={[t]:s};l&&(c.offset=l);let u=function e(t,s){if(t)return"function"==typeof t?iN()?sU(t,s):"ease-out":io(t)?ik(t):Array.isArray(t)?t.map(t=>e(t,s)||iS.easeOut):iS[t]}(o,r);Array.isArray(u)&&(c.easing=u);let h={delay:i,duration:r,easing:Array.isArray(u)?"linear":u,fill:"both",iterations:n+1,direction:"reverse"===a?"alternate":"normal"};d&&(h.pseudoElement=d);let m=e.animate(c,h);return m}(t,s,i,l,r),!1===l.autoplay&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!r){let e=im(i,this.options,a,this.speed);this.updateMotionValue?this.updateMotionValue(e):s.startsWith("--")?t.style.setProperty(s,e):t.style[s]=e,this.animation.cancel()}o?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),"finished"===this.state&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch(e){}}stop(){if(this.isStopped)return;this.isStopped=!0;let{state:e}=this;"idle"!==e&&"finished"!==e&&(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){this.isPseudoElement||this.animation.commitStyles?.()}get duration(){return Number(this.animation.effect?.getComputedTiming?.().duration||0)/1e3}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+e/1e3}get time(){return(Number(this.animation.currentTime)||0)/1e3}set time(e){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=sS(e)}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return null!==this.finishedTime?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,observe:t}){return(this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,e&&ij())?(this.animation.timeline=e,eX):t(this)}}let iA={anticipate:is,backInOut:it,circInOut:ia};class iM extends iT{constructor(e){!function(e){"string"==typeof e.ease&&e.ease in iA&&(e.ease=iA[e.ease])}(e),ix(e),super(e),void 0!==e.startTime&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){let{motionValue:t,onUpdate:s,onComplete:i,element:r,...n}=this.options;if(!t)return;if(void 0!==e)return void t.set(e);let a=new iv({...n,autoplay:!1}),o=Math.max(10,tl.now()-this.startTime),l=L(0,10,o-10);t.setWithVelocity(a.sample(Math.max(0,o-l)).value,a.sample(o).value,l),a.stop()}}let iP=(e,t)=>"zIndex"!==t&&!!("number"==typeof e||Array.isArray(e)||"string"==typeof e&&(el.test(e)||"0"===e)&&!e.startsWith("url("));function iE(e){e.duration=0,e.type="keyframes"}let iD=new Set(["opacity","clipPath","filter","transform"]),iL=ib(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));class iR extends ig{constructor({autoplay:e=!0,delay:t=0,type:s="keyframes",repeat:i=0,repeatDelay:r=0,repeatType:n="loop",keyframes:a,name:o,motionValue:l,element:d,...c}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=tl.now();const u={autoplay:e,delay:t,type:s,repeat:i,repeatDelay:r,repeatType:n,name:o,motionValue:l,element:d,...c},h=d?.KeyframeResolver||e9;this.keyframeResolver=new h(a,(e,t,s)=>this.onKeyframesResolved(e,t,u,!s),o,l,d),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,s,i){this.keyframeResolver=void 0;let{name:r,type:n,velocity:a,delay:o,isHandoff:l,onUpdate:d}=s;this.resolvedAt=tl.now(),!function(e,t,s,i){let r=e[0];if(null===r)return!1;if("display"===t||"visibility"===t)return!0;let n=e[e.length-1],a=iP(r,t),o=iP(n,t);return eC(a===o,`You are trying to animate ${t} from "${r}" to "${n}". "${a?n:r}" is not an animatable value.`,"value-not-animatable"),!!a&&!!o&&(function(e){let t=e[0];if(1===e.length)return!0;for(let s=0;s<e.length;s++)if(e[s]!==t)return!0}(e)||("spring"===s||iC(s))&&i)}(e,r,n,a)&&((eG.instantAnimations||!o)&&d?.(im(e,s,t)),e[0]=e[e.length-1],iE(s),s.repeat=0);let c={startTime:i?this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt:void 0,finalKeyframe:t,...s,keyframes:e},u=!l&&function(e){let{motionValue:t,name:s,repeatDelay:i,repeatType:r,damping:n,type:a}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;let{onUpdate:o,transformTemplate:l}=t.owner.getProps();return iL()&&s&&iD.has(s)&&("transform"!==s||!l)&&!o&&!i&&"mirror"!==r&&0!==n&&"inertia"!==a}(c),h=c.motionValue?.owner?.current,m=u?new iM({...c,element:h}):new iv(c);m.finished.then(()=>{this.notifyFinished()}).catch(eX),this.pendingTimeline&&(this.stopTimeline=m.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=m}get finished(){return this._animation?this.animation.finished:this._finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),e6=!0,e7(),e8(),e6=!1),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}let iV={type:"spring",stiffness:500,damping:25,restSpeed:10},iF={type:"keyframes",duration:.8},i$={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},iz=e=>null!==e,i_=(e,t,s,i={},r,n)=>a=>{let o=sw(i,e)||{},l=o.delay||i.delay||0,{elapsed:d=0}=i;d-=sS(l);let c={keyframes:Array.isArray(s)?s:[null,s],ease:"easeOut",velocity:t.getVelocity(),...o,delay:-d,onUpdate:e=>{t.set(e),o.onUpdate&&o.onUpdate(e)},onComplete:()=>{a(),o.onComplete&&o.onComplete()},name:e,motionValue:t,element:n?void 0:r};!function({when:e,delay:t,delayChildren:s,staggerChildren:i,staggerDirection:r,repeat:n,repeatType:a,repeatDelay:o,from:l,elapsed:d,...c}){return!!Object.keys(c).length}(o)&&Object.assign(c,((e,{keyframes:t})=>t.length>2?iF:D.has(e)?e.startsWith("scale")?{type:"spring",stiffness:550,damping:0===t[1]?2*Math.sqrt(550):30,restSpeed:10}:iV:i$)(e,c)),c.duration&&(c.duration=sS(c.duration)),c.repeatDelay&&(c.repeatDelay=sS(c.repeatDelay)),void 0!==c.from&&(c.keyframes[0]=c.from);let u=!1;if(!1!==c.type&&(0!==c.duration||c.repeatDelay)||(iE(c),0===c.delay&&(u=!0)),(eG.instantAnimations||eG.skipAnimations)&&(u=!0,iE(c),c.delay=0),c.allowFlatten=!o.type&&!o.ease,u&&!n&&void 0!==t.get()){let e=function(e,{repeat:t,repeatType:s="loop"},i){let r=e.filter(iz),n=t&&"loop"!==s&&t%2==1?0:r.length-1;return r[n]}(c.keyframes,o);if(void 0!==e)return void eZ.update(()=>{c.onUpdate(e),c.onComplete()})}return o.isSync?new iv(c):new iR(c)};function iI(e,t,{delay:s=0,transitionOverride:i,type:r}={}){let{transition:n=e.getDefaultTransition(),transitionEnd:a,...o}=t;i&&(n=i);let l=[],d=r&&e.animationState&&e.animationState.getState()[r];for(let t in o){let i=e.getValue(t,e.latestValues[t]??null),r=o[t];if(void 0===r||d&&function({protectedKeys:e,needsAnimating:t},s){let i=e.hasOwnProperty(s)&&!0!==t[s];return t[s]=!1,i}(d,t))continue;let a={delay:s,...sw(n||{},t)},c=i.get();if(void 0!==c&&!i.isAnimating&&!Array.isArray(r)&&r===c&&!a.velocity)continue;let u=!1;if(window.MotionHandoffAnimation){let s=e.props[sf];if(s){let e=window.MotionHandoffAnimation(s,t,eZ);null!==e&&(a.startTime=e,u=!0)}}sk(e,t),i.start(i_(t,i,r,e.shouldReduceMotion&&ew.has(t)?{type:!1}:a,e,u));let h=i.animation;h&&l.push(h)}return a&&Promise.all(l).then(()=>{eZ.update(()=>{a&&function(e,t){let{transitionEnd:s={},transition:i={},...r}=sj(e,t)||{};for(let t in r={...r,...s}){var n;let s=sN(n=r[t])?n[n.length-1]||0:n;e.hasValue(t)?e.getValue(t).set(s):e.addValue(t,tc(s))}}(e,a)})}),l}function iO(e,t,s,i=0,r=1){let n=Array.from(e).sort((e,t)=>e.sortNodePosition(t)).indexOf(t),a=e.size,o=(a-1)*i;return"function"==typeof s?s(n,a):1===r?n*i:o-n*i}function iB(e,t,s={}){let i=sj(e,t,"exit"===s.type?e.presenceContext?.custom:void 0),{transition:r=e.getDefaultTransition()||{}}=i||{};s.transitionOverride&&(r=s.transitionOverride);let n=i?()=>Promise.all(iI(e,i,s)):()=>Promise.resolve(),a=e.variantChildren&&e.variantChildren.size?(i=0)=>{let{delayChildren:n=0,staggerChildren:a,staggerDirection:o}=r;return function(e,t,s=0,i=0,r=0,n=1,a){let o=[];for(let l of e.variantChildren)l.notify("AnimationStart",t),o.push(iB(l,t,{...a,delay:s+("function"==typeof i?0:i)+iO(e.variantChildren,l,i,r,n)}).then(()=>l.notify("AnimationComplete",t)));return Promise.all(o)}(e,t,i,n,a,o,s)}:()=>Promise.resolve(),{when:o}=r;if(!o)return Promise.all([n(),a(s.delay)]);{let[e,t]="beforeChildren"===o?[n,a]:[a,n];return e().then(()=>t())}}let iU=tv.length;function iW(e,t){if(!Array.isArray(t))return!1;let s=t.length;if(s!==e.length)return!1;for(let i=0;i<s;i++)if(t[i]!==e[i])return!1;return!0}let iq=[...ty].reverse(),iK=ty.length;function iH(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function iY(){return{animate:iH(!0),whileInView:iH(),whileHover:iH(),whileTap:iH(),whileDrag:iH(),whileFocus:iH(),exit:iH()}}let iX=0;function iG(e){return[e("x"),e("y")]}let iQ=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function iJ(e){return iQ.has(e.tagName)||!0===e.isContentEditable}function iZ(e,t,s,i={passive:!0}){return e.addEventListener(t,s,i),()=>e.removeEventListener(t,s)}let i0={x:!1,y:!1};function i1(e){return e.max-e.min}function i5(e,t,s,i=.5){e.origin=i,e.originPoint=tB(t.min,t.max,e.origin),e.scale=i1(s)/i1(t),e.translate=tB(s.min,s.max,e.origin)-e.originPoint,(e.scale>=.9999&&e.scale<=1.0001||isNaN(e.scale))&&(e.scale=1),(e.translate>=-.01&&e.translate<=.01||isNaN(e.translate))&&(e.translate=0)}function i4(e,t,s,i){i5(e.x,t.x,s.x,i?i.originX:void 0),i5(e.y,t.y,s.y,i?i.originY:void 0)}function i2(e,t,s){e.min=s.min+t.min,e.max=e.min+i1(t)}function i3(e,t,s){e.min=t.min-s.min,e.max=e.min+i1(t)}function i6(e,t,s){i3(e.x,t.x,s.x),i3(e.y,t.y,s.y)}let i8=e=>"mouse"===e.pointerType?"number"!=typeof e.button||e.button<=0:!1!==e.isPrimary;function i7(e){return{point:{x:e.pageX,y:e.pageY}}}function i9(e,t,s,i){return iZ(e,t,e=>i8(e)&&s(e,i7(e)),i)}let re=({current:e})=>e?e.ownerDocument.defaultView:null,rt=(e,t)=>Math.abs(e-t),rs=new Set(["auto","scroll"]);class ri{constructor(e,t,{transformPagePoint:s,contextWindow:i=window,dragSnapToOrigin:r=!1,distanceThreshold:n=3,element:a}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=e=>{this.handleScroll(e.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{var e,t;if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let s=ra(this.lastMoveEventInfo,this.history),i=null!==this.startEvent,r=(e=s.offset,t={x:0,y:0},Math.sqrt(rt(e.x,t.x)**2+rt(e.y,t.y)**2)>=this.distanceThreshold);if(!i&&!r)return;let{point:n}=s,{timestamp:a}=e1;this.history.push({...n,timestamp:a});let{onStart:o,onMove:l}=this.handlers;i||(o&&o(this.lastMoveEvent,s),this.startEvent=this.lastMoveEvent),l&&l(this.lastMoveEvent,s)},this.handlePointerMove=(e,t)=>{this.lastMoveEvent=e,this.lastMoveEventInfo=rr(t,this.transformPagePoint),eZ.update(this.updatePoint,!0)},this.handlePointerUp=(e,t)=>{this.end();let{onEnd:s,onSessionEnd:i,resumeAnimation:r}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&r&&r(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let n=ra("pointercancel"===e.type?this.lastMoveEventInfo:rr(t,this.transformPagePoint),this.history);this.startEvent&&s&&s(e,n),i&&i(e,n)},!i8(e))return;this.dragSnapToOrigin=r,this.handlers=t,this.transformPagePoint=s,this.distanceThreshold=n,this.contextWindow=i||window;const o=rr(i7(e),this.transformPagePoint),{point:l}=o,{timestamp:d}=e1;this.history=[{...l,timestamp:d}];const{onSessionStart:c}=t;c&&c(e,ra(o,this.history)),this.removeListeners=sT(i9(this.contextWindow,"pointermove",this.handlePointerMove),i9(this.contextWindow,"pointerup",this.handlePointerUp),i9(this.contextWindow,"pointercancel",this.handlePointerUp)),a&&this.startScrollTracking(a)}startScrollTracking(e){let t=e.parentElement;for(;t;){let e=getComputedStyle(t);(rs.has(e.overflowX)||rs.has(e.overflowY))&&this.scrollPositions.set(t,{x:t.scrollLeft,y:t.scrollTop}),t=t.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0,passive:!0}),window.addEventListener("scroll",this.onWindowScroll,{passive:!0}),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(e){let t=this.scrollPositions.get(e);if(!t)return;let s=e===window,i=s?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},r={x:i.x-t.x,y:i.y-t.y};(0!==r.x||0!==r.y)&&(s?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=r.x,this.lastMoveEventInfo.point.y+=r.y):this.history.length>0&&(this.history[0].x-=r.x,this.history[0].y-=r.y),this.scrollPositions.set(e,i),eZ.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),e0(this.updatePoint)}}function rr(e,t){return t?{point:t(e.point)}:e}function rn(e,t){return{x:e.x-t.x,y:e.y-t.y}}function ra({point:e},t){return{point:e,delta:rn(e,ro(t)),offset:rn(e,t[0]),velocity:function(e,t){if(e.length<2)return{x:0,y:0};let s=e.length-1,i=null,r=ro(e);for(;s>=0&&(i=e[s],!(r.timestamp-i.timestamp>sS(.1)));)s--;if(!i)return{x:0,y:0};let n=(r.timestamp-i.timestamp)/1e3;if(0===n)return{x:0,y:0};let a={x:(r.x-i.x)/n,y:(r.y-i.y)/n};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}(t,.1)}}function ro(e){return e[e.length-1]}function rl(e,t,s){return{min:void 0!==t?e.min+t:void 0,max:void 0!==s?e.max+s-(e.max-e.min):void 0}}function rd(e,t){let s=t.min-e.min,i=t.max-e.max;return t.max-t.min<e.max-e.min&&([s,i]=[i,s]),{min:s,max:i}}function rc(e,t,s){return{min:ru(e,t),max:ru(e,s)}}function ru(e,t){return"number"==typeof e?e:e[t]||0}let rh=new WeakMap;class rm{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=eb(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:t=!1,distanceThreshold:s}={}){let{presenceContext:i}=this.visualElement;if(i&&!1===i.isPresent)return;let r=e=>{t?(this.stopAnimation(),this.snapToCursor(i7(e).point)):this.pauseAnimation()},n=(e,t)=>{this.stopAnimation();let{drag:s,dragPropagation:i,onDragStart:r}=this.getProps();if(s&&!i&&(this.openDragLock&&this.openDragLock(),this.openDragLock=function(e){if("x"===e||"y"===e)if(i0[e])return null;else return i0[e]=!0,()=>{i0[e]=!1};return i0.x||i0.y?null:(i0.x=i0.y=!0,()=>{i0.x=i0.y=!1})}(s),!this.openDragLock))return;this.latestPointerEvent=e,this.latestPanInfo=t,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),iG(e=>{let t=this.getAxisMotionValue(e).get()||0;if(H.test(t)){let{projection:s}=this.visualElement;if(s&&s.layout){let i=s.layout.layoutBox[e];i&&(t=i1(i)*(parseFloat(t)/100))}}this.originPoint[e]=t}),r&&eZ.postRender(()=>r(e,t)),sk(this.visualElement,"transform");let{animationState:n}=this.visualElement;n&&n.setActive("whileDrag",!0)},a=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t;let{dragPropagation:s,dragDirectionLock:i,onDirectionLock:r,onDrag:n}=this.getProps();if(!s&&!this.openDragLock)return;let{offset:a}=t;if(i&&null===this.currentDirection){this.currentDirection=function(e,t=10){let s=null;return Math.abs(e.y)>t?s="y":Math.abs(e.x)>t&&(s="x"),s}(a),null!==this.currentDirection&&r&&r(this.currentDirection);return}this.updateAxis("x",t.point,a),this.updateAxis("y",t.point,a),this.visualElement.render(),n&&n(e,t)},o=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t,this.stop(e,t),this.latestPointerEvent=null,this.latestPanInfo=null},l=()=>iG(e=>"paused"===this.getAnimationState(e)&&this.getAxisMotionValue(e).animation?.play()),{dragSnapToOrigin:d}=this.getProps();this.panSession=new ri(e,{onSessionStart:r,onStart:n,onMove:a,onSessionEnd:o,resumeAnimation:l},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:d,distanceThreshold:s,contextWindow:re(this.visualElement),element:this.visualElement.current})}stop(e,t){let s=e||this.latestPointerEvent,i=t||this.latestPanInfo,r=this.isDragging;if(this.cancel(),!r||!i||!s)return;let{velocity:n}=i;this.startAnimation(n);let{onDragEnd:a}=this.getProps();a&&eZ.postRender(()=>a(s,i))}cancel(){this.isDragging=!1;let{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();let{dragPropagation:s}=this.getProps();!s&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t&&t.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,t,s){let{drag:i}=this.getProps();if(!s||!rp(e,i,this.currentDirection))return;let r=this.getAxisMotionValue(e),n=this.originPoint[e]+s[e];this.constraints&&this.constraints[e]&&(n=function(e,{min:t,max:s},i){return void 0!==t&&e<t?e=i?tB(t,e,i.min):Math.max(e,t):void 0!==s&&e>s&&(e=i?tB(s,e,i.max):Math.min(e,s)),e}(n,this.constraints[e],this.elastic[e])),r.set(n)}resolveConstraints(){let{dragConstraints:e,dragElastic:t}=this.getProps(),s=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,i=this.constraints;e&&sy(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&s?this.constraints=function(e,{top:t,left:s,bottom:i,right:r}){return{x:rl(e.x,s,r),y:rl(e.y,t,i)}}(s.layoutBox,e):this.constraints=!1,this.elastic=function(e=.35){return!1===e?e=0:!0===e&&(e=.35),{x:rc(e,"left","right"),y:rc(e,"top","bottom")}}(t),i!==this.constraints&&s&&this.constraints&&!this.hasMutatedConstraints&&iG(e=>{var t,i;let r;!1!==this.constraints&&this.getAxisMotionValue(e)&&(this.constraints[e]=(t=s.layoutBox[e],i=this.constraints[e],r={},void 0!==i.min&&(r.min=i.min-t.min),void 0!==i.max&&(r.max=i.max-t.min),r))})}resolveRefConstraints(){var e;let{dragConstraints:t,onMeasureDragConstraints:s}=this.getProps();if(!t||!sy(t))return!1;let i=t.current;eT(null!==i,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.","drag-constraints-ref");let{projection:r}=this.visualElement;if(!r||!r.layout)return!1;let n=function(e,t,s){let i=t3(e,s),{scroll:r}=t;return r&&(t5(i.x,r.offset.x),t5(i.y,r.offset.y)),i}(i,r.root,this.visualElement.getTransformPagePoint()),a=(e=r.layout.layoutBox,{x:rd(e.x,n.x),y:rd(e.y,n.y)});if(s){let e=s(function({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}(a));this.hasMutatedConstraints=!!e,e&&(a=tY(e))}return a}startAnimation(e){let{drag:t,dragMomentum:s,dragElastic:i,dragTransition:r,dragSnapToOrigin:n,onDragTransitionEnd:a}=this.getProps(),o=this.constraints||{};return Promise.all(iG(a=>{if(!rp(a,t,this.currentDirection))return;let l=o&&o[a]||{};n&&(l={min:0,max:0});let d={type:"inertia",velocity:s?e[a]:0,bounceStiffness:i?200:1e6,bounceDamping:i?40:1e7,timeConstant:750,restDelta:1,restSpeed:10,...r,...l};return this.startAxisValueAnimation(a,d)})).then(a)}startAxisValueAnimation(e,t){let s=this.getAxisMotionValue(e);return sk(this.visualElement,e),s.start(i_(e,s,0,t,this.visualElement,!1))}stopAnimation(){iG(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){iG(e=>this.getAxisMotionValue(e).animation?.pause())}getAnimationState(e){return this.getAxisMotionValue(e).animation?.state}getAxisMotionValue(e){let t=`_drag${e.toUpperCase()}`,s=this.visualElement.getProps();return s[t]||this.visualElement.getValue(e,(s.initial?s.initial[e]:void 0)||0)}snapToCursor(e){iG(t=>{let{drag:s}=this.getProps();if(!rp(t,s,this.currentDirection))return;let{projection:i}=this.visualElement,r=this.getAxisMotionValue(t);if(i&&i.layout){let{min:s,max:n}=i.layout.layoutBox[t],a=r.get()||0;r.set(e[t]-tB(s,n,.5)+a)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;let{drag:e,dragConstraints:t}=this.getProps(),{projection:s}=this.visualElement;if(!sy(t)||!s||!this.constraints)return;this.stopAnimation();let i={x:0,y:0};iG(e=>{let t=this.getAxisMotionValue(e);if(t&&!1!==this.constraints){var s,r;let n,a,o,l=t.get();i[e]=(s={min:l,max:l},r=this.constraints[e],n=.5,a=i1(s),(o=i1(r))>a?n=ic(r.min,r.max-a,s.min):a>o&&(n=ic(s.min,s.max-o,r.min)),L(0,1,n))}});let{transformTemplate:r}=this.visualElement.getProps();this.visualElement.current.style.transform=r?r({},""):"none",s.root&&s.root.updateScroll(),s.updateLayout(),this.resolveConstraints(),iG(t=>{if(!rp(t,e,null))return;let s=this.getAxisMotionValue(t),{min:r,max:n}=this.constraints[t];s.set(tB(r,n,i[t]))})}addListeners(){if(!this.visualElement.current)return;rh.set(this.visualElement,this);let e=this.visualElement.current,t=i9(e,"pointerdown",t=>{let{drag:s,dragListener:i=!0}=this.getProps(),r=t.target,n=r!==e&&iJ(r);s&&i&&!n&&this.start(t)}),s=()=>{let{dragConstraints:e}=this.getProps();sy(e)&&e.current&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,r=i.addEventListener("measure",s);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),eZ.read(s);let n=iZ(window,"resize",()=>this.scalePositionWithinConstraints()),a=i.addEventListener("didUpdate",({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&(iG(t=>{let s=this.getAxisMotionValue(t);s&&(this.originPoint[t]+=e[t].translate,s.set(s.get()+e[t].translate))}),this.visualElement.render())});return()=>{n(),t(),r(),a&&a()}}getProps(){let e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:s=!1,dragPropagation:i=!1,dragConstraints:r=!1,dragElastic:n=.35,dragMomentum:a=!0}=e;return{...e,drag:t,dragDirectionLock:s,dragPropagation:i,dragConstraints:r,dragElastic:n,dragMomentum:a}}}function rp(e,t,s){return(!0===t||t===e)&&(null===s||s===e)}let rx=e=>(t,s)=>{e&&eZ.postRender(()=>e(t,s))},rf={hasAnimatedSinceResize:!0,hasEverUpdated:!1};var rg=u;let ry=!1;class rv extends rg.Component{componentDidMount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:s,layoutId:i}=this.props,{projection:r}=e;r&&(t.group&&t.group.add(r),s&&s.register&&i&&s.register(r),ry&&r.root.didUpdate(),r.addEventListener("animationComplete",()=>{this.safeToRemove()}),r.setOptions({...r.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),rf.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){let{layoutDependency:t,visualElement:s,drag:i,isPresent:r}=this.props,{projection:n}=s;return n&&(n.isPresent=r,e.layoutDependency!==t&&n.setOptions({...n.options,layoutDependency:t}),ry=!0,i||e.layoutDependency!==t||void 0===t||e.isPresent!==r?n.willUpdate():this.safeToRemove(),e.isPresent!==r&&(r?n.promote():n.relegate()||eZ.postRender(()=>{let e=n.getStack();e&&e.members.length||this.safeToRemove()}))),null}componentDidUpdate(){let{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),ta.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:s}=this.props,{projection:i}=e;ry=!0,i&&(i.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(i),s&&s.deregister&&s.deregister(i))}safeToRemove(){let{safeToRemove:e}=this.props;e&&e()}render(){return null}}function rb(e){let[t,s]=T(),i=(0,rg.useContext)(m);return(0,c.jsx)(rv,{...e,layoutGroup:i,switchLayoutGroup:(0,rg.useContext)(sg),isPresent:t,safeToRemove:s})}function rj(e,t,s,i,r){return e-=t,e=i+1/s*(e-i),void 0!==r&&(e=i+1/r*(e-i)),e}function rw(e,t,[s,i,r],n,a){!function(e,t=0,s=1,i=.5,r,n=e,a=e){if(H.test(t)&&(t=parseFloat(t),t=tB(a.min,a.max,t/100)-a.min),"number"!=typeof t)return;let o=tB(n.min,n.max,i);e===n&&(o-=t),e.min=rj(e.min,t,s,o,r),e.max=rj(e.max,t,s,o,r)}(e,t[s],t[i],t[r],t.scale,n,a)}let rN=["x","scaleX","originX"],rk=["y","scaleY","originY"];function rS(e,t,s,i){rw(e.x,t,rN,s?s.x:void 0,i?i.x:void 0),rw(e.y,t,rk,s?s.y:void 0,i?i.y:void 0)}function rC(e,t){e.min=t.min,e.max=t.max}function rT(e,t){rC(e.x,t.x),rC(e.y,t.y)}function rA(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function rM(e){return 0===e.translate&&1===e.scale}function rP(e){return rM(e.x)&&rM(e.y)}function rE(e,t){return e.min===t.min&&e.max===t.max}function rD(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function rL(e,t){return rD(e.x,t.x)&&rD(e.y,t.y)}function rR(e){return i1(e.x)/i1(e.y)}function rV(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}let rF=["TopLeft","TopRight","BottomLeft","BottomRight"],r$=rF.length,rz=e=>"string"==typeof e?parseFloat(e):e,r_=e=>"number"==typeof e||Y.test(e);function rI(e,t){return void 0!==e[t]?e[t]:e.borderRadius}let rO=rU(0,.5,ir),rB=rU(.5,.95,eX);function rU(e,t,s){return i=>i<e?0:i>t?1:s(ic(e,t,i))}function rW(e){return y(e)&&"ownerSVGElement"in e}let rq=(e,t)=>e.depth-t.depth;class rK{constructor(){this.children=[],this.isDirty=!1}add(e){ti(this.children,e),this.isDirty=!0}remove(e){tr(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(rq),this.isDirty=!1,this.children.forEach(e)}}class rH{constructor(){this.members=[]}add(e){ti(this.members,e),e.scheduleRender()}remove(e){if(tr(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){let e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(e){let t,s=this.members.findIndex(t=>e===t);if(0===s)return!1;for(let e=s;e>=0;e--){let s=this.members[e];if(!1!==s.isPresent){t=s;break}}return!!t&&(this.promote(t),!0)}promote(e,t){let s=this.lead;if(e!==s&&(this.prevLead=s,this.lead=e,e.show(),s)){s.instance&&s.scheduleRender(),e.scheduleRender();let i=s.options.layoutDependency,r=e.options.layoutDependency;(void 0===i||void 0===r||i!==r)&&(e.resumeFrom=s,t&&(e.resumeFrom.preserveOpacity=!0),s.snapshot&&(e.snapshot=s.snapshot,e.snapshot.latestValues=s.animationValues||s.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0));let{crossfade:n}=e.options;!1===n&&s.hide()}}exitAnimationComplete(){this.members.forEach(e=>{let{options:t,resumingFrom:s}=e;t.onExitComplete&&t.onExitComplete(),s&&s.options.onExitComplete&&s.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}let rY=["","X","Y","Z"],rX=0;function rG(e,t,s,i){let{latestValues:r}=t;r[e]&&(s[e]=r[e],t.setStaticValue(e,0),i&&(i[e]=0))}function rQ({attachResizeListener:e,defaultParent:t,measureScroll:s,checkIsScrollRoot:i,resetTransform:r}){return class{constructor(e={},s=t?.()){this.id=rX++,this.animationId=0,this.animationCommitId=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.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(r0),this.nodes.forEach(r8),this.nodes.forEach(r7),this.nodes.forEach(r1)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=e,this.root=s?s.root||s:this,this.path=s?[...s.path,s]:[],this.parent=s,this.depth=s?s.depth+1:0;for(let e=0;e<this.path.length;e++)this.path[e].shouldResetTransform=!0;this.root===this&&(this.nodes=new rK)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new tn),this.eventHandlers.get(e).add(t)}notifyListeners(e,...t){let s=this.eventHandlers.get(e);s&&s.notify(...t)}hasListeners(e){return this.eventHandlers.has(e)}mount(t){if(this.instance)return;this.isSVG=rW(t)&&!(rW(t)&&"svg"===t.tagName),this.instance=t;let{layoutId:s,layout:i,visualElement:r}=this.options;if(r&&!r.current&&r.mount(t),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(i||s)&&(this.isLayoutDirty=!0),e){let s,i=0,r=()=>this.root.updateBlockedByResize=!1;eZ.read(()=>{i=window.innerWidth}),e(t,()=>{let e=window.innerWidth;if(e!==i){let t,n;i=e,this.root.updateBlockedByResize=!0,s&&s(),t=tl.now(),n=({timestamp:e})=>{let s=e-t;s>=250&&(e0(n),r(s-250))},eZ.setup(n,!0),s=()=>e0(n),rf.hasAnimatedSinceResize&&(rf.hasAnimatedSinceResize=!1,this.nodes.forEach(r6))}})}s&&this.root.registerSharedNode(s,this),!1!==this.options.animate&&r&&(s||i)&&this.addEventListener("didUpdate",({delta:e,hasLayoutChanged:t,hasRelativeLayoutChanged:s,layout:i})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}let n=this.options.transition||r.getDefaultTransition()||nr,{onLayoutAnimationStart:a,onLayoutAnimationComplete:o}=r.getProps(),l=!this.targetLayout||!rL(this.targetLayout,i),d=!t&&s;if(this.options.layoutRoot||this.resumeFrom||d||t&&(l||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);let t={...sw(n,"layout"),onPlay:a,onComplete:o};(r.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t),this.setAnimationOrigin(e,d)}else t||r6(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=i})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);let e=this.getStack();e&&e.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),e0(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(r9),this.animationId++)}getTransformTemplate(){let{visualElement:e}=this.options;return e&&e.getProps().transformTemplate}willUpdate(e=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&function e(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;let{visualElement:s}=t.options;if(!s)return;let i=s.props[sf];if(window.MotionHasOptimisedAnimation(i,"transform")){let{layout:e,layoutId:s}=t.options;window.MotionCancelOptimisedAnimation(i,"transform",eZ,!(e||s))}let{parent:r}=t;r&&!r.hasCheckedOptimisedAppear&&e(r)}(this),this.root.isUpdating||this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let e=0;e<this.path.length;e++){let t=this.path[e];t.shouldResetTransform=!0,t.updateScroll("snapshot"),t.options.layoutRoot&&t.willUpdate(!1)}let{layoutId:t,layout:s}=this.options;if(void 0===t&&!s)return;let i=this.getTransformTemplate();this.prevTransformTemplateValue=i?i(this.latestValues,""):void 0,this.updateSnapshot(),e&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(r4);return}if(this.animationId<=this.animationCommitId)return void this.nodes.forEach(r2);this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(r3),this.nodes.forEach(rJ),this.nodes.forEach(rZ)):this.nodes.forEach(r2),this.clearAllSnapshots();let e=tl.now();e1.delta=L(0,1e3/60,e-e1.timestamp),e1.timestamp=e,e1.isProcessing=!0,e5.update.process(e1),e5.preRender.process(e1),e5.render.process(e1),e1.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,ta.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(r5),this.sharedNodes.forEach(ne)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,eZ.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){eZ.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){!this.snapshot&&this.instance&&(this.snapshot=this.measure(),!this.snapshot||i1(this.snapshot.measuredBox.x)||i1(this.snapshot.measuredBox.y)||(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let e=0;e<this.path.length;e++)this.path[e].updateScroll();let e=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected=eb(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);let{visualElement:t}=this.options;t&&t.notify("LayoutMeasure",this.layout.layoutBox,e?e.layoutBox:void 0)}updateScroll(e="measure"){let t=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===e&&(t=!1),t&&this.instance){let t=i(this.instance);this.scroll={animationId:this.root.animationId,phase:e,isRoot:t,offset:s(this.instance),wasRoot:this.scroll?this.scroll.isRoot:t}}}resetTransform(){if(!r)return;let e=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,t=this.projectionDelta&&!rP(this.projectionDelta),s=this.getTransformTemplate(),i=s?s(this.latestValues,""):void 0,n=i!==this.prevTransformTemplateValue;e&&this.instance&&(t||tQ(this.latestValues)||n)&&(r(this.instance,i),this.shouldResetTransform=!1,this.scheduleRender())}measure(e=!0){var t;let s=this.measurePageBox(),i=this.removeElementScroll(s);return e&&(i=this.removeTransform(i)),no((t=i).x),no(t.y),{animationId:this.root.animationId,measuredBox:s,layoutBox:i,latestValues:{},source:this.id}}measurePageBox(){let{visualElement:e}=this.options;if(!e)return eb();let t=e.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(nd))){let{scroll:e}=this.root;e&&(t5(t.x,e.offset.x),t5(t.y,e.offset.y))}return t}removeElementScroll(e){let t=eb();if(rT(t,e),this.scroll?.wasRoot)return t;for(let s=0;s<this.path.length;s++){let i=this.path[s],{scroll:r,options:n}=i;i!==this.root&&r&&n.layoutScroll&&(r.wasRoot&&rT(t,e),t5(t.x,r.offset.x),t5(t.y,r.offset.y))}return t}applyTransform(e,t=!1){let s=eb();rT(s,e);for(let e=0;e<this.path.length;e++){let i=this.path[e];!t&&i.options.layoutScroll&&i.scroll&&i!==i.root&&t2(s,{x:-i.scroll.offset.x,y:-i.scroll.offset.y}),tQ(i.latestValues)&&t2(s,i.latestValues)}return tQ(this.latestValues)&&t2(s,this.latestValues),s}removeTransform(e){let t=eb();rT(t,e);for(let e=0;e<this.path.length;e++){let s=this.path[e];if(!s.instance||!tQ(s.latestValues))continue;tG(s.latestValues)&&s.updateSnapshot();let i=eb();rT(i,s.measurePageBox()),rS(t,s.latestValues,s.snapshot?s.snapshot.layoutBox:void 0,i)}return tQ(this.latestValues)&&rS(t,this.latestValues),t}setTargetDelta(e){this.targetDelta=e,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(e){this.options={...this.options,...e,crossfade:void 0===e.crossfade||e.crossfade}}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!==e1.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(e=!1){let t=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=t.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=t.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=t.isSharedProjectionDirty);let s=!!this.resumingFrom||this!==t;if(!(e||s&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;let{layout:i,layoutId:r}=this.options;if(!this.layout||!(i||r))return;this.resolvedRelativeTargetAt=e1.timestamp;let n=this.getClosestProjectingParent();if(n&&this.linkedParentVersion!==n.layoutVersion&&!n.options.layoutRoot&&this.removeRelativeTarget(),this.targetDelta||this.relativeTarget||(n&&n.layout?this.createRelativeTarget(n,this.layout.layoutBox,n.layout.layoutBox):this.removeRelativeTarget()),this.relativeTarget||this.targetDelta){if(this.target||(this.target=eb(),this.targetWithTransforms=eb()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target){var a,o,l;this.forceRelativeParentToResolveTarget(),a=this.target,o=this.relativeTarget,l=this.relativeParent.target,i2(a.x,o.x,l.x),i2(a.y,o.y,l.y)}else this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):rT(this.target,this.layout.layoutBox),t1(this.target,this.targetDelta)):rT(this.target,this.layout.layoutBox);this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,n&&!!n.resumingFrom==!!this.resumingFrom&&!n.options.layoutScroll&&n.target&&1!==this.animationProgress?this.createRelativeTarget(n,this.target,n.target):this.relativeParent=this.relativeTarget=void 0)}}getClosestProjectingParent(){if(!(!this.parent||tG(this.parent.latestValues)||tJ(this.parent.latestValues)))if(this.parent.isProjecting())return this.parent;else return this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(e,t,s){this.relativeParent=e,this.linkedParentVersion=e.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=eb(),this.relativeTargetOrigin=eb(),i6(this.relativeTargetOrigin,t,s),rT(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){let e=this.getLead(),t=!!this.resumingFrom||this!==e,s=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(s=!1),t&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(s=!1),this.resolvedRelativeTargetAt===e1.timestamp&&(s=!1),s)return;let{layout:i,layoutId:r}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(i||r))return;rT(this.layoutCorrected,this.layout.layoutBox);let n=this.treeScale.x,a=this.treeScale.y;!function(e,t,s,i=!1){let r,n,a=s.length;if(a){t.x=t.y=1;for(let o=0;o<a;o++){n=(r=s[o]).projectionDelta;let{visualElement:a}=r.options;(!a||!a.props.style||"contents"!==a.props.style.display)&&(i&&r.options.layoutScroll&&r.scroll&&r!==r.root&&t2(e,{x:-r.scroll.offset.x,y:-r.scroll.offset.y}),n&&(t.x*=n.x.scale,t.y*=n.y.scale,t1(e,n)),i&&tQ(r.latestValues)&&t2(e,r.latestValues))}t.x<1.0000000000001&&t.x>.999999999999&&(t.x=1),t.y<1.0000000000001&&t.y>.999999999999&&(t.y=1)}}(this.layoutCorrected,this.treeScale,this.path,t),e.layout&&!e.target&&(1!==this.treeScale.x||1!==this.treeScale.y)&&(e.target=e.layout.layoutBox,e.targetWithTransforms=eb());let{target:o}=e;if(!o){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}this.projectionDelta&&this.prevProjectionDelta?(rA(this.prevProjectionDelta.x,this.projectionDelta.x),rA(this.prevProjectionDelta.y,this.projectionDelta.y)):this.createProjectionDeltas(),i4(this.projectionDelta,this.layoutCorrected,o,this.latestValues),this.treeScale.x===n&&this.treeScale.y===a&&rV(this.projectionDelta.x,this.prevProjectionDelta.x)&&rV(this.projectionDelta.y,this.prevProjectionDelta.y)||(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",o))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(e=!0){if(this.options.visualElement?.scheduleRender(),e){let e=this.getStack();e&&e.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=ey(),this.projectionDelta=ey(),this.projectionDeltaWithTransform=ey()}setAnimationOrigin(e,t=!1){let s,i=this.snapshot,r=i?i.latestValues:{},n={...this.latestValues},a=ey();this.relativeParent&&this.relativeParent.options.layoutRoot||(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;let o=eb(),l=(i?i.source:void 0)!==(this.layout?this.layout.source:void 0),d=this.getStack(),c=!d||d.members.length<=1,u=!!(l&&!c&&!0===this.options.crossfade&&!this.path.some(ni));this.animationProgress=0,this.mixTargetDelta=t=>{let i=t/1e3;if(nt(a.x,e.x,i),nt(a.y,e.y,i),this.setTargetDelta(a),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout){var d,h,m,p,x,f;i6(o,this.layout.layoutBox,this.relativeParent.layout.layoutBox),m=this.relativeTarget,p=this.relativeTargetOrigin,x=o,f=i,ns(m.x,p.x,x.x,f),ns(m.y,p.y,x.y,f),s&&(d=this.relativeTarget,h=s,rE(d.x,h.x)&&rE(d.y,h.y))&&(this.isProjectionDirty=!1),s||(s=eb()),rT(s,this.relativeTarget)}l&&(this.animationValues=n,function(e,t,s,i,r,n){r?(e.opacity=tB(0,s.opacity??1,rO(i)),e.opacityExit=tB(t.opacity??1,0,rB(i))):n&&(e.opacity=tB(t.opacity??1,s.opacity??1,i));for(let r=0;r<r$;r++){let n=`border${rF[r]}Radius`,a=rI(t,n),o=rI(s,n);(void 0!==a||void 0!==o)&&(a||(a=0),o||(o=0),0===a||0===o||r_(a)===r_(o)?(e[n]=Math.max(tB(rz(a),rz(o),i),0),(H.test(o)||H.test(a))&&(e[n]+="%")):e[n]=o)}(t.rotate||s.rotate)&&(e.rotate=tB(t.rotate||0,s.rotate||0,i))}(n,r,this.latestValues,i,u,c)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=i},this.mixTargetDelta(1e3*!!this.options.layoutRoot)}startAnimation(e){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(e0(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=eZ.update(()=>{var t,s,i;let r;rf.hasAnimatedSinceResize=!0,sA.layout++,this.motionValue||(this.motionValue=tc(0)),this.currentAnimation=(t=this.motionValue,s=[0,1e3],i={...e,velocity:0,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onStop:()=>{sA.layout--},onComplete:()=>{sA.layout--,e.onComplete&&e.onComplete(),this.completeAnimation()}},(r=ej(t)?t:tc(t)).start(i_("",r,s,i)),r.animation),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);let e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(1e3),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){let e=this.getLead(),{targetWithTransforms:t,target:s,layout:i,latestValues:r}=e;if(t&&s&&i){if(this!==e&&this.layout&&i&&nl(this.options.animationType,this.layout.layoutBox,i.layoutBox)){s=this.target||eb();let t=i1(this.layout.layoutBox.x);s.x.min=e.target.x.min,s.x.max=s.x.min+t;let i=i1(this.layout.layoutBox.y);s.y.min=e.target.y.min,s.y.max=s.y.min+i}rT(t,s),t2(t,r),i4(this.projectionDeltaWithTransform,this.layoutCorrected,t,r)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new rH),this.sharedNodes.get(e).add(t);let s=t.options.initialPromotionConfig;t.promote({transition:s?s.transition:void 0,preserveFollowOpacity:s&&s.shouldPreserveFollowOpacity?s.shouldPreserveFollowOpacity(t):void 0})}isLead(){let e=this.getStack();return!e||e.lead===this}getLead(){let{layoutId:e}=this.options;return e&&this.getStack()?.lead||this}getPrevLead(){let{layoutId:e}=this.options;return e?this.getStack()?.prevLead:void 0}getStack(){let{layoutId:e}=this.options;if(e)return this.root.sharedNodes.get(e)}promote({needsReset:e,transition:t,preserveFollowOpacity:s}={}){let i=this.getStack();i&&i.promote(this,s),e&&(this.projectionDelta=void 0,this.needsReset=!0),t&&this.setOptions({transition:t})}relegate(){let e=this.getStack();return!!e&&e.relegate(this)}resetSkewAndRotation(){let{visualElement:e}=this.options;if(!e)return;let t=!1,{latestValues:s}=e;if((s.z||s.rotate||s.rotateX||s.rotateY||s.rotateZ||s.skewX||s.skewY)&&(t=!0),!t)return;let i={};s.z&&rG("z",e,i,this.animationValues);for(let t=0;t<rY.length;t++)rG(`rotate${rY[t]}`,e,i,this.animationValues),rG(`skew${rY[t]}`,e,i,this.animationValues);for(let t in e.render(),i)e.setStaticValue(t,i[t]),this.animationValues&&(this.animationValues[t]=i[t]);e.scheduleRender()}applyProjectionStyles(e,t){if(!this.instance||this.isSVG)return;if(!this.isVisible){e.visibility="hidden";return}let s=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,e.visibility="",e.opacity="",e.pointerEvents=sl(t?.pointerEvents)||"",e.transform=s?s(this.latestValues,""):"none";return}let i=this.getLead();if(!this.projectionDelta||!this.layout||!i.target){this.options.layoutId&&(e.opacity=void 0!==this.latestValues.opacity?this.latestValues.opacity:1,e.pointerEvents=sl(t?.pointerEvents)||""),this.hasProjected&&!tQ(this.latestValues)&&(e.transform=s?s({},""):"none",this.hasProjected=!1);return}e.visibility="";let r=i.animationValues||i.latestValues;this.applyTransformsToTarget();let n=function(e,t,s){let i="",r=e.x.translate/t.x,n=e.y.translate/t.y,a=s?.z||0;if((r||n||a)&&(i=`translate3d(${r}px, ${n}px, ${a}px) `),(1!==t.x||1!==t.y)&&(i+=`scale(${1/t.x}, ${1/t.y}) `),s){let{transformPerspective:e,rotate:t,rotateX:r,rotateY:n,skewX:a,skewY:o}=s;e&&(i=`perspective(${e}px) ${i}`),t&&(i+=`rotate(${t}deg) `),r&&(i+=`rotateX(${r}deg) `),n&&(i+=`rotateY(${n}deg) `),a&&(i+=`skewX(${a}deg) `),o&&(i+=`skewY(${o}deg) `)}let o=e.x.scale*t.x,l=e.y.scale*t.y;return(1!==o||1!==l)&&(i+=`scale(${o}, ${l})`),i||"none"}(this.projectionDeltaWithTransform,this.treeScale,r);s&&(n=s(r,n)),e.transform=n;let{x:a,y:o}=this.projectionDelta;for(let t in e.transformOrigin=`${100*a.origin}% ${100*o.origin}% 0`,i.animationValues?e.opacity=i===this?r.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:r.opacityExit:e.opacity=i===this?void 0!==r.opacity?r.opacity:"":void 0!==r.opacityExit?r.opacityExit:0,tU){if(void 0===r[t])continue;let{correct:s,applyTo:a,isCSSVariable:o}=tU[t],l="none"===n?r[t]:s(r[t],i);if(a){let t=a.length;for(let s=0;s<t;s++)e[a[s]]=l}else o?this.options.visualElement.renderState.vars[t]=l:e[t]=l}this.options.layoutId&&(e.pointerEvents=i===this?sl(t?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(e=>e.currentAnimation?.stop()),this.root.nodes.forEach(r4),this.root.sharedNodes.clear()}}}function rJ(e){e.updateLayout()}function rZ(e){let t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){let{layoutBox:s,measuredBox:i}=e.layout,{animationType:r}=e.options,n=t.source!==e.layout.source;"size"===r?iG(e=>{let i=n?t.measuredBox[e]:t.layoutBox[e],r=i1(i);i.min=s[e].min,i.max=i.min+r}):nl(r,t.layoutBox,s)&&iG(i=>{let r=n?t.measuredBox[i]:t.layoutBox[i],a=i1(s[i]);r.max=r.min+a,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[i].max=e.relativeTarget[i].min+a)});let a=ey();i4(a,s,t.layoutBox);let o=ey();n?i4(o,e.applyTransform(i,!0),t.measuredBox):i4(o,s,t.layoutBox);let l=!rP(a),d=!1;if(!e.resumeFrom){let i=e.getClosestProjectingParent();if(i&&!i.resumeFrom){let{snapshot:r,layout:n}=i;if(r&&n){let a=eb();i6(a,t.layoutBox,r.layoutBox);let o=eb();i6(o,s,n.layoutBox),rL(a,o)||(d=!0),i.options.layoutRoot&&(e.relativeTarget=o,e.relativeTargetOrigin=a,e.relativeParent=i)}}}e.notifyListeners("didUpdate",{layout:s,snapshot:t,delta:o,layoutDelta:a,hasLayoutChanged:l,hasRelativeLayoutChanged:d})}else if(e.isLead()){let{onExitComplete:t}=e.options;t&&t()}e.options.transition=void 0}function r0(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function r1(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function r5(e){e.clearSnapshot()}function r4(e){e.clearMeasurements()}function r2(e){e.isLayoutDirty=!1}function r3(e){let{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function r6(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function r8(e){e.resolveTargetDelta()}function r7(e){e.calcProjection()}function r9(e){e.resetSkewAndRotation()}function ne(e){e.removeLeadSnapshot()}function nt(e,t,s){e.translate=tB(t.translate,0,s),e.scale=tB(t.scale,1,s),e.origin=t.origin,e.originPoint=t.originPoint}function ns(e,t,s,i){e.min=tB(t.min,s.min,i),e.max=tB(t.max,s.max,i)}function ni(e){return e.animationValues&&void 0!==e.animationValues.opacityExit}let nr={duration:.45,ease:[.4,0,.1,1]},nn=e=>"u">typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),na=nn("applewebkit/")&&!nn("chrome/")?Math.round:eX;function no(e){e.min=na(e.min),e.max=na(e.max)}function nl(e,t,s){return"position"===e||"preserve-aspect"===e&&!(.2>=Math.abs(rR(t)-rR(s)))}function nd(e){return e!==e.root&&e.scroll?.wasRoot}let nc=rQ({attachResizeListener:(e,t)=>iZ(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),nu={current:void 0},nh=rQ({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!nu.current){let e=new nc({});e.mount(window),e.setOptions({layoutScroll:!0}),nu.current=e}return nu.current},resetTransform:(e,t)=>{e.style.transform=void 0!==t?t:"none"},checkIsScrollRoot:e=>"fixed"===window.getComputedStyle(e).position});function nm(e,t){let s=function(e,t,s){if(null==e)return[];if(e instanceof EventTarget)return[e];if("string"==typeof e){let t=document,s=(void 0)??t.querySelectorAll(e);return s?Array.from(s):[]}return Array.from(e).filter(e=>null!=e)}(e),i=new AbortController;return[s,{passive:!0,...t,signal:i.signal},()=>i.abort()]}function np(e){return!("touch"===e.pointerType||i0.x||i0.y)}function nx(e,t,s){let{props:i}=e;e.animationState&&i.whileHover&&e.animationState.setActive("whileHover","Start"===s);let r=i["onHover"+s];r&&eZ.postRender(()=>r(t,i7(t)))}let nf=(e,t)=>!!t&&(e===t||nf(e,t.parentElement)),ng=new WeakSet;function ny(e){return t=>{"Enter"===t.key&&e(t)}}function nv(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}function nb(e){return i8(e)&&!(i0.x||i0.y)}function nj(e,t,s){let{props:i}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&i.whileTap&&e.animationState.setActive("whileTap","Start"===s);let r=i["onTap"+("End"===s?"":s)];r&&eZ.postRender(()=>r(t,i7(t)))}let nw=new WeakMap,nN=new WeakMap,nk=e=>{let t=nw.get(e.target);t&&t(e)},nS=e=>{e.forEach(nk)},nC={some:0,all:1},nT=function(e,t){if("u"<typeof Proxy)return sv;let s=new Map,i=(s,i)=>sv(s,i,e,t);return new Proxy((e,t)=>i(e,t),{get:(r,n)=>"create"===n?i:(s.has(n)||s.set(n,sv(n,void 0,e,t)),s.get(n))})}({animation:{Feature:class extends sb{constructor(e){super(e),e.animationState||(e.animationState=function(e){let t=t=>Promise.all(t.map(({animation:t,options:s})=>(function(e,t,s={}){let i;if(e.notify("AnimationStart",t),Array.isArray(t))i=Promise.all(t.map(t=>iB(e,t,s)));else if("string"==typeof t)i=iB(e,t,s);else{let r="function"==typeof t?sj(e,t,s.custom):t;i=Promise.all(iI(e,r,s))}return i.then(()=>{e.notify("AnimationComplete",t)})})(e,t,s))),s=iY(),i=!0,r=t=>(s,i)=>{let r=sj(e,i,"exit"===t?e.presenceContext?.custom:void 0);if(r){let{transition:e,transitionEnd:t,...i}=r;s={...s,...i,...t}}return s};function n(n){let{props:a}=e,o=function e(t){if(!t)return;if(!t.isControllingVariants){let s=t.parent&&e(t.parent)||{};return void 0!==t.props.initial&&(s.initial=t.props.initial),s}let s={};for(let e=0;e<iU;e++){let i=tv[e],r=t.props[i];(tg(r)||!1===r)&&(s[i]=r)}return s}(e.parent)||{},l=[],d=new Set,c={},u=1/0;for(let t=0;t<iK;t++){var h,m;let p=iq[t],x=s[p],f=void 0!==a[p]?a[p]:o[p],g=tg(f),y=p===n?x.isActive:null;!1===y&&(u=t);let v=f===o[p]&&f!==a[p]&&g;if(v&&i&&e.manuallyAnimateOnMount&&(v=!1),x.protectedKeys={...c},!x.isActive&&null===y||!f&&!x.prevProp||tf(f)||"boolean"==typeof f)continue;let b=(h=x.prevProp,"string"==typeof(m=f)?m!==h:!!Array.isArray(m)&&!iW(m,h)),j=b||p===n&&x.isActive&&!v&&g||t>u&&g,w=!1,N=Array.isArray(f)?f:[f],k=N.reduce(r(p),{});!1===y&&(k={});let{prevResolvedValues:S={}}=x,C={...S,...k},T=t=>{j=!0,d.has(t)&&(w=!0,d.delete(t)),x.needsAnimating[t]=!0;let s=e.getValue(t);s&&(s.liveStyle=!1)};for(let e in C){let t=k[e],s=S[e];if(!c.hasOwnProperty(e))(sN(t)&&sN(s)?iW(t,s):t===s)?void 0!==t&&d.has(e)?T(e):x.protectedKeys[e]=!0:null!=t?T(e):d.add(e)}x.prevProp=f,x.prevResolvedValues=k,x.isActive&&(c={...c,...k}),i&&e.blockInitialAnimation&&(j=!1);let A=v&&b,M=!A||w;j&&M&&l.push(...N.map(t=>{let s={type:p};if("string"==typeof t&&i&&!A&&e.manuallyAnimateOnMount&&e.parent){let{parent:i}=e,r=sj(i,t);if(i.enteringChildren&&r){let{delayChildren:t}=r.transition||{};s.delay=iO(i.enteringChildren,e,t)}}return{animation:t,options:s}}))}if(d.size){let t={};if("boolean"!=typeof a.initial){let s=sj(e,Array.isArray(a.initial)?a.initial[0]:a.initial);s&&s.transition&&(t.transition=s.transition)}d.forEach(s=>{let i=e.getBaseTarget(s),r=e.getValue(s);r&&(r.liveStyle=!0),t[s]=i??null}),l.push({animation:t})}let p=!!l.length;return i&&(!1===a.initial||a.initial===a.animate)&&!e.manuallyAnimateOnMount&&(p=!1),i=!1,p?t(l):Promise.resolve()}return{animateChanges:n,setActive:function(t,i){if(s[t].isActive===i)return Promise.resolve();e.variantChildren?.forEach(e=>e.animationState?.setActive(t,i)),s[t].isActive=i;let r=n(t);for(let e in s)s[e].protectedKeys={};return r},setAnimateFunction:function(s){t=s(e)},getState:()=>s,reset:()=>{s=iY()}}}(e))}updateAnimationControlsSubscription(){let{animate:e}=this.node.getProps();tf(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){let{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}},exit:{Feature:class extends sb{constructor(){super(...arguments),this.id=iX++}update(){if(!this.node.presenceContext)return;let{isPresent:e,onExitComplete:t}=this.node.presenceContext,{isPresent:s}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===s)return;let i=this.node.animationState.setActive("exit",!e);t&&!e&&i.then(()=>{t(this.id)})}mount(){let{register:e,onExitComplete:t}=this.node.presenceContext||{};t&&t(this.id),e&&(this.unmount=e(this.id))}unmount(){}}},inView:{Feature:class extends sb{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){var e;let t;this.unmount();let{viewport:s={}}=this.node.getProps(),{root:i,margin:r,amount:n="some",once:a}=s,o={root:i?i.current:void 0,rootMargin:r,threshold:"number"==typeof n?n:nC[n]},l=e=>{let{isIntersecting:t}=e;if(this.isInView===t||(this.isInView=t,a&&!t&&this.hasEnteredView))return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",t);let{onViewportEnter:s,onViewportLeave:i}=this.node.getProps(),r=t?s:i;r&&r(e)};return e=this.node.current,t=function({root:e,...t}){let s=e||document;nN.has(s)||nN.set(s,{});let i=nN.get(s),r=JSON.stringify(t);return i[r]||(i[r]=new IntersectionObserver(nS,{root:e,...t})),i[r]}(o),nw.set(e,l),t.observe(e),()=>{nw.delete(e),t.unobserve(e)}}mount(){this.startObserver()}update(){if("u"<typeof IntersectionObserver)return;let{props:e,prevProps:t}=this.node;["amount","margin","root"].some(function({viewport:e={}},{viewport:t={}}={}){return s=>e[s]!==t[s]}(e,t))&&this.startObserver()}unmount(){}}},tap:{Feature:class extends sb{mount(){let{current:e}=this.node;e&&(this.unmount=function(e,t,s={}){let[i,r,n]=nm(e,s),a=e=>{let i=e.currentTarget;if(!nb(e))return;ng.add(i);let n=t(i,e),a=(e,t)=>{window.removeEventListener("pointerup",o),window.removeEventListener("pointercancel",l),ng.has(i)&&ng.delete(i),nb(e)&&"function"==typeof n&&n(e,{success:t})},o=e=>{a(e,i===window||i===document||s.useGlobalTarget||nf(i,e.target))},l=e=>{a(e,!1)};window.addEventListener("pointerup",o,r),window.addEventListener("pointercancel",l,r)};return i.forEach(e=>{(s.useGlobalTarget?window:e).addEventListener("pointerdown",a,r),v(e)&&(e.addEventListener("focus",e=>((e,t)=>{let s=e.currentTarget;if(!s)return;let i=ny(()=>{if(ng.has(s))return;nv(s,"down");let e=ny(()=>{nv(s,"up")});s.addEventListener("keyup",e,t),s.addEventListener("blur",()=>nv(s,"cancel"),t)});s.addEventListener("keydown",i,t),s.addEventListener("blur",()=>s.removeEventListener("keydown",i),t)})(e,r)),iJ(e)||e.hasAttribute("tabindex")||(e.tabIndex=0))}),n}(e,(e,t)=>(nj(this.node,t,"Start"),(e,{success:t})=>nj(this.node,e,t?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}},focus:{Feature:class extends sb{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch(t){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=sT(iZ(this.node.current,"focus",()=>this.onFocus()),iZ(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}},hover:{Feature:class extends sb{mount(){let{current:e}=this.node;e&&(this.unmount=function(e,t,s={}){let[i,r,n]=nm(e,s),a=e=>{if(!np(e))return;let{target:s}=e,i=t(s,e);if("function"!=typeof i||!s)return;let n=e=>{np(e)&&(i(e),s.removeEventListener("pointerleave",n))};s.addEventListener("pointerleave",n,r)};return i.forEach(e=>{e.addEventListener("pointerenter",a,r)}),n}(e,(e,t)=>(nx(this.node,t,"Start"),e=>nx(this.node,e,"End"))))}unmount(){}}},pan:{Feature:class extends sb{constructor(){super(...arguments),this.removePointerDownListener=eX}onPointerDown(e){this.session=new ri(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:re(this.node)})}createPanHandlers(){let{onPanSessionStart:e,onPanStart:t,onPan:s,onPanEnd:i}=this.node.getProps();return{onSessionStart:rx(e),onStart:rx(t),onMove:s,onEnd:(e,t)=>{delete this.session,i&&eZ.postRender(()=>i(e,t))}}}mount(){this.removePointerDownListener=i9(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}},drag:{Feature:class extends sb{constructor(e){super(e),this.removeGroupControls=eX,this.removeListeners=eX,this.controls=new rm(e)}mount(){let{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||eX}update(){let{dragControls:e}=this.node.getProps(),{dragControls:t}=this.node.prevProps||{};e!==t&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}},ProjectionNode:nh,MeasureLayout:rb},layout:{ProjectionNode:nh,MeasureLayout:rb}},(e,t)=>t.isSVG??t7(e)?new tH(t):new t6(t,{allowProjection:e!==u.Fragment}));var nA=e.i(74133),nM=e.i(88069),nP=e.i(42098);function nE(e,t=300){let[s,i]=(0,u.useState)(e);return(0,u.useEffect)(()=>{let s=setTimeout(()=>{i(e)},t);return()=>{clearTimeout(s)}},[e,t]),s}var nD=e.i(45688);let nL=h.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";async function nR(e){if(!e||e.length<2)return[];let t=await fetch(`${nL}/api/suggestions?q=${encodeURIComponent(e)}&limit=8`);if(!t.ok)throw Error("Failed to fetch suggestions");return(await t.json()).suggestions}function nV(){for(var e,t,s=0,i="",r=arguments.length;s<r;s++)(e=arguments[s])&&(t=function e(t){var s,i,r="";if("string"==typeof t||"number"==typeof t)r+=t;else if("object"==typeof t)if(Array.isArray(t)){var n=t.length;for(s=0;s<n;s++)t[s]&&(i=e(t[s]))&&(r&&(r+=" "),r+=i)}else for(i in t)t[i]&&(r&&(r+=" "),r+=i);return r}(e))&&(i&&(i+=" "),i+=t);return i}let nF=(e=new Map,t=null,s)=>({nextPart:e,validators:t,classGroupId:s}),n$=[],nz=(e,t,s)=>{if(0==e.length-t)return s.classGroupId;let i=e[t],r=s.nextPart.get(i);if(r){let s=nz(e,t+1,r);if(s)return s}let n=s.validators;if(null===n)return;let a=0===t?e.join("-"):e.slice(t).join("-"),o=n.length;for(let e=0;e<o;e++){let t=n[e];if(t.validator(a))return t.classGroupId}},n_=(e,t)=>{let s=nF();for(let i in e)nI(e[i],s,i,t);return s},nI=(e,t,s,i)=>{let r=e.length;for(let n=0;n<r;n++)nO(e[n],t,s,i)},nO=(e,t,s,i)=>{"string"==typeof e?nB(e,t,s):"function"==typeof e?nU(e,t,s,i):nW(e,t,s,i)},nB=(e,t,s)=>{(""===e?t:nq(t,e)).classGroupId=s},nU=(e,t,s,i)=>{nK(e)?nI(e(i),t,s,i):(null===t.validators&&(t.validators=[]),t.validators.push({classGroupId:s,validator:e}))},nW=(e,t,s,i)=>{let r=Object.entries(e),n=r.length;for(let e=0;e<n;e++){let[n,a]=r[e];nI(a,nq(t,n),s,i)}},nq=(e,t)=>{let s=e,i=t.split("-"),r=i.length;for(let e=0;e<r;e++){let t=i[e],r=s.nextPart.get(t);r||(r=nF(),s.nextPart.set(t,r)),s=r}return s},nK=e=>"isThemeGetter"in e&&!0===e.isThemeGetter,nH=[],nY=(e,t,s,i,r)=>({modifiers:e,hasImportantModifier:t,baseClassName:s,maybePostfixModifierPosition:i,isExternal:r}),nX=/\s+/,nG=e=>{let t;if("string"==typeof e)return e;let s="";for(let i=0;i<e.length;i++)e[i]&&(t=nG(e[i]))&&(s&&(s+=" "),s+=t);return s},nQ=[],nJ=e=>{let t=t=>t[e]||nQ;return t.isThemeGetter=!0,t},nZ=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,n0=/^\((?:(\w[\w-]*):)?(.+)\)$/i,n1=/^\d+\/\d+$/,n5=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,n4=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,n2=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,n3=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,n6=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,n8=e=>n1.test(e),n7=e=>!!e&&!Number.isNaN(Number(e)),n9=e=>!!e&&Number.isInteger(Number(e)),ae=e=>e.endsWith("%")&&n7(e.slice(0,-1)),at=e=>n5.test(e),as=()=>!0,ai=e=>n4.test(e)&&!n2.test(e),ar=()=>!1,an=e=>n3.test(e),aa=e=>n6.test(e),ao=e=>!ad(e)&&!ax(e),al=e=>aw(e,aC,ar),ad=e=>nZ.test(e),ac=e=>aw(e,aT,ai),au=e=>aw(e,aA,n7),ah=e=>aw(e,ak,ar),am=e=>aw(e,aS,aa),ap=e=>aw(e,aP,an),ax=e=>n0.test(e),af=e=>aN(e,aT),ag=e=>aN(e,aM),ay=e=>aN(e,ak),av=e=>aN(e,aC),ab=e=>aN(e,aS),aj=e=>aN(e,aP,!0),aw=(e,t,s)=>{let i=nZ.exec(e);return!!i&&(i[1]?t(i[1]):s(i[2]))},aN=(e,t,s=!1)=>{let i=n0.exec(e);return!!i&&(i[1]?t(i[1]):s)},ak=e=>"position"===e||"percentage"===e,aS=e=>"image"===e||"url"===e,aC=e=>"length"===e||"size"===e||"bg-size"===e,aT=e=>"length"===e,aA=e=>"number"===e,aM=e=>"family-name"===e,aP=e=>"shadow"===e,aE=((e,...t)=>{let s,i,r,n,a=e=>{let t=i(e);if(t)return t;let n=((e,t)=>{let{parseClassName:s,getClassGroupId:i,getConflictingClassGroupIds:r,sortModifiers:n}=t,a=[],o=e.trim().split(nX),l="";for(let e=o.length-1;e>=0;e-=1){let t=o[e],{isExternal:d,modifiers:c,hasImportantModifier:u,baseClassName:h,maybePostfixModifierPosition:m}=s(t);if(d){l=t+(l.length>0?" "+l:l);continue}let p=!!m,x=i(p?h.substring(0,m):h);if(!x){if(!p||!(x=i(h))){l=t+(l.length>0?" "+l:l);continue}p=!1}let f=0===c.length?"":1===c.length?c[0]:n(c).join(":"),g=u?f+"!":f,y=g+x;if(a.indexOf(y)>-1)continue;a.push(y);let v=r(x,p);for(let e=0;e<v.length;++e){let t=v[e];a.push(g+t)}l=t+(l.length>0?" "+l:l)}return l})(e,s);return r(e,n),n};return n=o=>{var l;let d;return i=(s={cache:(e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,s=Object.create(null),i=Object.create(null),r=(r,n)=>{s[r]=n,++t>e&&(t=0,i=s,s=Object.create(null))};return{get(e){let t=s[e];return void 0!==t?t:void 0!==(t=i[e])?(r(e,t),t):void 0},set(e,t){e in s?s[e]=t:r(e,t)}}})((l=t.reduce((e,t)=>t(e),e())).cacheSize),parseClassName:(e=>{let{prefix:t,experimentalParseClassName:s}=e,i=e=>{let t,s=[],i=0,r=0,n=0,a=e.length;for(let o=0;o<a;o++){let a=e[o];if(0===i&&0===r){if(":"===a){s.push(e.slice(n,o)),n=o+1;continue}if("/"===a){t=o;continue}}"["===a?i++:"]"===a?i--:"("===a?r++:")"===a&&r--}let o=0===s.length?e:e.slice(n),l=o,d=!1;return o.endsWith("!")?(l=o.slice(0,-1),d=!0):o.startsWith("!")&&(l=o.slice(1),d=!0),nY(s,d,l,t&&t>n?t-n:void 0)};if(t){let e=t+":",s=i;i=t=>t.startsWith(e)?s(t.slice(e.length)):nY(nH,!1,t,void 0,!0)}if(s){let e=i;i=t=>s({className:t,parseClassName:e})}return i})(l),sortModifiers:(d=new Map,l.orderSensitiveModifiers.forEach((e,t)=>{d.set(e,1e6+t)}),e=>{let t=[],s=[];for(let i=0;i<e.length;i++){let r=e[i],n="["===r[0],a=d.has(r);n||a?(s.length>0&&(s.sort(),t.push(...s),s=[]),t.push(r)):s.push(r)}return s.length>0&&(s.sort(),t.push(...s)),t}),...(e=>{let t=(e=>{let{theme:t,classGroups:s}=e;return n_(s,t)})(e),{conflictingClassGroups:s,conflictingClassGroupModifiers:i}=e;return{getClassGroupId:e=>{if(e.startsWith("[")&&e.endsWith("]")){var s;let t,i,r;return -1===(s=e).slice(1,-1).indexOf(":")?void 0:(i=(t=s.slice(1,-1)).indexOf(":"),(r=t.slice(0,i))?"arbitrary.."+r:void 0)}let i=e.split("-"),r=+(""===i[0]&&i.length>1);return nz(i,r,t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=i[e],r=s[e];if(t){if(r){let e=Array(r.length+t.length);for(let t=0;t<r.length;t++)e[t]=r[t];for(let s=0;s<t.length;s++)e[r.length+s]=t[s];return e}return t}return r||n$}return s[e]||n$}}})(l)}).cache.get,r=s.cache.set,n=a,a(o)},(...e)=>n(((...e)=>{let t,s,i=0,r="";for(;i<e.length;)(t=e[i++])&&(s=nG(t))&&(r&&(r+=" "),r+=s);return r})(...e))})(()=>{let e=nJ("color"),t=nJ("font"),s=nJ("text"),i=nJ("font-weight"),r=nJ("tracking"),n=nJ("leading"),a=nJ("breakpoint"),o=nJ("container"),l=nJ("spacing"),d=nJ("radius"),c=nJ("shadow"),u=nJ("inset-shadow"),h=nJ("text-shadow"),m=nJ("drop-shadow"),p=nJ("blur"),x=nJ("perspective"),f=nJ("aspect"),g=nJ("ease"),y=nJ("animate"),v=()=>["auto","avoid","all","avoid-page","page","left","right","column"],b=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],j=()=>[...b(),ax,ad],w=()=>["auto","hidden","clip","visible","scroll"],N=()=>["auto","contain","none"],k=()=>[ax,ad,l],S=()=>[n8,"full","auto",...k()],C=()=>[n9,"none","subgrid",ax,ad],T=()=>["auto",{span:["full",n9,ax,ad]},n9,ax,ad],A=()=>[n9,"auto",ax,ad],M=()=>["auto","min","max","fr",ax,ad],P=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],E=()=>["start","end","center","stretch","center-safe","end-safe"],D=()=>["auto",...k()],L=()=>[n8,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...k()],R=()=>[e,ax,ad],V=()=>[...b(),ay,ah,{position:[ax,ad]}],F=()=>["no-repeat",{repeat:["","x","y","space","round"]}],$=()=>["auto","cover","contain",av,al,{size:[ax,ad]}],z=()=>[ae,af,ac],_=()=>["","none","full",d,ax,ad],I=()=>["",n7,af,ac],O=()=>["solid","dashed","dotted","double"],B=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],U=()=>[n7,ae,ay,ah],W=()=>["","none",p,ax,ad],q=()=>["none",n7,ax,ad],K=()=>["none",n7,ax,ad],H=()=>[n7,ax,ad],Y=()=>[n8,"full",...k()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[at],breakpoint:[at],color:[as],container:[at],"drop-shadow":[at],ease:["in","out","in-out"],font:[ao],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[at],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[at],shadow:[at],spacing:["px",n7],text:[at],"text-shadow":[at],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",n8,ad,ax,f]}],container:["container"],columns:[{columns:[n7,ad,ax,o]}],"break-after":[{"break-after":v()}],"break-before":[{"break-before":v()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:j()}],overflow:[{overflow:w()}],"overflow-x":[{"overflow-x":w()}],"overflow-y":[{"overflow-y":w()}],overscroll:[{overscroll:N()}],"overscroll-x":[{"overscroll-x":N()}],"overscroll-y":[{"overscroll-y":N()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:S()}],"inset-x":[{"inset-x":S()}],"inset-y":[{"inset-y":S()}],start:[{start:S()}],end:[{end:S()}],top:[{top:S()}],right:[{right:S()}],bottom:[{bottom:S()}],left:[{left:S()}],visibility:["visible","invisible","collapse"],z:[{z:[n9,"auto",ax,ad]}],basis:[{basis:[n8,"full","auto",o,...k()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[n7,n8,"auto","initial","none",ad]}],grow:[{grow:["",n7,ax,ad]}],shrink:[{shrink:["",n7,ax,ad]}],order:[{order:[n9,"first","last","none",ax,ad]}],"grid-cols":[{"grid-cols":C()}],"col-start-end":[{col:T()}],"col-start":[{"col-start":A()}],"col-end":[{"col-end":A()}],"grid-rows":[{"grid-rows":C()}],"row-start-end":[{row:T()}],"row-start":[{"row-start":A()}],"row-end":[{"row-end":A()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":M()}],"auto-rows":[{"auto-rows":M()}],gap:[{gap:k()}],"gap-x":[{"gap-x":k()}],"gap-y":[{"gap-y":k()}],"justify-content":[{justify:[...P(),"normal"]}],"justify-items":[{"justify-items":[...E(),"normal"]}],"justify-self":[{"justify-self":["auto",...E()]}],"align-content":[{content:["normal",...P()]}],"align-items":[{items:[...E(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...E(),{baseline:["","last"]}]}],"place-content":[{"place-content":P()}],"place-items":[{"place-items":[...E(),"baseline"]}],"place-self":[{"place-self":["auto",...E()]}],p:[{p:k()}],px:[{px:k()}],py:[{py:k()}],ps:[{ps:k()}],pe:[{pe:k()}],pt:[{pt:k()}],pr:[{pr:k()}],pb:[{pb:k()}],pl:[{pl:k()}],m:[{m:D()}],mx:[{mx:D()}],my:[{my:D()}],ms:[{ms:D()}],me:[{me:D()}],mt:[{mt:D()}],mr:[{mr:D()}],mb:[{mb:D()}],ml:[{ml:D()}],"space-x":[{"space-x":k()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":k()}],"space-y-reverse":["space-y-reverse"],size:[{size:L()}],w:[{w:[o,"screen",...L()]}],"min-w":[{"min-w":[o,"screen","none",...L()]}],"max-w":[{"max-w":[o,"screen","none","prose",{screen:[a]},...L()]}],h:[{h:["screen","lh",...L()]}],"min-h":[{"min-h":["screen","lh","none",...L()]}],"max-h":[{"max-h":["screen","lh",...L()]}],"font-size":[{text:["base",s,af,ac]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[i,ax,au]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",ae,ad]}],"font-family":[{font:[ag,ad,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[r,ax,ad]}],"line-clamp":[{"line-clamp":[n7,"none",ax,au]}],leading:[{leading:[n,...k()]}],"list-image":[{"list-image":["none",ax,ad]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ax,ad]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:R()}],"text-color":[{text:R()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...O(),"wavy"]}],"text-decoration-thickness":[{decoration:[n7,"from-font","auto",ax,ac]}],"text-decoration-color":[{decoration:R()}],"underline-offset":[{"underline-offset":[n7,"auto",ax,ad]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:k()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ax,ad]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ax,ad]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:V()}],"bg-repeat":[{bg:F()}],"bg-size":[{bg:$()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},n9,ax,ad],radial:["",ax,ad],conic:[n9,ax,ad]},ab,am]}],"bg-color":[{bg:R()}],"gradient-from-pos":[{from:z()}],"gradient-via-pos":[{via:z()}],"gradient-to-pos":[{to:z()}],"gradient-from":[{from:R()}],"gradient-via":[{via:R()}],"gradient-to":[{to:R()}],rounded:[{rounded:_()}],"rounded-s":[{"rounded-s":_()}],"rounded-e":[{"rounded-e":_()}],"rounded-t":[{"rounded-t":_()}],"rounded-r":[{"rounded-r":_()}],"rounded-b":[{"rounded-b":_()}],"rounded-l":[{"rounded-l":_()}],"rounded-ss":[{"rounded-ss":_()}],"rounded-se":[{"rounded-se":_()}],"rounded-ee":[{"rounded-ee":_()}],"rounded-es":[{"rounded-es":_()}],"rounded-tl":[{"rounded-tl":_()}],"rounded-tr":[{"rounded-tr":_()}],"rounded-br":[{"rounded-br":_()}],"rounded-bl":[{"rounded-bl":_()}],"border-w":[{border:I()}],"border-w-x":[{"border-x":I()}],"border-w-y":[{"border-y":I()}],"border-w-s":[{"border-s":I()}],"border-w-e":[{"border-e":I()}],"border-w-t":[{"border-t":I()}],"border-w-r":[{"border-r":I()}],"border-w-b":[{"border-b":I()}],"border-w-l":[{"border-l":I()}],"divide-x":[{"divide-x":I()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":I()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...O(),"hidden","none"]}],"divide-style":[{divide:[...O(),"hidden","none"]}],"border-color":[{border:R()}],"border-color-x":[{"border-x":R()}],"border-color-y":[{"border-y":R()}],"border-color-s":[{"border-s":R()}],"border-color-e":[{"border-e":R()}],"border-color-t":[{"border-t":R()}],"border-color-r":[{"border-r":R()}],"border-color-b":[{"border-b":R()}],"border-color-l":[{"border-l":R()}],"divide-color":[{divide:R()}],"outline-style":[{outline:[...O(),"none","hidden"]}],"outline-offset":[{"outline-offset":[n7,ax,ad]}],"outline-w":[{outline:["",n7,af,ac]}],"outline-color":[{outline:R()}],shadow:[{shadow:["","none",c,aj,ap]}],"shadow-color":[{shadow:R()}],"inset-shadow":[{"inset-shadow":["none",u,aj,ap]}],"inset-shadow-color":[{"inset-shadow":R()}],"ring-w":[{ring:I()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:R()}],"ring-offset-w":[{"ring-offset":[n7,ac]}],"ring-offset-color":[{"ring-offset":R()}],"inset-ring-w":[{"inset-ring":I()}],"inset-ring-color":[{"inset-ring":R()}],"text-shadow":[{"text-shadow":["none",h,aj,ap]}],"text-shadow-color":[{"text-shadow":R()}],opacity:[{opacity:[n7,ax,ad]}],"mix-blend":[{"mix-blend":[...B(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":B()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[n7]}],"mask-image-linear-from-pos":[{"mask-linear-from":U()}],"mask-image-linear-to-pos":[{"mask-linear-to":U()}],"mask-image-linear-from-color":[{"mask-linear-from":R()}],"mask-image-linear-to-color":[{"mask-linear-to":R()}],"mask-image-t-from-pos":[{"mask-t-from":U()}],"mask-image-t-to-pos":[{"mask-t-to":U()}],"mask-image-t-from-color":[{"mask-t-from":R()}],"mask-image-t-to-color":[{"mask-t-to":R()}],"mask-image-r-from-pos":[{"mask-r-from":U()}],"mask-image-r-to-pos":[{"mask-r-to":U()}],"mask-image-r-from-color":[{"mask-r-from":R()}],"mask-image-r-to-color":[{"mask-r-to":R()}],"mask-image-b-from-pos":[{"mask-b-from":U()}],"mask-image-b-to-pos":[{"mask-b-to":U()}],"mask-image-b-from-color":[{"mask-b-from":R()}],"mask-image-b-to-color":[{"mask-b-to":R()}],"mask-image-l-from-pos":[{"mask-l-from":U()}],"mask-image-l-to-pos":[{"mask-l-to":U()}],"mask-image-l-from-color":[{"mask-l-from":R()}],"mask-image-l-to-color":[{"mask-l-to":R()}],"mask-image-x-from-pos":[{"mask-x-from":U()}],"mask-image-x-to-pos":[{"mask-x-to":U()}],"mask-image-x-from-color":[{"mask-x-from":R()}],"mask-image-x-to-color":[{"mask-x-to":R()}],"mask-image-y-from-pos":[{"mask-y-from":U()}],"mask-image-y-to-pos":[{"mask-y-to":U()}],"mask-image-y-from-color":[{"mask-y-from":R()}],"mask-image-y-to-color":[{"mask-y-to":R()}],"mask-image-radial":[{"mask-radial":[ax,ad]}],"mask-image-radial-from-pos":[{"mask-radial-from":U()}],"mask-image-radial-to-pos":[{"mask-radial-to":U()}],"mask-image-radial-from-color":[{"mask-radial-from":R()}],"mask-image-radial-to-color":[{"mask-radial-to":R()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[n7]}],"mask-image-conic-from-pos":[{"mask-conic-from":U()}],"mask-image-conic-to-pos":[{"mask-conic-to":U()}],"mask-image-conic-from-color":[{"mask-conic-from":R()}],"mask-image-conic-to-color":[{"mask-conic-to":R()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:V()}],"mask-repeat":[{mask:F()}],"mask-size":[{mask:$()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ax,ad]}],filter:[{filter:["","none",ax,ad]}],blur:[{blur:W()}],brightness:[{brightness:[n7,ax,ad]}],contrast:[{contrast:[n7,ax,ad]}],"drop-shadow":[{"drop-shadow":["","none",m,aj,ap]}],"drop-shadow-color":[{"drop-shadow":R()}],grayscale:[{grayscale:["",n7,ax,ad]}],"hue-rotate":[{"hue-rotate":[n7,ax,ad]}],invert:[{invert:["",n7,ax,ad]}],saturate:[{saturate:[n7,ax,ad]}],sepia:[{sepia:["",n7,ax,ad]}],"backdrop-filter":[{"backdrop-filter":["","none",ax,ad]}],"backdrop-blur":[{"backdrop-blur":W()}],"backdrop-brightness":[{"backdrop-brightness":[n7,ax,ad]}],"backdrop-contrast":[{"backdrop-contrast":[n7,ax,ad]}],"backdrop-grayscale":[{"backdrop-grayscale":["",n7,ax,ad]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[n7,ax,ad]}],"backdrop-invert":[{"backdrop-invert":["",n7,ax,ad]}],"backdrop-opacity":[{"backdrop-opacity":[n7,ax,ad]}],"backdrop-saturate":[{"backdrop-saturate":[n7,ax,ad]}],"backdrop-sepia":[{"backdrop-sepia":["",n7,ax,ad]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":k()}],"border-spacing-x":[{"border-spacing-x":k()}],"border-spacing-y":[{"border-spacing-y":k()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ax,ad]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[n7,"initial",ax,ad]}],ease:[{ease:["linear","initial",g,ax,ad]}],delay:[{delay:[n7,ax,ad]}],animate:[{animate:["none",y,ax,ad]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[x,ax,ad]}],"perspective-origin":[{"perspective-origin":j()}],rotate:[{rotate:q()}],"rotate-x":[{"rotate-x":q()}],"rotate-y":[{"rotate-y":q()}],"rotate-z":[{"rotate-z":q()}],scale:[{scale:K()}],"scale-x":[{"scale-x":K()}],"scale-y":[{"scale-y":K()}],"scale-z":[{"scale-z":K()}],"scale-3d":["scale-3d"],skew:[{skew:H()}],"skew-x":[{"skew-x":H()}],"skew-y":[{"skew-y":H()}],transform:[{transform:[ax,ad,"","none","gpu","cpu"]}],"transform-origin":[{origin:j()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Y()}],"translate-x":[{"translate-x":Y()}],"translate-y":[{"translate-y":Y()}],"translate-z":[{"translate-z":Y()}],"translate-none":["translate-none"],accent:[{accent:R()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:R()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ax,ad]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":k()}],"scroll-mx":[{"scroll-mx":k()}],"scroll-my":[{"scroll-my":k()}],"scroll-ms":[{"scroll-ms":k()}],"scroll-me":[{"scroll-me":k()}],"scroll-mt":[{"scroll-mt":k()}],"scroll-mr":[{"scroll-mr":k()}],"scroll-mb":[{"scroll-mb":k()}],"scroll-ml":[{"scroll-ml":k()}],"scroll-p":[{"scroll-p":k()}],"scroll-px":[{"scroll-px":k()}],"scroll-py":[{"scroll-py":k()}],"scroll-ps":[{"scroll-ps":k()}],"scroll-pe":[{"scroll-pe":k()}],"scroll-pt":[{"scroll-pt":k()}],"scroll-pr":[{"scroll-pr":k()}],"scroll-pb":[{"scroll-pb":k()}],"scroll-pl":[{"scroll-pl":k()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ax,ad]}],fill:[{fill:["none",...R()]}],"stroke-w":[{stroke:[n7,af,ac,au]}],stroke:[{stroke:["none",...R()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});function aD(...e){return aE(nV(e))}function aL({className:e,...t}){return(0,c.jsx)("div",{"data-slot":"card",className:aD("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...t})}function aR({className:e,...t}){return(0,c.jsx)("div",{"data-slot":"card-header",className:aD("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",e),...t})}function aV({className:e,...t}){return(0,c.jsx)("div",{"data-slot":"card-title",className:aD("leading-none font-semibold",e),...t})}function aF({className:e,...t}){return(0,c.jsx)("div",{"data-slot":"card-content",className:aD("px-6",e),...t})}function a$(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}var az=Symbol.for("react.lazy"),a_=u[" use ".trim().toString()];function aI(e){var t;return null!=e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===az&&"_payload"in e&&"object"==typeof(t=e._payload)&&null!==t&&"then"in t}var aO=((l=u.forwardRef((e,t)=>{let{children:s,...i}=e;if(aI(s)&&"function"==typeof a_&&(s=a_(s._payload)),u.isValidElement(s)){var r;let e,n,a=(r=s,(n=(e=Object.getOwnPropertyDescriptor(r.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?r.ref:(n=(e=Object.getOwnPropertyDescriptor(r,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?r.props.ref:r.props.ref||r.ref),o=function(e,t){let s={...t};for(let i in t){let r=e[i],n=t[i];/^on[A-Z]/.test(i)?r&&n?s[i]=(...e)=>{let t=n(...e);return r(...e),t}:r&&(s[i]=r):"style"===i?s[i]={...r,...n}:"className"===i&&(s[i]=[r,n].filter(Boolean).join(" "))}return{...e,...s}}(i,s.props);return s.type!==u.Fragment&&(o.ref=t?function(...e){return t=>{let s=!1,i=e.map(e=>{let i=a$(e,t);return s||"function"!=typeof i||(s=!0),i});if(s)return()=>{for(let t=0;t<i.length;t++){let s=i[t];"function"==typeof s?s():a$(e[t],null)}}}}(t,a):a),u.cloneElement(s,o)}return u.Children.count(s)>1?u.Children.only(null):null})).displayName="Slot.SlotClone",i=l,(r=u.forwardRef((e,t)=>{let{children:s,...r}=e;aI(s)&&"function"==typeof a_&&(s=a_(s._payload));let n=u.Children.toArray(s),a=n.find(aU);if(a){let e=a.props.children,s=n.map(t=>t!==a?t:u.Children.count(e)>1?u.Children.only(null):u.isValidElement(e)?e.props.children:null);return(0,c.jsx)(i,{...r,ref:t,children:u.isValidElement(e)?u.cloneElement(e,void 0,s):null})}return(0,c.jsx)(i,{...r,ref:t,children:s})})).displayName="Slot.Slot",r),aB=Symbol("radix.slottable");function aU(e){return u.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===aB}let aW=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,aq=(n="inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",a={variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}},e=>{var t;if((null==a?void 0:a.variants)==null)return nV(n,null==e?void 0:e.class,null==e?void 0:e.className);let{variants:s,defaultVariants:i}=a,r=Object.keys(s).map(t=>{let r=null==e?void 0:e[t],n=null==i?void 0:i[t];if(null===r)return null;let a=aW(r)||aW(n);return s[t][a]}),o=e&&Object.entries(e).reduce((e,t)=>{let[s,i]=t;return void 0===i||(e[s]=i),e},{});return nV(n,r,null==a||null==(t=a.compoundVariants)?void 0:t.reduce((e,t)=>{let{class:s,className:r,...n}=t;return Object.entries(n).every(e=>{let[t,s]=e;return Array.isArray(s)?s.includes({...i,...o}[t]):({...i,...o})[t]===s})?[...e,s,r]:e},[]),null==e?void 0:e.class,null==e?void 0:e.className)});function aK({className:e,variant:t="default",size:s="default",asChild:i=!1,...r}){return(0,c.jsx)(i?aO:"button",{"data-slot":"button","data-variant":t,"data-size":s,className:aD(aq({variant:t,size:s,className:e})),...r})}function aH({className:e,type:t,...s}){return(0,c.jsx)("input",{type:t,"data-slot":"input",className:aD("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",e),...s})}var aY=e.i(97358),aX=e.i(33368);let aG={references:{color:"#60a5fa",label:"References",icon:"→"},extends:{color:"#34d399",label:"Extends",icon:"⊃"},contradicts:{color:"#f87171",label:"Contradicts",icon:"⊗"},related:{color:"#a78bfa",label:"Related",icon:"~"}},aQ=["architecture","pattern","preference","error","context","learning","todo","note","relationship","custom"];function aJ({memory:e,links:t=[],memories:s=[],onClose:i,onReinforce:r,onSelectMemory:n,isReinforcing:a=!1,reinforceSuccess:o=!1}){let[l,d]=(0,u.useState)(!1),[h,m]=(0,u.useState)(null),[p,x]=(0,u.useState)(!1),[f,g]=(0,u.useState)(e.title),[y,v]=(0,u.useState)(e.content),[b,j]=(0,u.useState)(e.category),[w,N]=(0,u.useState)((e.tags||[]).join(", ")),[k,S]=(0,u.useState)(!1),C=(0,nM.useEditMemory)(),T=(0,nM.useDeleteMemory)(),[A,M]=(0,u.useState)(e.id);A!==e.id&&(M(e.id),x(!1),S(!1),g(e.title),v(e.content),j(e.category),N((e.tags||[]).join(", "))),(0,u.useEffect)(()=>{if(o&&h===e.id){let e=setTimeout(()=>d(!0),0),t=setTimeout(()=>d(!1),1500);return()=>{clearTimeout(e),clearTimeout(t)}}},[o,h,e.id]);let P=(0,u.useCallback)(()=>{let t=w.split(",").map(e=>e.trim()).filter(Boolean);C.mutate({id:e.id,updates:{title:f,content:y,category:b,tags:t}},{onSuccess:()=>{x(!1)}})},[e.id,f,y,b,w,C]),E=(0,aX.calculateDecayFactor)(e),D=(0,aY.getCategoryColor)(e.category),L=(0,aY.getTypeColor)(e.type),R=E>.7?{label:"Healthy",color:"#22C55E",bgColor:"rgba(34, 197, 94, 0.15)"}:E>.4?{label:"Fading",color:"#EAB308",bgColor:"rgba(234, 179, 8, 0.15)"}:{label:"Critical",color:"#EF4444",bgColor:"rgba(239, 68, 68, 0.15)"},V=(0,u.useMemo)(()=>{let i=[];for(let r of t)if(r.source_id===e.id){let e=s.find(e=>e.id===r.target_id);e&&i.push({memory:e,relationship:r.relationship,strength:r.strength,direction:"to"})}else if(r.target_id===e.id){let e=s.find(e=>e.id===r.source_id);e&&i.push({memory:e,relationship:r.relationship,strength:r.strength,direction:"from"})}return i.sort((e,t)=>t.strength-e.strength)},[e.id,t,s]);return(0,c.jsxs)(aL,{className:`bg-slate-900 border-slate-700 h-full overflow-auto transition-all duration-300 ${l?"ring-2 ring-green-500 ring-opacity-75":""}`,children:[(0,c.jsxs)(aR,{className:"border-b border-slate-700 pb-3",children:[(0,c.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[p?(0,c.jsx)(aH,{value:f,onChange:e=>g(e.target.value),className:"bg-slate-800 border-slate-600 text-white text-lg font-semibold"}):(0,c.jsx)(aV,{className:"text-lg font-semibold text-white leading-tight",children:e.title}),(0,c.jsx)(aK,{variant:"ghost",size:"sm",onClick:i,className:"text-slate-400 hover:text-white -mt-1 shrink-0",children:"✕"})]}),(0,c.jsxs)("div",{className:"flex items-center gap-2 mt-2",children:[p?(0,c.jsx)("select",{value:b,onChange:e=>j(e.target.value),className:"bg-slate-800 border border-slate-600 text-white text-xs rounded-lg px-2 py-1",children:aQ.map(e=>(0,c.jsx)("option",{value:e,children:e},e))}):(0,c.jsx)("span",{className:"px-2 py-0.5 rounded text-xs font-medium",style:{backgroundColor:D+"20",color:D},children:e.category}),(0,c.jsx)("span",{className:"px-2 py-0.5 rounded text-xs font-medium",style:{backgroundColor:L+"20",color:L},children:e.type.replace("_","-")})]})]}),(0,c.jsxs)(aF,{className:"p-4 space-y-4",children:[(0,c.jsxs)("div",{children:[(0,c.jsx)("h4",{className:"text-xs font-medium text-slate-400 mb-1",children:"Content"}),p?(0,c.jsx)("textarea",{value:y,onChange:e=>v(e.target.value),rows:6,className:"w-full bg-slate-800 border border-slate-600 text-sm text-slate-200 rounded-lg p-3 resize-y focus:ring-cyan-500 focus:border-cyan-500"}):(0,c.jsx)("p",{className:"text-sm text-slate-200 whitespace-pre-wrap leading-relaxed",children:e.content})]}),p&&(0,c.jsxs)("div",{children:[(0,c.jsx)("h4",{className:"text-xs font-medium text-slate-400 mb-1",children:"Tags (comma-separated)"}),(0,c.jsx)(aH,{value:w,onChange:e=>N(e.target.value),placeholder:"tag1, tag2, tag3",className:"bg-slate-800 border-slate-600 text-white text-sm"})]}),p?(0,c.jsxs)("div",{className:"flex gap-2",children:[(0,c.jsx)(aK,{variant:"default",size:"sm",onClick:P,disabled:C.isPending,className:"flex-1 bg-emerald-600 hover:bg-emerald-700",children:C.isPending?"Saving...":"Save Changes"}),(0,c.jsx)(aK,{variant:"outline",size:"sm",onClick:()=>{x(!1),g(e.title),v(e.content),j(e.category),N((e.tags||[]).join(", "))},className:"flex-1 border-slate-600 text-slate-300 hover:text-white",children:"Cancel"})]}):null,!p&&(0,c.jsxs)("div",{className:"rounded-lg p-3 flex items-center gap-3",style:{backgroundColor:R.bgColor},children:[(0,c.jsx)("div",{className:"w-3 h-3 rounded-full animate-pulse",style:{backgroundColor:R.color}}),(0,c.jsxs)("div",{children:[(0,c.jsx)("div",{className:"text-sm font-medium",style:{color:R.color},children:R.label}),(0,c.jsx)("div",{className:"text-xs text-slate-400",children:E>.7?"Memory is strong and stable":E>.4?"Memory is fading - reinforce to preserve":"Memory at risk of deletion - reinforce now"})]})]}),!p&&(0,c.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,c.jsxs)("div",{className:"bg-slate-800 rounded-lg p-3",children:[(0,c.jsx)("div",{className:"text-xs text-slate-400",children:"Salience"}),(0,c.jsxs)("div",{className:"text-lg font-bold text-white",children:[(100*e.salience).toFixed(0),"%"]}),(0,c.jsx)("div",{className:"mt-1 h-1.5 bg-slate-700 rounded-full overflow-hidden",children:(0,c.jsx)("div",{className:"h-full bg-gradient-to-r from-red-500 via-yellow-500 to-green-500 rounded-full transition-all",style:{width:`${100*e.salience}%`}})})]}),(0,c.jsxs)("div",{className:"bg-slate-800 rounded-lg p-3",children:[(0,c.jsx)("div",{className:"text-xs text-slate-400",children:"Decay Factor"}),(0,c.jsxs)("div",{className:"text-lg font-bold text-white",children:[(100*E).toFixed(0),"%"]}),(0,c.jsx)("div",{className:"mt-1 h-1.5 bg-slate-700 rounded-full overflow-hidden",children:(0,c.jsx)("div",{className:"h-full rounded-full transition-all",style:{width:`${100*E}%`,backgroundColor:R.color}})})]})]}),!p&&(0,c.jsxs)("div",{className:`bg-slate-800 rounded-lg p-3 space-y-2 transition-all duration-300 ${l?"ring-1 ring-green-500/50":""}`,children:[(0,c.jsxs)("div",{className:"flex justify-between items-center",children:[(0,c.jsx)("span",{className:"text-xs text-slate-400",children:"Access Count"}),(0,c.jsxs)("span",{className:`text-sm font-medium transition-all duration-300 ${l?"text-green-400 scale-110":"text-white"}`,children:[e.accessCount," times"]})]}),(0,c.jsxs)("div",{className:"flex justify-between items-center",children:[(0,c.jsx)("span",{className:"text-xs text-slate-400",children:"Last Accessed"}),(0,c.jsx)("span",{className:`text-sm transition-all duration-300 ${l?"text-green-400":"text-white"}`,children:l?"Just now":(e=>{let t=new Date(e),s=Math.floor((new Date().getTime()-t.getTime())/36e5);if(s<1)return"Just now";if(s<24)return`${s}h ago`;let i=Math.floor(s/24);return i<7?`${i}d ago`:`${Math.floor(i/7)}w ago`})(e.lastAccessed)})]}),(0,c.jsxs)("div",{className:"flex justify-between items-center",children:[(0,c.jsx)("span",{className:"text-xs text-slate-400",children:"Created"}),(0,c.jsx)("span",{className:"text-sm text-white",children:new Date(e.createdAt).toLocaleString()})]})]}),!p&&V.length>0&&(0,c.jsxs)("div",{children:[(0,c.jsxs)("h4",{className:"text-xs font-medium text-slate-400 mb-2 flex items-center gap-2",children:[(0,c.jsx)("span",{className:"inline-block w-4 h-4",children:"🔗"}),"Related Memories (",V.length,")"]}),(0,c.jsx)("div",{className:"space-y-2 max-h-48 overflow-y-auto",children:V.map(({memory:e,relationship:t,strength:s,direction:i})=>{let r=aG[t]||aG.related,a=(0,aY.getCategoryColor)(e.category);return(0,c.jsxs)("button",{onClick:()=>n?.(e.id),className:"w-full text-left p-2 bg-slate-800 hover:bg-slate-750 rounded-lg transition-colors group",children:[(0,c.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,c.jsx)("span",{className:"w-1.5 h-1.5 rounded-full",style:{backgroundColor:r.color}}),(0,c.jsx)("span",{className:"text-[10px] font-medium",style:{color:r.color},children:"to"===i?`${r.icon} ${r.label}`:`${r.label} ${r.icon}`}),(0,c.jsxs)("span",{className:"text-[10px] text-slate-500 ml-auto",children:[(100*s).toFixed(0),"%"]})]}),(0,c.jsx)("div",{className:"text-sm text-white truncate group-hover:text-blue-400 transition-colors",children:e.title}),(0,c.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,c.jsx)("span",{className:"px-1.5 py-0.5 rounded text-[10px]",style:{backgroundColor:a+"20",color:a},children:e.category}),(0,c.jsxs)("span",{className:"text-[10px] text-slate-500",children:[(100*e.salience).toFixed(0),"% salience"]})]})]},`${e.id}-${i}`)})})]}),!p&&e.tags&&e.tags.length>0&&(0,c.jsxs)("div",{children:[(0,c.jsx)("h4",{className:"text-xs font-medium text-slate-400 mb-2",children:"Tags"}),(0,c.jsx)("div",{className:"flex flex-wrap gap-1",children:e.tags.map((e,t)=>(0,c.jsx)("span",{className:"px-2 py-0.5 bg-slate-700 text-slate-300 rounded text-xs",children:e},t))})]}),!p&&(0,c.jsxs)("div",{className:"space-y-2 pt-2",children:[(0,c.jsxs)("div",{className:"flex gap-2",children:[r&&(0,c.jsx)(aK,{variant:"default",size:"sm",onClick:()=>{m(e.id),r?.(e.id)},disabled:a,className:`flex-1 transition-all duration-300 ${l?"bg-green-600 hover:bg-green-600":"bg-blue-600 hover:bg-blue-700"}`,children:a?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("span",{className:"animate-spin mr-2",children:"⟳"}),"Reinforcing..."]}):l?(0,c.jsx)(c.Fragment,{children:"✓ Reinforced!"}):(0,c.jsx)(c.Fragment,{children:"⚡ Reinforce"})}),(0,c.jsx)(aK,{variant:"outline",size:"sm",onClick:()=>x(!0),className:"flex-1 border-slate-600 text-slate-300 hover:text-white hover:bg-slate-700",children:"Edit"})]}),k?(0,c.jsxs)("div",{className:"bg-red-500/10 border border-red-500/30 rounded-lg p-3",children:[(0,c.jsx)("p",{className:"text-xs text-red-400 mb-2",children:"Delete this memory permanently?"}),(0,c.jsxs)("div",{className:"flex gap-2",children:[(0,c.jsx)(aK,{variant:"default",size:"sm",onClick:()=>{T.mutate(e.id,{onSuccess:()=>{i()}})},disabled:T.isPending,className:"flex-1 bg-red-600 hover:bg-red-700",children:T.isPending?"Deleting...":"Confirm Delete"}),(0,c.jsx)(aK,{variant:"outline",size:"sm",onClick:()=>S(!1),className:"flex-1 border-slate-600 text-slate-300 hover:text-white",children:"Cancel"})]})]}):(0,c.jsx)(aK,{variant:"ghost",size:"sm",onClick:()=>S(!0),className:"w-full text-slate-500 hover:text-red-400 hover:bg-red-500/10",children:"Delete Memory"})]})]})]})}var aZ=e.i(1235);function a0(e){let t=Math.floor((Date.now()-new Date(e).getTime())/6e4);if(t<1)return"now";if(t<60)return`${t}m ago`;let s=Math.floor(t/60);if(s<24)return`${s}h ago`;let i=Math.floor(s/24);if(i<7)return`${i}d ago`;let r=Math.floor(i/7);return`${r}w ago`}function a1({memory:e,isSelected:t,onSelect:s,isChecked:i,onCheck:r}){let n=(0,aY.getCategoryColor)(e.category),a=(0,aY.getTypeColor)(e.type);return(0,c.jsxs)("div",{onClick:()=>s(e),className:`bg-slate-900 border rounded-lg p-3 hover:border-slate-600 cursor-pointer transition-colors relative ${t?"border-cyan-500":"border-slate-800"}`,children:[(0,c.jsx)("div",{className:"h-0.5 rounded-full bg-slate-800 mb-2 overflow-hidden",children:(0,c.jsx)("div",{className:"h-full rounded-full",style:{width:`${100*e.salience}%`,backgroundColor:n}})}),r&&(0,c.jsx)("input",{type:"checkbox",checked:i??!1,onChange:t=>{t.stopPropagation(),r(e.id,t.target.checked)},onClick:e=>e.stopPropagation(),className:"absolute top-3 right-3 w-4 h-4 accent-blue-500"}),(0,c.jsx)("h3",{className:"text-sm font-semibold text-white truncate pr-6",children:e.title}),(0,c.jsxs)("div",{className:"flex items-center gap-1.5 mt-1",children:[(0,c.jsx)("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full font-medium",style:{backgroundColor:n+"22",color:n},children:e.category}),(0,c.jsx)("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full font-medium",style:{backgroundColor:a+"22",color:a},children:e.type.replace("_","-")})]}),(0,c.jsx)("p",{className:"text-[13px] text-slate-400 mt-1.5 line-clamp-3 leading-snug",children:e.content}),e.tags.length>0&&(0,c.jsxs)("div",{className:"flex items-center gap-1 mt-2 flex-wrap",children:[e.tags.slice(0,3).map(e=>(0,c.jsx)("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-slate-800 text-slate-400",children:e},e)),e.tags.length>3&&(0,c.jsxs)("span",{className:"text-[10px] text-slate-500",children:["+",e.tags.length-3," more"]})]}),(0,c.jsxs)("div",{className:"flex items-center justify-between mt-2 text-[11px] text-slate-500",children:[(0,c.jsxs)("span",{children:["Created ",a0(e.createdAt)]}),(0,c.jsxs)("span",{children:["Accessed ",a0(e.lastAccessed)]})]})]})}let a5=h.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";function a4({memories:e,selectedMemory:t,onSelectMemory:s}){let[i,r]=(0,u.useState)("salience"),[n,a]=(0,u.useState)("grid"),[o,l]=(0,u.useState)(!1),[d,h]=(0,u.useState)(new Set),[m,p]=(0,u.useState)(!1),x=(0,aZ.useQueryClient)(),f=(0,u.useMemo)(()=>{let t=[...e];return t.sort((e,t)=>{switch(i){case"salience":return t.salience-e.salience;case"createdAt":return new Date(t.createdAt).getTime()-new Date(e.createdAt).getTime();case"lastAccessed":return new Date(t.lastAccessed).getTime()-new Date(e.lastAccessed).getTime();case"decayedScore":return(t.decayedScore??t.salience)-(e.decayedScore??e.salience);default:return 0}}),t},[e,i]),g=(0,u.useCallback)((e,t)=>{h(s=>{let i=new Set(s);return t?i.add(e):i.delete(e),i})},[]),y=async()=>{if(0!==d.size){p(!0);try{await Promise.all(Array.from(d).map(e=>fetch(`${a5}/api/memories/${e}`,{method:"DELETE"}))),h(new Set),x.invalidateQueries({queryKey:["memories"]})}finally{p(!1)}}};return(0,c.jsxs)("div",{className:"flex flex-col h-full",children:[(0,c.jsxs)("div",{className:"flex items-center gap-3 px-4 py-2 border-b border-slate-800 shrink-0",children:[(0,c.jsxs)("span",{className:"text-xs text-slate-400",children:[e.length," memories"]}),(0,c.jsx)("div",{className:"w-px h-5 bg-slate-700"}),(0,c.jsxs)("select",{value:i,onChange:e=>r(e.target.value),className:"bg-slate-800 border border-slate-700 text-white text-xs rounded px-2 py-1",children:[(0,c.jsx)("option",{value:"salience",children:"Salience"}),(0,c.jsx)("option",{value:"createdAt",children:"Created"}),(0,c.jsx)("option",{value:"lastAccessed",children:"Last Accessed"}),(0,c.jsx)("option",{value:"decayedScore",children:"Decay Score"})]}),(0,c.jsxs)("div",{className:"flex items-center border border-slate-700 rounded overflow-hidden",children:[(0,c.jsx)("button",{onClick:()=>a("grid"),className:`px-2 py-1 text-xs ${"grid"===n?"bg-slate-700 text-white":"text-slate-400 hover:text-white"}`,children:"Grid"}),(0,c.jsx)("button",{onClick:()=>a("list"),className:`px-2 py-1 text-xs ${"list"===n?"bg-slate-700 text-white":"text-slate-400 hover:text-white"}`,children:"List"})]}),(0,c.jsx)("div",{className:"w-px h-5 bg-slate-700"}),(0,c.jsx)("button",{onClick:()=>{l(!o),h(new Set)},className:`px-2 py-1 text-xs rounded ${o?"bg-blue-600 text-white":"bg-slate-800 text-slate-400 hover:text-white"}`,children:"Select"}),o&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("button",{onClick:()=>h(new Set(f.map(e=>e.id))),className:"px-2 py-1 text-xs text-slate-400 hover:text-white",children:"Select all"}),(0,c.jsx)("button",{onClick:y,disabled:0===d.size||m,className:"px-2 py-1 text-xs rounded bg-red-600/20 text-red-400 hover:bg-red-600/40 disabled:opacity-40",children:m?"Deleting...":`Delete (${d.size})`})]})]}),(0,c.jsx)("div",{className:"flex-1 overflow-y-auto p-4",children:(0,c.jsx)("div",{className:"grid"===n?"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-3":"flex flex-col gap-3 max-w-2xl",children:f.map(e=>(0,c.jsx)(a1,{memory:e,isSelected:t?.id===e.id,onSelect:s,isChecked:o?d.has(e.id):void 0,onCheck:o?g:void 0},e.id))})})]})}var a2=e.i(87353);let a3=e=>{let t=e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,s)=>s?s.toUpperCase():t.toLowerCase());return t.charAt(0).toUpperCase()+t.slice(1)},a6=(...e)=>e.filter((e,t,s)=>!!e&&""!==e.trim()&&s.indexOf(e)===t).join(" ").trim();var a8={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let a7=(0,u.forwardRef)(({color:e="currentColor",size:t=24,strokeWidth:s=2,absoluteStrokeWidth:i,className:r="",children:n,iconNode:a,...o},l)=>(0,u.createElement)("svg",{ref:l,...a8,width:t,height:t,stroke:e,strokeWidth:i?24*Number(s)/Number(t):s,className:a6("lucide",r),...!n&&!(e=>{for(let t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0})(o)&&{"aria-hidden":"true"},...o},[...a.map(([e,t])=>(0,u.createElement)(e,t)),...Array.isArray(n)?n:[n]])),a9=(e,t)=>{let s=(0,u.forwardRef)(({className:s,...i},r)=>(0,u.createElement)(a7,{ref:r,iconNode:t,className:a6(`lucide-${a3(e).replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${e}`,s),...i}));return s.displayName=a3(e),s},oe=a9("shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]),ot=a9("file-text",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]),os=a9("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),oi=a9("database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]),or=a9("brain",[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]]),on=a9("git-branch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]),oa=a9("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]),oo=a9("file-search",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["circle",{cx:"11.5",cy:"14.5",r:"2.5",key:"1bq0ko"}],["path",{d:"M13.3 16.3 15 18",key:"2quom7"}]]),ol=a9("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),od=[{id:"shield",label:"Shield",icon:oe},{id:"audit",label:"Audit",icon:ot},{id:"quarantine",label:"Queue",icon:os},{id:"agents",label:"Agents",icon:oa},{id:"skills",label:"Skills",icon:oo},{id:"dome",label:"Dome",icon:ol},{id:"memories",label:"Memories",icon:oi},{id:"brain",label:"Brain",icon:or},{id:"graph",label:"Graph",icon:on}];function oc(){let{viewMode:e,setViewMode:t}=(0,nP.useDashboardStore)(),{data:s}=(0,nM.useStats)(),{data:i}=(0,a2.useAuditStats)("24h"),{data:r}=(0,nM.useVersion)(),n=s?.decayDistribution?Math.round(s.decayDistribution.healthy/Math.max(1,s.total)*100):null,a=i?.blockedCount??0;return(0,c.jsxs)("nav",{className:"w-14 border-r border-slate-800 bg-slate-900/50 flex flex-col items-center py-3 shrink-0",children:[(0,c.jsx)("div",{className:"flex-1 flex flex-col items-center gap-1",children:od.map(({id:s,label:i,icon:r})=>(0,c.jsxs)("button",{onClick:()=>t(s),className:`relative w-10 h-10 rounded-lg flex flex-col items-center justify-center gap-0.5 transition-colors ${e===s?"dome"===s?"bg-red-600/20 text-red-400":"bg-cyan-600/20 text-cyan-400":"text-slate-500 hover:text-slate-300 hover:bg-slate-800"}`,title:i,children:[(0,c.jsx)(r,{size:18}),(0,c.jsx)("span",{className:"text-[9px] leading-none",children:i}),"shield"===s&&a>0&&(0,c.jsx)("span",{className:"absolute -top-0.5 -right-0.5 min-w-[14px] h-[14px] rounded-full bg-red-500 text-white text-[8px] flex items-center justify-center px-0.5",children:a>99?"99+":a})]},s))}),(0,c.jsxs)("div",{className:"flex flex-col items-center gap-1 text-[10px] text-slate-500",children:[s&&(0,c.jsx)("span",{children:s.total}),null!==n&&(0,c.jsxs)("span",{children:[n,"%"]}),r?.version&&(0,c.jsxs)("span",{children:["v",r.version]})]})]})}let ou=a9("flame",[["path",{d:"M12 3q1 4 4 6.5t3 5.5a1 1 0 0 1-14 0 5 5 0 0 1 1-3 1 1 0 0 0 5 0c0-2-1.5-3-1.5-5q0-2 2.5-4",key:"1slcih"}]]),oh=a9("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),om=a9("puzzle",[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]]),op=a9("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),ox=[{key:"trust",label:"Trust",icon:oe,color:"text-blue-400",bg:"bg-blue-400/10"},{key:"firewall",label:"Firewall",icon:ou,color:"text-orange-400",bg:"bg-orange-400/10"},{key:"sensitivity",label:"Sensitivity",icon:oh,color:"text-purple-400",bg:"bg-purple-400/10"},{key:"fragmentation",label:"Fragment",icon:om,color:"text-cyan-400",bg:"bg-cyan-400/10"},{key:"audit",label:"Audit",icon:ot,color:"text-green-400",bg:"bg-green-400/10"}],of={strict:{color:"text-red-400",bg:"bg-red-400/10"},balanced:{color:"text-cyan-400",bg:"bg-cyan-400/10"},permissive:{color:"text-green-400",bg:"bg-green-400/10"}};function og({timeRange:e}){let{projectFilter:t}=(0,nP.useDashboardStore)(),{data:s,isLoading:i,isError:r}=(0,a2.useAuditStats)(e,t||void 0),{data:n}=(0,a2.useDefenceConfig)(),a=(0,a2.useSetDefenceMode)(),[o,l]=(0,u.useState)(!1),d=(0,u.useRef)(null),h=n?.mode??"balanced",m=of[h];return(0,u.useEffect)(()=>{function e(e){d.current&&!d.current.contains(e.target)&&l(!1)}return o&&document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[o]),(0,c.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[n?.tampered&&(0,c.jsxs)("div",{className:"flex items-center gap-2 bg-red-500/10 border border-red-500/30 rounded-lg px-3 py-2 mb-3",children:[(0,c.jsx)(os,{size:14,className:"text-red-400 shrink-0"}),(0,c.jsx)("span",{className:"text-xs text-red-400",children:"Config integrity check failed — running in strict mode"})]}),(0,c.jsx)("h3",{className:"text-sm font-medium text-slate-300 mb-4",children:"Defence Pipeline"}),(0,c.jsx)("div",{className:"flex items-center gap-1 mb-4",children:ox.map(({key:e,label:t,icon:s,color:i,bg:r},n)=>(0,c.jsxs)("div",{className:"flex items-center",children:[(0,c.jsxs)("div",{className:`flex items-center gap-1.5 px-3 py-2 rounded-lg ${r}`,children:[(0,c.jsx)(s,{size:14,className:i}),(0,c.jsx)("span",{className:`text-xs font-medium ${i}`,children:t})]}),n<ox.length-1&&(0,c.jsx)("div",{className:"w-4 h-px bg-slate-700 mx-0.5"})]},e))}),i?(0,c.jsx)("div",{className:"text-xs text-slate-500 animate-pulse",children:"Loading stats..."}):r?(0,c.jsx)("div",{className:"text-xs text-red-400",children:"Failed to load stats"}):s?(0,c.jsxs)("div",{className:"grid grid-cols-3 gap-3",children:[(0,c.jsxs)("div",{className:"text-center",children:[(0,c.jsx)("div",{className:"text-2xl font-bold text-green-400",children:s.allowedCount}),(0,c.jsx)("div",{className:"text-[10px] text-slate-500 uppercase",children:"Allowed"})]}),(0,c.jsxs)("div",{className:"text-center",children:[(0,c.jsx)("div",{className:"text-2xl font-bold text-red-400",children:s.blockedCount}),(0,c.jsx)("div",{className:"text-[10px] text-slate-500 uppercase",children:"Blocked"})]}),(0,c.jsxs)("div",{className:"text-center",children:[(0,c.jsx)("div",{className:"text-2xl font-bold text-yellow-400",children:s.quarantinedCount}),(0,c.jsx)("div",{className:"text-[10px] text-slate-500 uppercase",children:"Quarantined"})]})]}):(0,c.jsx)("div",{className:"text-xs text-slate-500",children:"No data"}),(0,c.jsx)("button",{onClick:()=>nP.useDashboardStore.getState().setViewMode("audit"),className:"mt-3 w-full text-center text-xs text-cyan-400 hover:text-cyan-300 transition-colors py-1",children:"View full audit log →"}),(0,c.jsxs)("div",{className:"mt-2 pt-3 border-t border-slate-800 flex items-center justify-between",children:[(0,c.jsx)("span",{className:"text-xs text-slate-500",children:"Firewall Mode"}),(0,c.jsxs)("div",{className:"relative",ref:d,children:[(0,c.jsxs)("button",{onClick:()=>l(!o),className:`text-xs font-medium ${m.color} ${m.bg} px-2 py-0.5 rounded flex items-center gap-1 hover:opacity-80 transition-opacity`,children:[h,(0,c.jsx)(op,{size:10})]}),o&&(0,c.jsx)("div",{className:"absolute right-0 top-full mt-1 bg-slate-800 border border-slate-700 rounded-lg shadow-xl z-50 min-w-[120px] py-1",children:["strict","balanced","permissive"].map(e=>{let t=of[e];return(0,c.jsxs)("button",{onClick:()=>{a.mutate(e),l(!1)},className:`w-full text-left px-3 py-1.5 text-xs hover:bg-slate-700/50 transition-colors flex items-center justify-between ${e===h?t.color+" font-medium":"text-slate-400"}`,children:[e,e===h&&(0,c.jsx)("span",{className:"text-[10px]",children:"✓"})]},e)})})]})]})]})}function oy(){let{setViewMode:e,projectFilter:t}=(0,nP.useDashboardStore)(),{data:s,isLoading:i,isError:r}=(0,a2.useQuarantine)("pending",3,t||void 0),n=s?.total??0,a=s?.items??[];return(0,c.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,c.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,c.jsx)("h3",{className:"text-sm font-medium text-slate-300",children:"Quarantine Queue"}),n>0&&(0,c.jsxs)("span",{className:"text-xs font-medium text-yellow-400 bg-yellow-400/10 px-2 py-0.5 rounded-full",children:[n," pending"]})]}),i?(0,c.jsx)("div",{className:"text-xs text-slate-500 animate-pulse",children:"Loading..."}):r?(0,c.jsx)("div",{className:"text-xs text-red-400",children:"Failed to load quarantine"}):0===a.length?(0,c.jsxs)("div",{className:"flex flex-col items-center py-6 text-slate-500",children:[(0,c.jsx)(os,{size:24,className:"mb-2 text-slate-600"}),(0,c.jsx)("span",{className:"text-xs",children:"No items in quarantine"})]}):(0,c.jsx)("div",{className:"space-y-2",children:a.map(e=>{let t=(()=>{try{return JSON.parse(e.threat_indicators)}catch{return[]}})();return(0,c.jsxs)("div",{className:"bg-slate-800/50 border border-slate-700 rounded-lg p-3",children:[(0,c.jsxs)("div",{className:"flex items-start justify-between",children:[(0,c.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,c.jsx)("div",{className:"text-xs font-medium text-white truncate",children:e.title||"Untitled"}),(0,c.jsxs)("div",{className:"text-[10px] text-slate-500 mt-0.5",children:[e.source_type," · ",new Date(e.created_at).toLocaleTimeString()]})]}),(0,c.jsx)("span",{className:"text-[10px] text-red-400 bg-red-400/10 px-1.5 py-0.5 rounded shrink-0 ml-2",children:e.reason?.slice(0,30)||"Threat detected"})]}),t.length>0&&(0,c.jsx)("div",{className:"flex gap-1 mt-1.5 flex-wrap",children:t.slice(0,3).map((e,t)=>(0,c.jsx)("span",{className:"text-[9px] text-yellow-400 bg-yellow-400/10 px-1 py-0.5 rounded",children:e},t))})]},e.id)})}),n>0&&(0,c.jsxs)("button",{onClick:()=>e("quarantine"),className:"w-full mt-3 text-xs text-cyan-400 hover:text-cyan-300 transition-colors",children:["Review all ",n," items →"]})]})}function ov({timeRange:e}){let{projectFilter:t}=(0,nP.useDashboardStore)(),s={"24h":24,"7d":168,"30d":720},[i,r]=(0,u.useState)(()=>Date.now());(0,u.useEffect)(()=>{r(Date.now())},[e]);let n=(0,u.useMemo)(()=>new Date(6e4*Math.floor((i-36e5*s[e])/6e4)).toISOString(),[i,e]),{data:a,isLoading:o,isError:l}=(0,a2.useAuditLogs)({startTime:n,project:t||void 0,limit:500}),d=(0,u.useMemo)(()=>{if(!a?.logs.length)return[];let t="24h"===e?36e5:"7d"===e?216e5:864e5,s="24h"===e?24:"7d"===e?28:30,r=Array.from({length:s},(e,r)=>({time:i-(s-1-r)*t,allowed:0,blocked:0,quarantined:0}));for(let e of a.logs){let n=Math.floor((new Date(e.timestamp).getTime()-(i-s*t))/t),a=Math.min(Math.max(n,0),s-1);n>=0&&n<=s&&("ALLOW"===e.firewall_result?r[a].allowed++:"BLOCK"===e.firewall_result?r[a].blocked++:"QUARANTINE"===e.firewall_result&&r[a].quarantined++)}return r},[a,e,i]),h=Math.max(1,...d.map(e=>e.allowed+e.blocked+e.quarantined));return(0,c.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,c.jsx)("h3",{className:"text-sm font-medium text-slate-300 mb-4",children:"Threat Timeline"}),o?(0,c.jsx)("div",{className:"h-32 flex items-center justify-center",children:(0,c.jsx)("div",{className:"text-xs text-slate-500 animate-pulse",children:"Loading timeline..."})}):l?(0,c.jsx)("div",{className:"h-32 flex items-center justify-center",children:(0,c.jsx)("div",{className:"text-xs text-red-400",children:"Failed to load timeline"})}):0===d.length?(0,c.jsx)("div",{className:"h-32 flex items-center justify-center",children:(0,c.jsx)("div",{className:"text-xs text-slate-500",children:"No audit data"})}):(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("div",{className:"flex gap-px h-32",children:d.map((e,t)=>{let s=e.allowed+e.blocked+e.quarantined,i=s>0?e.blocked/s*100:0,r=s>0?e.quarantined/s*100:0;return(0,c.jsx)("div",{className:"flex-1 flex flex-col justify-end",title:`${new Date(e.time).toLocaleString()}: ${e.allowed} allowed, ${e.blocked} blocked, ${e.quarantined} quarantined`,children:(0,c.jsx)("div",{className:"w-full rounded-t-sm overflow-hidden",style:{height:`${Math.max(s/h*100,2*(s>0))}%`},children:(0,c.jsxs)("div",{className:"w-full h-full flex flex-col-reverse",children:[e.blocked>0&&(0,c.jsx)("div",{className:"bg-red-500",style:{height:`${i}%`}}),e.quarantined>0&&(0,c.jsx)("div",{className:"bg-yellow-500",style:{height:`${r}%`}}),(0,c.jsx)("div",{className:"bg-emerald-500/60 flex-1"})]})})},t)})}),(0,c.jsxs)("div",{className:"flex gap-4 mt-3 justify-center",children:[(0,c.jsxs)("div",{className:"flex items-center gap-1",children:[(0,c.jsx)("div",{className:"w-2 h-2 rounded-full bg-emerald-500/60"}),(0,c.jsx)("span",{className:"text-[10px] text-slate-500",children:"Allowed"})]}),(0,c.jsxs)("div",{className:"flex items-center gap-1",children:[(0,c.jsx)("div",{className:"w-2 h-2 rounded-full bg-red-500"}),(0,c.jsx)("span",{className:"text-[10px] text-slate-500",children:"Blocked"})]}),(0,c.jsxs)("div",{className:"flex items-center gap-1",children:[(0,c.jsx)("div",{className:"w-2 h-2 rounded-full bg-yellow-500"}),(0,c.jsx)("span",{className:"text-[10px] text-slate-500",children:"Quarantined"})]})]}),(0,c.jsx)("button",{onClick:()=>nP.useDashboardStore.getState().setViewMode("audit"),className:"mt-3 w-full text-center text-xs text-cyan-400 hover:text-cyan-300 transition-colors py-1",children:"View detailed audit log →"})]})]})}function ob({timeRange:e}){let{projectFilter:t}=(0,nP.useDashboardStore)(),{data:s,isLoading:i,isError:r}=(0,a2.useAuditStats)(e,t||void 0);if(i)return(0,c.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,c.jsx)("h3",{className:"text-sm font-medium text-slate-300 mb-4",children:"Stats Summary"}),(0,c.jsx)("div",{className:"text-xs text-slate-500 animate-pulse",children:"Loading..."})]});if(r)return(0,c.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,c.jsx)("h3",{className:"text-sm font-medium text-slate-300 mb-4",children:"Stats Summary"}),(0,c.jsx)("div",{className:"text-xs text-red-400",children:"Failed to load stats"})]});if(!s)return(0,c.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,c.jsx)("h3",{className:"text-sm font-medium text-slate-300 mb-4",children:"Stats Summary"}),(0,c.jsx)("div",{className:"text-xs text-slate-500",children:"No data"})]});let n=s.totalOperations||1,a=(s.blockedCount/n*100).toFixed(1),o=Object.entries(s.threatBreakdown||{}).sort((e,t)=>t[1]-e[1]).slice(0,5);return(0,c.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,c.jsx)("h3",{className:"text-sm font-medium text-slate-300 mb-4",children:"Stats Summary"}),(0,c.jsxs)("div",{className:"grid grid-cols-2 gap-3 mb-4",children:[(0,c.jsxs)("div",{className:"bg-slate-800/50 rounded-lg p-3 text-center",children:[(0,c.jsx)("div",{className:"text-2xl font-bold text-white",children:s.totalOperations}),(0,c.jsx)("div",{className:"text-[10px] text-slate-500 uppercase",children:"Total Scans"})]}),(0,c.jsxs)("div",{className:"bg-slate-800/50 rounded-lg p-3 text-center",children:[(0,c.jsxs)("div",{className:`text-2xl font-bold ${parseFloat(a)>10?"text-red-400":"text-green-400"}`,children:[a,"%"]}),(0,c.jsx)("div",{className:"text-[10px] text-slate-500 uppercase",children:"Block Rate"})]})]}),s.topSources.length>0&&(0,c.jsxs)("div",{className:"mb-4",children:[(0,c.jsx)("div",{className:"text-[10px] text-slate-500 uppercase mb-2",children:"Top Sources"}),(0,c.jsx)("div",{className:"space-y-1",children:s.topSources.slice(0,3).map(e=>(0,c.jsxs)("div",{className:"flex items-center justify-between",children:[(0,c.jsx)("span",{className:"text-xs text-slate-400",children:e.source}),(0,c.jsx)("span",{className:"text-xs text-slate-500",children:e.count})]},e.source))})]}),o.length>0&&(0,c.jsxs)("div",{children:[(0,c.jsx)("div",{className:"text-[10px] text-slate-500 uppercase mb-2",children:"Threat Types"}),(0,c.jsx)("div",{className:"space-y-1",children:o.map(([e,t])=>(0,c.jsxs)("div",{className:"flex items-center justify-between",children:[(0,c.jsx)("span",{className:"text-xs text-slate-400",children:e}),(0,c.jsx)("span",{className:"text-xs font-medium text-red-400",children:t})]},e))})]}),(0,c.jsx)("button",{onClick:()=>nP.useDashboardStore.getState().setViewMode("audit"),className:"mt-3 w-full text-center text-xs text-cyan-400 hover:text-cyan-300 transition-colors py-1",children:"View full audit log →"})]})}let oj=a9("cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]),ow=a9("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),oN=a9("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),ok=a9("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),oS=a9("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function oC(){let{projectFilter:e}=(0,nP.useDashboardStore)(),{data:t}=(0,a2.useAuditStats)("30d",e||void 0),[s,i]=(0,u.useState)("upsell"),[r,n]=(0,u.useState)(""),[a,o]=(0,u.useState)(null),[l,d]=(0,u.useState)(""),[h,m]=(0,u.useState)(!1);(0,u.useEffect)(()=>{let e=localStorage.getItem("shieldcortex_cloud_dismissed");if(e){let t=new Date(e);(Date.now()-t.getTime())/864e5<30&&i("hidden")}},[]),(0,u.useEffect)(()=>{fetch("http://localhost:3001/api/cloud/config").then(e=>e.json()).then(e=>{e.enabled&&e.apiKeySet&&i("hidden")}).catch(()=>{})},[]),(0,u.useEffect)(()=>{if("polling"!==s||!a)return;let e=setInterval(async()=>{try{let t=await fetch(`https://api.shieldcortex.ai/v1/auth/setup-status/${a}`),s=await t.json();"complete"===s.status&&s.api_key?(await fetch("http://localhost:3001/api/cloud/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cloudApiKey:s.api_key,cloudEnabled:!0,cloudBaseUrl:"https://api.shieldcortex.ai"})}),i("success"),clearInterval(e),setTimeout(()=>i("hidden"),5e3)):"expired"===s.status&&(d("Setup expired. Please try again."),i("upsell"),clearInterval(e))}catch{}},3e3);return()=>clearInterval(e)},[s,a]);let p=async e=>{if(e.preventDefault(),r&&!h){d(""),m(!0);try{let e=await fetch("https://api.shieldcortex.ai/v1/auth/cloud-setup",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:r})}),t=await e.json();t.setup_id?(o(t.setup_id),i("polling")):d(t.error||"Failed to start setup")}catch{d("Could not reach ShieldCortex Cloud. Check your connection.")}finally{m(!1)}}};if("hidden"===s)return null;let x=t?.blockedCount??0,f=t?.totalOperations??0;return(0,c.jsxs)("div",{className:"mt-4 bg-gradient-to-br from-slate-900 via-slate-900 to-cyan-950/30 border border-cyan-800/30 rounded-xl p-5 relative",children:["upsell"===s&&(0,c.jsx)("button",{onClick:()=>{localStorage.setItem("shieldcortex_cloud_dismissed",new Date().toISOString()),i("hidden")},className:"absolute top-3 right-3 text-slate-500 hover:text-slate-300 transition-colors",title:"Dismiss for 30 days",children:(0,c.jsx)(oS,{size:16})}),"upsell"===s&&(0,c.jsxs)("div",{className:"space-y-4",children:[(0,c.jsxs)("div",{className:"flex items-center gap-2",children:[(0,c.jsx)(oj,{size:20,className:"text-cyan-400"}),(0,c.jsx)("h3",{className:"text-sm font-semibold text-white",children:"ShieldCortex Cloud"})]}),(0,c.jsx)("p",{className:"text-sm text-slate-300",children:x>0?`You've blocked ${x} threats across ${f} scans — your team can't see them yet.`:"Sync your defence data to the cloud for team visibility, audit logs, and alerts."}),(0,c.jsxs)("form",{onSubmit:p,className:"flex gap-2",children:[(0,c.jsx)("input",{type:"email",placeholder:"Enter your email",value:r,onChange:e=>n(e.target.value),required:!0,className:"flex-1 bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-sm text-white placeholder:text-slate-500 focus:outline-none focus:ring-1 focus:ring-cyan-500 focus:border-cyan-500"}),(0,c.jsxs)("button",{type:"submit",disabled:h,className:"flex items-center gap-1.5 px-4 py-2 bg-cyan-600 hover:bg-cyan-500 disabled:opacity-50 rounded-lg text-sm font-medium text-white transition-colors",children:[h?(0,c.jsx)(oN,{size:14,className:"animate-spin"}):(0,c.jsx)(ow,{size:14}),"Get Started"]})]}),l&&(0,c.jsx)("p",{className:"text-xs text-red-400",children:l}),(0,c.jsx)("p",{className:"text-[10px] text-slate-500",children:"Free tier: 500 scans/month, 7-day retention. No credit card required."})]}),"polling"===s&&(0,c.jsxs)("div",{className:"flex items-center gap-3 py-2",children:[(0,c.jsx)(oN,{size:20,className:"text-cyan-400 animate-spin"}),(0,c.jsxs)("div",{children:[(0,c.jsx)("p",{className:"text-sm text-white font-medium",children:"Check your email"}),(0,c.jsx)("p",{className:"text-xs text-slate-400",children:"Click the link in your inbox to complete setup. We'll auto-configure everything."})]})]}),"success"===s&&(0,c.jsxs)("div",{className:"flex items-center gap-3 py-2",children:[(0,c.jsx)(ok,{size:20,className:"text-emerald-400"}),(0,c.jsxs)("div",{children:[(0,c.jsx)("p",{className:"text-sm text-white font-medium",children:"Connected to ShieldCortex Cloud"}),(0,c.jsx)("p",{className:"text-xs text-slate-400",children:"Your defence data will now sync automatically."})]})]})]})}function oT(){let e,t,{data:s,isLoading:i}=(0,nD.useQuery)({queryKey:["cloud-sync-status"],queryFn:async()=>{let e=await fetch("http://localhost:3001/api/cloud/sync-status");if(!e.ok)throw Error("Failed to fetch sync status");return e.json()},refetchInterval:1e4});if(i||!s)return null;let{enabled:r,apiKeySet:n,lastSyncAt:a,queue:o}=s;r&&n?o.failed>0?(e="bg-red-500",t=`${o.failed} event${1===o.failed?"":"s"} failed`):o.pending>0?(e="bg-amber-500",t=`${o.pending} event${1===o.pending?"":"s"} pending`):a?(e="bg-emerald-500",t="Cloud sync: OK"):(e="bg-emerald-500",t="Cloud sync: connected"):(e="bg-slate-500",t="Cloud sync: disabled");let l=a?function(e){let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);if(t<60)return`${t}s ago`;let s=Math.floor(t/60);if(s<60)return`${s}m ago`;let i=Math.floor(s/60);if(i<24)return`${i}h ago`;let r=Math.floor(i/24);return`${r}d ago`}(a):null;return(0,c.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 mb-4 bg-slate-800 rounded-lg text-xs w-fit",children:[(0,c.jsx)("span",{className:`inline-block w-2 h-2 rounded-full ${e}`}),(0,c.jsx)("span",{className:"text-slate-300",children:t}),l&&(0,c.jsxs)("span",{className:"text-slate-500",children:["last sync ",l]})]})}let oA=a9("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);var oM=e.i(71921),oP=e.i(88969);let oE=h.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";async function oD(e){let t=await (0,oP.authFetch)(`${oE}/api/skills/scan-all`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({dir:e})});if(!t.ok)throw Error("Failed to scan skills");return t.json()}async function oL(e){let t=await (0,oP.authFetch)(`${oE}/api/skills/scan`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw Error("Failed to scan skill content");return t.json()}function oR(){return(0,oM.useMutation)({mutationFn:e=>oD(e)})}async function oV(e){let t=await (0,oP.authFetch)(`${oE}/api/skills/trust`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e})});if(!t.ok)throw Error("Failed to trust skill");return t.json()}async function oF(e){let t=await (0,oP.authFetch)(`${oE}/api/skills/trust`,{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e})});if(!t.ok)throw Error("Failed to untrust skill");return t.json()}async function o$(e){let t=await (0,oP.authFetch)(`${oE}/api/skills/file`,{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e})});if(!t.ok)throw Error((await t.json().catch(()=>({}))).error||"Failed to delete skill file");return t.json()}function oz(){let e=oR(),{setViewMode:t}=(0,nP.useDashboardStore)(),[s,i]=(0,u.useState)(null),r=s?s.files.filter(e=>e.safe).length:0,n=s?.threatCount??0;return(0,c.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,c.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,c.jsx)("h3",{className:"text-sm font-medium text-slate-300",children:"Skill Scanner"}),(0,c.jsxs)("button",{onClick:()=>{e.mutate(void 0,{onSuccess:e=>i(e)})},disabled:e.isPending,className:"flex items-center gap-1.5 px-3 py-1.5 bg-cyan-600 hover:bg-cyan-500 disabled:opacity-50 rounded-lg text-xs font-medium text-white transition-colors",children:[e.isPending?(0,c.jsx)(oN,{size:12,className:"animate-spin"}):(0,c.jsx)(oo,{size:12}),"Scan All"]})]}),s?(0,c.jsxs)("div",{children:[(0,c.jsxs)("div",{className:"flex items-center gap-4 mb-3",children:[(0,c.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,c.jsx)(ok,{size:14,className:"text-green-400"}),(0,c.jsx)("span",{className:"text-sm font-medium text-green-400",children:r}),(0,c.jsx)("span",{className:"text-[10px] text-slate-500",children:"safe"})]}),n>0&&(0,c.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,c.jsx)(oA,{size:14,className:"text-red-400"}),(0,c.jsx)("span",{className:"text-sm font-medium text-red-400",children:n}),(0,c.jsx)("span",{className:"text-[10px] text-slate-500",children:"threats"})]}),(0,c.jsx)("span",{className:"text-[10px] text-slate-600",children:new Date(s.scannedAt).toLocaleTimeString()})]}),(0,c.jsxs)("button",{onClick:()=>t("skills"),className:"flex items-center gap-1 text-xs text-cyan-400 hover:text-cyan-300 transition-colors",children:["View all results",(0,c.jsx)(ow,{size:12})]})]}):e.isPending?(0,c.jsx)("div",{className:"flex items-center justify-center py-4",children:(0,c.jsx)(oN,{size:16,className:"text-cyan-400 animate-spin"})}):(0,c.jsxs)("div",{className:"text-center py-3",children:[(0,c.jsx)(oo,{size:20,className:"text-slate-600 mx-auto mb-1.5"}),(0,c.jsx)("p",{className:"text-[10px] text-slate-500",children:"Scan agent instruction files for threats"})]})]})}let o_=h.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";async function oI(){let e=await fetch(`${o_}/api/iron-dome/status`);if(!e.ok)throw Error("Failed to fetch Iron Dome status");return e.json()}async function oO(e){let t=await (0,oP.authFetch)(`${o_}/api/iron-dome/activate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({profile:e})});if(!t.ok)throw Error("Failed to activate Iron Dome");return t.json()}async function oB(){let e=await (0,oP.authFetch)(`${o_}/api/iron-dome/deactivate`,{method:"POST"});if(!e.ok)throw Error("Failed to deactivate Iron Dome");return e.json()}async function oU(e){let t=await (0,oP.authFetch)(`${o_}/api/iron-dome/scan`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:e})});if(!t.ok)throw Error("Failed to scan text");return t.json()}async function oW(e){let t=new URLSearchParams;e&&t.set("limit",e.toString());let s=await fetch(`${o_}/api/iron-dome/audit?${t}`);if(!s.ok)throw Error("Failed to fetch Iron Dome audit");return s.json()}function oq(){return(0,nD.useQuery)({queryKey:["iron-dome-status"],queryFn:oI,refetchInterval:3e4,retry:2})}function oK(e){return(0,nD.useQuery)({queryKey:["iron-dome-audit",e],queryFn:()=>oW(e),refetchInterval:3e4,retry:2})}function oH(){let{data:e,isLoading:t}=oq(),{data:s}=oK(100),i=e?.enabled??!1,r=e?.profile??"custom",n=Date.now()-864e5,a=(s?.logs??[]).filter(e=>new Date(e.timestamp).getTime()>n),o=a.filter(e=>e.reason?.includes("[iron-dome:")&&"BLOCK"===e.firewall_result).length,l=a.length;return(0,c.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,c.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,c.jsx)("h3",{className:"text-sm font-medium text-slate-300",children:"Iron Dome"}),(0,c.jsx)("span",{className:`text-[10px] font-medium px-2 py-0.5 rounded-full ${i?"bg-red-500/20 text-red-400 border border-red-500/30":"bg-slate-700/50 text-slate-500"}`,children:i?"ACTIVE":"INACTIVE"})]}),t?(0,c.jsx)("div",{className:"text-xs text-slate-500 animate-pulse",children:"Loading..."}):i?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsxs)("div",{className:"text-xs text-slate-500 mb-3",children:["Profile: ",(0,c.jsx)("span",{className:"text-red-400 font-medium",children:r})]}),(0,c.jsxs)("div",{className:"grid grid-cols-2 gap-3 mb-3",children:[(0,c.jsxs)("div",{className:"bg-slate-800/50 rounded-lg p-2 text-center",children:[(0,c.jsx)("div",{className:"text-lg font-bold text-red-400",children:o}),(0,c.jsx)("div",{className:"text-[10px] text-slate-500 uppercase",children:"Blocks"})]}),(0,c.jsxs)("div",{className:"bg-slate-800/50 rounded-lg p-2 text-center",children:[(0,c.jsx)("div",{className:"text-lg font-bold text-slate-300",children:l}),(0,c.jsx)("div",{className:"text-[10px] text-slate-500 uppercase",children:"Events"})]})]})]}):(0,c.jsxs)("div",{className:"text-center py-3",children:[(0,c.jsx)(oe,{size:20,className:"text-slate-600 mx-auto mb-1.5"}),(0,c.jsx)("p",{className:"text-[10px] text-slate-500",children:"Behaviour protection layer — not active"})]}),(0,c.jsx)("button",{onClick:()=>nP.useDashboardStore.getState().setViewMode("dome"),className:"w-full text-center text-xs text-red-400 hover:text-red-300 transition-colors py-1",children:"View Iron Dome →"})]})}let oY="http://localhost:3001";function oX(){return(0,nD.useQuery)({queryKey:["cloud-config"],queryFn:async()=>{let e=await (0,oP.authFetch)(`${oY}/api/cloud/config`);if(!e.ok)throw Error("Failed to fetch cloud config");return e.json()},refetchInterval:3e4})}function oG(e,t,s){return Math.max(t,Math.min(s,e))}function oQ(){let e,{data:t,isLoading:s}=oX(),i=(e=(0,aZ.useQueryClient)(),(0,oM.useMutation)({mutationFn:async e=>{let t=await (0,oP.authFetch)(`${oY}/api/cloud/config`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw Error("Failed to update cloud config");return t.json()},onSuccess:()=>{e.invalidateQueries({queryKey:["cloud-config"]})}})),[r,n]=(0,u.useState)(!1),[a,o]=(0,u.useState)(!0),[l,d]=(0,u.useState)("0.88"),[h,m]=(0,u.useState)("300");(0,u.useEffect)(()=>{let e=t?.openclawMemory;e&&(n(e.autoMemory),o(e.dedupe),d(String(e.noveltyThreshold)),m(String(e.maxRecent)))},[t]);let p=i.isPending;return(0,c.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,c.jsx)("h3",{className:"text-sm font-medium text-slate-300",children:"OpenClaw Memory"}),(0,c.jsx)("p",{className:"text-xs text-slate-500 mt-1",children:"Configure how ShieldCortex complements native OpenClaw memory."}),(0,c.jsx)("p",{className:"text-[11px] text-slate-600 mt-1",children:"Changes apply on next OpenClaw gateway restart."}),s?(0,c.jsx)("div",{className:"text-xs text-slate-500 mt-4 animate-pulse",children:"Loading settings..."}):(0,c.jsxs)("div",{className:"mt-4 space-y-3",children:[(0,c.jsxs)("div",{className:"flex items-center justify-between",children:[(0,c.jsx)("span",{className:"text-xs text-slate-400",children:"Auto-memory extraction"}),(0,c.jsx)("button",{type:"button",onClick:()=>n(!r),className:`h-6 w-11 rounded-full transition-colors ${r?"bg-cyan-500":"bg-slate-700"}`,children:(0,c.jsx)("span",{className:`block h-5 w-5 rounded-full bg-white transition-transform ${r?"translate-x-5":"translate-x-0.5"}`})})]}),(0,c.jsxs)("div",{className:"flex items-center justify-between",children:[(0,c.jsx)("span",{className:"text-xs text-slate-400",children:"Novelty dedupe"}),(0,c.jsx)("button",{type:"button",onClick:()=>o(!a),disabled:!r,className:`h-6 w-11 rounded-full transition-colors ${a&&r?"bg-emerald-500":"bg-slate-700"} ${!r?"opacity-50 cursor-not-allowed":""}`,children:(0,c.jsx)("span",{className:`block h-5 w-5 rounded-full bg-white transition-transform ${a&&r?"translate-x-5":"translate-x-0.5"}`})})]}),(0,c.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,c.jsxs)("div",{children:[(0,c.jsx)("label",{className:"block text-[11px] text-slate-500 mb-1",children:"Novelty threshold"}),(0,c.jsx)(aH,{type:"number",step:"0.01",min:.6,max:.99,value:l,disabled:!r||!a,onChange:e=>d(e.target.value),className:"h-8 text-xs bg-slate-800 border-slate-700"})]}),(0,c.jsxs)("div",{children:[(0,c.jsx)("label",{className:"block text-[11px] text-slate-500 mb-1",children:"Max recent records"}),(0,c.jsx)(aH,{type:"number",step:"1",min:50,max:1e3,value:h,disabled:!r||!a,onChange:e=>m(e.target.value),className:"h-8 text-xs bg-slate-800 border-slate-700"})]})]}),(0,c.jsxs)("div",{className:"flex items-center justify-between pt-1",children:[(0,c.jsx)("span",{className:"text-[11px] text-slate-500",children:"Default: dedupe on, threshold 0.88, max 300"}),(0,c.jsxs)(aK,{size:"sm",onClick:()=>{let e=oG(Number.parseFloat(l),.6,.99),t=Math.floor(oG(Number.parseInt(h,10),50,1e3));i.mutate({openclawAutoMemory:r,openclawAutoMemoryDedupe:a,openclawAutoMemoryNoveltyThreshold:Number.isFinite(e)?e:.88,openclawAutoMemoryMaxRecent:Number.isFinite(t)?t:300})},disabled:p,className:"h-8 text-xs bg-cyan-600 hover:bg-cyan-500 text-white",children:[p?(0,c.jsx)(oN,{size:12,className:"animate-spin"}):null,"Save"]})]})]})]})}function oJ(){let[e,t]=(0,u.useState)("24h");return(0,c.jsxs)("div",{className:"h-full overflow-y-auto p-6",children:[(0,c.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,c.jsx)("h2",{className:"text-lg font-semibold text-white",children:"Defence Overview"}),(0,c.jsx)("div",{className:"flex gap-1 bg-slate-800 rounded-lg p-0.5",children:["24h","7d","30d"].map(s=>(0,c.jsx)("button",{onClick:()=>t(s),className:`px-3 py-1 text-xs rounded-md transition-colors ${e===s?"bg-cyan-600 text-white":"text-slate-400 hover:text-white"}`,children:s},s))})]}),(0,c.jsx)(oT,{}),(0,c.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[(0,c.jsx)(og,{timeRange:e}),(0,c.jsx)(oy,{}),(0,c.jsx)(ov,{timeRange:e}),(0,c.jsx)(ob,{timeRange:e})]}),(0,c.jsx)("div",{className:"mt-4",children:(0,c.jsx)(oz,{})}),(0,c.jsx)("div",{className:"mt-4",children:(0,c.jsx)(oH,{})}),(0,c.jsx)("div",{className:"mt-4",children:(0,c.jsx)(oQ,{})}),(0,c.jsx)(oC,{})]})}let oZ={ALLOW:"bg-green-500/10 text-green-400",BLOCK:"bg-red-500/10 text-red-400",QUARANTINE:"bg-yellow-500/10 text-yellow-400"};function o0(){let{projectFilter:e,selectedAuditEntry:t,setSelectedAuditEntry:s}=(0,nP.useDashboardStore)(),[i,r]=(0,u.useState)("24h"),[n,a]=(0,u.useState)(void 0),[o,l]=(0,u.useState)(void 0),d={"24h":24,"7d":168,"30d":720},[h,m]=(0,u.useState)(()=>Date.now());(0,u.useEffect)(()=>{m(Date.now())},[i]);let p=(0,u.useMemo)(()=>new Date(6e4*Math.floor((h-36e5*d[i])/6e4)).toISOString(),[h,i]),{data:x,isLoading:f}=(0,a2.useAuditLogs)({startTime:p,source:n,firewallResult:o,project:e||void 0,limit:200}),g=x?.logs??[],y=(0,u.useCallback)(e=>{if(!t||0===g.length)return;let i=g.findIndex(e=>e.id===t.id);"Escape"===e.key?s(null):"ArrowDown"===e.key&&i<g.length-1?(e.preventDefault(),s(g[i+1])):"ArrowUp"===e.key&&i>0&&(e.preventDefault(),s(g[i-1]))},[t,g,s]);return(0,u.useEffect)(()=>(window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)),[y]),(0,c.jsxs)("div",{className:"h-full flex flex-col overflow-hidden",children:[(0,c.jsxs)("div",{className:"p-4 border-b border-slate-800 shrink-0",children:[(0,c.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,c.jsx)("h2",{className:"text-lg font-semibold text-white",children:"Audit Log"}),(0,c.jsx)("div",{className:"flex gap-1 bg-slate-800 rounded-lg p-0.5",children:["24h","7d","30d"].map(e=>(0,c.jsx)("button",{onClick:()=>r(e),className:`px-3 py-1 text-xs rounded-md transition-colors ${i===e?"bg-cyan-600 text-white":"text-slate-400 hover:text-white"}`,children:e},e))})]}),(0,c.jsxs)("div",{className:"flex gap-2",children:[(0,c.jsxs)("select",{value:o||"",onChange:e=>l(e.target.value||void 0),className:"bg-slate-800 border border-slate-700 text-white text-xs rounded-lg px-2 py-1",children:[(0,c.jsx)("option",{value:"",children:"All Results"}),(0,c.jsx)("option",{value:"ALLOW",children:"Allowed"}),(0,c.jsx)("option",{value:"BLOCK",children:"Blocked"}),(0,c.jsx)("option",{value:"QUARANTINE",children:"Quarantined"})]}),(0,c.jsxs)("select",{value:n||"",onChange:e=>a(e.target.value||void 0),className:"bg-slate-800 border border-slate-700 text-white text-xs rounded-lg px-2 py-1",children:[(0,c.jsx)("option",{value:"",children:"All Sources"}),(0,c.jsx)("option",{value:"hook",children:"Hook"}),(0,c.jsx)("option",{value:"api",children:"API"}),(0,c.jsx)("option",{value:"agent",children:"Agent"}),(0,c.jsx)("option",{value:"user",children:"User"}),(0,c.jsx)("option",{value:"cli",children:"CLI"})]}),(0,c.jsxs)("span",{className:"text-xs text-slate-500 self-center ml-auto",children:[g.length," entries"]})]})]}),(0,c.jsx)("div",{className:"flex-1 overflow-y-auto",children:f?(0,c.jsx)("div",{className:"flex items-center justify-center h-32",children:(0,c.jsx)("div",{className:"text-xs text-slate-500 animate-pulse",children:"Loading audit logs..."})}):0===g.length?(0,c.jsx)("div",{className:"flex items-center justify-center h-32",children:(0,c.jsx)("div",{className:"text-xs text-slate-500",children:"No audit entries for this period"})}):(0,c.jsxs)("table",{className:"w-full text-xs",children:[(0,c.jsx)("thead",{className:"sticky top-0 bg-slate-900",children:(0,c.jsxs)("tr",{className:"border-b border-slate-800",children:[(0,c.jsx)("th",{className:"text-left text-slate-500 font-medium px-4 py-2",children:"Time"}),(0,c.jsx)("th",{className:"text-left text-slate-500 font-medium px-4 py-2",children:"Source"}),(0,c.jsx)("th",{className:"text-left text-slate-500 font-medium px-4 py-2",children:"Result"}),(0,c.jsx)("th",{className:"text-left text-slate-500 font-medium px-4 py-2",children:"Trust"}),(0,c.jsx)("th",{className:"text-left text-slate-500 font-medium px-4 py-2",children:"Anomaly"}),(0,c.jsx)("th",{className:"text-left text-slate-500 font-medium px-4 py-2",children:"Reason"})]})}),(0,c.jsx)("tbody",{children:g.map(e=>(0,c.jsxs)("tr",{onClick:()=>{s(t?.id===e.id?null:e)},className:`border-b border-slate-800/50 cursor-pointer transition-colors ${t?.id===e.id?"bg-cyan-500/10 hover:bg-cyan-500/15":"hover:bg-slate-800/30"}`,children:[(0,c.jsx)("td",{className:"px-4 py-2 text-slate-400 whitespace-nowrap",children:new Date(e.timestamp).toLocaleString()}),(0,c.jsx)("td",{className:"px-4 py-2 text-slate-300",children:e.source_type}),(0,c.jsx)("td",{className:"px-4 py-2",children:(0,c.jsx)("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-medium ${oZ[e.firewall_result]||"text-slate-400"}`,children:e.firewall_result})}),(0,c.jsx)("td",{className:"px-4 py-2 text-slate-400",children:e.trust_score.toFixed(1)}),(0,c.jsx)("td",{className:"px-4 py-2",children:(0,c.jsx)("span",{className:e.anomaly_score>.5?"text-red-400":e.anomaly_score>.2?"text-yellow-400":"text-slate-400",children:e.anomaly_score.toFixed(2)})}),(0,c.jsx)("td",{className:"px-4 py-2 text-slate-400 max-w-xs truncate",children:e.reason||"—"})]},e.id))})]})})]})}let o1={ALLOW:{color:"#22C55E",bg:"rgba(34, 197, 94, 0.15)",label:"Allowed"},BLOCK:{color:"#EF4444",bg:"rgba(239, 68, 68, 0.15)",label:"Blocked"},QUARANTINE:{color:"#EAB308",bg:"rgba(234, 179, 8, 0.15)",label:"Quarantined"}},o5={PUBLIC:{color:"#94a3b8",bg:"rgba(148, 163, 184, 0.15)"},INTERNAL:{color:"#60a5fa",bg:"rgba(96, 165, 250, 0.15)"},CONFIDENTIAL:{color:"#f59e0b",bg:"rgba(245, 158, 11, 0.15)"},RESTRICTED:{color:"#ef4444",bg:"rgba(239, 68, 68, 0.15)"}},o4={instruction_injection:{color:"#ef4444",bg:"rgba(239, 68, 68, 0.15)"},privilege_escalation:{color:"#ef4444",bg:"rgba(239, 68, 68, 0.15)"},credential_leak:{color:"#ef4444",bg:"rgba(239, 68, 68, 0.15)"},encoding_obfuscation:{color:"#f59e0b",bg:"rgba(245, 158, 11, 0.15)"},fragmented_payload:{color:"#f59e0b",bg:"rgba(245, 158, 11, 0.15)"},external_url:{color:"#f59e0b",bg:"rgba(245, 158, 11, 0.15)"},pipeline_error:{color:"#94a3b8",bg:"rgba(148, 163, 184, 0.15)"}};function o2(e){return e>=.7?"#22C55E":e>=.4?"#EAB308":"#EF4444"}function o3(e){return e>.5?"#EF4444":e>.2?"#EAB308":"#94a3b8"}function o6({entry:e,onClose:t,onViewMemory:s}){let[i,r]=(0,u.useState)(!1),n=o1[e.firewall_result]||o1.ALLOW,a=o5[e.sensitivity_level]||o5.PUBLIC,o=function(e){try{let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}(e.threat_indicators),l=function(e){try{let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}(e.blocked_patterns),d=(0,u.useCallback)(()=>{let t=JSON.stringify(e,null,2);navigator.clipboard.writeText(t).then(()=>{r(!0),setTimeout(()=>r(!1),1500)})},[e]);return(0,c.jsxs)(aL,{className:"bg-slate-900 border-slate-700 h-full overflow-auto",children:[(0,c.jsxs)(aR,{className:"border-b border-slate-700 pb-3",children:[(0,c.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,c.jsxs)("div",{className:"flex items-center gap-3",children:[(0,c.jsx)("span",{className:"px-2.5 py-1 rounded-md text-xs font-bold",style:{backgroundColor:n.bg,color:n.color},children:n.label}),(0,c.jsx)("span",{className:"px-2 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:a.bg,color:a.color},children:e.sensitivity_level})]}),(0,c.jsx)(aK,{variant:"ghost",size:"sm",onClick:t,className:"text-slate-400 hover:text-white -mt-1",children:"✕"})]}),(0,c.jsx)("div",{className:"text-xs text-slate-400 mt-2",children:new Date(e.timestamp).toLocaleString()}),e.project&&(0,c.jsxs)("div",{className:"text-[10px] text-slate-500 mt-1",children:["Project: ",e.project]})]}),(0,c.jsxs)(aF,{className:"p-4 space-y-4",children:[(0,c.jsxs)("div",{children:[(0,c.jsx)("h4",{className:"text-xs font-medium text-slate-400 mb-2",children:"Source"}),(0,c.jsxs)("div",{className:"bg-slate-800 rounded-lg p-3",children:[(0,c.jsx)("div",{className:"flex items-center gap-2 mb-1",children:(0,c.jsx)("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium bg-cyan-500/10 text-cyan-400",children:e.source_type})}),e.source_identifier&&(0,c.jsx)("div",{className:"text-xs text-slate-300 mt-1 font-mono break-all",children:e.source_identifier})]})]}),(0,c.jsxs)("div",{children:[(0,c.jsx)("h4",{className:"text-xs font-medium text-slate-400 mb-2",children:"Scores"}),(0,c.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,c.jsxs)("div",{className:"bg-slate-800 rounded-lg p-3",children:[(0,c.jsx)("div",{className:"text-[10px] text-slate-500",children:"Trust"}),(0,c.jsxs)("div",{className:"text-lg font-bold",style:{color:o2(e.trust_score)},children:[(100*e.trust_score).toFixed(0),"%"]}),(0,c.jsx)("div",{className:"mt-1 h-1.5 bg-slate-700 rounded-full overflow-hidden",children:(0,c.jsx)("div",{className:"h-full rounded-full transition-all",style:{width:`${100*e.trust_score}%`,backgroundColor:o2(e.trust_score)}})})]}),(0,c.jsxs)("div",{className:"bg-slate-800 rounded-lg p-3",children:[(0,c.jsx)("div",{className:"text-[10px] text-slate-500",children:"Anomaly"}),(0,c.jsxs)("div",{className:"text-lg font-bold",style:{color:o3(e.anomaly_score)},children:[(100*e.anomaly_score).toFixed(0),"%"]}),(0,c.jsx)("div",{className:"mt-1 h-1.5 bg-slate-700 rounded-full overflow-hidden",children:(0,c.jsx)("div",{className:"h-full rounded-full transition-all",style:{width:`${100*e.anomaly_score}%`,backgroundColor:o3(e.anomaly_score)}})})]}),null!==e.fragmentation_score&&(0,c.jsxs)("div",{className:"bg-slate-800 rounded-lg p-3",children:[(0,c.jsx)("div",{className:"text-[10px] text-slate-500",children:"Fragmentation"}),(0,c.jsxs)("div",{className:"text-lg font-bold text-slate-300",children:[(100*e.fragmentation_score).toFixed(0),"%"]}),(0,c.jsx)("div",{className:"mt-1 h-1.5 bg-slate-700 rounded-full overflow-hidden",children:(0,c.jsx)("div",{className:"h-full rounded-full bg-purple-500 transition-all",style:{width:`${100*e.fragmentation_score}%`}})})]}),null!==e.pipeline_duration_ms&&(0,c.jsxs)("div",{className:"bg-slate-800 rounded-lg p-3",children:[(0,c.jsx)("div",{className:"text-[10px] text-slate-500",children:"Pipeline"}),(0,c.jsxs)("div",{className:"text-lg font-bold text-slate-300",children:[e.pipeline_duration_ms,"ms"]})]})]})]}),(0,c.jsxs)("div",{children:[(0,c.jsx)("h4",{className:"text-xs font-medium text-slate-400 mb-2",children:"Threat Indicators"}),o.length>0?(0,c.jsx)("div",{className:"flex flex-wrap gap-1.5",children:o.map((e,t)=>{let s=o4[e]||{color:"#94a3b8",bg:"rgba(148, 163, 184, 0.15)"};return(0,c.jsx)("span",{className:"px-2 py-1 rounded text-[11px] font-medium",style:{backgroundColor:s.bg,color:s.color},children:e.replace(/_/g," ")},t)})}):(0,c.jsx)("div",{className:"text-xs text-slate-600",children:"No threats detected"})]}),l.length>0&&(0,c.jsxs)("div",{children:[(0,c.jsx)("h4",{className:"text-xs font-medium text-slate-400 mb-2",children:"Blocked Patterns"}),(0,c.jsx)("div",{className:"bg-slate-800 rounded-lg p-3 max-h-32 overflow-y-auto",children:l.map((e,t)=>(0,c.jsx)("div",{className:"text-[11px] text-slate-300 font-mono break-all mb-1 last:mb-0",children:e},t))})]}),e.reason&&(0,c.jsxs)("div",{children:[(0,c.jsx)("h4",{className:"text-xs font-medium text-slate-400 mb-2",children:"Reason"}),(0,c.jsx)("div",{className:"bg-slate-800 rounded-lg p-3",children:(0,c.jsx)("p",{className:"text-xs text-slate-300 whitespace-pre-wrap leading-relaxed",children:e.reason})})]}),(0,c.jsxs)("div",{className:"flex gap-2 pt-2",children:[e.memory_id&&s&&(0,c.jsx)(aK,{variant:"default",size:"sm",onClick:()=>s(e.memory_id),className:"flex-1 bg-blue-600 hover:bg-blue-700",children:"View Memory"}),(0,c.jsx)(aK,{variant:"outline",size:"sm",onClick:d,className:`flex-1 border-slate-700 transition-all ${i?"bg-green-600/20 text-green-400 border-green-600/50":"text-slate-300 hover:text-white"}`,children:i?"Copied":"Copy JSON"})]})]})]})}let o8=a9("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);function o7({action:e,item:t,onConfirm:s,onCancel:i}){let[r,n]=(0,u.useState)(""),a="yes"===r.trim().toLowerCase();return(0,c.jsx)("div",{className:"fixed inset-0 bg-black/60 flex items-center justify-center z-50",children:(0,c.jsxs)("div",{className:"bg-slate-900 border border-slate-700 rounded-xl p-6 max-w-md w-full mx-4",children:[(0,c.jsxs)("h3",{className:"text-sm font-semibold text-white mb-2",children:["approve"===e?"Approve":"Reject"," quarantined item?"]}),(0,c.jsx)("p",{className:"text-xs text-slate-400 mb-1",children:(0,c.jsx)("strong",{children:t.title||"Untitled"})}),(0,c.jsx)("p",{className:"text-xs text-slate-500 mb-4",children:"approve"===e?"This will store the memory in the database.":"This will permanently discard the memory."}),(0,c.jsxs)("div",{className:"mb-4",children:[(0,c.jsxs)("label",{className:"text-xs text-slate-400 block mb-1",children:["Type ",(0,c.jsx)("strong",{className:"text-white",children:"YES"})," to confirm:"]}),(0,c.jsx)("input",{type:"text",value:r,onChange:e=>n(e.target.value),className:"w-full bg-slate-800 border border-slate-700 text-white text-sm rounded-lg px-3 py-2 focus:ring-cyan-500 focus:border-cyan-500",autoFocus:!0,onKeyDown:e=>{"Enter"===e.key&&a&&s(),"Escape"===e.key&&i()}})]}),(0,c.jsxs)("div",{className:"flex gap-2 justify-end",children:[(0,c.jsx)("button",{onClick:i,className:"px-3 py-1.5 text-xs text-slate-400 hover:text-white transition-colors",children:"Cancel"}),(0,c.jsx)("button",{onClick:s,disabled:!a,className:`px-3 py-1.5 text-xs rounded-lg transition-colors ${a?"approve"===e?"bg-green-600 text-white hover:bg-green-500":"bg-red-600 text-white hover:bg-red-500":"bg-slate-700 text-slate-500 cursor-not-allowed"}`,children:"approve"===e?"Approve":"Reject"})]})]})})}function o9(){let{projectFilter:e}=(0,nP.useDashboardStore)(),[t,s]=(0,u.useState)("pending"),{data:i,isLoading:r}=(0,a2.useQuarantine)(t,100,e||void 0),n=(0,a2.useApproveQuarantine)(),a=(0,a2.useRejectQuarantine)(),[o,l]=(0,u.useState)(null),d=i?.items??[];return(0,c.jsxs)("div",{className:"h-full flex flex-col overflow-hidden",children:[o&&(0,c.jsx)(o7,{action:o.action,item:o.item,onConfirm:()=>{o&&("approve"===o.action?n.mutate(o.item.id):a.mutate({id:o.item.id}),l(null))},onCancel:()=>l(null)}),(0,c.jsx)("div",{className:"p-4 border-b border-slate-800 shrink-0",children:(0,c.jsxs)("div",{className:"flex items-center justify-between",children:[(0,c.jsx)("h2",{className:"text-lg font-semibold text-white",children:"Quarantine Review"}),(0,c.jsx)("div",{className:"flex gap-1 bg-slate-800 rounded-lg p-0.5",children:["pending","approved","rejected"].map(e=>(0,c.jsx)("button",{onClick:()=>s(e),className:`px-3 py-1 text-xs rounded-md transition-colors capitalize ${t===e?"bg-cyan-600 text-white":"text-slate-400 hover:text-white"}`,children:e},e))})]})}),(0,c.jsx)("div",{className:"flex-1 overflow-y-auto p-4",children:r?(0,c.jsx)("div",{className:"flex items-center justify-center h-32",children:(0,c.jsx)("div",{className:"text-xs text-slate-500 animate-pulse",children:"Loading quarantine items..."})}):0===d.length?(0,c.jsxs)("div",{className:"flex flex-col items-center justify-center h-32 text-slate-500",children:[(0,c.jsx)(os,{size:24,className:"mb-2 text-slate-600"}),(0,c.jsxs)("span",{className:"text-xs",children:["No ",t," items"]})]}):(0,c.jsx)("div",{className:"space-y-3",children:d.map(e=>{let t=(()=>{try{return JSON.parse(e.threat_indicators)}catch{return[]}})();return(0,c.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,c.jsxs)("div",{className:"flex items-start justify-between mb-2",children:[(0,c.jsxs)("div",{children:[(0,c.jsx)("h4",{className:"text-sm font-medium text-white",children:e.title||"Untitled"}),(0,c.jsxs)("div",{className:"text-[10px] text-slate-500 mt-0.5",children:[e.source_type," · ",new Date(e.created_at).toLocaleString(),e.anomaly_score>0&&(0,c.jsxs)("span",{className:`ml-2 ${e.anomaly_score>.5?"text-red-400":"text-yellow-400"}`,children:["Anomaly: ",e.anomaly_score.toFixed(2)]})]})]}),(0,c.jsx)("span",{className:"text-[10px] text-red-400 bg-red-400/10 px-2 py-0.5 rounded",children:e.reason?.slice(0,50)||"Threat detected"})]}),(0,c.jsx)("div",{className:"bg-slate-800/50 rounded-lg p-3 mb-3 text-xs text-slate-300 max-h-24 overflow-y-auto whitespace-pre-wrap",children:e.content?.slice(0,500)||"No content"}),t.length>0&&(0,c.jsx)("div",{className:"flex gap-1 mb-3 flex-wrap",children:t.map((e,t)=>(0,c.jsx)("span",{className:"text-[9px] text-yellow-400 bg-yellow-400/10 px-1.5 py-0.5 rounded",children:e},t))}),"pending"===e.status&&(0,c.jsxs)("div",{className:"flex gap-2",children:[(0,c.jsxs)("button",{onClick:()=>l({action:"approve",item:e}),className:"flex items-center gap-1 px-3 py-1.5 text-xs bg-green-600/10 text-green-400 rounded-lg hover:bg-green-600/20 transition-colors",children:[(0,c.jsx)(o8,{size:12})," Approve"]}),(0,c.jsxs)("button",{onClick:()=>l({action:"reject",item:e}),className:"flex items-center gap-1 px-3 py-1.5 text-xs bg-red-600/10 text-red-400 rounded-lg hover:bg-red-600/20 transition-colors",children:[(0,c.jsx)(oS,{size:12})," Reject"]})]}),e.reviewed_at&&(0,c.jsxs)("div",{className:"text-[10px] text-slate-500",children:["approved"===e.status?"Approved":"Rejected"," by ",e.reviewed_by," at ",new Date(e.reviewed_at).toLocaleString()]})]},e.id)})})})]})}let le=a9("funnel",[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]]),lt=a9("arrow-up-down",[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]]),ls=a9("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),li=h.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";async function lr(e,t){let s=new URLSearchParams({timeRange:e});t&&s.set("project",t);let i=await fetch(`${li}/api/v1/agents?${s}`);if(!i.ok)throw Error("Failed to fetch agent registry");return i.json()}async function ln(e,t,s){let i=encodeURIComponent(e),r=new URLSearchParams({timeRange:t});s&&r.set("project",s);let n=await fetch(`${li}/api/v1/agents/${i}/timeline?${r}`);if(!n.ok)throw Error("Failed to fetch agent timeline");return n.json()}async function la(e,t){let s=encodeURIComponent(e),i=new URLSearchParams;t?.limit&&i.set("limit",t.limit.toString()),t?.offset&&i.set("offset",t.offset.toString()),t?.firewallResult&&i.set("firewallResult",t.firewallResult),t?.project&&i.set("project",t.project);let r=await fetch(`${li}/api/v1/agents/${s}/operations?${i}`);if(!r.ok)throw Error("Failed to fetch agent operations");return r.json()}function lo(e,t){return(0,nD.useQuery)({queryKey:["agent-operations",e,t],queryFn:()=>la(e,t),enabled:!!e,refetchInterval:3e4,retry:2})}function ll(e){return e>=.7?"full":e>=.5?"limited":"restricted"}let ld={full:"text-green-400",limited:"text-yellow-400",restricted:"text-red-400"},lc={full:"bg-green-500/10",limited:"bg-yellow-500/10",restricted:"bg-red-500/10"},lu={full:"Full Access",limited:"Limited",restricted:"Restricted"},lh=460,lm=90;function lp({identifier:e,timeRange:t}){let{data:s,isLoading:i}=function(e,t="24h",s){return(0,nD.useQuery)({queryKey:["agent-timeline",e,t,void 0],queryFn:()=>ln(e,t,void 0),enabled:!!e,refetchInterval:3e4,retry:2})}(e,t),r=s?.points??[],{linePath:n,dots:a,xLabels:o}=(0,u.useMemo)(()=>{if(0===r.length)return{linePath:"",dots:[],xLabels:[]};let e=r.map(e=>new Date(e.timestamp).getTime()),s=Math.min(...e),i=Math.max(...e)-s||1,n=e=>30+(e-s)/i*lh,a=e=>10+(1-e)*lm,o=r.map((t,s)=>{let i=n(e[s]),r=a(t.trust_score);return`${0===s?"M":"L"} ${i} ${r}`}),l=r.map((t,s)=>({x:n(e[s]),y:a(t.trust_score),result:t.firewall_result,score:t.trust_score,time:t.timestamp})).filter(e=>"ALLOW"!==e.result),d=Math.min(5,r.length),c=[];for(let e=0;e<d;e++){let r=s+i*e/(d-1||1),a=new Date(r);c.push({x:n(r),label:"24h"===t?a.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):a.toLocaleDateString([],{month:"short",day:"numeric"})})}return{linePath:o.join(" "),dots:l,xLabels:c}},[r,t]);return i?(0,c.jsx)("div",{className:"h-[120px] flex items-center justify-center text-slate-500 text-xs",children:"Loading timeline..."}):0===r.length?(0,c.jsx)("div",{className:"h-[120px] flex items-center justify-center text-slate-500 text-xs",children:"No data for this time range."}):(0,c.jsxs)("svg",{viewBox:"0 0 500 120",className:"w-full",preserveAspectRatio:"xMidYMid meet",children:[(0,c.jsx)("line",{x1:30,y1:10+(1-.7)*lm,x2:30+lh,y2:10+(1-.7)*lm,stroke:"#22c55e",strokeWidth:"0.5",strokeDasharray:"4 2",opacity:"0.3"}),(0,c.jsx)("line",{x1:30,y1:10+.5*lm,x2:30+lh,y2:10+.5*lm,stroke:"#eab308",strokeWidth:"0.5",strokeDasharray:"4 2",opacity:"0.3"}),(0,c.jsx)("text",{x:26,y:10+(1-.7)*lm+3,fill:"#64748b",fontSize:"8",textAnchor:"end",children:"0.7"}),(0,c.jsx)("text",{x:26,y:10+.5*lm+3,fill:"#64748b",fontSize:"8",textAnchor:"end",children:"0.5"}),(0,c.jsx)("text",{x:26,y:13,fill:"#64748b",fontSize:"8",textAnchor:"end",children:"1.0"}),(0,c.jsx)("text",{x:26,y:10+lm+3,fill:"#64748b",fontSize:"8",textAnchor:"end",children:"0.0"}),(0,c.jsx)("path",{d:n,fill:"none",stroke:"#06b6d4",strokeWidth:"1.5"}),a.map((e,t)=>(0,c.jsx)("circle",{cx:e.x,cy:e.y,r:"3",fill:"BLOCK"===e.result?"#ef4444":"#eab308",stroke:"#0f172a",strokeWidth:"1",children:(0,c.jsx)("title",{children:`${e.result} — trust: ${e.score.toFixed(2)} — ${new Date(e.time).toLocaleString()}`})},t)),o.map((e,t)=>(0,c.jsx)("text",{x:e.x,y:116,fill:"#64748b",fontSize:"8",textAnchor:"middle",children:e.label},t))]})}let lx={BLOCK:"text-red-400 bg-red-500/10",QUARANTINE:"text-yellow-400 bg-yellow-500/10"};function lf({identifier:e}){let{data:t,isLoading:s}=lo(e,{firewallResult:"BLOCK",limit:20}),{data:i}=lo(e,{firewallResult:"QUARANTINE",limit:20}),r=[...t?.entries??[],...i?.entries??[]].sort((e,t)=>new Date(t.timestamp).getTime()-new Date(e.timestamp).getTime());return s?(0,c.jsx)("div",{className:"text-slate-500 text-xs",children:"Loading..."}):0===r.length?(0,c.jsx)("div",{className:"text-slate-500 text-xs",children:"No flagged operations."}):(0,c.jsx)("div",{className:"space-y-1 max-h-60 overflow-y-auto",children:r.map(e=>{let t=[];try{t=JSON.parse(e.threat_indicators)}catch{}return(0,c.jsxs)("div",{className:"px-2 py-1.5 rounded bg-slate-800/50 border border-slate-800",children:[(0,c.jsxs)("div",{className:"flex items-center justify-between",children:[(0,c.jsx)("span",{className:`px-1 py-0.5 rounded text-[10px] font-medium ${lx[e.firewall_result]??"text-slate-400"}`,children:e.firewall_result}),(0,c.jsx)("span",{className:"text-[10px] text-slate-500",children:new Date(e.timestamp).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})})]}),e.reason&&(0,c.jsx)("p",{className:"text-[11px] text-slate-400 mt-0.5 truncate",children:e.reason}),t.length>0&&(0,c.jsx)("div",{className:"flex gap-1 mt-1 flex-wrap",children:t.map((e,t)=>(0,c.jsx)("span",{className:"px-1 py-0.5 rounded text-[9px] bg-red-500/10 text-red-400",children:e},t))}),(0,c.jsxs)("div",{className:"flex gap-3 mt-1 text-[10px] text-slate-500",children:[(0,c.jsxs)("span",{children:["Trust: ",e.trust_score.toFixed(2)]}),(0,c.jsxs)("span",{children:["Anomaly: ",e.anomaly_score.toFixed(2)]}),null!==e.pipeline_duration_ms&&(0,c.jsxs)("span",{children:[e.pipeline_duration_ms,"ms"]})]})]},e.id)})})}let lg=a9("bell",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]]),ly=h.default.env.NEXT_PUBLIC_WS_URL||"ws://localhost:3001/ws/events";function lv({agentFilter:e}){let[t,s]=(0,u.useState)([]),i=(0,u.useRef)(0),r=(0,u.useRef)(null),n=(0,u.useCallback)(t=>{try{let r=JSON.parse(t.data);if("defence_event"!==r.type)return;let n=r.data;if(e&&n.source_identifier!==e)return;s(e=>[{...n,id:++i.current},...e].slice(0,50))}catch{}},[e]);return((0,u.useEffect)(()=>{try{let e=new WebSocket(ly);return r.current=e,e.onmessage=n,e.onerror=()=>{},()=>{e.close(),r.current=null}}catch{return}},[n]),0===t.length)?(0,c.jsxs)("div",{className:"flex items-center gap-2 text-slate-500 text-xs py-2",children:[(0,c.jsx)(lg,{size:12}),(0,c.jsx)("span",{children:"Listening for defence events..."})]}):(0,c.jsx)("div",{className:"space-y-1 max-h-48 overflow-y-auto",children:(0,c.jsx)(P,{initial:!1,children:t.map(e=>(0,c.jsxs)(nT.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0},className:`px-2 py-1.5 rounded border text-xs ${"BLOCK"===e.firewall_result?"bg-red-500/5 border-red-500/20":"bg-yellow-500/5 border-yellow-500/20"}`,children:[(0,c.jsxs)("div",{className:"flex items-center justify-between",children:[(0,c.jsx)("span",{className:`font-medium ${"BLOCK"===e.firewall_result?"text-red-400":"text-yellow-400"}`,children:e.firewall_result}),(0,c.jsx)("span",{className:"text-[10px] text-slate-500",children:new Date(e.timestamp).toLocaleTimeString()})]}),(0,c.jsxs)("p",{className:"text-slate-400 text-[11px] truncate mt-0.5",children:[e.source_identifier," — ",e.reason??"No reason"]})]},e.id))})})}function lb({identifier:e,compact:t}){let s=e.split(">").map(e=>e.trim());return 1===s.length?(0,c.jsx)("span",{className:"font-mono text-sm text-white",children:e}):t?(0,c.jsxs)("span",{className:"font-mono text-sm",children:[(0,c.jsxs)("span",{className:"text-slate-500",children:[s.slice(0,-1).join(" › ")," › "]}),(0,c.jsx)("span",{className:"text-white",children:s[s.length-1]})]}):(0,c.jsx)("div",{className:"font-mono text-sm",children:s.map((e,t)=>(0,c.jsxs)("span",{children:[t>0&&(0,c.jsx)(ls,{size:12,className:"inline text-slate-600 mx-0.5"}),(0,c.jsx)("span",{className:t===s.length-1?"text-white":"text-slate-500",children:e})]},t))})}function lj({score:e}){let t=ll(e);return(0,c.jsxs)("span",{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-medium ${ld[t]} ${lc[t]}`,children:[e.toFixed(2)," · ",lu[t]]})}function lw({type:e}){let t={agent:"text-purple-400 bg-purple-500/10",cli:"text-cyan-400 bg-cyan-500/10",user:"text-green-400 bg-green-500/10",hook:"text-blue-400 bg-blue-500/10",api:"text-orange-400 bg-orange-500/10",web:"text-red-400 bg-red-500/10",file:"text-slate-400 bg-slate-500/10",email:"text-yellow-400 bg-yellow-500/10"}[e]??"text-slate-400 bg-slate-500/10";return(0,c.jsx)("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-medium ${t}`,children:e})}function lN(){let{projectFilter:e}=(0,nP.useDashboardStore)(),[t,s]=(0,u.useState)("24h"),[i,r]=(0,u.useState)(null),[n,a]=(0,u.useState)("operation_count"),[o,l]=(0,u.useState)(!1),[d,h]=(0,u.useState)(null),[m,p]=(0,u.useState)(null),[x,f]=(0,u.useState)(!1),[g]=(0,u.useState)(()=>Date.now()),{data:y,isLoading:v}=function(e="24h",t){return(0,nD.useQuery)({queryKey:["agents",e,t],queryFn:()=>lr(e,t),refetchInterval:3e4,retry:2})}(t,e??void 0),b=y?.agents??[],j=(0,u.useMemo)(()=>{let e=b;return d&&(e=e.filter(e=>e.source_type===d)),m&&(e=e.filter(e=>ll(e.avg_trust_score)===m)),x&&(e=e.filter(e=>e.flagged_count>0)),e},[b,d,m,x]),w=(0,u.useMemo)(()=>{let e=[...j];return e.sort((e,t)=>{let s=e[n],i=t[n];return"string"==typeof s&&"string"==typeof i?o?s.localeCompare(i):i.localeCompare(s):o?s-i:i-s}),e},[j,n,o]),N=(0,u.useMemo)(()=>[...new Set(b.map(e=>e.source_type))],[b]),k=e=>{n===e?l(!o):(a(e),l(!1))};return(0,c.jsxs)("div",{className:"flex h-full",children:[(0,c.jsxs)("div",{className:`${i?"w-1/2":"w-full"} border-r border-slate-800 flex flex-col`,children:[(0,c.jsxs)("div",{className:"p-3 border-b border-slate-800 flex items-center justify-between",children:[(0,c.jsxs)("div",{className:"flex items-center gap-2",children:[(0,c.jsx)(oa,{size:16,className:"text-cyan-400"}),(0,c.jsx)("h2",{className:"text-sm font-medium text-white",children:"Agent Registry"}),(0,c.jsxs)("span",{className:"text-xs text-slate-500",children:[w.length," agents"]})]}),(0,c.jsx)("div",{className:"flex gap-1",children:["24h","7d","30d"].map(e=>(0,c.jsx)("button",{onClick:()=>s(e),className:`px-2 py-0.5 text-[10px] rounded transition-colors ${t===e?"bg-cyan-600 text-white":"text-slate-400 hover:text-white"}`,children:e},e))})]}),(0,c.jsxs)("div",{className:"px-3 py-2 border-b border-slate-800 flex items-center gap-2 flex-wrap",children:[(0,c.jsx)(le,{size:12,className:"text-slate-500"}),N.map(e=>(0,c.jsx)("button",{onClick:()=>h(d===e?null:e),className:`px-1.5 py-0.5 text-[10px] rounded transition-colors ${d===e?"bg-cyan-600/20 text-cyan-400":"text-slate-500 hover:text-slate-300"}`,children:e},e)),(0,c.jsx)("span",{className:"text-slate-700",children:"|"}),["full","limited","restricted"].map(e=>(0,c.jsx)("button",{onClick:()=>p(m===e?null:e),className:`px-1.5 py-0.5 text-[10px] rounded transition-colors ${m===e?"bg-cyan-600/20 text-cyan-400":"text-slate-500 hover:text-slate-300"}`,children:e},e)),(0,c.jsx)("span",{className:"text-slate-700",children:"|"}),(0,c.jsxs)("button",{onClick:()=>f(!x),className:`px-1.5 py-0.5 text-[10px] rounded transition-colors flex items-center gap-0.5 ${x?"bg-red-600/20 text-red-400":"text-slate-500 hover:text-slate-300"}`,children:[(0,c.jsx)(os,{size:10})," flagged"]})]}),(0,c.jsxs)("div",{className:"px-3 py-1.5 border-b border-slate-800 grid grid-cols-[1fr_80px_60px_60px_70px] gap-2 text-[10px] text-slate-500",children:[(0,c.jsx)("span",{children:"Agent"}),(0,c.jsxs)("button",{onClick:()=>k("avg_trust_score"),className:"flex items-center gap-0.5 hover:text-slate-300",children:["Trust ",(0,c.jsx)(lt,{size:8})]}),(0,c.jsxs)("button",{onClick:()=>k("operation_count"),className:"flex items-center gap-0.5 hover:text-slate-300",children:["Ops ",(0,c.jsx)(lt,{size:8})]}),(0,c.jsxs)("button",{onClick:()=>k("flagged_count"),className:"flex items-center gap-0.5 hover:text-slate-300",children:["Flagged ",(0,c.jsx)(lt,{size:8})]}),(0,c.jsxs)("button",{onClick:()=>k("last_seen"),className:"flex items-center gap-0.5 hover:text-slate-300",children:["Last seen ",(0,c.jsx)(lt,{size:8})]})]}),(0,c.jsxs)("div",{className:"flex-1 overflow-y-auto",children:[v&&(0,c.jsx)("div",{className:"p-4 text-center text-slate-500 text-xs",children:"Loading agents..."}),!v&&0===w.length&&(0,c.jsx)("div",{className:"p-4 text-center text-slate-500 text-xs",children:"No agents found in this time range."}),w.map(e=>{let t,s=i?.source_identifier===e.source_identifier&&i?.source_type===e.source_type;return(0,c.jsxs)("button",{onClick:()=>r(s?null:e),className:`w-full px-3 py-2 grid grid-cols-[1fr_80px_60px_60px_70px] gap-2 items-center text-left transition-colors border-b border-slate-800/50 ${s?"bg-cyan-600/10":"hover:bg-slate-800/50"}`,children:[(0,c.jsxs)("div",{className:"min-w-0",children:[(0,c.jsx)(lb,{identifier:e.source_identifier,compact:!0}),(0,c.jsx)("div",{className:"mt-0.5",children:(0,c.jsx)(lw,{type:e.source_type})})]}),(0,c.jsx)(lj,{score:e.avg_trust_score}),(0,c.jsx)("span",{className:"text-xs text-slate-300 tabular-nums",children:e.operation_count}),(0,c.jsx)("span",{className:`text-xs tabular-nums ${e.flagged_count>0?"text-red-400":"text-slate-500"}`,children:e.flagged_count}),(0,c.jsx)("span",{className:"text-[10px] text-slate-500",children:(t=g-new Date(e.last_seen).getTime())<6e4?"just now":t<36e5?`${Math.floor(t/6e4)}m ago`:t<864e5?`${Math.floor(t/36e5)}h ago`:`${Math.floor(t/864e5)}d ago`})]},`${e.source_type}:${e.source_identifier}`)})]})]}),(0,c.jsx)(P,{children:i&&(0,c.jsxs)(nT.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:20},className:"w-1/2 flex flex-col overflow-y-auto",children:[(0,c.jsxs)("div",{className:"p-3 border-b border-slate-800",children:[(0,c.jsxs)("div",{className:"flex items-center justify-between",children:[(0,c.jsx)(lb,{identifier:i.source_identifier}),(0,c.jsx)("button",{onClick:()=>r(null),className:"text-slate-500 hover:text-white text-xs",children:"Close"})]}),(0,c.jsxs)("div",{className:"flex items-center gap-2 mt-1.5",children:[(0,c.jsx)(lw,{type:i.source_type}),(0,c.jsx)(lj,{score:i.avg_trust_score}),(0,c.jsxs)("span",{className:"text-[10px] text-slate-500",children:[i.operation_count," ops · ",i.flagged_count," flagged"]})]})]}),(0,c.jsxs)("div",{className:"p-3 border-b border-slate-800",children:[(0,c.jsx)("h3",{className:"text-xs font-medium text-slate-400 mb-2",children:"Trust Score Timeline"}),(0,c.jsx)(lp,{identifier:i.source_identifier,timeRange:t})]}),(0,c.jsxs)("div",{className:"p-3 border-b border-slate-800",children:[(0,c.jsxs)("h3",{className:"text-xs font-medium text-slate-400 mb-2",children:["Flagged Operations",i.flagged_count>0&&(0,c.jsxs)("span",{className:"ml-1 text-red-400",children:["(",i.flagged_count,")"]})]}),(0,c.jsx)(lf,{identifier:i.source_identifier})]}),(0,c.jsxs)("div",{className:"p-3",children:[(0,c.jsx)("h3",{className:"text-xs font-medium text-slate-400 mb-2",children:"Live Alerts"}),(0,c.jsx)(lv,{agentFilter:i.source_identifier})]})]})})]})}let lk=a9("shield-check",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),lS=a9("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]),lC={critical:"text-red-400 bg-red-400/10",high:"text-red-400 bg-red-400/10",medium:"text-yellow-400 bg-yellow-400/10",low:"text-slate-400 bg-slate-400/10",safe:"text-green-400 bg-green-400/10"};function lT({level:e}){let t=lC[e]??lC.low;return(0,c.jsx)("span",{className:`text-[10px] font-medium px-1.5 py-0.5 rounded ${t}`,children:e.toUpperCase()})}function lA({findings:e}){return 0===e.length?null:(0,c.jsx)("div",{className:"mt-2 space-y-1.5 pl-6",children:e.map((e,t)=>(0,c.jsxs)("div",{className:"flex items-start gap-2",children:[(0,c.jsx)(lT,{level:e.severity}),(0,c.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,c.jsx)("span",{className:"text-xs text-slate-300",children:e.description}),e.matchedText&&(0,c.jsxs)("div",{className:"mt-0.5 text-[10px] text-slate-500 font-mono truncate",children:['Match: "',e.matchedText,'"']})]})]},`${e.pattern}-${t}`))})}function lM(e){let t=e.split(/[/\\]/);return t[t.length-1]||e}function lP({file:e,cloudConnected:t,onTrust:s,onUntrust:i,onRemove:r,onCloudUpsell:n}){let[a,o]=(0,u.useState)(!e.safe),[l,d]=(0,u.useState)(!1);return(0,c.jsxs)("div",{className:"bg-slate-800/50 border border-slate-700 rounded-lg overflow-hidden",children:[(0,c.jsxs)("div",{className:"flex items-center",children:[(0,c.jsxs)("button",{onClick:()=>o(!a),className:"flex-1 px-3 py-2.5 flex items-center gap-3 hover:bg-slate-800/80 transition-colors min-w-0",children:[e.trusted?(0,c.jsx)(lk,{size:16,className:"text-cyan-400 shrink-0"}):e.safe?(0,c.jsx)(ok,{size:16,className:"text-green-400 shrink-0"}):(0,c.jsx)(oA,{size:16,className:"text-red-400 shrink-0"}),(0,c.jsxs)("div",{className:"flex-1 min-w-0 text-left",children:[(0,c.jsx)("span",{className:"text-xs font-medium text-white truncate block",children:e.skillName||lM(e.path)}),(0,c.jsx)("span",{className:"text-[10px] text-slate-500 truncate block",children:e.path.replace(/^\/Users\/[^/]+/,"~")})]}),(0,c.jsx)("span",{className:"text-[10px] text-slate-500 shrink-0",children:e.format}),e.trusted?(0,c.jsx)("span",{className:"text-[10px] px-1.5 py-0.5 rounded font-medium bg-cyan-400/10 text-cyan-400",children:"TRUSTED"}):(0,c.jsx)(lT,{level:e.riskLevel}),(0,c.jsxs)("span",{className:"text-[10px] text-slate-600 shrink-0",children:[e.scanDurationMs,"ms"]}),e.findings.length>0?a?(0,c.jsx)(op,{size:14,className:"text-slate-500 shrink-0"}):(0,c.jsx)(ls,{size:14,className:"text-slate-500 shrink-0"}):(0,c.jsx)("div",{className:"w-[14px] shrink-0"})]}),(0,c.jsxs)("div",{className:"flex items-center gap-0.5 pr-2 shrink-0",children:[e.trusted?(0,c.jsx)("button",{onClick:()=>i(e.path),title:"Remove trust",className:"p-1.5 rounded hover:bg-slate-700 transition-colors text-cyan-400 hover:text-cyan-300",children:(0,c.jsx)(lk,{size:14})}):(0,c.jsx)("button",{onClick:()=>s(e.path),title:"Mark as trusted",className:"p-1.5 rounded hover:bg-slate-700 transition-colors text-slate-500 hover:text-cyan-400",children:(0,c.jsx)(oe,{size:14})}),!e.safe&&!e.trusted&&(0,c.jsx)("button",{onClick:()=>t?d(!0):n(),title:t?"Remove skill file":"Connect to Cloud to remove",className:`p-1.5 rounded transition-colors ${t?"hover:bg-red-500/10 text-slate-500 hover:text-red-400":"text-slate-600 hover:text-slate-400 cursor-not-allowed"}`,children:(0,c.jsx)(lS,{size:14})})]})]}),l&&(0,c.jsxs)("div",{className:"border-t border-slate-700/50 px-3 py-2.5 bg-red-950/30 flex items-center gap-3",children:[(0,c.jsxs)("span",{className:"text-xs text-red-300 flex-1",children:["Remove ",(0,c.jsx)("span",{className:"font-medium",children:e.skillName||lM(e.path)}),"? This will delete the file from disk."]}),(0,c.jsx)("button",{onClick:()=>{r(e.path),d(!1)},className:"px-3 py-1 text-xs font-medium bg-red-600 hover:bg-red-500 text-white rounded transition-colors",children:"Delete"}),(0,c.jsx)("button",{onClick:()=>d(!1),className:"px-3 py-1 text-xs text-slate-400 hover:text-white transition-colors",children:"Cancel"})]}),a&&e.findings.length>0&&(0,c.jsx)("div",{className:"border-t border-slate-700/50 px-3 py-2 bg-slate-900/50",children:(0,c.jsx)(lA,{findings:e.findings})})]})}function lE({files:e,cloudConnected:t,onTrust:s,onUntrust:i,onRemove:r,onCloudUpsell:n}){return 0===e.length?null:(0,c.jsx)("div",{className:"space-y-1.5",children:e.map(e=>(0,c.jsx)(lP,{file:e,cloudConnected:t,onTrust:s,onUntrust:i,onRemove:r,onCloudUpsell:n},e.path))})}let lD=[{value:"",label:"Auto-detect"},{value:"skill-md",label:"SKILL.md (Claude Code)"},{value:"hook-md",label:"HOOK.md (OpenClaw)"},{value:"hook-js",label:"handler.js (OpenClaw)"},{value:"rules",label:".cursorrules / .windsurfrules / .clinerules"},{value:"claude-md",label:"CLAUDE.md"},{value:"copilot-md",label:"copilot-instructions.md"},{value:"aider-yml",label:".aider.conf.yml"},{value:"continue-json",label:".continue/config.json"}];function lL(){let e=oR(),t=(0,oM.useMutation)({mutationFn:oL}),s=(0,oM.useMutation)({mutationFn:oV}),i=(0,oM.useMutation)({mutationFn:oF}),r=(0,oM.useMutation)({mutationFn:o$}),{data:n}=oX(),[a,o]=(0,u.useState)(null),[l,d]=(0,u.useState)(null),[h,m]=(0,u.useState)(!1),[p,x]=(0,u.useState)(""),[f,g]=(0,u.useState)(""),[y,v]=(0,u.useState)(!1),b=!!(n?.enabled&&n?.apiKeySet);return(0,c.jsxs)("div",{className:"h-full overflow-y-auto p-6",children:[(0,c.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,c.jsxs)("div",{children:[(0,c.jsx)("h2",{className:"text-lg font-semibold text-white",children:"Skills Scanner"}),(0,c.jsx)("p",{className:"text-xs text-slate-400 mt-0.5",children:"Scan agent instruction files for hidden threats"})]}),(0,c.jsxs)("button",{onClick:()=>{e.mutate(void 0,{onSuccess:e=>o(e)})},disabled:e.isPending,className:"flex items-center gap-1.5 px-4 py-2 bg-cyan-600 hover:bg-cyan-500 disabled:opacity-50 rounded-lg text-sm font-medium text-white transition-colors",children:[e.isPending?(0,c.jsx)(oN,{size:14,className:"animate-spin"}):(0,c.jsx)(oo,{size:14}),"Scan All"]})]}),y&&(0,c.jsxs)("div",{className:"mb-4 bg-slate-900 border border-cyan-800/50 rounded-xl p-4 flex items-center gap-3",children:[(0,c.jsx)(oj,{size:20,className:"text-cyan-400 shrink-0"}),(0,c.jsxs)("div",{className:"flex-1",children:[(0,c.jsx)("p",{className:"text-sm font-medium text-white",children:"Connect to ShieldCortex Cloud"}),(0,c.jsx)("p",{className:"text-xs text-slate-400 mt-0.5",children:"Enable one-click skill removal and cloud-powered threat intelligence."})]}),(0,c.jsx)("button",{onClick:()=>v(!1),className:"text-xs text-slate-500 hover:text-slate-300 transition-colors",children:"Dismiss"})]}),a?(0,c.jsxs)("div",{className:"space-y-4",children:[(0,c.jsxs)("div",{className:"flex items-center gap-3 text-xs text-slate-400",children:[(0,c.jsxs)("span",{children:[(0,c.jsx)("span",{className:"text-white font-medium",children:a.totalScanned})," files scanned"]}),(0,c.jsx)("span",{className:"text-slate-600",children:"·"}),a.threatCount>0?(0,c.jsxs)("span",{children:[(0,c.jsx)("span",{className:"text-red-400 font-medium",children:a.threatCount})," with threats"]}):(0,c.jsx)("span",{className:"text-green-400",children:"All clean"}),(0,c.jsx)("span",{className:"text-slate-600",children:"·"}),(0,c.jsx)("span",{children:new Date(a.scannedAt).toLocaleTimeString()})]}),(0,c.jsx)(lE,{files:a.files,cloudConnected:b,onTrust:e=>{s.mutate(e,{onSuccess:()=>{a&&o({...a,files:a.files.map(t=>t.path===e?{...t,trusted:!0}:t),threatCount:a.files.filter(t=>!t.safe&&!t.trusted&&t.path!==e).length})}})},onUntrust:e=>{i.mutate(e,{onSuccess:()=>{a&&o({...a,files:a.files.map(t=>t.path===e?{...t,trusted:!1}:t),threatCount:a.files.filter(t=>{let s=t.path!==e&&t.trusted;return!t.safe&&!s}).length})}})},onRemove:e=>{r.mutate(e,{onSuccess:()=>{if(a){let t=a.files.filter(t=>t.path!==e);o({...a,files:t,totalScanned:t.length,threatCount:t.filter(e=>!e.safe&&!e.trusted).length})}}})},onCloudUpsell:()=>v(!0)})]}):e.isPending?(0,c.jsx)("div",{className:"flex items-center justify-center py-16",children:(0,c.jsx)(oN,{size:24,className:"text-cyan-400 animate-spin"})}):(0,c.jsxs)("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[(0,c.jsx)(oo,{size:32,className:"text-slate-600 mb-3"}),(0,c.jsx)("p",{className:"text-sm text-slate-400",children:"No skills scanned yet"}),(0,c.jsx)("p",{className:"text-xs text-slate-500 mt-1",children:'Click "Scan All" to discover and scan agent instruction files'})]}),(0,c.jsxs)("div",{className:"mt-6",children:[(0,c.jsxs)("button",{onClick:()=>m(!h),className:"flex items-center gap-1.5 text-xs text-slate-400 hover:text-slate-300 transition-colors",children:[h?(0,c.jsx)(op,{size:14}):(0,c.jsx)(ls,{size:14}),"Paste & Scan"]}),h&&(0,c.jsxs)("div",{className:"mt-3 bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,c.jsx)("textarea",{value:p,onChange:e=>x(e.target.value),placeholder:"Paste skill/instruction file content here...",className:"w-full h-32 bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-sm text-white placeholder:text-slate-500 focus:ring-cyan-500 focus:border-cyan-500 resize-y font-mono"}),(0,c.jsxs)("div",{className:"flex items-center gap-3 mt-3",children:[(0,c.jsx)("select",{value:f,onChange:e=>g(e.target.value),className:"bg-slate-800 border border-slate-700 text-white text-xs rounded-lg px-3 py-2 focus:ring-cyan-500 focus:border-cyan-500",children:lD.map(e=>(0,c.jsx)("option",{value:e.value,children:e.label},e.value))}),(0,c.jsxs)("button",{onClick:()=>{p.trim()&&t.mutate({content:p,format:f||void 0},{onSuccess:e=>d(e)})},disabled:t.isPending||!p.trim(),className:"flex items-center gap-1.5 px-4 py-2 bg-cyan-600 hover:bg-cyan-500 disabled:opacity-50 rounded-lg text-xs font-medium text-white transition-colors",children:[t.isPending?(0,c.jsx)(oN,{size:12,className:"animate-spin"}):(0,c.jsx)(oo,{size:12}),"Scan Content"]})]}),l&&(0,c.jsxs)("div",{className:"mt-4 bg-slate-800/50 border border-slate-700 rounded-lg p-3",children:[(0,c.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,c.jsx)("span",{className:"text-xs font-medium text-white",children:l.skillName}),(0,c.jsx)(lT,{level:l.riskLevel}),(0,c.jsxs)("span",{className:"text-[10px] text-slate-500",children:[l.scanDurationMs,"ms"]})]}),(0,c.jsx)("p",{className:"text-xs text-slate-400",children:l.summary}),l.findings.length>0&&(0,c.jsx)(lA,{findings:l.findings})]})]})]})]})}let lR=a9("lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]),lV=a9("radio",[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]),lF=a9("shield-off",[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71",key:"1jlk70"}],["path",{d:"M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264",key:"18rp1v"}]]),l$=a9("scan",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}]]),lz=[{id:"personal",label:"Personal",description:"Lighter touch for solo use",icon:oe},{id:"enterprise",label:"Enterprise",description:"Financial & data protection",icon:lR},{id:"school",label:"School",description:"GDPR strict, pupil data guarded",icon:oa},{id:"paranoid",label:"Paranoid",description:"Everything requires approval",icon:os}],l_=[{name:"Injection Scanner",description:"40+ patterns across 8 categories",icon:l$},{name:"Instruction Gateway",description:"Trusted channel validation",icon:lV},{name:"Action Gate",description:"Approve / block external actions",icon:lR},{name:"PII Guard",description:"Block sensitive data output",icon:oh},{name:"Kill Switch",description:"Emergency stop phrase",icon:lF},{name:"Sub-Agent Control",description:"Restrict spawned agent operations",icon:oa}],lI={critical:"bg-red-500/20 text-red-400 border-red-500/30",high:"bg-orange-500/20 text-orange-400 border-orange-500/30",medium:"bg-yellow-500/20 text-yellow-400 border-yellow-500/30",low:"bg-slate-500/20 text-slate-400 border-slate-500/30"},lO={CRITICAL:"bg-red-500/20 text-red-400",HIGH:"bg-orange-500/20 text-orange-400",MEDIUM:"bg-yellow-500/20 text-yellow-400",LOW:"bg-slate-500/20 text-slate-400",NONE:"bg-green-500/20 text-green-400"};function lB(){let e,t,{data:s,isLoading:i}=oq(),{data:r}=oK(50),n=(e=(0,aZ.useQueryClient)(),(0,oM.useMutation)({mutationFn:e=>oO(e),onSuccess:()=>{e.invalidateQueries({queryKey:["iron-dome-status"]}),e.invalidateQueries({queryKey:["iron-dome-audit"]})}})),a=(t=(0,aZ.useQueryClient)(),(0,oM.useMutation)({mutationFn:oB,onSuccess:()=>{t.invalidateQueries({queryKey:["iron-dome-status"]})}})),o=(0,oM.useMutation)({mutationFn:oU}),[l,d]=(0,u.useState)(""),[h,m]=(0,u.useState)(null),p=s?.enabled??!1,x=s?.profile,f=s?.config,g=r?.logs??[],y=g.filter(e=>"BLOCK"===e.firewall_result).length,v=g.filter(e=>"ALLOW"===e.firewall_result).length;return(0,c.jsxs)("div",{className:"h-full overflow-y-auto p-6",children:[(0,c.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,c.jsxs)("div",{className:"flex items-center gap-3",children:[(0,c.jsx)(ol,{size:20,className:"text-red-400"}),(0,c.jsx)("h2",{className:"text-lg font-semibold text-white",children:"Iron Dome"}),i?(0,c.jsx)("span",{className:"text-[10px] text-slate-500 animate-pulse",children:"Loading..."}):(0,c.jsx)("span",{className:`text-[10px] font-medium px-2 py-0.5 rounded-full ${p?"bg-red-500/20 text-red-400 border border-red-500/30":"bg-slate-700/50 text-slate-500"}`,children:p?"ACTIVE":"INACTIVE"})]}),p&&(0,c.jsxs)("button",{onClick:()=>{a.mutate()},disabled:a.isPending,className:"flex items-center gap-1.5 px-3 py-1.5 bg-red-500/10 border border-red-500/30 hover:bg-red-500/20 disabled:opacity-50 rounded-lg text-xs font-medium text-red-400 transition-colors",children:[a.isPending?(0,c.jsx)(oN,{size:12,className:"animate-spin"}):(0,c.jsx)(lF,{size:12}),"Deactivate"]})]}),(0,c.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4 mb-6",children:[(0,c.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,c.jsx)("h3",{className:"text-sm font-medium text-slate-300 mb-3",children:"Security Profiles"}),(0,c.jsx)("div",{className:"grid grid-cols-2 gap-2",children:lz.map(({id:e,label:t,description:s,icon:i})=>(0,c.jsxs)("button",{onClick:()=>{n.mutate(e)},disabled:n.isPending,className:`text-left p-3 rounded-lg border transition-colors ${x===e?"border-red-500/50 bg-red-500/10 text-red-400":"border-slate-700 bg-slate-800/50 text-slate-400 hover:border-slate-600"}`,children:[(0,c.jsxs)("div",{className:"flex items-center gap-1.5 mb-1",children:[(0,c.jsx)(i,{size:12}),(0,c.jsx)("span",{className:"text-xs font-medium",children:t})]}),(0,c.jsx)("div",{className:"text-[10px] text-slate-500",children:s})]},e))})]}),(0,c.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,c.jsx)("h3",{className:"text-sm font-medium text-slate-300 mb-3",children:"Module Status"}),(0,c.jsx)("div",{className:"space-y-2",children:l_.map(({name:e,description:t,icon:s})=>(0,c.jsxs)("div",{className:"flex items-center gap-3 px-3 py-2 rounded-lg bg-slate-800/50",children:[(0,c.jsx)(s,{size:14,className:p?"text-red-400":"text-slate-600"}),(0,c.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,c.jsx)("div",{className:"text-xs font-medium text-slate-300",children:e}),(0,c.jsx)("div",{className:"text-[10px] text-slate-500 truncate",children:t})]}),(0,c.jsx)("span",{className:`w-2 h-2 rounded-full ${p?"bg-red-400":"bg-slate-600"}`})]},e))})]})]}),p&&f&&(0,c.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4 mb-6",children:[(0,c.jsx)("h3",{className:"text-sm font-medium text-slate-300 mb-3",children:"Active Configuration"}),(0,c.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 text-xs",children:[(0,c.jsxs)("div",{children:[(0,c.jsx)("div",{className:"text-[10px] text-slate-500 uppercase mb-1",children:"Trusted Channels"}),(0,c.jsx)("div",{className:"flex flex-wrap gap-1",children:f.trustedChannels.map(e=>(0,c.jsx)("span",{className:"px-1.5 py-0.5 bg-slate-800 rounded text-slate-400",children:e},e))})]}),(0,c.jsxs)("div",{children:[(0,c.jsx)("div",{className:"text-[10px] text-slate-500 uppercase mb-1",children:"Requires Approval"}),(0,c.jsx)("div",{className:"flex flex-wrap gap-1",children:f.requireApproval.map(e=>(0,c.jsx)("span",{className:"px-1.5 py-0.5 bg-red-500/10 border border-red-500/20 rounded text-red-400",children:e},e))})]}),(0,c.jsxs)("div",{children:[(0,c.jsx)("div",{className:"text-[10px] text-slate-500 uppercase mb-1",children:"Kill Phrase"}),(0,c.jsx)("span",{className:"px-1.5 py-0.5 bg-slate-800 rounded text-slate-400 font-mono",children:f.killPhrase})]})]})]}),(0,c.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[(0,c.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,c.jsxs)("h3",{className:"text-sm font-medium text-slate-300 mb-3",children:[(0,c.jsx)(l$,{size:14,className:"inline mr-1.5 text-red-400"}),"Injection Scanner"]}),(0,c.jsx)("textarea",{value:l,onChange:e=>d(e.target.value),placeholder:"Paste suspicious text to scan for injection patterns...",className:"w-full h-28 bg-slate-800 border border-slate-700 rounded-lg p-3 text-sm text-white placeholder:text-slate-500 resize-none focus:outline-none focus:ring-1 focus:ring-red-500 focus:border-red-500"}),(0,c.jsxs)("button",{onClick:()=>{l.trim()&&o.mutate(l,{onSuccess:e=>m(e)})},disabled:o.isPending||!l.trim(),className:"mt-2 flex items-center gap-1.5 px-3 py-1.5 bg-red-600 hover:bg-red-500 disabled:opacity-50 rounded-lg text-xs font-medium text-white transition-colors",children:[o.isPending?(0,c.jsx)(oN,{size:12,className:"animate-spin"}):(0,c.jsx)(ol,{size:12}),"Scan"]}),h&&(0,c.jsxs)("div",{className:"mt-3 space-y-2",children:[(0,c.jsxs)("div",{className:"flex items-center gap-2",children:[h.clean?(0,c.jsx)(ok,{size:14,className:"text-green-400"}):(0,c.jsx)(oA,{size:14,className:"text-red-400"}),(0,c.jsx)("span",{className:`text-[10px] font-medium px-2 py-0.5 rounded-full ${lO[h.riskLevel]??"bg-slate-500/20 text-slate-400"}`,children:h.riskLevel}),(0,c.jsx)("span",{className:"text-xs text-slate-400",children:h.summary})]}),h.detections.map((e,t)=>(0,c.jsxs)("div",{className:`border rounded-lg p-3 ${lI[e.severity]??"border-slate-700"}`,children:[(0,c.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,c.jsx)("span",{className:"text-[10px] font-medium uppercase",children:e.severity}),(0,c.jsx)("span",{className:"text-xs text-slate-300",children:e.category.replace(/_/g," ")})]}),(0,c.jsx)("p",{className:"text-[11px] text-slate-400 mb-1",children:e.description}),(0,c.jsx)("code",{className:"text-[10px] text-slate-500 bg-slate-800 px-1.5 py-0.5 rounded block truncate",children:e.match})]},t))]})]}),(0,c.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,c.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,c.jsx)("h3",{className:"text-sm font-medium text-slate-300",children:"Event Feed"}),(0,c.jsxs)("span",{className:"text-[10px] text-slate-500",children:["Last ",g.length," events"]})]}),(0,c.jsxs)("div",{className:"grid grid-cols-3 gap-2 mb-3",children:[(0,c.jsxs)("div",{className:"bg-slate-800/50 rounded-lg p-2 text-center",children:[(0,c.jsx)("div",{className:"text-sm font-bold text-slate-300",children:g.length}),(0,c.jsx)("div",{className:"text-[10px] text-slate-500",children:"Total"})]}),(0,c.jsxs)("div",{className:"bg-slate-800/50 rounded-lg p-2 text-center",children:[(0,c.jsx)("div",{className:"text-sm font-bold text-red-400",children:y}),(0,c.jsx)("div",{className:"text-[10px] text-slate-500",children:"Blocked"})]}),(0,c.jsxs)("div",{className:"bg-slate-800/50 rounded-lg p-2 text-center",children:[(0,c.jsx)("div",{className:"text-sm font-bold text-green-400",children:v}),(0,c.jsx)("div",{className:"text-[10px] text-slate-500",children:"Allowed"})]})]}),(0,c.jsx)("div",{className:"space-y-1 max-h-72 overflow-y-auto",children:0===g.length?(0,c.jsxs)("div",{className:"text-center py-6",children:[(0,c.jsx)(oe,{size:20,className:"text-slate-600 mx-auto mb-1.5"}),(0,c.jsx)("p",{className:"text-[10px] text-slate-500",children:"No Iron Dome events yet"})]}):g.map((e,t)=>(0,c.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded-md bg-slate-800/50 text-xs",children:[(0,c.jsx)("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${"BLOCK"===e.firewall_result?"bg-red-400":"bg-green-400"}`}),(0,c.jsx)("span",{className:"text-slate-400 truncate flex-1",children:(e.reason??"").replace(/^\[iron-dome:\w+\]\s*/,"")}),(0,c.jsx)("span",{className:"text-[10px] text-slate-600 shrink-0",children:new Date(e.timestamp).toLocaleTimeString()})]},e.id??t))})]})]})]})}let lU=(0,nA.default)(()=>e.A(1369),{loadableGenerated:{modules:[11570]},ssr:!1,loading:()=>(0,c.jsx)("div",{className:"w-full h-full flex items-center justify-center bg-slate-950",children:(0,c.jsx)("div",{className:"text-slate-400 animate-pulse",children:"Loading Graph..."})})}),lW=(0,nA.default)(()=>e.A(62838).then(e=>e.BrainControlCentre),{loadableGenerated:{modules:[41740]},ssr:!1,loading:()=>(0,c.jsx)("div",{className:"w-full h-full flex items-center justify-center bg-slate-950",children:(0,c.jsx)("div",{className:"text-slate-400 animate-pulse",children:"Loading Brain Control Centre..."})})});function lq(){let e,[t,s]=(0,u.useState)(""),[i,r]=(0,u.useState)(!1),[n,a]=(0,u.useState)(!1),[o,l]=(0,u.useState)(void 0),[d,h]=(0,u.useState)(void 0),m=(0,u.useRef)(null),p=(0,u.useRef)(null),x=nE(t,300),{viewMode:f,selectedMemory:g,setSelectedMemory:y,selectedAuditEntry:v,setSelectedAuditEntry:b,projectFilter:j,setProjectFilter:w,addEvent:N}=(0,nP.useDashboardStore)(),{data:k=[]}=(e=nE(t,200),(0,nD.useQuery)({queryKey:["suggestions",e],queryFn:()=>nR(e),enabled:e.length>=2,staleTime:3e4,refetchOnWindowFocus:!1})),{data:S}=(0,nM.useProjects)();(0,u.useEffect)(()=>{let e=e=>{p.current&&!p.current.contains(e.target)&&m.current&&!m.current.contains(e.target)&&r(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);let{data:C=[],isLoading:T,isConnected:A,lastEvent:M}=(0,nM.useMemoriesWithRealtime)({limit:1e3,query:x||void 0,mode:x?"search":"recent",project:j||void 0,type:o,category:d}),{data:E,isLoading:D}=(0,nM.useStats)(j||void 0),{data:L=[]}=(0,nM.useMemoryLinks)(j||void 0),R=(0,u.useRef)(M);(0,u.useEffect)(()=>{!M||M===R.current||(R.current=M,new Set(["memory_created","memory_accessed","memory_updated","memory_deleted","consolidation_complete","decay_tick"]).has(M.type)&&N({type:M.type,timestamp:M.timestamp,data:M.data}))},[M,N]);let V=(0,nM.useAccessMemory)();(0,nM.useConsolidate)();let{data:F}=(0,nM.useControlStatus)();(0,nM.usePauseMemory)(),(0,nM.useResumeMemory)();let $=F?.paused??!1,{data:z}=oX(),_=z?.enabled&&z?.apiKeySet,I=e=>{y(e)},O=e=>{let t=C.find(t=>t.id===e);t&&y(t)},B="shield"===f||"audit"===f||"quarantine"===f||"agents"===f||"skills"===f||"dome"===f;return(0,c.jsxs)("div",{className:"h-screen w-screen bg-slate-950 text-white overflow-hidden flex flex-col",children:[(0,c.jsxs)("header",{className:"h-14 border-b border-slate-800 flex items-center justify-between px-4 bg-slate-900/50 backdrop-blur-sm shrink-0",children:[(0,c.jsxs)("div",{className:"flex items-center gap-4",children:[(0,c.jsxs)("div",{className:"flex items-center gap-2",children:[(0,c.jsx)(oe,{size:20,className:"text-cyan-400"}),(0,c.jsx)("h1",{className:"text-xl font-bold bg-gradient-to-r from-cyan-400 via-blue-400 to-emerald-400 bg-clip-text text-transparent",children:"ShieldCortex"}),(0,c.jsx)("div",{title:_?"Connected to ShieldCortex Cloud":"Cloud sync not configured",children:(0,c.jsx)(oj,{size:16,className:_?"text-emerald-400":"text-slate-600"})})]}),(0,c.jsx)("select",{value:j||"",onChange:e=>w(e.target.value||null),className:"bg-slate-800 border border-slate-700 text-white text-sm rounded-lg px-3 py-1.5 focus:ring-cyan-500 focus:border-cyan-500",children:S?.projects.map(e=>(0,c.jsxs)("option",{value:e.project||"",children:[e.label," (",e.memory_count,")"]},e.project||"all"))}),(0,c.jsxs)("div",{className:"relative",children:[(0,c.jsx)(aH,{ref:m,type:"text",placeholder:"Search memories...",value:t,onChange:e=>{s(e.target.value),r(!0)},onFocus:()=>r(!0),onKeyDown:e=>{"Escape"===e.key&&r(!1)},className:"w-64 bg-slate-800 border-slate-700 text-white placeholder:text-slate-400 focus:ring-cyan-500"}),i&&k.length>0&&(0,c.jsx)("div",{ref:p,className:"absolute top-full left-0 right-0 mt-1 bg-slate-800 border border-slate-700 rounded-lg shadow-xl overflow-hidden z-50",children:k.map((e,t)=>(0,c.jsxs)("button",{onClick:()=>{s(e.text),r(!1),m.current?.focus()},className:"w-full px-3 py-2 text-left hover:bg-slate-700 transition-colors flex items-center gap-2",children:[(0,c.jsx)("span",{className:"text-white text-sm truncate flex-1",children:e.text}),(0,c.jsx)("span",{className:"text-xs px-1.5 py-0.5 rounded bg-slate-600 text-slate-300",children:e.type})]},`${e.type}-${e.text}-${t}`))})]}),(0,c.jsxs)(aK,{variant:"outline",size:"sm",onClick:()=>a(!n),className:`border-slate-600 text-slate-300 hover:text-white hover:bg-slate-700 ${n?"bg-slate-700":""}`,title:"Filter memories by type and category",children:["Filters ",(o||d)&&"•"]})]}),(0,c.jsx)("div",{className:"flex items-center gap-2",children:(0,c.jsxs)("div",{className:"flex items-center gap-2 text-xs text-slate-400 px-2",children:[(0,c.jsx)("span",{className:`w-2 h-2 rounded-full ${$?"bg-orange-500 animate-pulse":A?"bg-green-500":"bg-yellow-500"}`,title:$?"Memory creation paused":A?"Real-time connected":"Polling mode"}),E?.total??C.length," memories"]})})]}),n&&(0,c.jsxs)("div",{className:"h-12 border-b border-slate-800 flex items-center gap-4 px-4 bg-slate-900/30",children:[(0,c.jsxs)("div",{className:"flex items-center gap-2",children:[(0,c.jsx)("span",{className:"text-xs text-slate-400",children:"Type:"}),["short_term","long_term","episodic"].map(e=>(0,c.jsx)("button",{onClick:()=>l(o===e?void 0:e),className:`px-2 py-1 text-xs rounded-full transition-colors ${o===e?"bg-blue-600 text-white":"bg-slate-800 text-slate-300 hover:bg-slate-700"}`,children:e.replace("_","-")},e))]}),(0,c.jsx)("div",{className:"w-px h-6 bg-slate-700"}),(0,c.jsxs)("div",{className:"flex items-center gap-2",children:[(0,c.jsx)("span",{className:"text-xs text-slate-400",children:"Category:"}),["architecture","pattern","error","learning","preference","context"].map(e=>(0,c.jsx)("button",{onClick:()=>h(d===e?void 0:e),className:`px-2 py-1 text-xs rounded-full transition-colors ${d===e?"bg-purple-600 text-white":"bg-slate-800 text-slate-300 hover:bg-slate-700"}`,children:e},e))]}),(o||d)&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("div",{className:"w-px h-6 bg-slate-700"}),(0,c.jsx)("button",{onClick:()=>{l(void 0),h(void 0)},className:"px-2 py-1 text-xs text-red-400 hover:text-red-300",children:"Clear all"})]})]}),(0,c.jsxs)("div",{className:"flex-1 flex overflow-hidden",children:[(0,c.jsx)(oc,{}),(0,c.jsx)(P,{mode:"wait",children:(0,c.jsxs)(nT.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},className:"flex-1 relative overflow-hidden",children:["shield"===f&&(0,c.jsx)(oJ,{}),"audit"===f&&(0,c.jsx)(o0,{}),"quarantine"===f&&(0,c.jsx)(o9,{}),"brain"===f&&(0,c.jsx)(lW,{memories:C,links:L,stats:E,isLoading:T}),"graph"===f&&(0,c.jsx)(lU,{memories:C,links:L,selectedMemory:g,onSelectMemory:I}),"agents"===f&&(0,c.jsx)(lN,{}),"skills"===f&&(0,c.jsx)(lL,{}),"dome"===f&&(0,c.jsx)(lB,{}),"memories"===f&&(0,c.jsx)(a4,{memories:C,selectedMemory:g,onSelectMemory:I})]},f)}),g&&!B&&"brain"!==f&&(0,c.jsx)("div",{className:"w-80 border-l border-slate-800 overflow-y-auto shrink-0",children:(0,c.jsx)(aJ,{memory:g,links:L,memories:C,onClose:()=>y(null),onReinforce:e=>{V.mutate(e)},onSelectMemory:O,isReinforcing:V.isPending,reinforceSuccess:V.isSuccess})}),v&&"audit"===f&&(0,c.jsx)("div",{className:"w-80 border-l border-slate-800 overflow-y-auto shrink-0",children:(0,c.jsx)(o6,{entry:v,onClose:()=>b(null),onViewMemory:e=>{b(null),O(e),nP.useDashboardStore.getState().setViewMode("memories")}})})]})]})}e.s(["default",()=>lq],23733)}]);
|
|
9
|
+
`),()=>{g.contains(f)&&g.removeChild(f)}},[t]),(0,c.jsx)(N,{isPresent:t,childRef:a,sizeRef:o,children:b.cloneElement(e,{ref:d})})}let S=({children:e,initial:t,isPresent:s,onExitComplete:i,custom:r,presenceAffectsLayout:n,mode:a,anchorX:o,anchorY:l,root:d})=>{let h=p(C),m=(0,u.useId)(),x=!0,f=(0,u.useMemo)(()=>(x=!1,{id:m,initial:t,isPresent:s,custom:r,onExitComplete:e=>{for(let t of(h.set(e,!0),h.values()))if(!t)return;i&&i()},register:e=>(h.set(e,!1),()=>h.delete(e))}),[s,h,i]);return n&&x&&(f={...f}),(0,u.useMemo)(()=>{h.forEach((e,t)=>h.set(t,!1))},[s]),u.useEffect(()=>{s||h.size||!i||i()},[s]),"popLayout"===a&&(e=(0,c.jsx)(k,{isPresent:s,anchorX:o,anchorY:l,root:d,children:e})),(0,c.jsx)(g.Provider,{value:f,children:e})};function C(){return new Map}function T(e=!0){let t=(0,u.useContext)(g);if(null===t)return[!0,null];let{isPresent:s,onExitComplete:i,register:r}=t,n=(0,u.useId)();(0,u.useEffect)(()=>{if(e)return r(n)},[e]);let a=(0,u.useCallback)(()=>e&&i&&i(n),[n,i,e]);return!s&&i?[!1,a]:[!0]}let A=e=>e.key||"";function M(e){let t=[];return u.Children.forEach(e,e=>{(0,u.isValidElement)(e)&&t.push(e)}),t}let P=({children:e,custom:t,initial:s=!0,onExitComplete:i,presenceAffectsLayout:r=!0,mode:n="sync",propagate:a=!1,anchorX:o="left",anchorY:l="top",root:d})=>{let[h,x]=T(a),g=(0,u.useMemo)(()=>M(e),[e]),y=a&&!h?[]:g.map(A),v=(0,u.useRef)(!0),b=(0,u.useRef)(g),j=p(()=>new Map),w=(0,u.useRef)(new Set),[N,k]=(0,u.useState)(g),[C,P]=(0,u.useState)(g);f(()=>{v.current=!1,b.current=g;for(let e=0;e<C.length;e++){let t=A(C[e]);y.includes(t)?(j.delete(t),w.current.delete(t)):!0!==j.get(t)&&j.set(t,!1)}},[C,y.length,y.join("-")]);let E=[];if(g!==N){let e=[...g];for(let t=0;t<C.length;t++){let s=C[t],i=A(s);y.includes(i)||(e.splice(t,0,s),E.push(s))}return"wait"===n&&E.length&&(e=E),P(M(e)),k(g),null}let{forceRender:D}=(0,u.useContext)(m);return(0,c.jsx)(c.Fragment,{children:C.map(e=>{let u=A(e),m=(!a||!!h)&&(g===C||y.includes(u));return(0,c.jsx)(S,{isPresent:m,initial:(!v.current||!!s)&&void 0,custom:t,presenceAffectsLayout:r,mode:n,root:d,onExitComplete:m?void 0:()=>{if(w.current.has(u)||(w.current.add(u),!j.has(u)))return;j.set(u,!0);let e=!0;j.forEach(t=>{t||(e=!1)}),e&&(D?.(),P(b.current),a&&x?.(),i&&i())},anchorX:o,anchorY:l,children:e},u)})})},E=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],D=new Set(E),L=(e,t,s)=>s>t?t:s<e?e:s,R={test:e=>"number"==typeof e,parse:parseFloat,transform:e=>e},V={...R,transform:e=>L(0,1,e)},F={...R,default:1},$=e=>Math.round(1e5*e)/1e5,z=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu,_=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,I=(e,t)=>s=>!!("string"==typeof s&&_.test(s)&&s.startsWith(e)||t&&null!=s&&Object.prototype.hasOwnProperty.call(s,t)),O=(e,t,s)=>i=>{if("string"!=typeof i)return i;let[r,n,a,o]=i.match(z);return{[e]:parseFloat(r),[t]:parseFloat(n),[s]:parseFloat(a),alpha:void 0!==o?parseFloat(o):1}},B={...R,transform:e=>Math.round(L(0,255,e))},U={test:I("rgb","red"),parse:O("red","green","blue"),transform:({red:e,green:t,blue:s,alpha:i=1})=>"rgba("+B.transform(e)+", "+B.transform(t)+", "+B.transform(s)+", "+$(V.transform(i))+")"},W={test:I("#"),parse:function(e){let t="",s="",i="",r="";return e.length>5?(t=e.substring(1,3),s=e.substring(3,5),i=e.substring(5,7),r=e.substring(7,9)):(t=e.substring(1,2),s=e.substring(2,3),i=e.substring(3,4),r=e.substring(4,5),t+=t,s+=s,i+=i,r+=r),{red:parseInt(t,16),green:parseInt(s,16),blue:parseInt(i,16),alpha:r?parseInt(r,16)/255:1}},transform:U.transform},q=e=>({test:t=>"string"==typeof t&&t.endsWith(e)&&1===t.split(" ").length,parse:parseFloat,transform:t=>`${t}${e}`}),K=q("deg"),H=q("%"),Y=q("px"),X=q("vh"),G=q("vw"),Q={...H,parse:e=>H.parse(e)/100,transform:e=>H.transform(100*e)},J={test:I("hsl","hue"),parse:O("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:s,alpha:i=1})=>"hsla("+Math.round(e)+", "+H.transform($(t))+", "+H.transform($(s))+", "+$(V.transform(i))+")"},Z={test:e=>U.test(e)||W.test(e)||J.test(e),parse:e=>U.test(e)?U.parse(e):J.test(e)?J.parse(e):W.parse(e),transform:e=>"string"==typeof e?e:e.hasOwnProperty("red")?U.transform(e):J.transform(e),getAnimatableNone:e=>{let t=Z.parse(e);return t.alpha=0,Z.transform(t)}},ee=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,et="number",es="color",ei=/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 er(e){let t=e.toString(),s=[],i={color:[],number:[],var:[]},r=[],n=0,a=t.replace(ei,e=>(Z.test(e)?(i.color.push(n),r.push(es),s.push(Z.parse(e))):e.startsWith("var(")?(i.var.push(n),r.push("var"),s.push(e)):(i.number.push(n),r.push(et),s.push(parseFloat(e))),++n,"${}")).split("${}");return{values:s,split:a,indexes:i,types:r}}function en(e){return er(e).values}function ea(e){let{split:t,types:s}=er(e),i=t.length;return e=>{let r="";for(let n=0;n<i;n++)if(r+=t[n],void 0!==e[n]){let t=s[n];t===et?r+=$(e[n]):t===es?r+=Z.transform(e[n]):r+=e[n]}return r}}let eo=e=>"number"==typeof e?0:Z.test(e)?Z.getAnimatableNone(e):e,el={test:function(e){return isNaN(e)&&"string"==typeof e&&(e.match(z)?.length||0)+(e.match(ee)?.length||0)>0},parse:en,createTransformer:ea,getAnimatableNone:function(e){let t=en(e);return ea(e)(t.map(eo))}},ed=new Set(["brightness","contrast","saturate","opacity"]);function ec(e){let[t,s]=e.slice(0,-1).split("(");if("drop-shadow"===t)return e;let[i]=s.match(z)||[];if(!i)return e;let r=s.replace(i,""),n=+!!ed.has(t);return i!==s&&(n*=100),t+"("+n+r+")"}let eu=/\b([a-z-]*)\(.*?\)/gu,eh={...el,getAnimatableNone:e=>{let t=e.match(eu);return t?t.map(ec).join(" "):e}},em={...R,transform:Math.round},ep={borderWidth:Y,borderTopWidth:Y,borderRightWidth:Y,borderBottomWidth:Y,borderLeftWidth:Y,borderRadius:Y,borderTopLeftRadius:Y,borderTopRightRadius:Y,borderBottomRightRadius:Y,borderBottomLeftRadius:Y,width:Y,maxWidth:Y,height:Y,maxHeight:Y,top:Y,right:Y,bottom:Y,left:Y,inset:Y,insetBlock:Y,insetBlockStart:Y,insetBlockEnd:Y,insetInline:Y,insetInlineStart:Y,insetInlineEnd:Y,padding:Y,paddingTop:Y,paddingRight:Y,paddingBottom:Y,paddingLeft:Y,paddingBlock:Y,paddingBlockStart:Y,paddingBlockEnd:Y,paddingInline:Y,paddingInlineStart:Y,paddingInlineEnd:Y,margin:Y,marginTop:Y,marginRight:Y,marginBottom:Y,marginLeft:Y,marginBlock:Y,marginBlockStart:Y,marginBlockEnd:Y,marginInline:Y,marginInlineStart:Y,marginInlineEnd:Y,fontSize:Y,backgroundPositionX:Y,backgroundPositionY:Y,rotate:K,rotateX:K,rotateY:K,rotateZ:K,scale:F,scaleX:F,scaleY:F,scaleZ:F,skew:K,skewX:K,skewY:K,distance:Y,translateX:Y,translateY:Y,translateZ:Y,x:Y,y:Y,z:Y,perspective:Y,transformPerspective:Y,opacity:V,originX:Q,originY:Q,originZ:Y,zIndex:em,fillOpacity:V,strokeOpacity:V,numOctaves:em},ex={...ep,color:Z,backgroundColor:Z,outlineColor:Z,fill:Z,stroke:Z,borderColor:Z,borderTopColor:Z,borderRightColor:Z,borderBottomColor:Z,borderLeftColor:Z,filter:eh,WebkitFilter:eh},ef=e=>ex[e],eg=()=>({translate:0,scale:1,origin:0,originPoint:0}),ey=()=>({x:eg(),y:eg()}),ev=()=>({min:0,max:0}),eb=()=>({x:ev(),y:ev()}),ej=e=>!!(e&&e.getVelocity),ew=new Set(["width","height","top","left","right","bottom",...E]),eN=e=>t=>t.test(e),ek=[R,Y,H,K,G,X,{test:e=>"auto"===e,parse:e=>e}],eS=e=>ek.find(eN(e)),eC=()=>{},eT=()=>{};h.default;let eA=e=>t=>"string"==typeof t&&t.startsWith(e),eM=eA("--"),eP=eA("var(--"),eE=e=>!!eP(e)&&eD.test(e.split("/*")[0].trim()),eD=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function eL(e){return"string"==typeof e&&e.split("/*")[0].includes("var(--")}let eR=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u,eV=e=>180*e/Math.PI,eF=e=>ez(eV(Math.atan2(e[1],e[0]))),e$={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:eF,rotateZ:eF,skewX:e=>eV(Math.atan(e[1])),skewY:e=>eV(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},ez=e=>((e%=360)<0&&(e+=360),e),e_=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),eI=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),eO={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:e_,scaleY:eI,scale:e=>(e_(e)+eI(e))/2,rotateX:e=>ez(eV(Math.atan2(e[6],e[5]))),rotateY:e=>ez(eV(Math.atan2(-e[2],e[0]))),rotateZ:eF,rotate:eF,skewX:e=>eV(Math.atan(e[4])),skewY:e=>eV(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function eB(e){return+!!e.includes("scale")}function eU(e,t){let s,i;if(!e||"none"===e)return eB(t);let r=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);if(r)s=eO,i=r;else{let t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);s=e$,i=t}if(!i)return eB(t);let n=s[t],a=i[1].split(",").map(eW);return"function"==typeof n?n(a):a[n]}function eW(e){return parseFloat(e.trim())}let eq=e=>e===R||e===Y,eK=new Set(["x","y","z"]),eH=E.filter(e=>!eK.has(e)),eY={width:({x:e},{paddingLeft:t="0",paddingRight:s="0"})=>e.max-e.min-parseFloat(t)-parseFloat(s),height:({y:e},{paddingTop:t="0",paddingBottom:s="0"})=>e.max-e.min-parseFloat(t)-parseFloat(s),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>eU(t,"x"),y:(e,{transform:t})=>eU(t,"y")};eY.translateX=eY.x,eY.translateY=eY.y;let eX=e=>e,eG={},eQ=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function eJ(e,t){let s=!1,i=!0,r={delta:0,timestamp:0,isProcessing:!1},n=()=>s=!0,a=eQ.reduce((e,s)=>(e[s]=function(e,t){let s=new Set,i=new Set,r=!1,n=!1,a=new WeakSet,o={delta:0,timestamp:0,isProcessing:!1},l=0;function d(t){a.has(t)&&(c.schedule(t),e()),l++,t(o)}let c={schedule:(e,t=!1,n=!1)=>{let o=n&&r?s:i;return t&&a.add(e),o.has(e)||o.add(e),e},cancel:e=>{i.delete(e),a.delete(e)},process:e=>{if(o=e,r){n=!0;return}r=!0,[s,i]=[i,s],s.forEach(d),t,l=0,s.clear(),r=!1,n&&(n=!1,c.process(e))}};return c}(n,t?s:void 0),e),{}),{setup:o,read:l,resolveKeyframes:d,preUpdate:c,update:u,preRender:h,render:m,postRender:p}=a,x=()=>{let n=eG.useManualTiming?r.timestamp:performance.now();s=!1,eG.useManualTiming||(r.delta=i?1e3/60:Math.max(Math.min(n-r.timestamp,40),1)),r.timestamp=n,r.isProcessing=!0,o.process(r),l.process(r),d.process(r),c.process(r),u.process(r),h.process(r),m.process(r),p.process(r),r.isProcessing=!1,s&&t&&(i=!1,e(x))};return{schedule:eQ.reduce((t,n)=>{let o=a[n];return t[n]=(t,n=!1,a=!1)=>(!s&&(s=!0,i=!0,r.isProcessing||e(x)),o.schedule(t,n,a)),t},{}),cancel:e=>{for(let t=0;t<eQ.length;t++)a[eQ[t]].cancel(e)},state:r,steps:a}}let{schedule:eZ,cancel:e0,state:e1,steps:e5}=eJ("u">typeof requestAnimationFrame?requestAnimationFrame:eX,!0),e2=new Set,e4=!1,e3=!1,e6=!1;function e8(){if(e3){let e=Array.from(e2).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),s=new Map;t.forEach(e=>{let t,i=(t=[],eH.forEach(s=>{let i=e.getValue(s);void 0!==i&&(t.push([s,i.get()]),i.set(+!!s.startsWith("scale")))}),t);i.length&&(s.set(e,i),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();let t=s.get(e);t&&t.forEach(([t,s])=>{e.getValue(t)?.set(s)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{void 0!==e.suspendedScrollY&&window.scrollTo(0,e.suspendedScrollY)})}e3=!1,e4=!1,e2.forEach(e=>e.complete(e6)),e2.clear()}function e7(){e2.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(e3=!0)})}class e9{constructor(e,t,s,i,r,n=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=s,this.motionValue=i,this.element=r,this.isAsync=n}scheduleResolve(){this.state="scheduled",this.isAsync?(e2.add(this),e4||(e4=!0,eZ.read(e7),eZ.resolveKeyframes(e8))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:e,name:t,element:s,motionValue:i}=this;if(null===e[0]){let r=i?.get(),n=e[e.length-1];if(void 0!==r)e[0]=r;else if(s&&t){let i=s.readValue(t,n);null!=i&&(e[0]=i)}void 0===e[0]&&(e[0]=n),i&&void 0===r&&i.set(e[0])}for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),e2.delete(this)}cancel(){"scheduled"===this.state&&(e2.delete(this),this.state="pending")}resume(){"pending"===this.state&&this.scheduleResolve()}}function te(e,t){let s=ef(e);return s!==eh&&(s=el),s.getAnimatableNone?s.getAnimatableNone(t):void 0}let tt=new Set(["auto","none","0"]);class ts extends e9{constructor(e,t,s,i,r){super(e,t,s,i,r,!0)}readKeyframes(){let{unresolvedKeyframes:e,element:t,name:s}=this;if(!t||!t.current)return;super.readKeyframes();for(let s=0;s<e.length;s++){let i=e[s];if("string"==typeof i&&eE(i=i.trim())){let r=function e(t,s,i=1){eT(i<=4,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`,"max-css-var-depth");let[r,n]=function(e){let t=eR.exec(e);if(!t)return[,];let[,s,i,r]=t;return[`--${s??i}`,r]}(t);if(!r)return;let a=window.getComputedStyle(s).getPropertyValue(r);if(a){let e=a.trim();return/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e)?parseFloat(e):e}return eE(n)?e(n,s,i+1):n}(i,t.current);void 0!==r&&(e[s]=r),s===e.length-1&&(this.finalKeyframe=i)}}if(this.resolveNoneKeyframes(),!ew.has(s)||2!==e.length)return;let[i,r]=e,n=eS(i),a=eS(r);if(eL(i)!==eL(r)&&eY[s]){this.needsMeasurement=!0;return}if(n!==a)if(eq(n)&&eq(a))for(let t=0;t<e.length;t++){let s=e[t];"string"==typeof s&&(e[t]=parseFloat(s))}else eY[s]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){let{unresolvedKeyframes:e,name:t}=this,s=[];for(let t=0;t<e.length;t++)(null===e[t]||function(e){if("number"==typeof e)return 0===e;if(null===e)return!0;return"none"===e||"0"===e||/^0[^.\s]+$/u.test(e)}(e[t]))&&s.push(t);s.length&&function(e,t,s){let i,r=0;for(;r<e.length&&!i;){let t=e[r];"string"==typeof t&&!tt.has(t)&&er(t).values.length&&(i=e[r]),r++}if(i&&s)for(let r of t)e[r]=te(s,i)}(e,s,t)}measureInitialState(){let{element:e,unresolvedKeyframes:t,name:s}=this;if(!e||!e.current)return;"height"===s&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=eY[s](e.measureViewportBox(),window.getComputedStyle(e.current)),t[0]=this.measuredOrigin;let i=t[t.length-1];void 0!==i&&e.getValue(s,i).jump(i,!1)}measureEndState(){let{element:e,name:t,unresolvedKeyframes:s}=this;if(!e||!e.current)return;let i=e.getValue(t);i&&i.jump(this.measuredOrigin,!1);let r=s.length-1,n=s[r];s[r]=eY[t](e.measureViewportBox(),window.getComputedStyle(e.current)),null!==n&&void 0===this.finalKeyframe&&(this.finalKeyframe=n),this.removedTransforms?.length&&this.removedTransforms.forEach(([t,s])=>{e.getValue(t).set(s)}),this.resolveNoneKeyframes()}}function ti(e,t){-1===e.indexOf(t)&&e.push(t)}function tr(e,t){let s=e.indexOf(t);s>-1&&e.splice(s,1)}class tn{constructor(){this.subscriptions=[]}add(e){return ti(this.subscriptions,e),()=>tr(this.subscriptions,e)}notify(e,t,s){let i=this.subscriptions.length;if(i)if(1===i)this.subscriptions[0](e,t,s);else for(let r=0;r<i;r++){let i=this.subscriptions[r];i&&i(e,t,s)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}let{schedule:ta}=eJ(queueMicrotask,!1);function to(){t=void 0}let tl={now:()=>(void 0===t&&tl.set(e1.isProcessing||eG.useManualTiming?e1.timestamp:performance.now()),t),set:e=>{t=e,queueMicrotask(to)}};class td{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{let t=tl.now();if(this.updatedAt!==t&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(let e of this.dependents)e.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=tl.now(),null===this.canTrackVelocity&&void 0!==e&&(this.canTrackVelocity=!isNaN(parseFloat(this.current)))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,t){this.events[e]||(this.events[e]=new tn);let s=this.events[e].add(t);return"change"===e?()=>{s(),eZ.read(()=>{this.events.change.getSize()||this.stop()})}:s}clearListeners(){for(let e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,s){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-s}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return o&&o.push(this),this.current}getPrevious(){return this.prev}getVelocity(){var e;let t=tl.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;let s=Math.min(this.updatedAt-this.prevUpdatedAt,30);return e=parseFloat(this.current)-parseFloat(this.prevFrameValue),s?1e3/s*e:0}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),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.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function tc(e,t){return new td(e,t)}let tu=[...ek,Z,el],th={current:null},tm={current:!1},tp="u">typeof window,tx=new WeakMap;function tf(e){return null!==e&&"object"==typeof e&&"function"==typeof e.start}function tg(e){return"string"==typeof e||Array.isArray(e)}let ty=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],tv=["initial",...ty];function tb(e){return tf(e.animate)||tv.some(t=>tg(e[t]))}function tj(e){return!!(tb(e)||e.variants)}function tw(e){let t=[{},{}];return e?.values.forEach((e,s)=>{t[0][s]=e.get(),t[1][s]=e.getVelocity()}),t}function tN(e,t,s,i){if("function"==typeof t){let[r,n]=tw(i);t=t(void 0!==s?s:e.custom,r,n)}if("string"==typeof t&&(t=e.variants&&e.variants[t]),"function"==typeof t){let[r,n]=tw(i);t=t(void 0!==s?s:e.custom,r,n)}return t}let tk=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],tS={};class tC{scrapeMotionValuesFromProps(e,t,s){return{}}constructor({parent:e,props:t,presenceContext:s,reducedMotionConfig:i,blockInitialAnimation:r,visualState:n},a={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=e9,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{let e=tl.now();this.renderScheduledAt<e&&(this.renderScheduledAt=e,eZ.render(this.render,!1,!0))};const{latestValues:o,renderState:l}=n;this.latestValues=o,this.baseTarget={...o},this.initialValues=t.initial?{...o}:{},this.renderState=l,this.parent=e,this.props=t,this.presenceContext=s,this.depth=e?e.depth+1:0,this.reducedMotionConfig=i,this.options=a,this.blockInitialAnimation=!!r,this.isControllingVariants=tb(t),this.isVariantNode=tj(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:d,...c}=this.scrapeMotionValuesFromProps(t,{},this);for(const e in c){const t=c[e];void 0!==o[e]&&ej(t)&&t.set(o[e])}}mount(e){this.current=e,tx.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.forEach((e,t)=>this.bindToMotionValue(t,e)),"never"===this.reducedMotionConfig?this.shouldReduceMotion=!1:"always"===this.reducedMotionConfig?this.shouldReduceMotion=!0:(tm.current||function(){if(tm.current=!0,tp)if(window.matchMedia){let e=window.matchMedia("(prefers-reduced-motion)"),t=()=>th.current=e.matches;e.addEventListener("change",t),t()}else th.current=!1}(),this.shouldReduceMotion=th.current),this.parent?.addChild(this),this.update(this.props,this.presenceContext)}unmount(){for(let e in this.projection&&this.projection.unmount(),e0(this.notifyUpdate),e0(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this),this.events)this.events[e].clear();for(let e in this.features){let t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,t){let s;this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();let i=D.has(e);i&&this.onBindTransform&&this.onBindTransform();let r=t.on("change",t=>{this.latestValues[e]=t,this.props.onUpdate&&eZ.preRender(this.notifyUpdate),i&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});"u">typeof window&&window.MotionCheckAppearSync&&(s=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{r(),s&&s(),t.owner&&t.stop()})}sortNodePosition(e){return this.current&&this.sortInstanceNodePosition&&this.type===e.type?this.sortInstanceNodePosition(this.current,e.current):0}updateFeatures(){let e="animation";for(e in tS){let t=tS[e];if(!t)continue;let{isEnabled:s,Feature:i}=t;if(!this.features[e]&&i&&s(this.props)&&(this.features[e]=new i(this)),this.features[e]){let t=this.features[e];t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):eb()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let t=0;t<tk.length;t++){let s=tk[t];this.propEventSubscriptions[s]&&(this.propEventSubscriptions[s](),delete this.propEventSubscriptions[s]);let i=e["on"+s];i&&(this.propEventSubscriptions[s]=this.on(s,i))}this.prevMotionValues=function(e,t,s){for(let i in t){let r=t[i],n=s[i];if(ej(r))e.addValue(i,r);else if(ej(n))e.addValue(i,tc(r,{owner:e}));else if(n!==r)if(e.hasValue(i)){let t=e.getValue(i);!0===t.liveStyle?t.jump(r):t.hasAnimated||t.set(r)}else{let t=e.getStaticValue(i);e.addValue(i,tc(void 0!==t?t:r,{owner:e}))}}for(let i in s)void 0===t[i]&&e.removeValue(i);return t}(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){let t=this.getClosestVariantNode();if(t)return t.variantChildren&&t.variantChildren.add(e),()=>t.variantChildren.delete(e)}addValue(e,t){let s=this.values.get(e);t!==s&&(s&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);let t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let s=this.values.get(e);return void 0===s&&void 0!==t&&(s=tc(null===t?void 0:t,{owner:this}),this.addValue(e,s)),s}readValue(e,t){let s=void 0===this.latestValues[e]&&this.current?this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options):this.latestValues[e];if(null!=s){let i,r;if("string"==typeof s&&(i=s,/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(i)||(r=s,/^0[^.\s]+$/u.test(r))))s=parseFloat(s);else{let i;i=s,!tu.find(eN(i))&&el.test(t)&&(s=te(e,t))}this.setBaseTarget(e,ej(s)?s.get():s)}return ej(s)?s.get():s}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){let t,{initial:s}=this.props;if("string"==typeof s||"object"==typeof s){let i=tN(this.props,s,this.presenceContext?.custom);i&&(t=i[e])}if(s&&void 0!==t)return t;let i=this.getBaseTargetFromProps(this.props,e);return void 0===i||ej(i)?void 0!==this.initialValues[e]&&void 0===t?void 0:this.baseTarget[e]:i}on(e,t){return this.events[e]||(this.events[e]=new tn),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){ta.render(this.render)}}class tT extends tC{constructor(){super(...arguments),this.KeyframeResolver=ts}sortInstanceNodePosition(e,t){return 2&e.compareDocumentPosition(t)?1:-1}getBaseTargetFromProps(e,t){let s=e.style;return s?s[t]:void 0}removeValueFromRenderState(e,{vars:t,style:s}){delete t[e],delete s[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);let{children:e}=this.props;ej(e)&&(this.childSubscription=e.on("change",e=>{this.current&&(this.current.textContent=`${e}`)}))}}function tA(e){return e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}let tM=(e,t)=>t&&"number"==typeof e?t.transform(e):e,tP={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},tE=E.length;function tD(e,t,s){let{style:i,vars:r,transformOrigin:n}=e,a=!1,o=!1;for(let e in t){let s=t[e];if(D.has(e)){a=!0;continue}if(eM(e)){r[e]=s;continue}{let t=tM(s,ep[e]);e.startsWith("origin")?(o=!0,n[e]=t):i[e]=t}}if(!t.transform&&(a||s?i.transform=function(e,t,s){let i="",r=!0;for(let n=0;n<tE;n++){let a=E[n],o=e[a];if(void 0===o)continue;let l=!0;if("number"==typeof o)l=o===+!!a.startsWith("scale");else{let e=parseFloat(o);l=a.startsWith("scale")?1===e:0===e}if(!l||s){let e=tM(o,ep[a]);if(!l){r=!1;let t=tP[a]||a;i+=`${t}(${e}) `}s&&(t[a]=e)}}return i=i.trim(),s?i=s(t,r?"":i):r&&(i="none"),i}(t,e.transform,s):i.transform&&(i.transform="none")),o){let{originX:e="50%",originY:t="50%",originZ:s=0}=n;i.transformOrigin=`${e} ${t} ${s}`}}let tL={offset:"stroke-dashoffset",array:"stroke-dasharray"},tR={offset:"strokeDashoffset",array:"strokeDasharray"},tV=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function tF(e,{attrX:t,attrY:s,attrScale:i,pathLength:r,pathSpacing:n=1,pathOffset:a=0,...o},l,d,c){if(tD(e,o,d),l){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};let{attrs:u,style:h}=e;for(let e of(u.transform&&(h.transform=u.transform,delete u.transform),(h.transform||u.transformOrigin)&&(h.transformOrigin=u.transformOrigin??"50% 50%",delete u.transformOrigin),h.transform&&(h.transformBox=c?.transformBox??"fill-box",delete u.transformBox),tV))void 0!==u[e]&&(h[e]=u[e],delete u[e]);void 0!==t&&(u.x=t),void 0!==s&&(u.y=s),void 0!==i&&(u.scale=i),void 0!==r&&function(e,t,s=1,i=0,r=!0){e.pathLength=1;let n=r?tL:tR;e[n.offset]=`${-i}`,e[n.array]=`${t} ${s}`}(u,r,n,a,!1)}let t$=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"]),tz=e=>"string"==typeof e&&"svg"===e.toLowerCase();function t_(e,{style:t,vars:s},i,r){let n,a=e.style;for(n in t)a[n]=t[n];for(n in r?.applyProjectionStyles(a,i),s)a.setProperty(n,s[n])}function tI(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}let tO={correct:(e,t)=>{if(!t.target)return e;if("string"==typeof e)if(!Y.test(e))return e;else e=parseFloat(e);let s=tI(e,t.target.x),i=tI(e,t.target.y);return`${s}% ${i}%`}},tB=(e,t,s)=>e+(t-e)*s,tU={borderRadius:{...tO,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:tO,borderTopRightRadius:tO,borderBottomLeftRadius:tO,borderBottomRightRadius:tO,boxShadow:{correct:(e,{treeScale:t,projectionDelta:s})=>{let i=el.parse(e);if(i.length>5)return e;let r=el.createTransformer(e),n=+("number"!=typeof i[0]),a=s.x.scale*t.x,o=s.y.scale*t.y;i[0+n]/=a,i[1+n]/=o;let l=tB(a,o,.5);return"number"==typeof i[2+n]&&(i[2+n]/=l),"number"==typeof i[3+n]&&(i[3+n]/=l),r(i)}}};function tW(e,{layout:t,layoutId:s}){return D.has(e)||e.startsWith("origin")||(t||void 0!==s)&&(!!tU[e]||"opacity"===e)}function tq(e,t,s){let i=e.style,r=t?.style,n={};if(!i)return n;for(let t in i)(ej(i[t])||r&&ej(r[t])||tW(t,e)||s?.getValue(t)?.liveStyle!==void 0)&&(n[t]=i[t]);return n}function tK(e,t,s){let i=tq(e,t,s);for(let s in e)(ej(e[s])||ej(t[s]))&&(i[-1!==E.indexOf(s)?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s]=e[s]);return i}class tH extends tT{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=eb}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(D.has(t)){let e=ef(t);return e&&e.default||0}return t=t$.has(t)?t:tA(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,s){return tK(e,t,s)}build(e,t,s){tF(e,t,this.isSVGTag,s.transformTemplate,s.style)}renderInstance(e,t,s,i){for(let s in t_(e,t,void 0,i),t.attrs)e.setAttribute(t$.has(s)?s:tA(s),t.attrs[s])}mount(e){this.isSVGTag=tz(e.tagName),super.mount(e)}}function tY({top:e,left:t,right:s,bottom:i}){return{x:{min:t,max:s},y:{min:e,max:i}}}function tX(e){return void 0===e||1===e}function tG({scale:e,scaleX:t,scaleY:s}){return!tX(e)||!tX(t)||!tX(s)}function tQ(e){return tG(e)||tJ(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function tJ(e){var t,s;return(t=e.x)&&"0%"!==t||(s=e.y)&&"0%"!==s}function tZ(e,t,s,i,r){return void 0!==r&&(e=i+r*(e-i)),i+s*(e-i)+t}function t0(e,t=0,s=1,i,r){e.min=tZ(e.min,t,s,i,r),e.max=tZ(e.max,t,s,i,r)}function t1(e,{x:t,y:s}){t0(e.x,t.translate,t.scale,t.originPoint),t0(e.y,s.translate,s.scale,s.originPoint)}function t5(e,t){e.min=e.min+t,e.max=e.max+t}function t2(e,t,s,i,r=.5){let n=tB(e.min,e.max,r);t0(e,t,s,n,i)}function t4(e,t){t2(e.x,t.x,t.scaleX,t.scale,t.originX),t2(e.y,t.y,t.scaleY,t.scale,t.originY)}function t3(e,t){return tY(function(e,t){if(!t)return e;let s=t({x:e.left,y:e.top}),i=t({x:e.right,y:e.bottom});return{top:s.y,left:s.x,bottom:i.y,right:i.x}}(e.getBoundingClientRect(),t))}class t6 extends tT{constructor(){super(...arguments),this.type="html",this.renderInstance=t_}readValueFromInstance(e,t){if(D.has(t))return this.projection?.isProjecting?eB(t):((e,t)=>{let{transform:s="none"}=getComputedStyle(e);return eU(s,t)})(e,t);{let s=window.getComputedStyle(e),i=(eM(t)?s.getPropertyValue(t):s[t])||0;return"string"==typeof i?i.trim():i}}measureInstanceViewportBox(e,{transformPagePoint:t}){return t3(e,t)}build(e,t,s){tD(e,t,s.transformTemplate)}scrapeMotionValuesFromProps(e,t,s){return tq(e,t,s)}}let t8=["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 t7(e){if("string"!=typeof e||e.includes("-"));else if(t8.indexOf(e)>-1||/[A-Z]/u.test(e))return!0;return!1}let t9=(0,u.createContext)({strict:!1}),se=(0,u.createContext)({});function st(e){return Array.isArray(e)?e.join(" "):e}let ss=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function si(e,t,s){for(let i in t)ej(t[i])||tW(i,s)||(e[i]=t[i])}let sr=()=>({...ss(),attrs:{}}),sn=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 sa(e){return e.startsWith("while")||e.startsWith("drag")&&"draggable"!==e||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||sn.has(e)}let so=e=>!sa(e);try{d=(()=>{let e=Error("Cannot find module '@emotion/is-prop-valid'");throw e.code="MODULE_NOT_FOUND",e})().default,"function"==typeof d&&(so=e=>e.startsWith("on")?!sa(e):d(e))}catch{}function sl(e){return ej(e)?e.get():e}let sd=e=>(t,s)=>{let i=(0,u.useContext)(se),r=(0,u.useContext)(g),n=()=>(function({scrapeMotionValuesFromProps:e,createRenderState:t},s,i,r){return{latestValues:function(e,t,s,i){let r={},n=i(e,{});for(let e in n)r[e]=sl(n[e]);let{initial:a,animate:o}=e,l=tb(e),d=tj(e);t&&d&&!l&&!1!==e.inherit&&(void 0===a&&(a=t.initial),void 0===o&&(o=t.animate));let c=!!s&&!1===s.initial,u=(c=c||!1===a)?o:a;if(u&&"boolean"!=typeof u&&!tf(u)){let t=Array.isArray(u)?u:[u];for(let s=0;s<t.length;s++){let i=tN(e,t[s]);if(i){let{transitionEnd:e,transition:t,...s}=i;for(let e in s){let t=s[e];if(Array.isArray(t)){let e=c?t.length-1:0;t=t[e]}null!==t&&(r[e]=t)}for(let t in e)r[t]=e[t]}}}return r}(s,i,r,e),renderState:t()}})(e,t,i,r);return s?n():p(n)},sc=sd({scrapeMotionValuesFromProps:tq,createRenderState:ss}),su=sd({scrapeMotionValuesFromProps:tK,createRenderState:sr}),sh={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"]},sm=!1;function sp(){return!function(){if(sm)return;let e={};for(let t in sh)e[t]={isEnabled:e=>sh[t].some(t=>!!e[t])};tS=e,sm=!0}(),tS}let sx=Symbol.for("motionComponentSymbol"),sf="data-"+tA("framerAppearId"),sg=(0,u.createContext)({});function sy(e){return e&&"object"==typeof e&&Object.prototype.hasOwnProperty.call(e,"current")}function sv(e,{forwardMotionProps:t=!1,type:s}={},i,r){i&&function(e){let t=sp();for(let s in e)t[s]={...t[s],...e[s]};tS=t}(i);let n=s?"svg"===s:t7(e),a=n?su:sc;function o(s,i){var o;let l,d,h,p={...(0,u.useContext)(j),...s,layoutId:function({layoutId:e}){let t=(0,u.useContext)(m).id;return t&&void 0!==e?t+"-"+e:e}(s)},{isStatic:y}=p,v=function(e){let{initial:t,animate:s}=function(e,t){if(tb(e)){let{initial:t,animate:s}=e;return{initial:!1===t||tg(t)?t:void 0,animate:tg(s)?s:void 0}}return!1!==e.inherit?t:{}}(e,(0,u.useContext)(se));return(0,u.useMemo)(()=>({initial:t,animate:s}),[st(t),st(s)])}(s),b=a(s,y);if(!y&&x){(0,u.useContext)(t9).strict;let t=function(e){let{drag:t,layout:s}=sp();if(!t&&!s)return{};let i={...t,...s};return{MeasureLayout:t?.isEnabled(e)||s?.isEnabled(e)?i.MeasureLayout:void 0,ProjectionNode:i.ProjectionNode}}(p);l=t.MeasureLayout,v.visualElement=function(e,t,s,i,r,n){let{visualElement:a}=(0,u.useContext)(se),o=(0,u.useContext)(t9),l=(0,u.useContext)(g),d=(0,u.useContext)(j).reducedMotion,c=(0,u.useRef)(null),h=(0,u.useRef)(!1);i=i||o.renderer,!c.current&&i&&(c.current=i(e,{visualState:t,parent:a,props:s,presenceContext:l,blockInitialAnimation:!!l&&!1===l.initial,reducedMotionConfig:d,isSVG:n}),h.current&&c.current&&(c.current.manuallyAnimateOnMount=!0));let m=c.current,p=(0,u.useContext)(sg);m&&!m.projection&&r&&("html"===m.type||"svg"===m.type)&&function(e,t,s,i){let{layoutId:r,layout:n,drag:a,dragConstraints:o,layoutScroll:l,layoutRoot:d,layoutCrossfade:c}=t;e.projection=new s(e.latestValues,t["data-framer-portal-id"]?void 0:function e(t){if(t)return!1!==t.options.allowProjection?t.projection:e(t.parent)}(e.parent)),e.projection.setOptions({layoutId:r,layout:n,alwaysMeasureLayout:!!a||o&&sy(o),visualElement:e,animationType:"string"==typeof n?n:"both",initialPromotionConfig:i,crossfade:c,layoutScroll:l,layoutRoot:d})}(c.current,s,r,p);let x=(0,u.useRef)(!1);(0,u.useInsertionEffect)(()=>{m&&x.current&&m.update(s,l)});let y=s[sf],v=(0,u.useRef)(!!y&&!window.MotionHandoffIsComplete?.(y)&&window.MotionHasOptimisedAnimation?.(y));return f(()=>{h.current=!0,m&&(x.current=!0,window.MotionIsMounted=!0,m.updateFeatures(),m.scheduleRenderMicrotask(),v.current&&m.animationState&&m.animationState.animateChanges())}),(0,u.useEffect)(()=>{m&&(!v.current&&m.animationState&&m.animationState.animateChanges(),v.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(y)}),v.current=!1),m.enteringChildren=void 0)}),m}(e,b,p,r,t.ProjectionNode,n)}return(0,c.jsxs)(se.Provider,{value:v,children:[l&&v.visualElement?(0,c.jsx)(l,{visualElement:v.visualElement,...p}):null,function(e,t,s,{latestValues:i},r,n=!1,a){let o=(a??t7(e)?function(e,t,s,i){let r=(0,u.useMemo)(()=>{let s=sr();return tF(s,t,tz(i),e.transformTemplate,e.style),{...s.attrs,style:{...s.style}}},[t]);if(e.style){let t={};si(t,e.style,e),r.style={...t,...r.style}}return r}:function(e,t){let s,i,r={},n=(s=e.style||{},si(i={},s,e),Object.assign(i,function({transformTemplate:e},t){return(0,u.useMemo)(()=>{let s=ss();return tD(s,t,e),Object.assign({},s.vars,s.style)},[t])}(e,t)),i);return e.drag&&!1!==e.dragListener&&(r.draggable=!1,n.userSelect=n.WebkitUserSelect=n.WebkitTouchCallout="none",n.touchAction=!0===e.drag?"none":`pan-${"x"===e.drag?"y":"x"}`),void 0===e.tabIndex&&(e.onTap||e.onTapStart||e.whileTap)&&(r.tabIndex=0),r.style=n,r})(t,i,r,e),l=function(e,t,s){let i={};for(let r in e)("values"!==r||"object"!=typeof e.values)&&(so(r)||!0===s&&sa(r)||!t&&!sa(r)||e.draggable&&r.startsWith("onDrag"))&&(i[r]=e[r]);return i}(t,"string"==typeof e,n),d=e!==u.Fragment?{...l,...o,ref:s}:{},{children:c}=t,h=(0,u.useMemo)(()=>ej(c)?c.get():c,[c]);return(0,u.createElement)(e,{...d,children:h})}(e,s,(o=v.visualElement,d=(0,u.useRef)(i),(0,u.useInsertionEffect)(()=>{d.current=i}),h=(0,u.useRef)(null),(0,u.useCallback)(e=>{e&&b.onMount?.(e),o&&(e?o.mount(e):o.unmount());let t=d.current;if("function"==typeof t)if(e){let s=t(e);"function"==typeof s&&(h.current=s)}else h.current?(h.current(),h.current=null):t(e);else t&&(t.current=e)},[o])),b,y,t,n)]})}o.displayName=`motion.${"string"==typeof e?e:`create(${e.displayName??e.name??""})`}`;let l=(0,u.forwardRef)(o);return l[sx]=e,l}class sb{constructor(e){this.isMounted=!1,this.node=e}update(){}}function sj(e,t,s){let i=e.getProps();return tN(i,t,void 0!==s?s:i.custom,e)}function sw(e,t){return e?.[t]??e?.default??e}let sN=e=>Array.isArray(e);function sk(e,t){let s=e.getValue("willChange");if(ej(s)&&s.add)return s.add(t);if(!s&&eG.WillChange){let s=new eG.WillChange("auto");e.addValue("willChange",s),s.add(t)}}let sS=e=>1e3*e,sC=(e,t)=>s=>t(e(s)),sT=(...e)=>e.reduce(sC),sA={layout:0,mainThread:0,waapi:0};function sM(e,t,s){return(s<0&&(s+=1),s>1&&(s-=1),s<1/6)?e+(t-e)*6*s:s<.5?t:s<2/3?e+(t-e)*(2/3-s)*6:e}function sP(e,t){return s=>s>0?t:e}let sE=(e,t,s)=>{let i=e*e,r=s*(t*t-i)+i;return r<0?0:Math.sqrt(r)},sD=[W,U,J];function sL(e){let t=sD.find(t=>t.test(e));if(eC(!!t,`'${e}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!t)return!1;let s=t.parse(e);return t===J&&(s=function({hue:e,saturation:t,lightness:s,alpha:i}){e/=360,s/=100;let r=0,n=0,a=0;if(t/=100){let i=s<.5?s*(1+t):s+t-s*t,o=2*s-i;r=sM(o,i,e+1/3),n=sM(o,i,e),a=sM(o,i,e-1/3)}else r=n=a=s;return{red:Math.round(255*r),green:Math.round(255*n),blue:Math.round(255*a),alpha:i}}(s)),s}let sR=(e,t)=>{let s=sL(e),i=sL(t);if(!s||!i)return sP(e,t);let r={...s};return e=>(r.red=sE(s.red,i.red,e),r.green=sE(s.green,i.green,e),r.blue=sE(s.blue,i.blue,e),r.alpha=tB(s.alpha,i.alpha,e),U.transform(r))},sV=new Set(["none","hidden"]);function sF(e,t){return s=>tB(e,t,s)}function s$(e){return"number"==typeof e?sF:"string"==typeof e?eE(e)?sP:Z.test(e)?sR:sI:Array.isArray(e)?sz:"object"==typeof e?Z.test(e)?sR:s_:sP}function sz(e,t){let s=[...e],i=s.length,r=e.map((e,s)=>s$(e)(e,t[s]));return e=>{for(let t=0;t<i;t++)s[t]=r[t](e);return s}}function s_(e,t){let s={...e,...t},i={};for(let r in s)void 0!==e[r]&&void 0!==t[r]&&(i[r]=s$(e[r])(e[r],t[r]));return e=>{for(let t in i)s[t]=i[t](e);return s}}let sI=(e,t)=>{let s=el.createTransformer(t),i=er(e),r=er(t);if(!(i.indexes.var.length===r.indexes.var.length&&i.indexes.color.length===r.indexes.color.length&&i.indexes.number.length>=r.indexes.number.length))return eC(!0,`Complex values '${e}' and '${t}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),sP(e,t);if(sV.has(e)&&!r.values.length||sV.has(t)&&!i.values.length)return sV.has(e)?s=>s<=0?e:t:s=>s>=1?t:e;return sT(sz(function(e,t){let s=[],i={color:0,var:0,number:0};for(let r=0;r<t.values.length;r++){let n=t.types[r],a=e.indexes[n][i[n]],o=e.values[a]??0;s[r]=o,i[n]++}return s}(i,r),r.values),s)};function sO(e,t,s){return"number"==typeof e&&"number"==typeof t&&"number"==typeof s?tB(e,t,s):s$(e)(e,t)}let sB=e=>{let t=({timestamp:t})=>e(t);return{start:(e=!0)=>eZ.update(t,e),stop:()=>e0(t),now:()=>e1.isProcessing?e1.timestamp:tl.now()}},sU=(e,t,s=10)=>{let i="",r=Math.max(Math.round(t/s),2);for(let t=0;t<r;t++)i+=Math.round(1e4*e(t/(r-1)))/1e4+", ";return`linear(${i.substring(0,i.length-2)})`};function sW(e){let t=0,s=e.next(t);for(;!s.done&&t<2e4;)t+=50,s=e.next(t);return t>=2e4?1/0:t}function sq(e,t,s){var i,r;let n=Math.max(t-5,0);return i=s-e(n),(r=t-n)?1e3/r*i:0}let sK=.01,sH=2,sY=.005,sX=.5;function sG(e,t){return e*Math.sqrt(1-t*t)}let sQ=["duration","bounce"],sJ=["stiffness","damping","mass"];function sZ(e,t){return t.some(t=>void 0!==e[t])}function s0(e=.3,t=.3){let s,i="object"!=typeof e?{visualDuration:e,keyframes:[0,1],bounce:t}:e,{restSpeed:r,restDelta:n}=i,a=i.keyframes[0],o=i.keyframes[i.keyframes.length-1],l={done:!1,value:a},{stiffness:d,damping:c,mass:u,duration:h,velocity:m,isResolvedFromDuration:p}=function(e){let t={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...e};if(!sZ(e,sJ)&&sZ(e,sQ))if(e.visualDuration){let s=2*Math.PI/(1.2*e.visualDuration),i=s*s,r=2*L(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:1,stiffness:i,damping:r}}else{let s=function({duration:e=800,bounce:t=.3,velocity:s=0,mass:i=1}){let r,n;eC(e<=sS(10),"Spring duration must be 10 seconds or less","spring-duration-limit");let a=1-t;a=L(.05,1,a),e=L(.01,10,e/1e3),a<1?(r=t=>{let i=t*a,r=i*e;return .001-(i-s)/sG(t,a)*Math.exp(-r)},n=t=>{let i=t*a*e,n=Math.pow(a,2)*Math.pow(t,2)*e,o=Math.exp(-i),l=sG(Math.pow(t,2),a);return(i*s+s-n)*o*(-r(t)+.001>0?-1:1)/l}):(r=t=>-.001+Math.exp(-t*e)*((t-s)*e+1),n=t=>e*e*(s-t)*Math.exp(-t*e));let o=function(e,t,s){let i=s;for(let s=1;s<12;s++)i-=e(i)/t(i);return i}(r,n,5/e);if(e=sS(e),isNaN(o))return{stiffness:100,damping:10,duration:e};{let t=Math.pow(o,2)*i;return{stiffness:t,damping:2*a*Math.sqrt(i*t),duration:e}}}(e);(t={...t,...s,mass:1}).isResolvedFromDuration=!0}return t}({...i,velocity:-((i.velocity||0)/1e3)}),x=m||0,f=c/(2*Math.sqrt(d*u)),g=o-a,y=Math.sqrt(d/u)/1e3,v=5>Math.abs(g);if(r||(r=v?sK:sH),n||(n=v?sY:sX),f<1){let e=sG(y,f);s=t=>o-Math.exp(-f*y*t)*((x+f*y*g)/e*Math.sin(e*t)+g*Math.cos(e*t))}else if(1===f)s=e=>o-Math.exp(-y*e)*(g+(x+y*g)*e);else{let e=y*Math.sqrt(f*f-1);s=t=>{let s=Math.exp(-f*y*t),i=Math.min(e*t,300);return o-s*((x+f*y*g)*Math.sinh(i)+e*g*Math.cosh(i))/e}}let b={calculatedDuration:p&&h||null,next:e=>{let t=s(e);if(p)l.done=e>=h;else{let i=0===e?x:0;f<1&&(i=0===e?sS(x):sq(s,e,t));let a=Math.abs(o-t)<=n;l.done=Math.abs(i)<=r&&a}return l.value=l.done?o:t,l},toString:()=>{let e=Math.min(sW(b),2e4),t=sU(t=>b.next(e*t).value,e,30);return e+"ms "+t},toTransition:()=>{}};return b}function s1({keyframes:e,velocity:t=0,power:s=.8,timeConstant:i=325,bounceDamping:r=10,bounceStiffness:n=500,modifyTarget:a,min:o,max:l,restDelta:d=.5,restSpeed:c}){let u,h,m=e[0],p={done:!1,value:m},x=s*t,f=m+x,g=void 0===a?f:a(f);g!==f&&(x=g-m);let y=e=>-x*Math.exp(-e/i),v=e=>g+y(e),b=e=>{let t=y(e),s=v(e);p.done=Math.abs(t)<=d,p.value=p.done?g:s},j=e=>{let t;if(t=p.value,void 0!==o&&t<o||void 0!==l&&t>l){var s;u=e,h=s0({keyframes:[p.value,(s=p.value,void 0===o?l:void 0===l||Math.abs(o-s)<Math.abs(l-s)?o:l)],velocity:sq(v,e,p.value),damping:r,stiffness:n,restDelta:d,restSpeed:c})}};return j(0),{calculatedDuration:null,next:e=>{let t=!1;return(h||void 0!==u||(t=!0,b(e),j(e)),void 0!==u&&e>=u)?h.next(e-u):(t||b(e),p)}}}s0.applyToOptions=e=>{let t=function(e,t=100,s){let i=s({...e,keyframes:[0,t]}),r=Math.min(sW(i),2e4);return{type:"keyframes",ease:e=>i.next(r*e).value/t,duration:r/1e3}}(e,100,s0);return e.ease=t.ease,e.duration=sS(t.duration),e.type="keyframes",e};let s5=(e,t,s)=>(((1-3*s+3*t)*e+(3*s-6*t))*e+3*t)*e;function s2(e,t,s,i){return e===t&&s===i?eX:r=>0===r||1===r?r:s5(function(e,t,s,i,r){let n,a,o=0;do(n=s5(a=t+(s-t)/2,i,r)-e)>0?s=a:t=a;while(Math.abs(n)>1e-7&&++o<12)return a}(r,0,1,e,s),t,i)}let s4=s2(.42,0,1,1),s3=s2(0,0,.58,1),s6=s2(.42,0,.58,1),s8=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,s7=e=>t=>1-e(1-t),s9=s2(.33,1.53,.69,.99),ie=s7(s9),it=s8(ie),is=e=>(e*=2)<1?.5*ie(e):.5*(2-Math.pow(2,-10*(e-1))),ii=e=>1-Math.sin(Math.acos(e)),ir=s7(ii),ia=s8(ii),io=e=>Array.isArray(e)&&"number"==typeof e[0],il={linear:eX,easeIn:s4,easeInOut:s6,easeOut:s3,circIn:ii,circInOut:ia,circOut:ir,backIn:ie,backInOut:it,backOut:s9,anticipate:is},id=e=>{if(io(e)){eT(4===e.length,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");let[t,s,i,r]=e;return s2(t,s,i,r)}return"string"==typeof e?(eT(void 0!==il[e],`Invalid easing type '${e}'`,"invalid-easing-type"),il[e]):e},ic=(e,t,s)=>{let i=t-e;return 0===i?1:(s-e)/i};function iu({duration:e=300,keyframes:t,times:s,ease:i="easeInOut"}){var r;let n,a=Array.isArray(i)&&"number"!=typeof i[0]?i.map(id):id(i),o={done:!1,value:t[0]},l=function(e,t,{clamp:s=!0,ease:i,mixer:r}={}){let n=e.length;if(eT(n===t.length,"Both input and output ranges must be the same length","range-length"),1===n)return()=>t[0];if(2===n&&t[0]===t[1])return()=>t[1];let a=e[0]===e[1];e[0]>e[n-1]&&(e=[...e].reverse(),t=[...t].reverse());let o=function(e,t,s){let i=[],r=s||eG.mix||sO,n=e.length-1;for(let s=0;s<n;s++){let n=r(e[s],e[s+1]);t&&(n=sT(Array.isArray(t)?t[s]||eX:t,n)),i.push(n)}return i}(t,i,r),l=o.length,d=s=>{if(a&&s<e[0])return t[0];let i=0;if(l>1)for(;i<e.length-2&&!(s<e[i+1]);i++);let r=ic(e[i],e[i+1],s);return o[i](r)};return s?t=>d(L(e[0],e[n-1],t)):d}((r=s&&s.length===t.length?s:(!function(e,t){let s=e[e.length-1];for(let i=1;i<=t;i++){let r=ic(0,t,i);e.push(tB(s,1,r))}}(n=[0],t.length-1),n),r.map(t=>t*e)),t,{ease:Array.isArray(a)?a:t.map(()=>a||s6).splice(0,t.length-1)});return{calculatedDuration:e,next:t=>(o.value=l(t),o.done=t>=e,o)}}let ih=e=>null!==e;function im(e,{repeat:t,repeatType:s="loop"},i,r=1){let n=e.filter(ih),a=r<0||t&&"loop"!==s&&t%2==1?0:n.length-1;return a&&void 0!==i?i:n[a]}let ip={decay:s1,inertia:s1,tween:iu,keyframes:iu,spring:s0};function ix(e){"string"==typeof e.type&&(e.type=ip[e.type])}class ig{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}}let iy=e=>e/100;class iv extends ig{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{let{motionValue:e}=this.options;e&&e.updatedAt!==tl.now()&&this.tick(tl.now()),this.isStopped=!0,"idle"!==this.state&&(this.teardown(),this.options.onStop?.())},sA.mainThread++,this.options=e,this.initAnimation(),this.play(),!1===e.autoplay&&this.pause()}initAnimation(){let{options:e}=this;ix(e);let{type:t=iu,repeat:s=0,repeatDelay:i=0,repeatType:r,velocity:n=0}=e,{keyframes:a}=e,o=t||iu;o!==iu&&"number"!=typeof a[0]&&(this.mixKeyframes=sT(iy,sO(a[0],a[1])),a=[0,100]);let l=o({...e,keyframes:a});"mirror"===r&&(this.mirroredGenerator=o({...e,keyframes:[...a].reverse(),velocity:-n})),null===l.calculatedDuration&&(l.calculatedDuration=sW(l));let{calculatedDuration:d}=l;this.calculatedDuration=d,this.resolvedDuration=d+i,this.totalDuration=this.resolvedDuration*(s+1)-i,this.generator=l}updateTime(e){let t=Math.round(e-this.startTime)*this.playbackSpeed;null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=t}tick(e,t=!1){let{generator:s,totalDuration:i,mixKeyframes:r,mirroredGenerator:n,resolvedDuration:a,calculatedDuration:o}=this;if(null===this.startTime)return s.next(0);let{delay:l=0,keyframes:d,repeat:c,repeatType:u,repeatDelay:h,type:m,onUpdate:p,finalKeyframe:x}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-i/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);let f=this.currentTime-l*(this.playbackSpeed>=0?1:-1),g=this.playbackSpeed>=0?f<0:f>i;this.currentTime=Math.max(f,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=i);let y=this.currentTime,v=s;if(c){let e=Math.min(this.currentTime,i)/a,t=Math.floor(e),s=e%1;!s&&e>=1&&(s=1),1===s&&t--,(t=Math.min(t,c+1))%2&&("reverse"===u?(s=1-s,h&&(s-=h/a)):"mirror"===u&&(v=n)),y=L(0,1,s)*a}let b=g?{done:!1,value:d[0]}:v.next(y);r&&(b.value=r(b.value));let{done:j}=b;g||null===o||(j=this.playbackSpeed>=0?this.currentTime>=i:this.currentTime<=0);let w=null===this.holdTime&&("finished"===this.state||"running"===this.state&&j);return w&&m!==s1&&(b.value=im(d,this.options,x,this.speed)),p&&p(b.value),w&&this.finish(),b}then(e,t){return this.finished.then(e,t)}get duration(){return this.calculatedDuration/1e3}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+e/1e3}get time(){return this.currentTime/1e3}set time(e){e=sS(e),this.currentTime=e,null===this.startTime||null!==this.holdTime||0===this.playbackSpeed?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(e){this.updateTime(tl.now());let t=this.playbackSpeed!==e;this.playbackSpeed=e,t&&(this.time=this.currentTime/1e3)}play(){if(this.isStopped)return;let{driver:e=sB,startTime:t}=this.options;this.driver||(this.driver=e(e=>this.tick(e))),this.options.onPlay?.();let s=this.driver.now();"finished"===this.state?(this.updateFinished(),this.startTime=s):null!==this.holdTime?this.startTime=s-this.holdTime:this.startTime||(this.startTime=t??s),"finished"===this.state&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(tl.now()),this.holdTime=this.currentTime}complete(){"running"!==this.state&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null,sA.mainThread--}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),e.observe(this)}}function ib(e){let t;return()=>(void 0===t&&(t=e()),t)}let ij=ib(()=>void 0!==window.ScrollTimeline),iw={},iN=(s=ib(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(e){return!1}return!0}),()=>iw.linearEasing??s()),ik=([e,t,s,i])=>`cubic-bezier(${e}, ${t}, ${s}, ${i})`,iS={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:ik([0,.65,.55,1]),circOut:ik([.55,0,1,.45]),backIn:ik([.31,.01,.66,-.59]),backOut:ik([.33,1.53,.69,.99])};function iC(e){return"function"==typeof e&&"applyToOptions"in e}class iT extends ig{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;const{element:t,name:s,keyframes:i,pseudoElement:r,allowFlatten:n=!1,finalKeyframe:a,onComplete:o}=e;this.isPseudoElement=!!r,this.allowFlatten=n,this.options=e,eT("string"!=typeof e.type,'Mini animate() doesn\'t support "type" as a string.',"mini-spring");const l=function({type:e,...t}){return iC(e)&&iN()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}(e);this.animation=function(e,t,s,{delay:i=0,duration:r=300,repeat:n=0,repeatType:a="loop",ease:o="easeOut",times:l}={},d){let c={[t]:s};l&&(c.offset=l);let u=function e(t,s){if(t)return"function"==typeof t?iN()?sU(t,s):"ease-out":io(t)?ik(t):Array.isArray(t)?t.map(t=>e(t,s)||iS.easeOut):iS[t]}(o,r);Array.isArray(u)&&(c.easing=u);let h={delay:i,duration:r,easing:Array.isArray(u)?"linear":u,fill:"both",iterations:n+1,direction:"reverse"===a?"alternate":"normal"};d&&(h.pseudoElement=d);let m=e.animate(c,h);return m}(t,s,i,l,r),!1===l.autoplay&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!r){let e=im(i,this.options,a,this.speed);this.updateMotionValue?this.updateMotionValue(e):s.startsWith("--")?t.style.setProperty(s,e):t.style[s]=e,this.animation.cancel()}o?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),"finished"===this.state&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch(e){}}stop(){if(this.isStopped)return;this.isStopped=!0;let{state:e}=this;"idle"!==e&&"finished"!==e&&(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){this.isPseudoElement||this.animation.commitStyles?.()}get duration(){return Number(this.animation.effect?.getComputedTiming?.().duration||0)/1e3}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+e/1e3}get time(){return(Number(this.animation.currentTime)||0)/1e3}set time(e){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=sS(e)}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return null!==this.finishedTime?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,observe:t}){return(this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,e&&ij())?(this.animation.timeline=e,eX):t(this)}}let iA={anticipate:is,backInOut:it,circInOut:ia};class iM extends iT{constructor(e){!function(e){"string"==typeof e.ease&&e.ease in iA&&(e.ease=iA[e.ease])}(e),ix(e),super(e),void 0!==e.startTime&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){let{motionValue:t,onUpdate:s,onComplete:i,element:r,...n}=this.options;if(!t)return;if(void 0!==e)return void t.set(e);let a=new iv({...n,autoplay:!1}),o=Math.max(10,tl.now()-this.startTime),l=L(0,10,o-10);t.setWithVelocity(a.sample(Math.max(0,o-l)).value,a.sample(o).value,l),a.stop()}}let iP=(e,t)=>"zIndex"!==t&&!!("number"==typeof e||Array.isArray(e)||"string"==typeof e&&(el.test(e)||"0"===e)&&!e.startsWith("url("));function iE(e){e.duration=0,e.type="keyframes"}let iD=new Set(["opacity","clipPath","filter","transform"]),iL=ib(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));class iR extends ig{constructor({autoplay:e=!0,delay:t=0,type:s="keyframes",repeat:i=0,repeatDelay:r=0,repeatType:n="loop",keyframes:a,name:o,motionValue:l,element:d,...c}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=tl.now();const u={autoplay:e,delay:t,type:s,repeat:i,repeatDelay:r,repeatType:n,name:o,motionValue:l,element:d,...c},h=d?.KeyframeResolver||e9;this.keyframeResolver=new h(a,(e,t,s)=>this.onKeyframesResolved(e,t,u,!s),o,l,d),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,s,i){this.keyframeResolver=void 0;let{name:r,type:n,velocity:a,delay:o,isHandoff:l,onUpdate:d}=s;this.resolvedAt=tl.now(),!function(e,t,s,i){let r=e[0];if(null===r)return!1;if("display"===t||"visibility"===t)return!0;let n=e[e.length-1],a=iP(r,t),o=iP(n,t);return eC(a===o,`You are trying to animate ${t} from "${r}" to "${n}". "${a?n:r}" is not an animatable value.`,"value-not-animatable"),!!a&&!!o&&(function(e){let t=e[0];if(1===e.length)return!0;for(let s=0;s<e.length;s++)if(e[s]!==t)return!0}(e)||("spring"===s||iC(s))&&i)}(e,r,n,a)&&((eG.instantAnimations||!o)&&d?.(im(e,s,t)),e[0]=e[e.length-1],iE(s),s.repeat=0);let c={startTime:i?this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt:void 0,finalKeyframe:t,...s,keyframes:e},u=!l&&function(e){let{motionValue:t,name:s,repeatDelay:i,repeatType:r,damping:n,type:a}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;let{onUpdate:o,transformTemplate:l}=t.owner.getProps();return iL()&&s&&iD.has(s)&&("transform"!==s||!l)&&!o&&!i&&"mirror"!==r&&0!==n&&"inertia"!==a}(c),h=c.motionValue?.owner?.current,m=u?new iM({...c,element:h}):new iv(c);m.finished.then(()=>{this.notifyFinished()}).catch(eX),this.pendingTimeline&&(this.stopTimeline=m.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=m}get finished(){return this._animation?this.animation.finished:this._finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),e6=!0,e7(),e8(),e6=!1),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}let iV={type:"spring",stiffness:500,damping:25,restSpeed:10},iF={type:"keyframes",duration:.8},i$={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},iz=e=>null!==e,i_=(e,t,s,i={},r,n)=>a=>{let o=sw(i,e)||{},l=o.delay||i.delay||0,{elapsed:d=0}=i;d-=sS(l);let c={keyframes:Array.isArray(s)?s:[null,s],ease:"easeOut",velocity:t.getVelocity(),...o,delay:-d,onUpdate:e=>{t.set(e),o.onUpdate&&o.onUpdate(e)},onComplete:()=>{a(),o.onComplete&&o.onComplete()},name:e,motionValue:t,element:n?void 0:r};!function({when:e,delay:t,delayChildren:s,staggerChildren:i,staggerDirection:r,repeat:n,repeatType:a,repeatDelay:o,from:l,elapsed:d,...c}){return!!Object.keys(c).length}(o)&&Object.assign(c,((e,{keyframes:t})=>t.length>2?iF:D.has(e)?e.startsWith("scale")?{type:"spring",stiffness:550,damping:0===t[1]?2*Math.sqrt(550):30,restSpeed:10}:iV:i$)(e,c)),c.duration&&(c.duration=sS(c.duration)),c.repeatDelay&&(c.repeatDelay=sS(c.repeatDelay)),void 0!==c.from&&(c.keyframes[0]=c.from);let u=!1;if(!1!==c.type&&(0!==c.duration||c.repeatDelay)||(iE(c),0===c.delay&&(u=!0)),(eG.instantAnimations||eG.skipAnimations)&&(u=!0,iE(c),c.delay=0),c.allowFlatten=!o.type&&!o.ease,u&&!n&&void 0!==t.get()){let e=function(e,{repeat:t,repeatType:s="loop"},i){let r=e.filter(iz),n=t&&"loop"!==s&&t%2==1?0:r.length-1;return r[n]}(c.keyframes,o);if(void 0!==e)return void eZ.update(()=>{c.onUpdate(e),c.onComplete()})}return o.isSync?new iv(c):new iR(c)};function iI(e,t,{delay:s=0,transitionOverride:i,type:r}={}){let{transition:n=e.getDefaultTransition(),transitionEnd:a,...o}=t;i&&(n=i);let l=[],d=r&&e.animationState&&e.animationState.getState()[r];for(let t in o){let i=e.getValue(t,e.latestValues[t]??null),r=o[t];if(void 0===r||d&&function({protectedKeys:e,needsAnimating:t},s){let i=e.hasOwnProperty(s)&&!0!==t[s];return t[s]=!1,i}(d,t))continue;let a={delay:s,...sw(n||{},t)},c=i.get();if(void 0!==c&&!i.isAnimating&&!Array.isArray(r)&&r===c&&!a.velocity)continue;let u=!1;if(window.MotionHandoffAnimation){let s=e.props[sf];if(s){let e=window.MotionHandoffAnimation(s,t,eZ);null!==e&&(a.startTime=e,u=!0)}}sk(e,t),i.start(i_(t,i,r,e.shouldReduceMotion&&ew.has(t)?{type:!1}:a,e,u));let h=i.animation;h&&l.push(h)}return a&&Promise.all(l).then(()=>{eZ.update(()=>{a&&function(e,t){let{transitionEnd:s={},transition:i={},...r}=sj(e,t)||{};for(let t in r={...r,...s}){var n;let s=sN(n=r[t])?n[n.length-1]||0:n;e.hasValue(t)?e.getValue(t).set(s):e.addValue(t,tc(s))}}(e,a)})}),l}function iO(e,t,s,i=0,r=1){let n=Array.from(e).sort((e,t)=>e.sortNodePosition(t)).indexOf(t),a=e.size,o=(a-1)*i;return"function"==typeof s?s(n,a):1===r?n*i:o-n*i}function iB(e,t,s={}){let i=sj(e,t,"exit"===s.type?e.presenceContext?.custom:void 0),{transition:r=e.getDefaultTransition()||{}}=i||{};s.transitionOverride&&(r=s.transitionOverride);let n=i?()=>Promise.all(iI(e,i,s)):()=>Promise.resolve(),a=e.variantChildren&&e.variantChildren.size?(i=0)=>{let{delayChildren:n=0,staggerChildren:a,staggerDirection:o}=r;return function(e,t,s=0,i=0,r=0,n=1,a){let o=[];for(let l of e.variantChildren)l.notify("AnimationStart",t),o.push(iB(l,t,{...a,delay:s+("function"==typeof i?0:i)+iO(e.variantChildren,l,i,r,n)}).then(()=>l.notify("AnimationComplete",t)));return Promise.all(o)}(e,t,i,n,a,o,s)}:()=>Promise.resolve(),{when:o}=r;if(!o)return Promise.all([n(),a(s.delay)]);{let[e,t]="beforeChildren"===o?[n,a]:[a,n];return e().then(()=>t())}}let iU=tv.length;function iW(e,t){if(!Array.isArray(t))return!1;let s=t.length;if(s!==e.length)return!1;for(let i=0;i<s;i++)if(t[i]!==e[i])return!1;return!0}let iq=[...ty].reverse(),iK=ty.length;function iH(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function iY(){return{animate:iH(!0),whileInView:iH(),whileHover:iH(),whileTap:iH(),whileDrag:iH(),whileFocus:iH(),exit:iH()}}let iX=0;function iG(e){return[e("x"),e("y")]}let iQ=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function iJ(e){return iQ.has(e.tagName)||!0===e.isContentEditable}function iZ(e,t,s,i={passive:!0}){return e.addEventListener(t,s,i),()=>e.removeEventListener(t,s)}let i0={x:!1,y:!1};function i1(e){return e.max-e.min}function i5(e,t,s,i=.5){e.origin=i,e.originPoint=tB(t.min,t.max,e.origin),e.scale=i1(s)/i1(t),e.translate=tB(s.min,s.max,e.origin)-e.originPoint,(e.scale>=.9999&&e.scale<=1.0001||isNaN(e.scale))&&(e.scale=1),(e.translate>=-.01&&e.translate<=.01||isNaN(e.translate))&&(e.translate=0)}function i2(e,t,s,i){i5(e.x,t.x,s.x,i?i.originX:void 0),i5(e.y,t.y,s.y,i?i.originY:void 0)}function i4(e,t,s){e.min=s.min+t.min,e.max=e.min+i1(t)}function i3(e,t,s){e.min=t.min-s.min,e.max=e.min+i1(t)}function i6(e,t,s){i3(e.x,t.x,s.x),i3(e.y,t.y,s.y)}let i8=e=>"mouse"===e.pointerType?"number"!=typeof e.button||e.button<=0:!1!==e.isPrimary;function i7(e){return{point:{x:e.pageX,y:e.pageY}}}function i9(e,t,s,i){return iZ(e,t,e=>i8(e)&&s(e,i7(e)),i)}let re=({current:e})=>e?e.ownerDocument.defaultView:null,rt=(e,t)=>Math.abs(e-t),rs=new Set(["auto","scroll"]);class ri{constructor(e,t,{transformPagePoint:s,contextWindow:i=window,dragSnapToOrigin:r=!1,distanceThreshold:n=3,element:a}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=e=>{this.handleScroll(e.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{var e,t;if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let s=ra(this.lastMoveEventInfo,this.history),i=null!==this.startEvent,r=(e=s.offset,t={x:0,y:0},Math.sqrt(rt(e.x,t.x)**2+rt(e.y,t.y)**2)>=this.distanceThreshold);if(!i&&!r)return;let{point:n}=s,{timestamp:a}=e1;this.history.push({...n,timestamp:a});let{onStart:o,onMove:l}=this.handlers;i||(o&&o(this.lastMoveEvent,s),this.startEvent=this.lastMoveEvent),l&&l(this.lastMoveEvent,s)},this.handlePointerMove=(e,t)=>{this.lastMoveEvent=e,this.lastMoveEventInfo=rr(t,this.transformPagePoint),eZ.update(this.updatePoint,!0)},this.handlePointerUp=(e,t)=>{this.end();let{onEnd:s,onSessionEnd:i,resumeAnimation:r}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&r&&r(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let n=ra("pointercancel"===e.type?this.lastMoveEventInfo:rr(t,this.transformPagePoint),this.history);this.startEvent&&s&&s(e,n),i&&i(e,n)},!i8(e))return;this.dragSnapToOrigin=r,this.handlers=t,this.transformPagePoint=s,this.distanceThreshold=n,this.contextWindow=i||window;const o=rr(i7(e),this.transformPagePoint),{point:l}=o,{timestamp:d}=e1;this.history=[{...l,timestamp:d}];const{onSessionStart:c}=t;c&&c(e,ra(o,this.history)),this.removeListeners=sT(i9(this.contextWindow,"pointermove",this.handlePointerMove),i9(this.contextWindow,"pointerup",this.handlePointerUp),i9(this.contextWindow,"pointercancel",this.handlePointerUp)),a&&this.startScrollTracking(a)}startScrollTracking(e){let t=e.parentElement;for(;t;){let e=getComputedStyle(t);(rs.has(e.overflowX)||rs.has(e.overflowY))&&this.scrollPositions.set(t,{x:t.scrollLeft,y:t.scrollTop}),t=t.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0,passive:!0}),window.addEventListener("scroll",this.onWindowScroll,{passive:!0}),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(e){let t=this.scrollPositions.get(e);if(!t)return;let s=e===window,i=s?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},r={x:i.x-t.x,y:i.y-t.y};(0!==r.x||0!==r.y)&&(s?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=r.x,this.lastMoveEventInfo.point.y+=r.y):this.history.length>0&&(this.history[0].x-=r.x,this.history[0].y-=r.y),this.scrollPositions.set(e,i),eZ.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),e0(this.updatePoint)}}function rr(e,t){return t?{point:t(e.point)}:e}function rn(e,t){return{x:e.x-t.x,y:e.y-t.y}}function ra({point:e},t){return{point:e,delta:rn(e,ro(t)),offset:rn(e,t[0]),velocity:function(e,t){if(e.length<2)return{x:0,y:0};let s=e.length-1,i=null,r=ro(e);for(;s>=0&&(i=e[s],!(r.timestamp-i.timestamp>sS(.1)));)s--;if(!i)return{x:0,y:0};let n=(r.timestamp-i.timestamp)/1e3;if(0===n)return{x:0,y:0};let a={x:(r.x-i.x)/n,y:(r.y-i.y)/n};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}(t,.1)}}function ro(e){return e[e.length-1]}function rl(e,t,s){return{min:void 0!==t?e.min+t:void 0,max:void 0!==s?e.max+s-(e.max-e.min):void 0}}function rd(e,t){let s=t.min-e.min,i=t.max-e.max;return t.max-t.min<e.max-e.min&&([s,i]=[i,s]),{min:s,max:i}}function rc(e,t,s){return{min:ru(e,t),max:ru(e,s)}}function ru(e,t){return"number"==typeof e?e:e[t]||0}let rh=new WeakMap;class rm{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=eb(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:t=!1,distanceThreshold:s}={}){let{presenceContext:i}=this.visualElement;if(i&&!1===i.isPresent)return;let r=e=>{t?(this.stopAnimation(),this.snapToCursor(i7(e).point)):this.pauseAnimation()},n=(e,t)=>{this.stopAnimation();let{drag:s,dragPropagation:i,onDragStart:r}=this.getProps();if(s&&!i&&(this.openDragLock&&this.openDragLock(),this.openDragLock=function(e){if("x"===e||"y"===e)if(i0[e])return null;else return i0[e]=!0,()=>{i0[e]=!1};return i0.x||i0.y?null:(i0.x=i0.y=!0,()=>{i0.x=i0.y=!1})}(s),!this.openDragLock))return;this.latestPointerEvent=e,this.latestPanInfo=t,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),iG(e=>{let t=this.getAxisMotionValue(e).get()||0;if(H.test(t)){let{projection:s}=this.visualElement;if(s&&s.layout){let i=s.layout.layoutBox[e];i&&(t=i1(i)*(parseFloat(t)/100))}}this.originPoint[e]=t}),r&&eZ.postRender(()=>r(e,t)),sk(this.visualElement,"transform");let{animationState:n}=this.visualElement;n&&n.setActive("whileDrag",!0)},a=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t;let{dragPropagation:s,dragDirectionLock:i,onDirectionLock:r,onDrag:n}=this.getProps();if(!s&&!this.openDragLock)return;let{offset:a}=t;if(i&&null===this.currentDirection){this.currentDirection=function(e,t=10){let s=null;return Math.abs(e.y)>t?s="y":Math.abs(e.x)>t&&(s="x"),s}(a),null!==this.currentDirection&&r&&r(this.currentDirection);return}this.updateAxis("x",t.point,a),this.updateAxis("y",t.point,a),this.visualElement.render(),n&&n(e,t)},o=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t,this.stop(e,t),this.latestPointerEvent=null,this.latestPanInfo=null},l=()=>iG(e=>"paused"===this.getAnimationState(e)&&this.getAxisMotionValue(e).animation?.play()),{dragSnapToOrigin:d}=this.getProps();this.panSession=new ri(e,{onSessionStart:r,onStart:n,onMove:a,onSessionEnd:o,resumeAnimation:l},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:d,distanceThreshold:s,contextWindow:re(this.visualElement),element:this.visualElement.current})}stop(e,t){let s=e||this.latestPointerEvent,i=t||this.latestPanInfo,r=this.isDragging;if(this.cancel(),!r||!i||!s)return;let{velocity:n}=i;this.startAnimation(n);let{onDragEnd:a}=this.getProps();a&&eZ.postRender(()=>a(s,i))}cancel(){this.isDragging=!1;let{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();let{dragPropagation:s}=this.getProps();!s&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t&&t.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,t,s){let{drag:i}=this.getProps();if(!s||!rp(e,i,this.currentDirection))return;let r=this.getAxisMotionValue(e),n=this.originPoint[e]+s[e];this.constraints&&this.constraints[e]&&(n=function(e,{min:t,max:s},i){return void 0!==t&&e<t?e=i?tB(t,e,i.min):Math.max(e,t):void 0!==s&&e>s&&(e=i?tB(s,e,i.max):Math.min(e,s)),e}(n,this.constraints[e],this.elastic[e])),r.set(n)}resolveConstraints(){let{dragConstraints:e,dragElastic:t}=this.getProps(),s=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,i=this.constraints;e&&sy(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&s?this.constraints=function(e,{top:t,left:s,bottom:i,right:r}){return{x:rl(e.x,s,r),y:rl(e.y,t,i)}}(s.layoutBox,e):this.constraints=!1,this.elastic=function(e=.35){return!1===e?e=0:!0===e&&(e=.35),{x:rc(e,"left","right"),y:rc(e,"top","bottom")}}(t),i!==this.constraints&&s&&this.constraints&&!this.hasMutatedConstraints&&iG(e=>{var t,i;let r;!1!==this.constraints&&this.getAxisMotionValue(e)&&(this.constraints[e]=(t=s.layoutBox[e],i=this.constraints[e],r={},void 0!==i.min&&(r.min=i.min-t.min),void 0!==i.max&&(r.max=i.max-t.min),r))})}resolveRefConstraints(){var e;let{dragConstraints:t,onMeasureDragConstraints:s}=this.getProps();if(!t||!sy(t))return!1;let i=t.current;eT(null!==i,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.","drag-constraints-ref");let{projection:r}=this.visualElement;if(!r||!r.layout)return!1;let n=function(e,t,s){let i=t3(e,s),{scroll:r}=t;return r&&(t5(i.x,r.offset.x),t5(i.y,r.offset.y)),i}(i,r.root,this.visualElement.getTransformPagePoint()),a=(e=r.layout.layoutBox,{x:rd(e.x,n.x),y:rd(e.y,n.y)});if(s){let e=s(function({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}(a));this.hasMutatedConstraints=!!e,e&&(a=tY(e))}return a}startAnimation(e){let{drag:t,dragMomentum:s,dragElastic:i,dragTransition:r,dragSnapToOrigin:n,onDragTransitionEnd:a}=this.getProps(),o=this.constraints||{};return Promise.all(iG(a=>{if(!rp(a,t,this.currentDirection))return;let l=o&&o[a]||{};n&&(l={min:0,max:0});let d={type:"inertia",velocity:s?e[a]:0,bounceStiffness:i?200:1e6,bounceDamping:i?40:1e7,timeConstant:750,restDelta:1,restSpeed:10,...r,...l};return this.startAxisValueAnimation(a,d)})).then(a)}startAxisValueAnimation(e,t){let s=this.getAxisMotionValue(e);return sk(this.visualElement,e),s.start(i_(e,s,0,t,this.visualElement,!1))}stopAnimation(){iG(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){iG(e=>this.getAxisMotionValue(e).animation?.pause())}getAnimationState(e){return this.getAxisMotionValue(e).animation?.state}getAxisMotionValue(e){let t=`_drag${e.toUpperCase()}`,s=this.visualElement.getProps();return s[t]||this.visualElement.getValue(e,(s.initial?s.initial[e]:void 0)||0)}snapToCursor(e){iG(t=>{let{drag:s}=this.getProps();if(!rp(t,s,this.currentDirection))return;let{projection:i}=this.visualElement,r=this.getAxisMotionValue(t);if(i&&i.layout){let{min:s,max:n}=i.layout.layoutBox[t],a=r.get()||0;r.set(e[t]-tB(s,n,.5)+a)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;let{drag:e,dragConstraints:t}=this.getProps(),{projection:s}=this.visualElement;if(!sy(t)||!s||!this.constraints)return;this.stopAnimation();let i={x:0,y:0};iG(e=>{let t=this.getAxisMotionValue(e);if(t&&!1!==this.constraints){var s,r;let n,a,o,l=t.get();i[e]=(s={min:l,max:l},r=this.constraints[e],n=.5,a=i1(s),(o=i1(r))>a?n=ic(r.min,r.max-a,s.min):a>o&&(n=ic(s.min,s.max-o,r.min)),L(0,1,n))}});let{transformTemplate:r}=this.visualElement.getProps();this.visualElement.current.style.transform=r?r({},""):"none",s.root&&s.root.updateScroll(),s.updateLayout(),this.resolveConstraints(),iG(t=>{if(!rp(t,e,null))return;let s=this.getAxisMotionValue(t),{min:r,max:n}=this.constraints[t];s.set(tB(r,n,i[t]))})}addListeners(){if(!this.visualElement.current)return;rh.set(this.visualElement,this);let e=this.visualElement.current,t=i9(e,"pointerdown",t=>{let{drag:s,dragListener:i=!0}=this.getProps(),r=t.target,n=r!==e&&iJ(r);s&&i&&!n&&this.start(t)}),s=()=>{let{dragConstraints:e}=this.getProps();sy(e)&&e.current&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,r=i.addEventListener("measure",s);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),eZ.read(s);let n=iZ(window,"resize",()=>this.scalePositionWithinConstraints()),a=i.addEventListener("didUpdate",({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&(iG(t=>{let s=this.getAxisMotionValue(t);s&&(this.originPoint[t]+=e[t].translate,s.set(s.get()+e[t].translate))}),this.visualElement.render())});return()=>{n(),t(),r(),a&&a()}}getProps(){let e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:s=!1,dragPropagation:i=!1,dragConstraints:r=!1,dragElastic:n=.35,dragMomentum:a=!0}=e;return{...e,drag:t,dragDirectionLock:s,dragPropagation:i,dragConstraints:r,dragElastic:n,dragMomentum:a}}}function rp(e,t,s){return(!0===t||t===e)&&(null===s||s===e)}let rx=e=>(t,s)=>{e&&eZ.postRender(()=>e(t,s))},rf={hasAnimatedSinceResize:!0,hasEverUpdated:!1};var rg=u;let ry=!1;class rv extends rg.Component{componentDidMount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:s,layoutId:i}=this.props,{projection:r}=e;r&&(t.group&&t.group.add(r),s&&s.register&&i&&s.register(r),ry&&r.root.didUpdate(),r.addEventListener("animationComplete",()=>{this.safeToRemove()}),r.setOptions({...r.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),rf.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){let{layoutDependency:t,visualElement:s,drag:i,isPresent:r}=this.props,{projection:n}=s;return n&&(n.isPresent=r,e.layoutDependency!==t&&n.setOptions({...n.options,layoutDependency:t}),ry=!0,i||e.layoutDependency!==t||void 0===t||e.isPresent!==r?n.willUpdate():this.safeToRemove(),e.isPresent!==r&&(r?n.promote():n.relegate()||eZ.postRender(()=>{let e=n.getStack();e&&e.members.length||this.safeToRemove()}))),null}componentDidUpdate(){let{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),ta.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:s}=this.props,{projection:i}=e;ry=!0,i&&(i.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(i),s&&s.deregister&&s.deregister(i))}safeToRemove(){let{safeToRemove:e}=this.props;e&&e()}render(){return null}}function rb(e){let[t,s]=T(),i=(0,rg.useContext)(m);return(0,c.jsx)(rv,{...e,layoutGroup:i,switchLayoutGroup:(0,rg.useContext)(sg),isPresent:t,safeToRemove:s})}function rj(e,t,s,i,r){return e-=t,e=i+1/s*(e-i),void 0!==r&&(e=i+1/r*(e-i)),e}function rw(e,t,[s,i,r],n,a){!function(e,t=0,s=1,i=.5,r,n=e,a=e){if(H.test(t)&&(t=parseFloat(t),t=tB(a.min,a.max,t/100)-a.min),"number"!=typeof t)return;let o=tB(n.min,n.max,i);e===n&&(o-=t),e.min=rj(e.min,t,s,o,r),e.max=rj(e.max,t,s,o,r)}(e,t[s],t[i],t[r],t.scale,n,a)}let rN=["x","scaleX","originX"],rk=["y","scaleY","originY"];function rS(e,t,s,i){rw(e.x,t,rN,s?s.x:void 0,i?i.x:void 0),rw(e.y,t,rk,s?s.y:void 0,i?i.y:void 0)}function rC(e,t){e.min=t.min,e.max=t.max}function rT(e,t){rC(e.x,t.x),rC(e.y,t.y)}function rA(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function rM(e){return 0===e.translate&&1===e.scale}function rP(e){return rM(e.x)&&rM(e.y)}function rE(e,t){return e.min===t.min&&e.max===t.max}function rD(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function rL(e,t){return rD(e.x,t.x)&&rD(e.y,t.y)}function rR(e){return i1(e.x)/i1(e.y)}function rV(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}let rF=["TopLeft","TopRight","BottomLeft","BottomRight"],r$=rF.length,rz=e=>"string"==typeof e?parseFloat(e):e,r_=e=>"number"==typeof e||Y.test(e);function rI(e,t){return void 0!==e[t]?e[t]:e.borderRadius}let rO=rU(0,.5,ir),rB=rU(.5,.95,eX);function rU(e,t,s){return i=>i<e?0:i>t?1:s(ic(e,t,i))}function rW(e){return y(e)&&"ownerSVGElement"in e}let rq=(e,t)=>e.depth-t.depth;class rK{constructor(){this.children=[],this.isDirty=!1}add(e){ti(this.children,e),this.isDirty=!0}remove(e){tr(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(rq),this.isDirty=!1,this.children.forEach(e)}}class rH{constructor(){this.members=[]}add(e){ti(this.members,e),e.scheduleRender()}remove(e){if(tr(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){let e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(e){let t,s=this.members.findIndex(t=>e===t);if(0===s)return!1;for(let e=s;e>=0;e--){let s=this.members[e];if(!1!==s.isPresent){t=s;break}}return!!t&&(this.promote(t),!0)}promote(e,t){let s=this.lead;if(e!==s&&(this.prevLead=s,this.lead=e,e.show(),s)){s.instance&&s.scheduleRender(),e.scheduleRender();let i=s.options.layoutDependency,r=e.options.layoutDependency;(void 0===i||void 0===r||i!==r)&&(e.resumeFrom=s,t&&(e.resumeFrom.preserveOpacity=!0),s.snapshot&&(e.snapshot=s.snapshot,e.snapshot.latestValues=s.animationValues||s.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0));let{crossfade:n}=e.options;!1===n&&s.hide()}}exitAnimationComplete(){this.members.forEach(e=>{let{options:t,resumingFrom:s}=e;t.onExitComplete&&t.onExitComplete(),s&&s.options.onExitComplete&&s.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}let rY=["","X","Y","Z"],rX=0;function rG(e,t,s,i){let{latestValues:r}=t;r[e]&&(s[e]=r[e],t.setStaticValue(e,0),i&&(i[e]=0))}function rQ({attachResizeListener:e,defaultParent:t,measureScroll:s,checkIsScrollRoot:i,resetTransform:r}){return class{constructor(e={},s=t?.()){this.id=rX++,this.animationId=0,this.animationCommitId=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.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(r0),this.nodes.forEach(r8),this.nodes.forEach(r7),this.nodes.forEach(r1)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=e,this.root=s?s.root||s:this,this.path=s?[...s.path,s]:[],this.parent=s,this.depth=s?s.depth+1:0;for(let e=0;e<this.path.length;e++)this.path[e].shouldResetTransform=!0;this.root===this&&(this.nodes=new rK)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new tn),this.eventHandlers.get(e).add(t)}notifyListeners(e,...t){let s=this.eventHandlers.get(e);s&&s.notify(...t)}hasListeners(e){return this.eventHandlers.has(e)}mount(t){if(this.instance)return;this.isSVG=rW(t)&&!(rW(t)&&"svg"===t.tagName),this.instance=t;let{layoutId:s,layout:i,visualElement:r}=this.options;if(r&&!r.current&&r.mount(t),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(i||s)&&(this.isLayoutDirty=!0),e){let s,i=0,r=()=>this.root.updateBlockedByResize=!1;eZ.read(()=>{i=window.innerWidth}),e(t,()=>{let e=window.innerWidth;if(e!==i){let t,n;i=e,this.root.updateBlockedByResize=!0,s&&s(),t=tl.now(),n=({timestamp:e})=>{let s=e-t;s>=250&&(e0(n),r(s-250))},eZ.setup(n,!0),s=()=>e0(n),rf.hasAnimatedSinceResize&&(rf.hasAnimatedSinceResize=!1,this.nodes.forEach(r6))}})}s&&this.root.registerSharedNode(s,this),!1!==this.options.animate&&r&&(s||i)&&this.addEventListener("didUpdate",({delta:e,hasLayoutChanged:t,hasRelativeLayoutChanged:s,layout:i})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}let n=this.options.transition||r.getDefaultTransition()||nr,{onLayoutAnimationStart:a,onLayoutAnimationComplete:o}=r.getProps(),l=!this.targetLayout||!rL(this.targetLayout,i),d=!t&&s;if(this.options.layoutRoot||this.resumeFrom||d||t&&(l||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);let t={...sw(n,"layout"),onPlay:a,onComplete:o};(r.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t),this.setAnimationOrigin(e,d)}else t||r6(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=i})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);let e=this.getStack();e&&e.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),e0(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(r9),this.animationId++)}getTransformTemplate(){let{visualElement:e}=this.options;return e&&e.getProps().transformTemplate}willUpdate(e=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&function e(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;let{visualElement:s}=t.options;if(!s)return;let i=s.props[sf];if(window.MotionHasOptimisedAnimation(i,"transform")){let{layout:e,layoutId:s}=t.options;window.MotionCancelOptimisedAnimation(i,"transform",eZ,!(e||s))}let{parent:r}=t;r&&!r.hasCheckedOptimisedAppear&&e(r)}(this),this.root.isUpdating||this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let e=0;e<this.path.length;e++){let t=this.path[e];t.shouldResetTransform=!0,t.updateScroll("snapshot"),t.options.layoutRoot&&t.willUpdate(!1)}let{layoutId:t,layout:s}=this.options;if(void 0===t&&!s)return;let i=this.getTransformTemplate();this.prevTransformTemplateValue=i?i(this.latestValues,""):void 0,this.updateSnapshot(),e&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(r2);return}if(this.animationId<=this.animationCommitId)return void this.nodes.forEach(r4);this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(r3),this.nodes.forEach(rJ),this.nodes.forEach(rZ)):this.nodes.forEach(r4),this.clearAllSnapshots();let e=tl.now();e1.delta=L(0,1e3/60,e-e1.timestamp),e1.timestamp=e,e1.isProcessing=!0,e5.update.process(e1),e5.preRender.process(e1),e5.render.process(e1),e1.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,ta.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(r5),this.sharedNodes.forEach(ne)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,eZ.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){eZ.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){!this.snapshot&&this.instance&&(this.snapshot=this.measure(),!this.snapshot||i1(this.snapshot.measuredBox.x)||i1(this.snapshot.measuredBox.y)||(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let e=0;e<this.path.length;e++)this.path[e].updateScroll();let e=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected=eb(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);let{visualElement:t}=this.options;t&&t.notify("LayoutMeasure",this.layout.layoutBox,e?e.layoutBox:void 0)}updateScroll(e="measure"){let t=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===e&&(t=!1),t&&this.instance){let t=i(this.instance);this.scroll={animationId:this.root.animationId,phase:e,isRoot:t,offset:s(this.instance),wasRoot:this.scroll?this.scroll.isRoot:t}}}resetTransform(){if(!r)return;let e=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,t=this.projectionDelta&&!rP(this.projectionDelta),s=this.getTransformTemplate(),i=s?s(this.latestValues,""):void 0,n=i!==this.prevTransformTemplateValue;e&&this.instance&&(t||tQ(this.latestValues)||n)&&(r(this.instance,i),this.shouldResetTransform=!1,this.scheduleRender())}measure(e=!0){var t;let s=this.measurePageBox(),i=this.removeElementScroll(s);return e&&(i=this.removeTransform(i)),no((t=i).x),no(t.y),{animationId:this.root.animationId,measuredBox:s,layoutBox:i,latestValues:{},source:this.id}}measurePageBox(){let{visualElement:e}=this.options;if(!e)return eb();let t=e.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(nd))){let{scroll:e}=this.root;e&&(t5(t.x,e.offset.x),t5(t.y,e.offset.y))}return t}removeElementScroll(e){let t=eb();if(rT(t,e),this.scroll?.wasRoot)return t;for(let s=0;s<this.path.length;s++){let i=this.path[s],{scroll:r,options:n}=i;i!==this.root&&r&&n.layoutScroll&&(r.wasRoot&&rT(t,e),t5(t.x,r.offset.x),t5(t.y,r.offset.y))}return t}applyTransform(e,t=!1){let s=eb();rT(s,e);for(let e=0;e<this.path.length;e++){let i=this.path[e];!t&&i.options.layoutScroll&&i.scroll&&i!==i.root&&t4(s,{x:-i.scroll.offset.x,y:-i.scroll.offset.y}),tQ(i.latestValues)&&t4(s,i.latestValues)}return tQ(this.latestValues)&&t4(s,this.latestValues),s}removeTransform(e){let t=eb();rT(t,e);for(let e=0;e<this.path.length;e++){let s=this.path[e];if(!s.instance||!tQ(s.latestValues))continue;tG(s.latestValues)&&s.updateSnapshot();let i=eb();rT(i,s.measurePageBox()),rS(t,s.latestValues,s.snapshot?s.snapshot.layoutBox:void 0,i)}return tQ(this.latestValues)&&rS(t,this.latestValues),t}setTargetDelta(e){this.targetDelta=e,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(e){this.options={...this.options,...e,crossfade:void 0===e.crossfade||e.crossfade}}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!==e1.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(e=!1){let t=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=t.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=t.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=t.isSharedProjectionDirty);let s=!!this.resumingFrom||this!==t;if(!(e||s&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;let{layout:i,layoutId:r}=this.options;if(!this.layout||!(i||r))return;this.resolvedRelativeTargetAt=e1.timestamp;let n=this.getClosestProjectingParent();if(n&&this.linkedParentVersion!==n.layoutVersion&&!n.options.layoutRoot&&this.removeRelativeTarget(),this.targetDelta||this.relativeTarget||(n&&n.layout?this.createRelativeTarget(n,this.layout.layoutBox,n.layout.layoutBox):this.removeRelativeTarget()),this.relativeTarget||this.targetDelta){if(this.target||(this.target=eb(),this.targetWithTransforms=eb()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target){var a,o,l;this.forceRelativeParentToResolveTarget(),a=this.target,o=this.relativeTarget,l=this.relativeParent.target,i4(a.x,o.x,l.x),i4(a.y,o.y,l.y)}else this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):rT(this.target,this.layout.layoutBox),t1(this.target,this.targetDelta)):rT(this.target,this.layout.layoutBox);this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,n&&!!n.resumingFrom==!!this.resumingFrom&&!n.options.layoutScroll&&n.target&&1!==this.animationProgress?this.createRelativeTarget(n,this.target,n.target):this.relativeParent=this.relativeTarget=void 0)}}getClosestProjectingParent(){if(!(!this.parent||tG(this.parent.latestValues)||tJ(this.parent.latestValues)))if(this.parent.isProjecting())return this.parent;else return this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(e,t,s){this.relativeParent=e,this.linkedParentVersion=e.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=eb(),this.relativeTargetOrigin=eb(),i6(this.relativeTargetOrigin,t,s),rT(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){let e=this.getLead(),t=!!this.resumingFrom||this!==e,s=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(s=!1),t&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(s=!1),this.resolvedRelativeTargetAt===e1.timestamp&&(s=!1),s)return;let{layout:i,layoutId:r}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(i||r))return;rT(this.layoutCorrected,this.layout.layoutBox);let n=this.treeScale.x,a=this.treeScale.y;!function(e,t,s,i=!1){let r,n,a=s.length;if(a){t.x=t.y=1;for(let o=0;o<a;o++){n=(r=s[o]).projectionDelta;let{visualElement:a}=r.options;(!a||!a.props.style||"contents"!==a.props.style.display)&&(i&&r.options.layoutScroll&&r.scroll&&r!==r.root&&t4(e,{x:-r.scroll.offset.x,y:-r.scroll.offset.y}),n&&(t.x*=n.x.scale,t.y*=n.y.scale,t1(e,n)),i&&tQ(r.latestValues)&&t4(e,r.latestValues))}t.x<1.0000000000001&&t.x>.999999999999&&(t.x=1),t.y<1.0000000000001&&t.y>.999999999999&&(t.y=1)}}(this.layoutCorrected,this.treeScale,this.path,t),e.layout&&!e.target&&(1!==this.treeScale.x||1!==this.treeScale.y)&&(e.target=e.layout.layoutBox,e.targetWithTransforms=eb());let{target:o}=e;if(!o){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}this.projectionDelta&&this.prevProjectionDelta?(rA(this.prevProjectionDelta.x,this.projectionDelta.x),rA(this.prevProjectionDelta.y,this.projectionDelta.y)):this.createProjectionDeltas(),i2(this.projectionDelta,this.layoutCorrected,o,this.latestValues),this.treeScale.x===n&&this.treeScale.y===a&&rV(this.projectionDelta.x,this.prevProjectionDelta.x)&&rV(this.projectionDelta.y,this.prevProjectionDelta.y)||(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",o))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(e=!0){if(this.options.visualElement?.scheduleRender(),e){let e=this.getStack();e&&e.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=ey(),this.projectionDelta=ey(),this.projectionDeltaWithTransform=ey()}setAnimationOrigin(e,t=!1){let s,i=this.snapshot,r=i?i.latestValues:{},n={...this.latestValues},a=ey();this.relativeParent&&this.relativeParent.options.layoutRoot||(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;let o=eb(),l=(i?i.source:void 0)!==(this.layout?this.layout.source:void 0),d=this.getStack(),c=!d||d.members.length<=1,u=!!(l&&!c&&!0===this.options.crossfade&&!this.path.some(ni));this.animationProgress=0,this.mixTargetDelta=t=>{let i=t/1e3;if(nt(a.x,e.x,i),nt(a.y,e.y,i),this.setTargetDelta(a),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout){var d,h,m,p,x,f;i6(o,this.layout.layoutBox,this.relativeParent.layout.layoutBox),m=this.relativeTarget,p=this.relativeTargetOrigin,x=o,f=i,ns(m.x,p.x,x.x,f),ns(m.y,p.y,x.y,f),s&&(d=this.relativeTarget,h=s,rE(d.x,h.x)&&rE(d.y,h.y))&&(this.isProjectionDirty=!1),s||(s=eb()),rT(s,this.relativeTarget)}l&&(this.animationValues=n,function(e,t,s,i,r,n){r?(e.opacity=tB(0,s.opacity??1,rO(i)),e.opacityExit=tB(t.opacity??1,0,rB(i))):n&&(e.opacity=tB(t.opacity??1,s.opacity??1,i));for(let r=0;r<r$;r++){let n=`border${rF[r]}Radius`,a=rI(t,n),o=rI(s,n);(void 0!==a||void 0!==o)&&(a||(a=0),o||(o=0),0===a||0===o||r_(a)===r_(o)?(e[n]=Math.max(tB(rz(a),rz(o),i),0),(H.test(o)||H.test(a))&&(e[n]+="%")):e[n]=o)}(t.rotate||s.rotate)&&(e.rotate=tB(t.rotate||0,s.rotate||0,i))}(n,r,this.latestValues,i,u,c)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=i},this.mixTargetDelta(1e3*!!this.options.layoutRoot)}startAnimation(e){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(e0(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=eZ.update(()=>{var t,s,i;let r;rf.hasAnimatedSinceResize=!0,sA.layout++,this.motionValue||(this.motionValue=tc(0)),this.currentAnimation=(t=this.motionValue,s=[0,1e3],i={...e,velocity:0,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onStop:()=>{sA.layout--},onComplete:()=>{sA.layout--,e.onComplete&&e.onComplete(),this.completeAnimation()}},(r=ej(t)?t:tc(t)).start(i_("",r,s,i)),r.animation),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);let e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(1e3),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){let e=this.getLead(),{targetWithTransforms:t,target:s,layout:i,latestValues:r}=e;if(t&&s&&i){if(this!==e&&this.layout&&i&&nl(this.options.animationType,this.layout.layoutBox,i.layoutBox)){s=this.target||eb();let t=i1(this.layout.layoutBox.x);s.x.min=e.target.x.min,s.x.max=s.x.min+t;let i=i1(this.layout.layoutBox.y);s.y.min=e.target.y.min,s.y.max=s.y.min+i}rT(t,s),t4(t,r),i2(this.projectionDeltaWithTransform,this.layoutCorrected,t,r)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new rH),this.sharedNodes.get(e).add(t);let s=t.options.initialPromotionConfig;t.promote({transition:s?s.transition:void 0,preserveFollowOpacity:s&&s.shouldPreserveFollowOpacity?s.shouldPreserveFollowOpacity(t):void 0})}isLead(){let e=this.getStack();return!e||e.lead===this}getLead(){let{layoutId:e}=this.options;return e&&this.getStack()?.lead||this}getPrevLead(){let{layoutId:e}=this.options;return e?this.getStack()?.prevLead:void 0}getStack(){let{layoutId:e}=this.options;if(e)return this.root.sharedNodes.get(e)}promote({needsReset:e,transition:t,preserveFollowOpacity:s}={}){let i=this.getStack();i&&i.promote(this,s),e&&(this.projectionDelta=void 0,this.needsReset=!0),t&&this.setOptions({transition:t})}relegate(){let e=this.getStack();return!!e&&e.relegate(this)}resetSkewAndRotation(){let{visualElement:e}=this.options;if(!e)return;let t=!1,{latestValues:s}=e;if((s.z||s.rotate||s.rotateX||s.rotateY||s.rotateZ||s.skewX||s.skewY)&&(t=!0),!t)return;let i={};s.z&&rG("z",e,i,this.animationValues);for(let t=0;t<rY.length;t++)rG(`rotate${rY[t]}`,e,i,this.animationValues),rG(`skew${rY[t]}`,e,i,this.animationValues);for(let t in e.render(),i)e.setStaticValue(t,i[t]),this.animationValues&&(this.animationValues[t]=i[t]);e.scheduleRender()}applyProjectionStyles(e,t){if(!this.instance||this.isSVG)return;if(!this.isVisible){e.visibility="hidden";return}let s=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,e.visibility="",e.opacity="",e.pointerEvents=sl(t?.pointerEvents)||"",e.transform=s?s(this.latestValues,""):"none";return}let i=this.getLead();if(!this.projectionDelta||!this.layout||!i.target){this.options.layoutId&&(e.opacity=void 0!==this.latestValues.opacity?this.latestValues.opacity:1,e.pointerEvents=sl(t?.pointerEvents)||""),this.hasProjected&&!tQ(this.latestValues)&&(e.transform=s?s({},""):"none",this.hasProjected=!1);return}e.visibility="";let r=i.animationValues||i.latestValues;this.applyTransformsToTarget();let n=function(e,t,s){let i="",r=e.x.translate/t.x,n=e.y.translate/t.y,a=s?.z||0;if((r||n||a)&&(i=`translate3d(${r}px, ${n}px, ${a}px) `),(1!==t.x||1!==t.y)&&(i+=`scale(${1/t.x}, ${1/t.y}) `),s){let{transformPerspective:e,rotate:t,rotateX:r,rotateY:n,skewX:a,skewY:o}=s;e&&(i=`perspective(${e}px) ${i}`),t&&(i+=`rotate(${t}deg) `),r&&(i+=`rotateX(${r}deg) `),n&&(i+=`rotateY(${n}deg) `),a&&(i+=`skewX(${a}deg) `),o&&(i+=`skewY(${o}deg) `)}let o=e.x.scale*t.x,l=e.y.scale*t.y;return(1!==o||1!==l)&&(i+=`scale(${o}, ${l})`),i||"none"}(this.projectionDeltaWithTransform,this.treeScale,r);s&&(n=s(r,n)),e.transform=n;let{x:a,y:o}=this.projectionDelta;for(let t in e.transformOrigin=`${100*a.origin}% ${100*o.origin}% 0`,i.animationValues?e.opacity=i===this?r.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:r.opacityExit:e.opacity=i===this?void 0!==r.opacity?r.opacity:"":void 0!==r.opacityExit?r.opacityExit:0,tU){if(void 0===r[t])continue;let{correct:s,applyTo:a,isCSSVariable:o}=tU[t],l="none"===n?r[t]:s(r[t],i);if(a){let t=a.length;for(let s=0;s<t;s++)e[a[s]]=l}else o?this.options.visualElement.renderState.vars[t]=l:e[t]=l}this.options.layoutId&&(e.pointerEvents=i===this?sl(t?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(e=>e.currentAnimation?.stop()),this.root.nodes.forEach(r2),this.root.sharedNodes.clear()}}}function rJ(e){e.updateLayout()}function rZ(e){let t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){let{layoutBox:s,measuredBox:i}=e.layout,{animationType:r}=e.options,n=t.source!==e.layout.source;"size"===r?iG(e=>{let i=n?t.measuredBox[e]:t.layoutBox[e],r=i1(i);i.min=s[e].min,i.max=i.min+r}):nl(r,t.layoutBox,s)&&iG(i=>{let r=n?t.measuredBox[i]:t.layoutBox[i],a=i1(s[i]);r.max=r.min+a,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[i].max=e.relativeTarget[i].min+a)});let a=ey();i2(a,s,t.layoutBox);let o=ey();n?i2(o,e.applyTransform(i,!0),t.measuredBox):i2(o,s,t.layoutBox);let l=!rP(a),d=!1;if(!e.resumeFrom){let i=e.getClosestProjectingParent();if(i&&!i.resumeFrom){let{snapshot:r,layout:n}=i;if(r&&n){let a=eb();i6(a,t.layoutBox,r.layoutBox);let o=eb();i6(o,s,n.layoutBox),rL(a,o)||(d=!0),i.options.layoutRoot&&(e.relativeTarget=o,e.relativeTargetOrigin=a,e.relativeParent=i)}}}e.notifyListeners("didUpdate",{layout:s,snapshot:t,delta:o,layoutDelta:a,hasLayoutChanged:l,hasRelativeLayoutChanged:d})}else if(e.isLead()){let{onExitComplete:t}=e.options;t&&t()}e.options.transition=void 0}function r0(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function r1(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function r5(e){e.clearSnapshot()}function r2(e){e.clearMeasurements()}function r4(e){e.isLayoutDirty=!1}function r3(e){let{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function r6(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function r8(e){e.resolveTargetDelta()}function r7(e){e.calcProjection()}function r9(e){e.resetSkewAndRotation()}function ne(e){e.removeLeadSnapshot()}function nt(e,t,s){e.translate=tB(t.translate,0,s),e.scale=tB(t.scale,1,s),e.origin=t.origin,e.originPoint=t.originPoint}function ns(e,t,s,i){e.min=tB(t.min,s.min,i),e.max=tB(t.max,s.max,i)}function ni(e){return e.animationValues&&void 0!==e.animationValues.opacityExit}let nr={duration:.45,ease:[.4,0,.1,1]},nn=e=>"u">typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),na=nn("applewebkit/")&&!nn("chrome/")?Math.round:eX;function no(e){e.min=na(e.min),e.max=na(e.max)}function nl(e,t,s){return"position"===e||"preserve-aspect"===e&&!(.2>=Math.abs(rR(t)-rR(s)))}function nd(e){return e!==e.root&&e.scroll?.wasRoot}let nc=rQ({attachResizeListener:(e,t)=>iZ(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),nu={current:void 0},nh=rQ({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!nu.current){let e=new nc({});e.mount(window),e.setOptions({layoutScroll:!0}),nu.current=e}return nu.current},resetTransform:(e,t)=>{e.style.transform=void 0!==t?t:"none"},checkIsScrollRoot:e=>"fixed"===window.getComputedStyle(e).position});function nm(e,t){let s=function(e,t,s){if(null==e)return[];if(e instanceof EventTarget)return[e];if("string"==typeof e){let t=document,s=(void 0)??t.querySelectorAll(e);return s?Array.from(s):[]}return Array.from(e).filter(e=>null!=e)}(e),i=new AbortController;return[s,{passive:!0,...t,signal:i.signal},()=>i.abort()]}function np(e){return!("touch"===e.pointerType||i0.x||i0.y)}function nx(e,t,s){let{props:i}=e;e.animationState&&i.whileHover&&e.animationState.setActive("whileHover","Start"===s);let r=i["onHover"+s];r&&eZ.postRender(()=>r(t,i7(t)))}let nf=(e,t)=>!!t&&(e===t||nf(e,t.parentElement)),ng=new WeakSet;function ny(e){return t=>{"Enter"===t.key&&e(t)}}function nv(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}function nb(e){return i8(e)&&!(i0.x||i0.y)}function nj(e,t,s){let{props:i}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&i.whileTap&&e.animationState.setActive("whileTap","Start"===s);let r=i["onTap"+("End"===s?"":s)];r&&eZ.postRender(()=>r(t,i7(t)))}let nw=new WeakMap,nN=new WeakMap,nk=e=>{let t=nw.get(e.target);t&&t(e)},nS=e=>{e.forEach(nk)},nC={some:0,all:1},nT=function(e,t){if("u"<typeof Proxy)return sv;let s=new Map,i=(s,i)=>sv(s,i,e,t);return new Proxy((e,t)=>i(e,t),{get:(r,n)=>"create"===n?i:(s.has(n)||s.set(n,sv(n,void 0,e,t)),s.get(n))})}({animation:{Feature:class extends sb{constructor(e){super(e),e.animationState||(e.animationState=function(e){let t=t=>Promise.all(t.map(({animation:t,options:s})=>(function(e,t,s={}){let i;if(e.notify("AnimationStart",t),Array.isArray(t))i=Promise.all(t.map(t=>iB(e,t,s)));else if("string"==typeof t)i=iB(e,t,s);else{let r="function"==typeof t?sj(e,t,s.custom):t;i=Promise.all(iI(e,r,s))}return i.then(()=>{e.notify("AnimationComplete",t)})})(e,t,s))),s=iY(),i=!0,r=t=>(s,i)=>{let r=sj(e,i,"exit"===t?e.presenceContext?.custom:void 0);if(r){let{transition:e,transitionEnd:t,...i}=r;s={...s,...i,...t}}return s};function n(n){let{props:a}=e,o=function e(t){if(!t)return;if(!t.isControllingVariants){let s=t.parent&&e(t.parent)||{};return void 0!==t.props.initial&&(s.initial=t.props.initial),s}let s={};for(let e=0;e<iU;e++){let i=tv[e],r=t.props[i];(tg(r)||!1===r)&&(s[i]=r)}return s}(e.parent)||{},l=[],d=new Set,c={},u=1/0;for(let t=0;t<iK;t++){var h,m;let p=iq[t],x=s[p],f=void 0!==a[p]?a[p]:o[p],g=tg(f),y=p===n?x.isActive:null;!1===y&&(u=t);let v=f===o[p]&&f!==a[p]&&g;if(v&&i&&e.manuallyAnimateOnMount&&(v=!1),x.protectedKeys={...c},!x.isActive&&null===y||!f&&!x.prevProp||tf(f)||"boolean"==typeof f)continue;let b=(h=x.prevProp,"string"==typeof(m=f)?m!==h:!!Array.isArray(m)&&!iW(m,h)),j=b||p===n&&x.isActive&&!v&&g||t>u&&g,w=!1,N=Array.isArray(f)?f:[f],k=N.reduce(r(p),{});!1===y&&(k={});let{prevResolvedValues:S={}}=x,C={...S,...k},T=t=>{j=!0,d.has(t)&&(w=!0,d.delete(t)),x.needsAnimating[t]=!0;let s=e.getValue(t);s&&(s.liveStyle=!1)};for(let e in C){let t=k[e],s=S[e];if(!c.hasOwnProperty(e))(sN(t)&&sN(s)?iW(t,s):t===s)?void 0!==t&&d.has(e)?T(e):x.protectedKeys[e]=!0:null!=t?T(e):d.add(e)}x.prevProp=f,x.prevResolvedValues=k,x.isActive&&(c={...c,...k}),i&&e.blockInitialAnimation&&(j=!1);let A=v&&b,M=!A||w;j&&M&&l.push(...N.map(t=>{let s={type:p};if("string"==typeof t&&i&&!A&&e.manuallyAnimateOnMount&&e.parent){let{parent:i}=e,r=sj(i,t);if(i.enteringChildren&&r){let{delayChildren:t}=r.transition||{};s.delay=iO(i.enteringChildren,e,t)}}return{animation:t,options:s}}))}if(d.size){let t={};if("boolean"!=typeof a.initial){let s=sj(e,Array.isArray(a.initial)?a.initial[0]:a.initial);s&&s.transition&&(t.transition=s.transition)}d.forEach(s=>{let i=e.getBaseTarget(s),r=e.getValue(s);r&&(r.liveStyle=!0),t[s]=i??null}),l.push({animation:t})}let p=!!l.length;return i&&(!1===a.initial||a.initial===a.animate)&&!e.manuallyAnimateOnMount&&(p=!1),i=!1,p?t(l):Promise.resolve()}return{animateChanges:n,setActive:function(t,i){if(s[t].isActive===i)return Promise.resolve();e.variantChildren?.forEach(e=>e.animationState?.setActive(t,i)),s[t].isActive=i;let r=n(t);for(let e in s)s[e].protectedKeys={};return r},setAnimateFunction:function(s){t=s(e)},getState:()=>s,reset:()=>{s=iY()}}}(e))}updateAnimationControlsSubscription(){let{animate:e}=this.node.getProps();tf(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){let{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}},exit:{Feature:class extends sb{constructor(){super(...arguments),this.id=iX++}update(){if(!this.node.presenceContext)return;let{isPresent:e,onExitComplete:t}=this.node.presenceContext,{isPresent:s}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===s)return;let i=this.node.animationState.setActive("exit",!e);t&&!e&&i.then(()=>{t(this.id)})}mount(){let{register:e,onExitComplete:t}=this.node.presenceContext||{};t&&t(this.id),e&&(this.unmount=e(this.id))}unmount(){}}},inView:{Feature:class extends sb{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){var e;let t;this.unmount();let{viewport:s={}}=this.node.getProps(),{root:i,margin:r,amount:n="some",once:a}=s,o={root:i?i.current:void 0,rootMargin:r,threshold:"number"==typeof n?n:nC[n]},l=e=>{let{isIntersecting:t}=e;if(this.isInView===t||(this.isInView=t,a&&!t&&this.hasEnteredView))return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",t);let{onViewportEnter:s,onViewportLeave:i}=this.node.getProps(),r=t?s:i;r&&r(e)};return e=this.node.current,t=function({root:e,...t}){let s=e||document;nN.has(s)||nN.set(s,{});let i=nN.get(s),r=JSON.stringify(t);return i[r]||(i[r]=new IntersectionObserver(nS,{root:e,...t})),i[r]}(o),nw.set(e,l),t.observe(e),()=>{nw.delete(e),t.unobserve(e)}}mount(){this.startObserver()}update(){if("u"<typeof IntersectionObserver)return;let{props:e,prevProps:t}=this.node;["amount","margin","root"].some(function({viewport:e={}},{viewport:t={}}={}){return s=>e[s]!==t[s]}(e,t))&&this.startObserver()}unmount(){}}},tap:{Feature:class extends sb{mount(){let{current:e}=this.node;e&&(this.unmount=function(e,t,s={}){let[i,r,n]=nm(e,s),a=e=>{let i=e.currentTarget;if(!nb(e))return;ng.add(i);let n=t(i,e),a=(e,t)=>{window.removeEventListener("pointerup",o),window.removeEventListener("pointercancel",l),ng.has(i)&&ng.delete(i),nb(e)&&"function"==typeof n&&n(e,{success:t})},o=e=>{a(e,i===window||i===document||s.useGlobalTarget||nf(i,e.target))},l=e=>{a(e,!1)};window.addEventListener("pointerup",o,r),window.addEventListener("pointercancel",l,r)};return i.forEach(e=>{(s.useGlobalTarget?window:e).addEventListener("pointerdown",a,r),v(e)&&(e.addEventListener("focus",e=>((e,t)=>{let s=e.currentTarget;if(!s)return;let i=ny(()=>{if(ng.has(s))return;nv(s,"down");let e=ny(()=>{nv(s,"up")});s.addEventListener("keyup",e,t),s.addEventListener("blur",()=>nv(s,"cancel"),t)});s.addEventListener("keydown",i,t),s.addEventListener("blur",()=>s.removeEventListener("keydown",i),t)})(e,r)),iJ(e)||e.hasAttribute("tabindex")||(e.tabIndex=0))}),n}(e,(e,t)=>(nj(this.node,t,"Start"),(e,{success:t})=>nj(this.node,e,t?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}},focus:{Feature:class extends sb{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch(t){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=sT(iZ(this.node.current,"focus",()=>this.onFocus()),iZ(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}},hover:{Feature:class extends sb{mount(){let{current:e}=this.node;e&&(this.unmount=function(e,t,s={}){let[i,r,n]=nm(e,s),a=e=>{if(!np(e))return;let{target:s}=e,i=t(s,e);if("function"!=typeof i||!s)return;let n=e=>{np(e)&&(i(e),s.removeEventListener("pointerleave",n))};s.addEventListener("pointerleave",n,r)};return i.forEach(e=>{e.addEventListener("pointerenter",a,r)}),n}(e,(e,t)=>(nx(this.node,t,"Start"),e=>nx(this.node,e,"End"))))}unmount(){}}},pan:{Feature:class extends sb{constructor(){super(...arguments),this.removePointerDownListener=eX}onPointerDown(e){this.session=new ri(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:re(this.node)})}createPanHandlers(){let{onPanSessionStart:e,onPanStart:t,onPan:s,onPanEnd:i}=this.node.getProps();return{onSessionStart:rx(e),onStart:rx(t),onMove:s,onEnd:(e,t)=>{delete this.session,i&&eZ.postRender(()=>i(e,t))}}}mount(){this.removePointerDownListener=i9(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}},drag:{Feature:class extends sb{constructor(e){super(e),this.removeGroupControls=eX,this.removeListeners=eX,this.controls=new rm(e)}mount(){let{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||eX}update(){let{dragControls:e}=this.node.getProps(),{dragControls:t}=this.node.prevProps||{};e!==t&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}},ProjectionNode:nh,MeasureLayout:rb},layout:{ProjectionNode:nh,MeasureLayout:rb}},(e,t)=>t.isSVG??t7(e)?new tH(t):new t6(t,{allowProjection:e!==u.Fragment}));var nA=e.i(74133),nM=e.i(88069),nP=e.i(42098);function nE(e,t=300){let[s,i]=(0,u.useState)(e);return(0,u.useEffect)(()=>{let s=setTimeout(()=>{i(e)},t);return()=>{clearTimeout(s)}},[e,t]),s}var nD=e.i(45688);let nL=h.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";async function nR(e){if(!e||e.length<2)return[];let t=await fetch(`${nL}/api/suggestions?q=${encodeURIComponent(e)}&limit=8`);if(!t.ok)throw Error("Failed to fetch suggestions");return(await t.json()).suggestions}function nV(){for(var e,t,s=0,i="",r=arguments.length;s<r;s++)(e=arguments[s])&&(t=function e(t){var s,i,r="";if("string"==typeof t||"number"==typeof t)r+=t;else if("object"==typeof t)if(Array.isArray(t)){var n=t.length;for(s=0;s<n;s++)t[s]&&(i=e(t[s]))&&(r&&(r+=" "),r+=i)}else for(i in t)t[i]&&(r&&(r+=" "),r+=i);return r}(e))&&(i&&(i+=" "),i+=t);return i}let nF=(e=new Map,t=null,s)=>({nextPart:e,validators:t,classGroupId:s}),n$=[],nz=(e,t,s)=>{if(0==e.length-t)return s.classGroupId;let i=e[t],r=s.nextPart.get(i);if(r){let s=nz(e,t+1,r);if(s)return s}let n=s.validators;if(null===n)return;let a=0===t?e.join("-"):e.slice(t).join("-"),o=n.length;for(let e=0;e<o;e++){let t=n[e];if(t.validator(a))return t.classGroupId}},n_=(e,t)=>{let s=nF();for(let i in e)nI(e[i],s,i,t);return s},nI=(e,t,s,i)=>{let r=e.length;for(let n=0;n<r;n++)nO(e[n],t,s,i)},nO=(e,t,s,i)=>{"string"==typeof e?nB(e,t,s):"function"==typeof e?nU(e,t,s,i):nW(e,t,s,i)},nB=(e,t,s)=>{(""===e?t:nq(t,e)).classGroupId=s},nU=(e,t,s,i)=>{nK(e)?nI(e(i),t,s,i):(null===t.validators&&(t.validators=[]),t.validators.push({classGroupId:s,validator:e}))},nW=(e,t,s,i)=>{let r=Object.entries(e),n=r.length;for(let e=0;e<n;e++){let[n,a]=r[e];nI(a,nq(t,n),s,i)}},nq=(e,t)=>{let s=e,i=t.split("-"),r=i.length;for(let e=0;e<r;e++){let t=i[e],r=s.nextPart.get(t);r||(r=nF(),s.nextPart.set(t,r)),s=r}return s},nK=e=>"isThemeGetter"in e&&!0===e.isThemeGetter,nH=[],nY=(e,t,s,i,r)=>({modifiers:e,hasImportantModifier:t,baseClassName:s,maybePostfixModifierPosition:i,isExternal:r}),nX=/\s+/,nG=e=>{let t;if("string"==typeof e)return e;let s="";for(let i=0;i<e.length;i++)e[i]&&(t=nG(e[i]))&&(s&&(s+=" "),s+=t);return s},nQ=[],nJ=e=>{let t=t=>t[e]||nQ;return t.isThemeGetter=!0,t},nZ=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,n0=/^\((?:(\w[\w-]*):)?(.+)\)$/i,n1=/^\d+\/\d+$/,n5=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,n2=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,n4=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,n3=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,n6=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,n8=e=>n1.test(e),n7=e=>!!e&&!Number.isNaN(Number(e)),n9=e=>!!e&&Number.isInteger(Number(e)),ae=e=>e.endsWith("%")&&n7(e.slice(0,-1)),at=e=>n5.test(e),as=()=>!0,ai=e=>n2.test(e)&&!n4.test(e),ar=()=>!1,an=e=>n3.test(e),aa=e=>n6.test(e),ao=e=>!ad(e)&&!ax(e),al=e=>aw(e,aC,ar),ad=e=>nZ.test(e),ac=e=>aw(e,aT,ai),au=e=>aw(e,aA,n7),ah=e=>aw(e,ak,ar),am=e=>aw(e,aS,aa),ap=e=>aw(e,aP,an),ax=e=>n0.test(e),af=e=>aN(e,aT),ag=e=>aN(e,aM),ay=e=>aN(e,ak),av=e=>aN(e,aC),ab=e=>aN(e,aS),aj=e=>aN(e,aP,!0),aw=(e,t,s)=>{let i=nZ.exec(e);return!!i&&(i[1]?t(i[1]):s(i[2]))},aN=(e,t,s=!1)=>{let i=n0.exec(e);return!!i&&(i[1]?t(i[1]):s)},ak=e=>"position"===e||"percentage"===e,aS=e=>"image"===e||"url"===e,aC=e=>"length"===e||"size"===e||"bg-size"===e,aT=e=>"length"===e,aA=e=>"number"===e,aM=e=>"family-name"===e,aP=e=>"shadow"===e,aE=((e,...t)=>{let s,i,r,n,a=e=>{let t=i(e);if(t)return t;let n=((e,t)=>{let{parseClassName:s,getClassGroupId:i,getConflictingClassGroupIds:r,sortModifiers:n}=t,a=[],o=e.trim().split(nX),l="";for(let e=o.length-1;e>=0;e-=1){let t=o[e],{isExternal:d,modifiers:c,hasImportantModifier:u,baseClassName:h,maybePostfixModifierPosition:m}=s(t);if(d){l=t+(l.length>0?" "+l:l);continue}let p=!!m,x=i(p?h.substring(0,m):h);if(!x){if(!p||!(x=i(h))){l=t+(l.length>0?" "+l:l);continue}p=!1}let f=0===c.length?"":1===c.length?c[0]:n(c).join(":"),g=u?f+"!":f,y=g+x;if(a.indexOf(y)>-1)continue;a.push(y);let v=r(x,p);for(let e=0;e<v.length;++e){let t=v[e];a.push(g+t)}l=t+(l.length>0?" "+l:l)}return l})(e,s);return r(e,n),n};return n=o=>{var l;let d;return i=(s={cache:(e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,s=Object.create(null),i=Object.create(null),r=(r,n)=>{s[r]=n,++t>e&&(t=0,i=s,s=Object.create(null))};return{get(e){let t=s[e];return void 0!==t?t:void 0!==(t=i[e])?(r(e,t),t):void 0},set(e,t){e in s?s[e]=t:r(e,t)}}})((l=t.reduce((e,t)=>t(e),e())).cacheSize),parseClassName:(e=>{let{prefix:t,experimentalParseClassName:s}=e,i=e=>{let t,s=[],i=0,r=0,n=0,a=e.length;for(let o=0;o<a;o++){let a=e[o];if(0===i&&0===r){if(":"===a){s.push(e.slice(n,o)),n=o+1;continue}if("/"===a){t=o;continue}}"["===a?i++:"]"===a?i--:"("===a?r++:")"===a&&r--}let o=0===s.length?e:e.slice(n),l=o,d=!1;return o.endsWith("!")?(l=o.slice(0,-1),d=!0):o.startsWith("!")&&(l=o.slice(1),d=!0),nY(s,d,l,t&&t>n?t-n:void 0)};if(t){let e=t+":",s=i;i=t=>t.startsWith(e)?s(t.slice(e.length)):nY(nH,!1,t,void 0,!0)}if(s){let e=i;i=t=>s({className:t,parseClassName:e})}return i})(l),sortModifiers:(d=new Map,l.orderSensitiveModifiers.forEach((e,t)=>{d.set(e,1e6+t)}),e=>{let t=[],s=[];for(let i=0;i<e.length;i++){let r=e[i],n="["===r[0],a=d.has(r);n||a?(s.length>0&&(s.sort(),t.push(...s),s=[]),t.push(r)):s.push(r)}return s.length>0&&(s.sort(),t.push(...s)),t}),...(e=>{let t=(e=>{let{theme:t,classGroups:s}=e;return n_(s,t)})(e),{conflictingClassGroups:s,conflictingClassGroupModifiers:i}=e;return{getClassGroupId:e=>{if(e.startsWith("[")&&e.endsWith("]")){var s;let t,i,r;return -1===(s=e).slice(1,-1).indexOf(":")?void 0:(i=(t=s.slice(1,-1)).indexOf(":"),(r=t.slice(0,i))?"arbitrary.."+r:void 0)}let i=e.split("-"),r=+(""===i[0]&&i.length>1);return nz(i,r,t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=i[e],r=s[e];if(t){if(r){let e=Array(r.length+t.length);for(let t=0;t<r.length;t++)e[t]=r[t];for(let s=0;s<t.length;s++)e[r.length+s]=t[s];return e}return t}return r||n$}return s[e]||n$}}})(l)}).cache.get,r=s.cache.set,n=a,a(o)},(...e)=>n(((...e)=>{let t,s,i=0,r="";for(;i<e.length;)(t=e[i++])&&(s=nG(t))&&(r&&(r+=" "),r+=s);return r})(...e))})(()=>{let e=nJ("color"),t=nJ("font"),s=nJ("text"),i=nJ("font-weight"),r=nJ("tracking"),n=nJ("leading"),a=nJ("breakpoint"),o=nJ("container"),l=nJ("spacing"),d=nJ("radius"),c=nJ("shadow"),u=nJ("inset-shadow"),h=nJ("text-shadow"),m=nJ("drop-shadow"),p=nJ("blur"),x=nJ("perspective"),f=nJ("aspect"),g=nJ("ease"),y=nJ("animate"),v=()=>["auto","avoid","all","avoid-page","page","left","right","column"],b=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],j=()=>[...b(),ax,ad],w=()=>["auto","hidden","clip","visible","scroll"],N=()=>["auto","contain","none"],k=()=>[ax,ad,l],S=()=>[n8,"full","auto",...k()],C=()=>[n9,"none","subgrid",ax,ad],T=()=>["auto",{span:["full",n9,ax,ad]},n9,ax,ad],A=()=>[n9,"auto",ax,ad],M=()=>["auto","min","max","fr",ax,ad],P=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],E=()=>["start","end","center","stretch","center-safe","end-safe"],D=()=>["auto",...k()],L=()=>[n8,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...k()],R=()=>[e,ax,ad],V=()=>[...b(),ay,ah,{position:[ax,ad]}],F=()=>["no-repeat",{repeat:["","x","y","space","round"]}],$=()=>["auto","cover","contain",av,al,{size:[ax,ad]}],z=()=>[ae,af,ac],_=()=>["","none","full",d,ax,ad],I=()=>["",n7,af,ac],O=()=>["solid","dashed","dotted","double"],B=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],U=()=>[n7,ae,ay,ah],W=()=>["","none",p,ax,ad],q=()=>["none",n7,ax,ad],K=()=>["none",n7,ax,ad],H=()=>[n7,ax,ad],Y=()=>[n8,"full",...k()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[at],breakpoint:[at],color:[as],container:[at],"drop-shadow":[at],ease:["in","out","in-out"],font:[ao],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[at],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[at],shadow:[at],spacing:["px",n7],text:[at],"text-shadow":[at],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",n8,ad,ax,f]}],container:["container"],columns:[{columns:[n7,ad,ax,o]}],"break-after":[{"break-after":v()}],"break-before":[{"break-before":v()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:j()}],overflow:[{overflow:w()}],"overflow-x":[{"overflow-x":w()}],"overflow-y":[{"overflow-y":w()}],overscroll:[{overscroll:N()}],"overscroll-x":[{"overscroll-x":N()}],"overscroll-y":[{"overscroll-y":N()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:S()}],"inset-x":[{"inset-x":S()}],"inset-y":[{"inset-y":S()}],start:[{start:S()}],end:[{end:S()}],top:[{top:S()}],right:[{right:S()}],bottom:[{bottom:S()}],left:[{left:S()}],visibility:["visible","invisible","collapse"],z:[{z:[n9,"auto",ax,ad]}],basis:[{basis:[n8,"full","auto",o,...k()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[n7,n8,"auto","initial","none",ad]}],grow:[{grow:["",n7,ax,ad]}],shrink:[{shrink:["",n7,ax,ad]}],order:[{order:[n9,"first","last","none",ax,ad]}],"grid-cols":[{"grid-cols":C()}],"col-start-end":[{col:T()}],"col-start":[{"col-start":A()}],"col-end":[{"col-end":A()}],"grid-rows":[{"grid-rows":C()}],"row-start-end":[{row:T()}],"row-start":[{"row-start":A()}],"row-end":[{"row-end":A()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":M()}],"auto-rows":[{"auto-rows":M()}],gap:[{gap:k()}],"gap-x":[{"gap-x":k()}],"gap-y":[{"gap-y":k()}],"justify-content":[{justify:[...P(),"normal"]}],"justify-items":[{"justify-items":[...E(),"normal"]}],"justify-self":[{"justify-self":["auto",...E()]}],"align-content":[{content:["normal",...P()]}],"align-items":[{items:[...E(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...E(),{baseline:["","last"]}]}],"place-content":[{"place-content":P()}],"place-items":[{"place-items":[...E(),"baseline"]}],"place-self":[{"place-self":["auto",...E()]}],p:[{p:k()}],px:[{px:k()}],py:[{py:k()}],ps:[{ps:k()}],pe:[{pe:k()}],pt:[{pt:k()}],pr:[{pr:k()}],pb:[{pb:k()}],pl:[{pl:k()}],m:[{m:D()}],mx:[{mx:D()}],my:[{my:D()}],ms:[{ms:D()}],me:[{me:D()}],mt:[{mt:D()}],mr:[{mr:D()}],mb:[{mb:D()}],ml:[{ml:D()}],"space-x":[{"space-x":k()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":k()}],"space-y-reverse":["space-y-reverse"],size:[{size:L()}],w:[{w:[o,"screen",...L()]}],"min-w":[{"min-w":[o,"screen","none",...L()]}],"max-w":[{"max-w":[o,"screen","none","prose",{screen:[a]},...L()]}],h:[{h:["screen","lh",...L()]}],"min-h":[{"min-h":["screen","lh","none",...L()]}],"max-h":[{"max-h":["screen","lh",...L()]}],"font-size":[{text:["base",s,af,ac]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[i,ax,au]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",ae,ad]}],"font-family":[{font:[ag,ad,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[r,ax,ad]}],"line-clamp":[{"line-clamp":[n7,"none",ax,au]}],leading:[{leading:[n,...k()]}],"list-image":[{"list-image":["none",ax,ad]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ax,ad]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:R()}],"text-color":[{text:R()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...O(),"wavy"]}],"text-decoration-thickness":[{decoration:[n7,"from-font","auto",ax,ac]}],"text-decoration-color":[{decoration:R()}],"underline-offset":[{"underline-offset":[n7,"auto",ax,ad]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:k()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ax,ad]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ax,ad]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:V()}],"bg-repeat":[{bg:F()}],"bg-size":[{bg:$()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},n9,ax,ad],radial:["",ax,ad],conic:[n9,ax,ad]},ab,am]}],"bg-color":[{bg:R()}],"gradient-from-pos":[{from:z()}],"gradient-via-pos":[{via:z()}],"gradient-to-pos":[{to:z()}],"gradient-from":[{from:R()}],"gradient-via":[{via:R()}],"gradient-to":[{to:R()}],rounded:[{rounded:_()}],"rounded-s":[{"rounded-s":_()}],"rounded-e":[{"rounded-e":_()}],"rounded-t":[{"rounded-t":_()}],"rounded-r":[{"rounded-r":_()}],"rounded-b":[{"rounded-b":_()}],"rounded-l":[{"rounded-l":_()}],"rounded-ss":[{"rounded-ss":_()}],"rounded-se":[{"rounded-se":_()}],"rounded-ee":[{"rounded-ee":_()}],"rounded-es":[{"rounded-es":_()}],"rounded-tl":[{"rounded-tl":_()}],"rounded-tr":[{"rounded-tr":_()}],"rounded-br":[{"rounded-br":_()}],"rounded-bl":[{"rounded-bl":_()}],"border-w":[{border:I()}],"border-w-x":[{"border-x":I()}],"border-w-y":[{"border-y":I()}],"border-w-s":[{"border-s":I()}],"border-w-e":[{"border-e":I()}],"border-w-t":[{"border-t":I()}],"border-w-r":[{"border-r":I()}],"border-w-b":[{"border-b":I()}],"border-w-l":[{"border-l":I()}],"divide-x":[{"divide-x":I()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":I()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...O(),"hidden","none"]}],"divide-style":[{divide:[...O(),"hidden","none"]}],"border-color":[{border:R()}],"border-color-x":[{"border-x":R()}],"border-color-y":[{"border-y":R()}],"border-color-s":[{"border-s":R()}],"border-color-e":[{"border-e":R()}],"border-color-t":[{"border-t":R()}],"border-color-r":[{"border-r":R()}],"border-color-b":[{"border-b":R()}],"border-color-l":[{"border-l":R()}],"divide-color":[{divide:R()}],"outline-style":[{outline:[...O(),"none","hidden"]}],"outline-offset":[{"outline-offset":[n7,ax,ad]}],"outline-w":[{outline:["",n7,af,ac]}],"outline-color":[{outline:R()}],shadow:[{shadow:["","none",c,aj,ap]}],"shadow-color":[{shadow:R()}],"inset-shadow":[{"inset-shadow":["none",u,aj,ap]}],"inset-shadow-color":[{"inset-shadow":R()}],"ring-w":[{ring:I()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:R()}],"ring-offset-w":[{"ring-offset":[n7,ac]}],"ring-offset-color":[{"ring-offset":R()}],"inset-ring-w":[{"inset-ring":I()}],"inset-ring-color":[{"inset-ring":R()}],"text-shadow":[{"text-shadow":["none",h,aj,ap]}],"text-shadow-color":[{"text-shadow":R()}],opacity:[{opacity:[n7,ax,ad]}],"mix-blend":[{"mix-blend":[...B(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":B()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[n7]}],"mask-image-linear-from-pos":[{"mask-linear-from":U()}],"mask-image-linear-to-pos":[{"mask-linear-to":U()}],"mask-image-linear-from-color":[{"mask-linear-from":R()}],"mask-image-linear-to-color":[{"mask-linear-to":R()}],"mask-image-t-from-pos":[{"mask-t-from":U()}],"mask-image-t-to-pos":[{"mask-t-to":U()}],"mask-image-t-from-color":[{"mask-t-from":R()}],"mask-image-t-to-color":[{"mask-t-to":R()}],"mask-image-r-from-pos":[{"mask-r-from":U()}],"mask-image-r-to-pos":[{"mask-r-to":U()}],"mask-image-r-from-color":[{"mask-r-from":R()}],"mask-image-r-to-color":[{"mask-r-to":R()}],"mask-image-b-from-pos":[{"mask-b-from":U()}],"mask-image-b-to-pos":[{"mask-b-to":U()}],"mask-image-b-from-color":[{"mask-b-from":R()}],"mask-image-b-to-color":[{"mask-b-to":R()}],"mask-image-l-from-pos":[{"mask-l-from":U()}],"mask-image-l-to-pos":[{"mask-l-to":U()}],"mask-image-l-from-color":[{"mask-l-from":R()}],"mask-image-l-to-color":[{"mask-l-to":R()}],"mask-image-x-from-pos":[{"mask-x-from":U()}],"mask-image-x-to-pos":[{"mask-x-to":U()}],"mask-image-x-from-color":[{"mask-x-from":R()}],"mask-image-x-to-color":[{"mask-x-to":R()}],"mask-image-y-from-pos":[{"mask-y-from":U()}],"mask-image-y-to-pos":[{"mask-y-to":U()}],"mask-image-y-from-color":[{"mask-y-from":R()}],"mask-image-y-to-color":[{"mask-y-to":R()}],"mask-image-radial":[{"mask-radial":[ax,ad]}],"mask-image-radial-from-pos":[{"mask-radial-from":U()}],"mask-image-radial-to-pos":[{"mask-radial-to":U()}],"mask-image-radial-from-color":[{"mask-radial-from":R()}],"mask-image-radial-to-color":[{"mask-radial-to":R()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[n7]}],"mask-image-conic-from-pos":[{"mask-conic-from":U()}],"mask-image-conic-to-pos":[{"mask-conic-to":U()}],"mask-image-conic-from-color":[{"mask-conic-from":R()}],"mask-image-conic-to-color":[{"mask-conic-to":R()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:V()}],"mask-repeat":[{mask:F()}],"mask-size":[{mask:$()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ax,ad]}],filter:[{filter:["","none",ax,ad]}],blur:[{blur:W()}],brightness:[{brightness:[n7,ax,ad]}],contrast:[{contrast:[n7,ax,ad]}],"drop-shadow":[{"drop-shadow":["","none",m,aj,ap]}],"drop-shadow-color":[{"drop-shadow":R()}],grayscale:[{grayscale:["",n7,ax,ad]}],"hue-rotate":[{"hue-rotate":[n7,ax,ad]}],invert:[{invert:["",n7,ax,ad]}],saturate:[{saturate:[n7,ax,ad]}],sepia:[{sepia:["",n7,ax,ad]}],"backdrop-filter":[{"backdrop-filter":["","none",ax,ad]}],"backdrop-blur":[{"backdrop-blur":W()}],"backdrop-brightness":[{"backdrop-brightness":[n7,ax,ad]}],"backdrop-contrast":[{"backdrop-contrast":[n7,ax,ad]}],"backdrop-grayscale":[{"backdrop-grayscale":["",n7,ax,ad]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[n7,ax,ad]}],"backdrop-invert":[{"backdrop-invert":["",n7,ax,ad]}],"backdrop-opacity":[{"backdrop-opacity":[n7,ax,ad]}],"backdrop-saturate":[{"backdrop-saturate":[n7,ax,ad]}],"backdrop-sepia":[{"backdrop-sepia":["",n7,ax,ad]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":k()}],"border-spacing-x":[{"border-spacing-x":k()}],"border-spacing-y":[{"border-spacing-y":k()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ax,ad]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[n7,"initial",ax,ad]}],ease:[{ease:["linear","initial",g,ax,ad]}],delay:[{delay:[n7,ax,ad]}],animate:[{animate:["none",y,ax,ad]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[x,ax,ad]}],"perspective-origin":[{"perspective-origin":j()}],rotate:[{rotate:q()}],"rotate-x":[{"rotate-x":q()}],"rotate-y":[{"rotate-y":q()}],"rotate-z":[{"rotate-z":q()}],scale:[{scale:K()}],"scale-x":[{"scale-x":K()}],"scale-y":[{"scale-y":K()}],"scale-z":[{"scale-z":K()}],"scale-3d":["scale-3d"],skew:[{skew:H()}],"skew-x":[{"skew-x":H()}],"skew-y":[{"skew-y":H()}],transform:[{transform:[ax,ad,"","none","gpu","cpu"]}],"transform-origin":[{origin:j()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Y()}],"translate-x":[{"translate-x":Y()}],"translate-y":[{"translate-y":Y()}],"translate-z":[{"translate-z":Y()}],"translate-none":["translate-none"],accent:[{accent:R()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:R()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ax,ad]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":k()}],"scroll-mx":[{"scroll-mx":k()}],"scroll-my":[{"scroll-my":k()}],"scroll-ms":[{"scroll-ms":k()}],"scroll-me":[{"scroll-me":k()}],"scroll-mt":[{"scroll-mt":k()}],"scroll-mr":[{"scroll-mr":k()}],"scroll-mb":[{"scroll-mb":k()}],"scroll-ml":[{"scroll-ml":k()}],"scroll-p":[{"scroll-p":k()}],"scroll-px":[{"scroll-px":k()}],"scroll-py":[{"scroll-py":k()}],"scroll-ps":[{"scroll-ps":k()}],"scroll-pe":[{"scroll-pe":k()}],"scroll-pt":[{"scroll-pt":k()}],"scroll-pr":[{"scroll-pr":k()}],"scroll-pb":[{"scroll-pb":k()}],"scroll-pl":[{"scroll-pl":k()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ax,ad]}],fill:[{fill:["none",...R()]}],"stroke-w":[{stroke:[n7,af,ac,au]}],stroke:[{stroke:["none",...R()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});function aD(...e){return aE(nV(e))}function aL({className:e,...t}){return(0,c.jsx)("div",{"data-slot":"card",className:aD("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...t})}function aR({className:e,...t}){return(0,c.jsx)("div",{"data-slot":"card-header",className:aD("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",e),...t})}function aV({className:e,...t}){return(0,c.jsx)("div",{"data-slot":"card-title",className:aD("leading-none font-semibold",e),...t})}function aF({className:e,...t}){return(0,c.jsx)("div",{"data-slot":"card-content",className:aD("px-6",e),...t})}function a$(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}var az=Symbol.for("react.lazy"),a_=u[" use ".trim().toString()];function aI(e){var t;return null!=e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===az&&"_payload"in e&&"object"==typeof(t=e._payload)&&null!==t&&"then"in t}var aO=((l=u.forwardRef((e,t)=>{let{children:s,...i}=e;if(aI(s)&&"function"==typeof a_&&(s=a_(s._payload)),u.isValidElement(s)){var r;let e,n,a=(r=s,(n=(e=Object.getOwnPropertyDescriptor(r.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?r.ref:(n=(e=Object.getOwnPropertyDescriptor(r,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?r.props.ref:r.props.ref||r.ref),o=function(e,t){let s={...t};for(let i in t){let r=e[i],n=t[i];/^on[A-Z]/.test(i)?r&&n?s[i]=(...e)=>{let t=n(...e);return r(...e),t}:r&&(s[i]=r):"style"===i?s[i]={...r,...n}:"className"===i&&(s[i]=[r,n].filter(Boolean).join(" "))}return{...e,...s}}(i,s.props);return s.type!==u.Fragment&&(o.ref=t?function(...e){return t=>{let s=!1,i=e.map(e=>{let i=a$(e,t);return s||"function"!=typeof i||(s=!0),i});if(s)return()=>{for(let t=0;t<i.length;t++){let s=i[t];"function"==typeof s?s():a$(e[t],null)}}}}(t,a):a),u.cloneElement(s,o)}return u.Children.count(s)>1?u.Children.only(null):null})).displayName="Slot.SlotClone",i=l,(r=u.forwardRef((e,t)=>{let{children:s,...r}=e;aI(s)&&"function"==typeof a_&&(s=a_(s._payload));let n=u.Children.toArray(s),a=n.find(aU);if(a){let e=a.props.children,s=n.map(t=>t!==a?t:u.Children.count(e)>1?u.Children.only(null):u.isValidElement(e)?e.props.children:null);return(0,c.jsx)(i,{...r,ref:t,children:u.isValidElement(e)?u.cloneElement(e,void 0,s):null})}return(0,c.jsx)(i,{...r,ref:t,children:s})})).displayName="Slot.Slot",r),aB=Symbol("radix.slottable");function aU(e){return u.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===aB}let aW=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,aq=(n="inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",a={variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}},e=>{var t;if((null==a?void 0:a.variants)==null)return nV(n,null==e?void 0:e.class,null==e?void 0:e.className);let{variants:s,defaultVariants:i}=a,r=Object.keys(s).map(t=>{let r=null==e?void 0:e[t],n=null==i?void 0:i[t];if(null===r)return null;let a=aW(r)||aW(n);return s[t][a]}),o=e&&Object.entries(e).reduce((e,t)=>{let[s,i]=t;return void 0===i||(e[s]=i),e},{});return nV(n,r,null==a||null==(t=a.compoundVariants)?void 0:t.reduce((e,t)=>{let{class:s,className:r,...n}=t;return Object.entries(n).every(e=>{let[t,s]=e;return Array.isArray(s)?s.includes({...i,...o}[t]):({...i,...o})[t]===s})?[...e,s,r]:e},[]),null==e?void 0:e.class,null==e?void 0:e.className)});function aK({className:e,variant:t="default",size:s="default",asChild:i=!1,...r}){return(0,c.jsx)(i?aO:"button",{"data-slot":"button","data-variant":t,"data-size":s,className:aD(aq({variant:t,size:s,className:e})),...r})}function aH({className:e,type:t,...s}){return(0,c.jsx)("input",{type:t,"data-slot":"input",className:aD("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",e),...s})}var aY=e.i(97358),aX=e.i(33368);let aG={references:{color:"#60a5fa",label:"References",icon:"→"},extends:{color:"#34d399",label:"Extends",icon:"⊃"},contradicts:{color:"#f87171",label:"Contradicts",icon:"⊗"},related:{color:"#a78bfa",label:"Related",icon:"~"}},aQ=["architecture","pattern","preference","error","context","learning","todo","note","relationship","custom"];function aJ({memory:e,links:t=[],memories:s=[],onClose:i,onReinforce:r,onSelectMemory:n,isReinforcing:a=!1,reinforceSuccess:o=!1}){let[l,d]=(0,u.useState)(!1),[h,m]=(0,u.useState)(null),[p,x]=(0,u.useState)(!1),[f,g]=(0,u.useState)(e.title),[y,v]=(0,u.useState)(e.content),[b,j]=(0,u.useState)(e.category),[w,N]=(0,u.useState)((e.tags||[]).join(", ")),[k,S]=(0,u.useState)(!1),C=(0,nM.useEditMemory)(),T=(0,nM.useDeleteMemory)(),[A,M]=(0,u.useState)(e.id);A!==e.id&&(M(e.id),x(!1),S(!1),g(e.title),v(e.content),j(e.category),N((e.tags||[]).join(", "))),(0,u.useEffect)(()=>{if(o&&h===e.id){let e=setTimeout(()=>d(!0),0),t=setTimeout(()=>d(!1),1500);return()=>{clearTimeout(e),clearTimeout(t)}}},[o,h,e.id]);let P=(0,u.useCallback)(()=>{let t=w.split(",").map(e=>e.trim()).filter(Boolean);C.mutate({id:e.id,updates:{title:f,content:y,category:b,tags:t}},{onSuccess:()=>{x(!1)}})},[e.id,f,y,b,w,C]),E=(0,aX.calculateDecayFactor)(e),D=(0,aY.getCategoryColor)(e.category),L=(0,aY.getTypeColor)(e.type),R=E>.7?{label:"Healthy",color:"#22C55E",bgColor:"rgba(34, 197, 94, 0.15)"}:E>.4?{label:"Fading",color:"#EAB308",bgColor:"rgba(234, 179, 8, 0.15)"}:{label:"Critical",color:"#EF4444",bgColor:"rgba(239, 68, 68, 0.15)"},V=(0,u.useMemo)(()=>{let i=[];for(let r of t)if(r.source_id===e.id){let e=s.find(e=>e.id===r.target_id);e&&i.push({memory:e,relationship:r.relationship,strength:r.strength,direction:"to"})}else if(r.target_id===e.id){let e=s.find(e=>e.id===r.source_id);e&&i.push({memory:e,relationship:r.relationship,strength:r.strength,direction:"from"})}return i.sort((e,t)=>t.strength-e.strength)},[e.id,t,s]);return(0,c.jsxs)(aL,{className:`bg-slate-900 border-slate-700 h-full overflow-auto transition-all duration-300 ${l?"ring-2 ring-green-500 ring-opacity-75":""}`,children:[(0,c.jsxs)(aR,{className:"border-b border-slate-700 pb-3",children:[(0,c.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[p?(0,c.jsx)(aH,{value:f,onChange:e=>g(e.target.value),className:"bg-slate-800 border-slate-600 text-white text-lg font-semibold"}):(0,c.jsx)(aV,{className:"text-lg font-semibold text-white leading-tight",children:e.title}),(0,c.jsx)(aK,{variant:"ghost",size:"sm",onClick:i,className:"text-slate-400 hover:text-white -mt-1 shrink-0",children:"✕"})]}),(0,c.jsxs)("div",{className:"flex items-center gap-2 mt-2",children:[p?(0,c.jsx)("select",{value:b,onChange:e=>j(e.target.value),className:"bg-slate-800 border border-slate-600 text-white text-xs rounded-lg px-2 py-1",children:aQ.map(e=>(0,c.jsx)("option",{value:e,children:e},e))}):(0,c.jsx)("span",{className:"px-2 py-0.5 rounded text-xs font-medium",style:{backgroundColor:D+"20",color:D},children:e.category}),(0,c.jsx)("span",{className:"px-2 py-0.5 rounded text-xs font-medium",style:{backgroundColor:L+"20",color:L},children:e.type.replace("_","-")})]})]}),(0,c.jsxs)(aF,{className:"p-4 space-y-4",children:[(0,c.jsxs)("div",{children:[(0,c.jsx)("h4",{className:"text-xs font-medium text-slate-400 mb-1",children:"Content"}),p?(0,c.jsx)("textarea",{value:y,onChange:e=>v(e.target.value),rows:6,className:"w-full bg-slate-800 border border-slate-600 text-sm text-slate-200 rounded-lg p-3 resize-y focus:ring-cyan-500 focus:border-cyan-500"}):(0,c.jsx)("p",{className:"text-sm text-slate-200 whitespace-pre-wrap leading-relaxed",children:e.content})]}),p&&(0,c.jsxs)("div",{children:[(0,c.jsx)("h4",{className:"text-xs font-medium text-slate-400 mb-1",children:"Tags (comma-separated)"}),(0,c.jsx)(aH,{value:w,onChange:e=>N(e.target.value),placeholder:"tag1, tag2, tag3",className:"bg-slate-800 border-slate-600 text-white text-sm"})]}),p?(0,c.jsxs)("div",{className:"flex gap-2",children:[(0,c.jsx)(aK,{variant:"default",size:"sm",onClick:P,disabled:C.isPending,className:"flex-1 bg-emerald-600 hover:bg-emerald-700",children:C.isPending?"Saving...":"Save Changes"}),(0,c.jsx)(aK,{variant:"outline",size:"sm",onClick:()=>{x(!1),g(e.title),v(e.content),j(e.category),N((e.tags||[]).join(", "))},className:"flex-1 border-slate-600 text-slate-300 hover:text-white",children:"Cancel"})]}):null,!p&&(0,c.jsxs)("div",{className:"rounded-lg p-3 flex items-center gap-3",style:{backgroundColor:R.bgColor},children:[(0,c.jsx)("div",{className:"w-3 h-3 rounded-full animate-pulse",style:{backgroundColor:R.color}}),(0,c.jsxs)("div",{children:[(0,c.jsx)("div",{className:"text-sm font-medium",style:{color:R.color},children:R.label}),(0,c.jsx)("div",{className:"text-xs text-slate-400",children:E>.7?"Memory is strong and stable":E>.4?"Memory is fading - reinforce to preserve":"Memory at risk of deletion - reinforce now"})]})]}),!p&&(0,c.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,c.jsxs)("div",{className:"bg-slate-800 rounded-lg p-3",children:[(0,c.jsx)("div",{className:"text-xs text-slate-400",children:"Salience"}),(0,c.jsxs)("div",{className:"text-lg font-bold text-white",children:[(100*e.salience).toFixed(0),"%"]}),(0,c.jsx)("div",{className:"mt-1 h-1.5 bg-slate-700 rounded-full overflow-hidden",children:(0,c.jsx)("div",{className:"h-full bg-gradient-to-r from-red-500 via-yellow-500 to-green-500 rounded-full transition-all",style:{width:`${100*e.salience}%`}})})]}),(0,c.jsxs)("div",{className:"bg-slate-800 rounded-lg p-3",children:[(0,c.jsx)("div",{className:"text-xs text-slate-400",children:"Decay Factor"}),(0,c.jsxs)("div",{className:"text-lg font-bold text-white",children:[(100*E).toFixed(0),"%"]}),(0,c.jsx)("div",{className:"mt-1 h-1.5 bg-slate-700 rounded-full overflow-hidden",children:(0,c.jsx)("div",{className:"h-full rounded-full transition-all",style:{width:`${100*E}%`,backgroundColor:R.color}})})]})]}),!p&&(0,c.jsxs)("div",{className:`bg-slate-800 rounded-lg p-3 space-y-2 transition-all duration-300 ${l?"ring-1 ring-green-500/50":""}`,children:[(0,c.jsxs)("div",{className:"flex justify-between items-center",children:[(0,c.jsx)("span",{className:"text-xs text-slate-400",children:"Access Count"}),(0,c.jsxs)("span",{className:`text-sm font-medium transition-all duration-300 ${l?"text-green-400 scale-110":"text-white"}`,children:[e.accessCount," times"]})]}),(0,c.jsxs)("div",{className:"flex justify-between items-center",children:[(0,c.jsx)("span",{className:"text-xs text-slate-400",children:"Last Accessed"}),(0,c.jsx)("span",{className:`text-sm transition-all duration-300 ${l?"text-green-400":"text-white"}`,children:l?"Just now":(e=>{let t=new Date(e),s=Math.floor((new Date().getTime()-t.getTime())/36e5);if(s<1)return"Just now";if(s<24)return`${s}h ago`;let i=Math.floor(s/24);return i<7?`${i}d ago`:`${Math.floor(i/7)}w ago`})(e.lastAccessed)})]}),(0,c.jsxs)("div",{className:"flex justify-between items-center",children:[(0,c.jsx)("span",{className:"text-xs text-slate-400",children:"Created"}),(0,c.jsx)("span",{className:"text-sm text-white",children:new Date(e.createdAt).toLocaleString()})]})]}),!p&&V.length>0&&(0,c.jsxs)("div",{children:[(0,c.jsxs)("h4",{className:"text-xs font-medium text-slate-400 mb-2 flex items-center gap-2",children:[(0,c.jsx)("span",{className:"inline-block w-4 h-4",children:"🔗"}),"Related Memories (",V.length,")"]}),(0,c.jsx)("div",{className:"space-y-2 max-h-48 overflow-y-auto",children:V.map(({memory:e,relationship:t,strength:s,direction:i})=>{let r=aG[t]||aG.related,a=(0,aY.getCategoryColor)(e.category);return(0,c.jsxs)("button",{onClick:()=>n?.(e.id),className:"w-full text-left p-2 bg-slate-800 hover:bg-slate-750 rounded-lg transition-colors group",children:[(0,c.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,c.jsx)("span",{className:"w-1.5 h-1.5 rounded-full",style:{backgroundColor:r.color}}),(0,c.jsx)("span",{className:"text-[10px] font-medium",style:{color:r.color},children:"to"===i?`${r.icon} ${r.label}`:`${r.label} ${r.icon}`}),(0,c.jsxs)("span",{className:"text-[10px] text-slate-500 ml-auto",children:[(100*s).toFixed(0),"%"]})]}),(0,c.jsx)("div",{className:"text-sm text-white truncate group-hover:text-blue-400 transition-colors",children:e.title}),(0,c.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,c.jsx)("span",{className:"px-1.5 py-0.5 rounded text-[10px]",style:{backgroundColor:a+"20",color:a},children:e.category}),(0,c.jsxs)("span",{className:"text-[10px] text-slate-500",children:[(100*e.salience).toFixed(0),"% salience"]})]})]},`${e.id}-${i}`)})})]}),!p&&e.tags&&e.tags.length>0&&(0,c.jsxs)("div",{children:[(0,c.jsx)("h4",{className:"text-xs font-medium text-slate-400 mb-2",children:"Tags"}),(0,c.jsx)("div",{className:"flex flex-wrap gap-1",children:e.tags.map((e,t)=>(0,c.jsx)("span",{className:"px-2 py-0.5 bg-slate-700 text-slate-300 rounded text-xs",children:e},t))})]}),!p&&(0,c.jsxs)("div",{className:"space-y-2 pt-2",children:[(0,c.jsxs)("div",{className:"flex gap-2",children:[r&&(0,c.jsx)(aK,{variant:"default",size:"sm",onClick:()=>{m(e.id),r?.(e.id)},disabled:a,className:`flex-1 transition-all duration-300 ${l?"bg-green-600 hover:bg-green-600":"bg-blue-600 hover:bg-blue-700"}`,children:a?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("span",{className:"animate-spin mr-2",children:"⟳"}),"Reinforcing..."]}):l?(0,c.jsx)(c.Fragment,{children:"✓ Reinforced!"}):(0,c.jsx)(c.Fragment,{children:"⚡ Reinforce"})}),(0,c.jsx)(aK,{variant:"outline",size:"sm",onClick:()=>x(!0),className:"flex-1 border-slate-600 text-slate-300 hover:text-white hover:bg-slate-700",children:"Edit"})]}),k?(0,c.jsxs)("div",{className:"bg-red-500/10 border border-red-500/30 rounded-lg p-3",children:[(0,c.jsx)("p",{className:"text-xs text-red-400 mb-2",children:"Delete this memory permanently?"}),(0,c.jsxs)("div",{className:"flex gap-2",children:[(0,c.jsx)(aK,{variant:"default",size:"sm",onClick:()=>{T.mutate(e.id,{onSuccess:()=>{i()}})},disabled:T.isPending,className:"flex-1 bg-red-600 hover:bg-red-700",children:T.isPending?"Deleting...":"Confirm Delete"}),(0,c.jsx)(aK,{variant:"outline",size:"sm",onClick:()=>S(!1),className:"flex-1 border-slate-600 text-slate-300 hover:text-white",children:"Cancel"})]})]}):(0,c.jsx)(aK,{variant:"ghost",size:"sm",onClick:()=>S(!0),className:"w-full text-slate-500 hover:text-red-400 hover:bg-red-500/10",children:"Delete Memory"})]})]})]})}var aZ=e.i(1235);function a0(e){let t=Math.floor((Date.now()-new Date(e).getTime())/6e4);if(t<1)return"now";if(t<60)return`${t}m ago`;let s=Math.floor(t/60);if(s<24)return`${s}h ago`;let i=Math.floor(s/24);if(i<7)return`${i}d ago`;let r=Math.floor(i/7);return`${r}w ago`}function a1({memory:e,isSelected:t,onSelect:s,isChecked:i,onCheck:r}){let n=(0,aY.getCategoryColor)(e.category),a=(0,aY.getTypeColor)(e.type);return(0,c.jsxs)("div",{onClick:()=>s(e),className:`bg-slate-900 border rounded-lg p-3 hover:border-slate-600 cursor-pointer transition-colors relative ${t?"border-cyan-500":"border-slate-800"}`,children:[(0,c.jsx)("div",{className:"h-0.5 rounded-full bg-slate-800 mb-2 overflow-hidden",children:(0,c.jsx)("div",{className:"h-full rounded-full",style:{width:`${100*e.salience}%`,backgroundColor:n}})}),r&&(0,c.jsx)("input",{type:"checkbox",checked:i??!1,onChange:t=>{t.stopPropagation(),r(e.id,t.target.checked)},onClick:e=>e.stopPropagation(),className:"absolute top-3 right-3 w-4 h-4 accent-blue-500"}),(0,c.jsx)("h3",{className:"text-sm font-semibold text-white truncate pr-6",children:e.title}),(0,c.jsxs)("div",{className:"flex items-center gap-1.5 mt-1",children:[(0,c.jsx)("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full font-medium",style:{backgroundColor:n+"22",color:n},children:e.category}),(0,c.jsx)("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full font-medium",style:{backgroundColor:a+"22",color:a},children:e.type.replace("_","-")})]}),(0,c.jsx)("p",{className:"text-[13px] text-slate-400 mt-1.5 line-clamp-3 leading-snug",children:e.content}),e.tags.length>0&&(0,c.jsxs)("div",{className:"flex items-center gap-1 mt-2 flex-wrap",children:[e.tags.slice(0,3).map(e=>(0,c.jsx)("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-slate-800 text-slate-400",children:e},e)),e.tags.length>3&&(0,c.jsxs)("span",{className:"text-[10px] text-slate-500",children:["+",e.tags.length-3," more"]})]}),(0,c.jsxs)("div",{className:"flex items-center justify-between mt-2 text-[11px] text-slate-500",children:[(0,c.jsxs)("span",{children:["Created ",a0(e.createdAt)]}),(0,c.jsxs)("span",{children:["Accessed ",a0(e.lastAccessed)]})]})]})}let a5=h.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";function a2({memories:e,selectedMemory:t,onSelectMemory:s}){let[i,r]=(0,u.useState)("salience"),[n,a]=(0,u.useState)("grid"),[o,l]=(0,u.useState)(!1),[d,h]=(0,u.useState)(new Set),[m,p]=(0,u.useState)(!1),x=(0,aZ.useQueryClient)(),f=(0,u.useMemo)(()=>{let t=[...e];return t.sort((e,t)=>{switch(i){case"salience":return t.salience-e.salience;case"createdAt":return new Date(t.createdAt).getTime()-new Date(e.createdAt).getTime();case"lastAccessed":return new Date(t.lastAccessed).getTime()-new Date(e.lastAccessed).getTime();case"decayedScore":return(t.decayedScore??t.salience)-(e.decayedScore??e.salience);default:return 0}}),t},[e,i]),g=(0,u.useCallback)((e,t)=>{h(s=>{let i=new Set(s);return t?i.add(e):i.delete(e),i})},[]),y=async()=>{if(0!==d.size){p(!0);try{await Promise.all(Array.from(d).map(e=>fetch(`${a5}/api/memories/${e}`,{method:"DELETE"}))),h(new Set),x.invalidateQueries({queryKey:["memories"]})}finally{p(!1)}}};return(0,c.jsxs)("div",{className:"flex flex-col h-full",children:[(0,c.jsxs)("div",{className:"flex items-center gap-3 px-4 py-2 border-b border-slate-800 shrink-0",children:[(0,c.jsxs)("span",{className:"text-xs text-slate-400",children:[e.length," memories"]}),(0,c.jsx)("div",{className:"w-px h-5 bg-slate-700"}),(0,c.jsxs)("select",{value:i,onChange:e=>r(e.target.value),className:"bg-slate-800 border border-slate-700 text-white text-xs rounded px-2 py-1",children:[(0,c.jsx)("option",{value:"salience",children:"Salience"}),(0,c.jsx)("option",{value:"createdAt",children:"Created"}),(0,c.jsx)("option",{value:"lastAccessed",children:"Last Accessed"}),(0,c.jsx)("option",{value:"decayedScore",children:"Decay Score"})]}),(0,c.jsxs)("div",{className:"flex items-center border border-slate-700 rounded overflow-hidden",children:[(0,c.jsx)("button",{onClick:()=>a("grid"),className:`px-2 py-1 text-xs ${"grid"===n?"bg-slate-700 text-white":"text-slate-400 hover:text-white"}`,children:"Grid"}),(0,c.jsx)("button",{onClick:()=>a("list"),className:`px-2 py-1 text-xs ${"list"===n?"bg-slate-700 text-white":"text-slate-400 hover:text-white"}`,children:"List"})]}),(0,c.jsx)("div",{className:"w-px h-5 bg-slate-700"}),(0,c.jsx)("button",{onClick:()=>{l(!o),h(new Set)},className:`px-2 py-1 text-xs rounded ${o?"bg-blue-600 text-white":"bg-slate-800 text-slate-400 hover:text-white"}`,children:"Select"}),o&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("button",{onClick:()=>h(new Set(f.map(e=>e.id))),className:"px-2 py-1 text-xs text-slate-400 hover:text-white",children:"Select all"}),(0,c.jsx)("button",{onClick:y,disabled:0===d.size||m,className:"px-2 py-1 text-xs rounded bg-red-600/20 text-red-400 hover:bg-red-600/40 disabled:opacity-40",children:m?"Deleting...":`Delete (${d.size})`})]})]}),(0,c.jsx)("div",{className:"flex-1 overflow-y-auto p-4",children:(0,c.jsx)("div",{className:"grid"===n?"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-3":"flex flex-col gap-3 max-w-2xl",children:f.map(e=>(0,c.jsx)(a1,{memory:e,isSelected:t?.id===e.id,onSelect:s,isChecked:o?d.has(e.id):void 0,onCheck:o?g:void 0},e.id))})})]})}var a4=e.i(87353);let a3=e=>{let t=e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,s)=>s?s.toUpperCase():t.toLowerCase());return t.charAt(0).toUpperCase()+t.slice(1)},a6=(...e)=>e.filter((e,t,s)=>!!e&&""!==e.trim()&&s.indexOf(e)===t).join(" ").trim();var a8={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let a7=(0,u.forwardRef)(({color:e="currentColor",size:t=24,strokeWidth:s=2,absoluteStrokeWidth:i,className:r="",children:n,iconNode:a,...o},l)=>(0,u.createElement)("svg",{ref:l,...a8,width:t,height:t,stroke:e,strokeWidth:i?24*Number(s)/Number(t):s,className:a6("lucide",r),...!n&&!(e=>{for(let t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0})(o)&&{"aria-hidden":"true"},...o},[...a.map(([e,t])=>(0,u.createElement)(e,t)),...Array.isArray(n)?n:[n]])),a9=(e,t)=>{let s=(0,u.forwardRef)(({className:s,...i},r)=>(0,u.createElement)(a7,{ref:r,iconNode:t,className:a6(`lucide-${a3(e).replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${e}`,s),...i}));return s.displayName=a3(e),s},oe=a9("shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]),ot=a9("file-text",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]),os=a9("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),oi=a9("database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]),or=a9("brain",[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]]),on=a9("git-branch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]),oa=a9("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]),oo=a9("file-search",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["circle",{cx:"11.5",cy:"14.5",r:"2.5",key:"1bq0ko"}],["path",{d:"M13.3 16.3 15 18",key:"2quom7"}]]),ol=a9("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),od=[{id:"shield",label:"Shield",icon:oe},{id:"audit",label:"Audit",icon:ot},{id:"quarantine",label:"Queue",icon:os},{id:"agents",label:"Agents",icon:oa},{id:"skills",label:"Skills",icon:oo},{id:"dome",label:"Dome",icon:ol},{id:"memories",label:"Memories",icon:oi},{id:"brain",label:"Brain",icon:or},{id:"graph",label:"Graph",icon:on}];function oc(){let{viewMode:e,setViewMode:t}=(0,nP.useDashboardStore)(),{data:s}=(0,nM.useStats)(),{data:i}=(0,a4.useAuditStats)("24h"),{data:r}=(0,nM.useVersion)(),n=s?.decayDistribution?Math.round(s.decayDistribution.healthy/Math.max(1,s.total)*100):null,a=i?.blockedCount??0;return(0,c.jsxs)("nav",{className:"w-14 border-r border-slate-800 bg-slate-900/50 flex flex-col items-center py-3 shrink-0",children:[(0,c.jsx)("div",{className:"flex-1 flex flex-col items-center gap-1",children:od.map(({id:s,label:i,icon:r})=>(0,c.jsxs)("button",{onClick:()=>t(s),className:`relative w-10 h-10 rounded-lg flex flex-col items-center justify-center gap-0.5 transition-colors ${e===s?"dome"===s?"bg-red-600/20 text-red-400":"bg-cyan-600/20 text-cyan-400":"text-slate-500 hover:text-slate-300 hover:bg-slate-800"}`,title:i,children:[(0,c.jsx)(r,{size:18}),(0,c.jsx)("span",{className:"text-[9px] leading-none",children:i}),"shield"===s&&a>0&&(0,c.jsx)("span",{className:"absolute -top-0.5 -right-0.5 min-w-[14px] h-[14px] rounded-full bg-red-500 text-white text-[8px] flex items-center justify-center px-0.5",children:a>99?"99+":a})]},s))}),(0,c.jsxs)("div",{className:"flex flex-col items-center gap-1 text-[10px] text-slate-500",children:[s&&(0,c.jsx)("span",{children:s.total}),null!==n&&(0,c.jsxs)("span",{children:[n,"%"]}),r?.version&&(0,c.jsxs)("span",{children:["v",r.version]})]})]})}let ou=a9("flame",[["path",{d:"M12 3q1 4 4 6.5t3 5.5a1 1 0 0 1-14 0 5 5 0 0 1 1-3 1 1 0 0 0 5 0c0-2-1.5-3-1.5-5q0-2 2.5-4",key:"1slcih"}]]),oh=a9("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),om=a9("puzzle",[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]]),op=a9("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),ox=[{key:"trust",label:"Trust",icon:oe,color:"text-blue-400",bg:"bg-blue-400/10"},{key:"firewall",label:"Firewall",icon:ou,color:"text-orange-400",bg:"bg-orange-400/10"},{key:"sensitivity",label:"Sensitivity",icon:oh,color:"text-purple-400",bg:"bg-purple-400/10"},{key:"fragmentation",label:"Fragment",icon:om,color:"text-cyan-400",bg:"bg-cyan-400/10"},{key:"audit",label:"Audit",icon:ot,color:"text-green-400",bg:"bg-green-400/10"}],of={strict:{color:"text-red-400",bg:"bg-red-400/10"},balanced:{color:"text-cyan-400",bg:"bg-cyan-400/10"},permissive:{color:"text-green-400",bg:"bg-green-400/10"}};function og({timeRange:e}){let{projectFilter:t}=(0,nP.useDashboardStore)(),{data:s,isLoading:i,isError:r}=(0,a4.useAuditStats)(e,t||void 0),{data:n}=(0,a4.useDefenceConfig)(),a=(0,a4.useSetDefenceMode)(),[o,l]=(0,u.useState)(!1),d=(0,u.useRef)(null),h=n?.mode??"balanced",m=of[h];return(0,u.useEffect)(()=>{function e(e){d.current&&!d.current.contains(e.target)&&l(!1)}return o&&document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[o]),(0,c.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[n?.tampered&&(0,c.jsxs)("div",{className:"flex items-center gap-2 bg-red-500/10 border border-red-500/30 rounded-lg px-3 py-2 mb-3",children:[(0,c.jsx)(os,{size:14,className:"text-red-400 shrink-0"}),(0,c.jsx)("span",{className:"text-xs text-red-400",children:"Config integrity check failed — running in strict mode"})]}),(0,c.jsx)("h3",{className:"text-sm font-medium text-slate-300 mb-4",children:"Defence Pipeline"}),(0,c.jsx)("div",{className:"flex items-center gap-1 mb-4",children:ox.map(({key:e,label:t,icon:s,color:i,bg:r},n)=>(0,c.jsxs)("div",{className:"flex items-center",children:[(0,c.jsxs)("div",{className:`flex items-center gap-1.5 px-3 py-2 rounded-lg ${r}`,children:[(0,c.jsx)(s,{size:14,className:i}),(0,c.jsx)("span",{className:`text-xs font-medium ${i}`,children:t})]}),n<ox.length-1&&(0,c.jsx)("div",{className:"w-4 h-px bg-slate-700 mx-0.5"})]},e))}),i?(0,c.jsx)("div",{className:"text-xs text-slate-500 animate-pulse",children:"Loading stats..."}):r?(0,c.jsx)("div",{className:"text-xs text-red-400",children:"Failed to load stats"}):s?(0,c.jsxs)("div",{className:"grid grid-cols-3 gap-3",children:[(0,c.jsxs)("div",{className:"text-center",children:[(0,c.jsx)("div",{className:"text-2xl font-bold text-green-400",children:s.allowedCount}),(0,c.jsx)("div",{className:"text-[10px] text-slate-500 uppercase",children:"Allowed"})]}),(0,c.jsxs)("div",{className:"text-center",children:[(0,c.jsx)("div",{className:"text-2xl font-bold text-red-400",children:s.blockedCount}),(0,c.jsx)("div",{className:"text-[10px] text-slate-500 uppercase",children:"Blocked"})]}),(0,c.jsxs)("div",{className:"text-center",children:[(0,c.jsx)("div",{className:"text-2xl font-bold text-yellow-400",children:s.quarantinedCount}),(0,c.jsx)("div",{className:"text-[10px] text-slate-500 uppercase",children:"Quarantined"})]})]}):(0,c.jsx)("div",{className:"text-xs text-slate-500",children:"No data"}),(0,c.jsx)("button",{onClick:()=>nP.useDashboardStore.getState().setViewMode("audit"),className:"mt-3 w-full text-center text-xs text-cyan-400 hover:text-cyan-300 transition-colors py-1",children:"View full audit log →"}),(0,c.jsxs)("div",{className:"mt-2 pt-3 border-t border-slate-800 flex items-center justify-between",children:[(0,c.jsx)("span",{className:"text-xs text-slate-500",children:"Firewall Mode"}),(0,c.jsxs)("div",{className:"relative",ref:d,children:[(0,c.jsxs)("button",{onClick:()=>l(!o),className:`text-xs font-medium ${m.color} ${m.bg} px-2 py-0.5 rounded flex items-center gap-1 hover:opacity-80 transition-opacity`,children:[h,(0,c.jsx)(op,{size:10})]}),o&&(0,c.jsx)("div",{className:"absolute right-0 top-full mt-1 bg-slate-800 border border-slate-700 rounded-lg shadow-xl z-50 min-w-[120px] py-1",children:["strict","balanced","permissive"].map(e=>{let t=of[e];return(0,c.jsxs)("button",{onClick:()=>{a.mutate(e),l(!1)},className:`w-full text-left px-3 py-1.5 text-xs hover:bg-slate-700/50 transition-colors flex items-center justify-between ${e===h?t.color+" font-medium":"text-slate-400"}`,children:[e,e===h&&(0,c.jsx)("span",{className:"text-[10px]",children:"✓"})]},e)})})]})]})]})}function oy(){let{setViewMode:e,projectFilter:t}=(0,nP.useDashboardStore)(),{data:s,isLoading:i,isError:r}=(0,a4.useQuarantine)("pending",3,t||void 0),n=s?.total??0,a=s?.items??[];return(0,c.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,c.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,c.jsx)("h3",{className:"text-sm font-medium text-slate-300",children:"Quarantine Queue"}),n>0&&(0,c.jsxs)("span",{className:"text-xs font-medium text-yellow-400 bg-yellow-400/10 px-2 py-0.5 rounded-full",children:[n," pending"]})]}),i?(0,c.jsx)("div",{className:"text-xs text-slate-500 animate-pulse",children:"Loading..."}):r?(0,c.jsx)("div",{className:"text-xs text-red-400",children:"Failed to load quarantine"}):0===a.length?(0,c.jsxs)("div",{className:"flex flex-col items-center py-6 text-slate-500",children:[(0,c.jsx)(os,{size:24,className:"mb-2 text-slate-600"}),(0,c.jsx)("span",{className:"text-xs",children:"No items in quarantine"})]}):(0,c.jsx)("div",{className:"space-y-2",children:a.map(e=>{let t=(()=>{try{return JSON.parse(e.threat_indicators)}catch{return[]}})();return(0,c.jsxs)("div",{className:"bg-slate-800/50 border border-slate-700 rounded-lg p-3",children:[(0,c.jsxs)("div",{className:"flex items-start justify-between",children:[(0,c.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,c.jsx)("div",{className:"text-xs font-medium text-white truncate",children:e.title||"Untitled"}),(0,c.jsxs)("div",{className:"text-[10px] text-slate-500 mt-0.5",children:[e.source_type," · ",new Date(e.created_at).toLocaleTimeString()]})]}),(0,c.jsx)("span",{className:"text-[10px] text-red-400 bg-red-400/10 px-1.5 py-0.5 rounded shrink-0 ml-2",children:e.reason?.slice(0,30)||"Threat detected"})]}),t.length>0&&(0,c.jsx)("div",{className:"flex gap-1 mt-1.5 flex-wrap",children:t.slice(0,3).map((e,t)=>(0,c.jsx)("span",{className:"text-[9px] text-yellow-400 bg-yellow-400/10 px-1 py-0.5 rounded",children:e},t))})]},e.id)})}),n>0&&(0,c.jsxs)("button",{onClick:()=>e("quarantine"),className:"w-full mt-3 text-xs text-cyan-400 hover:text-cyan-300 transition-colors",children:["Review all ",n," items →"]})]})}function ov({timeRange:e}){let{projectFilter:t}=(0,nP.useDashboardStore)(),s={"24h":24,"7d":168,"30d":720},[i,r]=(0,u.useState)(()=>Date.now());(0,u.useEffect)(()=>{r(Date.now())},[e]);let n=(0,u.useMemo)(()=>new Date(6e4*Math.floor((i-36e5*s[e])/6e4)).toISOString(),[i,e]),{data:a,isLoading:o,isError:l}=(0,a4.useAuditLogs)({startTime:n,project:t||void 0,limit:500}),d=(0,u.useMemo)(()=>{if(!a?.logs.length)return[];let t="24h"===e?36e5:"7d"===e?216e5:864e5,s="24h"===e?24:"7d"===e?28:30,r=Array.from({length:s},(e,r)=>({time:i-(s-1-r)*t,allowed:0,blocked:0,quarantined:0}));for(let e of a.logs){let n=Math.floor((new Date(e.timestamp).getTime()-(i-s*t))/t),a=Math.min(Math.max(n,0),s-1);n>=0&&n<=s&&("ALLOW"===e.firewall_result?r[a].allowed++:"BLOCK"===e.firewall_result?r[a].blocked++:"QUARANTINE"===e.firewall_result&&r[a].quarantined++)}return r},[a,e,i]),h=Math.max(1,...d.map(e=>e.allowed+e.blocked+e.quarantined));return(0,c.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,c.jsx)("h3",{className:"text-sm font-medium text-slate-300 mb-4",children:"Threat Timeline"}),o?(0,c.jsx)("div",{className:"h-32 flex items-center justify-center",children:(0,c.jsx)("div",{className:"text-xs text-slate-500 animate-pulse",children:"Loading timeline..."})}):l?(0,c.jsx)("div",{className:"h-32 flex items-center justify-center",children:(0,c.jsx)("div",{className:"text-xs text-red-400",children:"Failed to load timeline"})}):0===d.length?(0,c.jsx)("div",{className:"h-32 flex items-center justify-center",children:(0,c.jsx)("div",{className:"text-xs text-slate-500",children:"No audit data"})}):(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("div",{className:"flex gap-px h-32",children:d.map((e,t)=>{let s=e.allowed+e.blocked+e.quarantined,i=s>0?e.blocked/s*100:0,r=s>0?e.quarantined/s*100:0;return(0,c.jsx)("div",{className:"flex-1 flex flex-col justify-end",title:`${new Date(e.time).toLocaleString()}: ${e.allowed} allowed, ${e.blocked} blocked, ${e.quarantined} quarantined`,children:(0,c.jsx)("div",{className:"w-full rounded-t-sm overflow-hidden",style:{height:`${Math.max(s/h*100,2*(s>0))}%`},children:(0,c.jsxs)("div",{className:"w-full h-full flex flex-col-reverse",children:[e.blocked>0&&(0,c.jsx)("div",{className:"bg-red-500",style:{height:`${i}%`}}),e.quarantined>0&&(0,c.jsx)("div",{className:"bg-yellow-500",style:{height:`${r}%`}}),(0,c.jsx)("div",{className:"bg-emerald-500/60 flex-1"})]})})},t)})}),(0,c.jsxs)("div",{className:"flex gap-4 mt-3 justify-center",children:[(0,c.jsxs)("div",{className:"flex items-center gap-1",children:[(0,c.jsx)("div",{className:"w-2 h-2 rounded-full bg-emerald-500/60"}),(0,c.jsx)("span",{className:"text-[10px] text-slate-500",children:"Allowed"})]}),(0,c.jsxs)("div",{className:"flex items-center gap-1",children:[(0,c.jsx)("div",{className:"w-2 h-2 rounded-full bg-red-500"}),(0,c.jsx)("span",{className:"text-[10px] text-slate-500",children:"Blocked"})]}),(0,c.jsxs)("div",{className:"flex items-center gap-1",children:[(0,c.jsx)("div",{className:"w-2 h-2 rounded-full bg-yellow-500"}),(0,c.jsx)("span",{className:"text-[10px] text-slate-500",children:"Quarantined"})]})]}),(0,c.jsx)("button",{onClick:()=>nP.useDashboardStore.getState().setViewMode("audit"),className:"mt-3 w-full text-center text-xs text-cyan-400 hover:text-cyan-300 transition-colors py-1",children:"View detailed audit log →"})]})]})}function ob({timeRange:e}){let{projectFilter:t}=(0,nP.useDashboardStore)(),{data:s,isLoading:i,isError:r}=(0,a4.useAuditStats)(e,t||void 0);if(i)return(0,c.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,c.jsx)("h3",{className:"text-sm font-medium text-slate-300 mb-4",children:"Stats Summary"}),(0,c.jsx)("div",{className:"text-xs text-slate-500 animate-pulse",children:"Loading..."})]});if(r)return(0,c.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,c.jsx)("h3",{className:"text-sm font-medium text-slate-300 mb-4",children:"Stats Summary"}),(0,c.jsx)("div",{className:"text-xs text-red-400",children:"Failed to load stats"})]});if(!s)return(0,c.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,c.jsx)("h3",{className:"text-sm font-medium text-slate-300 mb-4",children:"Stats Summary"}),(0,c.jsx)("div",{className:"text-xs text-slate-500",children:"No data"})]});let n=s.totalOperations||1,a=(s.blockedCount/n*100).toFixed(1),o=Object.entries(s.threatBreakdown||{}).sort((e,t)=>t[1]-e[1]).slice(0,5);return(0,c.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,c.jsx)("h3",{className:"text-sm font-medium text-slate-300 mb-4",children:"Stats Summary"}),(0,c.jsxs)("div",{className:"grid grid-cols-2 gap-3 mb-4",children:[(0,c.jsxs)("div",{className:"bg-slate-800/50 rounded-lg p-3 text-center",children:[(0,c.jsx)("div",{className:"text-2xl font-bold text-white",children:s.totalOperations}),(0,c.jsx)("div",{className:"text-[10px] text-slate-500 uppercase",children:"Total Scans"})]}),(0,c.jsxs)("div",{className:"bg-slate-800/50 rounded-lg p-3 text-center",children:[(0,c.jsxs)("div",{className:`text-2xl font-bold ${parseFloat(a)>10?"text-red-400":"text-green-400"}`,children:[a,"%"]}),(0,c.jsx)("div",{className:"text-[10px] text-slate-500 uppercase",children:"Block Rate"})]})]}),s.topSources.length>0&&(0,c.jsxs)("div",{className:"mb-4",children:[(0,c.jsx)("div",{className:"text-[10px] text-slate-500 uppercase mb-2",children:"Top Sources"}),(0,c.jsx)("div",{className:"space-y-1",children:s.topSources.slice(0,3).map(e=>(0,c.jsxs)("div",{className:"flex items-center justify-between",children:[(0,c.jsx)("span",{className:"text-xs text-slate-400",children:e.source}),(0,c.jsx)("span",{className:"text-xs text-slate-500",children:e.count})]},e.source))})]}),o.length>0&&(0,c.jsxs)("div",{children:[(0,c.jsx)("div",{className:"text-[10px] text-slate-500 uppercase mb-2",children:"Threat Types"}),(0,c.jsx)("div",{className:"space-y-1",children:o.map(([e,t])=>(0,c.jsxs)("div",{className:"flex items-center justify-between",children:[(0,c.jsx)("span",{className:"text-xs text-slate-400",children:e}),(0,c.jsx)("span",{className:"text-xs font-medium text-red-400",children:t})]},e))})]}),(0,c.jsx)("button",{onClick:()=>nP.useDashboardStore.getState().setViewMode("audit"),className:"mt-3 w-full text-center text-xs text-cyan-400 hover:text-cyan-300 transition-colors py-1",children:"View full audit log →"})]})}let oj=a9("cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]),ow=a9("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),oN=a9("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),ok=a9("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),oS=a9("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function oC(){let{projectFilter:e}=(0,nP.useDashboardStore)(),{data:t}=(0,a4.useAuditStats)("30d",e||void 0),[s,i]=(0,u.useState)("upsell"),[r,n]=(0,u.useState)(""),[a,o]=(0,u.useState)(null),[l,d]=(0,u.useState)(""),[h,m]=(0,u.useState)(!1);(0,u.useEffect)(()=>{let e=localStorage.getItem("shieldcortex_cloud_dismissed");if(e){let t=new Date(e);(Date.now()-t.getTime())/864e5<30&&i("hidden")}},[]),(0,u.useEffect)(()=>{fetch("http://localhost:3001/api/cloud/config").then(e=>e.json()).then(e=>{e.enabled&&e.apiKeySet&&i("hidden")}).catch(()=>{})},[]),(0,u.useEffect)(()=>{if("polling"!==s||!a)return;let e=setInterval(async()=>{try{let t=await fetch(`https://api.shieldcortex.ai/v1/auth/setup-status/${a}`),s=await t.json();"complete"===s.status&&s.api_key?(await fetch("http://localhost:3001/api/cloud/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cloudApiKey:s.api_key,cloudEnabled:!0,cloudBaseUrl:"https://api.shieldcortex.ai"})}),i("success"),clearInterval(e),setTimeout(()=>i("hidden"),5e3)):"expired"===s.status&&(d("Setup expired. Please try again."),i("upsell"),clearInterval(e))}catch{}},3e3);return()=>clearInterval(e)},[s,a]);let p=async e=>{if(e.preventDefault(),r&&!h){d(""),m(!0);try{let e=await fetch("https://api.shieldcortex.ai/v1/auth/cloud-setup",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:r})}),t=await e.json();t.setup_id?(o(t.setup_id),i("polling")):d(t.error||"Failed to start setup")}catch{d("Could not reach ShieldCortex Cloud. Check your connection.")}finally{m(!1)}}};if("hidden"===s)return null;let x=t?.blockedCount??0,f=t?.totalOperations??0;return(0,c.jsxs)("div",{className:"mt-4 bg-gradient-to-br from-slate-900 via-slate-900 to-cyan-950/30 border border-cyan-800/30 rounded-xl p-5 relative",children:["upsell"===s&&(0,c.jsx)("button",{onClick:()=>{localStorage.setItem("shieldcortex_cloud_dismissed",new Date().toISOString()),i("hidden")},className:"absolute top-3 right-3 text-slate-500 hover:text-slate-300 transition-colors",title:"Dismiss for 30 days",children:(0,c.jsx)(oS,{size:16})}),"upsell"===s&&(0,c.jsxs)("div",{className:"space-y-4",children:[(0,c.jsxs)("div",{className:"flex items-center gap-2",children:[(0,c.jsx)(oj,{size:20,className:"text-cyan-400"}),(0,c.jsx)("h3",{className:"text-sm font-semibold text-white",children:"ShieldCortex Cloud"})]}),(0,c.jsx)("p",{className:"text-sm text-slate-300",children:x>0?`You've blocked ${x} threats across ${f} scans — your team can't see them yet.`:"Sync your defence data to the cloud for team visibility, audit logs, and alerts."}),(0,c.jsxs)("form",{onSubmit:p,className:"flex gap-2",children:[(0,c.jsx)("input",{type:"email",placeholder:"Enter your email",value:r,onChange:e=>n(e.target.value),required:!0,className:"flex-1 bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-sm text-white placeholder:text-slate-500 focus:outline-none focus:ring-1 focus:ring-cyan-500 focus:border-cyan-500"}),(0,c.jsxs)("button",{type:"submit",disabled:h,className:"flex items-center gap-1.5 px-4 py-2 bg-cyan-600 hover:bg-cyan-500 disabled:opacity-50 rounded-lg text-sm font-medium text-white transition-colors",children:[h?(0,c.jsx)(oN,{size:14,className:"animate-spin"}):(0,c.jsx)(ow,{size:14}),"Get Started"]})]}),l&&(0,c.jsx)("p",{className:"text-xs text-red-400",children:l}),(0,c.jsx)("p",{className:"text-[10px] text-slate-500",children:"Free tier: 500 scans/month, 7-day retention. No credit card required."})]}),"polling"===s&&(0,c.jsxs)("div",{className:"flex items-center gap-3 py-2",children:[(0,c.jsx)(oN,{size:20,className:"text-cyan-400 animate-spin"}),(0,c.jsxs)("div",{children:[(0,c.jsx)("p",{className:"text-sm text-white font-medium",children:"Check your email"}),(0,c.jsx)("p",{className:"text-xs text-slate-400",children:"Click the link in your inbox to complete setup. We'll auto-configure everything."})]})]}),"success"===s&&(0,c.jsxs)("div",{className:"flex items-center gap-3 py-2",children:[(0,c.jsx)(ok,{size:20,className:"text-emerald-400"}),(0,c.jsxs)("div",{children:[(0,c.jsx)("p",{className:"text-sm text-white font-medium",children:"Connected to ShieldCortex Cloud"}),(0,c.jsx)("p",{className:"text-xs text-slate-400",children:"Your defence data will now sync automatically."})]})]})]})}function oT(){let e,t,{data:s,isLoading:i}=(0,nD.useQuery)({queryKey:["cloud-sync-status"],queryFn:async()=>{let e=await fetch("http://localhost:3001/api/cloud/sync-status");if(!e.ok)throw Error("Failed to fetch sync status");return e.json()},refetchInterval:1e4});if(i||!s)return null;let{enabled:r,apiKeySet:n,lastSyncAt:a,queue:o}=s;r&&n?o.failed>0?(e="bg-red-500",t=`${o.failed} event${1===o.failed?"":"s"} failed`):o.pending>0?(e="bg-amber-500",t=`${o.pending} event${1===o.pending?"":"s"} pending`):a?(e="bg-emerald-500",t="Cloud sync: OK"):(e="bg-emerald-500",t="Cloud sync: connected"):(e="bg-slate-500",t="Cloud sync: disabled");let l=a?function(e){let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);if(t<60)return`${t}s ago`;let s=Math.floor(t/60);if(s<60)return`${s}m ago`;let i=Math.floor(s/60);if(i<24)return`${i}h ago`;let r=Math.floor(i/24);return`${r}d ago`}(a):null;return(0,c.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 mb-4 bg-slate-800 rounded-lg text-xs w-fit",children:[(0,c.jsx)("span",{className:`inline-block w-2 h-2 rounded-full ${e}`}),(0,c.jsx)("span",{className:"text-slate-300",children:t}),l&&(0,c.jsxs)("span",{className:"text-slate-500",children:["last sync ",l]})]})}let oA=a9("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);var oM=e.i(71921),oP=e.i(88969);let oE=h.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";async function oD(e){let t=await (0,oP.authFetch)(`${oE}/api/skills/scan-all`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({dir:e})});if(!t.ok)throw Error("Failed to scan skills");return t.json()}async function oL(e){let t=await (0,oP.authFetch)(`${oE}/api/skills/scan`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw Error("Failed to scan skill content");return t.json()}function oR(){return(0,oM.useMutation)({mutationFn:e=>oD(e)})}async function oV(e){let t=await (0,oP.authFetch)(`${oE}/api/skills/trust`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e})});if(!t.ok)throw Error("Failed to trust skill");return t.json()}async function oF(e){let t=await (0,oP.authFetch)(`${oE}/api/skills/trust`,{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e})});if(!t.ok)throw Error("Failed to untrust skill");return t.json()}async function o$(e){let t=await (0,oP.authFetch)(`${oE}/api/skills/file`,{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e})});if(!t.ok)throw Error((await t.json().catch(()=>({}))).error||"Failed to delete skill file");return t.json()}function oz(){let e=oR(),{setViewMode:t}=(0,nP.useDashboardStore)(),[s,i]=(0,u.useState)(null),r=s?s.files.filter(e=>e.safe).length:0,n=s?.threatCount??0;return(0,c.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,c.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,c.jsx)("h3",{className:"text-sm font-medium text-slate-300",children:"Skill Scanner"}),(0,c.jsxs)("button",{onClick:()=>{e.mutate(void 0,{onSuccess:e=>i(e)})},disabled:e.isPending,className:"flex items-center gap-1.5 px-3 py-1.5 bg-cyan-600 hover:bg-cyan-500 disabled:opacity-50 rounded-lg text-xs font-medium text-white transition-colors",children:[e.isPending?(0,c.jsx)(oN,{size:12,className:"animate-spin"}):(0,c.jsx)(oo,{size:12}),"Scan All"]})]}),s?(0,c.jsxs)("div",{children:[(0,c.jsxs)("div",{className:"flex items-center gap-4 mb-3",children:[(0,c.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,c.jsx)(ok,{size:14,className:"text-green-400"}),(0,c.jsx)("span",{className:"text-sm font-medium text-green-400",children:r}),(0,c.jsx)("span",{className:"text-[10px] text-slate-500",children:"safe"})]}),n>0&&(0,c.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,c.jsx)(oA,{size:14,className:"text-red-400"}),(0,c.jsx)("span",{className:"text-sm font-medium text-red-400",children:n}),(0,c.jsx)("span",{className:"text-[10px] text-slate-500",children:"threats"})]}),(0,c.jsx)("span",{className:"text-[10px] text-slate-600",children:new Date(s.scannedAt).toLocaleTimeString()})]}),(0,c.jsxs)("button",{onClick:()=>t("skills"),className:"flex items-center gap-1 text-xs text-cyan-400 hover:text-cyan-300 transition-colors",children:["View all results",(0,c.jsx)(ow,{size:12})]})]}):e.isPending?(0,c.jsx)("div",{className:"flex items-center justify-center py-4",children:(0,c.jsx)(oN,{size:16,className:"text-cyan-400 animate-spin"})}):(0,c.jsxs)("div",{className:"text-center py-3",children:[(0,c.jsx)(oo,{size:20,className:"text-slate-600 mx-auto mb-1.5"}),(0,c.jsx)("p",{className:"text-[10px] text-slate-500",children:"Scan agent instruction files for threats"})]})]})}let o_=h.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";async function oI(){let e=await fetch(`${o_}/api/iron-dome/status`);if(!e.ok)throw Error("Failed to fetch Iron Dome status");return e.json()}async function oO(e){let t=await (0,oP.authFetch)(`${o_}/api/iron-dome/activate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({profile:e})});if(!t.ok)throw Error("Failed to activate Iron Dome");return t.json()}async function oB(){let e=await (0,oP.authFetch)(`${o_}/api/iron-dome/deactivate`,{method:"POST"});if(!e.ok)throw Error("Failed to deactivate Iron Dome");return e.json()}async function oU(e){let t=await (0,oP.authFetch)(`${o_}/api/iron-dome/scan`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:e})});if(!t.ok)throw Error("Failed to scan text");return t.json()}async function oW(e){let t=new URLSearchParams;e&&t.set("limit",e.toString());let s=await fetch(`${o_}/api/iron-dome/audit?${t}`);if(!s.ok)throw Error("Failed to fetch Iron Dome audit");return s.json()}function oq(){return(0,nD.useQuery)({queryKey:["iron-dome-status"],queryFn:oI,refetchInterval:3e4,retry:2})}function oK(e){return(0,nD.useQuery)({queryKey:["iron-dome-audit",e],queryFn:()=>oW(e),refetchInterval:3e4,retry:2})}function oH(){let{data:e,isLoading:t}=oq(),{data:s}=oK(100),i=e?.enabled??!1,r=e?.profile??"custom",n=s?.logs??[],a=n.filter(e=>e.reason?.includes("[iron-dome:")&&"BLOCK"===e.firewall_result).length,o=n.length;return(0,c.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,c.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,c.jsx)("h3",{className:"text-sm font-medium text-slate-300",children:"Iron Dome"}),(0,c.jsx)("span",{className:`text-[10px] font-medium px-2 py-0.5 rounded-full ${i?"bg-red-500/20 text-red-400 border border-red-500/30":"bg-slate-700/50 text-slate-500"}`,children:i?"ACTIVE":"INACTIVE"})]}),t?(0,c.jsx)("div",{className:"text-xs text-slate-500 animate-pulse",children:"Loading..."}):i?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsxs)("div",{className:"text-xs text-slate-500 mb-3",children:["Profile: ",(0,c.jsx)("span",{className:"text-red-400 font-medium",children:r})]}),(0,c.jsxs)("div",{className:"grid grid-cols-2 gap-3 mb-3",children:[(0,c.jsxs)("div",{className:"bg-slate-800/50 rounded-lg p-2 text-center",children:[(0,c.jsx)("div",{className:"text-lg font-bold text-red-400",children:a}),(0,c.jsx)("div",{className:"text-[10px] text-slate-500 uppercase",children:"Blocks"})]}),(0,c.jsxs)("div",{className:"bg-slate-800/50 rounded-lg p-2 text-center",children:[(0,c.jsx)("div",{className:"text-lg font-bold text-slate-300",children:o}),(0,c.jsx)("div",{className:"text-[10px] text-slate-500 uppercase",children:"Events"})]})]})]}):(0,c.jsxs)("div",{className:"text-center py-3",children:[(0,c.jsx)(oe,{size:20,className:"text-slate-600 mx-auto mb-1.5"}),(0,c.jsx)("p",{className:"text-[10px] text-slate-500",children:"Behaviour protection layer — not active"})]}),(0,c.jsx)("button",{onClick:()=>nP.useDashboardStore.getState().setViewMode("dome"),className:"w-full text-center text-xs text-red-400 hover:text-red-300 transition-colors py-1",children:"View Iron Dome →"})]})}let oY="http://localhost:3001";function oX(){return(0,nD.useQuery)({queryKey:["cloud-config"],queryFn:async()=>{let e=await (0,oP.authFetch)(`${oY}/api/cloud/config`);if(!e.ok)throw Error("Failed to fetch cloud config");return e.json()},refetchInterval:3e4})}function oG(e,t,s){return Math.max(t,Math.min(s,e))}function oQ({initialAutoMemory:e,initialDedupe:t,initialNoveltyThreshold:s,initialMaxRecent:i}){let r,n=(r=(0,aZ.useQueryClient)(),(0,oM.useMutation)({mutationFn:async e=>{let t=await (0,oP.authFetch)(`${oY}/api/cloud/config`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw Error("Failed to update cloud config");return t.json()},onSuccess:()=>{r.invalidateQueries({queryKey:["cloud-config"]})}})),[a,o]=(0,u.useState)(e),[l,d]=(0,u.useState)(t),[h,m]=(0,u.useState)(String(s)),[p,x]=(0,u.useState)(String(i)),f=n.isPending;return(0,c.jsxs)("div",{className:"mt-4 space-y-3",children:[(0,c.jsxs)("div",{className:"flex items-center justify-between",children:[(0,c.jsx)("span",{className:"text-xs text-slate-400",children:"Auto-memory extraction"}),(0,c.jsx)("button",{type:"button",onClick:()=>o(!a),className:`h-6 w-11 rounded-full transition-colors ${a?"bg-cyan-500":"bg-slate-700"}`,children:(0,c.jsx)("span",{className:`block h-5 w-5 rounded-full bg-white transition-transform ${a?"translate-x-5":"translate-x-0.5"}`})})]}),(0,c.jsxs)("div",{className:"flex items-center justify-between",children:[(0,c.jsx)("span",{className:"text-xs text-slate-400",children:"Novelty dedupe"}),(0,c.jsx)("button",{type:"button",onClick:()=>d(!l),disabled:!a,className:`h-6 w-11 rounded-full transition-colors ${l&&a?"bg-emerald-500":"bg-slate-700"} ${!a?"opacity-50 cursor-not-allowed":""}`,children:(0,c.jsx)("span",{className:`block h-5 w-5 rounded-full bg-white transition-transform ${l&&a?"translate-x-5":"translate-x-0.5"}`})})]}),(0,c.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,c.jsxs)("div",{children:[(0,c.jsx)("label",{className:"block text-[11px] text-slate-500 mb-1",children:"Novelty threshold"}),(0,c.jsx)(aH,{type:"number",step:"0.01",min:.6,max:.99,value:h,disabled:!a||!l,onChange:e=>m(e.target.value),className:"h-8 text-xs bg-slate-800 border-slate-700"})]}),(0,c.jsxs)("div",{children:[(0,c.jsx)("label",{className:"block text-[11px] text-slate-500 mb-1",children:"Max recent records"}),(0,c.jsx)(aH,{type:"number",step:"1",min:50,max:1e3,value:p,disabled:!a||!l,onChange:e=>x(e.target.value),className:"h-8 text-xs bg-slate-800 border-slate-700"})]})]}),(0,c.jsxs)("div",{className:"flex items-center justify-between pt-1",children:[(0,c.jsx)("span",{className:"text-[11px] text-slate-500",children:"Default: dedupe on, threshold 0.88, max 300"}),(0,c.jsxs)(aK,{size:"sm",onClick:()=>{let e=oG(Number.parseFloat(h),.6,.99),t=Math.floor(oG(Number.parseInt(p,10),50,1e3));n.mutate({openclawAutoMemory:a,openclawAutoMemoryDedupe:l,openclawAutoMemoryNoveltyThreshold:Number.isFinite(e)?e:.88,openclawAutoMemoryMaxRecent:Number.isFinite(t)?t:300})},disabled:f,className:"h-8 text-xs bg-cyan-600 hover:bg-cyan-500 text-white",children:[f?(0,c.jsx)(oN,{size:12,className:"animate-spin"}):null,"Save"]})]})]})}function oJ(){let{data:e,isLoading:t}=oX(),s=e?.openclawMemory,i=s?`${s.autoMemory}-${s.dedupe}-${s.noveltyThreshold}-${s.maxRecent}`:"default";return(0,c.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,c.jsx)("h3",{className:"text-sm font-medium text-slate-300",children:"OpenClaw Memory"}),(0,c.jsx)("p",{className:"text-xs text-slate-500 mt-1",children:"Configure how ShieldCortex complements native OpenClaw memory."}),(0,c.jsx)("p",{className:"text-[11px] text-slate-600 mt-1",children:"Changes apply on next OpenClaw gateway restart."}),t?(0,c.jsx)("div",{className:"text-xs text-slate-500 mt-4 animate-pulse",children:"Loading settings..."}):(0,c.jsx)(oQ,{initialAutoMemory:s?.autoMemory??!1,initialDedupe:s?.dedupe??!0,initialNoveltyThreshold:s?.noveltyThreshold??.88,initialMaxRecent:s?.maxRecent??300},i)]})}function oZ(){let[e,t]=(0,u.useState)("24h");return(0,c.jsxs)("div",{className:"h-full overflow-y-auto p-6",children:[(0,c.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,c.jsx)("h2",{className:"text-lg font-semibold text-white",children:"Defence Overview"}),(0,c.jsx)("div",{className:"flex gap-1 bg-slate-800 rounded-lg p-0.5",children:["24h","7d","30d"].map(s=>(0,c.jsx)("button",{onClick:()=>t(s),className:`px-3 py-1 text-xs rounded-md transition-colors ${e===s?"bg-cyan-600 text-white":"text-slate-400 hover:text-white"}`,children:s},s))})]}),(0,c.jsx)(oT,{}),(0,c.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[(0,c.jsx)(og,{timeRange:e}),(0,c.jsx)(oy,{}),(0,c.jsx)(ov,{timeRange:e}),(0,c.jsx)(ob,{timeRange:e})]}),(0,c.jsx)("div",{className:"mt-4",children:(0,c.jsx)(oz,{})}),(0,c.jsx)("div",{className:"mt-4",children:(0,c.jsx)(oH,{})}),(0,c.jsx)("div",{className:"mt-4",children:(0,c.jsx)(oJ,{})}),(0,c.jsx)(oC,{})]})}let o0={ALLOW:"bg-green-500/10 text-green-400",BLOCK:"bg-red-500/10 text-red-400",QUARANTINE:"bg-yellow-500/10 text-yellow-400"};function o1(){let{projectFilter:e,selectedAuditEntry:t,setSelectedAuditEntry:s}=(0,nP.useDashboardStore)(),[i,r]=(0,u.useState)("24h"),[n,a]=(0,u.useState)(void 0),[o,l]=(0,u.useState)(void 0),d={"24h":24,"7d":168,"30d":720},[h,m]=(0,u.useState)(()=>Date.now());(0,u.useEffect)(()=>{m(Date.now())},[i]);let p=(0,u.useMemo)(()=>new Date(6e4*Math.floor((h-36e5*d[i])/6e4)).toISOString(),[h,i]),{data:x,isLoading:f}=(0,a4.useAuditLogs)({startTime:p,source:n,firewallResult:o,project:e||void 0,limit:200}),g=x?.logs??[],y=(0,u.useCallback)(e=>{if(!t||0===g.length)return;let i=g.findIndex(e=>e.id===t.id);"Escape"===e.key?s(null):"ArrowDown"===e.key&&i<g.length-1?(e.preventDefault(),s(g[i+1])):"ArrowUp"===e.key&&i>0&&(e.preventDefault(),s(g[i-1]))},[t,g,s]);return(0,u.useEffect)(()=>(window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)),[y]),(0,c.jsxs)("div",{className:"h-full flex flex-col overflow-hidden",children:[(0,c.jsxs)("div",{className:"p-4 border-b border-slate-800 shrink-0",children:[(0,c.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,c.jsx)("h2",{className:"text-lg font-semibold text-white",children:"Audit Log"}),(0,c.jsx)("div",{className:"flex gap-1 bg-slate-800 rounded-lg p-0.5",children:["24h","7d","30d"].map(e=>(0,c.jsx)("button",{onClick:()=>r(e),className:`px-3 py-1 text-xs rounded-md transition-colors ${i===e?"bg-cyan-600 text-white":"text-slate-400 hover:text-white"}`,children:e},e))})]}),(0,c.jsxs)("div",{className:"flex gap-2",children:[(0,c.jsxs)("select",{value:o||"",onChange:e=>l(e.target.value||void 0),className:"bg-slate-800 border border-slate-700 text-white text-xs rounded-lg px-2 py-1",children:[(0,c.jsx)("option",{value:"",children:"All Results"}),(0,c.jsx)("option",{value:"ALLOW",children:"Allowed"}),(0,c.jsx)("option",{value:"BLOCK",children:"Blocked"}),(0,c.jsx)("option",{value:"QUARANTINE",children:"Quarantined"})]}),(0,c.jsxs)("select",{value:n||"",onChange:e=>a(e.target.value||void 0),className:"bg-slate-800 border border-slate-700 text-white text-xs rounded-lg px-2 py-1",children:[(0,c.jsx)("option",{value:"",children:"All Sources"}),(0,c.jsx)("option",{value:"hook",children:"Hook"}),(0,c.jsx)("option",{value:"api",children:"API"}),(0,c.jsx)("option",{value:"agent",children:"Agent"}),(0,c.jsx)("option",{value:"user",children:"User"}),(0,c.jsx)("option",{value:"cli",children:"CLI"})]}),(0,c.jsxs)("span",{className:"text-xs text-slate-500 self-center ml-auto",children:[g.length," entries"]})]})]}),(0,c.jsx)("div",{className:"flex-1 overflow-y-auto",children:f?(0,c.jsx)("div",{className:"flex items-center justify-center h-32",children:(0,c.jsx)("div",{className:"text-xs text-slate-500 animate-pulse",children:"Loading audit logs..."})}):0===g.length?(0,c.jsx)("div",{className:"flex items-center justify-center h-32",children:(0,c.jsx)("div",{className:"text-xs text-slate-500",children:"No audit entries for this period"})}):(0,c.jsxs)("table",{className:"w-full text-xs",children:[(0,c.jsx)("thead",{className:"sticky top-0 bg-slate-900",children:(0,c.jsxs)("tr",{className:"border-b border-slate-800",children:[(0,c.jsx)("th",{className:"text-left text-slate-500 font-medium px-4 py-2",children:"Time"}),(0,c.jsx)("th",{className:"text-left text-slate-500 font-medium px-4 py-2",children:"Source"}),(0,c.jsx)("th",{className:"text-left text-slate-500 font-medium px-4 py-2",children:"Result"}),(0,c.jsx)("th",{className:"text-left text-slate-500 font-medium px-4 py-2",children:"Trust"}),(0,c.jsx)("th",{className:"text-left text-slate-500 font-medium px-4 py-2",children:"Anomaly"}),(0,c.jsx)("th",{className:"text-left text-slate-500 font-medium px-4 py-2",children:"Reason"})]})}),(0,c.jsx)("tbody",{children:g.map(e=>(0,c.jsxs)("tr",{onClick:()=>{s(t?.id===e.id?null:e)},className:`border-b border-slate-800/50 cursor-pointer transition-colors ${t?.id===e.id?"bg-cyan-500/10 hover:bg-cyan-500/15":"hover:bg-slate-800/30"}`,children:[(0,c.jsx)("td",{className:"px-4 py-2 text-slate-400 whitespace-nowrap",children:new Date(e.timestamp).toLocaleString()}),(0,c.jsx)("td",{className:"px-4 py-2 text-slate-300",children:e.source_type}),(0,c.jsx)("td",{className:"px-4 py-2",children:(0,c.jsx)("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-medium ${o0[e.firewall_result]||"text-slate-400"}`,children:e.firewall_result})}),(0,c.jsx)("td",{className:"px-4 py-2 text-slate-400",children:e.trust_score.toFixed(1)}),(0,c.jsx)("td",{className:"px-4 py-2",children:(0,c.jsx)("span",{className:e.anomaly_score>.5?"text-red-400":e.anomaly_score>.2?"text-yellow-400":"text-slate-400",children:e.anomaly_score.toFixed(2)})}),(0,c.jsx)("td",{className:"px-4 py-2 text-slate-400 max-w-xs truncate",children:e.reason||"—"})]},e.id))})]})})]})}let o5={ALLOW:{color:"#22C55E",bg:"rgba(34, 197, 94, 0.15)",label:"Allowed"},BLOCK:{color:"#EF4444",bg:"rgba(239, 68, 68, 0.15)",label:"Blocked"},QUARANTINE:{color:"#EAB308",bg:"rgba(234, 179, 8, 0.15)",label:"Quarantined"}},o2={PUBLIC:{color:"#94a3b8",bg:"rgba(148, 163, 184, 0.15)"},INTERNAL:{color:"#60a5fa",bg:"rgba(96, 165, 250, 0.15)"},CONFIDENTIAL:{color:"#f59e0b",bg:"rgba(245, 158, 11, 0.15)"},RESTRICTED:{color:"#ef4444",bg:"rgba(239, 68, 68, 0.15)"}},o4={instruction_injection:{color:"#ef4444",bg:"rgba(239, 68, 68, 0.15)"},privilege_escalation:{color:"#ef4444",bg:"rgba(239, 68, 68, 0.15)"},credential_leak:{color:"#ef4444",bg:"rgba(239, 68, 68, 0.15)"},encoding_obfuscation:{color:"#f59e0b",bg:"rgba(245, 158, 11, 0.15)"},fragmented_payload:{color:"#f59e0b",bg:"rgba(245, 158, 11, 0.15)"},external_url:{color:"#f59e0b",bg:"rgba(245, 158, 11, 0.15)"},pipeline_error:{color:"#94a3b8",bg:"rgba(148, 163, 184, 0.15)"}};function o3(e){return e>=.7?"#22C55E":e>=.4?"#EAB308":"#EF4444"}function o6(e){return e>.5?"#EF4444":e>.2?"#EAB308":"#94a3b8"}function o8({entry:e,onClose:t,onViewMemory:s}){let[i,r]=(0,u.useState)(!1),n=o5[e.firewall_result]||o5.ALLOW,a=o2[e.sensitivity_level]||o2.PUBLIC,o=function(e){try{let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}(e.threat_indicators),l=function(e){try{let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}(e.blocked_patterns),d=(0,u.useCallback)(()=>{let t=JSON.stringify(e,null,2);navigator.clipboard.writeText(t).then(()=>{r(!0),setTimeout(()=>r(!1),1500)})},[e]);return(0,c.jsxs)(aL,{className:"bg-slate-900 border-slate-700 h-full overflow-auto",children:[(0,c.jsxs)(aR,{className:"border-b border-slate-700 pb-3",children:[(0,c.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,c.jsxs)("div",{className:"flex items-center gap-3",children:[(0,c.jsx)("span",{className:"px-2.5 py-1 rounded-md text-xs font-bold",style:{backgroundColor:n.bg,color:n.color},children:n.label}),(0,c.jsx)("span",{className:"px-2 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:a.bg,color:a.color},children:e.sensitivity_level})]}),(0,c.jsx)(aK,{variant:"ghost",size:"sm",onClick:t,className:"text-slate-400 hover:text-white -mt-1",children:"✕"})]}),(0,c.jsx)("div",{className:"text-xs text-slate-400 mt-2",children:new Date(e.timestamp).toLocaleString()}),e.project&&(0,c.jsxs)("div",{className:"text-[10px] text-slate-500 mt-1",children:["Project: ",e.project]})]}),(0,c.jsxs)(aF,{className:"p-4 space-y-4",children:[(0,c.jsxs)("div",{children:[(0,c.jsx)("h4",{className:"text-xs font-medium text-slate-400 mb-2",children:"Source"}),(0,c.jsxs)("div",{className:"bg-slate-800 rounded-lg p-3",children:[(0,c.jsx)("div",{className:"flex items-center gap-2 mb-1",children:(0,c.jsx)("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium bg-cyan-500/10 text-cyan-400",children:e.source_type})}),e.source_identifier&&(0,c.jsx)("div",{className:"text-xs text-slate-300 mt-1 font-mono break-all",children:e.source_identifier})]})]}),(0,c.jsxs)("div",{children:[(0,c.jsx)("h4",{className:"text-xs font-medium text-slate-400 mb-2",children:"Scores"}),(0,c.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,c.jsxs)("div",{className:"bg-slate-800 rounded-lg p-3",children:[(0,c.jsx)("div",{className:"text-[10px] text-slate-500",children:"Trust"}),(0,c.jsxs)("div",{className:"text-lg font-bold",style:{color:o3(e.trust_score)},children:[(100*e.trust_score).toFixed(0),"%"]}),(0,c.jsx)("div",{className:"mt-1 h-1.5 bg-slate-700 rounded-full overflow-hidden",children:(0,c.jsx)("div",{className:"h-full rounded-full transition-all",style:{width:`${100*e.trust_score}%`,backgroundColor:o3(e.trust_score)}})})]}),(0,c.jsxs)("div",{className:"bg-slate-800 rounded-lg p-3",children:[(0,c.jsx)("div",{className:"text-[10px] text-slate-500",children:"Anomaly"}),(0,c.jsxs)("div",{className:"text-lg font-bold",style:{color:o6(e.anomaly_score)},children:[(100*e.anomaly_score).toFixed(0),"%"]}),(0,c.jsx)("div",{className:"mt-1 h-1.5 bg-slate-700 rounded-full overflow-hidden",children:(0,c.jsx)("div",{className:"h-full rounded-full transition-all",style:{width:`${100*e.anomaly_score}%`,backgroundColor:o6(e.anomaly_score)}})})]}),null!==e.fragmentation_score&&(0,c.jsxs)("div",{className:"bg-slate-800 rounded-lg p-3",children:[(0,c.jsx)("div",{className:"text-[10px] text-slate-500",children:"Fragmentation"}),(0,c.jsxs)("div",{className:"text-lg font-bold text-slate-300",children:[(100*e.fragmentation_score).toFixed(0),"%"]}),(0,c.jsx)("div",{className:"mt-1 h-1.5 bg-slate-700 rounded-full overflow-hidden",children:(0,c.jsx)("div",{className:"h-full rounded-full bg-purple-500 transition-all",style:{width:`${100*e.fragmentation_score}%`}})})]}),null!==e.pipeline_duration_ms&&(0,c.jsxs)("div",{className:"bg-slate-800 rounded-lg p-3",children:[(0,c.jsx)("div",{className:"text-[10px] text-slate-500",children:"Pipeline"}),(0,c.jsxs)("div",{className:"text-lg font-bold text-slate-300",children:[e.pipeline_duration_ms,"ms"]})]})]})]}),(0,c.jsxs)("div",{children:[(0,c.jsx)("h4",{className:"text-xs font-medium text-slate-400 mb-2",children:"Threat Indicators"}),o.length>0?(0,c.jsx)("div",{className:"flex flex-wrap gap-1.5",children:o.map((e,t)=>{let s=o4[e]||{color:"#94a3b8",bg:"rgba(148, 163, 184, 0.15)"};return(0,c.jsx)("span",{className:"px-2 py-1 rounded text-[11px] font-medium",style:{backgroundColor:s.bg,color:s.color},children:e.replace(/_/g," ")},t)})}):(0,c.jsx)("div",{className:"text-xs text-slate-600",children:"No threats detected"})]}),l.length>0&&(0,c.jsxs)("div",{children:[(0,c.jsx)("h4",{className:"text-xs font-medium text-slate-400 mb-2",children:"Blocked Patterns"}),(0,c.jsx)("div",{className:"bg-slate-800 rounded-lg p-3 max-h-32 overflow-y-auto",children:l.map((e,t)=>(0,c.jsx)("div",{className:"text-[11px] text-slate-300 font-mono break-all mb-1 last:mb-0",children:e},t))})]}),e.reason&&(0,c.jsxs)("div",{children:[(0,c.jsx)("h4",{className:"text-xs font-medium text-slate-400 mb-2",children:"Reason"}),(0,c.jsx)("div",{className:"bg-slate-800 rounded-lg p-3",children:(0,c.jsx)("p",{className:"text-xs text-slate-300 whitespace-pre-wrap leading-relaxed",children:e.reason})})]}),(0,c.jsxs)("div",{className:"flex gap-2 pt-2",children:[e.memory_id&&s&&(0,c.jsx)(aK,{variant:"default",size:"sm",onClick:()=>s(e.memory_id),className:"flex-1 bg-blue-600 hover:bg-blue-700",children:"View Memory"}),(0,c.jsx)(aK,{variant:"outline",size:"sm",onClick:d,className:`flex-1 border-slate-700 transition-all ${i?"bg-green-600/20 text-green-400 border-green-600/50":"text-slate-300 hover:text-white"}`,children:i?"Copied":"Copy JSON"})]})]})]})}let o7=a9("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);function o9({action:e,item:t,onConfirm:s,onCancel:i}){let[r,n]=(0,u.useState)(""),a="yes"===r.trim().toLowerCase();return(0,c.jsx)("div",{className:"fixed inset-0 bg-black/60 flex items-center justify-center z-50",children:(0,c.jsxs)("div",{className:"bg-slate-900 border border-slate-700 rounded-xl p-6 max-w-md w-full mx-4",children:[(0,c.jsxs)("h3",{className:"text-sm font-semibold text-white mb-2",children:["approve"===e?"Approve":"Reject"," quarantined item?"]}),(0,c.jsx)("p",{className:"text-xs text-slate-400 mb-1",children:(0,c.jsx)("strong",{children:t.title||"Untitled"})}),(0,c.jsx)("p",{className:"text-xs text-slate-500 mb-4",children:"approve"===e?"This will store the memory in the database.":"This will permanently discard the memory."}),(0,c.jsxs)("div",{className:"mb-4",children:[(0,c.jsxs)("label",{className:"text-xs text-slate-400 block mb-1",children:["Type ",(0,c.jsx)("strong",{className:"text-white",children:"YES"})," to confirm:"]}),(0,c.jsx)("input",{type:"text",value:r,onChange:e=>n(e.target.value),className:"w-full bg-slate-800 border border-slate-700 text-white text-sm rounded-lg px-3 py-2 focus:ring-cyan-500 focus:border-cyan-500",autoFocus:!0,onKeyDown:e=>{"Enter"===e.key&&a&&s(),"Escape"===e.key&&i()}})]}),(0,c.jsxs)("div",{className:"flex gap-2 justify-end",children:[(0,c.jsx)("button",{onClick:i,className:"px-3 py-1.5 text-xs text-slate-400 hover:text-white transition-colors",children:"Cancel"}),(0,c.jsx)("button",{onClick:s,disabled:!a,className:`px-3 py-1.5 text-xs rounded-lg transition-colors ${a?"approve"===e?"bg-green-600 text-white hover:bg-green-500":"bg-red-600 text-white hover:bg-red-500":"bg-slate-700 text-slate-500 cursor-not-allowed"}`,children:"approve"===e?"Approve":"Reject"})]})]})})}function le(){let{projectFilter:e}=(0,nP.useDashboardStore)(),[t,s]=(0,u.useState)("pending"),{data:i,isLoading:r}=(0,a4.useQuarantine)(t,100,e||void 0),n=(0,a4.useApproveQuarantine)(),a=(0,a4.useRejectQuarantine)(),[o,l]=(0,u.useState)(null),d=i?.items??[];return(0,c.jsxs)("div",{className:"h-full flex flex-col overflow-hidden",children:[o&&(0,c.jsx)(o9,{action:o.action,item:o.item,onConfirm:()=>{o&&("approve"===o.action?n.mutate(o.item.id):a.mutate({id:o.item.id}),l(null))},onCancel:()=>l(null)}),(0,c.jsx)("div",{className:"p-4 border-b border-slate-800 shrink-0",children:(0,c.jsxs)("div",{className:"flex items-center justify-between",children:[(0,c.jsx)("h2",{className:"text-lg font-semibold text-white",children:"Quarantine Review"}),(0,c.jsx)("div",{className:"flex gap-1 bg-slate-800 rounded-lg p-0.5",children:["pending","approved","rejected"].map(e=>(0,c.jsx)("button",{onClick:()=>s(e),className:`px-3 py-1 text-xs rounded-md transition-colors capitalize ${t===e?"bg-cyan-600 text-white":"text-slate-400 hover:text-white"}`,children:e},e))})]})}),(0,c.jsx)("div",{className:"flex-1 overflow-y-auto p-4",children:r?(0,c.jsx)("div",{className:"flex items-center justify-center h-32",children:(0,c.jsx)("div",{className:"text-xs text-slate-500 animate-pulse",children:"Loading quarantine items..."})}):0===d.length?(0,c.jsxs)("div",{className:"flex flex-col items-center justify-center h-32 text-slate-500",children:[(0,c.jsx)(os,{size:24,className:"mb-2 text-slate-600"}),(0,c.jsxs)("span",{className:"text-xs",children:["No ",t," items"]})]}):(0,c.jsx)("div",{className:"space-y-3",children:d.map(e=>{let t=(()=>{try{return JSON.parse(e.threat_indicators)}catch{return[]}})();return(0,c.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,c.jsxs)("div",{className:"flex items-start justify-between mb-2",children:[(0,c.jsxs)("div",{children:[(0,c.jsx)("h4",{className:"text-sm font-medium text-white",children:e.title||"Untitled"}),(0,c.jsxs)("div",{className:"text-[10px] text-slate-500 mt-0.5",children:[e.source_type," · ",new Date(e.created_at).toLocaleString(),e.anomaly_score>0&&(0,c.jsxs)("span",{className:`ml-2 ${e.anomaly_score>.5?"text-red-400":"text-yellow-400"}`,children:["Anomaly: ",e.anomaly_score.toFixed(2)]})]})]}),(0,c.jsx)("span",{className:"text-[10px] text-red-400 bg-red-400/10 px-2 py-0.5 rounded",children:e.reason?.slice(0,50)||"Threat detected"})]}),(0,c.jsx)("div",{className:"bg-slate-800/50 rounded-lg p-3 mb-3 text-xs text-slate-300 max-h-24 overflow-y-auto whitespace-pre-wrap",children:e.content?.slice(0,500)||"No content"}),t.length>0&&(0,c.jsx)("div",{className:"flex gap-1 mb-3 flex-wrap",children:t.map((e,t)=>(0,c.jsx)("span",{className:"text-[9px] text-yellow-400 bg-yellow-400/10 px-1.5 py-0.5 rounded",children:e},t))}),"pending"===e.status&&(0,c.jsxs)("div",{className:"flex gap-2",children:[(0,c.jsxs)("button",{onClick:()=>l({action:"approve",item:e}),className:"flex items-center gap-1 px-3 py-1.5 text-xs bg-green-600/10 text-green-400 rounded-lg hover:bg-green-600/20 transition-colors",children:[(0,c.jsx)(o7,{size:12})," Approve"]}),(0,c.jsxs)("button",{onClick:()=>l({action:"reject",item:e}),className:"flex items-center gap-1 px-3 py-1.5 text-xs bg-red-600/10 text-red-400 rounded-lg hover:bg-red-600/20 transition-colors",children:[(0,c.jsx)(oS,{size:12})," Reject"]})]}),e.reviewed_at&&(0,c.jsxs)("div",{className:"text-[10px] text-slate-500",children:["approved"===e.status?"Approved":"Rejected"," by ",e.reviewed_by," at ",new Date(e.reviewed_at).toLocaleString()]})]},e.id)})})})]})}let lt=a9("funnel",[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]]),ls=a9("arrow-up-down",[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]]),li=a9("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),lr=h.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";async function ln(e,t){let s=new URLSearchParams({timeRange:e});t&&s.set("project",t);let i=await fetch(`${lr}/api/v1/agents?${s}`);if(!i.ok)throw Error("Failed to fetch agent registry");return i.json()}async function la(e,t,s){let i=encodeURIComponent(e),r=new URLSearchParams({timeRange:t});s&&r.set("project",s);let n=await fetch(`${lr}/api/v1/agents/${i}/timeline?${r}`);if(!n.ok)throw Error("Failed to fetch agent timeline");return n.json()}async function lo(e,t){let s=encodeURIComponent(e),i=new URLSearchParams;t?.limit&&i.set("limit",t.limit.toString()),t?.offset&&i.set("offset",t.offset.toString()),t?.firewallResult&&i.set("firewallResult",t.firewallResult),t?.project&&i.set("project",t.project);let r=await fetch(`${lr}/api/v1/agents/${s}/operations?${i}`);if(!r.ok)throw Error("Failed to fetch agent operations");return r.json()}function ll(e,t){return(0,nD.useQuery)({queryKey:["agent-operations",e,t],queryFn:()=>lo(e,t),enabled:!!e,refetchInterval:3e4,retry:2})}function ld(e){return e>=.7?"full":e>=.5?"limited":"restricted"}let lc={full:"text-green-400",limited:"text-yellow-400",restricted:"text-red-400"},lu={full:"bg-green-500/10",limited:"bg-yellow-500/10",restricted:"bg-red-500/10"},lh={full:"Full Access",limited:"Limited",restricted:"Restricted"},lm=460,lp=90;function lx({identifier:e,timeRange:t}){let{data:s,isLoading:i}=function(e,t="24h",s){return(0,nD.useQuery)({queryKey:["agent-timeline",e,t,void 0],queryFn:()=>la(e,t,void 0),enabled:!!e,refetchInterval:3e4,retry:2})}(e,t),r=s?.points??[],{linePath:n,dots:a,xLabels:o}=(0,u.useMemo)(()=>{if(0===r.length)return{linePath:"",dots:[],xLabels:[]};let e=r.map(e=>new Date(e.timestamp).getTime()),s=Math.min(...e),i=Math.max(...e)-s||1,n=e=>30+(e-s)/i*lm,a=e=>10+(1-e)*lp,o=r.map((t,s)=>{let i=n(e[s]),r=a(t.trust_score);return`${0===s?"M":"L"} ${i} ${r}`}),l=r.map((t,s)=>({x:n(e[s]),y:a(t.trust_score),result:t.firewall_result,score:t.trust_score,time:t.timestamp})).filter(e=>"ALLOW"!==e.result),d=Math.min(5,r.length),c=[];for(let e=0;e<d;e++){let r=s+i*e/(d-1||1),a=new Date(r);c.push({x:n(r),label:"24h"===t?a.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):a.toLocaleDateString([],{month:"short",day:"numeric"})})}return{linePath:o.join(" "),dots:l,xLabels:c}},[r,t]);return i?(0,c.jsx)("div",{className:"h-[120px] flex items-center justify-center text-slate-500 text-xs",children:"Loading timeline..."}):0===r.length?(0,c.jsx)("div",{className:"h-[120px] flex items-center justify-center text-slate-500 text-xs",children:"No data for this time range."}):(0,c.jsxs)("svg",{viewBox:"0 0 500 120",className:"w-full",preserveAspectRatio:"xMidYMid meet",children:[(0,c.jsx)("line",{x1:30,y1:10+(1-.7)*lp,x2:30+lm,y2:10+(1-.7)*lp,stroke:"#22c55e",strokeWidth:"0.5",strokeDasharray:"4 2",opacity:"0.3"}),(0,c.jsx)("line",{x1:30,y1:10+.5*lp,x2:30+lm,y2:10+.5*lp,stroke:"#eab308",strokeWidth:"0.5",strokeDasharray:"4 2",opacity:"0.3"}),(0,c.jsx)("text",{x:26,y:10+(1-.7)*lp+3,fill:"#64748b",fontSize:"8",textAnchor:"end",children:"0.7"}),(0,c.jsx)("text",{x:26,y:10+.5*lp+3,fill:"#64748b",fontSize:"8",textAnchor:"end",children:"0.5"}),(0,c.jsx)("text",{x:26,y:13,fill:"#64748b",fontSize:"8",textAnchor:"end",children:"1.0"}),(0,c.jsx)("text",{x:26,y:10+lp+3,fill:"#64748b",fontSize:"8",textAnchor:"end",children:"0.0"}),(0,c.jsx)("path",{d:n,fill:"none",stroke:"#06b6d4",strokeWidth:"1.5"}),a.map((e,t)=>(0,c.jsx)("circle",{cx:e.x,cy:e.y,r:"3",fill:"BLOCK"===e.result?"#ef4444":"#eab308",stroke:"#0f172a",strokeWidth:"1",children:(0,c.jsx)("title",{children:`${e.result} — trust: ${e.score.toFixed(2)} — ${new Date(e.time).toLocaleString()}`})},t)),o.map((e,t)=>(0,c.jsx)("text",{x:e.x,y:116,fill:"#64748b",fontSize:"8",textAnchor:"middle",children:e.label},t))]})}let lf={BLOCK:"text-red-400 bg-red-500/10",QUARANTINE:"text-yellow-400 bg-yellow-500/10"};function lg({identifier:e}){let{data:t,isLoading:s}=ll(e,{firewallResult:"BLOCK",limit:20}),{data:i}=ll(e,{firewallResult:"QUARANTINE",limit:20}),r=[...t?.entries??[],...i?.entries??[]].sort((e,t)=>new Date(t.timestamp).getTime()-new Date(e.timestamp).getTime());return s?(0,c.jsx)("div",{className:"text-slate-500 text-xs",children:"Loading..."}):0===r.length?(0,c.jsx)("div",{className:"text-slate-500 text-xs",children:"No flagged operations."}):(0,c.jsx)("div",{className:"space-y-1 max-h-60 overflow-y-auto",children:r.map(e=>{let t=[];try{t=JSON.parse(e.threat_indicators)}catch{}return(0,c.jsxs)("div",{className:"px-2 py-1.5 rounded bg-slate-800/50 border border-slate-800",children:[(0,c.jsxs)("div",{className:"flex items-center justify-between",children:[(0,c.jsx)("span",{className:`px-1 py-0.5 rounded text-[10px] font-medium ${lf[e.firewall_result]??"text-slate-400"}`,children:e.firewall_result}),(0,c.jsx)("span",{className:"text-[10px] text-slate-500",children:new Date(e.timestamp).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})})]}),e.reason&&(0,c.jsx)("p",{className:"text-[11px] text-slate-400 mt-0.5 truncate",children:e.reason}),t.length>0&&(0,c.jsx)("div",{className:"flex gap-1 mt-1 flex-wrap",children:t.map((e,t)=>(0,c.jsx)("span",{className:"px-1 py-0.5 rounded text-[9px] bg-red-500/10 text-red-400",children:e},t))}),(0,c.jsxs)("div",{className:"flex gap-3 mt-1 text-[10px] text-slate-500",children:[(0,c.jsxs)("span",{children:["Trust: ",e.trust_score.toFixed(2)]}),(0,c.jsxs)("span",{children:["Anomaly: ",e.anomaly_score.toFixed(2)]}),null!==e.pipeline_duration_ms&&(0,c.jsxs)("span",{children:[e.pipeline_duration_ms,"ms"]})]})]},e.id)})})}let ly=a9("bell",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]]),lv=h.default.env.NEXT_PUBLIC_WS_URL||"ws://localhost:3001/ws/events";function lb({agentFilter:e}){let[t,s]=(0,u.useState)([]),i=(0,u.useRef)(0),r=(0,u.useRef)(null),n=(0,u.useCallback)(t=>{try{let r=JSON.parse(t.data);if("defence_event"!==r.type)return;let n=r.data;if(e&&n.source_identifier!==e)return;s(e=>[{...n,id:++i.current},...e].slice(0,50))}catch{}},[e]);return((0,u.useEffect)(()=>{try{let e=new WebSocket(lv);return r.current=e,e.onmessage=n,e.onerror=()=>{},()=>{e.close(),r.current=null}}catch{return}},[n]),0===t.length)?(0,c.jsxs)("div",{className:"flex items-center gap-2 text-slate-500 text-xs py-2",children:[(0,c.jsx)(ly,{size:12}),(0,c.jsx)("span",{children:"Listening for defence events..."})]}):(0,c.jsx)("div",{className:"space-y-1 max-h-48 overflow-y-auto",children:(0,c.jsx)(P,{initial:!1,children:t.map(e=>(0,c.jsxs)(nT.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0},className:`px-2 py-1.5 rounded border text-xs ${"BLOCK"===e.firewall_result?"bg-red-500/5 border-red-500/20":"bg-yellow-500/5 border-yellow-500/20"}`,children:[(0,c.jsxs)("div",{className:"flex items-center justify-between",children:[(0,c.jsx)("span",{className:`font-medium ${"BLOCK"===e.firewall_result?"text-red-400":"text-yellow-400"}`,children:e.firewall_result}),(0,c.jsx)("span",{className:"text-[10px] text-slate-500",children:new Date(e.timestamp).toLocaleTimeString()})]}),(0,c.jsxs)("p",{className:"text-slate-400 text-[11px] truncate mt-0.5",children:[e.source_identifier," — ",e.reason??"No reason"]})]},e.id))})})}function lj({identifier:e,compact:t}){let s=e.split(">").map(e=>e.trim());return 1===s.length?(0,c.jsx)("span",{className:"font-mono text-sm text-white",children:e}):t?(0,c.jsxs)("span",{className:"font-mono text-sm",children:[(0,c.jsxs)("span",{className:"text-slate-500",children:[s.slice(0,-1).join(" › ")," › "]}),(0,c.jsx)("span",{className:"text-white",children:s[s.length-1]})]}):(0,c.jsx)("div",{className:"font-mono text-sm",children:s.map((e,t)=>(0,c.jsxs)("span",{children:[t>0&&(0,c.jsx)(li,{size:12,className:"inline text-slate-600 mx-0.5"}),(0,c.jsx)("span",{className:t===s.length-1?"text-white":"text-slate-500",children:e})]},t))})}function lw({score:e}){let t=ld(e);return(0,c.jsxs)("span",{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-medium ${lc[t]} ${lu[t]}`,children:[e.toFixed(2)," · ",lh[t]]})}function lN({type:e}){let t={agent:"text-purple-400 bg-purple-500/10",cli:"text-cyan-400 bg-cyan-500/10",user:"text-green-400 bg-green-500/10",hook:"text-blue-400 bg-blue-500/10",api:"text-orange-400 bg-orange-500/10",web:"text-red-400 bg-red-500/10",file:"text-slate-400 bg-slate-500/10",email:"text-yellow-400 bg-yellow-500/10"}[e]??"text-slate-400 bg-slate-500/10";return(0,c.jsx)("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-medium ${t}`,children:e})}function lk(){let{projectFilter:e}=(0,nP.useDashboardStore)(),[t,s]=(0,u.useState)("24h"),[i,r]=(0,u.useState)(null),[n,a]=(0,u.useState)("operation_count"),[o,l]=(0,u.useState)(!1),[d,h]=(0,u.useState)(null),[m,p]=(0,u.useState)(null),[x,f]=(0,u.useState)(!1),[g]=(0,u.useState)(()=>Date.now()),{data:y,isLoading:v}=function(e="24h",t){return(0,nD.useQuery)({queryKey:["agents",e,t],queryFn:()=>ln(e,t),refetchInterval:3e4,retry:2})}(t,e??void 0),b=y?.agents??[],j=(0,u.useMemo)(()=>{let e=b;return d&&(e=e.filter(e=>e.source_type===d)),m&&(e=e.filter(e=>ld(e.avg_trust_score)===m)),x&&(e=e.filter(e=>e.flagged_count>0)),e},[b,d,m,x]),w=(0,u.useMemo)(()=>{let e=[...j];return e.sort((e,t)=>{let s=e[n],i=t[n];return"string"==typeof s&&"string"==typeof i?o?s.localeCompare(i):i.localeCompare(s):o?s-i:i-s}),e},[j,n,o]),N=(0,u.useMemo)(()=>[...new Set(b.map(e=>e.source_type))],[b]),k=e=>{n===e?l(!o):(a(e),l(!1))};return(0,c.jsxs)("div",{className:"flex h-full",children:[(0,c.jsxs)("div",{className:`${i?"w-1/2":"w-full"} border-r border-slate-800 flex flex-col`,children:[(0,c.jsxs)("div",{className:"p-3 border-b border-slate-800 flex items-center justify-between",children:[(0,c.jsxs)("div",{className:"flex items-center gap-2",children:[(0,c.jsx)(oa,{size:16,className:"text-cyan-400"}),(0,c.jsx)("h2",{className:"text-sm font-medium text-white",children:"Agent Registry"}),(0,c.jsxs)("span",{className:"text-xs text-slate-500",children:[w.length," agents"]})]}),(0,c.jsx)("div",{className:"flex gap-1",children:["24h","7d","30d"].map(e=>(0,c.jsx)("button",{onClick:()=>s(e),className:`px-2 py-0.5 text-[10px] rounded transition-colors ${t===e?"bg-cyan-600 text-white":"text-slate-400 hover:text-white"}`,children:e},e))})]}),(0,c.jsxs)("div",{className:"px-3 py-2 border-b border-slate-800 flex items-center gap-2 flex-wrap",children:[(0,c.jsx)(lt,{size:12,className:"text-slate-500"}),N.map(e=>(0,c.jsx)("button",{onClick:()=>h(d===e?null:e),className:`px-1.5 py-0.5 text-[10px] rounded transition-colors ${d===e?"bg-cyan-600/20 text-cyan-400":"text-slate-500 hover:text-slate-300"}`,children:e},e)),(0,c.jsx)("span",{className:"text-slate-700",children:"|"}),["full","limited","restricted"].map(e=>(0,c.jsx)("button",{onClick:()=>p(m===e?null:e),className:`px-1.5 py-0.5 text-[10px] rounded transition-colors ${m===e?"bg-cyan-600/20 text-cyan-400":"text-slate-500 hover:text-slate-300"}`,children:e},e)),(0,c.jsx)("span",{className:"text-slate-700",children:"|"}),(0,c.jsxs)("button",{onClick:()=>f(!x),className:`px-1.5 py-0.5 text-[10px] rounded transition-colors flex items-center gap-0.5 ${x?"bg-red-600/20 text-red-400":"text-slate-500 hover:text-slate-300"}`,children:[(0,c.jsx)(os,{size:10})," flagged"]})]}),(0,c.jsxs)("div",{className:"px-3 py-1.5 border-b border-slate-800 grid grid-cols-[1fr_80px_60px_60px_70px] gap-2 text-[10px] text-slate-500",children:[(0,c.jsx)("span",{children:"Agent"}),(0,c.jsxs)("button",{onClick:()=>k("avg_trust_score"),className:"flex items-center gap-0.5 hover:text-slate-300",children:["Trust ",(0,c.jsx)(ls,{size:8})]}),(0,c.jsxs)("button",{onClick:()=>k("operation_count"),className:"flex items-center gap-0.5 hover:text-slate-300",children:["Ops ",(0,c.jsx)(ls,{size:8})]}),(0,c.jsxs)("button",{onClick:()=>k("flagged_count"),className:"flex items-center gap-0.5 hover:text-slate-300",children:["Flagged ",(0,c.jsx)(ls,{size:8})]}),(0,c.jsxs)("button",{onClick:()=>k("last_seen"),className:"flex items-center gap-0.5 hover:text-slate-300",children:["Last seen ",(0,c.jsx)(ls,{size:8})]})]}),(0,c.jsxs)("div",{className:"flex-1 overflow-y-auto",children:[v&&(0,c.jsx)("div",{className:"p-4 text-center text-slate-500 text-xs",children:"Loading agents..."}),!v&&0===w.length&&(0,c.jsx)("div",{className:"p-4 text-center text-slate-500 text-xs",children:"No agents found in this time range."}),w.map(e=>{let t,s=i?.source_identifier===e.source_identifier&&i?.source_type===e.source_type;return(0,c.jsxs)("button",{onClick:()=>r(s?null:e),className:`w-full px-3 py-2 grid grid-cols-[1fr_80px_60px_60px_70px] gap-2 items-center text-left transition-colors border-b border-slate-800/50 ${s?"bg-cyan-600/10":"hover:bg-slate-800/50"}`,children:[(0,c.jsxs)("div",{className:"min-w-0",children:[(0,c.jsx)(lj,{identifier:e.source_identifier,compact:!0}),(0,c.jsx)("div",{className:"mt-0.5",children:(0,c.jsx)(lN,{type:e.source_type})})]}),(0,c.jsx)(lw,{score:e.avg_trust_score}),(0,c.jsx)("span",{className:"text-xs text-slate-300 tabular-nums",children:e.operation_count}),(0,c.jsx)("span",{className:`text-xs tabular-nums ${e.flagged_count>0?"text-red-400":"text-slate-500"}`,children:e.flagged_count}),(0,c.jsx)("span",{className:"text-[10px] text-slate-500",children:(t=g-new Date(e.last_seen).getTime())<6e4?"just now":t<36e5?`${Math.floor(t/6e4)}m ago`:t<864e5?`${Math.floor(t/36e5)}h ago`:`${Math.floor(t/864e5)}d ago`})]},`${e.source_type}:${e.source_identifier}`)})]})]}),(0,c.jsx)(P,{children:i&&(0,c.jsxs)(nT.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:20},className:"w-1/2 flex flex-col overflow-y-auto",children:[(0,c.jsxs)("div",{className:"p-3 border-b border-slate-800",children:[(0,c.jsxs)("div",{className:"flex items-center justify-between",children:[(0,c.jsx)(lj,{identifier:i.source_identifier}),(0,c.jsx)("button",{onClick:()=>r(null),className:"text-slate-500 hover:text-white text-xs",children:"Close"})]}),(0,c.jsxs)("div",{className:"flex items-center gap-2 mt-1.5",children:[(0,c.jsx)(lN,{type:i.source_type}),(0,c.jsx)(lw,{score:i.avg_trust_score}),(0,c.jsxs)("span",{className:"text-[10px] text-slate-500",children:[i.operation_count," ops · ",i.flagged_count," flagged"]})]})]}),(0,c.jsxs)("div",{className:"p-3 border-b border-slate-800",children:[(0,c.jsx)("h3",{className:"text-xs font-medium text-slate-400 mb-2",children:"Trust Score Timeline"}),(0,c.jsx)(lx,{identifier:i.source_identifier,timeRange:t})]}),(0,c.jsxs)("div",{className:"p-3 border-b border-slate-800",children:[(0,c.jsxs)("h3",{className:"text-xs font-medium text-slate-400 mb-2",children:["Flagged Operations",i.flagged_count>0&&(0,c.jsxs)("span",{className:"ml-1 text-red-400",children:["(",i.flagged_count,")"]})]}),(0,c.jsx)(lg,{identifier:i.source_identifier})]}),(0,c.jsxs)("div",{className:"p-3",children:[(0,c.jsx)("h3",{className:"text-xs font-medium text-slate-400 mb-2",children:"Live Alerts"}),(0,c.jsx)(lb,{agentFilter:i.source_identifier})]})]})})]})}let lS=a9("shield-check",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),lC=a9("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]),lT={critical:"text-red-400 bg-red-400/10",high:"text-red-400 bg-red-400/10",medium:"text-yellow-400 bg-yellow-400/10",low:"text-slate-400 bg-slate-400/10",safe:"text-green-400 bg-green-400/10"};function lA({level:e}){let t=lT[e]??lT.low;return(0,c.jsx)("span",{className:`text-[10px] font-medium px-1.5 py-0.5 rounded ${t}`,children:e.toUpperCase()})}function lM({findings:e}){return 0===e.length?null:(0,c.jsx)("div",{className:"mt-2 space-y-1.5 pl-6",children:e.map((e,t)=>(0,c.jsxs)("div",{className:"flex items-start gap-2",children:[(0,c.jsx)(lA,{level:e.severity}),(0,c.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,c.jsx)("span",{className:"text-xs text-slate-300",children:e.description}),e.matchedText&&(0,c.jsxs)("div",{className:"mt-0.5 text-[10px] text-slate-500 font-mono truncate",children:['Match: "',e.matchedText,'"']})]})]},`${e.pattern}-${t}`))})}function lP(e){let t=e.split(/[/\\]/);return t[t.length-1]||e}function lE({file:e,cloudConnected:t,onTrust:s,onUntrust:i,onRemove:r,onCloudUpsell:n}){let[a,o]=(0,u.useState)(!e.safe),[l,d]=(0,u.useState)(!1);return(0,c.jsxs)("div",{className:"bg-slate-800/50 border border-slate-700 rounded-lg overflow-hidden",children:[(0,c.jsxs)("div",{className:"flex items-center",children:[(0,c.jsxs)("button",{onClick:()=>o(!a),className:"flex-1 px-3 py-2.5 flex items-center gap-3 hover:bg-slate-800/80 transition-colors min-w-0",children:[e.trusted?(0,c.jsx)(lS,{size:16,className:"text-cyan-400 shrink-0"}):e.safe?(0,c.jsx)(ok,{size:16,className:"text-green-400 shrink-0"}):(0,c.jsx)(oA,{size:16,className:"text-red-400 shrink-0"}),(0,c.jsxs)("div",{className:"flex-1 min-w-0 text-left",children:[(0,c.jsx)("span",{className:"text-xs font-medium text-white truncate block",children:e.skillName||lP(e.path)}),(0,c.jsx)("span",{className:"text-[10px] text-slate-500 truncate block",children:e.path.replace(/^\/Users\/[^/]+/,"~")})]}),(0,c.jsx)("span",{className:"text-[10px] text-slate-500 shrink-0",children:e.format}),e.trusted?(0,c.jsx)("span",{className:"text-[10px] px-1.5 py-0.5 rounded font-medium bg-cyan-400/10 text-cyan-400",children:"TRUSTED"}):(0,c.jsx)(lA,{level:e.riskLevel}),(0,c.jsxs)("span",{className:"text-[10px] text-slate-600 shrink-0",children:[e.scanDurationMs,"ms"]}),e.findings.length>0?a?(0,c.jsx)(op,{size:14,className:"text-slate-500 shrink-0"}):(0,c.jsx)(li,{size:14,className:"text-slate-500 shrink-0"}):(0,c.jsx)("div",{className:"w-[14px] shrink-0"})]}),(0,c.jsxs)("div",{className:"flex items-center gap-0.5 pr-2 shrink-0",children:[e.trusted?(0,c.jsx)("button",{onClick:()=>i(e.path),title:"Remove trust",className:"p-1.5 rounded hover:bg-slate-700 transition-colors text-cyan-400 hover:text-cyan-300",children:(0,c.jsx)(lS,{size:14})}):(0,c.jsx)("button",{onClick:()=>s(e.path),title:"Mark as trusted",className:"p-1.5 rounded hover:bg-slate-700 transition-colors text-slate-500 hover:text-cyan-400",children:(0,c.jsx)(oe,{size:14})}),!e.safe&&!e.trusted&&(0,c.jsx)("button",{onClick:()=>t?d(!0):n(),title:t?"Remove skill file":"Connect to Cloud to remove",className:`p-1.5 rounded transition-colors ${t?"hover:bg-red-500/10 text-slate-500 hover:text-red-400":"text-slate-600 hover:text-slate-400 cursor-not-allowed"}`,children:(0,c.jsx)(lC,{size:14})})]})]}),l&&(0,c.jsxs)("div",{className:"border-t border-slate-700/50 px-3 py-2.5 bg-red-950/30 flex items-center gap-3",children:[(0,c.jsxs)("span",{className:"text-xs text-red-300 flex-1",children:["Remove ",(0,c.jsx)("span",{className:"font-medium",children:e.skillName||lP(e.path)}),"? This will delete the file from disk."]}),(0,c.jsx)("button",{onClick:()=>{r(e.path),d(!1)},className:"px-3 py-1 text-xs font-medium bg-red-600 hover:bg-red-500 text-white rounded transition-colors",children:"Delete"}),(0,c.jsx)("button",{onClick:()=>d(!1),className:"px-3 py-1 text-xs text-slate-400 hover:text-white transition-colors",children:"Cancel"})]}),a&&e.findings.length>0&&(0,c.jsx)("div",{className:"border-t border-slate-700/50 px-3 py-2 bg-slate-900/50",children:(0,c.jsx)(lM,{findings:e.findings})})]})}function lD({files:e,cloudConnected:t,onTrust:s,onUntrust:i,onRemove:r,onCloudUpsell:n}){return 0===e.length?null:(0,c.jsx)("div",{className:"space-y-1.5",children:e.map(e=>(0,c.jsx)(lE,{file:e,cloudConnected:t,onTrust:s,onUntrust:i,onRemove:r,onCloudUpsell:n},e.path))})}let lL=[{value:"",label:"Auto-detect"},{value:"skill-md",label:"SKILL.md (Claude Code)"},{value:"hook-md",label:"HOOK.md (OpenClaw)"},{value:"hook-js",label:"handler.js (OpenClaw)"},{value:"rules",label:".cursorrules / .windsurfrules / .clinerules"},{value:"claude-md",label:"CLAUDE.md"},{value:"copilot-md",label:"copilot-instructions.md"},{value:"aider-yml",label:".aider.conf.yml"},{value:"continue-json",label:".continue/config.json"}];function lR(){let e=oR(),t=(0,oM.useMutation)({mutationFn:oL}),s=(0,oM.useMutation)({mutationFn:oV}),i=(0,oM.useMutation)({mutationFn:oF}),r=(0,oM.useMutation)({mutationFn:o$}),{data:n}=oX(),[a,o]=(0,u.useState)(null),[l,d]=(0,u.useState)(null),[h,m]=(0,u.useState)(!1),[p,x]=(0,u.useState)(""),[f,g]=(0,u.useState)(""),[y,v]=(0,u.useState)(!1),b=!!(n?.enabled&&n?.apiKeySet);return(0,c.jsxs)("div",{className:"h-full overflow-y-auto p-6",children:[(0,c.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,c.jsxs)("div",{children:[(0,c.jsx)("h2",{className:"text-lg font-semibold text-white",children:"Skills Scanner"}),(0,c.jsx)("p",{className:"text-xs text-slate-400 mt-0.5",children:"Scan agent instruction files for hidden threats"})]}),(0,c.jsxs)("button",{onClick:()=>{e.mutate(void 0,{onSuccess:e=>o(e)})},disabled:e.isPending,className:"flex items-center gap-1.5 px-4 py-2 bg-cyan-600 hover:bg-cyan-500 disabled:opacity-50 rounded-lg text-sm font-medium text-white transition-colors",children:[e.isPending?(0,c.jsx)(oN,{size:14,className:"animate-spin"}):(0,c.jsx)(oo,{size:14}),"Scan All"]})]}),y&&(0,c.jsxs)("div",{className:"mb-4 bg-slate-900 border border-cyan-800/50 rounded-xl p-4 flex items-center gap-3",children:[(0,c.jsx)(oj,{size:20,className:"text-cyan-400 shrink-0"}),(0,c.jsxs)("div",{className:"flex-1",children:[(0,c.jsx)("p",{className:"text-sm font-medium text-white",children:"Connect to ShieldCortex Cloud"}),(0,c.jsx)("p",{className:"text-xs text-slate-400 mt-0.5",children:"Enable one-click skill removal and cloud-powered threat intelligence."})]}),(0,c.jsx)("button",{onClick:()=>v(!1),className:"text-xs text-slate-500 hover:text-slate-300 transition-colors",children:"Dismiss"})]}),a?(0,c.jsxs)("div",{className:"space-y-4",children:[(0,c.jsxs)("div",{className:"flex items-center gap-3 text-xs text-slate-400",children:[(0,c.jsxs)("span",{children:[(0,c.jsx)("span",{className:"text-white font-medium",children:a.totalScanned})," files scanned"]}),(0,c.jsx)("span",{className:"text-slate-600",children:"·"}),a.threatCount>0?(0,c.jsxs)("span",{children:[(0,c.jsx)("span",{className:"text-red-400 font-medium",children:a.threatCount})," with threats"]}):(0,c.jsx)("span",{className:"text-green-400",children:"All clean"}),(0,c.jsx)("span",{className:"text-slate-600",children:"·"}),(0,c.jsx)("span",{children:new Date(a.scannedAt).toLocaleTimeString()})]}),(0,c.jsx)(lD,{files:a.files,cloudConnected:b,onTrust:e=>{s.mutate(e,{onSuccess:()=>{a&&o({...a,files:a.files.map(t=>t.path===e?{...t,trusted:!0}:t),threatCount:a.files.filter(t=>!t.safe&&!t.trusted&&t.path!==e).length})}})},onUntrust:e=>{i.mutate(e,{onSuccess:()=>{a&&o({...a,files:a.files.map(t=>t.path===e?{...t,trusted:!1}:t),threatCount:a.files.filter(t=>{let s=t.path!==e&&t.trusted;return!t.safe&&!s}).length})}})},onRemove:e=>{r.mutate(e,{onSuccess:()=>{if(a){let t=a.files.filter(t=>t.path!==e);o({...a,files:t,totalScanned:t.length,threatCount:t.filter(e=>!e.safe&&!e.trusted).length})}}})},onCloudUpsell:()=>v(!0)})]}):e.isPending?(0,c.jsx)("div",{className:"flex items-center justify-center py-16",children:(0,c.jsx)(oN,{size:24,className:"text-cyan-400 animate-spin"})}):(0,c.jsxs)("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[(0,c.jsx)(oo,{size:32,className:"text-slate-600 mb-3"}),(0,c.jsx)("p",{className:"text-sm text-slate-400",children:"No skills scanned yet"}),(0,c.jsx)("p",{className:"text-xs text-slate-500 mt-1",children:'Click "Scan All" to discover and scan agent instruction files'})]}),(0,c.jsxs)("div",{className:"mt-6",children:[(0,c.jsxs)("button",{onClick:()=>m(!h),className:"flex items-center gap-1.5 text-xs text-slate-400 hover:text-slate-300 transition-colors",children:[h?(0,c.jsx)(op,{size:14}):(0,c.jsx)(li,{size:14}),"Paste & Scan"]}),h&&(0,c.jsxs)("div",{className:"mt-3 bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,c.jsx)("textarea",{value:p,onChange:e=>x(e.target.value),placeholder:"Paste skill/instruction file content here...",className:"w-full h-32 bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-sm text-white placeholder:text-slate-500 focus:ring-cyan-500 focus:border-cyan-500 resize-y font-mono"}),(0,c.jsxs)("div",{className:"flex items-center gap-3 mt-3",children:[(0,c.jsx)("select",{value:f,onChange:e=>g(e.target.value),className:"bg-slate-800 border border-slate-700 text-white text-xs rounded-lg px-3 py-2 focus:ring-cyan-500 focus:border-cyan-500",children:lL.map(e=>(0,c.jsx)("option",{value:e.value,children:e.label},e.value))}),(0,c.jsxs)("button",{onClick:()=>{p.trim()&&t.mutate({content:p,format:f||void 0},{onSuccess:e=>d(e)})},disabled:t.isPending||!p.trim(),className:"flex items-center gap-1.5 px-4 py-2 bg-cyan-600 hover:bg-cyan-500 disabled:opacity-50 rounded-lg text-xs font-medium text-white transition-colors",children:[t.isPending?(0,c.jsx)(oN,{size:12,className:"animate-spin"}):(0,c.jsx)(oo,{size:12}),"Scan Content"]})]}),l&&(0,c.jsxs)("div",{className:"mt-4 bg-slate-800/50 border border-slate-700 rounded-lg p-3",children:[(0,c.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,c.jsx)("span",{className:"text-xs font-medium text-white",children:l.skillName}),(0,c.jsx)(lA,{level:l.riskLevel}),(0,c.jsxs)("span",{className:"text-[10px] text-slate-500",children:[l.scanDurationMs,"ms"]})]}),(0,c.jsx)("p",{className:"text-xs text-slate-400",children:l.summary}),l.findings.length>0&&(0,c.jsx)(lM,{findings:l.findings})]})]})]})]})}let lV=a9("lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]),lF=a9("radio",[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]),l$=a9("shield-off",[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71",key:"1jlk70"}],["path",{d:"M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264",key:"18rp1v"}]]),lz=a9("scan",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}]]),l_=[{id:"personal",label:"Personal",description:"Lighter touch for solo use",icon:oe},{id:"enterprise",label:"Enterprise",description:"Financial & data protection",icon:lV},{id:"school",label:"School",description:"GDPR strict, pupil data guarded",icon:oa},{id:"paranoid",label:"Paranoid",description:"Everything requires approval",icon:os}],lI=[{name:"Injection Scanner",description:"40+ patterns across 8 categories",icon:lz},{name:"Instruction Gateway",description:"Trusted channel validation",icon:lF},{name:"Action Gate",description:"Approve / block external actions",icon:lV},{name:"PII Guard",description:"Block sensitive data output",icon:oh},{name:"Kill Switch",description:"Emergency stop phrase",icon:l$},{name:"Sub-Agent Control",description:"Restrict spawned agent operations",icon:oa}],lO={critical:"bg-red-500/20 text-red-400 border-red-500/30",high:"bg-orange-500/20 text-orange-400 border-orange-500/30",medium:"bg-yellow-500/20 text-yellow-400 border-yellow-500/30",low:"bg-slate-500/20 text-slate-400 border-slate-500/30"},lB={CRITICAL:"bg-red-500/20 text-red-400",HIGH:"bg-orange-500/20 text-orange-400",MEDIUM:"bg-yellow-500/20 text-yellow-400",LOW:"bg-slate-500/20 text-slate-400",NONE:"bg-green-500/20 text-green-400"};function lU(){let e,t,{data:s,isLoading:i}=oq(),{data:r}=oK(50),n=(e=(0,aZ.useQueryClient)(),(0,oM.useMutation)({mutationFn:e=>oO(e),onSuccess:()=>{e.invalidateQueries({queryKey:["iron-dome-status"]}),e.invalidateQueries({queryKey:["iron-dome-audit"]})}})),a=(t=(0,aZ.useQueryClient)(),(0,oM.useMutation)({mutationFn:oB,onSuccess:()=>{t.invalidateQueries({queryKey:["iron-dome-status"]})}})),o=(0,oM.useMutation)({mutationFn:oU}),[l,d]=(0,u.useState)(""),[h,m]=(0,u.useState)(null),p=s?.enabled??!1,x=s?.profile,f=s?.config,g=r?.logs??[],y=g.filter(e=>"BLOCK"===e.firewall_result).length,v=g.filter(e=>"ALLOW"===e.firewall_result).length;return(0,c.jsxs)("div",{className:"h-full overflow-y-auto p-6",children:[(0,c.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,c.jsxs)("div",{className:"flex items-center gap-3",children:[(0,c.jsx)(ol,{size:20,className:"text-red-400"}),(0,c.jsx)("h2",{className:"text-lg font-semibold text-white",children:"Iron Dome"}),i?(0,c.jsx)("span",{className:"text-[10px] text-slate-500 animate-pulse",children:"Loading..."}):(0,c.jsx)("span",{className:`text-[10px] font-medium px-2 py-0.5 rounded-full ${p?"bg-red-500/20 text-red-400 border border-red-500/30":"bg-slate-700/50 text-slate-500"}`,children:p?"ACTIVE":"INACTIVE"})]}),p&&(0,c.jsxs)("button",{onClick:()=>{a.mutate()},disabled:a.isPending,className:"flex items-center gap-1.5 px-3 py-1.5 bg-red-500/10 border border-red-500/30 hover:bg-red-500/20 disabled:opacity-50 rounded-lg text-xs font-medium text-red-400 transition-colors",children:[a.isPending?(0,c.jsx)(oN,{size:12,className:"animate-spin"}):(0,c.jsx)(l$,{size:12}),"Deactivate"]})]}),(0,c.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4 mb-6",children:[(0,c.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,c.jsx)("h3",{className:"text-sm font-medium text-slate-300 mb-3",children:"Security Profiles"}),(0,c.jsx)("div",{className:"grid grid-cols-2 gap-2",children:l_.map(({id:e,label:t,description:s,icon:i})=>(0,c.jsxs)("button",{onClick:()=>{n.mutate(e)},disabled:n.isPending,className:`text-left p-3 rounded-lg border transition-colors ${x===e?"border-red-500/50 bg-red-500/10 text-red-400":"border-slate-700 bg-slate-800/50 text-slate-400 hover:border-slate-600"}`,children:[(0,c.jsxs)("div",{className:"flex items-center gap-1.5 mb-1",children:[(0,c.jsx)(i,{size:12}),(0,c.jsx)("span",{className:"text-xs font-medium",children:t})]}),(0,c.jsx)("div",{className:"text-[10px] text-slate-500",children:s})]},e))})]}),(0,c.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,c.jsx)("h3",{className:"text-sm font-medium text-slate-300 mb-3",children:"Module Status"}),(0,c.jsx)("div",{className:"space-y-2",children:lI.map(({name:e,description:t,icon:s})=>(0,c.jsxs)("div",{className:"flex items-center gap-3 px-3 py-2 rounded-lg bg-slate-800/50",children:[(0,c.jsx)(s,{size:14,className:p?"text-red-400":"text-slate-600"}),(0,c.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,c.jsx)("div",{className:"text-xs font-medium text-slate-300",children:e}),(0,c.jsx)("div",{className:"text-[10px] text-slate-500 truncate",children:t})]}),(0,c.jsx)("span",{className:`w-2 h-2 rounded-full ${p?"bg-red-400":"bg-slate-600"}`})]},e))})]})]}),p&&f&&(0,c.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4 mb-6",children:[(0,c.jsx)("h3",{className:"text-sm font-medium text-slate-300 mb-3",children:"Active Configuration"}),(0,c.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 text-xs",children:[(0,c.jsxs)("div",{children:[(0,c.jsx)("div",{className:"text-[10px] text-slate-500 uppercase mb-1",children:"Trusted Channels"}),(0,c.jsx)("div",{className:"flex flex-wrap gap-1",children:f.trustedChannels.map(e=>(0,c.jsx)("span",{className:"px-1.5 py-0.5 bg-slate-800 rounded text-slate-400",children:e},e))})]}),(0,c.jsxs)("div",{children:[(0,c.jsx)("div",{className:"text-[10px] text-slate-500 uppercase mb-1",children:"Requires Approval"}),(0,c.jsx)("div",{className:"flex flex-wrap gap-1",children:f.requireApproval.map(e=>(0,c.jsx)("span",{className:"px-1.5 py-0.5 bg-red-500/10 border border-red-500/20 rounded text-red-400",children:e},e))})]}),(0,c.jsxs)("div",{children:[(0,c.jsx)("div",{className:"text-[10px] text-slate-500 uppercase mb-1",children:"Kill Phrase"}),(0,c.jsx)("span",{className:"px-1.5 py-0.5 bg-slate-800 rounded text-slate-400 font-mono",children:f.killPhrase})]})]})]}),(0,c.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[(0,c.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,c.jsxs)("h3",{className:"text-sm font-medium text-slate-300 mb-3",children:[(0,c.jsx)(lz,{size:14,className:"inline mr-1.5 text-red-400"}),"Injection Scanner"]}),(0,c.jsx)("textarea",{value:l,onChange:e=>d(e.target.value),placeholder:"Paste suspicious text to scan for injection patterns...",className:"w-full h-28 bg-slate-800 border border-slate-700 rounded-lg p-3 text-sm text-white placeholder:text-slate-500 resize-none focus:outline-none focus:ring-1 focus:ring-red-500 focus:border-red-500"}),(0,c.jsxs)("button",{onClick:()=>{l.trim()&&o.mutate(l,{onSuccess:e=>m(e)})},disabled:o.isPending||!l.trim(),className:"mt-2 flex items-center gap-1.5 px-3 py-1.5 bg-red-600 hover:bg-red-500 disabled:opacity-50 rounded-lg text-xs font-medium text-white transition-colors",children:[o.isPending?(0,c.jsx)(oN,{size:12,className:"animate-spin"}):(0,c.jsx)(ol,{size:12}),"Scan"]}),h&&(0,c.jsxs)("div",{className:"mt-3 space-y-2",children:[(0,c.jsxs)("div",{className:"flex items-center gap-2",children:[h.clean?(0,c.jsx)(ok,{size:14,className:"text-green-400"}):(0,c.jsx)(oA,{size:14,className:"text-red-400"}),(0,c.jsx)("span",{className:`text-[10px] font-medium px-2 py-0.5 rounded-full ${lB[h.riskLevel]??"bg-slate-500/20 text-slate-400"}`,children:h.riskLevel}),(0,c.jsx)("span",{className:"text-xs text-slate-400",children:h.summary})]}),h.detections.map((e,t)=>(0,c.jsxs)("div",{className:`border rounded-lg p-3 ${lO[e.severity]??"border-slate-700"}`,children:[(0,c.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,c.jsx)("span",{className:"text-[10px] font-medium uppercase",children:e.severity}),(0,c.jsx)("span",{className:"text-xs text-slate-300",children:e.category.replace(/_/g," ")})]}),(0,c.jsx)("p",{className:"text-[11px] text-slate-400 mb-1",children:e.description}),(0,c.jsx)("code",{className:"text-[10px] text-slate-500 bg-slate-800 px-1.5 py-0.5 rounded block truncate",children:e.match})]},t))]})]}),(0,c.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,c.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,c.jsx)("h3",{className:"text-sm font-medium text-slate-300",children:"Event Feed"}),(0,c.jsxs)("span",{className:"text-[10px] text-slate-500",children:["Last ",g.length," events"]})]}),(0,c.jsxs)("div",{className:"grid grid-cols-3 gap-2 mb-3",children:[(0,c.jsxs)("div",{className:"bg-slate-800/50 rounded-lg p-2 text-center",children:[(0,c.jsx)("div",{className:"text-sm font-bold text-slate-300",children:g.length}),(0,c.jsx)("div",{className:"text-[10px] text-slate-500",children:"Total"})]}),(0,c.jsxs)("div",{className:"bg-slate-800/50 rounded-lg p-2 text-center",children:[(0,c.jsx)("div",{className:"text-sm font-bold text-red-400",children:y}),(0,c.jsx)("div",{className:"text-[10px] text-slate-500",children:"Blocked"})]}),(0,c.jsxs)("div",{className:"bg-slate-800/50 rounded-lg p-2 text-center",children:[(0,c.jsx)("div",{className:"text-sm font-bold text-green-400",children:v}),(0,c.jsx)("div",{className:"text-[10px] text-slate-500",children:"Allowed"})]})]}),(0,c.jsx)("div",{className:"space-y-1 max-h-72 overflow-y-auto",children:0===g.length?(0,c.jsxs)("div",{className:"text-center py-6",children:[(0,c.jsx)(oe,{size:20,className:"text-slate-600 mx-auto mb-1.5"}),(0,c.jsx)("p",{className:"text-[10px] text-slate-500",children:"No Iron Dome events yet"})]}):g.map((e,t)=>(0,c.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded-md bg-slate-800/50 text-xs",children:[(0,c.jsx)("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${"BLOCK"===e.firewall_result?"bg-red-400":"bg-green-400"}`}),(0,c.jsx)("span",{className:"text-slate-400 truncate flex-1",children:(e.reason??"").replace(/^\[iron-dome:\w+\]\s*/,"")}),(0,c.jsx)("span",{className:"text-[10px] text-slate-600 shrink-0",children:new Date(e.timestamp).toLocaleTimeString()})]},e.id??t))})]})]})]})}let lW=(0,nA.default)(()=>e.A(1369),{loadableGenerated:{modules:[11570]},ssr:!1,loading:()=>(0,c.jsx)("div",{className:"w-full h-full flex items-center justify-center bg-slate-950",children:(0,c.jsx)("div",{className:"text-slate-400 animate-pulse",children:"Loading Graph..."})})}),lq=(0,nA.default)(()=>e.A(62838).then(e=>e.BrainControlCentre),{loadableGenerated:{modules:[41740]},ssr:!1,loading:()=>(0,c.jsx)("div",{className:"w-full h-full flex items-center justify-center bg-slate-950",children:(0,c.jsx)("div",{className:"text-slate-400 animate-pulse",children:"Loading Brain Control Centre..."})})});function lK(){let e,[t,s]=(0,u.useState)(""),[i,r]=(0,u.useState)(!1),[n,a]=(0,u.useState)(!1),[o,l]=(0,u.useState)(void 0),[d,h]=(0,u.useState)(void 0),m=(0,u.useRef)(null),p=(0,u.useRef)(null),x=nE(t,300),{viewMode:f,selectedMemory:g,setSelectedMemory:y,selectedAuditEntry:v,setSelectedAuditEntry:b,projectFilter:j,setProjectFilter:w,addEvent:N}=(0,nP.useDashboardStore)(),{data:k=[]}=(e=nE(t,200),(0,nD.useQuery)({queryKey:["suggestions",e],queryFn:()=>nR(e),enabled:e.length>=2,staleTime:3e4,refetchOnWindowFocus:!1})),{data:S}=(0,nM.useProjects)();(0,u.useEffect)(()=>{let e=e=>{p.current&&!p.current.contains(e.target)&&m.current&&!m.current.contains(e.target)&&r(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);let{data:C=[],isLoading:T,isConnected:A,lastEvent:M}=(0,nM.useMemoriesWithRealtime)({limit:1e3,query:x||void 0,mode:x?"search":"recent",project:j||void 0,type:o,category:d}),{data:E,isLoading:D}=(0,nM.useStats)(j||void 0),{data:L=[]}=(0,nM.useMemoryLinks)(j||void 0),R=(0,u.useRef)(M);(0,u.useEffect)(()=>{!M||M===R.current||(R.current=M,new Set(["memory_created","memory_accessed","memory_updated","memory_deleted","consolidation_complete","decay_tick"]).has(M.type)&&N({type:M.type,timestamp:M.timestamp,data:M.data}))},[M,N]);let V=(0,nM.useAccessMemory)();(0,nM.useConsolidate)();let{data:F}=(0,nM.useControlStatus)();(0,nM.usePauseMemory)(),(0,nM.useResumeMemory)();let $=F?.paused??!1,{data:z}=oX(),_=z?.enabled&&z?.apiKeySet,I=e=>{y(e)},O=e=>{let t=C.find(t=>t.id===e);t&&y(t)},B="shield"===f||"audit"===f||"quarantine"===f||"agents"===f||"skills"===f||"dome"===f;return(0,c.jsxs)("div",{className:"h-screen w-screen bg-slate-950 text-white overflow-hidden flex flex-col",children:[(0,c.jsxs)("header",{className:"h-14 border-b border-slate-800 flex items-center justify-between px-4 bg-slate-900/50 backdrop-blur-sm shrink-0",children:[(0,c.jsxs)("div",{className:"flex items-center gap-4",children:[(0,c.jsxs)("div",{className:"flex items-center gap-2",children:[(0,c.jsx)(oe,{size:20,className:"text-cyan-400"}),(0,c.jsx)("h1",{className:"text-xl font-bold bg-gradient-to-r from-cyan-400 via-blue-400 to-emerald-400 bg-clip-text text-transparent",children:"ShieldCortex"}),(0,c.jsx)("div",{title:_?"Connected to ShieldCortex Cloud":"Cloud sync not configured",children:(0,c.jsx)(oj,{size:16,className:_?"text-emerald-400":"text-slate-600"})})]}),(0,c.jsx)("select",{value:j||"",onChange:e=>w(e.target.value||null),className:"bg-slate-800 border border-slate-700 text-white text-sm rounded-lg px-3 py-1.5 focus:ring-cyan-500 focus:border-cyan-500",children:S?.projects.map(e=>(0,c.jsxs)("option",{value:e.project||"",children:[e.label," (",e.memory_count,")"]},e.project||"all"))}),(0,c.jsxs)("div",{className:"relative",children:[(0,c.jsx)(aH,{ref:m,type:"text",placeholder:"Search memories...",value:t,onChange:e=>{s(e.target.value),r(!0)},onFocus:()=>r(!0),onKeyDown:e=>{"Escape"===e.key&&r(!1)},className:"w-64 bg-slate-800 border-slate-700 text-white placeholder:text-slate-400 focus:ring-cyan-500"}),i&&k.length>0&&(0,c.jsx)("div",{ref:p,className:"absolute top-full left-0 right-0 mt-1 bg-slate-800 border border-slate-700 rounded-lg shadow-xl overflow-hidden z-50",children:k.map((e,t)=>(0,c.jsxs)("button",{onClick:()=>{s(e.text),r(!1),m.current?.focus()},className:"w-full px-3 py-2 text-left hover:bg-slate-700 transition-colors flex items-center gap-2",children:[(0,c.jsx)("span",{className:"text-white text-sm truncate flex-1",children:e.text}),(0,c.jsx)("span",{className:"text-xs px-1.5 py-0.5 rounded bg-slate-600 text-slate-300",children:e.type})]},`${e.type}-${e.text}-${t}`))})]}),(0,c.jsxs)(aK,{variant:"outline",size:"sm",onClick:()=>a(!n),className:`border-slate-600 text-slate-300 hover:text-white hover:bg-slate-700 ${n?"bg-slate-700":""}`,title:"Filter memories by type and category",children:["Filters ",(o||d)&&"•"]})]}),(0,c.jsx)("div",{className:"flex items-center gap-2",children:(0,c.jsxs)("div",{className:"flex items-center gap-2 text-xs text-slate-400 px-2",children:[(0,c.jsx)("span",{className:`w-2 h-2 rounded-full ${$?"bg-orange-500 animate-pulse":A?"bg-green-500":"bg-yellow-500"}`,title:$?"Memory creation paused":A?"Real-time connected":"Polling mode"}),E?.total??C.length," memories"]})})]}),n&&(0,c.jsxs)("div",{className:"h-12 border-b border-slate-800 flex items-center gap-4 px-4 bg-slate-900/30",children:[(0,c.jsxs)("div",{className:"flex items-center gap-2",children:[(0,c.jsx)("span",{className:"text-xs text-slate-400",children:"Type:"}),["short_term","long_term","episodic"].map(e=>(0,c.jsx)("button",{onClick:()=>l(o===e?void 0:e),className:`px-2 py-1 text-xs rounded-full transition-colors ${o===e?"bg-blue-600 text-white":"bg-slate-800 text-slate-300 hover:bg-slate-700"}`,children:e.replace("_","-")},e))]}),(0,c.jsx)("div",{className:"w-px h-6 bg-slate-700"}),(0,c.jsxs)("div",{className:"flex items-center gap-2",children:[(0,c.jsx)("span",{className:"text-xs text-slate-400",children:"Category:"}),["architecture","pattern","error","learning","preference","context"].map(e=>(0,c.jsx)("button",{onClick:()=>h(d===e?void 0:e),className:`px-2 py-1 text-xs rounded-full transition-colors ${d===e?"bg-purple-600 text-white":"bg-slate-800 text-slate-300 hover:bg-slate-700"}`,children:e},e))]}),(o||d)&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("div",{className:"w-px h-6 bg-slate-700"}),(0,c.jsx)("button",{onClick:()=>{l(void 0),h(void 0)},className:"px-2 py-1 text-xs text-red-400 hover:text-red-300",children:"Clear all"})]})]}),(0,c.jsxs)("div",{className:"flex-1 flex overflow-hidden",children:[(0,c.jsx)(oc,{}),(0,c.jsx)(P,{mode:"wait",children:(0,c.jsxs)(nT.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},className:"flex-1 relative overflow-hidden",children:["shield"===f&&(0,c.jsx)(oZ,{}),"audit"===f&&(0,c.jsx)(o1,{}),"quarantine"===f&&(0,c.jsx)(le,{}),"brain"===f&&(0,c.jsx)(lq,{memories:C,links:L,stats:E,isLoading:T}),"graph"===f&&(0,c.jsx)(lW,{memories:C,links:L,selectedMemory:g,onSelectMemory:I}),"agents"===f&&(0,c.jsx)(lk,{}),"skills"===f&&(0,c.jsx)(lR,{}),"dome"===f&&(0,c.jsx)(lU,{}),"memories"===f&&(0,c.jsx)(a2,{memories:C,selectedMemory:g,onSelectMemory:I})]},f)}),g&&!B&&"brain"!==f&&(0,c.jsx)("div",{className:"w-80 border-l border-slate-800 overflow-y-auto shrink-0",children:(0,c.jsx)(aJ,{memory:g,links:L,memories:C,onClose:()=>y(null),onReinforce:e=>{V.mutate(e)},onSelectMemory:O,isReinforcing:V.isPending,reinforceSuccess:V.isSuccess})}),v&&"audit"===f&&(0,c.jsx)("div",{className:"w-80 border-l border-slate-800 overflow-y-auto shrink-0",children:(0,c.jsx)(o8,{entry:v,onClose:()=>b(null),onViewMemory:e=>{b(null),O(e),nP.useDashboardStore.getState().setViewMode("memories")}})})]})]})}e.s(["default",()=>lK],23733)}]);
|