shieldcortex 2.17.1 → 2.19.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 +42 -24
- 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/page_client-reference-manifest.js +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 +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
- 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 +2 -2
- 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 +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/index.html +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/index.rsc +3 -3
- 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 +3 -3
- 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 +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- 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/1a71c9a52f0c9b16.css +3 -0
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/6bf7d89d34068ecb.js +9 -0
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/d0dcb5e0e04ae015.js +1 -0
- package/dashboard/.next/standalone/dashboard/package.json +1 -1
- package/dist/api/visualization-server.d.ts.map +1 -1
- package/dist/api/visualization-server.js +306 -0
- package/dist/api/visualization-server.js.map +1 -1
- package/dist/cloud/config.d.ts +13 -1
- package/dist/cloud/config.d.ts.map +1 -1
- package/dist/cloud/config.js +28 -3
- package/dist/cloud/config.js.map +1 -1
- package/dist/database/init.d.ts.map +1 -1
- package/dist/database/init.js +77 -0
- package/dist/database/init.js.map +1 -1
- package/dist/defence/__tests__/tool-response-scanner.test.d.ts +8 -0
- package/dist/defence/__tests__/tool-response-scanner.test.d.ts.map +1 -0
- package/dist/defence/__tests__/tool-response-scanner.test.js +106 -0
- package/dist/defence/__tests__/tool-response-scanner.test.js.map +1 -0
- package/dist/defence/audit/export.d.ts +6 -0
- package/dist/defence/audit/export.d.ts.map +1 -0
- package/dist/defence/audit/export.js +43 -0
- package/dist/defence/audit/export.js.map +1 -0
- package/dist/defence/custom-patterns/store.d.ts +52 -0
- package/dist/defence/custom-patterns/store.d.ts.map +1 -0
- package/dist/defence/custom-patterns/store.js +108 -0
- package/dist/defence/custom-patterns/store.js.map +1 -0
- package/dist/defence/custom-rules/store.d.ts +36 -0
- package/dist/defence/custom-rules/store.d.ts.map +1 -0
- package/dist/defence/custom-rules/store.js +57 -0
- package/dist/defence/custom-rules/store.js.map +1 -0
- package/dist/defence/iron-dome/custom-policies.d.ts +31 -0
- package/dist/defence/iron-dome/custom-policies.d.ts.map +1 -0
- package/dist/defence/iron-dome/custom-policies.js +79 -0
- package/dist/defence/iron-dome/custom-policies.js.map +1 -0
- package/dist/defence/iron-dome/index.d.ts +5 -5
- package/dist/defence/iron-dome/index.d.ts.map +1 -1
- package/dist/defence/iron-dome/index.js +55 -6
- package/dist/defence/iron-dome/index.js.map +1 -1
- package/dist/defence/pipeline.d.ts.map +1 -1
- package/dist/defence/pipeline.js +82 -6
- package/dist/defence/pipeline.js.map +1 -1
- package/dist/defence/skill-scanner/deep-scan.d.ts +30 -0
- package/dist/defence/skill-scanner/deep-scan.d.ts.map +1 -0
- package/dist/defence/skill-scanner/deep-scan.js +112 -0
- package/dist/defence/skill-scanner/deep-scan.js.map +1 -0
- package/dist/defence/tool-response-scanner.d.ts +23 -0
- package/dist/defence/tool-response-scanner.d.ts.map +1 -0
- package/dist/defence/tool-response-scanner.js +157 -0
- package/dist/defence/tool-response-scanner.js.map +1 -0
- package/dist/defence/trust/source-scorer.d.ts.map +1 -1
- package/dist/defence/trust/source-scorer.js +2 -1
- package/dist/defence/trust/source-scorer.js.map +1 -1
- package/dist/defence/types.d.ts +13 -2
- package/dist/defence/types.d.ts.map +1 -1
- package/dist/defence/types.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 +4 -0
- package/dist/lib.d.ts.map +1 -1
- package/dist/lib.js +4 -0
- package/dist/lib.js.map +1 -1
- package/dist/license/__tests__/feature-gating.test.d.ts +10 -0
- package/dist/license/__tests__/feature-gating.test.d.ts.map +1 -0
- package/dist/license/__tests__/feature-gating.test.js +188 -0
- package/dist/license/__tests__/feature-gating.test.js.map +1 -0
- 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 +13 -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/types.d.ts +16 -0
- package/dist/license/types.d.ts.map +1 -0
- package/dist/license/types.js +6 -0
- package/dist/license/types.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/server.d.ts.map +1 -1
- package/dist/server.js +99 -16
- package/dist/server.js.map +1 -1
- package/dist/tools/context.d.ts +5 -5
- package/dist/tools/context.d.ts.map +1 -1
- package/dist/tools/context.js +3 -1
- package/dist/tools/context.js.map +1 -1
- package/dist/tools/forget.d.ts +5 -5
- package/dist/tools/forget.js +1 -1
- package/dist/tools/forget.js.map +1 -1
- package/dist/tools/recall.d.ts +10 -10
- package/dist/tools/recall.js +1 -1
- package/dist/tools/recall.js.map +1 -1
- package/dist/tools/remember.d.ts +7 -7
- package/dist/tools/remember.js +1 -1
- package/dist/tools/remember.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/hooks/openclaw/cortex-memory/HOOK.md +7 -7
- package/hooks/openclaw/cortex-memory/handler.ts +1 -1
- package/package.json +2 -1
- package/plugins/openclaw/README.md +8 -8
- package/plugins/openclaw/index.ts +1 -1
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/42d01b77019fd208.js +0 -1
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/61a3c89b08347bc2.js +0 -9
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/c252c4de65df6d09.css +0 -3
- /package/dashboard/.next/standalone/dashboard/.next/static/{H-BGC5Yp6YmPEZGryV6bd → OfvwyqIJFP9N3Qdb23S-6}/_buildManifest.js +0 -0
- /package/dashboard/.next/standalone/dashboard/.next/static/{H-BGC5Yp6YmPEZGryV6bd → OfvwyqIJFP9N3Qdb23S-6}/_clientMiddlewareManifest.json +0 -0
- /package/dashboard/.next/standalone/dashboard/.next/static/{H-BGC5Yp6YmPEZGryV6bd → OfvwyqIJFP9N3Qdb23S-6}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,23733,e=>{"use strict";let t,s,i,a,r,n,l,o;var d,c=e.i(27493),u=e.i(4),h=e.i(22534);let m=(0,u.createContext)({});function x(e){let t=(0,u.useRef)(null);return null===t.current&&(t.current=e()),t.current}let p="u">typeof window,f=p?u.useLayoutEffect:u.useEffect,g=(0,u.createContext)(null);function y(e){return"object"==typeof e&&null!==e}function v(e){return y(e)&&"offsetHeight"in e}var b=u;let j=(0,u.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function w(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}class N extends b.Component{getSnapshotBeforeUpdate(e){let t=this.props.childRef.current;if(t&&e.isPresent&&!this.props.isPresent){let e=t.offsetParent,s=v(e)&&e.offsetWidth||0,i=v(e)&&e.offsetHeight||0,a=this.props.sizeRef.current;a.height=t.offsetHeight||0,a.width=t.offsetWidth||0,a.top=t.offsetTop,a.left=t.offsetLeft,a.right=s-a.width-a.left,a.bottom=i-a.height-a.top}return null}componentDidUpdate(){}render(){return this.props.children}}function k({children:e,isPresent:t,anchorX:s,anchorY:i,root:a}){let r=(0,b.useId)(),n=(0,b.useRef)(null),l=(0,b.useRef)({width:0,height:0,top:0,left:0,right:0,bottom:0}),{nonce:o}=(0,b.useContext)(j),d=function(...e){return u.useCallback(function(...e){return t=>{let s=!1,i=e.map(e=>{let i=w(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():w(e[t],null)}}}}(...e),e)}(n,e.props?.ref??e?.ref);return(0,b.useInsertionEffect)(()=>{let{width:e,height:d,top:c,left:u,right:h,bottom:m}=l.current;if(t||!n.current||!e||!d)return;let x="left"===s?`left: ${u}`:`right: ${h}`,p="bottom"===i?`bottom: ${m}`:`top: ${c}`;n.current.dataset.motionPopId=r;let f=document.createElement("style");o&&(f.nonce=o);let g=a??document.head;return g.appendChild(f),f.sheet&&f.sheet.insertRule(`
|
|
2
|
+
[data-motion-pop-id="${r}"] {
|
|
3
|
+
position: absolute !important;
|
|
4
|
+
width: ${e}px !important;
|
|
5
|
+
height: ${d}px !important;
|
|
6
|
+
${x}px !important;
|
|
7
|
+
${p}px !important;
|
|
8
|
+
}
|
|
9
|
+
`),()=>{g.contains(f)&&g.removeChild(f)}},[t]),(0,c.jsx)(N,{isPresent:t,childRef:n,sizeRef:l,children:b.cloneElement(e,{ref:d})})}let S=({children:e,initial:t,isPresent:s,onExitComplete:i,custom:a,presenceAffectsLayout:r,mode:n,anchorX:l,anchorY:o,root:d})=>{let h=x(C),m=(0,u.useId)(),p=!0,f=(0,u.useMemo)(()=>(p=!1,{id:m,initial:t,isPresent:s,custom:a,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 r&&p&&(f={...f}),(0,u.useMemo)(()=>{h.forEach((e,t)=>h.set(t,!1))},[s]),u.useEffect(()=>{s||h.size||!i||i()},[s]),"popLayout"===n&&(e=(0,c.jsx)(k,{isPresent:s,anchorX:l,anchorY:o,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:a}=t,r=(0,u.useId)();(0,u.useEffect)(()=>{if(e)return a(r)},[e]);let n=(0,u.useCallback)(()=>e&&i&&i(r),[r,i,e]);return!s&&i?[!1,n]:[!0]}let P=e=>e.key||"";function A(e){let t=[];return u.Children.forEach(e,e=>{(0,u.isValidElement)(e)&&t.push(e)}),t}let M=({children:e,custom:t,initial:s=!0,onExitComplete:i,presenceAffectsLayout:a=!0,mode:r="sync",propagate:n=!1,anchorX:l="left",anchorY:o="top",root:d})=>{let[h,p]=T(n),g=(0,u.useMemo)(()=>A(e),[e]),y=n&&!h?[]:g.map(P),v=(0,u.useRef)(!0),b=(0,u.useRef)(g),j=x(()=>new Map),w=(0,u.useRef)(new Set),[N,k]=(0,u.useState)(g),[C,M]=(0,u.useState)(g);f(()=>{v.current=!1,b.current=g;for(let e=0;e<C.length;e++){let t=P(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=P(s);y.includes(i)||(e.splice(t,0,s),E.push(s))}return"wait"===r&&E.length&&(e=E),M(A(e)),k(g),null}let{forceRender:D}=(0,u.useContext)(m);return(0,c.jsx)(c.Fragment,{children:C.map(e=>{let u=P(e),m=(!n||!!h)&&(g===C||y.includes(u));return(0,c.jsx)(S,{isPresent:m,initial:(!v.current||!!s)&&void 0,custom:t,presenceAffectsLayout:a,mode:r,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?.(),M(b.current),n&&p?.(),i&&i())},anchorX:l,anchorY:o,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,F={test:e=>"number"==typeof e,parse:parseFloat,transform:e=>e},R={...F,transform:e=>L(0,1,e)},V={...F,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[a,r,n,l]=i.match(z);return{[e]:parseFloat(a),[t]:parseFloat(r),[s]:parseFloat(n),alpha:void 0!==l?parseFloat(l):1}},B={...F,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)+", "+$(R.transform(i))+")"},q={test:I("#"),parse:function(e){let t="",s="",i="",a="";return e.length>5?(t=e.substring(1,3),s=e.substring(3,5),i=e.substring(5,7),a=e.substring(7,9)):(t=e.substring(1,2),s=e.substring(2,3),i=e.substring(3,4),a=e.substring(4,5),t+=t,s+=s,i+=i,a+=a),{red:parseInt(t,16),green:parseInt(s,16),blue:parseInt(i,16),alpha:a?parseInt(a,16)/255:1}},transform:U.transform},W=e=>({test:t=>"string"==typeof t&&t.endsWith(e)&&1===t.split(" ").length,parse:parseFloat,transform:t=>`${t}${e}`}),K=W("deg"),Q=W("%"),H=W("px"),X=W("vh"),Y=W("vw"),G={...Q,parse:e=>Q.parse(e)/100,transform:e=>Q.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)+", "+Q.transform($(t))+", "+Q.transform($(s))+", "+$(R.transform(i))+")"},Z={test:e=>U.test(e)||q.test(e)||J.test(e),parse:e=>U.test(e)?U.parse(e):J.test(e)?J.parse(e):q.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 ea(e){let t=e.toString(),s=[],i={color:[],number:[],var:[]},a=[],r=0,n=t.replace(ei,e=>(Z.test(e)?(i.color.push(r),a.push(es),s.push(Z.parse(e))):e.startsWith("var(")?(i.var.push(r),a.push("var"),s.push(e)):(i.number.push(r),a.push(et),s.push(parseFloat(e))),++r,"${}")).split("${}");return{values:s,split:n,indexes:i,types:a}}function er(e){return ea(e).values}function en(e){let{split:t,types:s}=ea(e),i=t.length;return e=>{let a="";for(let r=0;r<i;r++)if(a+=t[r],void 0!==e[r]){let t=s[r];t===et?a+=$(e[r]):t===es?a+=Z.transform(e[r]):a+=e[r]}return a}}let el=e=>"number"==typeof e?0:Z.test(e)?Z.getAnimatableNone(e):e,eo={test:function(e){return isNaN(e)&&"string"==typeof e&&(e.match(z)?.length||0)+(e.match(ee)?.length||0)>0},parse:er,createTransformer:en,getAnimatableNone:function(e){let t=er(e);return en(e)(t.map(el))}},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 a=s.replace(i,""),r=+!!ed.has(t);return i!==s&&(r*=100),t+"("+r+a+")"}let eu=/\b([a-z-]*)\(.*?\)/gu,eh={...eo,getAnimatableNone:e=>{let t=e.match(eu);return t?t.map(ec).join(" "):e}},em={...F,transform:Math.round},ex={borderWidth:H,borderTopWidth:H,borderRightWidth:H,borderBottomWidth:H,borderLeftWidth:H,borderRadius:H,borderTopLeftRadius:H,borderTopRightRadius:H,borderBottomRightRadius:H,borderBottomLeftRadius:H,width:H,maxWidth:H,height:H,maxHeight:H,top:H,right:H,bottom:H,left:H,inset:H,insetBlock:H,insetBlockStart:H,insetBlockEnd:H,insetInline:H,insetInlineStart:H,insetInlineEnd:H,padding:H,paddingTop:H,paddingRight:H,paddingBottom:H,paddingLeft:H,paddingBlock:H,paddingBlockStart:H,paddingBlockEnd:H,paddingInline:H,paddingInlineStart:H,paddingInlineEnd:H,margin:H,marginTop:H,marginRight:H,marginBottom:H,marginLeft:H,marginBlock:H,marginBlockStart:H,marginBlockEnd:H,marginInline:H,marginInlineStart:H,marginInlineEnd:H,fontSize:H,backgroundPositionX:H,backgroundPositionY:H,rotate:K,rotateX:K,rotateY:K,rotateZ:K,scale:V,scaleX:V,scaleY:V,scaleZ:V,skew:K,skewX:K,skewY:K,distance:H,translateX:H,translateY:H,translateZ:H,x:H,y:H,z:H,perspective:H,transformPerspective:H,opacity:R,originX:G,originY:G,originZ:H,zIndex:em,fillOpacity:R,strokeOpacity:R,numOctaves:em},ep={...ex,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=>ep[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=[F,H,Q,K,Y,X,{test:e=>"auto"===e,parse:e=>e}],eS=e=>ek.find(eN(e)),eC=()=>{},eT=()=>{};h.default;let eP=e=>t=>"string"==typeof t&&t.startsWith(e),eA=eP("--"),eM=eP("var(--"),eE=e=>!!eM(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 eF=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u,eR=e=>180*e/Math.PI,eV=e=>ez(eR(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:eV,rotateZ:eV,skewX:e=>eR(Math.atan(e[1])),skewY:e=>eR(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(eR(Math.atan2(e[6],e[5]))),rotateY:e=>ez(eR(Math.atan2(-e[2],e[0]))),rotateZ:eV,rotate:eV,skewX:e=>eR(Math.atan(e[4])),skewY:e=>eR(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 a=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);if(a)s=eO,i=a;else{let t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);s=e$,i=t}if(!i)return eB(t);let r=s[t],n=i[1].split(",").map(eq);return"function"==typeof r?r(n):n[r]}function eq(e){return parseFloat(e.trim())}let eW=e=>e===F||e===H,eK=new Set(["x","y","z"]),eQ=E.filter(e=>!eK.has(e)),eH={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")};eH.translateX=eH.x,eH.translateY=eH.y;let eX=e=>e,eY={},eG=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function eJ(e,t){let s=!1,i=!0,a={delta:0,timestamp:0,isProcessing:!1},r=()=>s=!0,n=eG.reduce((e,s)=>(e[s]=function(e,t){let s=new Set,i=new Set,a=!1,r=!1,n=new WeakSet,l={delta:0,timestamp:0,isProcessing:!1},o=0;function d(t){n.has(t)&&(c.schedule(t),e()),o++,t(l)}let c={schedule:(e,t=!1,r=!1)=>{let l=r&&a?s:i;return t&&n.add(e),l.has(e)||l.add(e),e},cancel:e=>{i.delete(e),n.delete(e)},process:e=>{if(l=e,a){r=!0;return}a=!0,[s,i]=[i,s],s.forEach(d),t,o=0,s.clear(),a=!1,r&&(r=!1,c.process(e))}};return c}(r,t?s:void 0),e),{}),{setup:l,read:o,resolveKeyframes:d,preUpdate:c,update:u,preRender:h,render:m,postRender:x}=n,p=()=>{let r=eY.useManualTiming?a.timestamp:performance.now();s=!1,eY.useManualTiming||(a.delta=i?1e3/60:Math.max(Math.min(r-a.timestamp,40),1)),a.timestamp=r,a.isProcessing=!0,l.process(a),o.process(a),d.process(a),c.process(a),u.process(a),h.process(a),m.process(a),x.process(a),a.isProcessing=!1,s&&t&&(i=!1,e(p))};return{schedule:eG.reduce((t,r)=>{let l=n[r];return t[r]=(t,r=!1,n=!1)=>(!s&&(s=!0,i=!0,a.isProcessing||e(p)),l.schedule(t,r,n)),t},{}),cancel:e=>{for(let t=0;t<eG.length;t++)n[eG[t]].cancel(e)},state:a,steps:n}}let{schedule:eZ,cancel:e0,state:e1,steps:e2}=eJ("u">typeof requestAnimationFrame?requestAnimationFrame:eX,!0),e5=new Set,e4=!1,e3=!1,e6=!1;function e8(){if(e3){let e=Array.from(e5).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),s=new Map;t.forEach(e=>{let t,i=(t=[],eQ.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,e5.forEach(e=>e.complete(e6)),e5.clear()}function e7(){e5.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(e3=!0)})}class e9{constructor(e,t,s,i,a,r=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=s,this.motionValue=i,this.element=a,this.isAsync=r}scheduleResolve(){this.state="scheduled",this.isAsync?(e5.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 a=i?.get(),r=e[e.length-1];if(void 0!==a)e[0]=a;else if(s&&t){let i=s.readValue(t,r);null!=i&&(e[0]=i)}void 0===e[0]&&(e[0]=r),i&&void 0===a&&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),e5.delete(this)}cancel(){"scheduled"===this.state&&(e5.delete(this),this.state="pending")}resume(){"pending"===this.state&&this.scheduleResolve()}}function te(e,t){let s=ef(e);return s!==eh&&(s=eo),s.getAnimatableNone?s.getAnimatableNone(t):void 0}let tt=new Set(["auto","none","0"]);class ts extends e9{constructor(e,t,s,i,a){super(e,t,s,i,a,!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 a=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[a,r]=function(e){let t=eF.exec(e);if(!t)return[,];let[,s,i,a]=t;return[`--${s??i}`,a]}(t);if(!a)return;let n=window.getComputedStyle(s).getPropertyValue(a);if(n){let e=n.trim();return/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e)?parseFloat(e):e}return eE(r)?e(r,s,i+1):r}(i,t.current);void 0!==a&&(e[s]=a),s===e.length-1&&(this.finalKeyframe=i)}}if(this.resolveNoneKeyframes(),!ew.has(s)||2!==e.length)return;let[i,a]=e,r=eS(i),n=eS(a);if(eL(i)!==eL(a)&&eH[s]){this.needsMeasurement=!0;return}if(r!==n)if(eW(r)&&eW(n))for(let t=0;t<e.length;t++){let s=e[t];"string"==typeof s&&(e[t]=parseFloat(s))}else eH[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,a=0;for(;a<e.length&&!i;){let t=e[a];"string"==typeof t&&!tt.has(t)&&ea(t).values.length&&(i=e[a]),a++}if(i&&s)for(let a of t)e[a]=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=eH[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 a=s.length-1,r=s[a];s[a]=eH[t](e.measureViewportBox(),window.getComputedStyle(e.current)),null!==r&&void 0===this.finalKeyframe&&(this.finalKeyframe=r),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 ta(e,t){let s=e.indexOf(t);s>-1&&e.splice(s,1)}class tr{constructor(){this.subscriptions=[]}add(e){return ti(this.subscriptions,e),()=>ta(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 a=0;a<i;a++){let i=this.subscriptions[a];i&&i(e,t,s)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}let{schedule:tn}=eJ(queueMicrotask,!1);function tl(){t=void 0}let to={now:()=>(void 0===t&&to.set(e1.isProcessing||eY.useManualTiming?e1.timestamp:performance.now()),t),set:e=>{t=e,queueMicrotask(tl)}};class td{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{let t=to.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=to.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 tr);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 l&&l.push(this),this.current}getPrevious(){return this.prev}getVelocity(){var e;let t=to.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,eo],th={current:null},tm={current:!1},tx="u">typeof window,tp=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[a,r]=tw(i);t=t(void 0!==s?s:e.custom,a,r)}if("string"==typeof t&&(t=e.variants&&e.variants[t]),"function"==typeof t){let[a,r]=tw(i);t=t(void 0!==s?s:e.custom,a,r)}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:a,visualState:r},n={}){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=to.now();this.renderScheduledAt<e&&(this.renderScheduledAt=e,eZ.render(this.render,!1,!0))};const{latestValues:l,renderState:o}=r;this.latestValues=l,this.baseTarget={...l},this.initialValues=t.initial?{...l}:{},this.renderState=o,this.parent=e,this.props=t,this.presenceContext=s,this.depth=e?e.depth+1:0,this.reducedMotionConfig=i,this.options=n,this.blockInitialAnimation=!!a,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!==l[e]&&ej(t)&&t.set(l[e])}}mount(e){this.current=e,tp.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,tx)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 a=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,()=>{a(),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 a=t[i],r=s[i];if(ej(a))e.addValue(i,a);else if(ej(r))e.addValue(i,tc(a,{owner:e}));else if(r!==a)if(e.hasValue(i)){let t=e.getValue(i);!0===t.liveStyle?t.jump(a):t.hasAnimated||t.set(a)}else{let t=e.getStaticValue(i);e.addValue(i,tc(void 0!==t?t:a,{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,a;if("string"==typeof s&&(i=s,/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(i)||(a=s,/^0[^.\s]+$/u.test(a))))s=parseFloat(s);else{let i;i=s,!tu.find(eN(i))&&eo.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 tr),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){tn.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 tP(e){return e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}let tA=(e,t)=>t&&"number"==typeof e?t.transform(e):e,tM={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},tE=E.length;function tD(e,t,s){let{style:i,vars:a,transformOrigin:r}=e,n=!1,l=!1;for(let e in t){let s=t[e];if(D.has(e)){n=!0;continue}if(eA(e)){a[e]=s;continue}{let t=tA(s,ex[e]);e.startsWith("origin")?(l=!0,r[e]=t):i[e]=t}}if(!t.transform&&(n||s?i.transform=function(e,t,s){let i="",a=!0;for(let r=0;r<tE;r++){let n=E[r],l=e[n];if(void 0===l)continue;let o=!0;if("number"==typeof l)o=l===+!!n.startsWith("scale");else{let e=parseFloat(l);o=n.startsWith("scale")?1===e:0===e}if(!o||s){let e=tA(l,ex[n]);if(!o){a=!1;let t=tM[n]||n;i+=`${t}(${e}) `}s&&(t[n]=e)}}return i=i.trim(),s?i=s(t,a?"":i):a&&(i="none"),i}(t,e.transform,s):i.transform&&(i.transform="none")),l){let{originX:e="50%",originY:t="50%",originZ:s=0}=r;i.transformOrigin=`${e} ${t} ${s}`}}let tL={offset:"stroke-dashoffset",array:"stroke-dasharray"},tF={offset:"strokeDashoffset",array:"strokeDasharray"},tR=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function tV(e,{attrX:t,attrY:s,attrScale:i,pathLength:a,pathSpacing:r=1,pathOffset:n=0,...l},o,d,c){if(tD(e,l,d),o){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),tR))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!==a&&function(e,t,s=1,i=0,a=!0){e.pathLength=1;let r=a?tL:tF;e[r.offset]=`${-i}`,e[r.array]=`${t} ${s}`}(u,a,r,n,!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,a){let r,n=e.style;for(r in t)n[r]=t[r];for(r in a?.applyProjectionStyles(n,i),s)n.setProperty(r,s[r])}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(!H.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=eo.parse(e);if(i.length>5)return e;let a=eo.createTransformer(e),r=+("number"!=typeof i[0]),n=s.x.scale*t.x,l=s.y.scale*t.y;i[0+r]/=n,i[1+r]/=l;let o=tB(n,l,.5);return"number"==typeof i[2+r]&&(i[2+r]/=o),"number"==typeof i[3+r]&&(i[3+r]/=o),a(i)}}};function tq(e,{layout:t,layoutId:s}){return D.has(e)||e.startsWith("origin")||(t||void 0!==s)&&(!!tU[e]||"opacity"===e)}function tW(e,t,s){let i=e.style,a=t?.style,r={};if(!i)return r;for(let t in i)(ej(i[t])||a&&ej(a[t])||tq(t,e)||s?.getValue(t)?.liveStyle!==void 0)&&(r[t]=i[t]);return r}function tK(e,t,s){let i=tW(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 tQ 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:tP(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,s){return tK(e,t,s)}build(e,t,s){tV(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:tP(s),t.attrs[s])}mount(e){this.isSVGTag=tz(e.tagName),super.mount(e)}}function tH({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 tY({scale:e,scaleX:t,scaleY:s}){return!tX(e)||!tX(t)||!tX(s)}function tG(e){return tY(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,a){return void 0!==a&&(e=i+a*(e-i)),i+s*(e-i)+t}function t0(e,t=0,s=1,i,a){e.min=tZ(e.min,t,s,i,a),e.max=tZ(e.max,t,s,i,a)}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 t2(e,t){e.min=e.min+t,e.max=e.max+t}function t5(e,t,s,i,a=.5){let r=tB(e.min,e.max,a);t0(e,t,s,r,i)}function t4(e,t){t5(e.x,t.x,t.scaleX,t.scale,t.originX),t5(e.y,t.y,t.scaleY,t.scale,t.originY)}function t3(e,t){return tH(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=(eA(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 tW(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])||tq(i,s)||(e[i]=t[i])}let sa=()=>({...ss(),attrs:{}}),sr=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 sn(e){return e.startsWith("while")||e.startsWith("drag")&&"draggable"!==e||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||sr.has(e)}let sl=e=>!sn(e);try{d=(()=>{let e=Error("Cannot find module '@emotion/is-prop-valid'");throw e.code="MODULE_NOT_FOUND",e})().default,"function"==typeof d&&(sl=e=>e.startsWith("on")?!sn(e):d(e))}catch{}function so(e){return ej(e)?e.get():e}let sd=e=>(t,s)=>{let i=(0,u.useContext)(se),a=(0,u.useContext)(g),r=()=>(function({scrapeMotionValuesFromProps:e,createRenderState:t},s,i,a){return{latestValues:function(e,t,s,i){let a={},r=i(e,{});for(let e in r)a[e]=so(r[e]);let{initial:n,animate:l}=e,o=tb(e),d=tj(e);t&&d&&!o&&!1!==e.inherit&&(void 0===n&&(n=t.initial),void 0===l&&(l=t.animate));let c=!!s&&!1===s.initial,u=(c=c||!1===n)?l:n;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&&(a[e]=t)}for(let t in e)a[t]=e[t]}}}return a}(s,i,a,e),renderState:t()}})(e,t,i,a);return s?r():x(r)},sc=sd({scrapeMotionValuesFromProps:tW,createRenderState:ss}),su=sd({scrapeMotionValuesFromProps:tK,createRenderState:sa}),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 sx(){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 sp=Symbol.for("motionComponentSymbol"),sf="data-"+tP("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,a){i&&function(e){let t=sx();for(let s in e)t[s]={...t[s],...e[s]};tS=t}(i);let r=s?"svg"===s:t7(e),n=r?su:sc;function l(s,i){var l;let o,d,h,x={...(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}=x,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=n(s,y);if(!y&&p){(0,u.useContext)(t9).strict;let t=function(e){let{drag:t,layout:s}=sx();if(!t&&!s)return{};let i={...t,...s};return{MeasureLayout:t?.isEnabled(e)||s?.isEnabled(e)?i.MeasureLayout:void 0,ProjectionNode:i.ProjectionNode}}(x);o=t.MeasureLayout,v.visualElement=function(e,t,s,i,a,r){let{visualElement:n}=(0,u.useContext)(se),l=(0,u.useContext)(t9),o=(0,u.useContext)(g),d=(0,u.useContext)(j).reducedMotion,c=(0,u.useRef)(null),h=(0,u.useRef)(!1);i=i||l.renderer,!c.current&&i&&(c.current=i(e,{visualState:t,parent:n,props:s,presenceContext:o,blockInitialAnimation:!!o&&!1===o.initial,reducedMotionConfig:d,isSVG:r}),h.current&&c.current&&(c.current.manuallyAnimateOnMount=!0));let m=c.current,x=(0,u.useContext)(sg);m&&!m.projection&&a&&("html"===m.type||"svg"===m.type)&&function(e,t,s,i){let{layoutId:a,layout:r,drag:n,dragConstraints:l,layoutScroll:o,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:a,layout:r,alwaysMeasureLayout:!!n||l&&sy(l),visualElement:e,animationType:"string"==typeof r?r:"both",initialPromotionConfig:i,crossfade:c,layoutScroll:o,layoutRoot:d})}(c.current,s,a,x);let p=(0,u.useRef)(!1);(0,u.useInsertionEffect)(()=>{m&&p.current&&m.update(s,o)});let y=s[sf],v=(0,u.useRef)(!!y&&!window.MotionHandoffIsComplete?.(y)&&window.MotionHasOptimisedAnimation?.(y));return f(()=>{h.current=!0,m&&(p.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,x,a,t.ProjectionNode,r)}return(0,c.jsxs)(se.Provider,{value:v,children:[o&&v.visualElement?(0,c.jsx)(o,{visualElement:v.visualElement,...x}):null,function(e,t,s,{latestValues:i},a,r=!1,n){let l=(n??t7(e)?function(e,t,s,i){let a=(0,u.useMemo)(()=>{let s=sa();return tV(s,t,tz(i),e.transformTemplate,e.style),{...s.attrs,style:{...s.style}}},[t]);if(e.style){let t={};si(t,e.style,e),a.style={...t,...a.style}}return a}:function(e,t){let s,i,a={},r=(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&&(a.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=!0===e.drag?"none":`pan-${"x"===e.drag?"y":"x"}`),void 0===e.tabIndex&&(e.onTap||e.onTapStart||e.whileTap)&&(a.tabIndex=0),a.style=r,a})(t,i,a,e),o=function(e,t,s){let i={};for(let a in e)("values"!==a||"object"!=typeof e.values)&&(sl(a)||!0===s&&sn(a)||!t&&!sn(a)||e.draggable&&a.startsWith("onDrag"))&&(i[a]=e[a]);return i}(t,"string"==typeof e,r),d=e!==u.Fragment?{...o,...l,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,(l=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),l&&(e?l.mount(e):l.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)},[l])),b,y,t,r)]})}l.displayName=`motion.${"string"==typeof e?e:`create(${e.displayName??e.name??""})`}`;let o=(0,u.forwardRef)(l);return o[sp]=e,o}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&&eY.WillChange){let s=new eY.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),sP={layout:0,mainThread:0,waapi:0};function sA(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 sM(e,t){return s=>s>0?t:e}let sE=(e,t,s)=>{let i=e*e,a=s*(t*t-i)+i;return a<0?0:Math.sqrt(a)},sD=[q,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 a=0,r=0,n=0;if(t/=100){let i=s<.5?s*(1+t):s+t-s*t,l=2*s-i;a=sA(l,i,e+1/3),r=sA(l,i,e),n=sA(l,i,e-1/3)}else a=r=n=s;return{red:Math.round(255*a),green:Math.round(255*r),blue:Math.round(255*n),alpha:i}}(s)),s}let sF=(e,t)=>{let s=sL(e),i=sL(t);if(!s||!i)return sM(e,t);let a={...s};return e=>(a.red=sE(s.red,i.red,e),a.green=sE(s.green,i.green,e),a.blue=sE(s.blue,i.blue,e),a.alpha=tB(s.alpha,i.alpha,e),U.transform(a))},sR=new Set(["none","hidden"]);function sV(e,t){return s=>tB(e,t,s)}function s$(e){return"number"==typeof e?sV:"string"==typeof e?eE(e)?sM:Z.test(e)?sF:sI:Array.isArray(e)?sz:"object"==typeof e?Z.test(e)?sF:s_:sM}function sz(e,t){let s=[...e],i=s.length,a=e.map((e,s)=>s$(e)(e,t[s]));return e=>{for(let t=0;t<i;t++)s[t]=a[t](e);return s}}function s_(e,t){let s={...e,...t},i={};for(let a in s)void 0!==e[a]&&void 0!==t[a]&&(i[a]=s$(e[a])(e[a],t[a]));return e=>{for(let t in i)s[t]=i[t](e);return s}}let sI=(e,t)=>{let s=eo.createTransformer(t),i=ea(e),a=ea(t);if(!(i.indexes.var.length===a.indexes.var.length&&i.indexes.color.length===a.indexes.color.length&&i.indexes.number.length>=a.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"),sM(e,t);if(sR.has(e)&&!a.values.length||sR.has(t)&&!i.values.length)return sR.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 a=0;a<t.values.length;a++){let r=t.types[a],n=e.indexes[r][i[r]],l=e.values[n]??0;s[a]=l,i[r]++}return s}(i,a),a.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:to.now()}},sU=(e,t,s=10)=>{let i="",a=Math.max(Math.round(t/s),2);for(let t=0;t<a;t++)i+=Math.round(1e4*e(t/(a-1)))/1e4+", ";return`linear(${i.substring(0,i.length-2)})`};function sq(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 sW(e,t,s){var i,a;let r=Math.max(t-5,0);return i=s-e(r),(a=t-r)?1e3/a*i:0}let sK=.01,sQ=2,sH=.005,sX=.5;function sY(e,t){return e*Math.sqrt(1-t*t)}let sG=["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:a,restDelta:r}=i,n=i.keyframes[0],l=i.keyframes[i.keyframes.length-1],o={done:!1,value:n},{stiffness:d,damping:c,mass:u,duration:h,velocity:m,isResolvedFromDuration:x}=function(e){let t={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...e};if(!sZ(e,sJ)&&sZ(e,sG))if(e.visualDuration){let s=2*Math.PI/(1.2*e.visualDuration),i=s*s,a=2*L(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:1,stiffness:i,damping:a}}else{let s=function({duration:e=800,bounce:t=.3,velocity:s=0,mass:i=1}){let a,r;eC(e<=sS(10),"Spring duration must be 10 seconds or less","spring-duration-limit");let n=1-t;n=L(.05,1,n),e=L(.01,10,e/1e3),n<1?(a=t=>{let i=t*n,a=i*e;return .001-(i-s)/sY(t,n)*Math.exp(-a)},r=t=>{let i=t*n*e,r=Math.pow(n,2)*Math.pow(t,2)*e,l=Math.exp(-i),o=sY(Math.pow(t,2),n);return(i*s+s-r)*l*(-a(t)+.001>0?-1:1)/o}):(a=t=>-.001+Math.exp(-t*e)*((t-s)*e+1),r=t=>e*e*(s-t)*Math.exp(-t*e));let l=function(e,t,s){let i=s;for(let s=1;s<12;s++)i-=e(i)/t(i);return i}(a,r,5/e);if(e=sS(e),isNaN(l))return{stiffness:100,damping:10,duration:e};{let t=Math.pow(l,2)*i;return{stiffness:t,damping:2*n*Math.sqrt(i*t),duration:e}}}(e);(t={...t,...s,mass:1}).isResolvedFromDuration=!0}return t}({...i,velocity:-((i.velocity||0)/1e3)}),p=m||0,f=c/(2*Math.sqrt(d*u)),g=l-n,y=Math.sqrt(d/u)/1e3,v=5>Math.abs(g);if(a||(a=v?sK:sQ),r||(r=v?sH:sX),f<1){let e=sY(y,f);s=t=>l-Math.exp(-f*y*t)*((p+f*y*g)/e*Math.sin(e*t)+g*Math.cos(e*t))}else if(1===f)s=e=>l-Math.exp(-y*e)*(g+(p+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 l-s*((p+f*y*g)*Math.sinh(i)+e*g*Math.cosh(i))/e}}let b={calculatedDuration:x&&h||null,next:e=>{let t=s(e);if(x)o.done=e>=h;else{let i=0===e?p:0;f<1&&(i=0===e?sS(p):sW(s,e,t));let n=Math.abs(l-t)<=r;o.done=Math.abs(i)<=a&&n}return o.value=o.done?l:t,o},toString:()=>{let e=Math.min(sq(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:a=10,bounceStiffness:r=500,modifyTarget:n,min:l,max:o,restDelta:d=.5,restSpeed:c}){let u,h,m=e[0],x={done:!1,value:m},p=s*t,f=m+p,g=void 0===n?f:n(f);g!==f&&(p=g-m);let y=e=>-p*Math.exp(-e/i),v=e=>g+y(e),b=e=>{let t=y(e),s=v(e);x.done=Math.abs(t)<=d,x.value=x.done?g:s},j=e=>{let t;if(t=x.value,void 0!==l&&t<l||void 0!==o&&t>o){var s;u=e,h=s0({keyframes:[x.value,(s=x.value,void 0===l?o:void 0===o||Math.abs(l-s)<Math.abs(o-s)?l:o)],velocity:sW(v,e,x.value),damping:a,stiffness:r,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),x)}}}s0.applyToOptions=e=>{let t=function(e,t=100,s){let i=s({...e,keyframes:[0,t]}),a=Math.min(sq(i),2e4);return{type:"keyframes",ease:e=>i.next(a*e).value/t,duration:a/1e3}}(e,100,s0);return e.ease=t.ease,e.duration=sS(t.duration),e.type="keyframes",e};let s2=(e,t,s)=>(((1-3*s+3*t)*e+(3*s-6*t))*e+3*t)*e;function s5(e,t,s,i){return e===t&&s===i?eX:a=>0===a||1===a?a:s2(function(e,t,s,i,a){let r,n,l=0;do(r=s2(n=t+(s-t)/2,i,a)-e)>0?s=n:t=n;while(Math.abs(r)>1e-7&&++l<12)return n}(a,0,1,e,s),t,i)}let s4=s5(.42,0,1,1),s3=s5(0,0,.58,1),s6=s5(.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=s5(.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)),ia=s7(ii),ir=s8(ii),il=e=>Array.isArray(e)&&"number"==typeof e[0],io={linear:eX,easeIn:s4,easeInOut:s6,easeOut:s3,circIn:ii,circInOut:ir,circOut:ia,backIn:ie,backInOut:it,backOut:s9,anticipate:is},id=e=>{if(il(e)){eT(4===e.length,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");let[t,s,i,a]=e;return s5(t,s,i,a)}return"string"==typeof e?(eT(void 0!==io[e],`Invalid easing type '${e}'`,"invalid-easing-type"),io[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 a;let r,n=Array.isArray(i)&&"number"!=typeof i[0]?i.map(id):id(i),l={done:!1,value:t[0]},o=function(e,t,{clamp:s=!0,ease:i,mixer:a}={}){let r=e.length;if(eT(r===t.length,"Both input and output ranges must be the same length","range-length"),1===r)return()=>t[0];if(2===r&&t[0]===t[1])return()=>t[1];let n=e[0]===e[1];e[0]>e[r-1]&&(e=[...e].reverse(),t=[...t].reverse());let l=function(e,t,s){let i=[],a=s||eY.mix||sO,r=e.length-1;for(let s=0;s<r;s++){let r=a(e[s],e[s+1]);t&&(r=sT(Array.isArray(t)?t[s]||eX:t,r)),i.push(r)}return i}(t,i,a),o=l.length,d=s=>{if(n&&s<e[0])return t[0];let i=0;if(o>1)for(;i<e.length-2&&!(s<e[i+1]);i++);let a=ic(e[i],e[i+1],s);return l[i](a)};return s?t=>d(L(e[0],e[r-1],t)):d}((a=s&&s.length===t.length?s:(!function(e,t){let s=e[e.length-1];for(let i=1;i<=t;i++){let a=ic(0,t,i);e.push(tB(s,1,a))}}(r=[0],t.length-1),r),a.map(t=>t*e)),t,{ease:Array.isArray(n)?n:t.map(()=>n||s6).splice(0,t.length-1)});return{calculatedDuration:e,next:t=>(l.value=o(t),l.done=t>=e,l)}}let ih=e=>null!==e;function im(e,{repeat:t,repeatType:s="loop"},i,a=1){let r=e.filter(ih),n=a<0||t&&"loop"!==s&&t%2==1?0:r.length-1;return n&&void 0!==i?i:r[n]}let ix={decay:s1,inertia:s1,tween:iu,keyframes:iu,spring:s0};function ip(e){"string"==typeof e.type&&(e.type=ix[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!==to.now()&&this.tick(to.now()),this.isStopped=!0,"idle"!==this.state&&(this.teardown(),this.options.onStop?.())},sP.mainThread++,this.options=e,this.initAnimation(),this.play(),!1===e.autoplay&&this.pause()}initAnimation(){let{options:e}=this;ip(e);let{type:t=iu,repeat:s=0,repeatDelay:i=0,repeatType:a,velocity:r=0}=e,{keyframes:n}=e,l=t||iu;l!==iu&&"number"!=typeof n[0]&&(this.mixKeyframes=sT(iy,sO(n[0],n[1])),n=[0,100]);let o=l({...e,keyframes:n});"mirror"===a&&(this.mirroredGenerator=l({...e,keyframes:[...n].reverse(),velocity:-r})),null===o.calculatedDuration&&(o.calculatedDuration=sq(o));let{calculatedDuration:d}=o;this.calculatedDuration=d,this.resolvedDuration=d+i,this.totalDuration=this.resolvedDuration*(s+1)-i,this.generator=o}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:a,mirroredGenerator:r,resolvedDuration:n,calculatedDuration:l}=this;if(null===this.startTime)return s.next(0);let{delay:o=0,keyframes:d,repeat:c,repeatType:u,repeatDelay:h,type:m,onUpdate:x,finalKeyframe:p}=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-o*(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)/n,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/n)):"mirror"===u&&(v=r)),y=L(0,1,s)*n}let b=g?{done:!1,value:d[0]}:v.next(y);a&&(b.value=a(b.value));let{done:j}=b;g||null===l||(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,p,this.speed)),x&&x(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(to.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(to.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,sP.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:a,allowFlatten:r=!1,finalKeyframe:n,onComplete:l}=e;this.isPseudoElement=!!a,this.allowFlatten=r,this.options=e,eT("string"!=typeof e.type,'Mini animate() doesn\'t support "type" as a string.',"mini-spring");const o=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:a=300,repeat:r=0,repeatType:n="loop",ease:l="easeOut",times:o}={},d){let c={[t]:s};o&&(c.offset=o);let u=function e(t,s){if(t)return"function"==typeof t?iN()?sU(t,s):"ease-out":il(t)?ik(t):Array.isArray(t)?t.map(t=>e(t,s)||iS.easeOut):iS[t]}(l,a);Array.isArray(u)&&(c.easing=u);let h={delay:i,duration:a,easing:Array.isArray(u)?"linear":u,fill:"both",iterations:r+1,direction:"reverse"===n?"alternate":"normal"};d&&(h.pseudoElement=d);let m=e.animate(c,h);return m}(t,s,i,o,a),!1===o.autoplay&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!a){let e=im(i,this.options,n,this.speed);this.updateMotionValue?this.updateMotionValue(e):s.startsWith("--")?t.style.setProperty(s,e):t.style[s]=e,this.animation.cancel()}l?.(),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 iP={anticipate:is,backInOut:it,circInOut:ir};class iA extends iT{constructor(e){!function(e){"string"==typeof e.ease&&e.ease in iP&&(e.ease=iP[e.ease])}(e),ip(e),super(e),void 0!==e.startTime&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){let{motionValue:t,onUpdate:s,onComplete:i,element:a,...r}=this.options;if(!t)return;if(void 0!==e)return void t.set(e);let n=new iv({...r,autoplay:!1}),l=Math.max(10,to.now()-this.startTime),o=L(0,10,l-10);t.setWithVelocity(n.sample(Math.max(0,l-o)).value,n.sample(l).value,o),n.stop()}}let iM=(e,t)=>"zIndex"!==t&&!!("number"==typeof e||Array.isArray(e)||"string"==typeof e&&(eo.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 iF extends ig{constructor({autoplay:e=!0,delay:t=0,type:s="keyframes",repeat:i=0,repeatDelay:a=0,repeatType:r="loop",keyframes:n,name:l,motionValue:o,element:d,...c}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=to.now();const u={autoplay:e,delay:t,type:s,repeat:i,repeatDelay:a,repeatType:r,name:l,motionValue:o,element:d,...c},h=d?.KeyframeResolver||e9;this.keyframeResolver=new h(n,(e,t,s)=>this.onKeyframesResolved(e,t,u,!s),l,o,d),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,s,i){this.keyframeResolver=void 0;let{name:a,type:r,velocity:n,delay:l,isHandoff:o,onUpdate:d}=s;this.resolvedAt=to.now(),!function(e,t,s,i){let a=e[0];if(null===a)return!1;if("display"===t||"visibility"===t)return!0;let r=e[e.length-1],n=iM(a,t),l=iM(r,t);return eC(n===l,`You are trying to animate ${t} from "${a}" to "${r}". "${n?r:a}" is not an animatable value.`,"value-not-animatable"),!!n&&!!l&&(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,a,r,n)&&((eY.instantAnimations||!l)&&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=!o&&function(e){let{motionValue:t,name:s,repeatDelay:i,repeatType:a,damping:r,type:n}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;let{onUpdate:l,transformTemplate:o}=t.owner.getProps();return iL()&&s&&iD.has(s)&&("transform"!==s||!o)&&!l&&!i&&"mirror"!==a&&0!==r&&"inertia"!==n}(c),h=c.motionValue?.owner?.current,m=u?new iA({...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 iR={type:"spring",stiffness:500,damping:25,restSpeed:10},iV={type:"keyframes",duration:.8},i$={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},iz=e=>null!==e,i_=(e,t,s,i={},a,r)=>n=>{let l=sw(i,e)||{},o=l.delay||i.delay||0,{elapsed:d=0}=i;d-=sS(o);let c={keyframes:Array.isArray(s)?s:[null,s],ease:"easeOut",velocity:t.getVelocity(),...l,delay:-d,onUpdate:e=>{t.set(e),l.onUpdate&&l.onUpdate(e)},onComplete:()=>{n(),l.onComplete&&l.onComplete()},name:e,motionValue:t,element:r?void 0:a};!function({when:e,delay:t,delayChildren:s,staggerChildren:i,staggerDirection:a,repeat:r,repeatType:n,repeatDelay:l,from:o,elapsed:d,...c}){return!!Object.keys(c).length}(l)&&Object.assign(c,((e,{keyframes:t})=>t.length>2?iV:D.has(e)?e.startsWith("scale")?{type:"spring",stiffness:550,damping:0===t[1]?2*Math.sqrt(550):30,restSpeed:10}:iR: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)),(eY.instantAnimations||eY.skipAnimations)&&(u=!0,iE(c),c.delay=0),c.allowFlatten=!l.type&&!l.ease,u&&!r&&void 0!==t.get()){let e=function(e,{repeat:t,repeatType:s="loop"},i){let a=e.filter(iz),r=t&&"loop"!==s&&t%2==1?0:a.length-1;return a[r]}(c.keyframes,l);if(void 0!==e)return void eZ.update(()=>{c.onUpdate(e),c.onComplete()})}return l.isSync?new iv(c):new iF(c)};function iI(e,t,{delay:s=0,transitionOverride:i,type:a}={}){let{transition:r=e.getDefaultTransition(),transitionEnd:n,...l}=t;i&&(r=i);let o=[],d=a&&e.animationState&&e.animationState.getState()[a];for(let t in l){let i=e.getValue(t,e.latestValues[t]??null),a=l[t];if(void 0===a||d&&function({protectedKeys:e,needsAnimating:t},s){let i=e.hasOwnProperty(s)&&!0!==t[s];return t[s]=!1,i}(d,t))continue;let n={delay:s,...sw(r||{},t)},c=i.get();if(void 0!==c&&!i.isAnimating&&!Array.isArray(a)&&a===c&&!n.velocity)continue;let u=!1;if(window.MotionHandoffAnimation){let s=e.props[sf];if(s){let e=window.MotionHandoffAnimation(s,t,eZ);null!==e&&(n.startTime=e,u=!0)}}sk(e,t),i.start(i_(t,i,a,e.shouldReduceMotion&&ew.has(t)?{type:!1}:n,e,u));let h=i.animation;h&&o.push(h)}return n&&Promise.all(o).then(()=>{eZ.update(()=>{n&&function(e,t){let{transitionEnd:s={},transition:i={},...a}=sj(e,t)||{};for(let t in a={...a,...s}){var r;let s=sN(r=a[t])?r[r.length-1]||0:r;e.hasValue(t)?e.getValue(t).set(s):e.addValue(t,tc(s))}}(e,n)})}),o}function iO(e,t,s,i=0,a=1){let r=Array.from(e).sort((e,t)=>e.sortNodePosition(t)).indexOf(t),n=e.size,l=(n-1)*i;return"function"==typeof s?s(r,n):1===a?r*i:l-r*i}function iB(e,t,s={}){let i=sj(e,t,"exit"===s.type?e.presenceContext?.custom:void 0),{transition:a=e.getDefaultTransition()||{}}=i||{};s.transitionOverride&&(a=s.transitionOverride);let r=i?()=>Promise.all(iI(e,i,s)):()=>Promise.resolve(),n=e.variantChildren&&e.variantChildren.size?(i=0)=>{let{delayChildren:r=0,staggerChildren:n,staggerDirection:l}=a;return function(e,t,s=0,i=0,a=0,r=1,n){let l=[];for(let o of e.variantChildren)o.notify("AnimationStart",t),l.push(iB(o,t,{...n,delay:s+("function"==typeof i?0:i)+iO(e.variantChildren,o,i,a,r)}).then(()=>o.notify("AnimationComplete",t)));return Promise.all(l)}(e,t,i,r,n,l,s)}:()=>Promise.resolve(),{when:l}=a;if(!l)return Promise.all([r(),n(s.delay)]);{let[e,t]="beforeChildren"===l?[r,n]:[n,r];return e().then(()=>t())}}let iU=tv.length;function iq(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 iW=[...ty].reverse(),iK=ty.length;function iQ(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function iH(){return{animate:iQ(!0),whileInView:iQ(),whileHover:iQ(),whileTap:iQ(),whileDrag:iQ(),whileFocus:iQ(),exit:iQ()}}let iX=0;function iY(e){return[e("x"),e("y")]}let iG=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function iJ(e){return iG.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 i2(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 i5(e,t,s,i){i2(e.x,t.x,s.x,i?i.originX:void 0),i2(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 ae=({current:e})=>e?e.ownerDocument.defaultView:null,at=(e,t)=>Math.abs(e-t),as=new Set(["auto","scroll"]);class ai{constructor(e,t,{transformPagePoint:s,contextWindow:i=window,dragSnapToOrigin:a=!1,distanceThreshold:r=3,element:n}={}){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=an(this.lastMoveEventInfo,this.history),i=null!==this.startEvent,a=(e=s.offset,t={x:0,y:0},Math.sqrt(at(e.x,t.x)**2+at(e.y,t.y)**2)>=this.distanceThreshold);if(!i&&!a)return;let{point:r}=s,{timestamp:n}=e1;this.history.push({...r,timestamp:n});let{onStart:l,onMove:o}=this.handlers;i||(l&&l(this.lastMoveEvent,s),this.startEvent=this.lastMoveEvent),o&&o(this.lastMoveEvent,s)},this.handlePointerMove=(e,t)=>{this.lastMoveEvent=e,this.lastMoveEventInfo=aa(t,this.transformPagePoint),eZ.update(this.updatePoint,!0)},this.handlePointerUp=(e,t)=>{this.end();let{onEnd:s,onSessionEnd:i,resumeAnimation:a}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&a&&a(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let r=an("pointercancel"===e.type?this.lastMoveEventInfo:aa(t,this.transformPagePoint),this.history);this.startEvent&&s&&s(e,r),i&&i(e,r)},!i8(e))return;this.dragSnapToOrigin=a,this.handlers=t,this.transformPagePoint=s,this.distanceThreshold=r,this.contextWindow=i||window;const l=aa(i7(e),this.transformPagePoint),{point:o}=l,{timestamp:d}=e1;this.history=[{...o,timestamp:d}];const{onSessionStart:c}=t;c&&c(e,an(l,this.history)),this.removeListeners=sT(i9(this.contextWindow,"pointermove",this.handlePointerMove),i9(this.contextWindow,"pointerup",this.handlePointerUp),i9(this.contextWindow,"pointercancel",this.handlePointerUp)),n&&this.startScrollTracking(n)}startScrollTracking(e){let t=e.parentElement;for(;t;){let e=getComputedStyle(t);(as.has(e.overflowX)||as.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},a={x:i.x-t.x,y:i.y-t.y};(0!==a.x||0!==a.y)&&(s?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=a.x,this.lastMoveEventInfo.point.y+=a.y):this.history.length>0&&(this.history[0].x-=a.x,this.history[0].y-=a.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 aa(e,t){return t?{point:t(e.point)}:e}function ar(e,t){return{x:e.x-t.x,y:e.y-t.y}}function an({point:e},t){return{point:e,delta:ar(e,al(t)),offset:ar(e,t[0]),velocity:function(e,t){if(e.length<2)return{x:0,y:0};let s=e.length-1,i=null,a=al(e);for(;s>=0&&(i=e[s],!(a.timestamp-i.timestamp>sS(.1)));)s--;if(!i)return{x:0,y:0};let r=(a.timestamp-i.timestamp)/1e3;if(0===r)return{x:0,y:0};let n={x:(a.x-i.x)/r,y:(a.y-i.y)/r};return n.x===1/0&&(n.x=0),n.y===1/0&&(n.y=0),n}(t,.1)}}function al(e){return e[e.length-1]}function ao(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 ad(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 ac(e,t,s){return{min:au(e,t),max:au(e,s)}}function au(e,t){return"number"==typeof e?e:e[t]||0}let ah=new WeakMap;class am{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 a=e=>{t?(this.stopAnimation(),this.snapToCursor(i7(e).point)):this.pauseAnimation()},r=(e,t)=>{this.stopAnimation();let{drag:s,dragPropagation:i,onDragStart:a}=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),iY(e=>{let t=this.getAxisMotionValue(e).get()||0;if(Q.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}),a&&eZ.postRender(()=>a(e,t)),sk(this.visualElement,"transform");let{animationState:r}=this.visualElement;r&&r.setActive("whileDrag",!0)},n=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t;let{dragPropagation:s,dragDirectionLock:i,onDirectionLock:a,onDrag:r}=this.getProps();if(!s&&!this.openDragLock)return;let{offset:n}=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}(n),null!==this.currentDirection&&a&&a(this.currentDirection);return}this.updateAxis("x",t.point,n),this.updateAxis("y",t.point,n),this.visualElement.render(),r&&r(e,t)},l=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t,this.stop(e,t),this.latestPointerEvent=null,this.latestPanInfo=null},o=()=>iY(e=>"paused"===this.getAnimationState(e)&&this.getAxisMotionValue(e).animation?.play()),{dragSnapToOrigin:d}=this.getProps();this.panSession=new ai(e,{onSessionStart:a,onStart:r,onMove:n,onSessionEnd:l,resumeAnimation:o},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:d,distanceThreshold:s,contextWindow:ae(this.visualElement),element:this.visualElement.current})}stop(e,t){let s=e||this.latestPointerEvent,i=t||this.latestPanInfo,a=this.isDragging;if(this.cancel(),!a||!i||!s)return;let{velocity:r}=i;this.startAnimation(r);let{onDragEnd:n}=this.getProps();n&&eZ.postRender(()=>n(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||!ax(e,i,this.currentDirection))return;let a=this.getAxisMotionValue(e),r=this.originPoint[e]+s[e];this.constraints&&this.constraints[e]&&(r=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}(r,this.constraints[e],this.elastic[e])),a.set(r)}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:a}){return{x:ao(e.x,s,a),y:ao(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:ac(e,"left","right"),y:ac(e,"top","bottom")}}(t),i!==this.constraints&&s&&this.constraints&&!this.hasMutatedConstraints&&iY(e=>{var t,i;let a;!1!==this.constraints&&this.getAxisMotionValue(e)&&(this.constraints[e]=(t=s.layoutBox[e],i=this.constraints[e],a={},void 0!==i.min&&(a.min=i.min-t.min),void 0!==i.max&&(a.max=i.max-t.min),a))})}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:a}=this.visualElement;if(!a||!a.layout)return!1;let r=function(e,t,s){let i=t3(e,s),{scroll:a}=t;return a&&(t2(i.x,a.offset.x),t2(i.y,a.offset.y)),i}(i,a.root,this.visualElement.getTransformPagePoint()),n=(e=a.layout.layoutBox,{x:ad(e.x,r.x),y:ad(e.y,r.y)});if(s){let e=s(function({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}(n));this.hasMutatedConstraints=!!e,e&&(n=tH(e))}return n}startAnimation(e){let{drag:t,dragMomentum:s,dragElastic:i,dragTransition:a,dragSnapToOrigin:r,onDragTransitionEnd:n}=this.getProps(),l=this.constraints||{};return Promise.all(iY(n=>{if(!ax(n,t,this.currentDirection))return;let o=l&&l[n]||{};r&&(o={min:0,max:0});let d={type:"inertia",velocity:s?e[n]:0,bounceStiffness:i?200:1e6,bounceDamping:i?40:1e7,timeConstant:750,restDelta:1,restSpeed:10,...a,...o};return this.startAxisValueAnimation(n,d)})).then(n)}startAxisValueAnimation(e,t){let s=this.getAxisMotionValue(e);return sk(this.visualElement,e),s.start(i_(e,s,0,t,this.visualElement,!1))}stopAnimation(){iY(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){iY(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){iY(t=>{let{drag:s}=this.getProps();if(!ax(t,s,this.currentDirection))return;let{projection:i}=this.visualElement,a=this.getAxisMotionValue(t);if(i&&i.layout){let{min:s,max:r}=i.layout.layoutBox[t],n=a.get()||0;a.set(e[t]-tB(s,r,.5)+n)}})}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};iY(e=>{let t=this.getAxisMotionValue(e);if(t&&!1!==this.constraints){var s,a;let r,n,l,o=t.get();i[e]=(s={min:o,max:o},a=this.constraints[e],r=.5,n=i1(s),(l=i1(a))>n?r=ic(a.min,a.max-n,s.min):n>l&&(r=ic(s.min,s.max-l,a.min)),L(0,1,r))}});let{transformTemplate:a}=this.visualElement.getProps();this.visualElement.current.style.transform=a?a({},""):"none",s.root&&s.root.updateScroll(),s.updateLayout(),this.resolveConstraints(),iY(t=>{if(!ax(t,e,null))return;let s=this.getAxisMotionValue(t),{min:a,max:r}=this.constraints[t];s.set(tB(a,r,i[t]))})}addListeners(){if(!this.visualElement.current)return;ah.set(this.visualElement,this);let e=this.visualElement.current,t=i9(e,"pointerdown",t=>{let{drag:s,dragListener:i=!0}=this.getProps(),a=t.target,r=a!==e&&iJ(a);s&&i&&!r&&this.start(t)}),s=()=>{let{dragConstraints:e}=this.getProps();sy(e)&&e.current&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,a=i.addEventListener("measure",s);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),eZ.read(s);let r=iZ(window,"resize",()=>this.scalePositionWithinConstraints()),n=i.addEventListener("didUpdate",({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&(iY(t=>{let s=this.getAxisMotionValue(t);s&&(this.originPoint[t]+=e[t].translate,s.set(s.get()+e[t].translate))}),this.visualElement.render())});return()=>{r(),t(),a(),n&&n()}}getProps(){let e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:s=!1,dragPropagation:i=!1,dragConstraints:a=!1,dragElastic:r=.35,dragMomentum:n=!0}=e;return{...e,drag:t,dragDirectionLock:s,dragPropagation:i,dragConstraints:a,dragElastic:r,dragMomentum:n}}}function ax(e,t,s){return(!0===t||t===e)&&(null===s||s===e)}let ap=e=>(t,s)=>{e&&eZ.postRender(()=>e(t,s))},af={hasAnimatedSinceResize:!0,hasEverUpdated:!1};var ag=u;let ay=!1;class av extends ag.Component{componentDidMount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:s,layoutId:i}=this.props,{projection:a}=e;a&&(t.group&&t.group.add(a),s&&s.register&&i&&s.register(a),ay&&a.root.didUpdate(),a.addEventListener("animationComplete",()=>{this.safeToRemove()}),a.setOptions({...a.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),af.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){let{layoutDependency:t,visualElement:s,drag:i,isPresent:a}=this.props,{projection:r}=s;return r&&(r.isPresent=a,e.layoutDependency!==t&&r.setOptions({...r.options,layoutDependency:t}),ay=!0,i||e.layoutDependency!==t||void 0===t||e.isPresent!==a?r.willUpdate():this.safeToRemove(),e.isPresent!==a&&(a?r.promote():r.relegate()||eZ.postRender(()=>{let e=r.getStack();e&&e.members.length||this.safeToRemove()}))),null}componentDidUpdate(){let{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),tn.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:s}=this.props,{projection:i}=e;ay=!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 ab(e){let[t,s]=T(),i=(0,ag.useContext)(m);return(0,c.jsx)(av,{...e,layoutGroup:i,switchLayoutGroup:(0,ag.useContext)(sg),isPresent:t,safeToRemove:s})}function aj(e,t,s,i,a){return e-=t,e=i+1/s*(e-i),void 0!==a&&(e=i+1/a*(e-i)),e}function aw(e,t,[s,i,a],r,n){!function(e,t=0,s=1,i=.5,a,r=e,n=e){if(Q.test(t)&&(t=parseFloat(t),t=tB(n.min,n.max,t/100)-n.min),"number"!=typeof t)return;let l=tB(r.min,r.max,i);e===r&&(l-=t),e.min=aj(e.min,t,s,l,a),e.max=aj(e.max,t,s,l,a)}(e,t[s],t[i],t[a],t.scale,r,n)}let aN=["x","scaleX","originX"],ak=["y","scaleY","originY"];function aS(e,t,s,i){aw(e.x,t,aN,s?s.x:void 0,i?i.x:void 0),aw(e.y,t,ak,s?s.y:void 0,i?i.y:void 0)}function aC(e,t){e.min=t.min,e.max=t.max}function aT(e,t){aC(e.x,t.x),aC(e.y,t.y)}function aP(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function aA(e){return 0===e.translate&&1===e.scale}function aM(e){return aA(e.x)&&aA(e.y)}function aE(e,t){return e.min===t.min&&e.max===t.max}function aD(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function aL(e,t){return aD(e.x,t.x)&&aD(e.y,t.y)}function aF(e){return i1(e.x)/i1(e.y)}function aR(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}let aV=["TopLeft","TopRight","BottomLeft","BottomRight"],a$=aV.length,az=e=>"string"==typeof e?parseFloat(e):e,a_=e=>"number"==typeof e||H.test(e);function aI(e,t){return void 0!==e[t]?e[t]:e.borderRadius}let aO=aU(0,.5,ia),aB=aU(.5,.95,eX);function aU(e,t,s){return i=>i<e?0:i>t?1:s(ic(e,t,i))}function aq(e){return y(e)&&"ownerSVGElement"in e}let aW=(e,t)=>e.depth-t.depth;class aK{constructor(){this.children=[],this.isDirty=!1}add(e){ti(this.children,e),this.isDirty=!0}remove(e){ta(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(aW),this.isDirty=!1,this.children.forEach(e)}}class aQ{constructor(){this.members=[]}add(e){ti(this.members,e),e.scheduleRender()}remove(e){if(ta(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,a=e.options.layoutDependency;(void 0===i||void 0===a||i!==a)&&(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:r}=e.options;!1===r&&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 aH=["","X","Y","Z"],aX=0;function aY(e,t,s,i){let{latestValues:a}=t;a[e]&&(s[e]=a[e],t.setStaticValue(e,0),i&&(i[e]=0))}function aG({attachResizeListener:e,defaultParent:t,measureScroll:s,checkIsScrollRoot:i,resetTransform:a}){return class{constructor(e={},s=t?.()){this.id=aX++,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(a0),this.nodes.forEach(a8),this.nodes.forEach(a7),this.nodes.forEach(a1)},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 aK)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new tr),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=aq(t)&&!(aq(t)&&"svg"===t.tagName),this.instance=t;let{layoutId:s,layout:i,visualElement:a}=this.options;if(a&&!a.current&&a.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,a=()=>this.root.updateBlockedByResize=!1;eZ.read(()=>{i=window.innerWidth}),e(t,()=>{let e=window.innerWidth;if(e!==i){let t,r;i=e,this.root.updateBlockedByResize=!0,s&&s(),t=to.now(),r=({timestamp:e})=>{let s=e-t;s>=250&&(e0(r),a(s-250))},eZ.setup(r,!0),s=()=>e0(r),af.hasAnimatedSinceResize&&(af.hasAnimatedSinceResize=!1,this.nodes.forEach(a6))}})}s&&this.root.registerSharedNode(s,this),!1!==this.options.animate&&a&&(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 r=this.options.transition||a.getDefaultTransition()||ra,{onLayoutAnimationStart:n,onLayoutAnimationComplete:l}=a.getProps(),o=!this.targetLayout||!aL(this.targetLayout,i),d=!t&&s;if(this.options.layoutRoot||this.resumeFrom||d||t&&(o||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);let t={...sw(r,"layout"),onPlay:n,onComplete:l};(a.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t),this.setAnimationOrigin(e,d)}else t||a6(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(a9),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:a}=t;a&&!a.hasCheckedOptimisedAppear&&e(a)}(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(a5);return}if(this.animationId<=this.animationCommitId)return void this.nodes.forEach(a4);this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(a3),this.nodes.forEach(aJ),this.nodes.forEach(aZ)):this.nodes.forEach(a4),this.clearAllSnapshots();let e=to.now();e1.delta=L(0,1e3/60,e-e1.timestamp),e1.timestamp=e,e1.isProcessing=!0,e2.update.process(e1),e2.preRender.process(e1),e2.render.process(e1),e1.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,tn.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(a2),this.sharedNodes.forEach(re)}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(!a)return;let e=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,t=this.projectionDelta&&!aM(this.projectionDelta),s=this.getTransformTemplate(),i=s?s(this.latestValues,""):void 0,r=i!==this.prevTransformTemplateValue;e&&this.instance&&(t||tG(this.latestValues)||r)&&(a(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)),rl((t=i).x),rl(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(rd))){let{scroll:e}=this.root;e&&(t2(t.x,e.offset.x),t2(t.y,e.offset.y))}return t}removeElementScroll(e){let t=eb();if(aT(t,e),this.scroll?.wasRoot)return t;for(let s=0;s<this.path.length;s++){let i=this.path[s],{scroll:a,options:r}=i;i!==this.root&&a&&r.layoutScroll&&(a.wasRoot&&aT(t,e),t2(t.x,a.offset.x),t2(t.y,a.offset.y))}return t}applyTransform(e,t=!1){let s=eb();aT(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}),tG(i.latestValues)&&t4(s,i.latestValues)}return tG(this.latestValues)&&t4(s,this.latestValues),s}removeTransform(e){let t=eb();aT(t,e);for(let e=0;e<this.path.length;e++){let s=this.path[e];if(!s.instance||!tG(s.latestValues))continue;tY(s.latestValues)&&s.updateSnapshot();let i=eb();aT(i,s.measurePageBox()),aS(t,s.latestValues,s.snapshot?s.snapshot.layoutBox:void 0,i)}return tG(this.latestValues)&&aS(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:a}=this.options;if(!this.layout||!(i||a))return;this.resolvedRelativeTargetAt=e1.timestamp;let r=this.getClosestProjectingParent();if(r&&this.linkedParentVersion!==r.layoutVersion&&!r.options.layoutRoot&&this.removeRelativeTarget(),this.targetDelta||this.relativeTarget||(r&&r.layout?this.createRelativeTarget(r,this.layout.layoutBox,r.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 n,l,o;this.forceRelativeParentToResolveTarget(),n=this.target,l=this.relativeTarget,o=this.relativeParent.target,i4(n.x,l.x,o.x),i4(n.y,l.y,o.y)}else this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):aT(this.target,this.layout.layoutBox),t1(this.target,this.targetDelta)):aT(this.target,this.layout.layoutBox);this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,r&&!!r.resumingFrom==!!this.resumingFrom&&!r.options.layoutScroll&&r.target&&1!==this.animationProgress?this.createRelativeTarget(r,this.target,r.target):this.relativeParent=this.relativeTarget=void 0)}}getClosestProjectingParent(){if(!(!this.parent||tY(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),aT(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:a}=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||a))return;aT(this.layoutCorrected,this.layout.layoutBox);let r=this.treeScale.x,n=this.treeScale.y;!function(e,t,s,i=!1){let a,r,n=s.length;if(n){t.x=t.y=1;for(let l=0;l<n;l++){r=(a=s[l]).projectionDelta;let{visualElement:n}=a.options;(!n||!n.props.style||"contents"!==n.props.style.display)&&(i&&a.options.layoutScroll&&a.scroll&&a!==a.root&&t4(e,{x:-a.scroll.offset.x,y:-a.scroll.offset.y}),r&&(t.x*=r.x.scale,t.y*=r.y.scale,t1(e,r)),i&&tG(a.latestValues)&&t4(e,a.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:l}=e;if(!l){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}this.projectionDelta&&this.prevProjectionDelta?(aP(this.prevProjectionDelta.x,this.projectionDelta.x),aP(this.prevProjectionDelta.y,this.projectionDelta.y)):this.createProjectionDeltas(),i5(this.projectionDelta,this.layoutCorrected,l,this.latestValues),this.treeScale.x===r&&this.treeScale.y===n&&aR(this.projectionDelta.x,this.prevProjectionDelta.x)&&aR(this.projectionDelta.y,this.prevProjectionDelta.y)||(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",l))}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,a=i?i.latestValues:{},r={...this.latestValues},n=ey();this.relativeParent&&this.relativeParent.options.layoutRoot||(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;let l=eb(),o=(i?i.source:void 0)!==(this.layout?this.layout.source:void 0),d=this.getStack(),c=!d||d.members.length<=1,u=!!(o&&!c&&!0===this.options.crossfade&&!this.path.some(ri));this.animationProgress=0,this.mixTargetDelta=t=>{let i=t/1e3;if(rt(n.x,e.x,i),rt(n.y,e.y,i),this.setTargetDelta(n),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout){var d,h,m,x,p,f;i6(l,this.layout.layoutBox,this.relativeParent.layout.layoutBox),m=this.relativeTarget,x=this.relativeTargetOrigin,p=l,f=i,rs(m.x,x.x,p.x,f),rs(m.y,x.y,p.y,f),s&&(d=this.relativeTarget,h=s,aE(d.x,h.x)&&aE(d.y,h.y))&&(this.isProjectionDirty=!1),s||(s=eb()),aT(s,this.relativeTarget)}o&&(this.animationValues=r,function(e,t,s,i,a,r){a?(e.opacity=tB(0,s.opacity??1,aO(i)),e.opacityExit=tB(t.opacity??1,0,aB(i))):r&&(e.opacity=tB(t.opacity??1,s.opacity??1,i));for(let a=0;a<a$;a++){let r=`border${aV[a]}Radius`,n=aI(t,r),l=aI(s,r);(void 0!==n||void 0!==l)&&(n||(n=0),l||(l=0),0===n||0===l||a_(n)===a_(l)?(e[r]=Math.max(tB(az(n),az(l),i),0),(Q.test(l)||Q.test(n))&&(e[r]+="%")):e[r]=l)}(t.rotate||s.rotate)&&(e.rotate=tB(t.rotate||0,s.rotate||0,i))}(r,a,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 a;af.hasAnimatedSinceResize=!0,sP.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:()=>{sP.layout--},onComplete:()=>{sP.layout--,e.onComplete&&e.onComplete(),this.completeAnimation()}},(a=ej(t)?t:tc(t)).start(i_("",a,s,i)),a.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:a}=e;if(t&&s&&i){if(this!==e&&this.layout&&i&&ro(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}aT(t,s),t4(t,a),i5(this.projectionDeltaWithTransform,this.layoutCorrected,t,a)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new aQ),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&&aY("z",e,i,this.animationValues);for(let t=0;t<aH.length;t++)aY(`rotate${aH[t]}`,e,i,this.animationValues),aY(`skew${aH[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=so(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=so(t?.pointerEvents)||""),this.hasProjected&&!tG(this.latestValues)&&(e.transform=s?s({},""):"none",this.hasProjected=!1);return}e.visibility="";let a=i.animationValues||i.latestValues;this.applyTransformsToTarget();let r=function(e,t,s){let i="",a=e.x.translate/t.x,r=e.y.translate/t.y,n=s?.z||0;if((a||r||n)&&(i=`translate3d(${a}px, ${r}px, ${n}px) `),(1!==t.x||1!==t.y)&&(i+=`scale(${1/t.x}, ${1/t.y}) `),s){let{transformPerspective:e,rotate:t,rotateX:a,rotateY:r,skewX:n,skewY:l}=s;e&&(i=`perspective(${e}px) ${i}`),t&&(i+=`rotate(${t}deg) `),a&&(i+=`rotateX(${a}deg) `),r&&(i+=`rotateY(${r}deg) `),n&&(i+=`skewX(${n}deg) `),l&&(i+=`skewY(${l}deg) `)}let l=e.x.scale*t.x,o=e.y.scale*t.y;return(1!==l||1!==o)&&(i+=`scale(${l}, ${o})`),i||"none"}(this.projectionDeltaWithTransform,this.treeScale,a);s&&(r=s(a,r)),e.transform=r;let{x:n,y:l}=this.projectionDelta;for(let t in e.transformOrigin=`${100*n.origin}% ${100*l.origin}% 0`,i.animationValues?e.opacity=i===this?a.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:a.opacityExit:e.opacity=i===this?void 0!==a.opacity?a.opacity:"":void 0!==a.opacityExit?a.opacityExit:0,tU){if(void 0===a[t])continue;let{correct:s,applyTo:n,isCSSVariable:l}=tU[t],o="none"===r?a[t]:s(a[t],i);if(n){let t=n.length;for(let s=0;s<t;s++)e[n[s]]=o}else l?this.options.visualElement.renderState.vars[t]=o:e[t]=o}this.options.layoutId&&(e.pointerEvents=i===this?so(t?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(e=>e.currentAnimation?.stop()),this.root.nodes.forEach(a5),this.root.sharedNodes.clear()}}}function aJ(e){e.updateLayout()}function aZ(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:a}=e.options,r=t.source!==e.layout.source;"size"===a?iY(e=>{let i=r?t.measuredBox[e]:t.layoutBox[e],a=i1(i);i.min=s[e].min,i.max=i.min+a}):ro(a,t.layoutBox,s)&&iY(i=>{let a=r?t.measuredBox[i]:t.layoutBox[i],n=i1(s[i]);a.max=a.min+n,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[i].max=e.relativeTarget[i].min+n)});let n=ey();i5(n,s,t.layoutBox);let l=ey();r?i5(l,e.applyTransform(i,!0),t.measuredBox):i5(l,s,t.layoutBox);let o=!aM(n),d=!1;if(!e.resumeFrom){let i=e.getClosestProjectingParent();if(i&&!i.resumeFrom){let{snapshot:a,layout:r}=i;if(a&&r){let n=eb();i6(n,t.layoutBox,a.layoutBox);let l=eb();i6(l,s,r.layoutBox),aL(n,l)||(d=!0),i.options.layoutRoot&&(e.relativeTarget=l,e.relativeTargetOrigin=n,e.relativeParent=i)}}}e.notifyListeners("didUpdate",{layout:s,snapshot:t,delta:l,layoutDelta:n,hasLayoutChanged:o,hasRelativeLayoutChanged:d})}else if(e.isLead()){let{onExitComplete:t}=e.options;t&&t()}e.options.transition=void 0}function a0(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 a1(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function a2(e){e.clearSnapshot()}function a5(e){e.clearMeasurements()}function a4(e){e.isLayoutDirty=!1}function a3(e){let{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function a6(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function a8(e){e.resolveTargetDelta()}function a7(e){e.calcProjection()}function a9(e){e.resetSkewAndRotation()}function re(e){e.removeLeadSnapshot()}function rt(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 rs(e,t,s,i){e.min=tB(t.min,s.min,i),e.max=tB(t.max,s.max,i)}function ri(e){return e.animationValues&&void 0!==e.animationValues.opacityExit}let ra={duration:.45,ease:[.4,0,.1,1]},rr=e=>"u">typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),rn=rr("applewebkit/")&&!rr("chrome/")?Math.round:eX;function rl(e){e.min=rn(e.min),e.max=rn(e.max)}function ro(e,t,s){return"position"===e||"preserve-aspect"===e&&!(.2>=Math.abs(aF(t)-aF(s)))}function rd(e){return e!==e.root&&e.scroll?.wasRoot}let rc=aG({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}),ru={current:void 0},rh=aG({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!ru.current){let e=new rc({});e.mount(window),e.setOptions({layoutScroll:!0}),ru.current=e}return ru.current},resetTransform:(e,t)=>{e.style.transform=void 0!==t?t:"none"},checkIsScrollRoot:e=>"fixed"===window.getComputedStyle(e).position});function rm(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 rx(e){return!("touch"===e.pointerType||i0.x||i0.y)}function rp(e,t,s){let{props:i}=e;e.animationState&&i.whileHover&&e.animationState.setActive("whileHover","Start"===s);let a=i["onHover"+s];a&&eZ.postRender(()=>a(t,i7(t)))}let rf=(e,t)=>!!t&&(e===t||rf(e,t.parentElement)),rg=new WeakSet;function ry(e){return t=>{"Enter"===t.key&&e(t)}}function rv(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}function rb(e){return i8(e)&&!(i0.x||i0.y)}function rj(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 a=i["onTap"+("End"===s?"":s)];a&&eZ.postRender(()=>a(t,i7(t)))}let rw=new WeakMap,rN=new WeakMap,rk=e=>{let t=rw.get(e.target);t&&t(e)},rS=e=>{e.forEach(rk)},rC={some:0,all:1},rT=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:(a,r)=>"create"===r?i:(s.has(r)||s.set(r,sv(r,void 0,e,t)),s.get(r))})}({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 a="function"==typeof t?sj(e,t,s.custom):t;i=Promise.all(iI(e,a,s))}return i.then(()=>{e.notify("AnimationComplete",t)})})(e,t,s))),s=iH(),i=!0,a=t=>(s,i)=>{let a=sj(e,i,"exit"===t?e.presenceContext?.custom:void 0);if(a){let{transition:e,transitionEnd:t,...i}=a;s={...s,...i,...t}}return s};function r(r){let{props:n}=e,l=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],a=t.props[i];(tg(a)||!1===a)&&(s[i]=a)}return s}(e.parent)||{},o=[],d=new Set,c={},u=1/0;for(let t=0;t<iK;t++){var h,m;let x=iW[t],p=s[x],f=void 0!==n[x]?n[x]:l[x],g=tg(f),y=x===r?p.isActive:null;!1===y&&(u=t);let v=f===l[x]&&f!==n[x]&&g;if(v&&i&&e.manuallyAnimateOnMount&&(v=!1),p.protectedKeys={...c},!p.isActive&&null===y||!f&&!p.prevProp||tf(f)||"boolean"==typeof f)continue;let b=(h=p.prevProp,"string"==typeof(m=f)?m!==h:!!Array.isArray(m)&&!iq(m,h)),j=b||x===r&&p.isActive&&!v&&g||t>u&&g,w=!1,N=Array.isArray(f)?f:[f],k=N.reduce(a(x),{});!1===y&&(k={});let{prevResolvedValues:S={}}=p,C={...S,...k},T=t=>{j=!0,d.has(t)&&(w=!0,d.delete(t)),p.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)?iq(t,s):t===s)?void 0!==t&&d.has(e)?T(e):p.protectedKeys[e]=!0:null!=t?T(e):d.add(e)}p.prevProp=f,p.prevResolvedValues=k,p.isActive&&(c={...c,...k}),i&&e.blockInitialAnimation&&(j=!1);let P=v&&b,A=!P||w;j&&A&&o.push(...N.map(t=>{let s={type:x};if("string"==typeof t&&i&&!P&&e.manuallyAnimateOnMount&&e.parent){let{parent:i}=e,a=sj(i,t);if(i.enteringChildren&&a){let{delayChildren:t}=a.transition||{};s.delay=iO(i.enteringChildren,e,t)}}return{animation:t,options:s}}))}if(d.size){let t={};if("boolean"!=typeof n.initial){let s=sj(e,Array.isArray(n.initial)?n.initial[0]:n.initial);s&&s.transition&&(t.transition=s.transition)}d.forEach(s=>{let i=e.getBaseTarget(s),a=e.getValue(s);a&&(a.liveStyle=!0),t[s]=i??null}),o.push({animation:t})}let x=!!o.length;return i&&(!1===n.initial||n.initial===n.animate)&&!e.manuallyAnimateOnMount&&(x=!1),i=!1,x?t(o):Promise.resolve()}return{animateChanges:r,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 a=r(t);for(let e in s)s[e].protectedKeys={};return a},setAnimateFunction:function(s){t=s(e)},getState:()=>s,reset:()=>{s=iH()}}}(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:a,amount:r="some",once:n}=s,l={root:i?i.current:void 0,rootMargin:a,threshold:"number"==typeof r?r:rC[r]},o=e=>{let{isIntersecting:t}=e;if(this.isInView===t||(this.isInView=t,n&&!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(),a=t?s:i;a&&a(e)};return e=this.node.current,t=function({root:e,...t}){let s=e||document;rN.has(s)||rN.set(s,{});let i=rN.get(s),a=JSON.stringify(t);return i[a]||(i[a]=new IntersectionObserver(rS,{root:e,...t})),i[a]}(l),rw.set(e,o),t.observe(e),()=>{rw.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,a,r]=rm(e,s),n=e=>{let i=e.currentTarget;if(!rb(e))return;rg.add(i);let r=t(i,e),n=(e,t)=>{window.removeEventListener("pointerup",l),window.removeEventListener("pointercancel",o),rg.has(i)&&rg.delete(i),rb(e)&&"function"==typeof r&&r(e,{success:t})},l=e=>{n(e,i===window||i===document||s.useGlobalTarget||rf(i,e.target))},o=e=>{n(e,!1)};window.addEventListener("pointerup",l,a),window.addEventListener("pointercancel",o,a)};return i.forEach(e=>{(s.useGlobalTarget?window:e).addEventListener("pointerdown",n,a),v(e)&&(e.addEventListener("focus",e=>((e,t)=>{let s=e.currentTarget;if(!s)return;let i=ry(()=>{if(rg.has(s))return;rv(s,"down");let e=ry(()=>{rv(s,"up")});s.addEventListener("keyup",e,t),s.addEventListener("blur",()=>rv(s,"cancel"),t)});s.addEventListener("keydown",i,t),s.addEventListener("blur",()=>s.removeEventListener("keydown",i),t)})(e,a)),iJ(e)||e.hasAttribute("tabindex")||(e.tabIndex=0))}),r}(e,(e,t)=>(rj(this.node,t,"Start"),(e,{success:t})=>rj(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,a,r]=rm(e,s),n=e=>{if(!rx(e))return;let{target:s}=e,i=t(s,e);if("function"!=typeof i||!s)return;let r=e=>{rx(e)&&(i(e),s.removeEventListener("pointerleave",r))};s.addEventListener("pointerleave",r,a)};return i.forEach(e=>{e.addEventListener("pointerenter",n,a)}),r}(e,(e,t)=>(rp(this.node,t,"Start"),e=>rp(this.node,e,"End"))))}unmount(){}}},pan:{Feature:class extends sb{constructor(){super(...arguments),this.removePointerDownListener=eX}onPointerDown(e){this.session=new ai(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:ae(this.node)})}createPanHandlers(){let{onPanSessionStart:e,onPanStart:t,onPan:s,onPanEnd:i}=this.node.getProps();return{onSessionStart:ap(e),onStart:ap(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 am(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:rh,MeasureLayout:ab},layout:{ProjectionNode:rh,MeasureLayout:ab}},(e,t)=>t.isSVG??t7(e)?new tQ(t):new t6(t,{allowProjection:e!==u.Fragment}));var rP=e.i(74133),rA=e.i(88069),rM=e.i(42098);function rE(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 rD=e.i(45688),rL=e.i(88969);let rF=h.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";async function rR(e){if(!e||e.length<2)return[];let t=await (0,rL.authFetch)(`${rF}/api/suggestions?q=${encodeURIComponent(e)}&limit=8`);if(!t.ok)throw Error("Failed to fetch suggestions");return(await t.json()).suggestions}function rV(){for(var e,t,s=0,i="",a=arguments.length;s<a;s++)(e=arguments[s])&&(t=function e(t){var s,i,a="";if("string"==typeof t||"number"==typeof t)a+=t;else if("object"==typeof t)if(Array.isArray(t)){var r=t.length;for(s=0;s<r;s++)t[s]&&(i=e(t[s]))&&(a&&(a+=" "),a+=i)}else for(i in t)t[i]&&(a&&(a+=" "),a+=i);return a}(e))&&(i&&(i+=" "),i+=t);return i}let r$=(e=new Map,t=null,s)=>({nextPart:e,validators:t,classGroupId:s}),rz=[],r_=(e,t,s)=>{if(0==e.length-t)return s.classGroupId;let i=e[t],a=s.nextPart.get(i);if(a){let s=r_(e,t+1,a);if(s)return s}let r=s.validators;if(null===r)return;let n=0===t?e.join("-"):e.slice(t).join("-"),l=r.length;for(let e=0;e<l;e++){let t=r[e];if(t.validator(n))return t.classGroupId}},rI=(e,t)=>{let s=r$();for(let i in e)rO(e[i],s,i,t);return s},rO=(e,t,s,i)=>{let a=e.length;for(let r=0;r<a;r++)rB(e[r],t,s,i)},rB=(e,t,s,i)=>{"string"==typeof e?rU(e,t,s):"function"==typeof e?rq(e,t,s,i):rW(e,t,s,i)},rU=(e,t,s)=>{(""===e?t:rK(t,e)).classGroupId=s},rq=(e,t,s,i)=>{rQ(e)?rO(e(i),t,s,i):(null===t.validators&&(t.validators=[]),t.validators.push({classGroupId:s,validator:e}))},rW=(e,t,s,i)=>{let a=Object.entries(e),r=a.length;for(let e=0;e<r;e++){let[r,n]=a[e];rO(n,rK(t,r),s,i)}},rK=(e,t)=>{let s=e,i=t.split("-"),a=i.length;for(let e=0;e<a;e++){let t=i[e],a=s.nextPart.get(t);a||(a=r$(),s.nextPart.set(t,a)),s=a}return s},rQ=e=>"isThemeGetter"in e&&!0===e.isThemeGetter,rH=[],rX=(e,t,s,i,a)=>({modifiers:e,hasImportantModifier:t,baseClassName:s,maybePostfixModifierPosition:i,isExternal:a}),rY=/\s+/,rG=e=>{let t;if("string"==typeof e)return e;let s="";for(let i=0;i<e.length;i++)e[i]&&(t=rG(e[i]))&&(s&&(s+=" "),s+=t);return s},rJ=[],rZ=e=>{let t=t=>t[e]||rJ;return t.isThemeGetter=!0,t},r0=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,r1=/^\((?:(\w[\w-]*):)?(.+)\)$/i,r2=/^\d+\/\d+$/,r5=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,r4=/\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$/,r3=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,r6=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,r8=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,r7=e=>r2.test(e),r9=e=>!!e&&!Number.isNaN(Number(e)),ne=e=>!!e&&Number.isInteger(Number(e)),nt=e=>e.endsWith("%")&&r9(e.slice(0,-1)),ns=e=>r5.test(e),ni=()=>!0,na=e=>r4.test(e)&&!r3.test(e),nr=()=>!1,nn=e=>r6.test(e),nl=e=>r8.test(e),no=e=>!nc(e)&&!nf(e),nd=e=>nN(e,nT,nr),nc=e=>r0.test(e),nu=e=>nN(e,nP,na),nh=e=>nN(e,nA,r9),nm=e=>nN(e,nS,nr),nx=e=>nN(e,nC,nl),np=e=>nN(e,nE,nn),nf=e=>r1.test(e),ng=e=>nk(e,nP),ny=e=>nk(e,nM),nv=e=>nk(e,nS),nb=e=>nk(e,nT),nj=e=>nk(e,nC),nw=e=>nk(e,nE,!0),nN=(e,t,s)=>{let i=r0.exec(e);return!!i&&(i[1]?t(i[1]):s(i[2]))},nk=(e,t,s=!1)=>{let i=r1.exec(e);return!!i&&(i[1]?t(i[1]):s)},nS=e=>"position"===e||"percentage"===e,nC=e=>"image"===e||"url"===e,nT=e=>"length"===e||"size"===e||"bg-size"===e,nP=e=>"length"===e,nA=e=>"number"===e,nM=e=>"family-name"===e,nE=e=>"shadow"===e,nD=((e,...t)=>{let s,i,a,r,n=e=>{let t=i(e);if(t)return t;let r=((e,t)=>{let{parseClassName:s,getClassGroupId:i,getConflictingClassGroupIds:a,sortModifiers:r}=t,n=[],l=e.trim().split(rY),o="";for(let e=l.length-1;e>=0;e-=1){let t=l[e],{isExternal:d,modifiers:c,hasImportantModifier:u,baseClassName:h,maybePostfixModifierPosition:m}=s(t);if(d){o=t+(o.length>0?" "+o:o);continue}let x=!!m,p=i(x?h.substring(0,m):h);if(!p){if(!x||!(p=i(h))){o=t+(o.length>0?" "+o:o);continue}x=!1}let f=0===c.length?"":1===c.length?c[0]:r(c).join(":"),g=u?f+"!":f,y=g+p;if(n.indexOf(y)>-1)continue;n.push(y);let v=a(p,x);for(let e=0;e<v.length;++e){let t=v[e];n.push(g+t)}o=t+(o.length>0?" "+o:o)}return o})(e,s);return a(e,r),r};return r=l=>{var o;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),a=(a,r)=>{s[a]=r,++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])?(a(e,t),t):void 0},set(e,t){e in s?s[e]=t:a(e,t)}}})((o=t.reduce((e,t)=>t(e),e())).cacheSize),parseClassName:(e=>{let{prefix:t,experimentalParseClassName:s}=e,i=e=>{let t,s=[],i=0,a=0,r=0,n=e.length;for(let l=0;l<n;l++){let n=e[l];if(0===i&&0===a){if(":"===n){s.push(e.slice(r,l)),r=l+1;continue}if("/"===n){t=l;continue}}"["===n?i++:"]"===n?i--:"("===n?a++:")"===n&&a--}let l=0===s.length?e:e.slice(r),o=l,d=!1;return l.endsWith("!")?(o=l.slice(0,-1),d=!0):l.startsWith("!")&&(o=l.slice(1),d=!0),rX(s,d,o,t&&t>r?t-r:void 0)};if(t){let e=t+":",s=i;i=t=>t.startsWith(e)?s(t.slice(e.length)):rX(rH,!1,t,void 0,!0)}if(s){let e=i;i=t=>s({className:t,parseClassName:e})}return i})(o),sortModifiers:(d=new Map,o.orderSensitiveModifiers.forEach((e,t)=>{d.set(e,1e6+t)}),e=>{let t=[],s=[];for(let i=0;i<e.length;i++){let a=e[i],r="["===a[0],n=d.has(a);r||n?(s.length>0&&(s.sort(),t.push(...s),s=[]),t.push(a)):s.push(a)}return s.length>0&&(s.sort(),t.push(...s)),t}),...(e=>{let t=(e=>{let{theme:t,classGroups:s}=e;return rI(s,t)})(e),{conflictingClassGroups:s,conflictingClassGroupModifiers:i}=e;return{getClassGroupId:e=>{if(e.startsWith("[")&&e.endsWith("]")){var s;let t,i,a;return -1===(s=e).slice(1,-1).indexOf(":")?void 0:(i=(t=s.slice(1,-1)).indexOf(":"),(a=t.slice(0,i))?"arbitrary.."+a:void 0)}let i=e.split("-"),a=+(""===i[0]&&i.length>1);return r_(i,a,t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=i[e],a=s[e];if(t){if(a){let e=Array(a.length+t.length);for(let t=0;t<a.length;t++)e[t]=a[t];for(let s=0;s<t.length;s++)e[a.length+s]=t[s];return e}return t}return a||rz}return s[e]||rz}}})(o)}).cache.get,a=s.cache.set,r=n,n(l)},(...e)=>r(((...e)=>{let t,s,i=0,a="";for(;i<e.length;)(t=e[i++])&&(s=rG(t))&&(a&&(a+=" "),a+=s);return a})(...e))})(()=>{let e=rZ("color"),t=rZ("font"),s=rZ("text"),i=rZ("font-weight"),a=rZ("tracking"),r=rZ("leading"),n=rZ("breakpoint"),l=rZ("container"),o=rZ("spacing"),d=rZ("radius"),c=rZ("shadow"),u=rZ("inset-shadow"),h=rZ("text-shadow"),m=rZ("drop-shadow"),x=rZ("blur"),p=rZ("perspective"),f=rZ("aspect"),g=rZ("ease"),y=rZ("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(),nf,nc],w=()=>["auto","hidden","clip","visible","scroll"],N=()=>["auto","contain","none"],k=()=>[nf,nc,o],S=()=>[r7,"full","auto",...k()],C=()=>[ne,"none","subgrid",nf,nc],T=()=>["auto",{span:["full",ne,nf,nc]},ne,nf,nc],P=()=>[ne,"auto",nf,nc],A=()=>["auto","min","max","fr",nf,nc],M=()=>["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=()=>[r7,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...k()],F=()=>[e,nf,nc],R=()=>[...b(),nv,nm,{position:[nf,nc]}],V=()=>["no-repeat",{repeat:["","x","y","space","round"]}],$=()=>["auto","cover","contain",nb,nd,{size:[nf,nc]}],z=()=>[nt,ng,nu],_=()=>["","none","full",d,nf,nc],I=()=>["",r9,ng,nu],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=()=>[r9,nt,nv,nm],q=()=>["","none",x,nf,nc],W=()=>["none",r9,nf,nc],K=()=>["none",r9,nf,nc],Q=()=>[r9,nf,nc],H=()=>[r7,"full",...k()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ns],breakpoint:[ns],color:[ni],container:[ns],"drop-shadow":[ns],ease:["in","out","in-out"],font:[no],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ns],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ns],shadow:[ns],spacing:["px",r9],text:[ns],"text-shadow":[ns],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",r7,nc,nf,f]}],container:["container"],columns:[{columns:[r9,nc,nf,l]}],"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:[ne,"auto",nf,nc]}],basis:[{basis:[r7,"full","auto",l,...k()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[r9,r7,"auto","initial","none",nc]}],grow:[{grow:["",r9,nf,nc]}],shrink:[{shrink:["",r9,nf,nc]}],order:[{order:[ne,"first","last","none",nf,nc]}],"grid-cols":[{"grid-cols":C()}],"col-start-end":[{col:T()}],"col-start":[{"col-start":P()}],"col-end":[{"col-end":P()}],"grid-rows":[{"grid-rows":C()}],"row-start-end":[{row:T()}],"row-start":[{"row-start":P()}],"row-end":[{"row-end":P()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":A()}],"auto-rows":[{"auto-rows":A()}],gap:[{gap:k()}],"gap-x":[{"gap-x":k()}],"gap-y":[{"gap-y":k()}],"justify-content":[{justify:[...M(),"normal"]}],"justify-items":[{"justify-items":[...E(),"normal"]}],"justify-self":[{"justify-self":["auto",...E()]}],"align-content":[{content:["normal",...M()]}],"align-items":[{items:[...E(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...E(),{baseline:["","last"]}]}],"place-content":[{"place-content":M()}],"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:[l,"screen",...L()]}],"min-w":[{"min-w":[l,"screen","none",...L()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[n]},...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,ng,nu]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[i,nf,nh]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",nt,nc]}],"font-family":[{font:[ny,nc,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:[a,nf,nc]}],"line-clamp":[{"line-clamp":[r9,"none",nf,nh]}],leading:[{leading:[r,...k()]}],"list-image":[{"list-image":["none",nf,nc]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",nf,nc]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:F()}],"text-color":[{text:F()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...O(),"wavy"]}],"text-decoration-thickness":[{decoration:[r9,"from-font","auto",nf,nu]}],"text-decoration-color":[{decoration:F()}],"underline-offset":[{"underline-offset":[r9,"auto",nf,nc]}],"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",nf,nc]}],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",nf,nc]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:R()}],"bg-repeat":[{bg:V()}],"bg-size":[{bg:$()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},ne,nf,nc],radial:["",nf,nc],conic:[ne,nf,nc]},nj,nx]}],"bg-color":[{bg:F()}],"gradient-from-pos":[{from:z()}],"gradient-via-pos":[{via:z()}],"gradient-to-pos":[{to:z()}],"gradient-from":[{from:F()}],"gradient-via":[{via:F()}],"gradient-to":[{to:F()}],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:F()}],"border-color-x":[{"border-x":F()}],"border-color-y":[{"border-y":F()}],"border-color-s":[{"border-s":F()}],"border-color-e":[{"border-e":F()}],"border-color-t":[{"border-t":F()}],"border-color-r":[{"border-r":F()}],"border-color-b":[{"border-b":F()}],"border-color-l":[{"border-l":F()}],"divide-color":[{divide:F()}],"outline-style":[{outline:[...O(),"none","hidden"]}],"outline-offset":[{"outline-offset":[r9,nf,nc]}],"outline-w":[{outline:["",r9,ng,nu]}],"outline-color":[{outline:F()}],shadow:[{shadow:["","none",c,nw,np]}],"shadow-color":[{shadow:F()}],"inset-shadow":[{"inset-shadow":["none",u,nw,np]}],"inset-shadow-color":[{"inset-shadow":F()}],"ring-w":[{ring:I()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:F()}],"ring-offset-w":[{"ring-offset":[r9,nu]}],"ring-offset-color":[{"ring-offset":F()}],"inset-ring-w":[{"inset-ring":I()}],"inset-ring-color":[{"inset-ring":F()}],"text-shadow":[{"text-shadow":["none",h,nw,np]}],"text-shadow-color":[{"text-shadow":F()}],opacity:[{opacity:[r9,nf,nc]}],"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":[r9]}],"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":F()}],"mask-image-linear-to-color":[{"mask-linear-to":F()}],"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":F()}],"mask-image-t-to-color":[{"mask-t-to":F()}],"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":F()}],"mask-image-r-to-color":[{"mask-r-to":F()}],"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":F()}],"mask-image-b-to-color":[{"mask-b-to":F()}],"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":F()}],"mask-image-l-to-color":[{"mask-l-to":F()}],"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":F()}],"mask-image-x-to-color":[{"mask-x-to":F()}],"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":F()}],"mask-image-y-to-color":[{"mask-y-to":F()}],"mask-image-radial":[{"mask-radial":[nf,nc]}],"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":F()}],"mask-image-radial-to-color":[{"mask-radial-to":F()}],"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":[r9]}],"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":F()}],"mask-image-conic-to-color":[{"mask-conic-to":F()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:R()}],"mask-repeat":[{mask:V()}],"mask-size":[{mask:$()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",nf,nc]}],filter:[{filter:["","none",nf,nc]}],blur:[{blur:q()}],brightness:[{brightness:[r9,nf,nc]}],contrast:[{contrast:[r9,nf,nc]}],"drop-shadow":[{"drop-shadow":["","none",m,nw,np]}],"drop-shadow-color":[{"drop-shadow":F()}],grayscale:[{grayscale:["",r9,nf,nc]}],"hue-rotate":[{"hue-rotate":[r9,nf,nc]}],invert:[{invert:["",r9,nf,nc]}],saturate:[{saturate:[r9,nf,nc]}],sepia:[{sepia:["",r9,nf,nc]}],"backdrop-filter":[{"backdrop-filter":["","none",nf,nc]}],"backdrop-blur":[{"backdrop-blur":q()}],"backdrop-brightness":[{"backdrop-brightness":[r9,nf,nc]}],"backdrop-contrast":[{"backdrop-contrast":[r9,nf,nc]}],"backdrop-grayscale":[{"backdrop-grayscale":["",r9,nf,nc]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[r9,nf,nc]}],"backdrop-invert":[{"backdrop-invert":["",r9,nf,nc]}],"backdrop-opacity":[{"backdrop-opacity":[r9,nf,nc]}],"backdrop-saturate":[{"backdrop-saturate":[r9,nf,nc]}],"backdrop-sepia":[{"backdrop-sepia":["",r9,nf,nc]}],"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",nf,nc]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[r9,"initial",nf,nc]}],ease:[{ease:["linear","initial",g,nf,nc]}],delay:[{delay:[r9,nf,nc]}],animate:[{animate:["none",y,nf,nc]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[p,nf,nc]}],"perspective-origin":[{"perspective-origin":j()}],rotate:[{rotate:W()}],"rotate-x":[{"rotate-x":W()}],"rotate-y":[{"rotate-y":W()}],"rotate-z":[{"rotate-z":W()}],scale:[{scale:K()}],"scale-x":[{"scale-x":K()}],"scale-y":[{"scale-y":K()}],"scale-z":[{"scale-z":K()}],"scale-3d":["scale-3d"],skew:[{skew:Q()}],"skew-x":[{"skew-x":Q()}],"skew-y":[{"skew-y":Q()}],transform:[{transform:[nf,nc,"","none","gpu","cpu"]}],"transform-origin":[{origin:j()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:H()}],"translate-x":[{"translate-x":H()}],"translate-y":[{"translate-y":H()}],"translate-z":[{"translate-z":H()}],"translate-none":["translate-none"],accent:[{accent:F()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:F()}],"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",nf,nc]}],"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",nf,nc]}],fill:[{fill:["none",...F()]}],"stroke-w":[{stroke:[r9,ng,nu,nh]}],stroke:[{stroke:["none",...F()]}],"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 nL(...e){return nD(rV(e))}function nF({className:e,...t}){return(0,c.jsx)("div",{"data-slot":"card",className:nL("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...t})}function nR({className:e,...t}){return(0,c.jsx)("div",{"data-slot":"card-header",className:nL("@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 nV({className:e,...t}){return(0,c.jsx)("div",{"data-slot":"card-title",className:nL("leading-none font-semibold",e),...t})}function n$({className:e,...t}){return(0,c.jsx)("div",{"data-slot":"card-content",className:nL("px-6",e),...t})}function nz(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}var n_=Symbol.for("react.lazy"),nI=u[" use ".trim().toString()];function nO(e){var t;return null!=e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===n_&&"_payload"in e&&"object"==typeof(t=e._payload)&&null!==t&&"then"in t}var nB=((o=u.forwardRef((e,t)=>{let{children:s,...i}=e;if(nO(s)&&"function"==typeof nI&&(s=nI(s._payload)),u.isValidElement(s)){var a;let e,r,n=(a=s,(r=(e=Object.getOwnPropertyDescriptor(a.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?a.ref:(r=(e=Object.getOwnPropertyDescriptor(a,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?a.props.ref:a.props.ref||a.ref),l=function(e,t){let s={...t};for(let i in t){let a=e[i],r=t[i];/^on[A-Z]/.test(i)?a&&r?s[i]=(...e)=>{let t=r(...e);return a(...e),t}:a&&(s[i]=a):"style"===i?s[i]={...a,...r}:"className"===i&&(s[i]=[a,r].filter(Boolean).join(" "))}return{...e,...s}}(i,s.props);return s.type!==u.Fragment&&(l.ref=t?function(...e){return t=>{let s=!1,i=e.map(e=>{let i=nz(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():nz(e[t],null)}}}}(t,n):n),u.cloneElement(s,l)}return u.Children.count(s)>1?u.Children.only(null):null})).displayName="Slot.SlotClone",i=o,(a=u.forwardRef((e,t)=>{let{children:s,...a}=e;nO(s)&&"function"==typeof nI&&(s=nI(s._payload));let r=u.Children.toArray(s),n=r.find(nq);if(n){let e=n.props.children,s=r.map(t=>t!==n?t:u.Children.count(e)>1?u.Children.only(null):u.isValidElement(e)?e.props.children:null);return(0,c.jsx)(i,{...a,ref:t,children:u.isValidElement(e)?u.cloneElement(e,void 0,s):null})}return(0,c.jsx)(i,{...a,ref:t,children:s})})).displayName="Slot.Slot",a),nU=Symbol("radix.slottable");function nq(e){return u.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===nU}let nW=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,nK=(r="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",n={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==n?void 0:n.variants)==null)return rV(r,null==e?void 0:e.class,null==e?void 0:e.className);let{variants:s,defaultVariants:i}=n,a=Object.keys(s).map(t=>{let a=null==e?void 0:e[t],r=null==i?void 0:i[t];if(null===a)return null;let n=nW(a)||nW(r);return s[t][n]}),l=e&&Object.entries(e).reduce((e,t)=>{let[s,i]=t;return void 0===i||(e[s]=i),e},{});return rV(r,a,null==n||null==(t=n.compoundVariants)?void 0:t.reduce((e,t)=>{let{class:s,className:a,...r}=t;return Object.entries(r).every(e=>{let[t,s]=e;return Array.isArray(s)?s.includes({...i,...l}[t]):({...i,...l})[t]===s})?[...e,s,a]:e},[]),null==e?void 0:e.class,null==e?void 0:e.className)});function nQ({className:e,variant:t="default",size:s="default",asChild:i=!1,...a}){return(0,c.jsx)(i?nB:"button",{"data-slot":"button","data-variant":t,"data-size":s,className:nL(nK({variant:t,size:s,className:e})),...a})}function nH({className:e,type:t,...s}){return(0,c.jsx)("input",{type:t,"data-slot":"input",className:nL("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 nX=e.i(97358),nY=e.i(33368);let nG={references:{color:"#60a5fa",label:"References",icon:"→"},extends:{color:"#34d399",label:"Extends",icon:"⊃"},contradicts:{color:"#f87171",label:"Contradicts",icon:"⊗"},related:{color:"#a78bfa",label:"Related",icon:"~"}},nJ=["architecture","pattern","preference","error","context","learning","todo","note","relationship","custom"];function nZ({memory:e,links:t=[],memories:s=[],onClose:i,onReinforce:a,onSelectMemory:r,isReinforcing:n=!1,reinforceSuccess:l=!1}){let[o,d]=(0,u.useState)(!1),[h,m]=(0,u.useState)(null),[x,p]=(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,rA.useEditMemory)(),T=(0,rA.useDeleteMemory)(),[P,A]=(0,u.useState)(e.id);P!==e.id&&(A(e.id),p(!1),S(!1),g(e.title),v(e.content),j(e.category),N((e.tags||[]).join(", "))),(0,u.useEffect)(()=>{if(l&&h===e.id){let e=setTimeout(()=>d(!0),0),t=setTimeout(()=>d(!1),1500);return()=>{clearTimeout(e),clearTimeout(t)}}},[l,h,e.id]);let M=(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:()=>{p(!1)}})},[e.id,f,y,b,w,C]),E=(0,nY.calculateDecayFactor)(e),D=(0,nX.getCategoryColor)(e.category),L=(0,nX.getTypeColor)(e.type),F=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)"},R=(0,u.useMemo)(()=>{let i=[];for(let a of t)if(a.source_id===e.id){let e=s.find(e=>e.id===a.target_id);e&&i.push({memory:e,relationship:a.relationship,strength:a.strength,direction:"to"})}else if(a.target_id===e.id){let e=s.find(e=>e.id===a.source_id);e&&i.push({memory:e,relationship:a.relationship,strength:a.strength,direction:"from"})}return i.sort((e,t)=>t.strength-e.strength)},[e.id,t,s]);return(0,c.jsxs)(nF,{className:`bg-slate-900 border-slate-700 h-full overflow-auto transition-all duration-300 ${o?"ring-2 ring-green-500 ring-opacity-75":""}`,children:[(0,c.jsxs)(nR,{className:"border-b border-slate-700 pb-3",children:[(0,c.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[x?(0,c.jsx)(nH,{value:f,onChange:e=>g(e.target.value),className:"bg-slate-800 border-slate-600 text-white text-lg font-semibold"}):(0,c.jsx)(nV,{className:"text-lg font-semibold text-white leading-tight",children:e.title}),(0,c.jsx)(nQ,{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:[x?(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:nJ.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)(n$,{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"}),x?(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})]}),x&&(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)(nH,{value:w,onChange:e=>N(e.target.value),placeholder:"tag1, tag2, tag3",className:"bg-slate-800 border-slate-600 text-white text-sm"})]}),x?(0,c.jsxs)("div",{className:"flex gap-2",children:[(0,c.jsx)(nQ,{variant:"default",size:"sm",onClick:M,disabled:C.isPending,className:"flex-1 bg-emerald-600 hover:bg-emerald-700",children:C.isPending?"Saving...":"Save Changes"}),(0,c.jsx)(nQ,{variant:"outline",size:"sm",onClick:()=>{p(!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,!x&&(0,c.jsxs)("div",{className:"rounded-lg p-3 flex items-center gap-3",style:{backgroundColor:F.bgColor},children:[(0,c.jsx)("div",{className:"w-3 h-3 rounded-full animate-pulse",style:{backgroundColor:F.color}}),(0,c.jsxs)("div",{children:[(0,c.jsx)("div",{className:"text-sm font-medium",style:{color:F.color},children:F.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"})]})]}),!x&&(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:F.color}})})]})]}),!x&&(0,c.jsxs)("div",{className:`bg-slate-800 rounded-lg p-3 space-y-2 transition-all duration-300 ${o?"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 ${o?"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 ${o?"text-green-400":"text-white"}`,children:o?"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()})]})]}),!x&&R.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 (",R.length,")"]}),(0,c.jsx)("div",{className:"space-y-2 max-h-48 overflow-y-auto",children:R.map(({memory:e,relationship:t,strength:s,direction:i})=>{let a=nG[t]||nG.related,n=(0,nX.getCategoryColor)(e.category);return(0,c.jsxs)("button",{onClick:()=>r?.(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:a.color}}),(0,c.jsx)("span",{className:"text-[10px] font-medium",style:{color:a.color},children:"to"===i?`${a.icon} ${a.label}`:`${a.label} ${a.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:n+"20",color:n},children:e.category}),(0,c.jsxs)("span",{className:"text-[10px] text-slate-500",children:[(100*e.salience).toFixed(0),"% salience"]})]})]},`${e.id}-${i}`)})})]}),!x&&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))})]}),!x&&(0,c.jsxs)("div",{className:"space-y-2 pt-2",children:[(0,c.jsxs)("div",{className:"flex gap-2",children:[a&&(0,c.jsx)(nQ,{variant:"default",size:"sm",onClick:()=>{m(e.id),a?.(e.id)},disabled:n,className:`flex-1 transition-all duration-300 ${o?"bg-green-600 hover:bg-green-600":"bg-blue-600 hover:bg-blue-700"}`,children:n?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("span",{className:"animate-spin mr-2",children:"⟳"}),"Reinforcing..."]}):o?(0,c.jsx)(c.Fragment,{children:"✓ Reinforced!"}):(0,c.jsx)(c.Fragment,{children:"⚡ Reinforce"})}),(0,c.jsx)(nQ,{variant:"outline",size:"sm",onClick:()=>p(!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)(nQ,{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)(nQ,{variant:"outline",size:"sm",onClick:()=>S(!1),className:"flex-1 border-slate-600 text-slate-300 hover:text-white",children:"Cancel"})]})]}):(0,c.jsx)(nQ,{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 n0=e.i(1235);function n1(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 a=Math.floor(i/7);return`${a}w ago`}function n2({memory:e,isSelected:t,onSelect:s,isChecked:i,onCheck:a}){let r=(0,nX.getCategoryColor)(e.category),n=(0,nX.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:r}})}),a&&(0,c.jsx)("input",{type:"checkbox",checked:i??!1,onChange:t=>{t.stopPropagation(),a(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:r+"22",color:r},children:e.category}),(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.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 ",n1(e.createdAt)]}),(0,c.jsxs)("span",{children:["Accessed ",n1(e.lastAccessed)]})]})]})}let n5=h.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";function n4({memories:e,selectedMemory:t,onSelectMemory:s}){let[i,a]=(0,u.useState)("salience"),[r,n]=(0,u.useState)("grid"),[l,o]=(0,u.useState)(!1),[d,h]=(0,u.useState)(new Set),[m,x]=(0,u.useState)(!1),p=(0,n0.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){x(!0);try{await Promise.all(Array.from(d).map(e=>(0,rL.authFetch)(`${n5}/api/memories/${e}`,{method:"DELETE"}))),h(new Set),p.invalidateQueries({queryKey:["memories"]})}finally{x(!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=>a(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:()=>n("grid"),className:`px-2 py-1 text-xs ${"grid"===r?"bg-slate-700 text-white":"text-slate-400 hover:text-white"}`,children:"Grid"}),(0,c.jsx)("button",{onClick:()=>n("list"),className:`px-2 py-1 text-xs ${"list"===r?"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:()=>{o(!l),h(new Set)},className:`px-2 py-1 text-xs rounded ${l?"bg-blue-600 text-white":"bg-slate-800 text-slate-400 hover:text-white"}`,children:"Select"}),l&&(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"===r?"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)(n2,{memory:e,isSelected:t?.id===e.id,onSelect:s,isChecked:l?d.has(e.id):void 0,onCheck:l?g:void 0},e.id))})})]})}var n3=e.i(87353),n6=e.i(71921);let n8=h.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";async function n7(){let e=await (0,rL.authFetch)(`${n8}/api/license/status`);if(!e.ok)throw Error("Failed to fetch license status");return e.json()}async function n9(e){let t=await (0,rL.authFetch)(`${n8}/api/license/activate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:e})});if(!t.ok)throw Error((await t.json().catch(()=>({error:"Activation failed"}))).error||"Activation failed");return t.json()}async function le(){let e=await (0,rL.authFetch)(`${n8}/api/license/deactivate`,{method:"POST"});if(!e.ok)throw Error("Failed to deactivate license");return e.json()}function lt(){return(0,rD.useQuery)({queryKey:["license-status"],queryFn:n7,refetchInterval:6e4,retry:2})}let ls=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)},li=(...e)=>e.filter((e,t,s)=>!!e&&""!==e.trim()&&s.indexOf(e)===t).join(" ").trim();var la={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 lr=(0,u.forwardRef)(({color:e="currentColor",size:t=24,strokeWidth:s=2,absoluteStrokeWidth:i,className:a="",children:r,iconNode:n,...l},o)=>(0,u.createElement)("svg",{ref:o,...la,width:t,height:t,stroke:e,strokeWidth:i?24*Number(s)/Number(t):s,className:li("lucide",a),...!r&&!(e=>{for(let t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0})(l)&&{"aria-hidden":"true"},...l},[...n.map(([e,t])=>(0,u.createElement)(e,t)),...Array.isArray(r)?r:[r]])),ln=(e,t)=>{let s=(0,u.forwardRef)(({className:s,...i},a)=>(0,u.createElement)(lr,{ref:a,iconNode:t,className:li(`lucide-${ls(e).replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${e}`,s),...i}));return s.displayName=ls(e),s},ll=ln("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"}]]),lo=ln("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"}]]),ld=ln("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"}]]),lc=ln("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"}]]),lu=ln("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"}]]),lh=ln("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"}]]),lm=ln("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"}]]),lx=ln("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"}]]),lp=ln("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"}]]),lf=[{id:"shield",label:"Shield",icon:ll},{id:"audit",label:"Audit",icon:lo},{id:"quarantine",label:"Queue",icon:ld},{id:"agents",label:"Agents",icon:lm},{id:"skills",label:"Skills",icon:lx},{id:"dome",label:"Dome",icon:lp},{id:"memories",label:"Memories",icon:lc},{id:"brain",label:"Brain",icon:lu},{id:"graph",label:"Graph",icon:lh}],lg=new Set(["shield","audit","skills","dome"]);function ly(){let{viewMode:e,setViewMode:t}=(0,rM.useDashboardStore)(),{data:s}=(0,rA.useStats)(),{data:i}=(0,n3.useAuditStats)("24h"),{data:a}=(0,rA.useVersion)(),{data:r}=lt(),n=!r||"free"===r.tier,l=s?.decayDistribution?Math.round(s.decayDistribution.healthy/Math.max(1,s.total)*100):null,o=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:lf.map(({id:s,label:i,icon:a})=>(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)(a,{size:18}),(0,c.jsx)("span",{className:"text-[9px] leading-none",children:i}),"shield"===s&&o>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:o>99?"99+":o}),n&&lg.has(s)&&(0,c.jsx)("span",{className:"absolute -bottom-0.5 -left-0.5 px-1 h-[12px] rounded-full bg-cyan-600/80 text-white text-[7px] font-bold flex items-center justify-center leading-none",children:"PRO"})]},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!==l&&(0,c.jsxs)("span",{children:[l,"%"]}),a?.version&&(0,c.jsxs)("span",{children:["v",a.version]})]})]})}let lv=ln("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"}]]),lb=ln("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"}]]),lj=ln("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"}]]),lw=ln("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),lN=[{key:"trust",label:"Trust",icon:ll,color:"text-blue-400",bg:"bg-blue-400/10"},{key:"firewall",label:"Firewall",icon:lv,color:"text-orange-400",bg:"bg-orange-400/10"},{key:"sensitivity",label:"Sensitivity",icon:lb,color:"text-purple-400",bg:"bg-purple-400/10"},{key:"fragmentation",label:"Fragment",icon:lj,color:"text-cyan-400",bg:"bg-cyan-400/10"},{key:"audit",label:"Audit",icon:lo,color:"text-green-400",bg:"bg-green-400/10"}],lk={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 lS({timeRange:e}){let{projectFilter:t}=(0,rM.useDashboardStore)(),{data:s,isLoading:i,isError:a}=(0,n3.useAuditStats)(e,t||void 0),{data:r}=(0,n3.useDefenceConfig)(),n=(0,n3.useSetDefenceMode)(),[l,o]=(0,u.useState)(!1),d=(0,u.useRef)(null),h=r?.mode??"balanced",m=lk[h];return(0,u.useEffect)(()=>{function e(e){d.current&&!d.current.contains(e.target)&&o(!1)}return l&&document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[l]),(0,c.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[r?.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)(ld,{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:lN.map(({key:e,label:t,icon:s,color:i,bg:a},r)=>(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 ${a}`,children:[(0,c.jsx)(s,{size:14,className:i}),(0,c.jsx)("span",{className:`text-xs font-medium ${i}`,children:t})]}),r<lN.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..."}):a?(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:()=>rM.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:()=>o(!l),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)(lw,{size:10})]}),l&&(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=lk[e];return(0,c.jsxs)("button",{onClick:()=>{n.mutate(e),o(!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 lC(){let{setViewMode:e,projectFilter:t}=(0,rM.useDashboardStore)(),{data:s,isLoading:i,isError:a}=(0,n3.useQuarantine)("pending",3,t||void 0),r=s?.total??0,n=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"}),r>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:[r," pending"]})]}),i?(0,c.jsx)("div",{className:"text-xs text-slate-500 animate-pulse",children:"Loading..."}):a?(0,c.jsx)("div",{className:"text-xs text-red-400",children:"Failed to load quarantine"}):0===n.length?(0,c.jsxs)("div",{className:"flex flex-col items-center py-6 text-slate-500",children:[(0,c.jsx)(ld,{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:n.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)})}),r>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 ",r," items →"]})]})}function lT({timeRange:e}){let{projectFilter:t}=(0,rM.useDashboardStore)(),s={"24h":24,"7d":168,"30d":720},[i,a]=(0,u.useState)(()=>Date.now());(0,u.useEffect)(()=>{a(Date.now())},[e]);let r=(0,u.useMemo)(()=>new Date(6e4*Math.floor((i-36e5*s[e])/6e4)).toISOString(),[i,e]),{data:n,isLoading:l,isError:o}=(0,n3.useAuditLogs)({startTime:r,project:t||void 0,limit:500}),d=(0,u.useMemo)(()=>{if(!n?.logs.length)return[];let t="24h"===e?36e5:"7d"===e?216e5:864e5,s="24h"===e?24:"7d"===e?28:30,a=Array.from({length:s},(e,a)=>({time:i-(s-1-a)*t,allowed:0,blocked:0,quarantined:0}));for(let e of n.logs){let r=Math.floor((new Date(e.timestamp).getTime()-(i-s*t))/t),n=Math.min(Math.max(r,0),s-1);r>=0&&r<=s&&("ALLOW"===e.firewall_result?a[n].allowed++:"BLOCK"===e.firewall_result?a[n].blocked++:"QUARANTINE"===e.firewall_result&&a[n].quarantined++)}return a},[n,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"}),l?(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..."})}):o?(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,a=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:`${a}%`}}),(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:()=>rM.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 lP({timeRange:e}){let{projectFilter:t}=(0,rM.useDashboardStore)(),{data:s,isLoading:i,isError:a}=(0,n3.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(a)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 r=s.totalOperations||1,n=(s.blockedCount/r*100).toFixed(1),l=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(n)>10?"text-red-400":"text-green-400"}`,children:[n,"%"]}),(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))})]}),l.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:l.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:()=>rM.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 lA=ln("cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]),lM=ln("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),lE=ln("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),lD=ln("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),lL=ln("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),lF=ln("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);function lR(){let{projectFilter:e}=(0,rM.useDashboardStore)(),{data:t}=(0,n3.useAuditStats)("30d",e||void 0),{data:s}=lt(),[i,a]=(0,u.useState)("upsell"),[r,n]=(0,u.useState)(""),[l,o]=(0,u.useState)(null),[d,h]=(0,u.useState)(""),[m,x]=(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&&a("hidden")}},[]),(0,u.useEffect)(()=>{(0,rL.authFetch)("http://localhost:3001/api/cloud/config").then(e=>e.json()).then(e=>{e.enabled&&e.apiKeySet&&a("hidden")}).catch(()=>{})},[]),(0,u.useEffect)(()=>{if("polling"!==i||!l)return;let e=setInterval(async()=>{try{let t=await fetch(`https://api.shieldcortex.ai/v1/auth/setup-status/${l}`),s=await t.json();"complete"===s.status&&s.api_key?(await (0,rL.authFetch)("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"})}),a("success"),clearInterval(e),setTimeout(()=>a("hidden"),5e3)):"expired"===s.status&&(h("Setup expired. Please try again."),a("upsell"),clearInterval(e))}catch{}},3e3);return()=>clearInterval(e)},[i,l]);let p=async e=>{if(e.preventDefault(),r&&!m){h(""),x(!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),a("polling")):h(t.error||"Failed to start setup")}catch{h("Could not reach ShieldCortex Cloud. Check your connection.")}finally{x(!1)}}},f=()=>{localStorage.setItem("shieldcortex_cloud_dismissed",new Date().toISOString()),a("hidden")};if("hidden"===i)return null;let g=t?.blockedCount??0,y=t?.totalOperations??0,v=s?.tier??"free";return"team"!==v&&"enterprise"!==v&&"upsell"===i?(0,c.jsxs)("div",{className:"mt-4 bg-gradient-to-br from-slate-900 via-slate-900 to-violet-950/20 border border-violet-800/30 rounded-xl p-5 relative",children:[(0,c.jsx)("button",{onClick:f,className:"absolute top-3 right-3 text-slate-500 hover:text-slate-300 transition-colors",title:"Dismiss for 30 days",children:(0,c.jsx)(lL,{size:16})}),(0,c.jsxs)("div",{className:"space-y-3",children:[(0,c.jsxs)("div",{className:"flex items-center gap-2",children:[(0,c.jsx)(lA,{size:20,className:"text-violet-400"}),(0,c.jsx)("h3",{className:"text-sm font-semibold text-white",children:"Cloud Sync"}),(0,c.jsx)("span",{className:"text-[10px] font-semibold px-1.5 py-0.5 rounded text-violet-400 bg-violet-400/10",children:"Team"})]}),(0,c.jsx)("p",{className:"text-sm text-slate-300",children:g>0?`You've blocked ${g} threats locally. Upgrade to Team to sync across devices and give your team visibility.`:"Sync defence data across devices, share audit logs with your team, and get centralised alerts."}),(0,c.jsxs)("a",{href:"https://shieldcortex.ai/pricing",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 px-4 py-2 bg-violet-600 hover:bg-violet-500 rounded-lg text-sm font-medium text-white transition-colors",children:["Upgrade to Team",(0,c.jsx)(lF,{size:12})]})]})]}):(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"===i&&(0,c.jsx)("button",{onClick:f,className:"absolute top-3 right-3 text-slate-500 hover:text-slate-300 transition-colors",title:"Dismiss for 30 days",children:(0,c.jsx)(lL,{size:16})}),"upsell"===i&&(0,c.jsxs)("div",{className:"space-y-4",children:[(0,c.jsxs)("div",{className:"flex items-center gap-2",children:[(0,c.jsx)(lA,{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:g>0?`You've blocked ${g} threats across ${y} 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:m,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:[m?(0,c.jsx)(lE,{size:14,className:"animate-spin"}):(0,c.jsx)(lM,{size:14}),"Get Started"]})]}),d&&(0,c.jsx)("p",{className:"text-xs text-red-400",children:d}),(0,c.jsx)("p",{className:"text-[10px] text-slate-500",children:"Your Team licence includes cloud sync. Enter your email to connect."})]}),"polling"===i&&(0,c.jsxs)("div",{className:"flex items-center gap-3 py-2",children:[(0,c.jsx)(lE,{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"===i&&(0,c.jsxs)("div",{className:"flex items-center gap-3 py-2",children:[(0,c.jsx)(lD,{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 lV(){let e,t,{data:s,isLoading:i}=(0,rD.useQuery)({queryKey:["cloud-sync-status"],queryFn:async()=>{let e=await (0,rL.authFetch)("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:a,apiKeySet:r,lastSyncAt:n,queue:l}=s;a&&r?l.failed>0?(e="bg-red-500",t=`${l.failed} event${1===l.failed?"":"s"} failed`):l.pending>0?(e="bg-amber-500",t=`${l.pending} event${1===l.pending?"":"s"} pending`):n?(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 o=n?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 a=Math.floor(i/24);return`${a}d ago`}(n):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}),o&&(0,c.jsxs)("span",{className:"text-slate-500",children:["last sync ",o]})]})}let l$=ln("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"}]]),lz=h.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";async function l_(e){let t=await (0,rL.authFetch)(`${lz}/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 lI(e){let t=await (0,rL.authFetch)(`${lz}/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 lO(){return(0,n6.useMutation)({mutationFn:e=>l_(e)})}async function lB(e){let t=await (0,rL.authFetch)(`${lz}/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 lU(e){let t=await (0,rL.authFetch)(`${lz}/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 lq(e){let t=await (0,rL.authFetch)(`${lz}/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 lW(){let e=lO(),{setViewMode:t}=(0,rM.useDashboardStore)(),[s,i]=(0,u.useState)(null),a=s?s.files.filter(e=>e.safe).length:0,r=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)(lE,{size:12,className:"animate-spin"}):(0,c.jsx)(lx,{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)(lD,{size:14,className:"text-green-400"}),(0,c.jsx)("span",{className:"text-sm font-medium text-green-400",children:a}),(0,c.jsx)("span",{className:"text-[10px] text-slate-500",children:"safe"})]}),r>0&&(0,c.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,c.jsx)(l$,{size:14,className:"text-red-400"}),(0,c.jsx)("span",{className:"text-sm font-medium text-red-400",children:r}),(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)(lM,{size:12})]})]}):e.isPending?(0,c.jsx)("div",{className:"flex items-center justify-center py-4",children:(0,c.jsx)(lE,{size:16,className:"text-cyan-400 animate-spin"})}):(0,c.jsxs)("div",{className:"text-center py-3",children:[(0,c.jsx)(lx,{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 lK=h.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";async function lQ(){let e=await (0,rL.authFetch)(`${lK}/api/iron-dome/status`);if(!e.ok)throw Error("Failed to fetch Iron Dome status");return e.json()}async function lH(e){let t=await (0,rL.authFetch)(`${lK}/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 lX(){let e=await (0,rL.authFetch)(`${lK}/api/iron-dome/deactivate`,{method:"POST"});if(!e.ok)throw Error("Failed to deactivate Iron Dome");return e.json()}async function lY(e){let t=await (0,rL.authFetch)(`${lK}/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 lG(e){let t=new URLSearchParams;e&&t.set("limit",e.toString());let s=await (0,rL.authFetch)(`${lK}/api/iron-dome/audit?${t}`);if(!s.ok)throw Error("Failed to fetch Iron Dome audit");return s.json()}function lJ(){return(0,rD.useQuery)({queryKey:["iron-dome-status"],queryFn:lQ,refetchInterval:3e4,retry:2})}function lZ(e){return(0,rD.useQuery)({queryKey:["iron-dome-audit",e],queryFn:()=>lG(e),refetchInterval:3e4,retry:2})}function l0(){let{data:e,isLoading:t}=lJ(),{data:s}=lZ(100),i=e?.enabled??!1,a=e?.profile??"custom",r=s?.logs??[],n=r.filter(e=>e.reason?.includes("[iron-dome:")&&"BLOCK"===e.firewall_result).length,l=r.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:a})]}),(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:n}),(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)(ll,{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:()=>rM.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 l1="http://localhost:3001";function l2(){return(0,rD.useQuery)({queryKey:["cloud-config"],queryFn:async()=>{let e=await (0,rL.authFetch)(`${l1}/api/cloud/config`);if(!e.ok)throw Error("Failed to fetch cloud config");return e.json()},refetchInterval:3e4})}function l5(e,t,s){return Math.max(t,Math.min(s,e))}function l4({initialAutoMemory:e,initialDedupe:t,initialNoveltyThreshold:s,initialMaxRecent:i}){let a,r=(a=(0,n0.useQueryClient)(),(0,n6.useMutation)({mutationFn:async e=>{let t=await (0,rL.authFetch)(`${l1}/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:()=>{a.invalidateQueries({queryKey:["cloud-config"]})}})),[n,l]=(0,u.useState)(e),[o,d]=(0,u.useState)(t),[h,m]=(0,u.useState)(String(s)),[x,p]=(0,u.useState)(String(i)),f=r.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:()=>l(!n),className:`h-6 w-11 rounded-full transition-colors ${n?"bg-cyan-500":"bg-slate-700"}`,children:(0,c.jsx)("span",{className:`block h-5 w-5 rounded-full bg-white transition-transform ${n?"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(!o),disabled:!n,className:`h-6 w-11 rounded-full transition-colors ${o&&n?"bg-emerald-500":"bg-slate-700"} ${!n?"opacity-50 cursor-not-allowed":""}`,children:(0,c.jsx)("span",{className:`block h-5 w-5 rounded-full bg-white transition-transform ${o&&n?"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)(nH,{type:"number",step:"0.01",min:.6,max:.99,value:h,disabled:!n||!o,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)(nH,{type:"number",step:"1",min:50,max:1e3,value:x,disabled:!n||!o,onChange:e=>p(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)(nQ,{size:"sm",onClick:()=>{let e=l5(Number.parseFloat(h),.6,.99),t=Math.floor(l5(Number.parseInt(x,10),50,1e3));r.mutate({openclawAutoMemory:n,openclawAutoMemoryDedupe:o,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)(lE,{size:12,className:"animate-spin"}):null,"Save"]})]})]})}function l3(){let{data:e,isLoading:t}=l2(),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)(l4,{initialAutoMemory:s?.autoMemory??!1,initialDedupe:s?.dedupe??!0,initialNoveltyThreshold:s?.noveltyThreshold??.88,initialMaxRecent:s?.maxRecent??300},i)]})}let l6=ln("key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]),l8=ln("sparkles",[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]]),l7=ln("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"}]]),l9=ln("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]),oe={free:"Free",pro:"Pro",team:"Team",enterprise:"Enterprise"},ot={free:"text-slate-400",pro:"text-cyan-400",team:"text-violet-400",enterprise:"text-amber-400"},os={free:"bg-slate-400/10",pro:"bg-cyan-400/10",team:"bg-violet-400/10",enterprise:"bg-amber-400/10"},oi=["Custom injection patterns","Custom Iron Dome policies","Custom firewall rules","Audit export (JSON/CSV)","Skill scanner deep mode"];function oa(){let e,t,{data:s,isLoading:i}=lt(),a=(e=(0,n0.useQueryClient)(),(0,n6.useMutation)({mutationFn:e=>n9(e),onSuccess:()=>{e.invalidateQueries({queryKey:["license-status"]})}})),r=(t=(0,n0.useQueryClient)(),(0,n6.useMutation)({mutationFn:le,onSuccess:()=>{t.invalidateQueries({queryKey:["license-status"]})}})),[n,l]=(0,u.useState)(""),[o,d]=(0,u.useState)(!1),[h,m]=(0,u.useState)(!1);if(i||!s)return(0,c.jsx)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4 mb-4",children:(0,c.jsxs)("div",{className:"flex items-center gap-2",children:[(0,c.jsx)(ll,{size:16,className:"text-slate-500"}),(0,c.jsx)("span",{className:"text-xs text-slate-500 animate-pulse",children:"Loading licence..."})]})});let x=s.tier;if("free"===x)return(0,c.jsxs)("div",{className:"relative overflow-hidden rounded-xl mb-4 bg-gradient-to-br from-slate-900 via-slate-900 to-cyan-950/30 border border-cyan-700/30",children:[(0,c.jsx)("div",{className:"absolute top-0 right-0 w-32 h-32 bg-cyan-500/5 rounded-full blur-2xl -translate-y-1/2 translate-x-1/2"}),(0,c.jsxs)("div",{className:"relative p-5",children:[(0,c.jsxs)("div",{className:"flex items-start justify-between mb-4",children:[(0,c.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,c.jsx)("div",{className:"flex items-center justify-center w-8 h-8 rounded-lg bg-cyan-500/10 border border-cyan-500/20",children:(0,c.jsx)(l8,{size:16,className:"text-cyan-400"})}),(0,c.jsxs)("div",{children:[(0,c.jsx)("h3",{className:"text-sm font-semibold text-white",children:"Unlock Pro Features"}),(0,c.jsx)("p",{className:"text-[11px] text-slate-400 mt-0.5",children:"Your defence pipeline is fully active. Upgrade for advanced controls."})]})]}),(0,c.jsx)("span",{className:"text-[10px] font-medium px-2 py-0.5 rounded-full bg-slate-800 text-slate-400 border border-slate-700",children:"Free"})]}),(0,c.jsx)("div",{className:"grid grid-cols-2 gap-x-4 gap-y-1.5 mb-4",children:oi.map(e=>(0,c.jsxs)("div",{className:"flex items-center gap-1.5 text-xs",children:[(0,c.jsx)(l7,{size:10,className:"text-cyan-500/60 shrink-0"}),(0,c.jsx)("span",{className:"text-slate-400",children:e})]},e))}),(0,c.jsx)("div",{className:"flex items-center gap-3",children:o?(0,c.jsxs)("form",{onSubmit:e=>{e.preventDefault(),n.trim()&&a.mutate(n.trim(),{onSuccess:()=>{l(""),d(!1)}})},className:"flex-1 flex gap-2",children:[(0,c.jsx)("input",{type:"text",placeholder:"sc_pro_...",value:n,onChange:e=>l(e.target.value),className:"flex-1 bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white placeholder:text-slate-600 focus:outline-none focus:ring-1 focus:ring-cyan-500",autoFocus:!0}),(0,c.jsx)("button",{type:"submit",disabled:a.isPending||!n.trim(),className:"px-4 py-2 text-xs font-medium bg-cyan-600 hover:bg-cyan-500 disabled:opacity-50 text-white rounded-lg transition-colors",children:a.isPending?(0,c.jsx)(lE,{size:12,className:"animate-spin"}):"Activate"}),(0,c.jsx)("button",{type:"button",onClick:()=>{d(!1),l(""),a.reset()},className:"px-3 py-2 text-xs text-slate-500 hover:text-slate-300 transition-colors",children:"Cancel"})]}):(0,c.jsxs)(c.Fragment,{children:[(0,c.jsxs)("a",{href:"https://shieldcortex.ai/pricing",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 px-4 py-2 text-xs font-medium bg-cyan-600 hover:bg-cyan-500 text-white rounded-lg transition-colors",children:["View Plans",(0,c.jsx)(lF,{size:11})]}),(0,c.jsxs)("button",{onClick:()=>d(!0),className:"inline-flex items-center gap-1.5 px-4 py-2 text-xs font-medium bg-slate-800 hover:bg-slate-700 text-slate-300 rounded-lg transition-colors border border-slate-700",children:[(0,c.jsx)(l6,{size:12}),"I Have a Key"]})]})}),(0,c.jsxs)("p",{className:"mt-3 text-[10px] text-slate-600",children:["Or via CLI: ",(0,c.jsx)("code",{className:"text-slate-500 bg-slate-800/50 px-1 py-0.5 rounded",children:"shieldcortex license activate sc_pro_..."})]}),a.isError&&(0,c.jsx)("p",{className:"mt-2 text-xs text-red-400",children:a.error instanceof Error?a.error.message:"Activation failed"})]})]});let p=s.features.filter(e=>e.enabled).length,f=s.features.length;return(0,c.jsxs)("div",{className:"bg-slate-900 border border-cyan-800/40 rounded-xl p-4 mb-4",children:[(0,c.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,c.jsxs)("div",{className:"flex items-center gap-2",children:[(0,c.jsx)(ll,{size:16,className:ot[x]}),(0,c.jsx)("h3",{className:"text-sm font-medium text-slate-300",children:"Licence"}),(0,c.jsx)("span",{className:`text-[10px] font-semibold px-1.5 py-0.5 rounded ${ot[x]} ${os[x]}`,children:oe[x]})]}),(0,c.jsxs)("span",{className:"text-[10px] text-slate-500",children:[p,"/",f," features"]})]}),(0,c.jsxs)("div",{className:"space-y-2 mb-3",children:[s.email&&(0,c.jsxs)("div",{className:"flex items-center justify-between text-xs",children:[(0,c.jsx)("span",{className:"text-slate-500",children:"Email"}),(0,c.jsx)("span",{className:"text-slate-300",children:s.email})]}),null!==s.daysUntilExpiry&&(0,c.jsxs)("div",{className:"flex items-center justify-between text-xs",children:[(0,c.jsx)("span",{className:"text-slate-500",children:"Expires"}),(0,c.jsx)("span",{className:s.daysUntilExpiry<=7?"text-yellow-400":"text-slate-300",children:s.daysUntilExpiry<=0?"Expired (grace period)":`${s.daysUntilExpiry} days`})]})]}),(0,c.jsxs)("button",{onClick:()=>m(!h),className:"flex items-center gap-1 text-[10px] text-slate-500 hover:text-slate-300 transition-colors mb-2",children:[h?(0,c.jsx)(l9,{size:12}):(0,c.jsx)(lw,{size:12}),h?"Hide features":"Show features"]}),h&&(0,c.jsx)("div",{className:"space-y-1.5 mb-3",children:s.features.map(e=>(0,c.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[e.enabled?(0,c.jsx)(lD,{size:12,className:"text-emerald-400 shrink-0"}):(0,c.jsx)(l$,{size:12,className:"text-slate-600 shrink-0"}),(0,c.jsx)("span",{className:e.enabled?"text-slate-300":"text-slate-600",children:e.description.split(".")[0]}),!e.enabled&&(0,c.jsx)("span",{className:`text-[9px] px-1 py-0.5 rounded ${ot[e.requiredTier]} ${os[e.requiredTier]}`,children:oe[e.requiredTier]})]},e.feature))}),(0,c.jsx)("button",{onClick:()=>{confirm(`Remove your ${oe[x]} licence key? You will lose access to paid features.`)&&r.mutate()},disabled:r.isPending,className:"text-[10px] text-slate-600 hover:text-red-400 transition-colors",children:"Deactivate"})]})}let or=ln("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),on=ln("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"}]]),ol=ln("toggle-left",[["circle",{cx:"9",cy:"12",r:"3",key:"u3jwor"}],["rect",{width:"20",height:"14",x:"2",y:"5",rx:"7",key:"g7kal2"}]]),oo=ln("toggle-right",[["circle",{cx:"15",cy:"12",r:"3",key:"1afu0r"}],["rect",{width:"20",height:"14",x:"2",y:"5",rx:"7",key:"g7kal2"}]]);function od({feature:e,children:t,label:s}){let{data:i}=lt();if(!i)return(0,c.jsx)(c.Fragment,{children:t});let a=i.features.find(t=>t.feature===e);if(!a||a.enabled)return(0,c.jsx)(c.Fragment,{children:t});let r=a.requiredTier;return(0,c.jsxs)("div",{className:"relative",children:[(0,c.jsx)("div",{className:"pointer-events-none select-none opacity-30 blur-[2px]",children:t}),(0,c.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center bg-slate-900/60 rounded-xl backdrop-blur-sm",children:[(0,c.jsx)(l7,{size:24,className:"text-slate-500 mb-2"}),(0,c.jsxs)("p",{className:"text-sm font-medium text-slate-300 mb-1",children:[oe[r]," Feature"]}),s&&(0,c.jsx)("p",{className:"text-xs text-slate-500 mb-3 text-center max-w-xs",children:s}),(0,c.jsxs)("a",{href:"https://shieldcortex.ai/pricing",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 px-4 py-2 text-xs bg-cyan-600 hover:bg-cyan-500 text-white rounded-lg transition-colors",children:["Upgrade to ",oe[r],(0,c.jsx)(lF,{size:10})]})]})]})}let oc=h.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001",ou=[{id:1,name:"Block API key patterns",priority:1,condition_type:"regex",condition_value:"sk-[a-zA-Z0-9]{32,}",action:"block",enabled:!0},{id:2,name:"Quarantine code injection",priority:2,condition_type:"regex",condition_value:"eval\\(|Function\\(",action:"quarantine",enabled:!0},{id:3,name:"Allow internal docs",priority:10,condition_type:"source",condition_value:"agent:docs-helper",action:"allow",enabled:!1}],oh=[{id:1,name:"Internal tool abuse",category:"tool_misuse",severity:"high",regex:"execute_tool\\(.*?delete|drop|truncate",description:"Detects attempts to use internal tools for destructive operations.",enabled:!0},{id:2,name:"PII exfiltration",category:"data_leak",severity:"critical",regex:"(SSN|social.security|\\d{3}-\\d{2}-\\d{4})",description:"Catches social security number patterns in agent memory writes.",enabled:!0},{id:3,name:"Prompt override attempt",category:"injection",severity:"medium",regex:"ignore.*(previous|above|prior).*instructions",description:"Detects common prompt injection override phrases.",enabled:!0}],om=[{id:1,name:"Strict Healthcare",description:"Blocks all PII patterns, requires approval for external actions, whitelists only HIPAA-compliant channels.",is_active:!0},{id:2,name:"Dev Sandbox",description:"Permissive mode for development. Allows all channels, logs but does not block. Ideal for testing.",is_active:!1}],ox=[{files:["SKILL.md","handler.js"],finding:"Skill declares read-only but handler writes to filesystem",severity:"high"},{files:["SKILL.md","config.json"],finding:"Config enables network access not mentioned in skill manifest",severity:"medium"},{files:["handler.js","utils.js"],finding:"Dynamic eval() used in utility imported by main handler",severity:"critical"}],op={"File access":45,"Network calls":30,"Process exec":15,"Memory write":10},of=["Restrict filesystem writes to a sandboxed directory","Add explicit network permission declarations to SKILL.md"];function og(){let e,t,s,i,{data:a,isLoading:r,isLocked:n}={...e=(0,rD.useQuery)({queryKey:["firewall-rules"],queryFn:()=>(0,rL.gatedFetch)(`${oc}/api/firewall-rules`).then(e=>{if(!e.ok)throw Error("Failed to fetch firewall rules");return e.json()}),retry:(e,t)=>!(t instanceof rL.FeatureLockedError)&&e<2,refetchInterval:3e4}),isLocked:e.error instanceof rL.FeatureLockedError},l=(t=(0,n0.useQueryClient)(),(0,n6.useMutation)({mutationFn:e=>(0,rL.gatedFetch)(`${oc}/api/firewall-rules`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}).then(e=>e.ok?e.json():e.json().then(e=>{throw Error(e.error)})),onSuccess:()=>{t.invalidateQueries({queryKey:["firewall-rules"]})}})),o=(s=(0,n0.useQueryClient)(),(0,n6.useMutation)({mutationFn:({id:e,...t})=>(0,rL.gatedFetch)(`${oc}/api/firewall-rules/${e}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}).then(e=>e.ok?e.json():e.json().then(e=>{throw Error(e.error)})),onSuccess:()=>{s.invalidateQueries({queryKey:["firewall-rules"]})}})),d=(i=(0,n0.useQueryClient)(),(0,n6.useMutation)({mutationFn:e=>(0,rL.gatedFetch)(`${oc}/api/firewall-rules/${e}`,{method:"DELETE"}).then(e=>e.ok?e.json():e.json().then(e=>{throw Error(e.error)})),onSuccess:()=>{i.invalidateQueries({queryKey:["firewall-rules"]})}})),[h,m]=(0,u.useState)(!1),[x,p]=(0,u.useState)({name:"",priority:100,condition_type:"regex",condition_value:"",action:"block"}),f=a?.rules??[];return n?(0,c.jsx)(oy,{}):(0,c.jsxs)("div",{className:"space-y-3",children:[(0,c.jsxs)("div",{className:"flex items-center justify-between",children:[(0,c.jsxs)("div",{className:"flex items-center gap-2",children:[(0,c.jsx)(ll,{size:16,className:"text-cyan-400"}),(0,c.jsx)("h3",{className:"text-sm font-medium text-slate-200",children:"Custom Firewall Rules"}),(0,c.jsxs)("span",{className:"text-xs text-slate-500",children:[f.length,"/25"]})]}),(0,c.jsxs)("button",{onClick:()=>m(!h),className:"flex items-center gap-1 px-2 py-1 text-xs bg-cyan-600/20 text-cyan-400 rounded hover:bg-cyan-600/30 transition-colors",children:[(0,c.jsx)(or,{size:12})," Add Rule"]})]}),h&&(0,c.jsxs)("form",{onSubmit:e=>{e.preventDefault(),l.mutate(x,{onSuccess:()=>{m(!1),p({name:"",priority:100,condition_type:"regex",condition_value:"",action:"block"})}})},className:"p-3 bg-slate-800/50 rounded-lg space-y-2",children:[(0,c.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,c.jsx)("input",{value:x.name,onChange:e=>p(t=>({...t,name:e.target.value})),placeholder:"Rule name",required:!0,className:"px-2 py-1.5 text-xs bg-slate-900 border border-slate-700 rounded text-slate-200 placeholder:text-slate-600"}),(0,c.jsx)("input",{value:x.priority,onChange:e=>p(t=>({...t,priority:Number(e.target.value)})),type:"number",placeholder:"Priority",className:"px-2 py-1.5 text-xs bg-slate-900 border border-slate-700 rounded text-slate-200"})]}),(0,c.jsxs)("div",{className:"grid grid-cols-3 gap-2",children:[(0,c.jsxs)("select",{value:x.condition_type,onChange:e=>p(t=>({...t,condition_type:e.target.value})),className:"px-2 py-1.5 text-xs bg-slate-900 border border-slate-700 rounded text-slate-200",children:[(0,c.jsx)("option",{value:"regex",children:"Regex"}),(0,c.jsx)("option",{value:"source",children:"Source"}),(0,c.jsx)("option",{value:"keyword",children:"Keyword"})]}),(0,c.jsx)("input",{value:x.condition_value,onChange:e=>p(t=>({...t,condition_value:e.target.value})),placeholder:"Condition value",required:!0,className:"px-2 py-1.5 text-xs bg-slate-900 border border-slate-700 rounded text-slate-200 placeholder:text-slate-600"}),(0,c.jsxs)("select",{value:x.action,onChange:e=>p(t=>({...t,action:e.target.value})),className:"px-2 py-1.5 text-xs bg-slate-900 border border-slate-700 rounded text-slate-200",children:[(0,c.jsx)("option",{value:"block",children:"Block"}),(0,c.jsx)("option",{value:"quarantine",children:"Quarantine"}),(0,c.jsx)("option",{value:"allow",children:"Allow"})]})]}),(0,c.jsxs)("div",{className:"flex gap-2",children:[(0,c.jsx)("button",{type:"submit",disabled:l.isPending,className:"px-3 py-1 text-xs bg-cyan-600 text-white rounded hover:bg-cyan-500 disabled:opacity-50",children:l.isPending?"Creating...":"Create"}),(0,c.jsx)("button",{type:"button",onClick:()=>m(!1),className:"px-3 py-1 text-xs text-slate-400 hover:text-slate-200",children:"Cancel"})]}),l.error&&(0,c.jsx)("p",{className:"text-xs text-red-400",children:l.error.message})]}),r?(0,c.jsx)("div",{className:"text-xs text-slate-500 py-4 text-center",children:"Loading rules..."}):0===f.length?(0,c.jsx)("div",{className:"text-xs text-slate-500 py-4 text-center",children:'No custom rules yet. Click "Add Rule" to create one.'}):(0,c.jsx)("div",{className:"space-y-1",children:f.map(e=>(0,c.jsxs)("div",{className:"flex items-center gap-3 px-3 py-2 bg-slate-800/30 rounded text-xs",children:[(0,c.jsx)("span",{className:"text-slate-400 w-6 text-right",children:e.priority}),(0,c.jsx)("span",{className:"text-slate-200 flex-1",children:e.name}),(0,c.jsx)("code",{className:"text-slate-500 text-[10px] max-w-[120px] truncate",children:e.condition_value}),(0,c.jsx)("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-medium ${"block"===e.action?"bg-red-500/20 text-red-400":"quarantine"===e.action?"bg-yellow-500/20 text-yellow-400":"bg-green-500/20 text-green-400"}`,children:e.action}),(0,c.jsx)("button",{onClick:()=>o.mutate({id:e.id,enabled:+!e.enabled}),className:"text-slate-500 hover:text-slate-300",title:e.enabled?"Disable":"Enable",children:e.enabled?(0,c.jsx)(oo,{size:14,className:"text-cyan-400"}):(0,c.jsx)(ol,{size:14})}),(0,c.jsx)("button",{onClick:()=>d.mutate(e.id),className:"text-slate-500 hover:text-red-400",children:(0,c.jsx)(on,{size:12})})]},e.id))})]})}function oy(){return(0,c.jsxs)("div",{className:"space-y-3",children:[(0,c.jsxs)("div",{className:"flex items-center gap-2",children:[(0,c.jsx)(ll,{size:16,className:"text-cyan-400"}),(0,c.jsx)("h3",{className:"text-sm font-medium text-slate-200",children:"Custom Firewall Rules"}),(0,c.jsx)("span",{className:"text-xs text-slate-500",children:"0/25"})]}),(0,c.jsx)("div",{className:"space-y-1",children:ou.map(e=>(0,c.jsxs)("div",{className:"flex items-center gap-3 px-3 py-2 bg-slate-800/30 rounded text-xs",children:[(0,c.jsx)("span",{className:"text-slate-400 w-6 text-right",children:e.priority}),(0,c.jsx)("span",{className:"text-slate-200 flex-1",children:e.name}),(0,c.jsx)("code",{className:"text-slate-500 text-[10px] max-w-[120px] truncate",children:e.condition_value}),(0,c.jsx)("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-medium ${"block"===e.action?"bg-red-500/20 text-red-400":"quarantine"===e.action?"bg-yellow-500/20 text-yellow-400":"bg-green-500/20 text-green-400"}`,children:e.action})]},e.id))})]})}function ov(){return(0,c.jsx)("div",{className:"bg-slate-900/50 border border-slate-800 rounded-xl p-4",children:(0,c.jsx)(od,{feature:"custom_firewall_rules",label:"Add custom rules to control what gets blocked, allowed, or quarantined.",children:(0,c.jsx)(og,{})})})}function ob(){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)(oa,{}),(0,c.jsx)(lV,{}),(0,c.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[(0,c.jsx)(lS,{timeRange:e}),(0,c.jsx)(lC,{}),(0,c.jsx)(lT,{timeRange:e}),(0,c.jsx)(lP,{timeRange:e})]}),(0,c.jsx)("div",{className:"mt-4",children:(0,c.jsx)(lW,{})}),(0,c.jsx)("div",{className:"mt-4",children:(0,c.jsx)(l0,{})}),(0,c.jsx)("div",{className:"mt-4",children:(0,c.jsx)(l3,{})}),(0,c.jsx)("div",{className:"mt-4",children:(0,c.jsx)(ov,{})}),(0,c.jsx)(lR,{})]})}let oj=ln("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]),ow=ln("file-braces",[["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 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"1oajmo"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"mpwhp6"}]]),oN=h.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";function ok(){let e=(0,n6.useMutation)({mutationFn:async({format:e,startTime:t,endTime:s})=>{let i=new URLSearchParams({format:e});t&&i.set("startTime",t),s&&i.set("endTime",s);let a=await (0,rL.gatedFetch)(`${oN}/api/audit/export?${i}`);if(!a.ok)throw Error((await a.json().catch(()=>({}))).error||"Export failed");let r=await a.blob(),n=URL.createObjectURL(r),l=document.createElement("a");return l.href=n,l.download=`shieldcortex-audit-${Date.now()}.${"csv"===e?"csv":"json"}`,document.body.appendChild(l),l.click(),document.body.removeChild(l),URL.revokeObjectURL(n),{success:!0}}}),[t,s]=(0,u.useState)("json");return(0,c.jsxs)("div",{className:"space-y-3",children:[(0,c.jsxs)("div",{className:"flex items-center gap-2",children:[(0,c.jsx)(oj,{size:16,className:"text-cyan-400"}),(0,c.jsx)("h3",{className:"text-sm font-medium text-slate-200",children:"Export Audit Logs"})]}),(0,c.jsxs)("div",{className:"flex items-center gap-3",children:[(0,c.jsxs)("div",{className:"flex rounded-lg overflow-hidden border border-slate-700",children:[(0,c.jsxs)("button",{onClick:()=>s("json"),className:`flex items-center gap-1.5 px-3 py-1.5 text-xs transition-colors ${"json"===t?"bg-cyan-600/20 text-cyan-400":"bg-slate-800 text-slate-400 hover:text-slate-200"}`,children:[(0,c.jsx)(ow,{size:12})," JSON"]}),(0,c.jsxs)("button",{onClick:()=>s("csv"),className:`flex items-center gap-1.5 px-3 py-1.5 text-xs transition-colors ${"csv"===t?"bg-cyan-600/20 text-cyan-400":"bg-slate-800 text-slate-400 hover:text-slate-200"}`,children:[(0,c.jsx)(lo,{size:12})," CSV"]})]}),(0,c.jsxs)("button",{onClick:()=>e.mutate({format:t}),disabled:e.isPending,className:"flex items-center gap-1.5 px-4 py-1.5 text-xs bg-cyan-600 text-white rounded-lg hover:bg-cyan-500 disabled:opacity-50 transition-colors",children:[(0,c.jsx)(oj,{size:12}),e.isPending?"Exporting...":"Export"]})]}),e.error&&(0,c.jsx)("p",{className:"text-xs text-red-400",children:e.error.message}),e.isSuccess&&(0,c.jsx)("p",{className:"text-xs text-green-400",children:"Export downloaded successfully."})]})}function oS(){return(0,c.jsx)("div",{className:"bg-slate-900/50 border border-slate-800 rounded-xl p-4",children:(0,c.jsx)(od,{feature:"audit_export",label:"Export your full audit trail as JSON or CSV for compliance reporting.",children:(0,c.jsx)(ok,{})})})}let oC={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 oT(){let{projectFilter:e,selectedAuditEntry:t,setSelectedAuditEntry:s}=(0,rM.useDashboardStore)(),[i,a]=(0,u.useState)("24h"),[r,n]=(0,u.useState)(void 0),[l,o]=(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 x=(0,u.useMemo)(()=>new Date(6e4*Math.floor((h-36e5*d[i])/6e4)).toISOString(),[h,i]),{data:p,isLoading:f}=(0,n3.useAuditLogs)({startTime:x,source:r,firewallResult:l,project:e||void 0,limit:200}),g=p?.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:()=>a(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:l||"",onChange:e=>o(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:r||"",onChange:e=>n(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 ${oC[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))})]})}),(0,c.jsx)("div",{className:"mt-4",children:(0,c.jsx)(oS,{})})]})}let oP={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"}},oA={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)"}},oM={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 oE(e){return e>=.7?"#22C55E":e>=.4?"#EAB308":"#EF4444"}function oD(e){return e>.5?"#EF4444":e>.2?"#EAB308":"#94a3b8"}function oL({entry:e,onClose:t,onViewMemory:s}){let[i,a]=(0,u.useState)(!1),r=oP[e.firewall_result]||oP.ALLOW,n=oA[e.sensitivity_level]||oA.PUBLIC,l=function(e){try{let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}(e.threat_indicators),o=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(()=>{a(!0),setTimeout(()=>a(!1),1500)})},[e]);return(0,c.jsxs)(nF,{className:"bg-slate-900 border-slate-700 h-full overflow-auto",children:[(0,c.jsxs)(nR,{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:r.bg,color:r.color},children:r.label}),(0,c.jsx)("span",{className:"px-2 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:n.bg,color:n.color},children:e.sensitivity_level})]}),(0,c.jsx)(nQ,{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)(n$,{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:oE(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:oE(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:oD(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:oD(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"}),l.length>0?(0,c.jsx)("div",{className:"flex flex-wrap gap-1.5",children:l.map((e,t)=>{let s=oM[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"})]}),o.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:o.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)(nQ,{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)(nQ,{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 oF=ln("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);function oR({action:e,item:t,onConfirm:s,onCancel:i}){let[a,r]=(0,u.useState)(""),n="yes"===a.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:a,onChange:e=>r(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&&n&&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:!n,className:`px-3 py-1.5 text-xs rounded-lg transition-colors ${n?"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 oV(){let{projectFilter:e}=(0,rM.useDashboardStore)(),[t,s]=(0,u.useState)("pending"),{data:i,isLoading:a}=(0,n3.useQuarantine)(t,100,e||void 0),r=(0,n3.useApproveQuarantine)(),n=(0,n3.useRejectQuarantine)(),[l,o]=(0,u.useState)(null),d=i?.items??[];return(0,c.jsxs)("div",{className:"h-full flex flex-col overflow-hidden",children:[l&&(0,c.jsx)(oR,{action:l.action,item:l.item,onConfirm:()=>{l&&("approve"===l.action?r.mutate(l.item.id):n.mutate({id:l.item.id}),o(null))},onCancel:()=>o(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:a?(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)(ld,{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:()=>o({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)(oF,{size:12})," Approve"]}),(0,c.jsxs)("button",{onClick:()=>o({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)(lL,{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 o$=ln("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"}]]),oz=ln("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"}]]),o_=ln("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),oI=h.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";async function oO(e,t){let s=new URLSearchParams({timeRange:e});t&&s.set("project",t);let i=await (0,rL.authFetch)(`${oI}/api/v1/agents?${s}`);if(!i.ok)throw Error("Failed to fetch agent registry");return i.json()}async function oB(e,t,s){let i=encodeURIComponent(e),a=new URLSearchParams({timeRange:t});s&&a.set("project",s);let r=await (0,rL.authFetch)(`${oI}/api/v1/agents/${i}/timeline?${a}`);if(!r.ok)throw Error("Failed to fetch agent timeline");return r.json()}async function oU(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 a=await (0,rL.authFetch)(`${oI}/api/v1/agents/${s}/operations?${i}`);if(!a.ok)throw Error("Failed to fetch agent operations");return a.json()}function oq(e,t){return(0,rD.useQuery)({queryKey:["agent-operations",e,t],queryFn:()=>oU(e,t),enabled:!!e,refetchInterval:3e4,retry:2})}function oW(e){return e>=.7?"full":e>=.5?"limited":"restricted"}let oK={full:"text-green-400",limited:"text-yellow-400",restricted:"text-red-400"},oQ={full:"bg-green-500/10",limited:"bg-yellow-500/10",restricted:"bg-red-500/10"},oH={full:"Full Access",limited:"Limited",restricted:"Restricted"},oX=460,oY=90;function oG({identifier:e,timeRange:t}){let{data:s,isLoading:i}=function(e,t="24h",s){return(0,rD.useQuery)({queryKey:["agent-timeline",e,t,void 0],queryFn:()=>oB(e,t,void 0),enabled:!!e,refetchInterval:3e4,retry:2})}(e,t),a=s?.points??[],{linePath:r,dots:n,xLabels:l}=(0,u.useMemo)(()=>{if(0===a.length)return{linePath:"",dots:[],xLabels:[]};let e=a.map(e=>new Date(e.timestamp).getTime()),s=Math.min(...e),i=Math.max(...e)-s||1,r=e=>30+(e-s)/i*oX,n=e=>10+(1-e)*oY,l=a.map((t,s)=>{let i=r(e[s]),a=n(t.trust_score);return`${0===s?"M":"L"} ${i} ${a}`}),o=a.map((t,s)=>({x:r(e[s]),y:n(t.trust_score),result:t.firewall_result,score:t.trust_score,time:t.timestamp})).filter(e=>"ALLOW"!==e.result),d=Math.min(5,a.length),c=[];for(let e=0;e<d;e++){let a=s+i*e/(d-1||1),n=new Date(a);c.push({x:r(a),label:"24h"===t?n.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):n.toLocaleDateString([],{month:"short",day:"numeric"})})}return{linePath:l.join(" "),dots:o,xLabels:c}},[a,t]);return i?(0,c.jsx)("div",{className:"h-[120px] flex items-center justify-center text-slate-500 text-xs",children:"Loading timeline..."}):0===a.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)*oY,x2:30+oX,y2:10+(1-.7)*oY,stroke:"#22c55e",strokeWidth:"0.5",strokeDasharray:"4 2",opacity:"0.3"}),(0,c.jsx)("line",{x1:30,y1:10+.5*oY,x2:30+oX,y2:10+.5*oY,stroke:"#eab308",strokeWidth:"0.5",strokeDasharray:"4 2",opacity:"0.3"}),(0,c.jsx)("text",{x:26,y:10+(1-.7)*oY+3,fill:"#64748b",fontSize:"8",textAnchor:"end",children:"0.7"}),(0,c.jsx)("text",{x:26,y:10+.5*oY+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+oY+3,fill:"#64748b",fontSize:"8",textAnchor:"end",children:"0.0"}),(0,c.jsx)("path",{d:r,fill:"none",stroke:"#06b6d4",strokeWidth:"1.5"}),n.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)),l.map((e,t)=>(0,c.jsx)("text",{x:e.x,y:116,fill:"#64748b",fontSize:"8",textAnchor:"middle",children:e.label},t))]})}let oJ={BLOCK:"text-red-400 bg-red-500/10",QUARANTINE:"text-yellow-400 bg-yellow-500/10"};function oZ({identifier:e}){let{data:t,isLoading:s}=oq(e,{firewallResult:"BLOCK",limit:20}),{data:i}=oq(e,{firewallResult:"QUARANTINE",limit:20}),a=[...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===a.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:a.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 ${oJ[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 o0=ln("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"}]]),o1=h.default.env.NEXT_PUBLIC_WS_URL||"ws://localhost:3001/ws/events";function o2({agentFilter:e}){let[t,s]=(0,u.useState)([]),i=(0,u.useRef)(0),a=(0,u.useRef)(null),r=(0,u.useCallback)(t=>{try{let a=JSON.parse(t.data);if("defence_event"!==a.type)return;let r=a.data;if(e&&r.source_identifier!==e)return;s(e=>[{...r,id:++i.current},...e].slice(0,50))}catch{}},[e]);return((0,u.useEffect)(()=>{try{let e=new WebSocket(o1);return a.current=e,e.onmessage=r,e.onerror=()=>{},()=>{e.close(),a.current=null}}catch{return}},[r]),0===t.length)?(0,c.jsxs)("div",{className:"flex items-center gap-2 text-slate-500 text-xs py-2",children:[(0,c.jsx)(o0,{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)(M,{initial:!1,children:t.map(e=>(0,c.jsxs)(rT.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 o5({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)(o_,{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 o4({score:e}){let t=oW(e);return(0,c.jsxs)("span",{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-medium ${oK[t]} ${oQ[t]}`,children:[e.toFixed(2)," · ",oH[t]]})}function o3({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 o6(){let{projectFilter:e}=(0,rM.useDashboardStore)(),[t,s]=(0,u.useState)("24h"),[i,a]=(0,u.useState)(null),[r,n]=(0,u.useState)("operation_count"),[l,o]=(0,u.useState)(!1),[d,h]=(0,u.useState)(null),[m,x]=(0,u.useState)(null),[p,f]=(0,u.useState)(!1),[g]=(0,u.useState)(()=>Date.now()),{data:y,isLoading:v}=function(e="24h",t){return(0,rD.useQuery)({queryKey:["agents",e,t],queryFn:()=>oO(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=>oW(e.avg_trust_score)===m)),p&&(e=e.filter(e=>e.flagged_count>0)),e},[b,d,m,p]),w=(0,u.useMemo)(()=>{let e=[...j];return e.sort((e,t)=>{let s=e[r],i=t[r];return"string"==typeof s&&"string"==typeof i?l?s.localeCompare(i):i.localeCompare(s):l?s-i:i-s}),e},[j,r,l]),N=(0,u.useMemo)(()=>[...new Set(b.map(e=>e.source_type))],[b]),k=e=>{r===e?o(!l):(n(e),o(!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)(lm,{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)(o$,{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:()=>x(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(!p),className:`px-1.5 py-0.5 text-[10px] rounded transition-colors flex items-center gap-0.5 ${p?"bg-red-600/20 text-red-400":"text-slate-500 hover:text-slate-300"}`,children:[(0,c.jsx)(ld,{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)(oz,{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)(oz,{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)(oz,{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)(oz,{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:()=>a(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)(o5,{identifier:e.source_identifier,compact:!0}),(0,c.jsx)("div",{className:"mt-0.5",children:(0,c.jsx)(o3,{type:e.source_type})})]}),(0,c.jsx)(o4,{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)(M,{children:i&&(0,c.jsxs)(rT.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)(o5,{identifier:i.source_identifier}),(0,c.jsx)("button",{onClick:()=>a(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)(o3,{type:i.source_type}),(0,c.jsx)(o4,{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)(oG,{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)(oZ,{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)(o2,{agentFilter:i.source_identifier})]})]})})]})}let o8=ln("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"}]]),o7={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 o9({level:e}){let t=o7[e]??o7.low;return(0,c.jsx)("span",{className:`text-[10px] font-medium px-1.5 py-0.5 rounded ${t}`,children:e.toUpperCase()})}function de({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)(o9,{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 dt(e){let t=e.split(/[/\\]/);return t[t.length-1]||e}function ds({file:e,cloudConnected:t,onTrust:s,onUntrust:i,onRemove:a,onCloudUpsell:r}){let[n,l]=(0,u.useState)(!e.safe),[o,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:()=>l(!n),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)(o8,{size:16,className:"text-cyan-400 shrink-0"}):e.safe?(0,c.jsx)(lD,{size:16,className:"text-green-400 shrink-0"}):(0,c.jsx)(l$,{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||dt(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)(o9,{level:e.riskLevel}),(0,c.jsxs)("span",{className:"text-[10px] text-slate-600 shrink-0",children:[e.scanDurationMs,"ms"]}),e.findings.length>0?n?(0,c.jsx)(lw,{size:14,className:"text-slate-500 shrink-0"}):(0,c.jsx)(o_,{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)(o8,{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)(ll,{size:14})}),!e.safe&&!e.trusted&&(0,c.jsx)("button",{onClick:()=>t?d(!0):r(),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)(on,{size:14})})]})]}),o&&(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||dt(e.path)}),"? This will delete the file from disk."]}),(0,c.jsx)("button",{onClick:()=>{a(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"})]}),n&&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)(de,{findings:e.findings})})]})}function di({files:e,cloudConnected:t,onTrust:s,onUntrust:i,onRemove:a,onCloudUpsell:r}){return 0===e.length?null:(0,c.jsx)("div",{className:"space-y-1.5",children:e.map(e=>(0,c.jsx)(ds,{file:e,cloudConnected:t,onTrust:s,onUntrust:i,onRemove:a,onCloudUpsell:r},e.path))})}let da=ln("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]),dr=h.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";function dn(){let[e,t]=(0,u.useState)(null),[s,i]=(0,u.useState)(!1),[a,r]=(0,u.useState)(null),[n,l]=(0,u.useState)(!1),o=async()=>{i(!0),r(null);try{let e=await (0,rL.gatedFetch)(`${dr}/api/skills/deep-scan`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:[]})});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.error||"Deep scan failed")}t(await e.json())}catch(e){e instanceof rL.FeatureLockedError?l(!0):r(e.message)}finally{i(!1)}};return n?(0,c.jsx)(dl,{}):(0,c.jsxs)("div",{className:"space-y-3",children:[(0,c.jsxs)("div",{className:"flex items-center justify-between",children:[(0,c.jsxs)("div",{className:"flex items-center gap-2",children:[(0,c.jsx)(lx,{size:16,className:"text-cyan-400"}),(0,c.jsx)("h3",{className:"text-sm font-medium text-slate-200",children:"Deep Skill Scanner"})]}),(0,c.jsxs)("button",{onClick:o,disabled:s,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs bg-cyan-600 text-white rounded-lg hover:bg-cyan-500 disabled:opacity-50 transition-colors",children:[(0,c.jsx)(da,{size:12}),s?"Scanning...":"Run Deep Scan"]})]}),a&&(0,c.jsx)("p",{className:"text-xs text-red-400",children:a}),e&&(0,c.jsxs)("div",{className:"space-y-3",children:[e.degraded&&(0,c.jsx)("p",{className:"text-[10px] text-yellow-400 bg-yellow-500/10 px-2 py-1 rounded",children:e.degradedReason}),e.correlations.length>0&&(0,c.jsxs)("div",{className:"space-y-1",children:[(0,c.jsx)("h4",{className:"text-xs text-slate-400 font-medium",children:"Cross-File Correlations"}),e.correlations.map((e,t)=>(0,c.jsxs)("div",{className:"flex items-start gap-2 px-3 py-2 bg-slate-800/30 rounded text-xs",children:[(0,c.jsx)(ld,{size:12,className:"critical"===e.severity?"text-red-400 mt-0.5":"high"===e.severity?"text-orange-400 mt-0.5":"text-yellow-400 mt-0.5"}),(0,c.jsxs)("div",{children:[(0,c.jsx)("p",{className:"text-slate-200",children:e.finding}),(0,c.jsxs)("p",{className:"text-slate-500 text-[10px]",children:["Files: ",e.files.join(", ")]})]})]},t))]}),Object.keys(e.intentBreakdown).length>0&&(0,c.jsxs)("div",{children:[(0,c.jsx)("h4",{className:"text-xs text-slate-400 font-medium mb-1",children:"Intent Breakdown"}),(0,c.jsx)("div",{className:"grid grid-cols-2 gap-1",children:Object.entries(e.intentBreakdown).map(([e,t])=>(0,c.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[(0,c.jsx)("div",{className:"flex-1",children:(0,c.jsx)("div",{className:"h-1.5 bg-slate-800 rounded-full overflow-hidden",children:(0,c.jsx)("div",{className:"h-full bg-cyan-500/60 rounded-full",style:{width:`${Math.min(100,5*t)}%`}})})}),(0,c.jsx)("span",{className:"text-slate-500 text-[10px] w-16 truncate",children:e}),(0,c.jsx)("span",{className:"text-slate-400 text-[10px] w-4 text-right",children:t})]},e))})]}),e.recommendations.length>0&&(0,c.jsxs)("div",{children:[(0,c.jsx)("h4",{className:"text-xs text-slate-400 font-medium mb-1",children:"Recommendations"}),(0,c.jsx)("ul",{className:"space-y-1",children:e.recommendations.map((e,t)=>(0,c.jsx)("li",{className:"text-xs text-slate-300 pl-3 relative before:absolute before:left-0 before:top-1.5 before:w-1.5 before:h-1.5 before:rounded-full before:bg-cyan-500/40",children:e},t))})]}),0===e.correlations.length&&0===Object.keys(e.intentBreakdown).length&&(0,c.jsx)("p",{className:"text-xs text-slate-500 text-center py-2",children:"No files provided for scanning. Upload skill files to analyse."})]}),!e&&!s&&(0,c.jsx)("p",{className:"text-xs text-slate-500 text-center py-2",children:"Run a deep scan to analyse skill files for cross-file threats and intent patterns."})]})}function dl(){return(0,c.jsxs)("div",{className:"space-y-3",children:[(0,c.jsxs)("div",{className:"flex items-center gap-2",children:[(0,c.jsx)(lx,{size:16,className:"text-cyan-400"}),(0,c.jsx)("h3",{className:"text-sm font-medium text-slate-200",children:"Deep Skill Scanner"})]}),(0,c.jsxs)("div",{className:"space-y-1",children:[(0,c.jsx)("h4",{className:"text-xs text-slate-400 font-medium",children:"Cross-File Correlations"}),ox.map((e,t)=>(0,c.jsxs)("div",{className:"flex items-start gap-2 px-3 py-2 bg-slate-800/30 rounded text-xs",children:[(0,c.jsx)(ld,{size:12,className:"critical"===e.severity?"text-red-400 mt-0.5":"high"===e.severity?"text-orange-400 mt-0.5":"text-yellow-400 mt-0.5"}),(0,c.jsxs)("div",{children:[(0,c.jsx)("p",{className:"text-slate-200",children:e.finding}),(0,c.jsxs)("p",{className:"text-slate-500 text-[10px]",children:["Files: ",e.files.join(", ")]})]})]},t))]}),(0,c.jsxs)("div",{children:[(0,c.jsx)("h4",{className:"text-xs text-slate-400 font-medium mb-1",children:"Intent Breakdown"}),(0,c.jsx)("div",{className:"grid grid-cols-2 gap-1",children:Object.entries(op).map(([e,t])=>(0,c.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[(0,c.jsx)("div",{className:"flex-1",children:(0,c.jsx)("div",{className:"h-1.5 bg-slate-800 rounded-full overflow-hidden",children:(0,c.jsx)("div",{className:"h-full bg-cyan-500/60 rounded-full",style:{width:`${t}%`}})})}),(0,c.jsx)("span",{className:"text-slate-500 text-[10px] w-16 truncate",children:e}),(0,c.jsx)("span",{className:"text-slate-400 text-[10px] w-4 text-right",children:t})]},e))})]}),(0,c.jsxs)("div",{children:[(0,c.jsx)("h4",{className:"text-xs text-slate-400 font-medium mb-1",children:"Recommendations"}),(0,c.jsx)("ul",{className:"space-y-1",children:of.map((e,t)=>(0,c.jsx)("li",{className:"text-xs text-slate-300 pl-3 relative before:absolute before:left-0 before:top-1.5 before:w-1.5 before:h-1.5 before:rounded-full before:bg-cyan-500/40",children:e},t))})]})]})}function dd(){return(0,c.jsx)("div",{className:"bg-slate-900/50 border border-slate-800 rounded-xl p-4",children:(0,c.jsx)(od,{feature:"skill_scanner_deep",label:"Deep skill scanning with multi-file analysis and semantic intent detection.",children:(0,c.jsx)(dn,{})})})}let dc=[{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 du(){let e=lO(),t=(0,n6.useMutation)({mutationFn:lI}),s=(0,n6.useMutation)({mutationFn:lB}),i=(0,n6.useMutation)({mutationFn:lU}),a=(0,n6.useMutation)({mutationFn:lq}),{data:r}=l2(),[n,l]=(0,u.useState)(null),[o,d]=(0,u.useState)(null),[h,m]=(0,u.useState)(!1),[x,p]=(0,u.useState)(""),[f,g]=(0,u.useState)(""),[y,v]=(0,u.useState)(!1),b=!!(r?.enabled&&r?.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=>l(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)(lE,{size:14,className:"animate-spin"}):(0,c.jsx)(lx,{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)(lA,{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"})]}),n?(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:n.totalScanned})," files scanned"]}),(0,c.jsx)("span",{className:"text-slate-600",children:"·"}),n.threatCount>0?(0,c.jsxs)("span",{children:[(0,c.jsx)("span",{className:"text-red-400 font-medium",children:n.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(n.scannedAt).toLocaleTimeString()})]}),(0,c.jsx)(di,{files:n.files,cloudConnected:b,onTrust:e=>{s.mutate(e,{onSuccess:()=>{n&&l({...n,files:n.files.map(t=>t.path===e?{...t,trusted:!0}:t),threatCount:n.files.filter(t=>!t.safe&&!t.trusted&&t.path!==e).length})}})},onUntrust:e=>{i.mutate(e,{onSuccess:()=>{n&&l({...n,files:n.files.map(t=>t.path===e?{...t,trusted:!1}:t),threatCount:n.files.filter(t=>{let s=t.path!==e&&t.trusted;return!t.safe&&!s}).length})}})},onRemove:e=>{a.mutate(e,{onSuccess:()=>{if(n){let t=n.files.filter(t=>t.path!==e);l({...n,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)(lE,{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)(lx,{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)(lw,{size:14}):(0,c.jsx)(o_,{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:x,onChange:e=>p(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:dc.map(e=>(0,c.jsx)("option",{value:e.value,children:e.label},e.value))}),(0,c.jsxs)("button",{onClick:()=>{x.trim()&&t.mutate({content:x,format:f||void 0},{onSuccess:e=>d(e)})},disabled:t.isPending||!x.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)(lE,{size:12,className:"animate-spin"}):(0,c.jsx)(lx,{size:12}),"Scan Content"]})]}),o&&(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:o.skillName}),(0,c.jsx)(o9,{level:o.riskLevel}),(0,c.jsxs)("span",{className:"text-[10px] text-slate-500",children:[o.scanDurationMs,"ms"]})]}),(0,c.jsx)("p",{className:"text-xs text-slate-400",children:o.summary}),o.findings.length>0&&(0,c.jsx)(de,{findings:o.findings})]})]})]}),(0,c.jsx)("div",{className:"mt-4",children:(0,c.jsx)(dd,{})})]})}let dh=ln("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"}]]),dm=ln("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"}]]),dx=ln("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"}]]),dp=ln("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]),df=h.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";function dg(){let e,t,s,{data:i,isLoading:a,isLocked:r}={...e=(0,rD.useQuery)({queryKey:["custom-patterns"],queryFn:()=>(0,rL.gatedFetch)(`${df}/api/patterns`).then(e=>{if(!e.ok)throw Error("Failed to fetch custom patterns");return e.json()}),retry:(e,t)=>!(t instanceof rL.FeatureLockedError)&&e<2,refetchInterval:3e4}),isLocked:e.error instanceof rL.FeatureLockedError},n=(t=(0,n0.useQueryClient)(),(0,n6.useMutation)({mutationFn:e=>(0,rL.gatedFetch)(`${df}/api/patterns`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}).then(e=>e.ok?e.json():e.json().then(e=>{throw Error(e.error)})),onSuccess:()=>{t.invalidateQueries({queryKey:["custom-patterns"]})}})),l=(s=(0,n0.useQueryClient)(),(0,n6.useMutation)({mutationFn:e=>(0,rL.gatedFetch)(`${df}/api/patterns/${e}`,{method:"DELETE"}).then(e=>e.ok?e.json():e.json().then(e=>{throw Error(e.error)})),onSuccess:()=>{s.invalidateQueries({queryKey:["custom-patterns"]})}})),o=(0,n6.useMutation)({mutationFn:({id:e,text:t})=>(0,rL.gatedFetch)(`${df}/api/patterns/${e}/test`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:t})}).then(e=>e.ok?e.json():e.json().then(e=>{throw Error(e.error)}))}),[d,h]=(0,u.useState)(!1),[m,x]=(0,u.useState)(null),[p,f]=(0,u.useState)({name:"",category:"custom",severity:"medium",regex:"",description:""}),g=i?.patterns??[],y=!0,v="";if(p.regex)try{new RegExp(p.regex)}catch(e){y=!1,v=e.message}return r?(0,c.jsx)(dy,{}):(0,c.jsxs)("div",{className:"space-y-3",children:[(0,c.jsxs)("div",{className:"flex items-center justify-between",children:[(0,c.jsxs)("div",{className:"flex items-center gap-2",children:[(0,c.jsx)(lp,{size:16,className:"text-red-400"}),(0,c.jsx)("h3",{className:"text-sm font-medium text-slate-200",children:"Custom Injection Patterns"}),(0,c.jsxs)("span",{className:"text-xs text-slate-500",children:[g.length,"/50"]})]}),(0,c.jsxs)("button",{onClick:()=>h(!d),className:"flex items-center gap-1 px-2 py-1 text-xs bg-red-600/20 text-red-400 rounded hover:bg-red-600/30 transition-colors",children:[(0,c.jsx)(or,{size:12})," Add Pattern"]})]}),d&&(0,c.jsxs)("form",{onSubmit:e=>{e.preventDefault(),n.mutate(p,{onSuccess:()=>{h(!1),f({name:"",category:"custom",severity:"medium",regex:"",description:""})}})},className:"p-3 bg-slate-800/50 rounded-lg space-y-2",children:[(0,c.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,c.jsx)("input",{value:p.name,onChange:e=>f(t=>({...t,name:e.target.value})),placeholder:"Pattern name",required:!0,className:"px-2 py-1.5 text-xs bg-slate-900 border border-slate-700 rounded text-slate-200 placeholder:text-slate-600"}),(0,c.jsxs)("select",{value:p.severity,onChange:e=>f(t=>({...t,severity:e.target.value})),className:"px-2 py-1.5 text-xs bg-slate-900 border border-slate-700 rounded text-slate-200",children:[(0,c.jsx)("option",{value:"critical",children:"Critical"}),(0,c.jsx)("option",{value:"high",children:"High"}),(0,c.jsx)("option",{value:"medium",children:"Medium"}),(0,c.jsx)("option",{value:"low",children:"Low"})]})]}),(0,c.jsxs)("div",{className:"relative",children:[(0,c.jsx)("input",{value:p.regex,onChange:e=>f(t=>({...t,regex:e.target.value})),placeholder:"Regex pattern",required:!0,className:`w-full px-2 py-1.5 text-xs bg-slate-900 border rounded text-slate-200 font-mono placeholder:text-slate-600 ${y?"border-slate-700":"border-red-500"}`}),!y&&(0,c.jsx)("p",{className:"text-[10px] text-red-400 mt-0.5",children:v})]}),(0,c.jsx)("input",{value:p.description,onChange:e=>f(t=>({...t,description:e.target.value})),placeholder:"Description (optional)",className:"w-full px-2 py-1.5 text-xs bg-slate-900 border border-slate-700 rounded text-slate-200 placeholder:text-slate-600"}),(0,c.jsxs)("div",{className:"flex gap-2",children:[(0,c.jsx)("button",{type:"submit",disabled:n.isPending||!y,className:"px-3 py-1 text-xs bg-red-600 text-white rounded hover:bg-red-500 disabled:opacity-50",children:n.isPending?"Creating...":"Create"}),(0,c.jsx)("button",{type:"button",onClick:()=>h(!1),className:"px-3 py-1 text-xs text-slate-400 hover:text-slate-200",children:"Cancel"})]}),n.error&&(0,c.jsx)("p",{className:"text-xs text-red-400",children:n.error.message})]}),a?(0,c.jsx)("div",{className:"text-xs text-slate-500 py-4 text-center",children:"Loading patterns..."}):0===g.length?(0,c.jsx)("div",{className:"text-xs text-slate-500 py-4 text-center",children:'No custom patterns yet. Click "Add Pattern" to create one.'}):(0,c.jsx)("div",{className:"space-y-1",children:g.map(e=>(0,c.jsxs)("div",{className:"px-3 py-2 bg-slate-800/30 rounded text-xs space-y-1",children:[(0,c.jsxs)("div",{className:"flex items-center gap-2",children:[(0,c.jsx)("span",{className:"text-slate-200 flex-1 font-medium",children:e.name}),(0,c.jsx)("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-medium ${"critical"===e.severity?"bg-red-500/20 text-red-400":"high"===e.severity?"bg-orange-500/20 text-orange-400":"medium"===e.severity?"bg-yellow-500/20 text-yellow-400":"bg-slate-500/20 text-slate-400"}`,children:e.severity}),(0,c.jsx)("button",{onClick:()=>x(m?.id===e.id?null:{id:e.id,text:""}),className:"text-slate-500 hover:text-cyan-400",title:"Test pattern",children:(0,c.jsx)(dp,{size:12})}),(0,c.jsx)("button",{onClick:()=>l.mutate(e.id),className:"text-slate-500 hover:text-red-400",children:(0,c.jsx)(on,{size:12})})]}),(0,c.jsx)("code",{className:"text-slate-500 text-[10px] block truncate",children:e.regex}),m?.id===e.id&&(0,c.jsxs)("div",{className:"flex gap-2 mt-1",children:[(0,c.jsx)("input",{value:m.text,onChange:t=>x({id:e.id,text:t.target.value}),placeholder:"Test text...",className:"flex-1 px-2 py-1 text-[10px] bg-slate-900 border border-slate-700 rounded text-slate-200 placeholder:text-slate-600"}),(0,c.jsx)("button",{onClick:()=>o.mutate({id:e.id,text:m.text}),disabled:!m.text,className:"px-2 py-1 text-[10px] bg-cyan-600/20 text-cyan-400 rounded hover:bg-cyan-600/30 disabled:opacity-50",children:"Test"}),o.data&&(0,c.jsxs)("span",{className:"text-[10px] text-slate-400 self-center",children:[o.data.count," matches"]})]})]},e.id))})]})}function dy(){return(0,c.jsxs)("div",{className:"space-y-3",children:[(0,c.jsxs)("div",{className:"flex items-center gap-2",children:[(0,c.jsx)(lp,{size:16,className:"text-red-400"}),(0,c.jsx)("h3",{className:"text-sm font-medium text-slate-200",children:"Custom Injection Patterns"}),(0,c.jsx)("span",{className:"text-xs text-slate-500",children:"0/50"})]}),(0,c.jsx)("div",{className:"space-y-1",children:oh.map(e=>(0,c.jsxs)("div",{className:"px-3 py-2 bg-slate-800/30 rounded text-xs space-y-1",children:[(0,c.jsxs)("div",{className:"flex items-center gap-2",children:[(0,c.jsx)("span",{className:"text-slate-200 flex-1 font-medium",children:e.name}),(0,c.jsx)("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-medium ${"critical"===e.severity?"bg-red-500/20 text-red-400":"high"===e.severity?"bg-orange-500/20 text-orange-400":"bg-yellow-500/20 text-yellow-400"}`,children:e.severity})]}),(0,c.jsx)("code",{className:"text-slate-500 text-[10px] block truncate",children:e.regex})]},e.id))})]})}function dv(){return(0,c.jsx)("div",{className:"bg-slate-900/50 border border-slate-800 rounded-xl p-4",children:(0,c.jsx)(od,{feature:"custom_injection_patterns",label:"Define up to 50 custom regex patterns for detecting domain-specific threats.",children:(0,c.jsx)(dg,{})})})}let db=h.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";function dj(){let e,t,s,i,{data:a,isLoading:r,isLocked:n}={...e=(0,rD.useQuery)({queryKey:["custom-policies"],queryFn:()=>(0,rL.gatedFetch)(`${db}/api/iron-dome/policies`).then(e=>{if(!e.ok)throw Error("Failed to fetch custom policies");return e.json()}),retry:(e,t)=>!(t instanceof rL.FeatureLockedError)&&e<2,refetchInterval:3e4}),isLocked:e.error instanceof rL.FeatureLockedError},l=(t=(0,n0.useQueryClient)(),(0,n6.useMutation)({mutationFn:e=>(0,rL.gatedFetch)(`${db}/api/iron-dome/policies`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}).then(e=>e.ok?e.json():e.json().then(e=>{throw Error(e.error)})),onSuccess:()=>{t.invalidateQueries({queryKey:["custom-policies"]})}})),o=(s=(0,n0.useQueryClient)(),(0,n6.useMutation)({mutationFn:e=>(0,rL.gatedFetch)(`${db}/api/iron-dome/policies/${e}`,{method:"DELETE"}).then(e=>e.ok?e.json():e.json().then(e=>{throw Error(e.error)})),onSuccess:()=>{s.invalidateQueries({queryKey:["custom-policies"]})}})),d=(i=(0,n0.useQueryClient)(),(0,n6.useMutation)({mutationFn:e=>(0,rL.gatedFetch)(`${db}/api/iron-dome/policies/${e}/activate`,{method:"PUT"}).then(e=>e.ok?e.json():e.json().then(e=>{throw Error(e.error)})),onSuccess:()=>{i.invalidateQueries({queryKey:["custom-policies"]})}})),[h,m]=(0,u.useState)(!1),[x,p]=(0,u.useState)({name:"",description:""}),f=a?.policies??[];return n?(0,c.jsx)(dw,{}):(0,c.jsxs)("div",{className:"space-y-3",children:[(0,c.jsxs)("div",{className:"flex items-center justify-between",children:[(0,c.jsxs)("div",{className:"flex items-center gap-2",children:[(0,c.jsx)(ll,{size:16,className:"text-red-400"}),(0,c.jsx)("h3",{className:"text-sm font-medium text-slate-200",children:"Custom Iron Dome Policies"}),(0,c.jsxs)("span",{className:"text-xs text-slate-500",children:[f.length,"/10"]})]}),(0,c.jsxs)("button",{onClick:()=>m(!h),className:"flex items-center gap-1 px-2 py-1 text-xs bg-red-600/20 text-red-400 rounded hover:bg-red-600/30 transition-colors",children:[(0,c.jsx)(or,{size:12})," Create Policy"]})]}),h&&(0,c.jsxs)("form",{onSubmit:e=>{e.preventDefault(),l.mutate({name:x.name,description:x.description,config:{}},{onSuccess:()=>{m(!1),p({name:"",description:""})}})},className:"p-3 bg-slate-800/50 rounded-lg space-y-2",children:[(0,c.jsx)("input",{value:x.name,onChange:e=>p(t=>({...t,name:e.target.value})),placeholder:"Policy name",required:!0,className:"w-full px-2 py-1.5 text-xs bg-slate-900 border border-slate-700 rounded text-slate-200 placeholder:text-slate-600"}),(0,c.jsx)("textarea",{value:x.description,onChange:e=>p(t=>({...t,description:e.target.value})),placeholder:"Description",rows:2,className:"w-full px-2 py-1.5 text-xs bg-slate-900 border border-slate-700 rounded text-slate-200 placeholder:text-slate-600 resize-none"}),(0,c.jsxs)("div",{className:"flex gap-2",children:[(0,c.jsx)("button",{type:"submit",disabled:l.isPending,className:"px-3 py-1 text-xs bg-red-600 text-white rounded hover:bg-red-500 disabled:opacity-50",children:l.isPending?"Creating...":"Create"}),(0,c.jsx)("button",{type:"button",onClick:()=>m(!1),className:"px-3 py-1 text-xs text-slate-400 hover:text-slate-200",children:"Cancel"})]}),l.error&&(0,c.jsx)("p",{className:"text-xs text-red-400",children:l.error.message})]}),r?(0,c.jsx)("div",{className:"text-xs text-slate-500 py-4 text-center",children:"Loading policies..."}):0===f.length?(0,c.jsx)("div",{className:"text-xs text-slate-500 py-4 text-center",children:'No custom policies yet. Click "Create Policy" to get started.'}):(0,c.jsx)("div",{className:"space-y-1",children:f.map(e=>(0,c.jsxs)("div",{className:"flex items-center gap-3 px-3 py-2 bg-slate-800/30 rounded text-xs",children:[(0,c.jsxs)("div",{className:"flex-1",children:[(0,c.jsxs)("div",{className:"flex items-center gap-2",children:[(0,c.jsx)("span",{className:"text-slate-200 font-medium",children:e.name}),1===e.is_active&&(0,c.jsx)("span",{className:"px-1.5 py-0.5 rounded bg-green-500/20 text-green-400 text-[10px] font-medium",children:"Active"})]}),e.description&&(0,c.jsx)("p",{className:"text-slate-500 text-[10px] mt-0.5",children:e.description})]}),!e.is_active&&(0,c.jsxs)("button",{onClick:()=>d.mutate(e.id),className:"flex items-center gap-1 px-2 py-1 text-[10px] bg-green-600/20 text-green-400 rounded hover:bg-green-600/30",title:"Set active",children:[(0,c.jsx)(oF,{size:10})," Activate"]}),(0,c.jsx)("button",{onClick:()=>o.mutate(e.id),className:"text-slate-500 hover:text-red-400",children:(0,c.jsx)(on,{size:12})})]},e.id))})]})}function dw(){return(0,c.jsxs)("div",{className:"space-y-3",children:[(0,c.jsxs)("div",{className:"flex items-center gap-2",children:[(0,c.jsx)(ll,{size:16,className:"text-red-400"}),(0,c.jsx)("h3",{className:"text-sm font-medium text-slate-200",children:"Custom Iron Dome Policies"}),(0,c.jsx)("span",{className:"text-xs text-slate-500",children:"0/10"})]}),(0,c.jsx)("div",{className:"space-y-1",children:om.map(e=>(0,c.jsx)("div",{className:"flex items-center gap-3 px-3 py-2 bg-slate-800/30 rounded text-xs",children:(0,c.jsxs)("div",{className:"flex-1",children:[(0,c.jsxs)("div",{className:"flex items-center gap-2",children:[(0,c.jsx)("span",{className:"text-slate-200 font-medium",children:e.name}),e.is_active&&(0,c.jsx)("span",{className:"px-1.5 py-0.5 rounded bg-green-500/20 text-green-400 text-[10px] font-medium",children:"Active"})]}),(0,c.jsx)("p",{className:"text-slate-500 text-[10px] mt-0.5",children:e.description})]})},e.id))})]})}function dN(){return(0,c.jsx)("div",{className:"bg-slate-900/50 border border-slate-800 rounded-xl p-4",children:(0,c.jsx)(od,{feature:"custom_iron_dome_policies",label:"Create custom Iron Dome policies with tailored action gates and trust levels.",children:(0,c.jsx)(dj,{})})})}let dk=[{id:"personal",label:"Personal",description:"Lighter touch for solo use",icon:ll},{id:"enterprise",label:"Enterprise",description:"Financial & data protection",icon:l7},{id:"school",label:"School",description:"GDPR strict, pupil data guarded",icon:lm},{id:"paranoid",label:"Paranoid",description:"Everything requires approval",icon:ld}],dS=[{name:"Injection Scanner",description:"40+ patterns across 8 categories",icon:dx},{name:"Instruction Gateway",description:"Trusted channel validation",icon:dh},{name:"Action Gate",description:"Approve / block external actions",icon:l7},{name:"PII Guard",description:"Block sensitive data output",icon:lb},{name:"Kill Switch",description:"Emergency stop phrase",icon:dm},{name:"Sub-Agent Control",description:"Restrict spawned agent operations",icon:lm}],dC={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"},dT={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 dP(){let e,t,{data:s,isLoading:i}=lJ(),{data:a}=lZ(50),r=(e=(0,n0.useQueryClient)(),(0,n6.useMutation)({mutationFn:e=>lH(e),onSuccess:()=>{e.invalidateQueries({queryKey:["iron-dome-status"]}),e.invalidateQueries({queryKey:["iron-dome-audit"]})}})),n=(t=(0,n0.useQueryClient)(),(0,n6.useMutation)({mutationFn:lX,onSuccess:()=>{t.invalidateQueries({queryKey:["iron-dome-status"]})}})),l=(0,n6.useMutation)({mutationFn:lY}),[o,d]=(0,u.useState)(""),[h,m]=(0,u.useState)(null),x=s?.enabled??!1,p=s?.profile,f=s?.config,g=a?.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)(lp,{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 ${x?"bg-red-500/20 text-red-400 border border-red-500/30":"bg-slate-700/50 text-slate-500"}`,children:x?"ACTIVE":"INACTIVE"})]}),x&&(0,c.jsxs)("button",{onClick:()=>{n.mutate()},disabled:n.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:[n.isPending?(0,c.jsx)(lE,{size:12,className:"animate-spin"}):(0,c.jsx)(dm,{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:dk.map(({id:e,label:t,description:s,icon:i})=>(0,c.jsxs)("button",{onClick:()=>{r.mutate(e)},disabled:r.isPending,className:`text-left p-3 rounded-lg border transition-colors ${p===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:dS.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:x?"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 ${x?"bg-red-400":"bg-slate-600"}`})]},e))})]})]}),x&&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)(dx,{size:14,className:"inline mr-1.5 text-red-400"}),"Injection Scanner"]}),(0,c.jsx)("textarea",{value:o,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:()=>{o.trim()&&l.mutate(o,{onSuccess:e=>m(e)})},disabled:l.isPending||!o.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:[l.isPending?(0,c.jsx)(lE,{size:12,className:"animate-spin"}):(0,c.jsx)(lp,{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)(lD,{size:14,className:"text-green-400"}):(0,c.jsx)(l$,{size:14,className:"text-red-400"}),(0,c.jsx)("span",{className:`text-[10px] font-medium px-2 py-0.5 rounded-full ${dT[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 ${dC[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)(ll,{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))})]})]}),(0,c.jsx)("div",{className:"mt-4",children:(0,c.jsx)(dv,{})}),(0,c.jsx)("div",{className:"mt-4",children:(0,c.jsx)(dN,{})})]})}let dA=(0,rP.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..."})})}),dM=(0,rP.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 dE(){let e,[t,s]=(0,u.useState)(""),[i,a]=(0,u.useState)(!1),[r,n]=(0,u.useState)(!1),[l,o]=(0,u.useState)(void 0),[d,h]=(0,u.useState)(void 0),m=(0,u.useRef)(null),x=(0,u.useRef)(null),p=rE(t,300),{viewMode:f,selectedMemory:g,setSelectedMemory:y,selectedAuditEntry:v,setSelectedAuditEntry:b,projectFilter:j,setProjectFilter:w,addEvent:N}=(0,rM.useDashboardStore)(),{data:k=[]}=(e=rE(t,200),(0,rD.useQuery)({queryKey:["suggestions",e],queryFn:()=>rR(e),enabled:e.length>=2,staleTime:3e4,refetchOnWindowFocus:!1})),{data:S}=(0,rA.useProjects)();(0,u.useEffect)(()=>{let e=e=>{x.current&&!x.current.contains(e.target)&&m.current&&!m.current.contains(e.target)&&a(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);let{data:C=[],isLoading:T,isConnected:P,lastEvent:A}=(0,rA.useMemoriesWithRealtime)({limit:1e3,query:p||void 0,mode:p?"search":"recent",project:j||void 0,type:l,category:d}),{data:E,isLoading:D}=(0,rA.useStats)(j||void 0),{data:L=[]}=(0,rA.useMemoryLinks)(j||void 0),F=(0,u.useRef)(A);(0,u.useEffect)(()=>{!A||A===F.current||(F.current=A,new Set(["memory_created","memory_accessed","memory_updated","memory_deleted","consolidation_complete","decay_tick"]).has(A.type)&&N({type:A.type,timestamp:A.timestamp,data:A.data}))},[A,N]);let R=(0,rA.useAccessMemory)();(0,rA.useConsolidate)();let{data:V}=(0,rA.useControlStatus)();(0,rA.usePauseMemory)(),(0,rA.useResumeMemory)();let $=V?.paused??!1,{data:z}=l2(),_=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)(ll,{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)(lA,{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)(nH,{ref:m,type:"text",placeholder:"Search memories...",value:t,onChange:e=>{s(e.target.value),a(!0)},onFocus:()=>a(!0),onKeyDown:e=>{"Escape"===e.key&&a(!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:x,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),a(!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)(nQ,{variant:"outline",size:"sm",onClick:()=>n(!r),className:`border-slate-600 text-slate-300 hover:text-white hover:bg-slate-700 ${r?"bg-slate-700":""}`,title:"Filter memories by type and category",children:["Filters ",(l||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":P?"bg-green-500":"bg-yellow-500"}`,title:$?"Memory creation paused":P?"Real-time connected":"Polling mode"}),E?.total??C.length," memories"]})})]}),r&&(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:()=>o(l===e?void 0:e),className:`px-2 py-1 text-xs rounded-full transition-colors ${l===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))]}),(l||d)&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("div",{className:"w-px h-6 bg-slate-700"}),(0,c.jsx)("button",{onClick:()=>{o(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)(ly,{}),(0,c.jsx)(M,{mode:"wait",children:(0,c.jsxs)(rT.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)(ob,{}),"audit"===f&&(0,c.jsx)(oT,{}),"quarantine"===f&&(0,c.jsx)(oV,{}),"brain"===f&&(0,c.jsx)(dM,{memories:C,links:L,stats:E,isLoading:T}),"graph"===f&&(0,c.jsx)(dA,{memories:C,links:L,selectedMemory:g,onSelectMemory:I}),"agents"===f&&(0,c.jsx)(o6,{}),"skills"===f&&(0,c.jsx)(du,{}),"dome"===f&&(0,c.jsx)(dP,{}),"memories"===f&&(0,c.jsx)(n4,{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)(nZ,{memory:g,links:L,memories:C,onClose:()=>y(null),onReinforce:e=>{R.mutate(e)},onSelectMemory:O,isReinforcing:R.isPending,reinforceSuccess:R.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)(oL,{entry:v,onClose:()=>b(null),onViewMemory:e=>{b(null),O(e),rM.useDashboardStore.getState().setViewMode("memories")}})})]})]})}e.s(["default",()=>dE],23733)}]);
|